All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
instancedBySchema.h
Go to the documentation of this file.
1//
2// Copyright 2023 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
8
9/* ************************************************************************** */
10/* ** ** */
11/* ** This file is generated by a script. ** */
12/* ** ** */
13/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14/* ** Edit hdSchemaDefs.py instead to make changes. ** */
15/* ** ** */
16/* ************************************************************************** */
17
18#ifndef PXR_IMAGING_HD_INSTANCED_BY_SCHEMA_H
19#define PXR_IMAGING_HD_INSTANCED_BY_SCHEMA_H
20
22
23#include "pxr/imaging/hd/api.h"
24
25#include "pxr/imaging/hd/schema.h"
26
27// --(BEGIN CUSTOM CODE: Includes)--
28// --(END CUSTOM CODE: Includes)--
29
30PXR_NAMESPACE_OPEN_SCOPE
31
32// --(BEGIN CUSTOM CODE: Declares)--
33// --(END CUSTOM CODE: Declares)--
34
35#define HD_INSTANCED_BY_SCHEMA_TOKENS \
36 (instancedBy) \
37 (paths) \
38 (prototypeRoots) \
39
40TF_DECLARE_PUBLIC_TOKENS(HdInstancedBySchemaTokens, HD_API,
41 HD_INSTANCED_BY_SCHEMA_TOKENS);
42
43//-----------------------------------------------------------------------------
44
45// A schema marking a prim as instanced by another prim.
46//
47// Many renderers need to know not what prototypes an instancer has, but
48// rather what instancers a prototype has; this is encoded in "instancedBy". A
49// prim is "instancedBy" /Instancer if /Instancer has a prototype path that's
50// a parent of the prim. A complicating exception is if /A instances /A/B,
51// which instances /A/B/C, we don't consider /A to be instancing /A/B/C
52// directly; this is to support nested explicit instancing of things like
53// leaves/trees/forests.
54//
55// This value is computed based on the instancer topology of instancer prims
56// in the scene.
57//
58// Note: if multiple instancers reference a prototype, it's possible for
59// instancedBy to contain multiple entries. Some renderers may be able to read
60// this directly, but some may need to duplicate prims with an op so that each
61// prim has a single instancer, depending on how the renderer exposes
62// instancing.
63//
64
65class HdInstancedBySchema : public HdSchema
66{
67public:
70
71 HdInstancedBySchema(HdContainerDataSourceHandle container)
72 : HdSchema(container) {}
73
79 HD_API
80 static HdInstancedBySchema GetFromParent(
81 const HdContainerDataSourceHandle &fromParentContainer);
82
84
85// --(BEGIN CUSTOM CODE: Schema Methods)--
86// --(END CUSTOM CODE: Schema Methods)--
87
90
91 HD_API
92 HdPathArrayDataSourceHandle GetPaths() const;
93
94 HD_API
95 HdPathArrayDataSourceHandle GetPrototypeRoots() const;
96
98
101
104 HD_API
105 static const TfToken &GetSchemaToken();
106
109 HD_API
110 static const HdDataSourceLocator &GetDefaultLocator();
111
113
122
124 HD_API
125 static const HdDataSourceLocator &GetPathsLocator();
127
130
138 HD_API
139 static HdContainerDataSourceHandle
140 BuildRetained(
141 const HdPathArrayDataSourceHandle &paths,
142 const HdPathArrayDataSourceHandle &prototypeRoots
143 );
144
152 {
153 public:
154 HD_API
155 Builder &SetPaths(
156 const HdPathArrayDataSourceHandle &paths);
157 HD_API
158 Builder &SetPrototypeRoots(
159 const HdPathArrayDataSourceHandle &prototypeRoots);
160
162 HD_API
163 HdContainerDataSourceHandle Build();
164
165 private:
166 HdPathArrayDataSourceHandle _paths;
167 HdPathArrayDataSourceHandle _prototypeRoots;
168
169 };
170
172};
173
174PXR_NAMESPACE_CLOSE_SCOPE
175
176#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:26
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:81