36 auto clipEditor = editor::addScriptClass<ScriptAnimationClipEditor>(table,
"AnimationClipEditor");
37 editor::registerEditorWorkspace<ScriptAnimationClipEditor>(
38 clipEditor, bind,
"animation clip editor and workspace must not be null");
39#if defined(EVE_ANIMATION_EDITOR_RUNTIME)
40 clipEditor.addFunc(
"loadRuntimeClip", [bind](ScriptAnimationClipEditor* self,
animation::AnimSkeleton* skeleton,
42 return bind.checked(self && skeleton &&
clip,
"animation clip editor, skeleton and clip must not be null",
43 [&] {
return self->editor().loadRuntimeClip(*skeleton, *
clip); });
47 return bind.checked(self && skeleton &&
clip,
"animation clip editor, clip and skeleton must not be null",
48 [&] {
return self->editor().writeRuntimeClip(*
clip, *skeleton); });
52 "setViewport", [bind](ScriptAnimationClipEditor* self,
float width,
float rowHeight,
float labelWidth) {
53 return bind.checked(self,
"animation clip editor must not be null",
54 [&] {
return self->editor().setViewport(
width, rowHeight, labelWidth); });
56 clipEditor.addFunc(
"seekX", [bind](ScriptAnimationClipEditor* self,
float x) {
57 return bind.checked(self,
"animation clip editor must not be null", [&] {
return self->editor().seekX(
x); });
59 clipEditor.addFunc(
"seekSeconds", [bind](ScriptAnimationClipEditor* self,
float seconds) {
60 return bind.checked(self,
"animation clip editor must not be null",
61 [&] {
return self->editor().seekSeconds(
static_cast<double>(seconds)); });
63 clipEditor.addFunc(
"pointerDown", [bind](ScriptAnimationClipEditor* self,
float x,
float y) {
64 return bind.checked(self,
"animation clip editor must not be null",
65 [&] {
return self->editor().pointerDown(
x,
y); });
67 clipEditor.addFunc(
"selectBone", [bind](ScriptAnimationClipEditor* self,
const std::string&
bone) {
68 return bind.checked(self,
"animation clip editor must not be null",
69 [&] {
return self->editor().selectBone(
bone); });
71 clipEditor.addFunc(
"setMaskWeight", [bind](ScriptAnimationClipEditor* self,
float weight) {
72 return bind.checked(self,
"animation clip editor must not be null",
73 [&] {
return self->editor().setMaskWeight(
static_cast<double>(
weight)); });
75 clipEditor.addFunc(
"setDuration", [bind](ScriptAnimationClipEditor* self,
float duration) {
76 return bind.checked(self,
"animation clip editor must not be null",
77 [&] {
return self->editor().setDuration(
static_cast<double>(
duration)); });
79 clipEditor.addFunc(
"setSampleRate", [bind](ScriptAnimationClipEditor* self,
float sampleRate) {
80 return bind.checked(self,
"animation clip editor must not be null",
81 [&] {
return self->editor().setSampleRate(
static_cast<double>(sampleRate)); });
83 clipEditor.addFunc(
"setLoop", [bind](ScriptAnimationClipEditor* self,
bool loop) {
84 return bind.checked(self,
"animation clip editor must not be null",
85 [&] {
return self->editor().setLoop(
loop); });
87 clipEditor.addFunc(
"moveSelectedKey", [bind](ScriptAnimationClipEditor* self,
float time) {
88 return bind.checked(self,
"animation clip editor must not be null",
89 [&] {
return self->editor().moveSelectedKey(
static_cast<double>(
time)); });
91 clipEditor.addFunc(
"keySelectedBone", [bind](ScriptAnimationClipEditor* self) {
92 return bind.checked(self,
"animation clip editor must not be null",
93 [&] {
return self->editor().keySelectedBone(); });
95 clipEditor.addFunc(
"deleteSelectedKey", [bind](ScriptAnimationClipEditor* self) {
96 return bind.checked(self,
"animation clip editor must not be null",
97 [&] {
return self->editor().deleteSelectedKey(); });
99 clipEditor.addFunc(
"setSelectedPosition", [bind](ScriptAnimationClipEditor* self,
float x,
float y,
float z) {
100 return bind.checked(self,
"animation clip editor must not be null",
101 [&] {
return self->editor().setSelectedPosition(
x,
y,
z); });
103 clipEditor.addFunc(
"setSelectedRotation", [bind](ScriptAnimationClipEditor* self,
float x,
float y,
float z) {
104 return bind.checked(self,
"animation clip editor must not be null",
105 [&] {
return self->editor().setSelectedRotation(
x,
y,
z); });
107 clipEditor.addFunc(
"setSelectedScale", [bind](ScriptAnimationClipEditor* self,
float x,
float y,
float z) {
108 return bind.checked(self,
"animation clip editor must not be null",
109 [&] {
return self->editor().setSelectedScale(
x,
y,
z); });
111 editor::registerEditorHistory<ScriptAnimationClipEditor>(clipEditor, bind,
112 "animation clip editor must not be null");
113 clipEditor.addFunc(
"play", [](ScriptAnimationClipEditor* self) {
114 if (self) self->editor().play();
116 clipEditor.addFunc(
"pause", [](ScriptAnimationClipEditor* self) {
117 if (self) self->editor().pause();
119 clipEditor.addFunc(
"stop", [bind](ScriptAnimationClipEditor* self) {
120 return bind.checked(self,
"animation clip editor must not be null", [&] {
121 self->editor().stop();
122 return self->editor().update(0.0);
125 clipEditor.addFunc(
"update", [bind](ScriptAnimationClipEditor* self,
float deltaSeconds) {
127 auto result = self->editor().update(
static_cast<double>(deltaSeconds));
130 clipEditor.addFunc(
"isPlaying", [](ScriptAnimationClipEditor* self) {
return self && self->editor().isPlaying(); });
131 clipEditor.addFunc(
"getDuration", [](ScriptAnimationClipEditor* self) {
132 return self ?
static_cast<float>(self->editor().duration()) : 0.0f;
134 clipEditor.addFunc(
"getSampleRate", [](ScriptAnimationClipEditor* self) {
135 return self ?
static_cast<float>(self->editor().sampleRate()) : 0.0f;
137 clipEditor.addFunc(
"getLoop", [](ScriptAnimationClipEditor* self) {
return self && self->editor().isLooping(); });
138 clipEditor.addFunc(
"getPlayhead", [](ScriptAnimationClipEditor* self) {
139 return self ?
static_cast<float>(self->editor().playhead()) : 0.0f;
141 clipEditor.addFunc(
"getLayoutWidth", [](ScriptAnimationClipEditor* self) {
142 return self ? self->editor().layoutWidth() : 0.0f;
144 clipEditor.addFunc(
"getLayoutHeight", [](ScriptAnimationClipEditor* self) {
145 return self ? self->editor().layoutHeight() : 0.0f;
147 clipEditor.addFunc(
"getPlayheadX", [](ScriptAnimationClipEditor* self) {
148 return self ? self->editor().playheadX() : 0.0f;
150 clipEditor.addFunc(
"getSelectedBone", [](ScriptAnimationClipEditor* self) {
151 return self ? self->editor().selectedBone() : std::string{};
153 clipEditor.addFunc(
"getSelectedMaskWeight", [](ScriptAnimationClipEditor* self) {
154 return self ?
static_cast<float>(self->editor().selectedMaskWeight()) : 1.0f;
156 clipEditor.addFunc(
"hasSelectedKey", [](ScriptAnimationClipEditor* self) {
return self && self->editor().hasSelectedKey(); });
157 clipEditor.addFunc(
"getSelectedKeyTime", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedKeyTime()) : 0.0f; });
158 clipEditor.addFunc(
"getSelectedPositionX", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedPositionX()) : 0.0f; });
159 clipEditor.addFunc(
"getSelectedPositionY", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedPositionY()) : 0.0f; });
160 clipEditor.addFunc(
"getSelectedPositionZ", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedPositionZ()) : 0.0f; });
161 clipEditor.addFunc(
"getSelectedRotationX", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedRotationX()) : 0.0f; });
162 clipEditor.addFunc(
"getSelectedRotationY", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedRotationY()) : 0.0f; });
163 clipEditor.addFunc(
"getSelectedRotationZ", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedRotationZ()) : 0.0f; });
164 clipEditor.addFunc(
"getSelectedScaleX", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedScaleX()) : 1.0f; });
165 clipEditor.addFunc(
"getSelectedScaleY", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedScaleY()) : 1.0f; });
166 clipEditor.addFunc(
"getSelectedScaleZ", [](ScriptAnimationClipEditor* self) {
return self ?
static_cast<float>(self->editor().selectedScaleZ()) : 1.0f; });
167 clipEditor.addFunc(
"getBoneCount", [](ScriptAnimationClipEditor* self) {
return self ? self->editor().boneCount() : 0; });
168 clipEditor.addFunc(
"getBoneName", [](ScriptAnimationClipEditor* self,
int index) {
return self ? self->editor().boneName(
index) : std::string{}; });
169 clipEditor.addFunc(
"getBoneParent", [](ScriptAnimationClipEditor* self,
int index) {
return self ? self->editor().boneParent(
index) : std::string{}; });
170 clipEditor.addFunc(
"getTrackCount", [](ScriptAnimationClipEditor* self) {
171 return self ? self->editor().trackCount() : 0;
173 clipEditor.addFunc(
"getTrackBone", [](ScriptAnimationClipEditor* self,
int index) {
174 return self ? self->editor().trackBone(
index) : std::string{};
176 clipEditor.addFunc(
"getTrackId", [](ScriptAnimationClipEditor* self,
int index) {
177 return self ? self->editor().trackId(
index) : std::string{};
179 clipEditor.addFunc(
"getTrackSelected", [](ScriptAnimationClipEditor* self,
int index) {
180 return self && self->editor().isTrackSelected(
index);
182 clipEditor.addFunc(
"getKeyCount", [](ScriptAnimationClipEditor* self) {
183 return self ? self->editor().keyCount() : 0;
185 clipEditor.addFunc(
"getKeyX", [](ScriptAnimationClipEditor* self,
int index) {
186 return self ? self->editor().keyX(
index) : 0.0f;
188 clipEditor.addFunc(
"getKeyY", [](ScriptAnimationClipEditor* self,
int index) {
189 return self ? self->editor().keyY(
index) : 0.0f;
191 clipEditor.addFunc(
"getKeySelected", [](ScriptAnimationClipEditor* self,
int index) {
192 return self && self->editor().isKeySelected(
index);
194 clipEditor.addFunc(
"getEventCount", [](ScriptAnimationClipEditor* self) {
195 return self ? self->editor().eventCount() : 0;
197 clipEditor.addFunc(
"getEventX", [](ScriptAnimationClipEditor* self,
int index) {
198 return self ? self->editor().eventX(
index) : 0.0f;
200 clipEditor.addFunc(
"getEventName", [](ScriptAnimationClipEditor* self,
int index) {
201 return self ? self->editor().eventName(
index) : std::string{};
203 clipEditor.addFunc(
"getPrimitiveCount", [](ScriptAnimationClipEditor* self) {
204 return self ? self->editor().primitiveCount() : 0;
206 clipEditor.addFunc(
"getPrimitiveKind", [](ScriptAnimationClipEditor* self,
int index) {
207 return self ? self->editor().primitiveKind(
index) : std::string{};
209 clipEditor.addFunc(
"getPrimitiveX", [](ScriptAnimationClipEditor* self,
int index) {
210 return self ? self->editor().primitiveX(
index) : 0.0f;
212 clipEditor.addFunc(
"getPrimitiveY", [](ScriptAnimationClipEditor* self,
int index) {
213 return self ? self->editor().primitiveY(
index) : 0.0f;
215 clipEditor.addFunc(
"getPrimitiveDirX", [](ScriptAnimationClipEditor* self,
int index) {
216 return self ? self->editor().primitiveDirX(
index) : 0.0f;
218 clipEditor.addFunc(
"getPrimitiveDirY", [](ScriptAnimationClipEditor* self,
int index) {
219 return self ? self->editor().primitiveDirY(
index) : 0.0f;
221 clipEditor.addFunc(
"getPrimitiveLength", [](ScriptAnimationClipEditor* self,
int index) {
222 return self ? self->editor().primitiveLength(
index) : 0.0f;
224 clipEditor.addFunc(
"getPrimitiveRadius", [](ScriptAnimationClipEditor* self,
int index) {
225 return self ? self->editor().primitiveRadius(
index) : 0.0f;
227 clipEditor.addFunc(
"getPrimitiveR", [](ScriptAnimationClipEditor* self,
int index) {
228 return self ? self->editor().primitiveR(
index) : 0.0f;
230 clipEditor.addFunc(
"getPrimitiveG", [](ScriptAnimationClipEditor* self,
int index) {
231 return self ? self->editor().primitiveG(
index) : 0.0f;
233 clipEditor.addFunc(
"getPrimitiveB", [](ScriptAnimationClipEditor* self,
int index) {
234 return self ? self->editor().primitiveB(
index) : 0.0f;
237 editor::registerEditorOwnedCreate<ScriptAnimationClipEditor, AnimationEditorModule>(
238 moduleClass, bind,
"animation clip target id must not be empty");