HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_PrimHandle.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_PrimHandle_h__
19 #define __HUSD_PrimHandle_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_ObjectHandle.h"
23 #include "HUSD_Utils.h"
24 #include <UT/UT_StringHolder.h>
25 #include <UT/UT_ArrayStringSet.h>
26 #include <UT/UT_Array.h>
27 #include <UT/UT_Options.h>
28 #include <SYS/SYS_Inline.h>
29 
39 };
40 
46 };
47 
56 };
57 
59 {
60 public:
64 };
67 {
68  return (state == HUSD_TRUE ||
69  state == HUSD_OVERRIDDEN_TRUE ||
70  state == HUSD_ANIMATED_TRUE);
71 }
72 
75 {
76  return (state != HUSD_NOTPOSSIBLE &&
77  state != HUSD_NOTAPPLICABLE);
78 }
79 
80 class HUSD_TimeCode;
82 
83 // This class is a standalone wrapper around a specific primitice in a USD
84 // stage wrapped in an HUSD_DataHandle. It's purpose is to serve as the data
85 // accessor for tree nodes in the Scene Graph Tree. It should not be used for
86 // any other purpose, as it is extremely inefficient. Each function call locks
87 // the HUSD_DataHandle, queries its information, then unlocks it again. This
88 // is a matter of convenience for the calling pattern of the scene graph tree.
89 // Because it is inefficient the scene graph tree caches any information that
90 // comes out of this object.
91 //
92 // Anyone else tempted to use this object should use HUSD_Info instead.
94 {
95 public:
98  const HUSD_DataHandle &data_handle,
99  const HUSD_Path &prim_path =
102  const HUSD_DataHandle &data_handle,
103  const HUSD_ConstOverridesPtr &overrides,
104  OverridesHandling overrides_handling,
105  const HUSD_Path &prim_path =
107  ~HUSD_PrimHandle() override;
108 
109  const HUSD_DataHandle &dataHandle() const override;
110  const HUSD_ConstOverridesPtr &overrides() const override;
111 
112  HUSD_PrimStatus getStatus() const;
114  UT_StringHolder getVariantInfo() const;
115  UT_StringHolder getKind() const;
116  UT_StringHolder getDrawMode(bool *has_override = nullptr) const;
117  UT_StringHolder getPurpose() const;
118  HUSD_MaterialInfo getMaterialInfo() const;
119  UT_StringHolder getProxyPath() const;
120  UT_StringHolder getSpecifier() const;
121  UT_StringHolder getIcon() const;
122  HUSD_PrimAttribState getActive() const;
123  HUSD_PrimAttribState getVisible(const HUSD_TimeCode &timecode) const;
124  HUSD_SoloState getSoloState() const;
125  int64 getDescendants(
126  HUSD_PrimTraversalDemands demands) const;
127  bool hasAnyOverrides() const;
128  bool hasPayload() const;
129  bool isDefined() const;
130 
131  bool hasChildren(HUSD_PrimTraversalDemands demands) const;
132  void getChildren(UT_Array<HUSD_PrimHandle> &children,
133  HUSD_PrimTraversalDemands demands) const;
134  void getProperties(
136  bool include_attributes,
137  bool include_relationships,
138  bool include_shader_inputs) const;
139 
140  // Debugging only... Do not use in production code.
141  void getAttributeNames(
142  UT_ArrayStringSet &attrib_names) const;
143  void extractAttributes(
144  const UT_ArrayStringSet &which_attribs,
145  const HUSD_TimeCode &tc,
146  UT_Options &values);
147 
148 private:
149  HUSD_DataHandle myDataHandle;
150  HUSD_ConstOverridesPtr myOverrides;
151 };
152 
153 #endif
154 
SYS_FORCE_INLINE bool HUSDstateAsBool(HUSD_PrimAttribState state)
GLint GLsizei const GLuint64 * values
Definition: glew.h:3612
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_SoloState
HUSD_PrimTraversalDemands
Definition: HUSD_Utils.h:31
HUSD_PrimStatus
virtual const HUSD_ConstOverridesPtr & overrides() const =0
static const HUSD_Path theRootPrimPath
Definition: HUSD_Path.h:59
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
long long int64
Definition: SYS_Types.h:116
A map of string to various well defined value types.
Definition: UT_Options.h:84
virtual const HUSD_DataHandle & dataHandle() const =0
GLenum GLuint GLsizei const GLenum * props
Definition: glew.h:5632
UT_StringHolder myMaterialName
UT_StringHolder myMaterialPath
SYS_FORCE_INLINE bool HUSDstateCanChange(HUSD_PrimAttribState state)
const GLfloat * tc
Definition: glew.h:16304
HUSD_PrimAttribState
GEO_API int getPrimType(const TypeMask &mask)
GU_API GA_OffsetArray getChildren(GU_Detail *gdp, const GA_Offset &node)