HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XUSD_LockedGeoRegistry.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 __XUSD_LockedGeoRegistry_h__
19 #define __XUSD_LockedGeoRegistry_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "XUSD_LockedGeo.h"
24 #include <GU/GU_DetailHandle.h>
25 #include <UT/UT_StringHolder.h>
26 #include <pxr/pxr.h>
27 
29 
30 // This class is used to keep alive SOP cook results that are referenced by
31 // USD. Adding an entry to the registry involves passing in the cooked SOP
32 // result, along with the SOP path and arguments to be used during the
33 // conversion from SOPs to USD. The returned shared pointer is kept as
34 // sidecar data along with any stage that might refer to this SOP layer in
35 // any way. This ensures the SOP won't modify the GU_Detail with a recook
36 // as long as a USD stage needs the old GU_Detail (the USD VtArrays use the
37 // same pointers to memory as the GU_Detail attributes in some cases).
38 //
39 // The getGeometry method is used by the SdfFileFormat plugin for loading
40 // USD from a GU_Detail using a SOP path. Because of the sidecar shared
41 // pointers, it should always be true that if SOP geometry is being loaded
42 // through this plugin, at least some XUSD_Data will be holding a shared
43 // pointer that points to the GU_Detail.
44 
46 {
47 public:
48  static XUSD_LockedGeoPtr createLockedGeo(
49  const UT_StringHolder &nodepath,
50  const XUSD_LockedGeoArgs &args,
51  const GU_ConstDetailHandle &gdh);
52  static XUSD_LockedGeoPtr getLockedGeo(const UT_StringHolder &nodepath,
53  const XUSD_LockedGeoArgs &args);
54  static GU_ConstDetailHandle getGeometry(const UT_StringHolder &nodepath,
55  const XUSD_LockedGeoArgs &args);
56 
57 private:
58  friend class XUSD_LockedGeo;
59 
60  static void returnLockedGeo(XUSD_LockedGeo *lockedgeo);
61 };
62 
64 
65 #endif
66 
PXR_NAMESPACE_OPEN_SCOPE typedef SdfFileFormat::FileFormatArguments XUSD_LockedGeoArgs
#define HUSD_API
Definition: HUSD_API.h:32
Wrapper around hboost::intrusive_ptr.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
**If you just want to fire and args
Definition: thread.h:609