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()