Alembic: AbcMaterial/IMaterial.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
IMaterial.h
1//-*****************************************************************************
2//
3// Copyright (c) 2009-2015,
4// Sony Pictures Imageworks Inc. and
5// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
6//
7// All rights reserved.
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12// * Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14// * Redistributions in binary form must reproduce the above
15// copyright notice, this list of conditions and the following disclaimer
16// in the documentation and/or other materials provided with the
17// distribution.
18// * Neither the name of Sony Pictures Imageworks, nor
19// Industrial Light & Magic, nor the names of their contributors may be used
20// to endorse or promote products derived from this software without specific
21// prior written permission.
22//
23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34//
35//-*****************************************************************************
36
37#ifndef Alembic_AbcMaterial_IMaterial_h
38#define Alembic_AbcMaterial_IMaterial_h
39
40#include <Alembic/Abc/All.h>
41#include <Alembic/Util/Export.h>
42#include <Alembic/AbcMaterial/SchemaInfoDeclarations.h>
43
44namespace Alembic {
45namespace AbcMaterial {
46namespace ALEMBIC_VERSION_NS {
47
52 class ALEMBIC_EXPORT IMaterialSchema
53 : public Abc::ISchema<MaterialSchemaInfo>
54{
55public:
56
57 //-------------------------------------------------------------------------
58 //BOILERPLATE
59
60 typedef IMaterialSchema this_type;
61
62 IMaterialSchema() {}
63
70 IMaterialSchema( const ICompoundProperty &iParent,
71 const std::string &iName,
72 const Abc::Argument &iArg0 = Abc::Argument(),
73 const Abc::Argument &iArg1 = Abc::Argument() )
74
75 : Abc::ISchema<MaterialSchemaInfo>( iParent, iName, iArg0, iArg1 )
76 {
77 init();
78 }
79
84 IMaterialSchema( const ICompoundProperty &iProp,
85 const Abc::Argument &iArg0 = Abc::Argument(),
86 const Abc::Argument &iArg1 = Abc::Argument() )
87 : Abc::ISchema<MaterialSchemaInfo>( iProp, iArg0, iArg1 )
88 {
89 init();
90 }
91
92 //-------------------------------------------------------------------------
93 //ACTUAL STUFF
94
100 void getTargetNames( std::vector<std::string> & iTargetNames );
101
106 void getShaderTypesForTarget( const std::string & iTargetName,
107 std::vector<std::string> & oShaderTypeNames );
108
111 bool getShader( const std::string & iTarget,
112 const std::string & iShaderType,
113 std::string & oResult );
114
118 Abc::ICompoundProperty getShaderParameters(
119 const std::string & iTarget, const std::string & iShaderType );
120
121 //-------------------------------------------------------------------------
122
123 class ALEMBIC_EXPORT NetworkNode
124 {
125 public:
126
127 NetworkNode();
128 NetworkNode( Abc::ICompoundProperty iCompound );
129 NetworkNode( Abc::ICompoundProperty iParent,
130 const std::string & iNodeName );
131
132 bool valid();
133
134 std::string getName();
135
136 bool getTarget( std::string & oResult );
137 bool getNodeType( std::string & oResult );
138
139 Abc::ICompoundProperty getParameters();
140
141 size_t getNumConnections();
142 bool getConnection( size_t iIndex,
143 std::string & oInputName,
144 std::string & oConnectedNodeName,
145 std::string & oConnectedOutputName );
146
147 bool getConnection( const std::string & iInputName,
148 std::string & oConnectedNodeName,
149 std::string & oConnectedOutputName );
150
151 private:
152 Abc::ICompoundProperty m_compound;
153
154 bool m_connectionsChecked;
155 std::vector< std::string > m_connections;
156 std::map< std::string, std::string > m_connectionsMap;
157
158 void splitConnectionValue( const std::string & v,
159 std::string & a,
160 std::string & b );
161 };
162
163 size_t getNumNetworkNodes();
164 void getNetworkNodeNames( std::vector<std::string> & oNames );
165
166 NetworkNode getNetworkNode( size_t iIndex );
167 NetworkNode getNetworkNode( const std::string & iNodeName );
168
169 void getNetworkTerminalTargetNames(
170 std::vector<std::string> & oTargetNames );
171
172 void getNetworkTerminalShaderTypesForTarget(
173 const std::string & iTargetName,
174 std::vector<std::string> & oShaderTypeNames );
175
176 bool getNetworkTerminal( const std::string & iTarget,
177 const std::string & iShaderType,
178 std::string & oNodeName,
179 std::string & oOutputName );
180
181 size_t getNumNetworkInterfaceParameterMappings();
182 bool getNetworkInterfaceParameterMapping( size_t iIndex,
183 std::string & oInterfaceParamName,
184 std::string & oMapToNodeName,
185 std::string & oMapToParamName );
186
187 void getNetworkInterfaceParameterMappingNames(
188 std::vector<std::string> & oNames );
189
190 bool getNetworkInterfaceParameterMapping(
191 const std::string & iInterfaceParamName,
192 std::string & oMapToNodeName,
193 std::string & oMapToParamName );
194
195 Abc::ICompoundProperty getNetworkInterfaceParameters();
196
197protected:
198
199private:
200
201 void init();
202
203 std::map<std::string, std::string> m_shaderNames;
204 std::map<std::string, std::string> m_terminals;
205 std::map<std::string, std::string> m_interfaceMap;
206 std::vector<std::string> m_interface;
207
208 Abc::ICompoundProperty m_interfaceParams;
209 Abc::ICompoundProperty m_node;
210};
211
213typedef Abc::ISchemaObject<IMaterialSchema> IMaterial;
214
215typedef Util::shared_ptr< IMaterial > IMaterialPtr;
216
217} // End namespace ALEMBIC_VERSION_NS
218
219using namespace ALEMBIC_VERSION_NS;
220
221} // End namespace AbcMaterial
222} // End namespace Alembic
223
224#endif
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::ICompoundProperty
Definition ICompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::ICompoundProperty::ICompoundProperty
ICompoundProperty()
Definition ICompoundProperty.h:65
Alembic::Abc::ALEMBIC_VERSION_NS::ISchema
Definition ISchema.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::ISchema< MaterialSchemaInfo >::ISchema
ISchema()
Definition ISchema.h:112
Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject
Definition ISchemaObject.h:56
Alembic::AbcMaterial::ALEMBIC_VERSION_NS::IMaterialSchema::NetworkNode
Definition IMaterial.h:124
Alembic::AbcMaterial::ALEMBIC_VERSION_NS::IMaterialSchema::IMaterialSchema
IMaterialSchema(const ICompoundProperty &iProp, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IMaterial.h:84
Alembic::AbcMaterial::ALEMBIC_VERSION_NS::IMaterialSchema::IMaterialSchema
IMaterialSchema(const ICompoundProperty &iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IMaterial.h:70
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39