c4d.modules.substance
¶
New in version R18.020.
c4d.modules.substance.
ImportSubstance
(
doc
,
fn
,
copyFile
,
errPopup
,
addUndo
,
createMaterial
)
¶
Imports a Substance asset file (.sbsar) into doc .
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Return type: |
tuple(int,
|
||||||||
Returns: |
A tuple with the following information: int: The result for the import:
c4d.BaseList2D
: The imported Substance asset.
int: User’s choice if
copyFile
was
ASK
. Otherwise same as passed to
copyFile
.
|
c4d.modules.substance.
CreateMaterial
(
asset
,
graphIndex
,
mode
)
¶
Creates a Cinema 4D standard material from asset .
Parameters: |
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | |||||||||||
Returns: |
The created material. |
c4d.modules.substance.
CreateSubstanceShader
(
asset
)
¶
Creates a Substance shader linked to asset .
Parameters: |
asset
(
c4d.BaseList2D
) – The Substance asset. Can be
None
(since R18.039).
|
---|---|
Return type: |
c4d.BaseShader
|
Returns: | The created Substance shader. |
c4d.modules.substance.
AssignChannelToMaterial
(
asset
,
mat
,
channelId
,
outputUid
,
addUndo
)
¶
Parameters: |
|
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||||||||
Returns: |
True if successful, otherwise False . |
c4d.modules.substance.
GetFirstSubstance
(
doc
)
¶
Retrieves the first Substance asset in doc .
Parameters: |
doc
(
c4d.documents.BaseDocument
) – The document.
|
---|---|
Return type: |
c4d.BaseList2D
|
Returns: | The first Substance asset, or None if none exists. |
c4d.modules.substance.
GetSubstances
(
doc
,
onlySelected
)
¶
Retrieves all (or only selected) Substance assets in doc .
Parameters: |
|
---|---|
Return type: |
list of
|
Returns: |
The retrieved Substance assets. |
c4d.modules.substance.
InsertLastSubstance
(
doc
,
asset
)
¶
Inserts asset into doc as last element.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
c4d.modules.substance.
GetSubstanceGraph
(
asset
[
,
prevGraph=None
]
)
¶
Retrieves the Substance graph. This function may be used to iterate over the graphs of asset .
Parameters: |
|
---|---|
Return type: |
tuple(PyCObject, str) |
Returns: |
The Substance graph and its name. |
c4d.modules.substance.
GetSubstanceInput
(
asset
,
graph
[
,
prevInput=None
]
)
¶
Retrieves the Substance input of an asset. This function may be used to iterate over the inputs of graph for asset .
Parameters: |
|
||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
tuple(PyCObject, int, int, int, int, str) |
||||||||||||||||||||||||||||
Returns: |
A tuple with the following information: The Substance input, or None if input is not available. The unique ID of the input. Only valid if the function does not return None . The ID of the first component of the input parameter in Cinema 4D. This ID can be used to create a
c4d.DescId
for
C4DAtom.SetParameter()
. Only valid if the function does not return
None
.
The number of description elements used in Cinema 4D to represent the Substance input parameter. Only valid if the function does not return
None
.
The data type of the input. Only valid if the function does not return
None
.
|
c4d.modules.substance.
GetSubstanceOutput
(
asset
,
graph
,
getBitmap
[
,
prevOutput=None
]
)
¶
Retrieves the Substance output of an asset. This function may be used to iterate over the outputs of graph for asset .
Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
tuple(PyCObject, int, int, str,
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: |
A tuple with the following information: The Substance output, or None if output is not available. The unique ID of the output. Only valid if the function does not return None . The output type ID. Only valid if the function does not return None as Substance output. The name of the returned output. Only valid if the function does not return None . The clone of the output channel bitmap. Only valid if the function does not return None and getBitmap was passed True . |
c4d.modules.substance.
PrefsGetMaterialModeSetting
(
)
¶
Convenience function to get the material creation mode set in Substance preferences.
Return type: | int | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
The material creation mode:
|
c4d.modules.substance.
PrefsGetPreviewSetting
(
)
¶
Convenience function to get the preview mode for Content Browser set in Substance preferences.
Return type: | int |
---|---|
Returns: | 0 for mosaic preview, otherwise rendered preview scene. |
c4d.modules.substance.
MaterialUsesSubstance
(
mat
)
¶
Checks if mat contains any Substance shaders.
Parameters: |
mat
(
c4d.BaseMaterial
) – The material to check for Substance shaders.
|
---|---|
Return type: | bool |
Returns: | True if the material uses a Substance shader, otherwise False . |
c4d.modules.substance.
GetSubstanceMosaicPreview
(
asset
,
w
,
h
)
¶
Returns an image with previews of the output channels of asset .
Note
While the Substance asset won’t have to be re-rendered, this operation still involves downscaling of all Substance outputs.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The resulting preview bitmap. |