colorspace
Nuke Colorspace related methods
colorspace_exists_on_node(node, colorspace_name)
Check if colorspace exists on node
Look through all options in the colorspace knob, and see if we have an exact match to one of the items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node | Node | nuke node object | required |
colorspace_name | str | color profile name | required |
Returns:
Name | Type | Description |
---|---|---|
bool | True if exists |
Source code in client/ayon_nuke/api/colorspace.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
create_viewer_profile_string(viewer, display=None, path_like=False)
Convert viewer and display to string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
viewer | str | viewer name | required |
display | Optional[str] | display name | None |
path_like | Optional[bool] | if True, return path like string | False |
Returns:
Name | Type | Description |
---|---|---|
str | viewer config string |
Source code in client/ayon_nuke/api/colorspace.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
get_colorspace_list(colorspace_knob, node=None, consider_aliases=True)
Get available colorspace profile names
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colorspace_knob | Knob | nuke knob object | required |
node | Optional[Node] | nuke node for caching differentiation | None |
consider_aliases | Optional[bool] | optional flag to indicate if | True |
Returns:
Name | Type | Description |
---|---|---|
list | list of strings names of profiles |
Source code in client/ayon_nuke/api/colorspace.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
get_display_and_view_colorspaces(root_node)
Get all possible display and view colorspaces
This is stored in class variable to avoid multiple calls.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_node | Node | root node | required |
Returns:
Name | Type | Description |
---|---|---|
list | all possible display and view colorspaces |
Source code in client/ayon_nuke/api/colorspace.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
get_formatted_colorspace(colorspace_name, formatting_data, root_node=None)
Format colorspace profile name into string.
This method is formatting colorspace profile name. It is iterating over all possible combinations of input string which could be separated by COLOR_VALUE_SEPARATOR defined in constants.
If Anatomy template tokens are used but formatting data is not provided, it will try any other available variants in next position of the separator.
This method also validate that the formatted colorspace profile name is available in currently run nuke session ocio config.
Example
from ayon_nuke.api.colorspace import get_formatted_colorspace colorspace_name = "{project_code}_{context};ACES - ACEScg" formatting_data = { ... "context": "01sh010", ... "project_code": "proj01" ...} new_colorspace_name = get_formatted_colorspace( ... colorspace_name, formatting_data) print(new_colorspace_name) "proj01_01sh010"
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colorspace_name | str | colorspace profile name | required |
formatting_data | dict | formatting data | required |
root_node | Optional[Node] | root node | None |
Returns:
Name | Type | Description |
---|---|---|
str | formatted colorspace profile string ex: "ACES - ACEScg" |
Source code in client/ayon_nuke/api/colorspace.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
get_formatted_display_and_view(view_profile, formatting_data, root_node=None)
Format display and view profile into string.
This method is formatting a display and view profile. It is iterating over all possible combinations of display and view colorspaces. Those could be separated by COLOR_VALUE_SEPARATOR defined in constants.
If Anatomy template tokens are used but formatting data is not provided, it will try any other available variants in next position of the separator.
This method also validate that the formatted display and view profile is available in currently run nuke session ocio config.
Example
from ayon_nuke.api.colorspace import get_formatted_display_and_view view_profile = { ... "view": "{context};sRGB", ... "display": "{project_code};ACES" ... } formatting_data = { ... "context": "01sh010", ... "project_code": "proj01" ...} display_and_view = get_formatted_display_and_view( ... view_profile, formatting_data) print(display_and_view) "01sh010 (proj01)"
Parameters:
Name | Type | Description | Default |
---|---|---|---|
view_profile | dict | view and display profile | required |
formatting_data | dict | formatting data | required |
root_node | Optional[Node] | root node | None |
Returns:
Name | Type | Description |
---|---|---|
str | formatted display and view profile string ex: "sRGB (ACES)" |
Source code in client/ayon_nuke/api/colorspace.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
get_formatted_display_and_view_as_dict(view_profile, formatting_data, root_node=None)
Format display and view profile into dict.
This method is formatting a display and view profile. It is iterating over all possible combinations of display and view colorspaces. Those could be separated by COLOR_VALUE_SEPARATOR defined in constants.
If Anatomy template tokens are used but formatting data is not provided, it will try any other available variants in next position of the separator.
This method also validate that the formatted display and view profile is available in currently run nuke session ocio config.
Example
from ayon_nuke.api.colorspace import get_formatted_display_and_view_as_dict # noqa view_profile = { ... "view": "{context};sRGB", ... "display": "{project_code};ACES" ... } formatting_data = { ... "context": "01sh010", ... "project_code": "proj01" ...} display_and_view = get_formatted_display_and_view_as_dict( ... view_profile, formatting_data) print(display_and_view) {"view": "01sh010", "display": "proj01"}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
view_profile | dict | view and display profile | required |
formatting_data | dict | formatting data | required |
root_node | Optional[Node] | root node | None |
Returns:
Name | Type | Description |
---|---|---|
dict | formatted display and view profile in dict ex: {"view": "sRGB", "display": "ACES"} |
Source code in client/ayon_nuke/api/colorspace.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|