Adding Xref to PyGen, crashing of c4d

On 06/12/2016 at 07:58, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   17, 18 
Platform:   Windows  ;   
Language(s) :       PYTHON  ;

Hello, small back to c4d
I tried for friend  to make small clonner based at interactive xref-ops.

If add Xref by op.SetParameter(c4d.ID_CA_XREF_FILE, 'xref.c4d', c4d.DESCFLAGS_SET_USERINTERACTION), in py-gen op. It crashed c4d.

If normally add by console or script, all are ok.

import c4d  
import random  
def main() :  
  null = c4d.BaseObject(c4d.Onull)  
  if Frame == 0:  
      i = 1  
      while i < 5:  
          i = i + 1  
          testop = c4d.BaseObject(c4d.Oxref)  
          testop.SetAbsPos(c4d.Vector(i*400, 0, 0))  
          testop.SetParameter(c4d.ID_CA_XREF_GENERATOR, True, c4d.DESCFLAGS_SET_USERINTERACTION)  
          testop.SetParameter(c4d.ID_CA_XREF_FILE, 'xref.c4d', c4d.DESCFLAGS_SET_USERINTERACTION)  
          testop.SetParameter(c4d.ID_CA_XREF_OFFSET, c4d.BaseTime(random.uniform(0.0, 1.0)), c4d.DESCFLAGS_SET_USERINTERACTION)  
  return null

On 07/12/2016 at 02:22, xxxxxxxx wrote:

The thing is, you are doing user interaction stuff during execution of the scene pipeline (that's where the Python Generator code is being executing). No, user interaction is allowed in such places (see Threading Information).
On the other hand, Cinema shouldn't crash, but handle the situation gracefully. I'll look into it and post a bug report.

On 07/12/2016 at 03:58, xxxxxxxx wrote:

Hello Andreas
Thank you
I decided to use for test small part of code by scripting py-gen op and xrefs. Failed at some moments.
Will try to code in plug-in "body". maybe need to use own scheme of xref functionality(i read over forum, it is useless thing)