Testing Expression Plugin Tag Parent Class

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 01 January 2007   #1
Testing Expression Plugin Tag Parent Class

When I test an expression plugin tag by printing 'instanceof(tag, ExpressionPluginTag)', the result is '1' for the tag itself. However, when I use the same tag to test other expression plugin tags, the result is '0'. If I test the original tag from e.g. a COFFEE tag, the result is now '0'.

It seems that an expression plugin tag will correctly identify its own parent class using 'instanceof' but will give a false result for other tags of the same type. I'm wondering why this happens and whether this test can be reliably used when connecting an expression plugin tag with its User Data.
 
Old 01 January 2007   #2
For a regular COFFEE Tag to check if it is the one you are after, the only way (that I know of) is to check its name.
So you would then try search such as:

GetFirstTag(obj,name)
{
var tag = obj->GetFirstTag();
while (tag){
if (tag->GetName() == tostring(name)) return tag;
tag = tag->GetNext();
}
return NULL;
}

main(doc,op)
{

var ttag = GetFirstTag(op,"MyName");
if(!ttag)
return;

var myuserdata = ttag#ID_USERDATA:1;

if(!myuserdata) return
}


But I assume you are going to use "real" expression tags, so then you need a unique
ID to search for.
Either use the test range (1000001 to 1000010 I think, check SDK) or better get you own unique ID at PluginCafe.

So then it is:

GetFirstTag(obj,type)
{
var tag = obj->GetFirstTag();
while (tag){
if (tag->GetType() == type) return tag;
tag = tag->GetNext();
}
return NULL;
}

 
main(doc,op)
{
var ttag = GetFirstTag(op, ID);
if(!ttag) return;
var myuserdata = ttag#ID_USERDATA:1;
}


Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools

Last edited by tcastudios : 01 January 2007 at 10:11 PM. Reason: Making the code actually work:)
 
Old 01 January 2007   #3
Lennart, this works nicely.

Thanks for taking the time to arrange the code for me. I didnít realise that GetType() could be used with a plugin ID in this way - very useful.

This is for the Symmetry Clamp expression plugin tag. Iím planning to add User Data and present the tag for setting up via a scene file, in the same way as youíve done with Squeezer and GOGO/NONO. I like the AM integration that this gives, as opposed to a COFFEE dialog.
 
Old 01 January 2007   #4
Nice Darter: i see forward for the final relase!
__________________
MrBraun - Moderator www.C4DHotline.it
R11+FR Stage2 SP4
Cactus Dan Plugin - Remotion Plugin - Tarabella plugin - M.G. Add the Sea plugin

 
Old 01 January 2007   #5
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:54 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.