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
    • Recent
    • Tags
    • Users
    • Login

    c4d.EventAdd() [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 633 Views
    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 Offline
      Helper
      last edited by

      On 12/12/2014 at 09:03, xxxxxxxx wrote:

      I have a python tag from witch I run my script.
      To keep it simple say I use this:

      tip_enable = [1200]
             tip_disable = [1100,1300,1400]
              
             #enable morphs in Top_Morph
             for item in tip_enable:          
                 tip_L_01.GetFirstTag()[4000,item] = True
              
             #disable morphs in Top_Morph
             for item in tip_disable:          
                 tip_L_01.GetFirstTag()[4000,item] = False
                
             c4d.EventAdd()

      Now my problem is I want to work this from a Radio Button, but "c4d.EventAdd()" will keep on executing while that Radio Button is active. I want c4d to update only once even though the Radio Button is active.

      Is this possible???

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

        On 12/12/2014 at 10:04, xxxxxxxx wrote:

        Hello,

        can you explain what you mean with "work this from a Radio Button"? A Python tag's "main" function will be called every time the document or the host object will be calculated.

        Best wishes,
        Sebastian

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

          On 12/12/2014 at 18:41, xxxxxxxx wrote:

          Sorry Sebastian, what I meant was "Python Node"

          if cntrl_obj[c4d.ID_USERDATA,7] == 0: #Radio button
            
                 tip_enable = [1200]
                 tip_disable = [1100,1300,1400]
                  
                 #enable morphs in Top_Morph
                 for item in tip_enable:          
                      tip_L_01.GetFirstTag()[4000,item] = True
                  
                 #disable morphs in Top_Morph
                 for item in tip_disable:          
                      tip_L_01.GetFirstTag()[4000,item] = False
                    
                 c4d.EventAdd()

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

            On 15/12/2014 at 11:07, xxxxxxxx wrote:

            Hello,

            so if I understand you correctly you have a Python Xpresso node and want that some code only executes once after some userdata of some object was changed.

            I suggest that you could store the old value of your control parameter in another user data parameter of your control object. So you can check if the current value is different than the stored value. Also this way the stored value will be saved with the control object.

            Best wishes,
            Sebastian

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

              On 15/12/2014 at 19:39, xxxxxxxx wrote:

              Thanks Sebastian. I simply rescript to use "conditions" to run and stop my script

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

                On 16/12/2014 at 04:03, xxxxxxxx wrote:

                You should not call c4d.EventAdd() from Tag or Node. There should
                be no need for it. Please explain why you think you need it.

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

                  On 16/12/2014 at 04:46, xxxxxxxx wrote:

                  With English not my first language its hard to explain, but my objects did not want to update without the c4d.EventAdd(). With c4d.EventAdd() it worked fine but it kept on updating witch slowed things down. But after restructuring my script so that it only runs in certain conditions everything is fine now.

                  Thanks

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