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
    1. Maxon Developers Forum
    2. ops
    3. Topics
    O
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 9
    • Best 2
    • Controversial 0
    • Groups 0

    Topics created by ops

    • O

      Dissipating fog volume

      Cinema 4D SDK
      • python • • ops
      2
      0
      Votes
      2
      Posts
      391
      Views

      ferdinandF

      Hey @ops,

      Thank you for reaching out to us. Please excuse the delayed reply. You must use the c4d.modules.volume.VolumeBuilder interface for what you want to do, specifically its GetInputObject method. You have to understand that a volume builder is not a singular object, but a virtual tree of objects, and most parameters are located on one of these child objects. Cinema 4D then only displays the parameters of the child objects inline in the GUI (i.e., description) of the Volume Builder object.

      5b76e06e-da90-4205-9e68-3e0ca7d14e8f-image.png
      Fig.I: The internal makeup of a Volume Builder object. The virtual hierarchy in form of Volume Filter is inaccessible both via the Object Manager and things like GeListNode.GetChildren(). Instead we must use the dedicate UI and API interface to access them.

      Cheers,
      Ferdinand

      Code """Sets the new min and max values of a Volume Builder fog range object. Must be run as a Script Manager script with a Volume Builder object selected. """ import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. #: The volume builder fog range object type. We currently do not expose a symbol for this. c4d.Ofograngemap = 1039862 def main() -> None: """Called by Cinema 4D when the script is being executed. """ if not isinstance(op, c4d.modules.volume.VolumeBuilder): raise ValueError("The selected object is not a Volume Builder.") # Iterate over the objects in the Volume Builder 'Objects' parameter list. for i in range(op.GetInputObjectCount()): node: c4d.BaseList2D | None = op.GetInputObject(i) # Can happen for folders and on failure, there is no good way to distinguish between the two. if node is None: continue # This is a fog range object, we could do here further checks to ensure it is the correct one. if node.GetType() == c4d.Ofograngemap: print(f"{node[c4d.ID_VOLUMEFILTER_SDF_REMAP_NEW_MIN] = }") print(f"{node[c4d.ID_VOLUMEFILTER_SDF_REMAP_NEW_MAX] = }") # Set new values. node[c4d.ID_VOLUMEFILTER_SDF_REMAP_NEW_MIN] = 0.5 node[c4d.ID_VOLUMEFILTER_SDF_REMAP_NEW_MAX] = 2.0 # Push an update event to Cinema 4D to refresh the user interface. c4d.EventAdd() if __name__ == '__main__': main()
    • O

      How to scale(/rotate/move) a parent object without affecting its children?

      Cinema 4D SDK
      • python windows s26 • • ops
      4
      0
      Votes
      4
      Posts
      733
      Views

      O

      And that's good to know about using GetMl() over Get Mg(), mainly for the performance reasons if I understood correctly.

    • O

      C4DAtom.SetParameter/GetParameter help

      Cinema 4D SDK
      • 2024 python • • ops
      3
      0
      Votes
      3
      Posts
      503
      Views

      i_mazlovI

      Hi @ops,

      Thanks for reaching out to us and thanks for sharing your solution with the community, this is highly appreciated!

      You're right, the most common way of accessing object's attributes is by using subscript operator.

      Cheers,
      Ilia

    • O

      Python equivalent of the Xpresso node "Get nearest point on spline"?

      Cinema 4D SDK
      • python 2024 • • ops
      6
      0
      Votes
      6
      Posts
      1.0k
      Views

      O

      Thanks a LOT @ferdinand and @mikeudin , for sharing your insights and suggestions!
      They are definitely valuable and am sure will come in handy in the future!!!