AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EventCommand.h
1 //
2 // Copyright 2017 Animal Logic
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.//
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #pragma once
17 
18 
19 #include "maya/MPxCommand.h"
20 #include "pxr/pxr.h"
21 #include "AL/event/EventHandler.h"
22 #include "AL/maya/utils/Api.h"
23 #include "AL/maya/utils/MayaHelperMacros.h"
24 
25 PXR_NAMESPACE_USING_DIRECTIVE
26 
27 namespace AL {
28 namespace usdmaya {
29 namespace cmds {
30 
31 //----------------------------------------------------------------------------------------------------------------------
39 //----------------------------------------------------------------------------------------------------------------------
41 {
43  MStatus redoItImplementation();
45  std::vector<AL::event::CallbackId> m_callbacksToDelete;
47  AL::event::Callbacks m_callbacksToInsert;
48 };
49 
50 //----------------------------------------------------------------------------------------------------------------------
53 //----------------------------------------------------------------------------------------------------------------------
54 class Event
55  : public MPxCommand
56 {
57  MString m_eventName;
58  AL::event::NodeEvents* m_associatedData = 0;
59  AL::event::CallbackId m_parentEvent = 0;
60  bool m_deleting = false;
61 public:
62  AL_MAYA_DECLARE_COMMAND();
63 private:
64  bool isUndoable() const override;
65  MStatus doIt(const MArgList& args) override;
66  MStatus redoIt() override;
67  MStatus undoIt() override;
68 };
69 
70 //----------------------------------------------------------------------------------------------------------------------
73 //----------------------------------------------------------------------------------------------------------------------
75  : public MPxCommand
76 {
77 public:
78  AL_MAYA_DECLARE_COMMAND();
79 private:
80  MStatus doIt(const MArgList& args) override;
81 };
82 
83 //----------------------------------------------------------------------------------------------------------------------
86 //----------------------------------------------------------------------------------------------------------------------
88  : public MPxCommand
89 {
90 public:
91  AL_MAYA_DECLARE_COMMAND();
92 private:
93  MStatus doIt(const MArgList& args) override;
94 };
95 
96 //----------------------------------------------------------------------------------------------------------------------
99 //----------------------------------------------------------------------------------------------------------------------
100 class Callback
101  : public MPxCommand,
102  public BaseCallbackCommand
103 {
104 public:
105  AL_MAYA_DECLARE_COMMAND();
106 private:
107  bool isUndoable() const override;
108  MStatus doIt(const MArgList& args) override;
109  MStatus redoIt() override;
110  MStatus undoIt() override;
111 };
112 
113 //----------------------------------------------------------------------------------------------------------------------
116 //----------------------------------------------------------------------------------------------------------------------
118  : public MPxCommand
119 {
120 public:
121  AL_MAYA_DECLARE_COMMAND();
122 private:
123  bool isUndoable() const override;
124  MStatus doIt(const MArgList& args) override;
125 };
126 
127 //----------------------------------------------------------------------------------------------------------------------
130 //----------------------------------------------------------------------------------------------------------------------
132  : public MPxCommand
133 {
134 public:
135  AL_MAYA_DECLARE_COMMAND();
136 private:
137  bool isUndoable() const override;
138  MStatus doIt(const MArgList& args) override;
139 };
140 
141 //----------------------------------------------------------------------------------------------------------------------
144 //----------------------------------------------------------------------------------------------------------------------
146  : public MPxCommand,
147  public BaseCallbackCommand
148 {
149 public:
150  AL_MAYA_DECLARE_COMMAND();
151 private:
152  bool isUndoable() const override;
153  MStatus doIt(const MArgList& args) override;
154  MStatus redoIt() override;
155  MStatus undoIt() override;
156 };
157 
158 //----------------------------------------------------------------------------------------------------------------------
161 //----------------------------------------------------------------------------------------------------------------------
163  : public MPxCommand
164 {
165 public:
166  AL_MAYA_DECLARE_COMMAND();
167 private:
168  bool isUndoable() const override;
169  MStatus doIt(const MArgList& args) override;
170 };
171 
172 //----------------------------------------------------------------------------------------------------------------------
175 //----------------------------------------------------------------------------------------------------------------------
177  : public MPxCommand
178 {
179 public:
180  AL_MAYA_DECLARE_COMMAND();
181 private:
182  bool isUndoable() const override;
183  MStatus doIt(const MArgList& args) override;
184 };
185 
187 extern void constructEventCommandGuis();
188 
189 //----------------------------------------------------------------------------------------------------------------------
190 } // cmds
191 } // usdmaya
192 } // AL
193 //----------------------------------------------------------------------------------------------------------------------
194 
195 
196 
MStatus redoItImplementation()
call within both the undo and redo methods
A command that lists the events available on either a particular node, or the global set of events...
Definition: EventCommand.h:117
A command that allows you to register and unregister new Event types from script. ...
Definition: EventCommand.h:54
The base class for all commands that need to create/delete callbacks in some way. Fill m_callbacksToD...
Definition: EventCommand.h:40
A command that allows you to query information about a specific event.
Definition: EventCommand.h:74
A command that lists the events available on either a particular node, or the global set of events...
Definition: EventCommand.h:176
A command that allows you to create / delete callbacks assigned to a specific event within AL_usdmaya...
Definition: EventCommand.h:100
std::vector< AL::event::CallbackId > m_callbacksToDelete
the callback ids that need to be deleted
Definition: EventCommand.h:45
A command that lists the events available on either a particular node, or the global set of events...
Definition: EventCommand.h:162
A command that allows you to query information about an event.
Definition: EventCommand.h:87
A command that will trigger all callbacks on an event.
Definition: EventCommand.h:131
AL::event::Callbacks m_callbacksToInsert
the callback structures generated from EventScheduler::buildCallback
Definition: EventCommand.h:47
A command that will delete all callback ids specified as an argument.
Definition: EventCommand.h:145