HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_PropertyHandle.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_PropertyHandle_h__
19 #define __HUSD_PropertyHandle_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_ObjectHandle.h"
23 #include "HUSD_PrimHandle.h"
24 
26 
27 #define HUSD_PROPERTY_VALUETYPE "usdvaluetype"
28 #define HUSD_PROPERTY_VALUETYPE_RELATIONSHIP "relationship"
29 #define HUSD_PROPERTY_VALUETYPE_XFORM "xform"
30 #define HUSD_PROPERTY_APISCHEMA "usdapischema"
31 #define HUSD_PROPERTY_XFORM_PARM_PREFIX "xformparmprefix"
32 
33 // This class is a standalone wrapper around a specific property in a USD
34 // stage wrapped in an HUSD_DataHandle. It's purpose is to serve as the data
35 // accessor for tree nodes in the Scene Graph Tree. It should not be used for
36 // any other purpose, as it is extremely inefficient. Each function call locks
37 // the HUSD_DataHandle, queries its information, then unlocks it again. This
38 // is a matter of convenience for the calling pattern of the scene graph tree.
39 // Because it is inefficient the scene graph tree caches any information that
40 // comes out of this object.
41 //
42 // Anyone else tempted to use this object should use HUSD_Info instead.
44 {
45 public:
48  const HUSD_PrimHandle &prim_handle,
49  const UT_StringHolder &property_name);
50  virtual ~HUSD_PropertyHandle();
51 
52  virtual const HUSD_DataHandle &dataHandle() const override
53  { return myPrimHandle.dataHandle(); }
54  virtual const HUSD_ConstOverridesPtr&overrides() const override
55  { return myPrimHandle.overrides(); }
56  const HUSD_PrimHandle &primHandle() const
57  { return myPrimHandle; }
58 
59  UT_StringHolder getSourceSchema() const;
60  bool isCustom() const;
61  bool isXformOp() const;
62 
63  void createScriptedParms(
65  const UT_StringRef &custom_name,
66  bool prepend_control_parm,
67  bool prefix_xform_parms) const;
68 
69 private:
70  void createScriptedControlParm(
72  const UT_String &propbasename,
73  const UT_StringRef &usdvaluetype) const;
74 
75  HUSD_PrimHandle myPrimHandle;
76 };
77 
78 #endif
79 
#define HUSD_API
Definition: HUSD_API.h:32
virtual const HUSD_DataHandle & dataHandle() const override
const HUSD_PrimHandle & primHandle() const
virtual const HUSD_ConstOverridesPtr & overrides() const override