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

    SendModelingCommand(MCOMMAND_SUBDIVIDE) broken in C4D 2023?

    Cinema 4D SDK
    c++
    2
    4
    530
    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.
    • fwilleke80F
      fwilleke80
      last edited by fwilleke80

      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

      www.frankwilleke.de
      Only asking personal code questions here.

      1 Reply Last reply Reply Quote 1
      • fwilleke80F
        fwilleke80
        last edited by fwilleke80

        Interesting...

        If I put all code aside, simply start Cinema 4D 2023, and do the following:

        1. Create Cube
        2. Make Cube editable (with "c")
        3. Choose Mesh > Add > Subdivide (click the cogwheel icon)
        4. Set any settings, or don't change anything
        5. Click OK

        --> The cube does not change at all.

        Is MCOMMAND_SUBDIVIDE maybe completely broken?

        Cheers,
        Frank

        www.frankwilleke.de
        Only asking personal code questions here.

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by

          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

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 2
          • fwilleke80F
            fwilleke80
            last edited by

            Thank you, that fixed it.

            www.frankwilleke.de
            Only asking personal code questions here.

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