Scene
- class dazpy.DazScene(client=None)[source]
Bases:
objectHigh-level proxy for the active DAZ Studio scene (
Sceneglobal).This is the primary entry point for inspecting and manipulating the scene. All methods execute DazScript on the server and return Python objects.
- Parameters:
client (DazClient | None) – Optional
DazClientto use. A default client connecting to127.0.0.1:18811is created when omitted.
Example:
from dazpy import DazScene scene = DazScene() print(scene.num_nodes(), "nodes in scene") figure = scene.find_skeleton_by_label("Genesis 9")
- nodes()[source]
Return all top-level and child nodes in the scene.
The returned list contains typed subclass instances:
DazSkeletonfor figures,DazCamera,DazLight, andDazNodefor everything else.
- find_node(name)[source]
Find a scene node by its internal name.
- Parameters:
name (str) – The
getName()string of the node.- Returns:
A
DazNodeproxy for the node.- Raises:
NodeNotFoundError – If no node with that name exists in the scene.
- Return type:
- find_node_by_label(label)[source]
Find a scene node by its user-visible label.
The returned proxy is anchored to the node’s internal name so it remains stable if the label is later changed.
- Parameters:
label (str) – The
getLabel()string shown in the Scene panel.- Returns:
A
DazNodeproxy.- Raises:
NodeNotFoundError – If no node with that label exists.
- Return type:
- find_skeleton(name)[source]
Find a skeleton by its internal name.
- Parameters:
name (str) – Internal name of the skeleton node (e.g.
"Genesis9"). To look up by the user-visible label shown in the Scene panel (e.g."Genesis 9"), usefind_skeleton_by_label().- Returns:
A
DazSkeletonproxy.- Raises:
NodeNotFoundError – If no skeleton with that name exists.
- Return type:
- find_skeleton_by_label(label)[source]
Find a skeleton by its user-visible label.
- Parameters:
label (str) – Label shown in the Scene panel.
- Returns:
A
DazSkeletonproxy.- Raises:
NodeNotFoundError – If no skeleton with that label exists.
- Return type:
- set_primary_selection(node)[source]
Set the primary selection to node.
- Parameters:
node (DazNode) – The node to select.
- select_all(on=True)[source]
Select or deselect all nodes.
- Parameters:
on (bool) –
Trueto select all,Falseto deselect all.
- undo(label)[source]
Return a context manager that groups all enclosed changes into a single undo step.
- Parameters:
label (str) – The label shown in DAZ Studio’s Edit > Undo menu.
- Returns:
A
UndoGroupcontext manager.- Return type:
Example:
with scene.undo("Move figure"): node.set_position(100, 0, 0)
- set_frame(frame)[source]
Jump to a specific timeline frame.
- Parameters:
frame (int) – Zero-based frame number.
- load(path)[source]
Load a scene file (merge mode — does not clear the existing scene).
- Parameters:
path (str) – Absolute path to the
.dazor.duffile on the server host.
- save(path)[source]
Save the scene to a file.
- Parameters:
path (str) – Absolute destination path on the server host.