HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_MergeInto.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_MergeInto_h__
19 #define __HUSD_MergeInto_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_TimeCode.h"
24 #include <UT/UT_ValArray.h>
25 #include <UT/UT_StringArray.h>
26 #include <UT/UT_UniquePtr.h>
27 
29 {
30 public:
32  ~HUSD_MergeInto();
33 
34  // Setting the primitive type for any parent primitives that need to be
35  // created when creating the merge destination primitive.
36  void setParentPrimType(const UT_StringHolder &primtype)
37  { myParentPrimType = primtype; }
39  { return myParentPrimType; }
40  // Specify the primitive kind value to be set on the inserted primitives.
41  void setPrimKind(const UT_StringHolder &kind)
42  { myPrimKind = kind; }
43  const UT_StringHolder &primKind() const
44  { return myPrimKind; }
45  // Specify the primitive specifier value to be set on the inserted primitives.
47  { myPrimSpecifier = spec; }
49  { return myPrimSpecifier; }
50  // Specify the primitive kind value to be set on any automatically created
51  // parents of the inserted primitives.
53  { myParentPrimKind = kind; }
55  { return myParentPrimKind; }
56  // Specify that this operation should guarantee that each destination
57  // location is unique, and doesn't overwrite any existing primitive on
58  // the stage.
59  void setMakeUniqueDestPaths(bool make_unique)
60  { myMakeUniqueDestPaths = make_unique; }
61  bool makeUniqueDestPaths() const
62  { return myMakeUniqueDestPaths; }
63  // Specify whether prims should be merged directly into the prim specified
64  // by `dest_path` or as a child (i.e., `dest_path` is a parent).
65  // Example: source_path=/archive/sphereGeo & dest_path=/geo/sphere
66  // PATH_IS_TARGET -> prim data ends up in /geo/*sphere*
67  // PATH_IS_PARENT -> prim data ends up in /geo/sphere/*sphereGeo*
68  enum DestPathMode { PATH_IS_TARGET, PATH_IS_PARENT };
70  { myDestPathMode = mode; }
72  { return myDestPathMode; }
73 
74  bool addHandle(const HUSD_DataHandle &src,
75  const UT_StringHolder &dest_path,
76  const UT_StringHolder &source_node_path,
77  const UT_StringHolder &source_path = UT_StringHolder(),
78  fpreal frame_offset = 0,
79  fpreal framerate_scale = 1,
80  bool keep_xform = false,
81  bool keep_material = false,
82  const HUSD_TimeCode &time_code = HUSD_TimeCode());
83  bool addHandle(const HUSD_DataHandle &src,
84  const UT_StringArray &dest_paths,
85  const UT_StringHolder &source_node_path,
86  const UT_StringArray &source_paths,
87  fpreal frame_offset = 0,
88  fpreal framerate_scale = 1);
89  bool execute(HUSD_AutoLayerLock &lock) const;
90  bool postExecuteAssignXform(HUSD_AutoWriteLock &lock,
91  const UT_StringRef &xform_suffix) const;
92  bool areInheritedXformsAnimated() const;
93  bool postExecuteAssignMaterial(HUSD_AutoWriteLock &lock) const;
94 
95 private:
96  struct husd_MergeIntoPrivate;
97 
99  UT_StringHolder myPrimKind;
100  UT_StringHolder myPrimSpecifier;
101  UT_StringHolder myParentPrimKind;
102  UT_StringHolder myParentPrimType;
103  bool myMakeUniqueDestPaths;
104  DestPathMode myDestPathMode;
105 };
106 
107 #endif
108 
void setPrimKind(const UT_StringHolder &kind)
void setDestPathMode(DestPathMode mode)
const UT_StringHolder & primKind() const
#define HUSD_API
Definition: HUSD_API.h:32
const UT_StringHolder & primSpecifier() const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
void setParentPrimType(const UT_StringHolder &primtype)
bool makeUniqueDestPaths() const
const UT_StringHolder & parentPrimType() const
GLenum mode
Definition: glcorearb.h:99
void setMakeUniqueDestPaths(bool make_unique)
void setParentPrimKind(const UT_StringHolder &kind)
void setPrimSpecifier(const UT_StringHolder &spec)
fpreal64 fpreal
Definition: SYS_Types.h:277
const UT_StringHolder & parentPrimKind() const
DestPathMode destPathMode() const
GLenum src
Definition: glcorearb.h:1793