Maxon Developers
    • Downloads
      • All Downloads
      • Cinema 4D Python SDK
      • Cinema 4D C++ SDK
      • Cineware SDK
      • ZBrush GoZ SDK
      • Cinema 4D Python Examples
      • Cinema 4D C++ Examples
      • Project Tool
      • SDK Database
    • Documentation
      • Cinema 4D Python SDK
      • Cinema 4D C++ SDK
      • Cineware SDK
      • ZBrush GoZ SDK
    • Forum
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Forums
      • Overview
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • News & Information
      • Downloads
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Crash of a filter plugin

    SDK Help
    0
    5
    140
    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 06/03/2006 at 11:26, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.5 
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hi everybody.
      I'm beginning developping little plugins in C.O.F.F.E.E and I experience a problem trying to make a filter plugin which simply writes objects coords of a scene in a file. To do that, I've created a coords_exporter class inherited from the FilterPlugin class and I've registered it in the main() function. But, when I execute my script, Cinema4D crashes after I select the file to write and I really don't know why...
      There is my code :

      class coords_exporter : FilterPlugin  
      {  
      public:  
          coords_exporter();  
          GetName();  
          GetID();  
          Identify(probe,fname);  
          Save(doc,fname,obj,mat,env,dialog);  
      };  
        
      coords_exporter::coords_exporter()  
      {  
          super();  
      }  
        
      coords_exporter::GetID()  
      {  
          return 1000001;  
      }  
        
      coords_exporter::GetName()  
      {  
          return "coords_exporter";  
      }  
        
      coords_exporter::Identify(probe,fname)  
      {  
          return TRUE;  
      }  
        
      coords_exporter::Save(doc,fname,obj,mat,env,dialog)  
      {  
          var object=new(BaseObject);  
          object=doc->GetFirstObject();  
          var file=new(BaseFile);  
          file->Open(fname,GE_WRITE,FILE_DIALOG,GeGetByteOrder());  
          var pos;  
          while(object!=NULL)  
          {  
              pos=object->GetPosition();  
              file->WriteReal(pos.x);  
              file->WriteReal(pos.y);  
              file->WriteReal(pos.z);  
              object=object->GetNext();  
          }  
      }  
        
      main(doc,op)  
      {  
          Register(coords_exporter);  
      }
      

      Could you tell me where I'm mistaking ?

      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 06/03/2006 at 13:27, xxxxxxxx wrote:

        Why are you doing this:

        var object=new(BaseObject);
            object=doc->GetFirstObject();

        You are creating a new BaseObject and then filling it with another (the return value)! Do this:

        var object = doc->GetFirstObject();

        Not certain if that is the cause, but it's a place to begin.

        Also, why are you doing this:

        main(doc,op)

        I've never seen that and it certainly caused a COFFEE error on load. Do this instead:

        main()

        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 06/03/2006 at 14:21, xxxxxxxx wrote:

          I've written

          var object = doc->GetFirstObject();
          

          instead of

          var object=new(BaseObject);  
          object=doc->GetFirstObject();
          

          and this haven't resolved my crash problem. So, I've tried to suppress the main() function parameters but, when I do that, I get the following error in the console :
          "[FAIL] Script 'coords_exporter' : Too many parameters"

          Do you have other ideas ?
          Thank you for your help.

          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 06/03/2006 at 15:18, xxxxxxxx wrote:

            That's interesting since I tested the script in R9.5 just as you gave it and there was a COFFEE error in the Console Window. As soon as the 'doc,op' were removed from main(), not only did the plugin load but it worked (with the other modification noted)!

            So now I have to wonder if there isn't something else going on here: bad C4D install or a test PluginID conflict? I used 1000003 since others were already used.

            Any particular modifications to your install? Close Cinema, move all other plugins in the 'Plugins' folder to another folder like 'plugins_back', and restart Cinema with only your plugin. See if the crash continues to occur.

            One other thing noted: You say that you 'execute your script'. Are you doing this from the File->Export menu or in some other fashion? Since it is an imort/export plugin, it should be called from File->Export.

            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 07/03/2006 at 10:28, xxxxxxxx wrote:

              I've found my error. Instead of creating a .cof file and putting it in the "plugins" folder, I was just writing my code in the "Script Manager" window and then clicking on the "Exectute" button.
              Now, suppressing "doc,op" in the main() declaration and loading the plugin at Cinema4D launch with a .cof file, the script works, except that, after choosing my save file, Cinema4D displays the following error dialog :
              "Invalid file operation in file name_of_my_file"

              Do you know what it is about ?
              Thank you a lot.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post