Synchronize parameters in Tag and object



  • On 31/08/2016 at 05:43, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R17 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello.

    I have a TagData plugin, which can be applied on light objects.
    There are some parameters though in Tag and Light that i want them to have the same value.
    The reason why I need this is because  I don't want the user to switch from tag to light all the time. So basically, I duplicate some light parameters inside the tag to keep the light parameterization in one place, which is the tag.

    To do that, I declare the tag as Expression.
    The synchronization takes place in Execute and SetDParameter methods of the tag.
    Whenever the light object is modified, the execute is called and synchronizes the tag.
    Also, when the tag is modified, it changes the light's parameters as well.

    The problem is that the Execute method is called even though the light object is not modified.
    I click around the viewport and the Execute method runs.
    How can I prevent that ?

    Or what's the best way to synchronize 2 parameters in a tag and object?

    To set the parameters in tag or light, I use c4d_atom.SetParameter(......).

    Thank you for your time.



  • On 01/09/2016 at 01:42, xxxxxxxx wrote:

    Hello,

    I'm not aware of any official way to synchronize parameters in such a way so I'm afraid there is no "best" way.

    The Execute () function of a tag is called every time the scene is – well – executed. So this behaviour is correct, you can't prevent that. If you want to update the parameters on the tag only when the parameters on the object have changed you would have to check for this situation inside your Execute () function.

    Best wishes,
    Sebastian


Log in to reply