HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_EditLinkCollections.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_EditLinkCollections_h__
19 #define __HUSD_EditLinkCollections_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include <UT/UT_String.h>
24 #include <UT/UT_UniquePtr.h>
25 
26 class husd_EditLinkCollectionsPrivate;
27 class HUSD_FindPrims;
28 class HUSD_TimeCode;
29 
30 // This class allows edit of links between prims that are defined as
31 // collections, typically with a specific name for the collection that defines
32 // the link.
33 // These are things like light links and shadow links with are collections on
34 // a prim (in their case a prim with the UsdLuxLightAPI schema) that specifies
35 // the geometry prims they are linked to.
37 {
38 public:
39  enum LinkType
40  {
43  MaterialLink
44  };
45 
46  HUSD_EditLinkCollections(HUSD_AutoWriteLock &lock, LinkType linktype);
48 
49 
50  /// Add a link whose source is the prim that will contain the collection
51  /// that defines the link.
52  /// This does not create the collections.
53  bool addLinkItems(const HUSD_FindPrims &linkSource,
54  const HUSD_FindPrims &includeprims,
55  const HUSD_FindPrims &excludeprims,
56  const UT_StringHolder &pathexpr,
57  const UT_StringRef &linkid);
58 
59  /// Add a link whose source is NOT the prim that will contain the
60  /// collection that defines the link, but rather the prims in the link's
61  /// include and excludes lists will contain the collection that defines
62  /// the link.
63  /// This does not create the collections.
64  bool addReverseLinkItems(const HUSD_FindPrims &linkSource,
65  const HUSD_FindPrims &includeprims,
66  const HUSD_FindPrims &excludeprims,
67  const UT_StringHolder &pathexpr,
68  const UT_StringRef &linkid);
69 
70  /// Create the collections necessary for all links previously added.
71  bool createCollections(UT_String *error_message=nullptr);
72 
73 private:
74  HUSD_AutoWriteLock &myWriteLock;
75  LinkType myLinkType;
77 };
78 
79 #endif
80 
#define HUSD_API
Definition: HUSD_API.h:31
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39