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
    • Recent
    • Tags
    • Users
    • Login

    MCOMMAND_MAKEEDITABLE -> Cinema crashes

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 489 Views
    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 Offline
      Helper
      last edited by

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

      On 17/05/2008 at 12:52, xxxxxxxx wrote:

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

      ---------
      Hi.
      I'm trying to make a cube in C++ and then make it editable. This is my code so far in my object-plugin:

      BaseObject* extrudierterWuerfel::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
      {
           BaseObject *wuerfel = BaseObject::Alloc(Ocube);
           BaseDocument *doc = op->GetDocument();
           doc->InsertObject(wuerfel, NULL, NULL);

      ModelingCommandData datac;
           BaseContainer basec;

      datac.doc=doc;
           datac.op=op;
           datac.bc=&basec;
           
          SendModelingCommand(MCOMMAND_MAKEEDITABLE, datac);
           
           return wuerfel;
      }

      I don't know what is wrong, but when I start the plugin, Cinema crashes. When I change the command from MCOMMAND_MAKEEDITABLE to MCOMMAND_SELECTALL, that doesn't happen.
      Can you please help me?

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

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

        On 17/05/2008 at 14:42, xxxxxxxx wrote:

        You CANNOT use SendModelingCommand() in GetVirtualObjects() - especially anything that causes a cache rebuild which is what GetVirtualObjects() is already in the process of doing. MAKEEDITABLE and CURRENTSTATETOOBJECT for instance.

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

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

          On 17/05/2008 at 15:06, xxxxxxxx wrote:

          Ah, ok, but where or how should I do it then?

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

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

            On 17/05/2008 at 15:52, xxxxxxxx wrote:

            Not there? 😉

            You'll have to allocate a PolygonObject to be returned and fill in the Vector and Polygon arrays yourself if you must do it in GetVirtualObjects().

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

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

              On 18/05/2008 at 05:43, xxxxxxxx wrote:

              Thanks so far, I found another thread here, where is described how to do this with a copy of the object. This is my new code:

              BaseObject* extrudierterWuerfel::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
              {
                   BaseDocument *doc = op->GetDocument();

              BaseObject *cloned = BaseObject::Alloc(Ocube);
                   
                   PolygonObject *poly=NULL;

              BaseDocument *copydoc=doc->Alloc();
                  copydoc->InsertObject(cloned,NULL,NULL,FALSE);

              ModelingCommandData cd,cd2,cd3;
                   cd.doc     = copydoc;
                   cd.op     = cloned;
                   if (!SendModelingCommand(MCOMMAND_MAKEEDITABLE, cd)) return NULL;

              poly=static_cast<PolygonObject*>(cd.result->GetIndex(0));

              copydoc->SetMode(Mpolygons);
                   
                   
                   BaseContainer bc;
                   bc.SetData(MDATA_EXTRUDE_OFFSET, 50);          
                   
                   ModelingCommandData extrusionmcd;

              extrusionmcd.bc=&bc;
                   extrusionmcd.doc=copydoc;
                   extrusionmcd.op=poly;

              SendModelingCommand(ID_MODELING_EXTRUDE_TOOL, extrusionmcd);
                   
                   return poly;
              }

              The good thing here is, that nothing crashes. The bad thing is, that no making editable or extrusion happens. Why is that?

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

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

                On 22/05/2008 at 02:58, xxxxxxxx wrote:

                Nobody knows what's wrong here? Is it that I have to copy the object back into the Basedocument doc?

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