TagData::Draw() Not Being Called



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

    On 15/01/2009 at 04:52, xxxxxxxx wrote:

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

    ---------
    I've created a TagData plugin which draws 3D lines and handles on an object linked via the tag's link box. When op has its editor mode set to off, Draw() is not being called. The same happens if op's editor visibility is turned off by a parent.

    Execute() is being called and I've tried forcing a redraw from there but to no avail. The OM hierarchy position of the linked object makes no difference.

    This is probably something obvious but I haven't been able to find a solution in the SDK or forum archive.

    Any help would be appreciated.



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

    On 15/01/2009 at 05:13, xxxxxxxx wrote:

    Quote: _When op has its editor mode set to off, Draw() is not being called. The same happens if op's editor visibility is turned off by a parent.
    >
    > * * *
    _


    What is op, the object the tag is attached to or the object in the tag's link field?

    cheers,
    Matthias



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

    On 15/01/2009 at 05:39, xxxxxxxx wrote:

    It's the host object of the tag. I want to be able to hide this but still have the linked object and drawn elements visible.



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

    On 16/01/2009 at 07:17, xxxxxxxx wrote:

    Ok, it is currently not possible. The object switches of the drawing pipeline for all attached tags if you disable it for editor display.

    cheers,
    Matthias



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

    On 16/01/2009 at 08:14, xxxxxxxx wrote:

    Howdy,

    Have you tried using a SceneHookData plugin to do the drawing? ;o)

    Adios,
    Cactus Dan



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

    On 16/01/2009 at 18:38, xxxxxxxx wrote:

    Quote: Originally posted by Matthias Bober on 16 January 2009
    >
    > * * *
    >
    > Ok, it is currently not possible. The object switches of the drawing pipeline for all attached tags if you disable it for editor display.
    >
    >
    > * * *

    I'd suspected that this might be the case. Thanks for the confirmation.

    > Quote: Originally posted by Cactus Dan on 16 January 2009
    >
    > * * *
    >
    > Have you tried using a SceneHookData plugin to do the drawing? ;o)
    >
    >
    > * * *

    Thanks for the suggestion. I saw your post on drawing joints when searching the archive.

    I've had similar issues with the 3D functions, so SceneHookData is an appealing option for this reason alone. If it solves the editor visibility issue, better still.

    Anyway, I've successfully registered a SceneHookData plugin using the example posted previously by Matthias. Now I just have to get my head around integrating it with the TagData plugin.

    I'll post an update when I get there.



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

    On 17/01/2009 at 08:12, xxxxxxxx wrote:

    Howdy,

    Keep in mind that you can call any function of a TagData class by getting the NodeData with the GeListNode::GetNodeData() function and casting it to your tag's plugin class:

    > // Get NodeData from BaseTag \*tag and cast to MyPluginTag \> MyPluginTag \*pTag = static_cast<MyPluginTag\*>(tag->GetNodeData()); \> \> // Call TagData::Draw() function of MyPluginTag \*pTag \> pTag->Draw(tag,tag->GetObject(),bd,bh);

    Adios,
    Cactus Dan



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

    On 17/01/2009 at 08:26, xxxxxxxx wrote:

    Quote: _Keep in mind that you can call any function of a TagData class by getting the NodeData with the GeListNode::GetNodeData() function and casting it to your tag's plugin class
    >
    > * * *
    _


    Please be very careful with that as it can lead to crashes. Here a quote from the developer kitchen technotes:

    • This Virtual Function Call will crash:

    > \> PluginVideoPost \*node; \> for (node = renderdata- >GetFirstVideoPost(); node; node=node->GetNext()) \> { \>      VideoPostData \*pVPData = (VideoPostData\*=)node->GetNodeData(); \>      LONG info = pVPData->GetRenderInfo(); \> } \>

    • Beware of calling NodeData members!
    • pVPData can be NULL, check necessary
    • A plugin is not allowed to use the virtual function table of another plugin! This will only work with the same plugin, not over plugin boundaries
    • To avoid crashes call above must be replaced by

    > \> PluginVideoPost \*node; \> for (node = renderdata->GetFirstVideoPost(); node; node=node->GetNext()) \> { \>      VideoPostData \*pVPData = (VideoPostData\*=)node->GetNodeData(); \>      if (!pVPData) continue; \>      LONG info = ((pVPData->\*((VIDEOPOSTPLUGIN\* )C4DOS.Bl->RetrieveTableX(pVPData,0))->GetRenderInfo)(node); \> } \>

    cheers,
    Matthias



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

    On 17/01/2009 at 08:40, xxxxxxxx wrote:

    Howdy,

    Yes, sorry about that.

    As Matthias stated, it is very important to always check that a class pointer is valid before accessing any of it's member functions.

    You would certainly want to change this:

    > pTag->Draw(tag,tag->GetObject(),bd,bh);

    ... to this:

    > if(pTag) \> { \>      pTag->Draw(tag,tag->GetObject(),bd,bh); \> }

    .. in my example above. ;o)

    Adios,
    Cactus Dan



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

    On 18/01/2009 at 14:13, xxxxxxxx wrote:

    Thanks for the information, this should be useful in getting things orchestrated. And I'll be sure to use a prophylactic with the class pointer.

    I'll have time to dive back into this at the end of the week, so I may have some questions then.


Log in to reply