AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LayerVisitor.h
1 #pragma once
2 #include "AL/usdmaya/Common.h"
3 
4 #include <stack>
5 #include <vector>
6 
7 namespace AL {
8 namespace usdmaya {
9 namespace nodes {
10 
11 //----------------------------------------------------------------------------------------------------------------------
15 //----------------------------------------------------------------------------------------------------------------------
17 {
18 public:
19 
22  LayerVisitor(ProxyShape* shape);
23 
25  virtual ~LayerVisitor() {}
26 
28  void visitAll();
29 
31  virtual void onVisit() {}
32 
35  inline Layer* thisLayer() const
36  { return m_stack.top().m_thisLayer; }
37 
40  inline Layer* parentLayer() const
41  { return m_stack.top().m_parentLayer; }
42 
45  inline bool isSubLayer() const
46  { return m_stack.top().m_isSubLayer; }
47 
50  inline uint32_t depth() const
51  { return static_cast<uint32_t>(m_stack.size()); }
52 
53 private:
54  void visit();
55  struct StackItem
56  {
57  StackItem(Layer* layer, const bool isSubLayer);
58  std::vector<Layer*> m_subLayers;
59  std::vector<Layer*> m_childLayers;
60  Layer* m_thisLayer;
61  Layer* m_parentLayer;
62  int32_t m_index;
63  bool m_isSubLayer;
64  };
65 
66  std::stack<StackItem> m_stack;
67  ProxyShape* m_shape;
68 };
69 
70 //----------------------------------------------------------------------------------------------------------------------
71 } // nodes
72 } // usdmaya
73 } // AL
74 //----------------------------------------------------------------------------------------------------------------------
void visitAll()
call to visit all of the layers
A custom proxy shape node that attaches itself to a USD file, and then renders it. The stage is held internally as a member variable, and it will be composed based on a change to the "filePath" attribute.
Definition: ProxyShape.h:33
virtual ~LayerVisitor()
dtor
Definition: LayerVisitor.h:25
uint32_t depth() const
returns the recursion depth.
Definition: LayerVisitor.h:50
virtual void onVisit()
override to implement your own custom processing for each layer.
Definition: LayerVisitor.h:31
bool isSubLayer() const
returns true if the current layer is a sub layer
Definition: LayerVisitor.h:45
Layer * thisLayer() const
returns the current layer being visited
Definition: LayerVisitor.h:35
The layer node stores a reference to an SdfLayer.
Definition: Layer.h:20
A class that follows the visitor pattern to walk through all layer nodes associated with the specifie...
Definition: LayerVisitor.h:16
LayerVisitor(ProxyShape *shape)
ctor
Layer * parentLayer() const
returns the parent of the current layer being visited
Definition: LayerVisitor.h:40