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 
60 };
61 
63 {
64 public:
68 };
71 {
72  return (state == HUSD_TRUE ||
73  state == HUSD_OVERRIDDEN_TRUE ||
74  state == HUSD_ANIMATED_TRUE);
75 }
76 
79 {
80  return (state != HUSD_NOTPOSSIBLE &&
81  state != HUSD_NOTAPPLICABLE);
82 }
83 
84 class HUSD_TimeCode;
86 
87 // This class is a standalone wrapper around a specific primitice in a USD
88 // stage wrapped in an HUSD_DataHandle. It's purpose is to serve as the data
89 // accessor for tree nodes in the Scene Graph Tree. It should not be used for
90 // any other purpose, as it is extremely inefficient. Each function call locks
91 // the HUSD_DataHandle, queries its information, then unlocks it again. This
92 // is a matter of convenience for the calling pattern of the scene graph tree.
93 // Because it is inefficient the scene graph tree caches any information that
94 // comes out of this object.
95 //
96 // Anyone else tempted to use this object should use HUSD_Info instead.
98 {
99 public:
100  HUSD_PrimHandle();
102  const HUSD_DataHandle &data_handle,
103  const HUSD_Path &prim_path =
106  const HUSD_DataHandle &data_handle,
107  const HUSD_ConstOverridesPtr &overrides,
108  const HUSD_ConstPostLayersPtr &postlayers,
109  OverridesHandling overrides_handling,
110  const HUSD_Path &prim_path =
112  ~HUSD_PrimHandle() override;
113 
114  const HUSD_DataHandle &dataHandle() const override;
115  const HUSD_ConstOverridesPtr &overrides() const override;
116  const HUSD_ConstPostLayersPtr &postLayers() const override;
117 
118  HUSD_PrimStatus getStatus() const;
120  UT_StringHolder getVariantInfo() const;
121  UT_StringHolder getKind(bool *kind_is_valid) const;
122  UT_StringHolder getDrawMode(bool *has_override = nullptr) const;
123  UT_StringHolder getPurpose() const;
124  HUSD_MaterialInfo getMaterialInfo() const;
125  UT_StringHolder getProxyPath() const;
126  UT_StringHolder getAncestorPayloadPath() const;
127  UT_StringHolder getSpecifier() const;
128  UT_StringHolder getIcon() const;
129  HUSD_PrimAttribState getActive() const;
130  HUSD_PrimAttribState getVisible(const HUSD_TimeCode &timecode) const;
131  HUSD_PrimAttribState getSelectable() const;
132  HUSD_SoloState getSoloState() const;
133  int64 getChildCount(
134  HUSD_PrimTraversalDemands demands) const;
135  int64 getDescendantCount(
136  HUSD_PrimTraversalDemands demands) const;
137  bool hasAnyOverrides() const;
138  bool hasAnyPostLayers() const;
139  bool hasPayload() const;
140  bool isDefined() const;
141  bool isHiddenInUi() const;
142  bool isEditable() const;
143 
144  bool hasChildren(HUSD_PrimTraversalDemands demands) const;
145 // void getParent(HUSD_PrimHandle &parent) const;
146  void getChildren(UT_Array<HUSD_PrimHandle> &children,
147  HUSD_PrimTraversalDemands demands) const;
148  void getProperties(
150  bool include_attributes,
151  bool include_relationships,
152  bool include_shader_inputs) const;
153 
154  // Debugging only... Do not use in production code.
155  void getAttributeNames(
156  UT_ArrayStringSet &attrib_names) const;
157  void extractAttributes(
158  const UT_ArrayStringSet &which_attribs,
159  const HUSD_TimeCode &tc,
160  UT_Options &values);
161 
162 private:
163  HUSD_DataHandle myDataHandle;
164  HUSD_ConstOverridesPtr myOverrides;
165  HUSD_ConstPostLayersPtr myPostLayers;
166 };
167 
168 #endif
169 
SYS_FORCE_INLINE bool HUSDstateAsBool(HUSD_PrimAttribState state)
#define HUSD_API
Definition: HUSD_API.h:31
HUSD_SoloState
HUSD_PrimTraversalDemands
Definition: HUSD_Utils.h:39
GU_API GA_OffsetArray getChildren(const GU_Detail *gdp, const GA_Offset &node, bool recurse=false)
HUSD_PrimStatus
virtual const HUSD_ConstOverridesPtr & overrides() const =0
static const HUSD_Path theRootPrimPath
Definition: HUSD_Path.h:65
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
long long int64
Definition: SYS_Types.h:116
virtual const HUSD_ConstPostLayersPtr & postLayers() const =0
A map of string to various well defined value types.
Definition: UT_Options.h:84
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
virtual const HUSD_DataHandle & dataHandle() const =0
UT_StringHolder myMaterialName
UT_StringHolder myMaterialPath
SYS_FORCE_INLINE bool HUSDstateCanChange(HUSD_PrimAttribState state)
HUSD_PrimAttribState
GEO_API int getPrimType(const TypeMask &mask)
state
Definition: core.h:2289
GLenum GLuint GLsizei const GLenum * props
Definition: glcorearb.h:2525