SendModelingCommand(MCOMMAND_SUBDIVIDE) broken in C4D 2023?
-
Hi,
I have a function that looks like this:
Bool SubdividePolygonObject(PolygonObject* const objectPtr, const maxon::Int32 subdivisions, const maxon::Bool sds) { // Parameters for the modeling command BaseContainer modelingCommandParameters; modelingCommandParameters.SetBool(MDATA_SUBDIVIDE_HYPER, sds); modelingCommandParameters.SetInt32(MDATA_SUBDIVIDE_SUB, subdivisions); // Execute modeling command ModelingCommandData modelingCommandData; modelingCommandData.op = objectPtr; modelingCommandData.bc = &modelingCommandParameters; if (!SendModelingCommand(MCOMMAND_SUBDIVIDE, modelingCommandData)) return false; return true; }
Example usage:
BaseContainer cubeData; basicObjectData.SetVector(PRIM_CUBE_LEN, maxon::Vector(100.0)); cubeData.SetInt32(PRIM_CUBE_SUBX, 2); cubeData.SetInt32(PRIM_CUBE_SUBY, 2); cubeData.SetInt32(PRIM_CUBE_SUBZ, 2); PolygonObject* const objectPtr = static_cast<PolygonObject*>(GeneratePrimitive(nullptr, Ocube, cubeData, 1.0, false, hh->GetThread())); if (!SubdividePolygonObject(objectPtr, 5, true)) GePrint("Something went wrong."_s);
This works fine in R20 - R25, but returns
false
in 2023.
What could be the reason?Cheers,
Frank -
Interesting...
If I put all code aside, simply start Cinema 4D 2023, and do the following:
- Create Cube
- Make Cube editable (with "c")
- Choose Mesh > Add > Subdivide (click the cogwheel icon)
- Set any settings, or don't change anything
- Click OK
--> The cube does not change at all.
Is MCOMMAND_SUBDIVIDE maybe completely broken?
Cheers,
Frank -
Hi Franck,
You are right, the UI command is not working if the document is on object mode; there is already a bug report open for that one. I do not know if both issues are related and if the fix will also modify the API behavior but for now you can change the mode to the ModelingCommandData like so.
modelingCommandData.mode = MODELINGCOMMANDMODE::POLYGONSELECTION;
If specifying the mode becomes mandatory i will update the documentation.
Cheers,
Manuel -
Thank you, that fixed it.