Materials & Modifiers
DazMaterial
- class dazpy.DazMaterial(client, locator)[source]
Bases:
DazElementProxy for a
DzMaterialsurface on a DAZ Studio node.Instances are obtained via
DazNode.materials()orDazNode.find_material().- property diffuse_color: dict | None
Diffuse colour as
{"r", "g", "b"}(0–255, read/write).Can be set with a
dictor a 3-tuple(r, g, b).
- property opacity: float | None
Base opacity / transparency value (0.0 transparent – 1.0 opaque, read/write).
- describe()[source]
Return this material’s index, name, label and shader class.
- Raises:
MaterialError – If the material is not found.
- property_values()[source]
Every property on the material with its type and value, in one call.
Colors come back as
"#rrggbb"; image properties as the map’s file path (Nonewhen no map is set).
- set_property_value(name, value)[source]
Set a numeric or color property found by internal name, then label.
- Parameters:
- Returns:
MaterialPropertyWritewith the label, type and value read back.- Raises:
ValueError – If a color value is not
#RRGGBB(checked before the call when value is a string).MaterialError – If the material or property is missing, or the property is neither numeric nor color.
- Return type:
MaterialPropertyWrite
- copy_from(source)[source]
Copy every property value from source onto matching properties here.
Properties are matched by internal name. Returns
(copied, skipped), where skipped counts source properties with no match here or whose value Studio refused.- Raises:
MaterialError – If either material is not found.
DazMorph
- class dazpy.DazMorph(client, locator)[source]
Bases:
DazModifierProxy for a
DzMorphblendshape slider on a node.Returned by
DazNode.morphs()andDazNode.find_modifier()when the underlying DAZ modifier is aDzMorph.
DazModifier
- class dazpy.DazModifier(client, locator)[source]
Bases:
DazElementProxy for a
DzModifier(constraint, formula, etc.) on a node.Instances are obtained via
DazNode.modifiers()orDazNode.find_modifier(). For morph/blendshape modifiers, the more specificDazMorphsubclass is returned automatically.
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:
objectDeclarative 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 Roughnesschannels at all) need different channel labels – useSurfaceProperty/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.
- textures: tuple[TextureMap, ...]
- properties: tuple[SurfaceProperty, ...]
- class dazpy.TextureMap(channel, file_path)[source]
Bases:
objectOne 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 tosetMap()can hang or crash DAZ Studio via a blocking file-not-found dialog.
- class dazpy.SurfaceProperty(label, value)[source]
Bases:
objectGeneric named Iray surface-channel override.
For channels not covered by
IrayMaterial’s typed fields.- Parameters:
- 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.propertiesis applied last, so it can supersede any typed field or texture set earlier in the same call.
- Raises:
ValueError – If any
spec.textures[*].file_pathis not absolute.FileNotFoundError – If any
spec.textures[*].file_pathdoes not exist on disk. All texture paths are validated before any DazScript call is made, for the same reason asapply_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:
material (DazMaterial) – The target material.
texture (TextureMap) – The texture-slot assignment.
- Raises:
ValueError – If
texture.file_pathis not an absolute path.FileNotFoundError – If
texture.file_pathdoes 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:
material (DazMaterial) – The target material.
prop (SurfaceProperty) – The label/value pair to set.
- Raises:
MaterialError – If the material or property cannot be found.