THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2004 at 10:38, xxxxxxxx wrote:
Cinema 4D Version: 8.5
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
I have now created XML import for C4D, and it works, but only if "<?xml" is replaced with something else.
With "<?xml" the file can not be read or I will get an error "Invalid file operation in file...".
Is it possible that C4D will read this file, and don't put it to my import plugins?
Any possibility to load XML file in C4D with "<?xml version="1.0"?>" without change the file self?
On 19/04/2004 at 00:01, xxxxxxxx wrote:
for XML im-/export I'm using Xerces from apache.org ( http://xml.apache.org/xerces-c/index.html) and include it into my plugin.
Xerces does the parsing of the XML file so I only have to take care about the correct translation of XML elements /C4D objects in the files.
Maybe this can solve your problem.
On 19/04/2004 at 16:03, xxxxxxxx wrote:
The problem seems to be that the native C4D XML scene loader is evaluated first, so your SceneLoaderData never gets a chance to see the data. I've confirmed this behavior and reported it.
As far as I can see, the only workaround (without changing the XML files) would be to create a CommandData instead (i.e. a menu entry in the plugin Menu, for example "Load XML...").
On 22/04/2004 at 18:08, xxxxxxxx wrote:
There is another workaround that is moderately ugly: intercepting the built-in XML importer, which is just a SceneLoaderData. I haven't tried it myself, but you would use FindPlugin() with 1001027 and C4DPL_SCENELOADER, then change the values of the pluginstructure, i.e. reroute both Identify and Load and providing fallback to the C4D importer using stuff like:
Bool result = (loader->*(((SCENELOADERPLUGIN* )C4DOS.Bl->RetrieveTableX(loader,0))->Identify))(...)
Sounds tempting, doesn't it?
On 30/04/2004 at 03:11, xxxxxxxx wrote:
Thanks Ingo, but I already have another XML Parse and it make its job well enough.
Xerces seems to be too big for me.
Thank Mikael, I will try this ugly workaround
Yes it sounds tempting, to replace C4D XML importeur with my own.
My XML file has another file extension as *.xml
It would be also enough to replace C4D-XML Identify and to test for the file extension.
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
// 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.
// Let the built-in importer see if it wants a try
return (this->*(RealIdentify))(node, name, probe, size);
// 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)>(