HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_CreateMaterial.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_CreateMaterial_h__
19 #define __HUSD_CreateMaterial_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_TimeCode.h"
24 
25 class VOP_Node;
26 class UT_Options;
27 
29 {
30 public:
31  /// Standard c-tor.
33 
34  /// Defines a USD material primitive at a given @p usd_mat_path
35  /// based on given @p material_vop material node.
36  /// @param auto_generate_preview_shader If true, an attempt is made
37  /// to ensure the created material has a preview shader
38  /// (for the universal render context). Ie, if the material node
39  /// does not contain any explicit preview shader node to translate,
40  /// then an ad-hoc preview shader USD primitive will be generated.
41  bool createMaterial( VOP_Node &material_vop,
42  const UT_StringRef &usd_mat_path,
43  bool auto_generate_preview_shader ) const;
44 
45  /// Creates a new USD material primitive at @p usd_mat_path, which inherits
46  /// from the material given by @p base_material_path, and sets
47  /// the parameter override values on the created material.
48  bool createDerivedMaterial(
49  const UT_StringRef &base_material_path,
50  const UT_Options &material_parameters,
51  const UT_StringRef &usd_mat_path) const;
52 
53  /// Sets the time code at which shader parameters are evaluated.
54  void setTimeCode( const HUSD_TimeCode &time_code )
55  { myTimeCode = time_code; }
56 
57  /// Sets the primitive type that should be used when creating parents
58  /// that don't exist yet in the USD hierarchy.
60  { myParentType = type; }
61 
62 private:
63  HUSD_AutoWriteLock &myWriteLock;
64  UT_StringHolder myParentType; // Type of intermediate ancestors.
65  HUSD_TimeCode myTimeCode; // Time at which to eval shader parms.
66 };
67 
68 
69 #endif
70 
#define HUSD_API
Definition: HUSD_API.h:32
void setParentPrimType(const UT_StringHolder &type)
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
A map of string to various well defined value types.
Definition: UT_Options.h:42
void setTimeCode(const HUSD_TimeCode &time_code)
Sets the time code at which shader parameters are evaluated.
type
Definition: core.h:528