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

    Cycle Buttons [SOLVED]

    SDK Help
    0
    3
    286
    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 02/08/2014 at 07:13, xxxxxxxx wrote:

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

      ---------
      I am having trouble getting cycle buttons to work in a generator plugin. 
      This is what I added in the res file

      	        LONG MYOBJECT_CYCLE
      	        {
      	            CYCLE
      	            {
      	                CYCLE_ITEM_1;
      	                CYCLE_ITEM_2;
      	                CYCLE_ITEM_3;
      	            }
      	        }
      

      The cycle list appears fine in the AM. 
      The problem is when I am try to access the buttons. This is the code that I am using:

      Bool MYOBJECT::Message(GeListNode *node, LONG type, void *data)
      {
      	switch (type)
      	{
      		case MSG_DESCRIPTION_COMMAND:
      		{
      			DescriptionCommand *dc = (DescriptionCommand* ) data;
      			if (dc->id[0].id == MYOBJECT_CYCLE)
      			{				
      				BaseContainer *bc = ((BaseObject* )node)->GetDataInstance();
      				if (!bc) return FALSE;
      				LONG item = bc->GetLong(MYOBJECT_CYCLE);
      				switch (item)
      				{
      					case CYCLE_ITEM_1:
      					GePrint("1");
      					break;
        
      					case CYCLE_ITEM_2:
      					GePrint("2");
      					break;
        
      					case CYCLE_ITEM_3:
      					GePrint("3");
      					break;   
        
      					default:
      					GePrint("default");
      					break;
      				}
      			}
        
      		}
        
      	}
        
        
      return TRUE;
      }
      

      Nothing gets printed. If I try to print  dc- >id[0].id I don't get anything.I am presuming that MYOBJECT_CYCLE is not getting recognized in the first place. 
      Anyone can shed a light on what I might be doing wrong?

      Thanks

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

        On 02/08/2014 at 10:54, xxxxxxxx wrote:

        MSG_DESCRIPTION_COMMAND only works with Buttons.  You should check using MSG_DESCRIPTION_CHECKUPDATE.

        case MSG_DESCRIPTION_CHECKUPDATE:
        	DescriptionCheckUpdate* dcu = static_cast<DescriptionCheckUpdate*>(data);
        	if (!dcu)
        		return TRUE;
        	BaseContainer* bc = op->GetDataInstance();
        	if (!bc)
        		return TRUE;
        	LONG id = (*(dcu->descid))[0].id;
        	LONG item = ...
        	...
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 02/08/2014 at 11:51, xxxxxxxx wrote:

          Works like a charm. Thanks a lot (again) Robert!

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