Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    XML open

    SDK Help
    0
    6
    596
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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:

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

      ---------
      Hi,
      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?
      Regards,
      Remotion

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 19/04/2004 at 00:01, xxxxxxxx wrote:

        Hi Remotion,

        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.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          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...").

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            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?

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              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.

              Best Regards,
              Remotion

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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));     
                      }  
                      ...  
                    }
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post