SourceUniformColor
SourceUniformColor is a type of source that output an uniform texture from a given color.
For more information, see module colormanagement.
Example
import random
import substance_painter as sp
# Get the currently displayed stack
stack = sp.textureset.get_active_stack()
position = sp.layerstack.InsertPosition.from_textureset_stack(stack)
# Insert a fill layer and setup an uniform color source plugged to the basecolor
fill = sp.layerstack.insert_fill(position)
grey = sp.colormanagement.Color(0.5, 0.5, 0.5)
fill.set_source(sp.textureset.ChannelType.BaseColor, grey)
# Edit the color parameter
src = fill.get_source(sp.textureset.ChannelType.BaseColor)
color = src.get_color()
new_color = sp.colormanagement.Color(
color.value[0] + random.uniform(-0.5, 0.5),
color.value[1] + random.uniform(-0.5, 0.5),
color.value[2] + random.uniform(-0.5, 0.5))
src.set_color(new_color)
# Select the Fill layer
sp.layerstack.set_selected_nodes([fill])
class substance_painter.source.SourceUniformColor(uid) substance_painter.source.SourceUniformColor
A class that represents an uniform color source.
get_color() -> Color substance_painter.source.SourceUniformColor.get_color
Get the uniform color of the source.
Returns: The uniform color used by the source.
Return type: Color
set_color(color: Color) -> None substance_painter.source.SourceUniformColor.set_color
Set the uniform color of the source.
Parameters: color (Color) – The desired uniform color.
Return type: None
uid() -> int substance_painter.source.SourceUniformColor.uid
Get the object internal uid.
Returns: The internal identifier of the object as an integer.
Return type: int
recommendation-more-help
substance-3d-dev-help-painter-python-guide