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

    NodeData Init()

    SDK Help
    0
    4
    410
    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 13/04/2014 at 13:56, xxxxxxxx wrote:

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

      ---------
      I was wondering why the virtual Init() function is called more than just when the plugin is instantiated..

      For example when i run my plugin, change a value or press a button in its properties, it fires Init()..  It also only fires it the first time - so for example if i change a specific value three times, it only firse Init() the first time, then if i hit a DIFFERENT button, it fires Init(), and i can then go back and change the first value and again itll fire Init() the first time the value is changed..

      Can anybody explain the reason for this or logic behind it?

      Having trouble with an INEXCLUDE that only seems to update after a call to Init(), trying to get to the bottom of it..

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

        On 13/04/2014 at 21:49, xxxxxxxx wrote:

        Init() is always called when an instance of your plugin is created. An
        undo step is added when you change a value of your node. That will
        call Init() on a different NodeData.

        -Niklas

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

          On 14/04/2014 at 13:44, xxxxxxxx wrote:

          Cheers Niklas..  The GePrint("Init()") i have at the start of my Init override is displaying in the console every time it fires - i would assume from that that it is running my Init override, no?

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

            On 17/04/2014 at 14:42, xxxxxxxx wrote:

            Yes, it is your plugin class that is invoked, but another instance of it. Check the memory address
            of the "this" pointer when Init() is called. Basically, what happens when an undo is created, is that
            a copy of your object/tag/material is created and that requires the NodeData subclass to be
            initialized with Init().

            Best,
            -Niklas

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