Free Electron
MayaNode.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __maya_MayaNode_h__
8 #define __maya_MayaNode_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Maya node
17 
18  @ingroup maya
19 *//***************************************************************************/
20 class MayaNode:
21  public MPxDeformerNode,
22  public MetaPlugin
23 {
24  private:
25 
26  class Parameter
27  {
28  public:
29  MObject m_object;
30  MObject m_objectPaint;
31  MObject m_objectPaintList;
32  };
33  class Registration
34  {
35  public:
36  U32 m_uniqueId;
37  String m_implementation;
38  std::map<String,Parameter> m_parameterMap;
39  std::map<String,String> m_cleanMap;
40  Array<String> m_inputChannelArray;
41  Array<String> m_outputChannelArray;
42  BWORD m_autoOutput;
43  };
44 
45  public:
46 
47  class Brush
48  {
49  public:
50  MayaNode* m_pMayaNode;
51  };
52 
53  MayaNode(void);
54 virtual ~MayaNode(void);
55 
56 virtual void dirty(BWORD a_aggressive);
57 virtual BWORD interrupted(void);
58 
59 virtual void postConstructor(void);
60 
61 static void* create(void);
62 
63 static void preRegister(U32 a_uniqueId,String a_name,
64  String a_implementation);
65 static MStatus initialize(void);
66 static void postRegister(void);
67 
68 virtual MStatus setDependentsDirty(
69  const MPlug &a_rPlugBeingDirtied,
70  MPlugArray& a_rAffectedPlugs);
71 virtual MStatus compute(const MPlug& a_rPlug,
72  MDataBlock& a_rData);
73 virtual MStatus shouldSave(const MPlug& a_rPlug,
74  bool& a_rResult);
75 
76  /// @internal
77  void brush(WindowEvent& a_rEvent,
78  const SpatialVector& a_rRayOrigin,
79  const SpatialVector& a_rRayDirection);
80 
81 const String prompt(void);
82 
83 const String nodeBeforeShape(void);
84 
85 static std::map<String,Brush> ms_brushMap;
86 static std::map<String,Brush> ms_shapeMap;
87 
88  protected:
89 virtual String evalParamString(String a_key,
90  Real a_time);
91 
92  private:
93  void updateComponents(BWORD a_constructing,
94  BWORD a_doInput);
95  void updateComponentArrays(
96  I32 a_iterateIndex,
97  I32 a_iterateCount);
98  void precompute(Real a_time);
99 static void populateOperator(String a_name);
100  void updateCatalog(MDataBlock& a_rData,
101  Real a_time,BWORD a_doInput);
102  void relayErrors(void);
103  void restoreState(void);
104 
105 static I32 ms_registerLock; //* TODO threadsafe
106 static String ms_registerName;
107 
108 static MObject ms_compoundBehavior;
109 
110 static std::map<String,Registration> ms_mayaRegistry;
111 static std::map<String,MayaNode*> ms_shape;
112 
113  MComputation m_computation;
114 
115  Array< sp<Component> > m_originalInputArray;
116  sp<Component> m_spOriginalOutput;
117 
118  MayaContext m_mayaContext;
119 
120  String m_typeName;
121  String m_nodeName;
122  String m_implementation;
123  String m_shapeNode;
124 
125  U32 m_paintSize;
126  BWORD m_bound;
127 };
128 
129 } /* namespace ext */
130 } /* namespace fe */
131 
132 #endif /* __maya_MayaNode_h__ */
shared FE context for Maya plugins
Definition: MayaContext.h:23
kernel
Definition: namespace.dox:3
Maya node.
Definition: MayaNode.h:20
Generalized windowing event.
Definition: WindowEvent.h:43
Automatically reference-counted string container.
Definition: String.h:128
Wrapper for std::vector.
Definition: Array.h:21
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
void brush(WindowEvent &a_rEvent, const SpatialVector &a_rRayOrigin, const SpatialVector &a_rRayDirection)
Definition: MayaNode.cc:3259
Common functionality of meta plugins for Houdini, Maya, etc.
Definition: MetaPlugin.h:20