THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/05/2005 at 10:27, xxxxxxxx wrote:
If no one has a better idea, you could always use messaging. I've used MSG_RETRIEVEPRIVATEDATA to pass structs and arrays (in the void* data of a RetrievePrivateData struct) to and from my own plugins with much success.
Basically, when your shader needs information from these tags, the shader can send a message like this with a RetrievePrivateData struct, the tag fills the data (and maybe sets the flags), and the shader retrieves what is filled into it.
If you need to look for tags, I suggest getting the BaseDocument from the node (node->GetDocument()), and then set up a recursive method in the shader to get each object and check for tags:
// These will need to be defined accessible for MyShader and MyTag
#define RPDATA_SET 0
#define RPDATA_GET 1
struct MyDataStruct
{
// whatever data is to be passed
};
Bool MyShader::SomeMethod()
{
BaseDocument* baseDoc = node->GetDocument();
if (!QueryTag(baseDoc, baseDoc->GetFirstObject()) return FALSE;
...
return TRUE;
}
// Recursively check Document Object's for your PluginTag
Bool MyShader::QueryTag(BaseDocument* baseDoc, BaseObject* obj)
{
LONG nr;
PluginTag* pt;
RetrievePrivateData rpdata;
MyDataStruct myDataStruct;
for (obj; obj; obj = obj->GetNext())
{
/* Do this here to perform leaf->root traversal
// Handle children
if (!QueryTag(baseDoc, obj->GetDown())) return FALSE;
*/
// Get each MyPlugin tag from object (if nay)
for (nr = 0; pt = (PluginTag* )obj->GetTag(ID_MYTAG, nr); nr++)
{
// Messaging
rpdata.flags = RPDATA_GET;
rpdata.data = &myDataStruct;
if (pt->Message(MSG_RETRIEVEPRIVATEDATA, &rpdata;))
{
// extract data filled by your PluginTag
}
}
// Do this here to perform root->leaf traversal
// Handle children
if (!QueryTag(baseDoc, obj->GetDown())) return FALSE;
}
return TRUE;
}