Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Command MCOMMAND_MAKEEDITABLE

    SDK Help
    0
    4
    387
    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 28/05/2007 at 08:36, xxxxxxxx wrote:

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

      ---------
      In order to export objects I need to convert them into polygon objects before exporting.
      But there are some problems with the hierarchy.
      The ->GetNext and ->GetDown functions dont work as soon as a new object has been inserted.

      How can I fix this?
      And I have seen the Polygonize function, but I cant use it.

      Any help is appreciated.

        
      static bool transform(BaseObject* op, BaseDocument* dst)  
      {  
           if(!op || !dst )  
                return 1;  
           ModelingCommandData cd;  
        
           if(op->GetType() >= Ocube && op->GetType() <= Osinglepoly)  
           {       
                  
                cd.doc = dst;  
                cd.op = op;  
                if (!SendModelingCommand(MCOMMAND_MAKEEDITABLE,cd))goto Error;  
        
                if (!cd.result) goto Error;  
                BaseObject* res = (BaseObject* )cd.result->GetIndex(0);  
                if (!res) goto Error;  
                dst->InsertObject(res, NULL, NULL);  
           }  
           transform(op->GetDown(), dst);  
           transform(op->GetNext(), dst);  
           return 0;  
        
           Error:  
           GePrint("Fehler bei Objektumwandlung");  
           AtomArray::Free(cd.result);  
           return 1;  
        
      }  
      //Jedes mathematische Objekt wird in ein Polygonobjekt umgewandelt  
      static BaseDocument* TransformObjToPoly(BaseDocument* doc)  
      {  
           BaseDocument* dst=BaseDocument::Alloc(); if (!dst) return NULL;  
           BaseObject* nx=NULL;  
           BaseObject* res=NULL;  
           BaseObject* op=NULL;  
        
           ModelingCommandData cd;  
           cd.doc = dst;  
        
           if (!doc->CopyTo(dst,0,NULL)) goto Error;  
        
           if(transform(dst->GetFirstObject(), dst)) goto Error;  
        
           return dst;  
        
      Error:  
           GePrint("Fehler bei Objektumwandlung");  
           blDelete(dst);  
           AtomArray::Free(cd.result);  
           return NULL;  
      }  
      
      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 29/05/2007 at 00:43, xxxxxxxx wrote:

        Hi ...

        What you want to do is to make all the objects in the document editable. Am I right?
        I use this code segment for that.

        Bool dlgLevelControl::Command(LONG id, const BaseContainer &msg;)
        {
        switch(id)
        {
        case BTN_TEST://when the testing button is pressed
        {
        BaseDocument *doc=GetActiveDocument();
        BaseObject *obj=doc->GetFirstObject();
        MakeAllEditable(obj);
        }
        break;
        }
        }
        ...

        void dlgTest::MakeAllEditable(BaseObject *obj)
        {
             String strObj;
             if(obj)
             {
                  strObj=obj->GetName();
                  BaseDocument *doc=GetActiveDocument();
                  ModelingCommandData mcd;
                  mcd.bc=obj->GetDataInstance();
                  mcd.doc=doc;
                  mcd.op=obj;
                  mcd.mode=MODIFY_ALL;
                  mcd.flags=MODELINGCOMMANDFLAG_CREATEUNDO;
                  if (!SendModelingCommand(MCOMMAND_MAKEEDITABLE,mcd)) return;
                  EventAdd(EVENT_FORCEREDRAW);
                  obj=doc->SearchObject(strObj);
                  MakeAllEditable(obj->GetDown());
                  MakeAllEditable(obj->GetNext());
             }
        }

        Hope it can help ...
        Zaw Min Tun

        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 29/05/2007 at 01:17, xxxxxxxx wrote:

          Thank you very much, it works perfectly.

          Since the changes rearanges objects in the list, this

          obj=doc->SearchObject(strObj);
          

          was necessary to go to modified object.

          It drove me nuts for a while 🙂

          tnx again.

          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 31/05/2007 at 19:29, xxxxxxxx wrote:

            Yes ... it's always like that ... 🙂
            You're welcome ...

            Zaw Min Tun

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