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_UniquePtr.h>
24 
25 class husd_EditLinkCollectionsPrivate;
26 class HUSD_FindPrims;
27 class HUSD_TimeCode;
28 
29 // This class allows edit of links between prims that are defined as
30 // collections, typically with a specific name for the collection that defines
31 // the link.
32 // These are things like light links and shadow links with are collections on
33 // a prim (in their case a prim with the UsdLuxLightAPI schema) that specifies
34 // the geometry prims they are linked to.
36 {
37 public:
38  enum LinkType
39  {
42  MaterialLink
43  };
44 
45  HUSD_EditLinkCollections(HUSD_AutoWriteLock &lock, LinkType linktype);
47 
48 
49  /// Add a link whose source is the prim that will contain the collection
50  /// that defines the link.
51  /// This does not create the collections.
52  bool addLinkItems(const HUSD_FindPrims &linkSource,
53  const HUSD_FindPrims &includeprims,
54  const HUSD_FindPrims &excludeprims,
55  int nodeid,
56  const HUSD_TimeCode &tc,
57  UT_StringArray *errors = nullptr);
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  int nodeid,
68  const HUSD_TimeCode &tc,
69  UT_StringArray *errors = nullptr);
70 
71  /// Create the collections necessary for all links previously added.
72  bool createCollections(UT_StringArray *errors = nullptr);
73 
74  /// Clear all added links.
75  void clear();
76 
77 private:
78  HUSD_AutoWriteLock &myWriteLock;
79  LinkType myLinkType;
81  myPrivate;
82 };
83 
84 #endif
85 
#define HUSD_API
Definition: HUSD_API.h:32
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39