Copying All Compatible Properties from One Object to Another?



  • Hi,

    Is there a preferred way of copying all compatible object properties from an object of one type, to an object of another type? Things, I'm thinking of:

    • Name
    • Matrix
    • Layers
    • Visibility
    • Tags
    • Animation
    • Compatible Properties / Animation - So probably, PSR, but maybe also Visibility or Time Tracks, etc.

    I think I know how to approach this manually, but don't want to duplicate efforts if there's an API method, or existing snippet that does this as I'm afraid of leaving out something critical, and/or future proofing against future API additions.
    Thanks!

    Donovan



  • Realizing I never responded to this Thank you @m_magalhaes, @mikegold10, and @PluginStudent.

    I ended up manually making a list of the parameters I wanted to copy and iterating through all of them. Not ideal, but at least glad to know there wasn't an automated method I was missing.



  • Hi,

    as you may know, if the object's type were the same you could use CopyTo
    But in your case, there's no builtin function do to it.

    I've checked how it's done for external compositing programme and there's nothing helpfull.

    Cheers,
    Manuel



  • @m_magalhaes said in Copying All Compatible Properties from One Object to Another?:

    Hi,

    as you may know, if the object's type were the same you could use CopyTo
    But in your case, there's no builtin function do to it.

    I've checked how it's done for external compositing programme and there's nothing helpfull.

    Cheers,
    Manuel

    What about copying data from the BaseContainer of the source object to the destination object only if the ids in the source BaseContainer are relevant and/or are already present in the destination object's BaseContainer (i.e., copy only those key/value pairs that are applicable to the destination)?



  • @mikegold10 said in Copying All Compatible Properties from One Object to Another?:

    What about copying data from the BaseContainer

    There is no guarantee that all relevant data is stored in the BaseContainer.



  • hi,

    as @PluginStudent said, not everything is stored on the BaseContainer

    There's a lot of things to think when you are exporting to an external application if you want to replicate the scene the right way.
    For example, what about, if in Cinema 4D the camera is shifted ?

    Cheers,
    Manuel



  • Realizing I never responded to this Thank you @m_magalhaes, @mikegold10, and @PluginStudent.

    I ended up manually making a list of the parameters I wanted to copy and iterating through all of them. Not ideal, but at least glad to know there wasn't an automated method I was missing.


Log in to reply