instancedBySchema.h
1 //
2 // Copyright 2021 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 // This file is generated by a script. Do not edit directly. Edit the
26 // schema.template.h file to make changes.
27 
28 #ifndef PXR_IMAGING_HD_INSTANCED_BY_SCHEMA_H
29 #define PXR_IMAGING_HD_INSTANCED_BY_SCHEMA_H
30 
31 #include "pxr/imaging/hd/api.h"
32 
33 #include "pxr/imaging/hd/schema.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
37 //-----------------------------------------------------------------------------
38 
39 #define HDINSTANCEDBY_SCHEMA_TOKENS \
40  (instancedBy) \
41  (paths) \
42 
43 TF_DECLARE_PUBLIC_TOKENS(HdInstancedBySchemaTokens, HD_API,
44  HDINSTANCEDBY_SCHEMA_TOKENS);
45 
46 //-----------------------------------------------------------------------------
47 
48 // A schema marking a prim as instanced by another prim.
49 //
50 // Many renderers need to know not what prototypes an instancer has, but
51 // rather what instancers a prototype has; this is encoded in
52 // "instancedBy". A prim is "instancedBy" /Instancer if /Instancer has
53 // a prototype path that's a parent of the prim. A complicating exception is
54 // if /A instances /A/B, which instances /A/B/C, we don't consider /A to be
55 // instancing /A/B/C directly; this is to support nested explicit instancing
56 // of things like leaves/trees/forests.
57 //
58 // This value is computed based on the instancer topology of instancer prims in
59 // the scene.
60 //
61 // Note: if multiple instancers reference a prototype, it's possible for
62 // instancedBy to contain multiple entries. Some renderers may be able to
63 // read this directly, but some may need to duplicate prims with an op so that
64 // each prim has a single instancer, depending on how the renderer exposes
65 // instancing.
66 
67 
68 class HdInstancedBySchema : public HdSchema
69 {
70 public:
71  HdInstancedBySchema(HdContainerDataSourceHandle container)
72  : HdSchema(container) {}
73 
74  //ACCESSORS
75 
76  HD_API
77  HdPathArrayDataSourceHandle GetPaths();
78 
79  // RETRIEVING AND CONSTRUCTING
80 
86  HD_API
87  static HdContainerDataSourceHandle
88  BuildRetained(
89  const HdPathArrayDataSourceHandle &paths
90  );
91 
98  class Builder
99  {
100  public:
101  HD_API
102  Builder &SetPaths(
103  const HdPathArrayDataSourceHandle &paths);
104 
106  HD_API
107  HdContainerDataSourceHandle Build();
108 
109  private:
110  HdPathArrayDataSourceHandle _paths;
111  };
112 
118  HD_API
119  static HdInstancedBySchema GetFromParent(
120  const HdContainerDataSourceHandle &fromParentContainer);
121 
124  HD_API
125  static const HdDataSourceLocator &GetDefaultLocator();
126 
127 };
128 
129 PXR_NAMESPACE_CLOSE_SCOPE
130 
131 #endif
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
Represents an object that can identify the location of a data source.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
Utility class for setting sparse sets of child data source fields to be filled as arguments into Buil...
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:42