Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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?
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.
On 17/05/2008 at 15:06, xxxxxxxx wrote:
Ah, ok, but where or how should I do it then?
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().
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?
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?