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

    Coffeetag: Global variables

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 268 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 10/01/2011 at 06:40, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:      
      Language(s) :

      ---------
      Hi,

      my global variables get set to null when e.g. using the extrude tool on op.
      Same thing when i undo a Change of the mesh of op.
      How can i prevent from this ?

      thanks, nux

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 14/01/2011 at 05:25, xxxxxxxx wrote:

        You can't prevent this for the COFFEE tag. You have to use a ExpressionPluginTag. There you can store the values in a member variable. To keep the data of the member variable intact you also need to override the Copy Save and Load methods of the base class.

        Here is a simple example showing the concept. The variable text is my 'global' variable.

          
        class MyExpressionPluginTag : ExpressionPluginTag  
        {  
          var text;  
            
          public:  
              MyExpressionPluginTag();  
          
              GetID();  
              MultipleAllowed();  
              DisplayAllowed();  
              GetHelpText();  
              UseMenu();  
              GetName();  
              Edit();  
              Execute(doc, op);  
                
              Copy(dest);  
              Save(hf);  
              Load(hf);  
        }  
          
        MyExpressionPluginTag::MyExpressionPluginTag()   
        {  
          // Call the parent constructor  
          super();   
        }  
          
        MyExpressionPluginTag::GetID()                 
        {   
          return 1025002;  
        }  
          
        MyExpressionPluginTag::MultipleAllowed()       
        {   
          return FALSE;  
        }  
          
        MyExpressionPluginTag::DisplayAllowed()        
        {  
          return TRUE;  
        }  
          
        MyExpressionPluginTag::GetHelpText()           
        {   
          return "test";  
        }  
          
          
        MyExpressionPluginTag::UseMenu()   
        {  
          return TRUE;  
        }  
          
        MyExpressionPluginTag::GetName()   
        {  
          return "test";  
        }  
          
        MyExpressionPluginTag::Edit()  
        {  
        }  
          
        MyExpressionPluginTag::Execute(doc, op)  
        {  
          if (text == nil) text = "hello";  
          else text = "world";  
            
          println(text);  
        }  
          
        MyExpressionPluginTag::Copy(dest)  
        {  
          //copy variable to destination  
          dest->text = text;  
        }  
          
        MyExpressionPluginTag::Load(hf)  
        {  
          if (text != nil) text = hf->ReadString();  
        }  
          
        MyExpressionPluginTag::Save(hf)  
        {  
          if (text != nil) hf->WriteString(text);  
        }  
          
          
        main()  
        {  
          Register(MyExpressionPluginTag);  
        }  
        

        cheers,
        Matthias

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 14/01/2011 at 10:17, xxxxxxxx wrote:

          I already thought about using a real Plugin, but i wanted to be able to use the Attributesmanager, and no dialog. Is it not possible to implement such functionality to COFFEE or does Maxon just not have the time for it ? 💡

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