User Tools

Site Tools


DzMaterial

Base class for all material types.

More...

Inherits :

Inherited By : DzBrickMaterial, DzDefaultMaterial, DzShaderMaterial and uberiraymaterial_dz

Properties

Static Methods

DAZ Script
DzMaterialgetMaterial ( Number which )
NumbergetNumMaterials ()

Methods

Signals

voidassetModified ()
voidassetWasSaved ()
voidbakedMapChanged ()
voidselectionStateChanged ( DzMaterial mat, Boolean onOff )
voidsettingsChanged ()
voidsmoothingChanged ()
voidtagsChanged ()
voiduvsChanged ()

Detailed Description

A “material” represents a collection of properties and settings that, when applied through the use of a “shader” (a small program/subroutine that describes how the settings are used), describe how the geometry associated with a 3D object interacts with light and ultimately what the surface of that 3D object looks like when rendered.

See Also:

Properties


DzAuthor : assetAuthor

The author of the file for this material. (Read Only)

Since:

  • 4.8.1.21

DzVersion : assetFileRevision

The revision version of the asset file for this material. (Read Only)

Since:

  • 4.8.1.21

String : assetId

The asset id for this material.

Since:

  • 4.8.1.18

Date : assetModifiedDate

The modified date of the asset file for this material. (Read Only)

Since:

  • 4.8.1.21

DzUri : assetSource

The URI of the asset source for this material; only valid when the asset is in an embedded state - i.e. modified. (Read Only)

Since:

  • 4.8.1.21

DzUri : assetUri

The asset URI for this material. (Read Only)

Since:

  • 4.8.1.18

DzRenderMgr::RenderPriority : renderPriority

The render priority for the material. Render priority controls the order in which materials are handled during a render. The higher the priority, the earlier the material will be handled. If several materials have the same render priority, those materials will be handled in an arbitrary order.

The render priority on all nodes that use this material (this will include the top-level skeleton node when dealing with figures) can automatically be set to match the material's new priority by calling enablePropagateRenderPriorityToNodes() with true before calling this method.

The default render priority is DzRenderMgr::RENDER_PRIORITY_NORMAL.

Static Methods


DzMaterial : getMaterial( Number which )

Return Value:

  • The material with the given index

Number : getNumMaterials()

Return Value:

  • The number of materials that have been created

Methods


DzMaterial : duplicateOrDefaultMaterial( DzElementDuplicateContext context )

Parameter(s):

  • context - The context of the material to duplicate.

Return Value:

  • The duplicate material if a material could be duplicated, otherwise a DzDefaultMaterial.

Since:

  • 4.6.2.104

void : enablePropagateRenderPriorityToNodes( Boolean propagate )

Sets whether or not this material should propagate its render priority up to all the nodes that use it. Setting this to true will also ensure that the render priority is set for nodes that the material is assigned to at a later time.

The default behaviour is to not propagate.

Parameter(s):

  • propagateOnOff - Whether or not the new priority value should be applied to all nodes that use this material (this will include the top-level skeleton node when dealing with figures).

DzUVSet : getActiveUVSet( shape_dz shape )

Return Value:

  • The uv set that is used by this material for the given shape. May be NULL if the shape does not have any UV Sets.

Since:

  • 4.9.3.69

DzUVSet : getActiveUVSet( geometry_dz geom )

Return Value:

  • The UV set that is used by this material for the given geometry. May be NULL if the geometry does not have any UV Sets.

Since:

  • 4.9.3.69

Array : getAllMaps()

Collects all the images that are being used by this material at the current time and inserts them into the given list if they are not already there.


DzTexture : getBakedMap()

Return Value:

  • The 'baked' map for the material. NULL if the material is not using a baked map.

Number : getBaseOpacity()

Return Value:

  • The opactiy value for this material.

DzBox3 : getBoundingBox()

TODO: Add description.


DzTexture : getColorMap()

Return Value:

  • The color ('texture') map for this material.

Color : getDiffuseColor()

Return Value:

  • The diffuse color for this material.

Number : getIndex()

Return Value:

  • The material index of this material.

String : getMaterialName()

Return Value:

  • The name for the type of shader (not the name for the material instance).

Number : getNumGLMaps()

Return Value:

  • The number of OpenGL texture maps necessary for rendering this material in OpenGL (e.g. one for a diffuse color map, one for an opacity map, etc.).

Number : getNumUVMaps()

Deprecated

This is deprecated because its name is somewhat of a misnomer. Use getNumGLMaps instead.

Return Value:

  • The number of OpenGL texture maps necessary for rendering this material in OpenGL (e.g. one for a diffuse color map, one for an opacity map, etc.).

DzTexture : getOpacityMap()

Return Value:

  • The opacity map for this material.

DzBoolProperty : getPropagatePriorityControl()

Return Value:

  • The property that controls the render priority propagation for this material.

DzEnumProperty : getRenderPriorityControl()

Return Value:

  • The property that controls the render priority for this material.

Array : getShapeList()

Return Value:

  • A list of the shapes this material is on.

DzFloatProperty : getSmoothAngleControl()

Return Value:

  • The property that controls the smoothing angle for this material.

DzBoolProperty : getSmoothControl()

Return Value:

  • The property that controls whether smoothing is enabled for this material.

Number : getSmoothingAngle()

Return Value:

  • The current smoothing angle for the material.

Array : getTags()

Return Value:

  • A list of [trimmed] tags on this material.

Since:

  • 4.7.1.29

DzStringProperty : getTagsControl()

Return Value:

  • The property that holds the tags for this material.

Since:

  • 4.7.1.29

DzEnumProperty : getUVSetControl()

Return Value:

  • The property that controls the active UV set for this material.

Boolean : isColorMappable()

Return Value:

  • true if the material supports mapping of the Diffuse channel, otherwise false.

Boolean : isHighlighted()

Return Value:

  • true if the material is currently drawn with a highlight, otherwise false.

Boolean : isOpacityMappable()

Return Value:

  • true if the material supports mapping of the Opacity channel, otherwise false.

Boolean : isOpaque()

Return Value:

  • true if this material is opaque, otherwise false.

Boolean : isPropagateRenderPriorityToNodesEnabled()

Return Value:

  • Whether or not this material should propagate its render priority up to all the nodes that use it.

Boolean : isSelected()

Retrieve selection state.

Return Value:

  • true if the material is selected, otherwise false.

Boolean : isSmoothingOn()

Return Value:

  • true if smoothing is enabled for the material, otherwise false.

Boolean : modifyAsset()

Marks the asset as being modified. Makes the current author the author of the file.

Return Value:

  • true if the asset was successfully marked as modified, otherwise false.

Boolean : modifyAsset( DzUri newUri )

Marks the asset as being modified. Makes the current author the author of the file. Sets the file URI for the asset to the given URI.

Parameter(s):

  • newUri - The new file URI to set for the asset.

Return Value:

  • true if the asset was successfully marked as modified, otherwise false.

Boolean : needsPtex()

TODO: Add description.


Boolean : needsTangentSpaceParams()

Return Value:

  • true if the rendering geometry needs the additional dPds and dPdsM parameters for shaders, otherwise false.

void : select( Boolean onOff )

Set the selection state for this material.

Parameter(s):

  • onOff - If true, the material will be selected. If false, the material will be deselected.

void : setBakedMap( DzTexture img )

Set the 'baked' shader map for this material. This overrides any current material settings and just draws the map. This is useful for representing the results of off-line shaders that can not be represented in OpenGL - the results of the shader are 'baked' onto a texture map, and then applied to the material with this function.

Parameter(s):

  • img - The image that will be applied to the material instead of the current material settings. If NULL, the current baked map is cleared and the material is returned to using its current settings.

void : setBaseOpacity( Number val )

Set the opacity value for this material.


void : setColorMap( DzTexture img )

Set the color ('texture') map for this material.


void : setDiffuseColor( Color color )

Set the diffuse color for this material.


void : setOpacityMap( DzTexture img )

Set the opactiy map for this material.


void : setSmoothingAngle( Number angle )

Sets the smoothing angle for the material. This only has effect on the material if smoothing is enabled.

Parameter(s):

  • angle - The smoothing angle for the material. Any edges on the mesh where angle of the normals of the adjacent facets is less than this value will be smoothed. Higher values mean more smoothing, lower values mean less smoothing.

void : setSmoothingOn( Boolean onOff )

Sets whether or not smoothing is enabled for the material.

Parameter(s):

  • onOff - If true, smoothing is applied according to the smoothing angle. If false, no smoothing is applied to the material.

Boolean : shadersMatch( DzMaterial otherMat )

Return Value:

  • true if these materials are using the same shaders, otherwise false.

Default implementation returns true if the materials are the same class.


Boolean : shouldAlwaysEmbed()

Return Value:

  • true if this material should always embed into a DSON scene, otherwise false.

void : startDrawHighlight()

Causes this material to be drawn with a highlight based on the styles current highlight color. This is used by material selection tools, etc, to give visual feedback to the user about a material in the viewport.


void : stopDrawHighlight()

Causes this material to stop being drawn with a highlight.

Signals


void : assetModified()

Signature:“assetModified()”

Emitted when the material has been modified.


void : assetWasSaved()

Signature:“assetWasSaved()”

Emitted after the material has been saved.


void : bakedMapChanged()

Signature:“bakedMapChanged()”

Transmitted when the baked map of this material changes.


void : selectionStateChanged( DzMaterial mat, Boolean onOff )

Signature:“selectionStateChanged(DzMaterial*,bool)”

Transmitted when the selection state of this material changes.


void : settingsChanged()

Signature:“settingsChanged()”

Transmitted when one of the values of this material changes.


void : smoothingChanged()

Signature:“smoothingChanged()”

Transmitted when the smoothing settings of this material change.


void : tagsChanged()

Signature:“tagsChanged()”

Transmitted when the tags on this material change.


void : uvsChanged()

Signature:“uvsChanged()”

Transmitted when the uv settings of this material change.