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
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. vwgamedev
    3. Topics
    V
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by vwgamedev

    • V

      Call "Set Deformed Mesh" on Weight Tag

      Cinema 4D SDK
      • 2024 python windows • • vwgamedev
      2
      0
      Votes
      2
      Posts
      477
      Views

      M

      Hi you need to use call button

      def apply_deformed_mesh(meshes): """ Apply 'Set Deformed Mesh' on all meshes with weight tags. """ for obj in meshes: weight_tag = obj.GetTag(c4d.Tweights) if weight_tag: bc = weight_tag.GetDataInstance() # Set the button to 'Set Deformed Mesh' bc.SetInt32(c4d.ID_CA_WEIGHT_TAG_SET_BUTTON, c4d.ID_CA_WEIGHT_TAG_SET_DEFORMED_MESH) c4d.CallButton(weight_tag, c4d.ID_CA_WEIGHT_TAG_SET_BUTTON) # Update the scene c4d.EventAdd()

      Cheers,
      Maxime.

    • V

      Automatic UV Rectangularize / MDATA_UVRECTANGULARIZE

      Cinema 4D SDK
      • • • vwgamedev
      2
      0
      Votes
      2
      Posts
      582
      Views

      M

      Hi sadly the only way is to use c4d.CallCommand(1055347) which does not open the window but directly execute the command.
      You can change the setting as you could in the windows, by editing the value in the BaseContainer of the document.
      Finally it act on the selected polygon, so the best way would be to select them.

      Find bellow a script that you can execute in the script manager that will select all polygon of an object and run the command.

      from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: # Enables UV Polygon Mode if not already in any UV mode (needed for GetActiveUVSet to works) if doc.GetMode() not in [c4d.Muvpoints, c4d.Muvpolygons]: doc.SetMode(c4d.Muvpolygons) # Retrieves active UVSet, The UV windows need to be opened at least one time handle = c4d.modules.bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL) if handle is None: # If fail it may be because the Texture view is not open # Open A texture View c4d.CallCommand(170103) # In S22 you need to update the UV Mesh if c4d.API_VERSION >= 22000: c4d.modules.bodypaint.UpdateMeshUV(False) # Retrieves active UVSet, The UV windows need to be opened at least one time handle = c4d.modules.bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL) if handle is None: raise RuntimeError("There is no Active UVSet") # Select the polygon you want to operate on currentSel = op.GetPolygonS() previousSel = currentSel.GetClone() # Will be used to restore the initial selection state at the end currentSel.SelectAll(op.GetPolygonCount() - 1 ) # Update the UV mesh to properly take into account the new selection c4d.modules.bodypaint.UpdateMeshUV(True) # Define the settings settings = doc.GetSettingsInstance(c4d.DOCUMENTSETTINGS_MODELING) settings[c4d.MDATA_UVRECTANGULARIZE_ALIGN] = True settings[c4d.MDATA_UVRECTANGULARIZE_EQUIDISTANT] = False # Execute the command c4d.CallCommand(1055347) # Restore the initial selection previousSel.CopyTo(currentSel) c4d.modules.bodypaint.UpdateMeshUV(True) c4d.EventAdd() if __name__ == '__main__': main()

      Cheers,
      Maxime.

    • V

      UVCOMMAND_RELAX does not use the RELAXUV_EDGESEL_POINTER

      Cinema 4D SDK
      • s26 python windows • • vwgamedev
      3
      0
      Votes
      3
      Posts
      476
      Views

      V

      @ferdinand
      Thank you for the hint and the superfast response! I was not aware that these symbols dissolve into these numbers, which of course makes it much easier to work with them now. I was able to solve it with CallUVCommand:

      settings = c4d.BaseContainer() settings[c4d.RELAXUV_KEEP_BORDER] = False settings[c4d.RELAXUV_KEEP_NEIGHBORS] = False settings[c4d.RELAXUV_KEEP_POINTSEL] = False settings[c4d.RELAXUV_CUT_EDGESEL] = True settings[c4d.RELAXUV_EDGESEL_POINTER] = edge_sellection settings[c4d.RELAXUV_MAX_ITERATIONS] = 1 settings[c4d.RELAXUV_MODE] = c4d.RELAXUV_MODE_ABF ret = c4d.modules.bodypaint.CallUVCommand(handle.GetPoints(), handle.GetPointCount(), handle.GetPolys(), handle.GetPolyCount(), uvw, handle.GetPolySel(), handle.GetUVPointSel(), obj, handle.GetMode(), c4d.UVCOMMAND_RELAX, settings)