THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/06/2005 at 13:58, xxxxxxxx wrote:
For reference, here is some sample code for the ugly workaround:
// Link to real XML loader
static Bool (SceneLoaderData::*RealIdentify)(PluginSceneLoader *node, const Filename &name, UCHAR *probe, LONG size);
// A dummy class to hold our Identify.
class DummySceneLoader : public SceneLoaderData
{
public:
// Note: This function is not virtual!
Bool MyIdentify(PluginSceneLoader *node, const Filename &name, UCHAR *probe, LONG size)
{
// Our own test
if (IsOfMyXMLFormat(name, probe, size))
{
// Note: We need to return FALSE here. That means C4D won't import
// the XML file, so our real Identify() function on a SceneLoaderData
// elsewhere will be called.
return FALSE;
}
else
{
// Let the built-in importer see if it wants a try
return (this->*(RealIdentify))(node, name, probe, size);
}
}
};
Bool PluginStart(void)
{
{
// Find the built-in XML importer
BasePlugin* bp = FindPlugin(1001027, C4DPL_SCENELOADER);
SCENELOADERPLUGIN* slp = static_cast<SCENELOADERPLUGIN*>(bp->GetPluginStructure());
// Disable XML import
RealIdentify = slp->Identify;
slp->Identify = reinterpret_cast<
Bool (SceneLoaderData::* )(
PluginSceneLoader *node, const Filename &name, UCHAR *probe, LONG size)>(
&(DummySceneLoader::MyIdentify));
}
...
}