Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Synchronize parameters in Tag and object

    SDK Help
    0
    2
    261
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post