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  const HUSD_ConstPostLayersPtr &postlayers,
105  OverridesHandling overrides_handling,
106  const HUSD_Path &prim_path =
108  ~HUSD_PrimHandle() override;
109 
110  const HUSD_DataHandle &dataHandle() const override;
111  const HUSD_ConstOverridesPtr &overrides() const override;
112  const HUSD_ConstPostLayersPtr &postLayers() const override;
113 
114  HUSD_PrimStatus getStatus() const;
116  UT_StringHolder getVariantInfo() const;
117  UT_StringHolder getKind() const;
118  UT_StringHolder getDrawMode(bool *has_override = nullptr) const;
119  UT_StringHolder getPurpose() const;
120  HUSD_MaterialInfo getMaterialInfo() const;
121  UT_StringHolder getProxyPath() const;
122  UT_StringHolder getSpecifier() const;
123  UT_StringHolder getIcon() const;
124  HUSD_PrimAttribState getActive() const;
125  HUSD_PrimAttribState getVisible(const HUSD_TimeCode &timecode) const;
126  HUSD_PrimAttribState getSelectable() const;
127  HUSD_SoloState getSoloState() const;
128  int64 getDescendants(
129  HUSD_PrimTraversalDemands demands) const;
130  bool hasAnyOverrides() const;
131  bool hasAnyPostLayers() const;
132  bool hasPayload() const;
133  bool isDefined() const;
134  bool isHiddenInUi() const;
135 
136  bool hasChildren(HUSD_PrimTraversalDemands demands) const;
137  void getChildren(UT_Array<HUSD_PrimHandle> &children,
138  HUSD_PrimTraversalDemands demands) const;
139  void getProperties(
141  bool include_attributes,
142  bool include_relationships,
143  bool include_shader_inputs) const;
144 
145  // Debugging only... Do not use in production code.
146  void getAttributeNames(
147  UT_ArrayStringSet &attrib_names) const;
148  void extractAttributes(
149  const UT_ArrayStringSet &which_attribs,
150  const HUSD_TimeCode &tc,
151  UT_Options &values);
152 
153 private:
154  HUSD_DataHandle myDataHandle;
155  HUSD_ConstOverridesPtr myOverrides;
156  HUSD_ConstPostLayersPtr myPostLayers;
157 };
158 
159 #endif
160 
SYS_FORCE_INLINE bool HUSDstateAsBool(HUSD_PrimAttribState state)
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_SoloState
HUSD_PrimTraversalDemands
Definition: HUSD_Utils.h:38
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:64
#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)
GLenum GLuint GLsizei const GLenum * props
Definition: glcorearb.h:2525