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

    allow tag only on special kind of object

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 698 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 22/01/2010 at 01:10, xxxxxxxx wrote:

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

      ---------
      Is it possible, that my tag can only be added to a special kind of object (nullobject for example)?

      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 22/01/2010 at 02:04, xxxxxxxx wrote:

        No, that's not possible.

        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 24/01/2010 at 08:43, xxxxxxxx wrote:

          Howdy,

          You could make your tag check for the type of object it is on, and if it's not a specific type of object, have the tag do nothing.

          For example you could add this at the top of your Execution() function:

            
          if(!op->IsInstanceOf(Onull)) return EXECUTION_RESULT_USERBREAK;   
          

          Adios,
          Cactus Dan

          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 25/01/2010 at 01:02, xxxxxxxx wrote:

            I thought of something like that, but in this case, the tags are just placeholders for export information. I tried to simply disable the input boxes (in GetDDescription), but couldn't figure out how to get the objecttype of the object the tag is attached to.
            GeListeNode->GetUp/Down didn't do the trick.

            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 09/01/2011 at 06:21, xxxxxxxx wrote:

              I Don't understand why it should not be possible.

              Which language ? In COFFEE i would do it like this:

              if(!instanceof(op,NullObject) {
              tagplugintag = op->GetFirstTag();
              while (tagplugintag && instanceof(tagplugintag,TAGPLUGIN_ID) {
                  tagplugintag = tagplugintag->GetNext();
              }
              tagplugintag->Remove();
              }

              Why should this not work ? Just tipped this in a few seconds and couldnt test it.

              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 09/01/2011 at 09:00, xxxxxxxx wrote:

                It can be done that way, nux95, but best from a SceneHook plugin (something to keep track of the scene).  In other words, it is impossible for the tag to remove itself unless you really like crashing C4D. 🙂

                If you go that route then it might also be worthwhile to open a dialog explaining that the tag was removed for that reason so that the user doesn't go batty wondering why the tag keeps disappearing on certain objects.

                Also, I would use a for loop and do it this way (assuming C++), especially if multiple instances of the tag are possible on an object:

                if (!op->IsInstanceOf(Onull))  
                {  
                  BaseTag*    ntag =    NULL;  
                  for(BaseTag* tag = op->GetFirstTag(); tag; tag = ntag)  
                  {  
                      ntag =    tag->GetNext();  
                      if (tag->IsInstanceOf(MYPLUGINTAG_ID))  
                      {  
                          tag->Remove();  
                          PluginTag::Free(tag);  
                      }  
                  }  
                }
                
                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 09/01/2011 at 09:14, xxxxxxxx wrote:

                  Hello,
                  the cinema 4d crash is because you have to place the the op control in the right place.
                  if you make it in init of your tag cinema crash because the tag is not yet inserted in the document and not attached on the op.
                  if you place your control code in message on type MSG_MENUPREPARE you can do it very simply
                  i used it in TakeTool To ensure the user to use taketool tags only on correct objects.

                  here an example :
                  Bool LookAtCamera::Message(GeListNode* node, LONG type, void* data)
                  {
                       if ( type == MSG_MENUPREPARE)
                       {
                            BaseObject * op = ((BaseTag* )node)->GetObject();
                            if (op->GetType() != Ocamera) return FALSE;
                       }
                       return TRUE;
                  }

                  all the best
                  Franz

                  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 17/02/2011 at 03:24, xxxxxxxx wrote:

                    Wow thanks very much, that's perfect 🙂

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