NetworkMaterialEdit

A NetworkMaterialEdit node enables the editing of material locations using the NodegraphAPI. Since Katana 6.0v1 the NetworkMaterialEdit node has been scriptable.

NetworkMaterialEdit API

class NetworkMaterialEdit.NetworkMaterialEditNode

Bases: NetworkMaterialBaseNode

Class implementing the NetworkMaterialEdit SuperTool node type.

Since:

Katana 4.0v1

__init__()

Initializes an instance of this class.

polish()

This method is automatically called on the SuperTool after it has finished loading and initialization.

It will only be called once.

Initialize members and event handlers.

setDisableAutoUpdate(forceDisableAutoUpdate)

Passing True to forceDisableAutoUpdate will stop the internal nodegraph change flush functionality that is triggered by a timer to be registered. This means all NME nodegraph change events need to be flushed manually to take effect, see flushEdits.

Parameters:

forceDisableAutoUpdate (bool) – If set to true, auto updates are turned off in UI mode.

See:

flushEdits

Note:

Auto update is only available in UI mode, so setting this will only have an effect in that mode.

Since:

6.0v1

isAutoUpdateDisabled()

Returns whether auto-update is disabled for this B{NetworkMaterialEdit}.

Return type:

bool

Returns:

True if auto update is diabled, False if not.

See:

setDisableAutoUpdate

Note:

Auto update is only available in UI mode, so this will only have an effect in that mode.

Since:

6.0v1

setSceneGraphLocation(location)

Sets the sceneGraphLocation for the material to be edited, and repopulates the nodegraph from the upstream material. This calls repopulate, which may have some side effects detailed in the repopulate function.

Return type:

bool

Parameters:

location (str) – The scene graph location of the material this node will edit.

Returns:

Whether the repopulation of the B{NetworkMaterialEdit} was successful after setting a new scenegraph location.

See:

repopulate

Since:

6.0v1

repopulate(processAllEvents=True)

Repopulates the B{NetworkMaterialEdit}’s nodegraph from the upstream material, determined by the sceneGraphLocation parameter. Changes will only take immediate effect if processAllEvents is True as changes are executed via the event handling system, otherwise changes will be executed at the next Utils.EventModule.ProcessAllEvents call.

Return type:

bool

Parameters:

processAllEvents (bool) – Whether to internally call Utils.EventModule.ProcessAllEvents, defaults to True.

Returns:

True if this update was successful, otherwise False.

Note:

Calling this method regenerates the internals of the NetworkMaterialEdit node, therefore any references to nodes inside this group created before this call may be orphaned.

Since:

6.0v1

depopulate(processAllEvents=True)

Depopulates the B{NetworkMaterialEdit} node. Changes will only take immediate effect if processAllEvents is True as changes are executed via the event handling system, otherwise changes will be executed at the next Utils.EventModule.ProcessAllEvents call.

Parameters:

processAllEvents (bool) – Whether to internally call Utils.EventModule.ProcessAllEvents, defaults to True.

Note:

Calling this method clears the internals of the NetworkMaterialEdit node, therefore any references to nodes inside this group created before this call may be orphaned.

Since:

6.0v1

getLastUpstreamMaterialHash()

Get the last upstream hash of the B{material} attribute of this node.

Return type:

str or None

Returns:

Hash of the B{material} attribute, or None if the contents of this B{NetworkMaterialEdit} are empty.

Since:

6.0v1

isPopulated()

Checks if B{NetworkMaterialEdit}’s nodegraph is populated from an upstream material.

Return type:

bool

Returns:

True if the B{NetworkMaterialEdit}’s nodegraph is populated, otherwise False.

See:

repopulate

Since:

6.0v1

flushEdits(processAllEvents=True)

Flushes all edits that are saved and are relevant this B{NetworkMaterialEdit}. Edits are represented as 'nodegraph_changed' events that are internal to a B{NetworkMaterialEdit} (i.e a node has been added or a param has been edited), and contain the original event which was deemed to be relevant.

Parameters:

processAllEvents (bool) – Whether to internally call Utils.EventModule.ProcessAllEvents, defaults to True.

Note:

Calling this method regenerates the internals of the NetworkMaterialEdit node, therefore any references to nodes inside this group created before this call may be orphaned.

Since:

6.0v1

getMaterialAttr()

Get the resulting B{material} attribute of this node.

Return type:

FnAttribute.GroupAttribute or None

Returns:

B{material} attributes, or None if an appropriate GeometryProducer cannot be created.

Since:

6.0v1

getNetworkMaterialEditRequiresUpdate()

Checks if the Upstream Material hash does not match the one stored in this B{NetworkMaterialEdit} node.

Return type:

bool

Returns:

True if the B{NetworkMaterialEdit}’s material hash does not match the upstream material hash, otherwise False.

See:

isPopulated

Since:

6.0v1

handleNetworkMaterialNodeCreate(networkMaterialNode)

Handles the creation of a NetworkMaterial node’s utility nodes (GroupStack and Material).

This is called with a newly created NetworkMaterial immediately after _setupInternalNetwork.

Parameters:

networkMaterialNode (NodegraphAPI.Node) – The NetworkMaterial node being created.

Since:

Katana 4.0v1

getNetworkMaterials()

Get the (only) NetworkMaterial node.

Return type:

list of NodegraphAPI.Node

Returns:

List containing a single element, the internal NetworkMaterial.

Since:

Katana 4.0v1

isChildNodePersistent(node)

Check if given node should not be deleted when the NetworkMaterialEdit contents are cleared pending a re-population.

Return type:

bool

Parameters:

node (NodegraphAPI.Node) – Node to check.

Returns:

True if node is persistent, False otherwise.

getContentsLayoutAttributes(**kwargs)

Construct the layout attributes of child nodes (and their descendents)

Return type:

FnAttribute.GroupAttribute

Parameters:

kwargs – Ignored

Returns:

Layout attributes

getNodeStates()

Returns the “EditState” of all the internal interactive child nodes of this node.

Return type:

dict

Returns:

A dictionary of all child nodes keyed on their current “EditState”.

getNodeFromSourceNodeName(nodeName)

Get node within NetworkMaterialEdit that mirrors upstream node with given name.

Return type:

NodegraphAPI.Node or None

Parameters:

nodeName (str) – Upstream node’s name.

Returns:

Local node that mirrors node with given name, or None if not found.

isUserParameterEditingAllowed()
Return type:

bool

Returns:

False. The NetworkMaterialEdit node type does not support user parameters.

Since:

Katana 4.5v1

getSourceNodeNameFromNode(node)

Get the name of the upstream node that the given node mirrors.

Return type:

str or None

Parameters:

node (NodegraphAPI.Node) – Node to query.

Returns:

Upstream node’s name, or None if not found.

Since:

6.0v1

invalidateLayout()

Flag that material.B{layout} attributes need to be reconstructed.

Override base class to prevent cooking layout attributes if NME is currently populating.

getScenegraphLocation(frameTime=None)

This implementation ensures that the default value of the “sceneGraphLocation” parameter is always used for a NetworkMaterialEdit node.

Return type:

str

Parameters:

frameTime (float or None) – The frame time at which to evaluate the parameter that determines this function’s result, or None to evaluate the parameter at the current time (meaning the result of NodegraphAPI.GetCurrentTime()).

Returns:

The path of the scene graph location that this node primarily works with.