Cortex  10.0.0-a4
OBJ_SceneCacheTransform.h
1 //
3 // Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // * Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // * Neither the name of Image Engine Design nor the names of any
17 // other contributors to this software may be used to endorse or
18 // promote products derived from this software without specific prior
19 // written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
34 
35 #ifndef IECOREHOUDINI_OBJSCENECACHETRANSFORM_H
36 #define IECOREHOUDINI_OBJSCENECACHETRANSFORM_H
37 
38 #include "OBJ/OBJ_SubNet.h"
39 #include "UT/UT_StringMMPattern.h"
40 
41 #include "IECore/LinkedScene.h"
42 
43 #include "IECoreHoudini/LiveScene.h"
44 #include "IECoreHoudini/OBJ_SceneCacheNode.h"
45 
46 namespace IECoreHoudini
47 {
48 
50 class OBJ_SceneCacheTransform : public OBJ_SceneCacheNode<OBJ_SubNet>
51 {
52  public :
53 
54  OBJ_SceneCacheTransform( OP_Network *net, const char *name, OP_Operator *op );
55  virtual ~OBJ_SceneCacheTransform();
56 
57  static const char *typeName;
58 
59  static OP_Node *create( OP_Network *net, const char *name, OP_Operator *op );
60  static OP_TemplatePair *buildParameters();
61 
62  static PRM_Name pHierarchy;
63  static PRM_Name pDepth;
64 
65  static PRM_Default hierarchyDefault;
66  static PRM_Default depthDefault;
67 
68  static PRM_ChoiceList hierarchyList;
69  static PRM_ChoiceList depthList;
70 
71  enum Hierarchy
72  {
73  SubNetworks,
74  Parenting,
75  FlatGeometry
76  };
77 
78  enum Depth
79  {
80  AllDescendants,
81  Children
82  };
83 
88  virtual void expandHierarchy( const IECore::SceneInterface *scene );
91  virtual void pushToHierarchy();
92 
93  protected :
94 
95  struct Parameters
96  {
97  Parameters();
98  Parameters( const Parameters &other );
99 
100  GeometryType geometryType;
101  Hierarchy hierarchy;
102  Depth depth;
103  UT_String attributeFilter;
104  UT_String attributeCopy;
105  UT_String shapeFilter;
106  UT_String tagFilterStr;
107  UT_StringMMPattern tagFilter;
108  UT_String fullPathName;
109  bool tagGroups;
110  };
111 
114  virtual OBJ_Node *doExpandObject( const IECore::SceneInterface *scene, OP_Network *parent, const Parameters &params );
115 
119  virtual OBJ_Node *doExpandChild( const IECore::SceneInterface *scene, OP_Network *parent, const Parameters &params );
120 
123  virtual void doExpandChildren( const IECore::SceneInterface *scene, OP_Network *parent, const Parameters &params );
124 
125  static OP_TemplatePair *buildExtraParameters();
126 
127  virtual int *getIndirect() const;
128 
129  private :
130 
132  struct LiveSceneAddOn
133  {
134  LiveSceneAddOn();
135  };
136  static LiveSceneAddOn g_liveSceneAddOn;
137 
138  static void attributeNames( const OP_Node *node, IECore::SceneInterface::NameList &attrs );
139  static IECore::ConstObjectPtr readAttribute( const OP_Node *node, const IECore::SceneInterface::Name &name, double time );
140  static bool hasTag( const OP_Node *node, const IECore::SceneInterface::Name &tag, int filter );
141  static void readTags( const OP_Node *node, IECore::SceneInterface::NameList &tags, int filter );
142 
143  static int *g_indirection;
144 
145 };
146 
147 } // namespace IECoreHoudini
148 
149 #endif // IECOREHOUDINI_OBJSCENECACHETRANSFORM_H
The IECoreHoudini namespace holds all the functionality of libIECoreHoudini.
Definition: CoreHoudini.h:51
double time(OP_Context context) const
virtual void doExpandChildren(const IECore::SceneInterface *scene, OP_Network *parent, const Parameters &params)
virtual void expandHierarchy(const IECore::SceneInterface *scene)
Definition: OBJ_SceneCacheNode.h:51
virtual OBJ_Node * doExpandChild(const IECore::SceneInterface *scene, OP_Network *parent, const Parameters &params)
Definition: SceneInterface.h:69
Definition: InternedString.h:55
IECore::ConstSceneInterfacePtr scene() const
virtual OBJ_Node * doExpandObject(const IECore::SceneInterface *scene, OP_Network *parent, const Parameters &params)
OBJ for loading a transform or expanding a hierarchy from an IECore::SceneCache.
Definition: OBJ_SceneCacheTransform.h:50