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 
60 {
61  return (state == HUSD_TRUE ||
62  state == HUSD_OVERRIDDEN_TRUE ||
63  state == HUSD_ANIMATED_TRUE);
64 }
65 
68 {
69  return (state != HUSD_NOTPOSSIBLE &&
70  state != HUSD_NOTAPPLICABLE);
71 }
72 
73 class HUSD_TimeCode;
75 
76 // This class is a standalone wrapper around a specific primitice in a USD
77 // stage wrapped in an HUSD_DataHandle. It's purpose is to serve as the data
78 // accessor for tree nodes in the Scene Graph Tree. It should not be used for
79 // any other purpose, as it is extremely inefficient. Each function call locks
80 // the HUSD_DataHandle, queries its information, then unlocks it again. This
81 // is a matter of convenience for the calling pattern of the scene graph tree.
82 // Because it is inefficient the scene graph tree caches any information that
83 // comes out of this object.
84 //
85 // Anyone else tempted to use this object should use HUSD_Info instead.
87 {
88 public:
91  const HUSD_DataHandle &data_handle,
92  const HUSD_Path &prim_path =
95  const HUSD_DataHandle &data_handle,
96  const HUSD_ConstOverridesPtr &overrides,
97  OverridesHandling overrides_handling,
98  const HUSD_Path &prim_path =
100  ~HUSD_PrimHandle() override;
101 
102  const HUSD_DataHandle &dataHandle() const override;
103  const HUSD_ConstOverridesPtr &overrides() const override;
104 
105  HUSD_PrimStatus getStatus() const;
107  UT_StringHolder getVariantInfo() const;
108  UT_StringHolder getKind() const;
109  UT_StringHolder getDrawMode(bool *has_override = nullptr) const;
110  UT_StringHolder getPurpose() const;
111  UT_StringHolder getProxyPath() const;
112  UT_StringHolder getSpecifier() const;
113  UT_StringHolder getIcon() const;
114  HUSD_PrimAttribState getActive() const;
115  HUSD_PrimAttribState getVisible(const HUSD_TimeCode &timecode) const;
116  HUSD_SoloState getSoloState() const;
117  int64 getDescendants(
118  HUSD_PrimTraversalDemands demands) const;
119  bool hasAnyOverrides() const;
120  bool hasPayload() const;
121  bool isDefined() const;
122 
123  bool hasChildren(HUSD_PrimTraversalDemands demands) const;
124  void getChildren(UT_Array<HUSD_PrimHandle> &children,
125  HUSD_PrimTraversalDemands demands) const;
126  void getProperties(
128  bool include_attributes,
129  bool include_relationships,
130  bool include_shader_inputs) const;
131 
132  // Debugging only... Do not use in production code.
133  void getAttributeNames(
134  UT_ArrayStringSet &attrib_names) const;
135  void extractAttributes(
136  const UT_ArrayStringSet &which_attribs,
137  const HUSD_TimeCode &tc,
138  UT_Options &values);
139 
140 private:
141  HUSD_DataHandle myDataHandle;
142  HUSD_ConstOverridesPtr myOverrides;
143 };
144 
145 #endif
146 
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:30
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
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)