Verwenden von Volltonfarben

Die SDSpotColorLibrary -Klasse, auf die von der SDApplication-Klasse zugegriffen werden kann, enthält Informationen zu den in Designer enthaltenen Volltonfarbbibliotheken.

Mit dieser Klasse können Farbbücher und Schmuckfarben aufgelistet werden, um bestimmte Schmuckfarben oder die Schmuckfarbe zu finden, die einer bestimmten RGB am nächsten kommt.

Volltonfarben sind nicht verfügbar in Designer, wenn OpenColorIO verwendet wird. In diesem Fall gibt app.getSpotColorLibrary() None zurück.

IMPORTANT
Volltonfarben sind nicht verfügbar in Designer, wenn OpenColorIO verwendet wird. In diesem Fall gibt app.getSpotColorLibrary() None zurück.
import sd



ctx = sd.getContext()

app = ctx.getSDApplication()

spotLib = app.getSpotColorLibrary()



## Find a color by color book and color name.

col = spotLib.findSpotColorByName(

    spotColorBookName="PANTONE+ Solid Coated",

    spotColorName="PANTONE Yellow 012 C"

)



print(col)

print(col.get())



print(spotLib.getSpotColorBookName(col))

print(spotLib.getSpotColorName(col))



## Find the closest spot color in a specific book, to an RGB color.

## The RGB color is specified in the working color space currently used by Designer.

col = spotLib.findClosestSpotColor(

    spotColorBookName="PANTONE+ Solid Coated",

    r=88 / 255.0,

    g=132 / 255.0,

    b=167 / 255.0

)



print(col)

print(col.get())

print(spotLib.getSpotColorBookName(col))

print(spotLib.getSpotColorName(col))

Volltonfarben können aus den Knoteneigenschaften abgerufen und in diese eingefügt werden.

import sd

from sd.api.sdbasetypes import *

from sd.api.sdvaluecolorrgba import SDValueColorRGBA

from sd.api.sdvaluespotcolor import SDValueSpotColor



ctx = sd.getContext()

app = ctx.getSDApplication()

uiMgr = app.getUIMgr()

spotLib = app.getSpotColorLibrary()



node = uiMgr.getCurrentGraphSelection()[0]



## Set RGBA color in node property.

rgbaColor = SDValueColorRGBA.sNew(ColorRGBA(0.7, 0.5, 0.2, 1))

node.setInputPropertyValueFromId("outputcolor", rgbaColor)



## Set spot color in node property.

spotColor = spotLib.findSpotColorByName(

    spotColorBookName="PANTONE+ Solid Coated",

    spotColorName="PANTONE Yellow 012 C"

)

node.setInputPropertyValueFromId("outputcolor", spotColor)



## Get color from node property (could be a SDValueColorRGBA or a SDValueSpotColor)

anyColor = node.getInputPropertyValueFromId("outputcolor")



## Print the RGBA components of the color.

print(anyColor.get())



## Check if the color is a spot color.

if isinstance(anyColor, SDValueSpotColor):

## Print the spot color information of the color.

    print(spotLib.getSpotColorBookName(anyColor))

    print(spotLib.getSpotColorName(anyColor))


recommendation-more-help
substance-3d-designer-help-guide