Copy All Parameters of One Object to Another in Real Time?



  • HI,

    Is there a way Copy All Parameters of One Object to Another in Real Time?
    Basically, an instance. I would use the instance object but it does not work for emitter.

    You can see the problem here:
    https://www.dropbox.com/s/s5wi1dhq1tysy0d/c4d290_python_copy_all_parameters_in_real_time.mp4?dl=0

    Regards,
    Ben



  • Hi,

    You need to add an object as child of the emitter and activate the "show object" options. Than, you have to change the mode of the Instance to "Render Instance".

    If it doesn't work for your need, we will see what we can do in code with InstanceObject

    The "problem" is that some data can be stored in various way. That could be an issue at the end :)

    Cheers,
    Manuel



  • Hi,

    @bentraje said:

    Is there a way Copy All Parameters of One Object to Another in Real Time?

    I assume with copying in realtime, you actually mean copying dynamically, i.e. establish an ongoing one way linkage from the parameters of one object to the other.

    The continuous execution would have to be done by yourself, but you can copy one object to another with c4d.C4DAtom.CopyTo and one data container to another with c4d.BaseContainer.CopyTo. The one to choose depends on what you would consider the parameters of an object. If you would only consider elements of the description parameters, i.e. "the gui values", then copying the data container will be enough. If your definition of parameters is broader, you will have to copy the whole node.

    But I doubt that you can copy the internal state of a particle system. I do not think that there is a particular technical reason that would prevent that, it just strikes me as an odd feature, so I might be wrong about that, never have tested that.

    Cheers,
    zipit



  • Thanks for the response

    @m_magalhaes
    Oh thanks. It now works on native c4d emitter but not in xparticles emitter.
    No worries, the solution by @zipit works

    @zipit

    Thanks. It works as expected. Here's the code I used added in a python tag

        orig = doc.SearchObject("original")
        dup = doc.SearchObject("duplicate")
        
        orig_container = orig.GetDataInstance()
        orig_container.CopyTo(dup.GetDataInstance(), flags= c4d.COPYFLAGS_PRIVATE_CONTAINER_COPY_IDENTICAL, trans=None)
    
        c4d.EventAdd()
    

Log in to reply