c4d.NodeMaterial¶
-
class
c4d.
NodeMaterial
¶ - The node-based material with the Mbase type.This class is a collection of accessors to node-related functionality that are grouped for clarity purposes.Note that any
c4d.BaseMaterial
can be elevated to ac4d.NodeMaterial
, no special construction is needed.New in version S24.
Methods Signatures
Checks whether the node space under the provided id was instantiated for the material. |
|
Returns the node path to the material end node. |
|
Returns the node path to the solo node. |
|
Returns the corresponding |
|
|
Calculates the |
Returns the node graph for the provided node space id. |
|
Creates a node graph for the provided node space identifier if a graph does not already exist. |
|
Creates a node graph populated with default nodes for the provided node space identifier if a graph does not already exist. |
|
Creates an empty node graph for the provided node space identifier if a graph does not already exist. |
|
Removes a node graph for the provided node space id if there is a graph. |
|
Returns the |
|
Returns the uuid of the given |
Static Methods Signatures
|
Determines the paths pointing to directories that are used to reference images by relative path in a particular |
Returns the material owner of the provided graph. |
Inheritance
Parent Class:
Methods Documentation
-
NodeMaterial.
HasSpace
(self, spaceId)¶ Checks whether the node space under the provided id was instantiated for the material.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Returns
Returns True if the node space exists, False otherwise.
- Return type
bool
-
NodeMaterial.
GetMaterialNodePath
(self, spaceId)¶ Returns the node path to the material end node.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Returns
The path to the material end node.
- Return type
-
NodeMaterial.
GetSoloNodePath
(self, spaceId)¶ Returns the node path to the solo node.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Returns
The path to the solo node, empty if nothing was soloed.
- Return type
-
NodeMaterial.
GetBaseListForNode
(self, spaceId, nodePath)¶ Returns the corresponding
c4d.BaseList2D
element for amaxon.GraphNode
.- Parameters
spaceId (
maxon.Id
) – The id of the node space.nodePath (
maxon.NodePath
) – Absolute Path to the Node.
- Returns
BaseList2D element. The return value can be None if there’s no corresponding element, or if it refers to an inner node.
- Return type
Optional[c4d.BaseList2D]
-
NodeMaterial.
GetDescIDForNodePort
(self, spaceId, node, port)¶ Calculates the
c4d.DescID
for a given port.- Parameters
spaceId (
maxon.Id
) – The id of the node space.node (
maxon.node
) – The node that owns the port.port (
maxon.node
) – The port.
- Returns
The description ID of the port.
- Return type
-
NodeMaterial.
GetGraph
(self, spaceId)¶ Returns the node graph for the provided node space id.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Raises
SystemError – If the material does not have this space.
- Returns
Returns the node graph.
- Return type
-
NodeMaterial.
AddGraph
(self, spaceId)¶ Creates a node graph for the provided node space identifier if a graph does not already exist.
Deprecated since version 2023.1.0: Use
NodeMaterial.CreateDefaultGraph()
orNodeMaterial.CreateEmptyGraph()
.- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Returns
The added graph.
- Return type
-
NodeMaterial.
CreateDefaultGraph
(self, spaceId)¶ Creates a node graph populated with default nodes for the provided node space identifier if a graph does not already exist.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Returns
The added graph.
- Return type
-
NodeMaterial.
CreateEmptyGraph
(self, spaceId)¶ Creates an empty node graph for the provided node space identifier if a graph does not already exist.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.- Returns
The added graph.
- Return type
-
NodeMaterial.
RemoveGraph
(self, spaceId)¶ Removes a node graph for the provided node space id if there is a graph.
- Parameters
spaceId (
maxon.Id
) – The id of the node space.
-
NodeMaterial.
UuidToBaseList2D
(self, spaceId, uuid)¶ Returns the
c4d.BaseList2D
element with the given uuid.- Parameters
spaceId (
maxon.Id
) – The id of the node space.uuid (
maxon.Uuid
) – Uuid to find.
- Returns
BaseList2D object.
- Return type
-
NodeMaterial.
BaseList2DToUuid
(self, spaceId, object)¶ Returns the uuid of the given
c4d.BaseList2D
object.- Parameters
spaceId (
maxon.Id
) – The id of the node space.object (c4d.BaseList2D) –
c4d.BaseList2D
object to find.
- Return type
- Returns
The uuid
Static Methods Documentation
-
static
c4d.NodeMaterial.
GetTextureSearchPaths
(secondaryPath, documentPath)¶ Determines the paths pointing to directories that are used to reference images by relative path in a particular
c4d.documents.BaseDocument
.>>> doc = c4d.documents.GetActiveDocument() >>> secondaryPath = maxon.Url(doc.GetDataInstance()[c4d.DOCUMENT_SECONDARYPATH]) >>> docPath = maxon.Url(doc.GetDocumentPath()) >>> docPath file:///C:/Users/m_adam/Documents >>> textureSearchPaths = c4d.NodeMaterial.GetTextureSearchPaths(secondaryPath, docPath) >>> for path in textureSearchPaths: ... print(path) file:///C:/Users/m_adam/Documents file:///C:/Users/m_adam/Documents/tex file:///C:/Users/m_adam/Documents/MAXON/Build/24.029 file:///C:/Users/m_adam/Documents/MAXON/Build/24.029_/tex file:///C:/Users/m_adam/AppData/Roaming/Maxon/24.029_0F21F86A file:///C:/Users/m_adam/AppData/Roaming/Maxon/24.029_0F21F86A/tex
- Parameters
- Return type
- Returns
The set of paths in which the images may be located.
-
static
c4d.NodeMaterial.
GetMaterial
(graph)¶ Returns the material owner of the provided graph.
Note
The returned BaseMaterial is only safe for access in the usual places of the API.You must avoid to perform read or write access to it in an arbitrary worker thread.- Parameters
graph (
maxon.NodesGraphModelRef
) – The node graph of the owner.- Returns
Returns the owner of the node graph, None if unknown or on failure to retrieve.
- Return type
Optional[c4d.BaseMaterial]