Cortex  10.0.0-a4
TypedObjectParameter.h
1 //
3 // Copyright (c) 2007-2012, Image Engine Design Inc. All rights reserved.
4 //
5 // Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
6 // its affiliates and/or its licensors.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 //
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // * Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the distribution.
18 //
19 // * Neither the name of Image Engine Design nor the names of any
20 // other contributors to this software may be used to endorse or
21 // promote products derived from this software without specific prior
22 // written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
37 
38 #ifndef IE_CORE_TYPEDOBJECTPARAMETER_H
39 #define IE_CORE_TYPEDOBJECTPARAMETER_H
40 
41 #include <string>
42 
43 #include "IECore/ObjectParameter.h"
44 
45 namespace IECore
46 {
47 
48 IE_CORE_FORWARDDECLARE( Renderable )
49 IE_CORE_FORWARDDECLARE( StateRenderable )
50 IE_CORE_FORWARDDECLARE( AttributeState )
51 IE_CORE_FORWARDDECLARE( Shader )
52 IE_CORE_FORWARDDECLARE( Transform )
53 IE_CORE_FORWARDDECLARE( MatrixMotionTransform )
54 IE_CORE_FORWARDDECLARE( MatrixTransform )
55 IE_CORE_FORWARDDECLARE( VisibleRenderable )
56 IE_CORE_FORWARDDECLARE( Group )
57 IE_CORE_FORWARDDECLARE( ObjectVector )
58 IE_CORE_FORWARDDECLARE( SmoothSkinningData )
59 
62 template<typename T>
64 {
65  public :
66 
67  typedef T ObjectType;
68  typedef typename T::Ptr ObjectTypePtr;
69  typedef typename T::ConstPtr ConstObjectTypePtr;
70  typedef std::pair<std::string, ObjectTypePtr> ObjectPreset;
71  typedef std::vector<ObjectPreset> ObjectPresetsContainer;
72 
73  TypedObjectParameter( const std::string &name, const std::string &description, typename T::Ptr defaultValue, const ObjectPresetsContainer &presets = ObjectPresetsContainer(), bool presetsOnly = false,ConstCompoundObjectPtr userData=nullptr );
74 
75  IECORE_RUNTIMETYPED_DECLARETEMPLATE( TypedObjectParameter<T>, ObjectParameter );
76 
78  bool valueValid( const Object *value, std::string *reason = nullptr ) const override;
79 
80  protected:
81 
82  static PresetsContainer makePresets( const ObjectPresetsContainer &presets );
83 
84  private :
85 
86  static TypeDescription<TypedObjectParameter<T> > g_typeDescription;
87 
88 };
89 
102 
103 IE_CORE_DECLAREPTR( RenderableParameter );
104 IE_CORE_DECLAREPTR( StateRenderableParameter );
105 IE_CORE_DECLAREPTR( AttributeStateParameter );
106 IE_CORE_DECLAREPTR( ShaderParameter );
107 IE_CORE_DECLAREPTR( TransformParameter );
108 IE_CORE_DECLAREPTR( MatrixMotionTransformParameter );
109 IE_CORE_DECLAREPTR( MatrixTransformParameter );
110 IE_CORE_DECLAREPTR( VisibleRenderableParameter );
111 IE_CORE_DECLAREPTR( GroupParameter );
112 IE_CORE_DECLAREPTR( CompoundObjectParameter );
113 IE_CORE_DECLAREPTR( ObjectVectorParameter );
114 IE_CORE_DECLAREPTR( SmoothSkinningDataParameter );
115 
116 } // namespace IECore
117 
118 #endif // IE_CORE_TYPEDOBJECTPARAMETER_H
Definition: ObjectParameter.h:48
std::vector< Preset > PresetsContainer
A type to store a bunch of preset values for the Parameter.
Definition: Parameter.h:63
Definition: Object.h:104
Definition: TypedObjectParameter.h:63
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43