Loading...
Searching...
No Matches
instancedBySchema.h
Go to the documentation of this file.
1//
2// Copyright 2023 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
25
26/* ************************************************************************** */
27/* ** ** */
28/* ** This file is generated by a script. ** */
29/* ** ** */
30/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
31/* ** Edit hdSchemaDefs.py instead to make changes. ** */
32/* ** ** */
33/* ************************************************************************** */
34
35#ifndef PXR_IMAGING_HD_INSTANCED_BY_SCHEMA_H
36#define PXR_IMAGING_HD_INSTANCED_BY_SCHEMA_H
37
39
40#include "pxr/imaging/hd/api.h"
41
42#include "pxr/imaging/hd/schema.h"
43
44// --(BEGIN CUSTOM CODE: Includes)--
45// --(END CUSTOM CODE: Includes)--
46
47PXR_NAMESPACE_OPEN_SCOPE
48
49// --(BEGIN CUSTOM CODE: Declares)--
50// --(END CUSTOM CODE: Declares)--
51
52#define HD_INSTANCED_BY_SCHEMA_TOKENS \
53 (instancedBy) \
54 (paths) \
55 (prototypeRoots) \
56
57TF_DECLARE_PUBLIC_TOKENS(HdInstancedBySchemaTokens, HD_API,
58 HD_INSTANCED_BY_SCHEMA_TOKENS);
59
60//-----------------------------------------------------------------------------
61
62// A schema marking a prim as instanced by another prim.
63//
64// Many renderers need to know not what prototypes an instancer has, but
65// rather what instancers a prototype has; this is encoded in "instancedBy". A
66// prim is "instancedBy" /Instancer if /Instancer has a prototype path that's
67// a parent of the prim. A complicating exception is if /A instances /A/B,
68// which instances /A/B/C, we don't consider /A to be instancing /A/B/C
69// directly; this is to support nested explicit instancing of things like
70// leaves/trees/forests.
71//
72// This value is computed based on the instancer topology of instancer prims
73// in the scene.
74//
75// Note: if multiple instancers reference a prototype, it's possible for
76// instancedBy to contain multiple entries. Some renderers may be able to read
77// this directly, but some may need to duplicate prims with an op so that each
78// prim has a single instancer, depending on how the renderer exposes
79// instancing.
80//
81
82class HdInstancedBySchema : public HdSchema
83{
84public:
87
88 HdInstancedBySchema(HdContainerDataSourceHandle container)
89 : HdSchema(container) {}
90
96 HD_API
97 static HdInstancedBySchema GetFromParent(
98 const HdContainerDataSourceHandle &fromParentContainer);
99
101
102// --(BEGIN CUSTOM CODE: Schema Methods)--
103// --(END CUSTOM CODE: Schema Methods)--
104
107
108 HD_API
109 HdPathArrayDataSourceHandle GetPaths() const;
110
111 HD_API
112 HdPathArrayDataSourceHandle GetPrototypeRoots() const;
113
115
118
121 HD_API
122 static const TfToken &GetSchemaToken();
123
126 HD_API
127 static const HdDataSourceLocator &GetDefaultLocator();
128
130
133
141 HD_API
142 static HdContainerDataSourceHandle
143 BuildRetained(
144 const HdPathArrayDataSourceHandle &paths,
145 const HdPathArrayDataSourceHandle &prototypeRoots
146 );
147
155 {
156 public:
157 HD_API
158 Builder &SetPaths(
159 const HdPathArrayDataSourceHandle &paths);
160 HD_API
161 Builder &SetPrototypeRoots(
162 const HdPathArrayDataSourceHandle &prototypeRoots);
163
165 HD_API
166 HdContainerDataSourceHandle Build();
167
168 private:
169 HdPathArrayDataSourceHandle _paths;
170 HdPathArrayDataSourceHandle _prototypeRoots;
171
172 };
173
175};
176
177PXR_NAMESPACE_CLOSE_SCOPE
178
179#endif
Represents an object that can identify the location of a data source.
Utility class for setting sparse sets of child data source fields to be filled as arguments into Buil...
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:43
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:98