forked from ahmidou/SpliceSoftimage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FabricDFGWidget.h
101 lines (87 loc) · 2.35 KB
/
FabricDFGWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef __FabricDFGWidget_H_
#define __FabricDFGWidget_H_
#include "FabricDFGPlugin.h"
#include <DFG/DFGCombinedWidget.h>
// constants
enum OPENCANVAS_RETURN_VALS // return values of OpenCanvas().
{
SUCCESS = 0, // success.
ALREADY_OPEN, // there already is an open canvas window.
NULL_POINTER, // some pointer is NULL.
};
// forward declarations.
struct _opUserData;
const char *GetOpenCanvasErrorDescription(OPENCANVAS_RETURN_VALS in_errID);
OPENCANVAS_RETURN_VALS OpenCanvas(_opUserData *pud, const char *winTitle);
class FabricDFGWidget : public FabricUI::DFG::DFGCombinedWidget
{
public:
FabricDFGWidget(QWidget *parent) : FabricUI::DFG::DFGCombinedWidget(parent)
{
}
virtual void onUndo()
{
XSI::CValueArray args;
XSI::CValue val;
XSI::Application().ExecuteCommand(L"Undo", args, val);
}
virtual void onRedo()
{
XSI::CValueArray args;
XSI::CValue val;
XSI::Application().ExecuteCommand(L"Redo", args, val);
}
virtual void onSelectCanvasNodeInDCC()
{
}
virtual void onImportGraphInDCC()
{
}
virtual void onExportGraphInDCC()
{
}
static void log(void *userData, const char *message, unsigned int length)
{
std::string mess = std::string("[CANVAS] ") + (message ? message : "");
feLog(userData, mess.c_str(), mess.length());
}
bool eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
switch (keyEvent->key())
{
case Qt::Key_Y: // redo.
{
if (keyEvent->modifiers().testFlag(Qt::ControlModifier))
{
XSI::CValueArray args;
XSI::CValue val;
XSI::Application().ExecuteCommand(L"Redo", args, val);
return true;
}
} break;
case Qt::Key_Z: // undo.
{
if (keyEvent->modifiers().testFlag(Qt::ControlModifier))
{
XSI::CValueArray args;
XSI::CValue val;
XSI::Application().ExecuteCommand(L"Undo", args, val);
return true;
}
} break;
default:
{
// the Canvas window in Softimage is a modal
// dialog, so we accept all key press events.
return true;
}
}
}
return false;
}
};
void FabricInitQt();
#endif