-
Notifications
You must be signed in to change notification settings - Fork 0
/
TKUM_Parameter.h
208 lines (132 loc) · 3.4 KB
/
TKUM_Parameter.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#pragma once
#ifndef TKUM_PARAMETER_H
#define TKUM_PARAMETER_H
#include "TKUM.h"
#define TKUM_CHECKOUT_PARAM(IN_DATA, ID, PARAM) PF_CHECKOUT_PARAM(IN_DATA, ID, IN_DATA->current_time, IN_DATA->time_step, IN_DATA->time_scale, PARAM)
#define COUDNT_LOAD_SUITE_STR "can't load suite"
/* responsible for set/get parameters */
class Parameter {
protected:
PF_InData* in_data = nullptr;
PF_OutData* out_data = nullptr;
PF_Err err = PF_Err_NONE;
PF_ParamDef param;
//std::vector<PF_LayerDef*> checkouted_layers;
void init(void) {
err = PF_Err_NONE;
AEFX_CLR_STRUCT(param);
}
PF_Err checkOutParam(int id) {
return TKUM_CHECKOUT_PARAM(in_data, id, ¶m);
}
public:
Parameter(PF_InData* in, PF_OutData* out) {
in_data = in;
out_data = out;
init();
}
~Parameter(void) {
in_data = nullptr;
out_data = nullptr;
}
PF_Err GetPoint(int id, A_FloatPoint* value) {
init();
ERR(checkOutParam(id));
PF_PointParamSuite1* suite;
ERR(AEFX_AcquireSuite(
in_data,
out_data,
kPFPointParamSuite,
kPFPointParamSuiteVersion1,
COUDNT_LOAD_SUITE_STR,
(void**)&suite)
);
ERR(suite->PF_GetFloatingPointValueFromPointDef(in_data->effect_ref, ¶m, value));
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
PF_Err GetAngle(int id, double* value) {
init();
ERR(checkOutParam(id));
PF_AngleParamSuite1* suite;
ERR(AEFX_AcquireSuite(
in_data, out_data,
kPFAngleParamSuite,
kPFAngleParamSuiteVersion1,
COUDNT_LOAD_SUITE_STR,
(void**)&suite)
);
ERR(suite->PF_GetFloatingPointValueFromAngleDef(in_data->effect_ref, ¶m, value));
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
PF_Err GetPopup(int id, int* value) {
init();
ERR(checkOutParam(id));
*value = param.u.pd.value;
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
PF_Err GetFloatSlider(int id, double* value) {
init();
ERR(TKUM_CHECKOUT_PARAM(in_data, id, ¶m));
*value = param.u.fs_d.value;
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
PF_Err GetIntSlider(int id, int* value) {
init();
ERR(TKUM_CHECKOUT_PARAM(in_data, id, ¶m));
*value = param.u.sd.value;
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
PF_Err GetCheckbox(int id, bool* value) {
init();
ERR(TKUM_CHECKOUT_PARAM(in_data, id, ¶m));
*value = param.u.bd.value;
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
PF_Err GetColor(int id, PF_Pixel32* value) {
init();
ERR(TKUM_CHECKOUT_PARAM(in_data, id, ¶m));
AEGP_SuiteHandler suites(in_data->pica_basicP);
ERR(suites.ColorParamSuite1()->PF_GetFloatingPointColorFromColorDef(
in_data->effect_ref,
¶m,
value
));
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
virtual PF_Err GetLayer(int id, PF_LayerDef* layer_data) {
init();
err = in_data->inter.checkout_param(
in_data->effect_ref,
id,
in_data->current_time,
in_data->time_step,
in_data->time_scale,
¶m
);
*layer_data = param.u.ld;
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
virtual PF_Err GetLayer(int id, PF_LayerDef* layer_data, int frame) {
init();
err = in_data->inter.checkout_param(
in_data->effect_ref,
id,
frame * in_data->time_step,
in_data->time_step,
in_data->time_scale,
¶m
);
*layer_data = param.u.ld;
ERR(PF_CHECKIN_PARAM(in_data, ¶m));
return err;
}
};
#endif // TKUM_PARAMETER_H