File size: 17,158 Bytes
d8ab1df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 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 204 205 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 292 293 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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
Sdr module — pxr-usd-api 105.1 documentation
pxr-usd-api
»
Modules »
Sdr module
# Sdr module
Summary: The Sdr (Shader Definition Registry) is a specialized version of Ndr for Shaders.
Python bindings for libSdr
Classes:
NodeContext
NodeMetadata
NodeRole
PropertyMetadata
PropertyRole
PropertyTypes
Registry
The shading-specialized version of NdrRegistry .
ShaderNode
A specialized version of NdrNode which holds shading information.
ShaderNodeList
ShaderProperty
A specialized version of NdrProperty which holds shading information.
class pxr.Sdr.NodeContext
Attributes:
Displacement
Light
LightFilter
Pattern
PixelFilter
SampleFilter
Surface
Volume
Displacement = 'displacement'
Light = 'light'
LightFilter = 'lightFilter'
Pattern = 'pattern'
PixelFilter = 'pixelFilter'
SampleFilter = 'sampleFilter'
Surface = 'surface'
Volume = 'volume'
class pxr.Sdr.NodeMetadata
Attributes:
Category
Departments
Help
ImplementationName
Label
Pages
Primvars
Role
SdrDefinitionNameFallbackPrefix
SdrUsdEncodingVersion
Target
Category = 'category'
Departments = 'departments'
Help = 'help'
ImplementationName = '__SDR__implementationName'
Label = 'label'
Pages = 'pages'
Primvars = 'primvars'
Role = 'role'
SdrDefinitionNameFallbackPrefix = 'sdrDefinitionNameFallbackPrefix'
SdrUsdEncodingVersion = 'sdrUsdEncodingVersion'
Target = '__SDR__target'
class pxr.Sdr.NodeRole
Attributes:
Field
Math
Primvar
Texture
Field = 'field'
Math = 'math'
Primvar = 'primvar'
Texture = 'texture'
class pxr.Sdr.PropertyMetadata
Attributes:
Colorspace
Connectable
DefaultInput
Help
Hints
ImplementationName
IsAssetIdentifier
IsDynamicArray
Label
Options
Page
RenderType
Role
SdrUsdDefinitionType
Target
ValidConnectionTypes
VstructConditionalExpr
VstructMemberName
VstructMemberOf
Widget
Colorspace = '__SDR__colorspace'
Connectable = 'connectable'
DefaultInput = '__SDR__defaultinput'
Help = 'help'
Hints = 'hints'
ImplementationName = '__SDR__implementationName'
IsAssetIdentifier = '__SDR__isAssetIdentifier'
IsDynamicArray = 'isDynamicArray'
Label = 'label'
Options = 'options'
Page = 'page'
RenderType = 'renderType'
Role = 'role'
SdrUsdDefinitionType = 'sdrUsdDefinitionType'
Target = '__SDR__target'
ValidConnectionTypes = 'validConnectionTypes'
VstructConditionalExpr = 'vstructConditionalExpr'
VstructMemberName = 'vstructMemberName'
VstructMemberOf = 'vstructMemberOf'
Widget = 'widget'
class pxr.Sdr.PropertyRole
Attributes:
None
None = 'none'
class pxr.Sdr.PropertyTypes
Attributes:
Color
Color4
Float
Int
Matrix
Normal
Point
String
Struct
Terminal
Unknown
Vector
Vstruct
Color = 'color'
Color4 = 'color4'
Float = 'float'
Int = 'int'
Matrix = 'matrix'
Normal = 'normal'
Point = 'point'
String = 'string'
Struct = 'struct'
Terminal = 'terminal'
Unknown = 'unknown'
Vector = 'vector'
Vstruct = 'vstruct'
class pxr.Sdr.Registry
The shading-specialized version of NdrRegistry .
Methods:
GetShaderNodeByIdentifier(identifier, ...)
Exactly like NdrRegistry::GetNodeByIdentifier() , but returns a SdrShaderNode pointer instead of a NdrNode pointer.
GetShaderNodeByIdentifierAndType(identifier, ...)
Exactly like NdrRegistry::GetNodeByIdentifierAndType() , but returns a SdrShaderNode pointer instead of a NdrNode pointer.
GetShaderNodeByName(name, typePriority, filter)
Exactly like NdrRegistry::GetNodeByName() , but returns a SdrShaderNode pointer instead of a NdrNode pointer.
GetShaderNodeByNameAndType(name, nodeType, ...)
Exactly like NdrRegistry::GetNodeByNameAndType() , but returns a SdrShaderNode pointer instead of a NdrNode pointer.
GetShaderNodeFromAsset(shaderAsset, ...)
Wrapper method for NdrRegistry::GetNodeFromAsset() .
GetShaderNodeFromSourceCode(sourceCode, ...)
Wrapper method for NdrRegistry::GetNodeFromSourceCode() .
GetShaderNodesByFamily(family, filter)
Exactly like NdrRegistry::GetNodesByFamily() , but returns a vector of SdrShaderNode pointers instead of a vector of NdrNode pointers.
GetShaderNodesByIdentifier(identifier)
Exactly like NdrRegistry::GetNodesByIdentifier() , but returns a vector of SdrShaderNode pointers instead of a vector of NdrNode pointers.
GetShaderNodesByName(name, filter)
Exactly like NdrRegistry::GetNodesByName() , but returns a vector of SdrShaderNode pointers instead of a vector of NdrNode pointers.
Attributes:
expired
True if this object has expired, False otherwise.
GetShaderNodeByIdentifier(identifier, typePriority) → ShaderNode
Exactly like NdrRegistry::GetNodeByIdentifier() , but returns a
SdrShaderNode pointer instead of a NdrNode pointer.
Parameters
identifier (NdrIdentifier) –
typePriority (NdrTokenVec) –
GetShaderNodeByIdentifierAndType(identifier, nodeType) → ShaderNode
Exactly like NdrRegistry::GetNodeByIdentifierAndType() , but
returns a SdrShaderNode pointer instead of a NdrNode pointer.
Parameters
identifier (NdrIdentifier) –
nodeType (str) –
GetShaderNodeByName(name, typePriority, filter) → ShaderNode
Exactly like NdrRegistry::GetNodeByName() , but returns a
SdrShaderNode pointer instead of a NdrNode pointer.
Parameters
name (str) –
typePriority (NdrTokenVec) –
filter (VersionFilter) –
GetShaderNodeByNameAndType(name, nodeType, filter) → ShaderNode
Exactly like NdrRegistry::GetNodeByNameAndType() , but returns a
SdrShaderNode pointer instead of a NdrNode pointer.
Parameters
name (str) –
nodeType (str) –
filter (VersionFilter) –
GetShaderNodeFromAsset(shaderAsset, metadata, subIdentifier, sourceType) → ShaderNode
Wrapper method for NdrRegistry::GetNodeFromAsset() .
Returns a valid SdrShaderNode pointer upon success.
Parameters
shaderAsset (AssetPath) –
metadata (NdrTokenMap) –
subIdentifier (str) –
sourceType (str) –
GetShaderNodeFromSourceCode(sourceCode, sourceType, metadata) → ShaderNode
Wrapper method for NdrRegistry::GetNodeFromSourceCode() .
Returns a valid SdrShaderNode pointer upon success.
Parameters
sourceCode (str) –
sourceType (str) –
metadata (NdrTokenMap) –
GetShaderNodesByFamily(family, filter) → SdrShaderNodePtrVec
Exactly like NdrRegistry::GetNodesByFamily() , but returns a
vector of SdrShaderNode pointers instead of a vector of
NdrNode pointers.
Parameters
family (str) –
filter (VersionFilter) –
GetShaderNodesByIdentifier(identifier) → SdrShaderNodePtrVec
Exactly like NdrRegistry::GetNodesByIdentifier() , but returns a
vector of SdrShaderNode pointers instead of a vector of
NdrNode pointers.
Parameters
identifier (NdrIdentifier) –
GetShaderNodesByName(name, filter) → SdrShaderNodePtrVec
Exactly like NdrRegistry::GetNodesByName() , but returns a vector
of SdrShaderNode pointers instead of a vector of NdrNode
pointers.
Parameters
name (str) –
filter (VersionFilter) –
property expired
True if this object has expired, False otherwise.
class pxr.Sdr.ShaderNode
A specialized version of NdrNode which holds shading information.
Methods:
GetAdditionalPrimvarProperties()
The list of string input properties whose values provide the names of additional primvars consumed by this node.
GetAllVstructNames()
Gets all vstructs that are present in the shader.
GetAssetIdentifierInputNames()
Returns the list of all inputs that are tagged as asset identifier inputs.
GetCategory()
The category assigned to this node, if any.
GetDefaultInput()
Returns the first shader input that is tagged as the default input.
GetDepartments()
The departments this node is associated with, if any.
GetHelp()
The help message assigned to this node, if any.
GetImplementationName()
Returns the implementation name of this node.
GetLabel()
The label assigned to this node, if any.
GetPages()
Gets the pages on which the node's properties reside (an aggregate of the unique SdrShaderProperty::GetPage() values for all of the node's properties).
GetPrimvars()
The list of primvars this node knows it requires / uses.
GetPropertyNamesForPage(pageName)
Gets the names of the properties on a certain page (one that was returned by GetPages() ).
GetRole()
Returns the role of this node.
GetShaderInput(inputName)
Get a shader input property by name.
GetShaderOutput(outputName)
Get a shader output property by name.
GetAdditionalPrimvarProperties() → NdrTokenVec
The list of string input properties whose values provide the names of
additional primvars consumed by this node.
For example, this may return a token named varname . This
indicates that the client should query the value of a (presumed to be
string-valued) input attribute named varname from its scene
description to determine the name of a primvar the node will consume.
See GetPrimvars() for additional information.
GetAllVstructNames() → NdrTokenVec
Gets all vstructs that are present in the shader.
GetAssetIdentifierInputNames() → NdrTokenVec
Returns the list of all inputs that are tagged as asset identifier
inputs.
GetCategory() → str
The category assigned to this node, if any.
Distinct from the family returned from GetFamily() .
GetDefaultInput() → ShaderProperty
Returns the first shader input that is tagged as the default input.
A default input and its value can be used to acquire a fallback value
for a node when the node is considered’disabled’or otherwise incapable
of producing an output value.
GetDepartments() → NdrTokenVec
The departments this node is associated with, if any.
GetHelp() → str
The help message assigned to this node, if any.
GetImplementationName() → str
Returns the implementation name of this node.
The name of the node is how to refer to the node in shader networks.
The label is how to present this node to users. The implementation
name is the name of the function (or something) this node represents
in the implementation. Any client using the implementation must
call this method to get the correct name; using getName() is not
correct.
GetLabel() → str
The label assigned to this node, if any.
Distinct from the name returned from GetName() . In the context of
a UI, the label value might be used as the display name for the node
instead of the name.
GetPages() → NdrTokenVec
Gets the pages on which the node’s properties reside (an aggregate of
the unique SdrShaderProperty::GetPage() values for all of the
node’s properties).
Nodes themselves do not reside on pages. In an example scenario,
properties might be divided into two pages,’Simple’and’Advanced’.
GetPrimvars() → NdrTokenVec
The list of primvars this node knows it requires / uses.
For example, a shader node may require the’normals’primvar to function
correctly. Additional, user specified primvars may have been authored
on the node. These can be queried via
GetAdditionalPrimvarProperties() . Together, GetPrimvars() and
GetAdditionalPrimvarProperties() , provide the complete list of
primvar requirements for the node.
GetPropertyNamesForPage(pageName) → NdrTokenVec
Gets the names of the properties on a certain page (one that was
returned by GetPages() ).
To get properties that are not assigned to a page, an empty string can
be used for pageName .
Parameters
pageName (str) –
GetRole() → str
Returns the role of this node.
This is used to annotate the role that the shader node plays inside a
shader network. We can tag certain shaders to indicate their role
within a shading network. We currently tag primvar reading nodes,
texture reading nodes and nodes that access volume fields (like
extinction or scattering). This is done to identify resources used by
a shading network.
GetShaderInput(inputName) → ShaderProperty
Get a shader input property by name.
nullptr is returned if an input with the given name does not
exist.
Parameters
inputName (str) –
GetShaderOutput(outputName) → ShaderProperty
Get a shader output property by name.
nullptr is returned if an output with the given name does not
exist.
Parameters
outputName (str) –
class pxr.Sdr.ShaderNodeList
Methods:
append
extend
append()
extend()
class pxr.Sdr.ShaderProperty
A specialized version of NdrProperty which holds shading
information.
Methods:
GetDefaultValueAsSdfType()
Accessor for default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.
GetHelp()
The help message assigned to this property, if any.
GetHints()
Any UI"hints"that are associated with this property.
GetImplementationName()
Returns the implementation name of this property.
GetLabel()
The label assigned to this property, if any.
GetOptions()
If the property has a set of valid values that are pre-determined, this will return the valid option names and corresponding string values (if the option was specified with a value).
GetPage()
The page (group), eg"Advanced", this property appears on, if any.
GetVStructConditionalExpr()
If this field is part of a vstruct, this is the conditional expression.
GetVStructMemberName()
If this field is part of a vstruct, this is its name in the struct.
GetVStructMemberOf()
If this field is part of a vstruct, this is the name of the struct.
GetValidConnectionTypes()
Gets the list of valid connection types for this property.
GetWidget()
The widget"hint"that indicates the widget that can best display the type of data contained in this property, if any.
IsAssetIdentifier()
Determines if the value held by this property is an asset identifier (eg, a file path); the logic for this is left up to the parser.
IsDefaultInput()
Determines if the value held by this property is the default input for this node.
IsVStruct()
Returns true if the field is the head of a vstruct.
IsVStructMember()
Returns true if this field is part of a vstruct.
GetDefaultValueAsSdfType() → VtValue
Accessor for default value corresponding to the SdfValueTypeName
returned by GetTypeAsSdfType.
Note that this is different than GetDefaultValue which returns the
default value associated with the SdrPropertyType and may differ from
the SdfValueTypeName, example when sdrUsdDefinitionType metadata is
specified for a sdr property.
GetTypeAsSdfType
GetHelp() → str
The help message assigned to this property, if any.
GetHints() → NdrTokenMap
Any UI”hints”that are associated with this property.
“Hints”are simple key/value pairs.
GetImplementationName() → str
Returns the implementation name of this property.
The name of the property is how to refer to the property in shader
networks. The label is how to present this property to users. The
implementation name is the name of the parameter this property
represents in the implementation. Any client using the implementation
must call this method to get the correct name; using getName()
is not correct.
GetLabel() → str
The label assigned to this property, if any.
Distinct from the name returned from GetName() . In the context of
a UI, the label value might be used as the display name for the
property instead of the name.
GetOptions() → NdrOptionVec
If the property has a set of valid values that are pre-determined,
this will return the valid option names and corresponding string
values (if the option was specified with a value).
GetPage() → str
The page (group), eg”Advanced”, this property appears on, if any.
Note that the page for a shader property can be nested, delimited
by”:”, representing the hierarchy of sub-pages a property is defined
in.
GetVStructConditionalExpr() → str
If this field is part of a vstruct, this is the conditional
expression.
GetVStructMemberName() → str
If this field is part of a vstruct, this is its name in the struct.
GetVStructMemberOf() → str
If this field is part of a vstruct, this is the name of the struct.
GetValidConnectionTypes() → NdrTokenVec
Gets the list of valid connection types for this property.
This value comes from shader metadata, and may not be specified. The
value from NdrProperty::GetType() can be used as a fallback, or
you can use the connectability test in CanConnectTo() .
GetWidget() → str
The widget”hint”that indicates the widget that can best display the
type of data contained in this property, if any.
Examples of this value could include”number”,”slider”, etc.
IsAssetIdentifier() → bool
Determines if the value held by this property is an asset identifier
(eg, a file path); the logic for this is left up to the parser.
Note: The type returned from GetTypeAsSdfType() will be Asset
if this method returns true (even though its true underlying data
type is string).
IsDefaultInput() → bool
Determines if the value held by this property is the default input for
this node.
IsVStruct() → bool
Returns true if the field is the head of a vstruct.
IsVStructMember() → bool
Returns true if this field is part of a vstruct.
© Copyright 2019-2023, NVIDIA.
Last updated on Nov 14, 2023.
|