41 auto clipEditor = editor::addScriptClass<ScriptAnimationClipEditor>(table,
"AnimationClipEditor");
42 editor::exposeWorkspacePresentation<ScriptAnimationClipEditor, AnimationClipPresentation>(clipEditor,
44 editor::registerEditorWorkspace<ScriptAnimationClipEditor>(
45 clipEditor, bind,
"animation clip editor and workspace must not be null");
46#if defined(EVE_ANIMATION_EDITOR_RUNTIME)
47 clipEditor.addFunc(
"loadRuntimeClip", [bind](ScriptAnimationClipEditor* self,
animation::AnimSkeleton* skeleton,
49 return bind.checked(self && skeleton &&
clip,
"animation clip editor, skeleton and clip must not be null",
50 [&] {
return self->editor().loadRuntimeClip(*skeleton, *
clip); });
54 return bind.checked(self && skeleton &&
clip,
"animation clip editor, clip and skeleton must not be null",
55 [&] {
return self->editor().writeRuntimeClip(*
clip, *skeleton); });
59 "setViewport", [bind](ScriptAnimationClipEditor* self,
float width,
float rowHeight,
float labelWidth) {
60 return bind.checked(self,
"animation clip editor must not be null",
61 [&] {
return self->editor().setViewport(
width, rowHeight, labelWidth); });
63 clipEditor.addFunc(
"seekX", [bind](ScriptAnimationClipEditor* self,
float x) {
64 return bind.checked(self,
"animation clip editor must not be null", [&] {
return self->editor().seekX(
x); });
66 clipEditor.addFunc(
"seekSeconds", [bind](ScriptAnimationClipEditor* self,
float seconds) {
67 return bind.checked(self,
"animation clip editor must not be null",
68 [&] {
return self->editor().seekSeconds(
static_cast<double>(seconds)); });
70 clipEditor.addFunc(
"pointerDown", [bind](ScriptAnimationClipEditor* self,
float x,
float y) {
71 return bind.checked(self,
"animation clip editor must not be null",
72 [&] {
return self->editor().pointerDown(
x,
y); });
74 clipEditor.addFunc(
"selectBone", [bind](ScriptAnimationClipEditor* self,
const std::string&
bone) {
75 return bind.checked(self,
"animation clip editor must not be null",
76 [&] {
return self->editor().selectBone(
bone); });
78 clipEditor.addFunc(
"setMaskWeight", [bind](ScriptAnimationClipEditor* self,
float weight) {
79 return bind.checked(self,
"animation clip editor must not be null",
80 [&] {
return self->editor().setMaskWeight(
static_cast<double>(
weight)); });
82 clipEditor.addFunc(
"setDuration", [bind](ScriptAnimationClipEditor* self,
float duration) {
83 return bind.checked(self,
"animation clip editor must not be null",
84 [&] {
return self->editor().setDuration(
static_cast<double>(
duration)); });
86 clipEditor.addFunc(
"setSampleRate", [bind](ScriptAnimationClipEditor* self,
float sampleRate) {
87 return bind.checked(self,
"animation clip editor must not be null",
88 [&] {
return self->editor().setSampleRate(
static_cast<double>(sampleRate)); });
90 clipEditor.addFunc(
"setLoop", [bind](ScriptAnimationClipEditor* self,
bool loop) {
91 return bind.checked(self,
"animation clip editor must not be null",
92 [&] {
return self->editor().setLoop(
loop); });
94 clipEditor.addFunc(
"moveSelectedKey", [bind](ScriptAnimationClipEditor* self,
float time) {
95 return bind.checked(self,
"animation clip editor must not be null",
96 [&] {
return self->editor().moveSelectedKey(
static_cast<double>(
time)); });
98 clipEditor.addFunc(
"keySelectedBone", [bind](ScriptAnimationClipEditor* self) {
99 return bind.checked(self,
"animation clip editor must not be null",
100 [&] {
return self->editor().keySelectedBone(); });
102 clipEditor.addFunc(
"deleteSelectedKey", [bind](ScriptAnimationClipEditor* self) {
103 return bind.checked(self,
"animation clip editor must not be null",
104 [&] {
return self->editor().deleteSelectedKey(); });
106 clipEditor.addFunc(
"setSelectedPosition", [bind](ScriptAnimationClipEditor* self,
float x,
float y,
float z) {
107 return bind.checked(self,
"animation clip editor must not be null",
108 [&] {
return self->editor().setSelectedPosition(
x,
y,
z); });
110 clipEditor.addFunc(
"setSelectedRotation", [bind](ScriptAnimationClipEditor* self,
float x,
float y,
float z) {
111 return bind.checked(self,
"animation clip editor must not be null",
112 [&] {
return self->editor().setSelectedRotation(
x,
y,
z); });
114 clipEditor.addFunc(
"setSelectedScale", [bind](ScriptAnimationClipEditor* self,
float x,
float y,
float z) {
115 return bind.checked(self,
"animation clip editor must not be null",
116 [&] {
return self->editor().setSelectedScale(
x,
y,
z); });
118 editor::registerEditorHistory<ScriptAnimationClipEditor>(clipEditor, bind,
119 "animation clip editor must not be null");
120 clipEditor.addFunc(
"play", [](ScriptAnimationClipEditor* self) {
121 if (self) self->editor().play();
123 clipEditor.addFunc(
"pause", [](ScriptAnimationClipEditor* self) {
124 if (self) self->editor().pause();
126 clipEditor.addFunc(
"stop", [bind](ScriptAnimationClipEditor* self) {
127 return bind.checked(self,
"animation clip editor must not be null", [&] {
128 self->editor().stop();
129 return self->editor().update(0.0);
132 clipEditor.addFunc(
"update", [bind](ScriptAnimationClipEditor* self,
float deltaSeconds) {
134 auto result = self->editor().update(
static_cast<double>(deltaSeconds));
137 clipEditor.addFunc(
"isPlaying", [](ScriptAnimationClipEditor* self) {
return self && self->editor().isPlaying(); });
138 clipEditor.addFunc(
"getDuration", [](ScriptAnimationClipEditor* self) {
139 return self ?
static_cast<float>(self->editor().duration()) : 0.0f;
141 clipEditor.addFunc(
"getSampleRate", [](ScriptAnimationClipEditor* self) {
142 return self ?
static_cast<float>(self->editor().sampleRate()) : 0.0f;
144 clipEditor.addFunc(
"getLoop", [](ScriptAnimationClipEditor* self) {
return self && self->editor().isLooping(); });
145 clipEditor.addFunc(
"getPlayhead", [](ScriptAnimationClipEditor* self) {
146 return self ?
static_cast<float>(self->editor().playhead()) : 0.0f;
148 clipEditor.addFunc(
"getLayoutWidth", [](ScriptAnimationClipEditor* self) {
149 return self ? self->editor().layoutWidth() : 0.0f;
151 clipEditor.addFunc(
"getLayoutHeight", [](ScriptAnimationClipEditor* self) {
152 return self ? self->editor().layoutHeight() : 0.0f;
154 clipEditor.addFunc(
"getPlayheadX", [](ScriptAnimationClipEditor* self) {
155 return self ? self->editor().playheadX() : 0.0f;
157 clipEditor.addFunc(
"getSelectedBone", [](ScriptAnimationClipEditor* self) {
158 return self ? self->editor().selectedBone() : std::string{};
160 clipEditor.addFunc(
"getSelectedMaskWeight", [](ScriptAnimationClipEditor* self) {
161 return self ?
static_cast<float>(self->editor().selectedMaskWeight()) : 1.0f;
163 clipEditor.addFunc(
"hasSelectedKey", [](ScriptAnimationClipEditor* self) {
return self && self->editor().hasSelectedKey(); });
164 clipEditor.addFunc(
"getSelectedKeyTime", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedKeyTime()) : 0.0f; });
165 clipEditor.addFunc(
"getSelectedPositionX", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedPositionX()) : 0.0f; });
166 clipEditor.addFunc(
"getSelectedPositionY", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedPositionY()) : 0.0f; });
167 clipEditor.addFunc(
"getSelectedPositionZ", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedPositionZ()) : 0.0f; });
168 clipEditor.addFunc(
"getSelectedRotationX", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedRotationX()) : 0.0f; });
169 clipEditor.addFunc(
"getSelectedRotationY", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedRotationY()) : 0.0f; });
170 clipEditor.addFunc(
"getSelectedRotationZ", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedRotationZ()) : 0.0f; });
171 clipEditor.addFunc(
"getSelectedScaleX", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedScaleX()) : 1.0f; });
172 clipEditor.addFunc(
"getSelectedScaleY", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedScaleY()) : 1.0f; });
173 clipEditor.addFunc(
"getSelectedScaleZ", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedScaleZ()) : 1.0f; });
174 clipEditor.addFunc(
"getBoneCount", [](ScriptAnimationClipEditor* self) {
return self ? self->editor().boneCount() : 0; });
175 clipEditor.addFunc(
"getBoneName", [](ScriptAnimationClipEditor* self,
int index) {
return self ? self->editor().boneName(
index) : std::string{}; });
176 clipEditor.addFunc(
"getBoneParent", [](ScriptAnimationClipEditor* self,
int index) {
return self ? self->editor().boneParent(
index) : std::string{}; });
177 clipEditor.addFunc(
"getTrackCount", [](ScriptAnimationClipEditor* self) {
178 return self ? self->editor().trackCount() : 0;
180 clipEditor.addFunc(
"getTrackBone", [](ScriptAnimationClipEditor* self,
int index) {
181 return self ? self->editor().trackBone(
index) : std::string{};
183 clipEditor.addFunc(
"getTrackId", [](ScriptAnimationClipEditor* self,
int index) {
184 return self ? self->editor().trackId(
index) : std::string{};
186 clipEditor.addFunc(
"getTrackSelected", [](ScriptAnimationClipEditor* self,
int index) {
187 return self && self->editor().isTrackSelected(
index);
189 clipEditor.addFunc(
"getKeyCount", [](ScriptAnimationClipEditor* self) {
190 return self ? self->editor().keyCount() : 0;
192 clipEditor.addFunc(
"getKeyX", [](ScriptAnimationClipEditor* self,
int index) {
193 return self ? self->editor().keyX(
index) : 0.0f;
195 clipEditor.addFunc(
"getKeyY", [](ScriptAnimationClipEditor* self,
int index) {
196 return self ? self->editor().keyY(
index) : 0.0f;
198 clipEditor.addFunc(
"getKeySelected", [](ScriptAnimationClipEditor* self,
int index) {
199 return self && self->editor().isKeySelected(
index);
201 clipEditor.addFunc(
"getEventCount", [](ScriptAnimationClipEditor* self) {
202 return self ? self->editor().eventCount() : 0;
204 clipEditor.addFunc(
"getEventX", [](ScriptAnimationClipEditor* self,
int index) {
205 return self ? self->editor().eventX(
index) : 0.0f;
207 clipEditor.addFunc(
"getEventName", [](ScriptAnimationClipEditor* self,
int index) {
208 return self ? self->editor().eventName(
index) : std::string{};
210 clipEditor.addFunc(
"getPrimitiveCount", [](ScriptAnimationClipEditor* self) {
211 return self ? self->editor().primitiveCount() : 0;
213 clipEditor.addFunc(
"getPrimitiveKind", [](ScriptAnimationClipEditor* self,
int index) {
214 return self ? self->editor().primitiveKind(
index) : std::string{};
216 clipEditor.addFunc(
"getPrimitiveX", [](ScriptAnimationClipEditor* self,
int index) {
217 return self ? self->editor().primitiveX(
index) : 0.0f;
219 clipEditor.addFunc(
"getPrimitiveY", [](ScriptAnimationClipEditor* self,
int index) {
220 return self ? self->editor().primitiveY(
index) : 0.0f;
222 clipEditor.addFunc(
"getPrimitiveDirX", [](ScriptAnimationClipEditor* self,
int index) {
223 return self ? self->editor().primitiveDirX(
index) : 0.0f;
225 clipEditor.addFunc(
"getPrimitiveDirY", [](ScriptAnimationClipEditor* self,
int index) {
226 return self ? self->editor().primitiveDirY(
index) : 0.0f;
228 clipEditor.addFunc(
"getPrimitiveLength", [](ScriptAnimationClipEditor* self,
int index) {
229 return self ? self->editor().primitiveLength(
index) : 0.0f;
231 clipEditor.addFunc(
"getPrimitiveRadius", [](ScriptAnimationClipEditor* self,
int index) {
232 return self ? self->editor().primitiveRadius(
index) : 0.0f;
234 clipEditor.addFunc(
"getPrimitiveR", [](ScriptAnimationClipEditor* self,
int index) {
235 return self ? self->editor().primitiveR(
index) : 0.0f;
237 clipEditor.addFunc(
"getPrimitiveG", [](ScriptAnimationClipEditor* self,
int index) {
238 return self ? self->editor().primitiveG(
index) : 0.0f;
240 clipEditor.addFunc(
"getPrimitiveB", [](ScriptAnimationClipEditor* self,
int index) {
241 return self ? self->editor().primitiveB(
index) : 0.0f;
244 editor::registerEditorOwnedCreate<ScriptAnimationClipEditor, AnimationEditorModule>(
245 moduleClass, bind,
"animation clip target id must not be empty");