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 //
24 ////////////////////////////////////////////////////////////////////////
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_XFORM_SCHEMA_H
29 #define PXR_IMAGING_HD_XFORM_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 HDXFORM_SCHEMA_TOKENS \
40     (xform) \
41     (matrix) \
42     (resetXformStack) \
43 
44 TF_DECLARE_PUBLIC_TOKENS(HdXformSchemaTokens, HD_API,
45     HDXFORM_SCHEMA_TOKENS);
46 
47 //-----------------------------------------------------------------------------
48 
49 class HdXformSchema : public HdSchema
50 {
51 public:
HdXformSchema(HdContainerDataSourceHandle container)52     HdXformSchema(HdContainerDataSourceHandle container)
53     : HdSchema(container) {}
54 
55     //ACCESSORS
56 
57     HD_API
58     HdMatrixDataSourceHandle GetMatrix();
59 
60     // The "resetXformStack" flag tells consumers that this transform doesn't
61     // inherit from the parent prim's transform.
62     HD_API
63     HdBoolDataSourceHandle GetResetXformStack();
64 
65     // RETRIEVING AND CONSTRUCTING
66 
67     /// Builds a container data source which includes the provided child data
68     /// sources. Parameters with nullptr values are excluded. This is a
69     /// low-level interface. For cases in which it's desired to define
70     /// the container with a sparse set of child fields, the Builder class
71     /// is often more convenient and readable.
72     HD_API
73     static HdContainerDataSourceHandle
74     BuildRetained(
75         const HdMatrixDataSourceHandle &matrix,
76         const HdBoolDataSourceHandle &resetXformStack
77     );
78 
79     /// \class HdXformSchema::Builder
80     ///
81     /// Utility class for setting sparse sets of child data source fields to be
82     /// filled as arguments into BuildRetained. Because all setter methods
83     /// return a reference to the instance, this can be used in the "builder
84     /// pattern" form.
85     class Builder
86     {
87     public:
88         HD_API
89         Builder &SetMatrix(
90             const HdMatrixDataSourceHandle &matrix);
91         HD_API
92         Builder &SetResetXformStack(
93             const HdBoolDataSourceHandle &resetXformStack);
94 
95         /// Returns a container data source containing the members set thus far.
96         HD_API
97         HdContainerDataSourceHandle Build();
98 
99     private:
100         HdMatrixDataSourceHandle _matrix;
101         HdBoolDataSourceHandle _resetXformStack;
102     };
103 
104     /// Retrieves a container data source with the schema's default name token
105     /// "xform" from the parent container and constructs a
106     /// HdXformSchema instance.
107     /// Because the requested container data source may not exist, the result
108     /// should be checked with IsDefined() or a bool comparison before use.
109     HD_API
110     static HdXformSchema GetFromParent(
111         const HdContainerDataSourceHandle &fromParentContainer);
112 
113     /// Returns an HdDataSourceLocator (relative to the prim-level data source)
114     /// where the container representing this schema is found by default.
115     HD_API
116     static const HdDataSourceLocator &GetDefaultLocator();
117 
118 };
119 
120 PXR_NAMESPACE_CLOSE_SCOPE
121 
122 #endif