Returning a GetClone() weirdness



  • On 08/11/2013 at 11:50, xxxxxxxx wrote:

    Super simple python in a Generator in R14. I added a userdata for the object, and one 'real' numbers

    For some reason it doesn't seem to refresh properly. and when the real number Userdata updates it dissapears. Any ideas as to what I'm missing?

      
    import c4d
      
    def main() :
        someUserData = op[c4d.ID_USERDATA,2]
        obj = op[c4d.ID_USERDATA,1
      
        obj2 = obj.GetClone()
        obj2.Message (c4d.MSG_UPDATE)
      
        return obj2
      
    
    

    Thanks for your patience, I'm learning : )
    Chris



  • On 08/11/2013 at 20:37, xxxxxxxx wrote:

    obj = op[c4d.ID_USERDATA,1 need ]

    try to have console open while using python generator to view the error origin.

    Ok tested in r14, not refreshing in the view but using http://code.vonc.fr/?a=36 script on the python generator return the sphere with desired radius.

    working file:

    https://www.dropbox.com/s/ufdzx7pgl30748h/plugincafe_weirdclone_09_11_2013.c4d



  • On 11/11/2013 at 09:22, xxxxxxxx wrote:

    Hi Focus3D,
    Thanks for reply. I've opened your file, but it has the exact same problem. For instance, if you turn off the Python Generator then back on again, the sphere doesn't appear until another refresh. Tested in R14 and 15. Any thoughts?

    Also I do keep the console open, it just doesn't return any errors on this one.
    Thanks again.



  • On 11/11/2013 at 09:56, xxxxxxxx wrote:

    c4d.EventAdd()

    right ?
    d



  • On 11/11/2013 at 09:58, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    c4d.EventAdd()

    right ?
    d

    Never from an Expression/Generator/or alike. It could lock C4D in an unconditional loop of refreshes.

    It works when you put the generator before the sphere in the hierarchy. Waiting for an answer from
    the devs.

    Best,
    -Niklas



  • On 11/11/2013 at 11:11, xxxxxxxx wrote:

    Got an answer. It's quite easy, the bits of the clone need to be reset. The easiest way is to pass
    c4d.COPYFLAGS_NO_BITS to GetClone().

    >     obj = op[c4d.ID_USERDATA,1].GetClone(c4d.COPYFLAGS_NO_BITS)

    Best,
    -Niklas



  • On 11/11/2013 at 12:54, xxxxxxxx wrote:

    Never would have figured that out in a million years. Thanks fellas!



  • On 13/11/2013 at 07:55, xxxxxxxx wrote:

    @Niklas,

    nice one, thanks.


Log in to reply