Materials & Modifiers

DazMaterial

class dazpy.DazMaterial(client, locator)[source]

Bases: DazElement

Proxy for a DzMaterial surface on a DAZ Studio node.

Instances are obtained via DazNode.materials() or DazNode.find_material().

property material_name: str | None

Internal material name (read-only).

property diffuse_color: dict | None

Diffuse colour as {"r", "g", "b"} (0–255, read/write).

Can be set with a dict or a 3-tuple (r, g, b).

property opacity: float | None

Base opacity / transparency value (0.0 transparent – 1.0 opaque, read/write).

color_map()[source]

Return the file path of the diffuse colour texture, or None.

is_smoothing_on()[source]

Return True if normal smoothing is enabled for this material.

property smoothing_angle: float | None

Normal smoothing angle in degrees (read/write).

is_opaque()[source]

Return True if the material is fully opaque (opacity == 1.0).

DazMorph

class dazpy.DazMorph(client, locator)[source]

Bases: DazModifier

Proxy for a DzMorph blendshape slider on a node.

Returned by DazNode.morphs() and DazNode.find_modifier() when the underlying DAZ modifier is a DzMorph.

property value: float | None

Current morph strength (typically 0.0–1.0, read/write).

property min: float | None

Minimum allowed value for this morph channel (read-only).

property max: float | None

Maximum allowed value for this morph channel (read-only).

DazModifier

class dazpy.DazModifier(client, locator)[source]

Bases: DazElement

Proxy for a DzModifier (constraint, formula, etc.) on a node.

Instances are obtained via DazNode.modifiers() or DazNode.find_modifier(). For morph/blendshape modifiers, the more specific DazMorph subclass is returned automatically.

property modifier_label: str | None

User-visible display label of this modifier (read-only).

property enabled: bool | None

Whether this modifier is currently active (read/write).

dazpy.materials

Declarative Iray Uber Base material setup, built on DazMaterial.

class dazpy.IrayMaterial(base_color=None, metallic_weight=None, roughness=None, glossy_reflectivity=None, cutout_opacity=None, bump_strength=None, top_coat_weight=None, textures=<factory>, properties=<factory>)[source]

Bases: object

Declarative Iray Uber Base material spec.

Targets the classic Iray Uber Base shader specifically. Figures using the PBRSkin shader variant (e.g. default Genesis 9 skin materials, which have no Cutout Opacity/Glossy Roughness channels at all) need different channel labels – use SurfaceProperty / set_surface_property() with PBRSkin’s own labels instead.

Parameters:
  • base_color (tuple[int, int, int] | None) – (r, g, b) in the 0-255 range.

  • metallic_weight (float | None) – 0.0-1.0.

  • roughness (float | None) – 0.0-1.0 (Glossy Roughness).

  • glossy_reflectivity (float | None) – 0.0-1.0.

  • cutout_opacity (float | None) – 0.0 (fully cut out) - 1.0 (opaque).

  • bump_strength (float | None) – Bump map strength multiplier.

  • top_coat_weight (float | None) – 0.0-1.0.

  • textures (tuple[TextureMap, ...]) – Texture-slot assignments, applied after the typed fields above.

  • properties (tuple[SurfaceProperty, ...]) – Ad hoc named-channel overrides, applied last so they can supersede any typed field or texture set in the same call.

base_color: tuple[int, int, int] | None = None
metallic_weight: float | None = None
roughness: float | None = None
glossy_reflectivity: float | None = None
cutout_opacity: float | None = None
bump_strength: float | None = None
top_coat_weight: float | None = None
textures: tuple[TextureMap, ...]
properties: tuple[SurfaceProperty, ...]
class dazpy.TextureMap(channel, file_path)[source]

Bases: object

One texture-slot assignment for an Iray material channel.

Parameters:
  • channel (str) – A key into the known Iray channel labels (e.g. "base_color", "normal", "bump", "metallic", "roughness", "cutout_opacity") or an arbitrary DazScript property display label not in that table.

  • file_path (str) – Absolute path to an image file on disk. Must exist – validated by apply_texture_map() before any DazScript call is made, since an invalid path passed to setMap() can hang or crash DAZ Studio via a blocking file-not-found dialog.

channel: str
file_path: str
class dazpy.SurfaceProperty(label, value)[source]

Bases: object

Generic named Iray surface-channel override.

For channels not covered by IrayMaterial’s typed fields.

Parameters:
  • label (str) – The DazScript property display label (getLabel()).

  • value (object) – The value to set. Must be JSON-serialisable.

label: str
value: object
dazpy.apply_iray_material(material, spec)[source]

Apply spec to material in typed-fields -> textures -> properties order.

Parameters:
  • material (DazMaterial) – The target material.

  • spec (IrayMaterial) – The material configuration. None-valued typed fields are skipped. spec.properties is applied last, so it can supersede any typed field or texture set earlier in the same call.

Raises:
  • ValueError – If any spec.textures[*].file_path is not absolute.

  • FileNotFoundError – If any spec.textures[*].file_path does not exist on disk. All texture paths are validated before any DazScript call is made, for the same reason as apply_texture_map().

  • MaterialError – If the material or a resolved channel property cannot be found on the live material.

dazpy.apply_texture_map(material, texture)[source]

Assign texture to material’s corresponding Iray channel.

Parameters:
Raises:
  • ValueError – If texture.file_path is not an absolute path.

  • FileNotFoundError – If texture.file_path does not exist on disk. Checked before any DazScript call is made.

  • MaterialError – If the material or the resolved channel property cannot be found on the live material.

dazpy.get_surface_property(material, label)[source]

Return the current value of the named Iray surface property.

Parameters:
  • material (DazMaterial) – The target material.

  • label (str) – The DazScript property display label.

Raises:

MaterialError – If the material or property cannot be found.

dazpy.set_surface_property(material, prop)[source]

Set a single named Iray surface property.

Parameters:
Raises:

MaterialError – If the material or property cannot be found.