Parent object for Tag?



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

    On 09/06/2004 at 03:37, xxxxxxxx wrote:

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

    ---------
    Hi all,
    I've got a custom plugin tag which inherits from TagData.
    In its GUI in the attrib panel it has some buttons which trigger methods. These methods need to know the parent object for the tag, but I can't figure out how to get it.

    The Execute method isn't called for a button press.
    Get() returns the current tag.
    Get()->GetUp() returns NULL
    Get()->GetListHead()->GetFirst() returns the first tag for the object.

    I note that BaseTag has a GetObject() method, but I don't really understand the relationship between BaseTag and TagData. (I tried inheriting from both, but the compiler really didn't like that)

    So, how do I retrieve the object containing the tag?
    I'm sure there must be an easy way, but I can't find it...

    Cheers - Steve



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

    On 09/06/2004 at 03:46, xxxxxxxx wrote:

    You basically was going in the right direction

        
        
        
        
           BaseObject *op = tag->GetObject();  
           if(op)  
            GePrint(op->GetName());
        
        
        
    


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

    On 09/06/2004 at 07:03, xxxxxxxx wrote:

    That's what I was thinking, but TagData doesn't have a 'GetObject()' method...

    BaseTag does, but the SDK docs say that Tag plugins should inherit from TagData, not BaseTag.

    In fact, BaseTag and TagData are in unrelated hierarchies.

    Should I be deriving from BaseTag instead of TagData?

    Cheers - Steve



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

    On 09/06/2004 at 15:10, xxxxxxxx wrote:

    Whoops my bad sorry, just I recently used tag->GetObject() but forgot that tag was infact a BaseTag and not a TagData.
     
    I may be wrong here (as usual :)) but a BaseTag represents a tag, while TagData represents a tag type plugin
     
    Same reason why an ObjectData is not related to a BaseObject. One is an actual object, the other is represents a plugin type.
     
    Where do you need to access this host object from? there are two method for a TagData that automatically pass the host object.

        
        
        
        
        virtual Bool Draw(PluginTag* tag, BaseObject* op, BaseDraw* bd, BaseDrawHelp* bh);  
        virtual LONG Execute(PluginTag* tag, BaseDocument* doc, BaseObject* op, BaseThread* bt, LONG priority, LONG flags);
        
        
        
    

    Perhaps you could take advantage of that



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

    On 10/06/2004 at 12:24, xxxxxxxx wrote:

    Hmmm, it's seeming increasingly likely that I'm going about this in completely the wrong way, as things just seem to be getting excessively complex...

    Here's what I'm doing:

    I've got a custom tag plugin derived from TagData.

    I override the Message method, and if I receive a message of type == MSG_DESCRIPTION_COMMAND and dtype == DTYPE_BUTTON, I look at 'id' to determine which button in the attrib panel has been pressed, and call an appropriate method (I've got a four button attrib panel defined and working).

    The method called needs to know the object holding the tag, which is what I'm trying to solve.

    The 'Execute' method that you suggested doesn't get called when these buttons are pressed.

    The 'Draw' method does get called regularly, but again, not when the buttons are pressed. I could store the object passed by Draw in a member variable, and then access that in the other methods, but this sounds like a very ugly way of doing it.

    (What I'm actually trying to implement is something that acts similar to, and uses the same four button interface in the attrib panel as, a selection tag.)

    I'm guessing that I should be using 'PluginTag' (derived from BaseTag, which I've just noticed!) rather than TagData.

    The reason I've been trying to use TagData is because that's the one listed under 'Plugin Types' in the documentation...

    Cheers - Steve



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

    On 11/06/2004 at 03:13, xxxxxxxx wrote:

    Simply call this in your message function.
    BaseTag* tag = static_cast<BaseTag*>(node);
    BaseObject* op = tag->GetObject();



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

    On 12/06/2004 at 07:36, xxxxxxxx wrote:

    Aha, thanks Samir, that works perfectly!

    Cheers - Steve


Log in to reply