32 auto avatarEditor = editor::addScriptClass<ScriptAvatarDocumentEditor>(table,
"AvatarDocumentEditor");
33 editor::registerEditorWorkspace<ScriptAvatarDocumentEditor>(avatarEditor, bind,
34 "avatar editor and workspace must not be null");
35 avatarEditor.addFunc(
"selectLayer", [bind](ScriptAvatarDocumentEditor* self,
const std::string&
id) {
36 return bind.checked(self,
"avatar editor must not be null", [&] {
return self->editor().selectLayer(
id); });
38 avatarEditor.addFunc(
"selectParameter", [bind](ScriptAvatarDocumentEditor* self,
const std::string&
id) {
39 return bind.checked(self,
"avatar editor must not be null", [&] {
return self->editor().selectParameter(
id); });
41 avatarEditor.addFunc(
"selectExpression", [bind](ScriptAvatarDocumentEditor* self,
const std::string&
id) {
42 return bind.checked(self,
"avatar editor must not be null",
43 [&] {
return self->editor().selectExpression(
id); });
45 avatarEditor.addFunc(
"pointerDown", [bind](ScriptAvatarDocumentEditor* self,
float x,
float y) {
46 return bind.checked(self,
"avatar editor must not be null", [&] {
return self->editor().pointerDown(
x,
y); });
48 avatarEditor.addFunc(
"setLayerVisible", [bind](ScriptAvatarDocumentEditor* self,
bool visible) {
49 return bind.checked(self,
"avatar editor must not be null",
50 [&] {
return self->editor().setLayerVisible(
visible); });
52 avatarEditor.addFunc(
"setLayerZ", [bind](ScriptAvatarDocumentEditor* self,
int zIndex) {
53 return bind.checked(self,
"avatar editor must not be null", [&] {
return self->editor().setLayerZ(zIndex); });
55 avatarEditor.addFunc(
"setParameterValue", [bind](ScriptAvatarDocumentEditor* self,
float value) {
56 return bind.checked(self,
"avatar editor must not be null",
57 [&] {
return self->editor().setParameterValue(
static_cast<double>(
value)); });
59 avatarEditor.addFunc(
"createLayer",
60 [bind](ScriptAvatarDocumentEditor* self,
const std::string&
id,
const std::string&
name) {
61 return bind.checked(self,
"avatar editor must not be null",
62 [&] {
return self->editor().createLayer(
id,
name); });
64 avatarEditor.addFunc(
"deleteSelectedLayer", [bind](ScriptAvatarDocumentEditor* self) {
65 return bind.checked(self,
"avatar editor must not be null",
66 [&] {
return self->editor().deleteSelectedLayer(); });
68 avatarEditor.addFunc(
"createParameter",
69 [bind](ScriptAvatarDocumentEditor* self,
const std::string&
id,
const std::string&
name) {
70 return bind.checked(self,
"avatar editor must not be null",
71 [&] {
return self->editor().createParameter(
id,
name); });
73 avatarEditor.addFunc(
"deleteSelectedParameter", [bind](ScriptAvatarDocumentEditor* self) {
74 return bind.checked(self,
"avatar editor must not be null",
75 [&] {
return self->editor().deleteSelectedParameter(); });
77 avatarEditor.addFunc(
"createExpression",
78 [bind](ScriptAvatarDocumentEditor* self,
const std::string&
id,
const std::string&
name) {
79 return bind.checked(self,
"avatar editor must not be null",
80 [&] {
return self->editor().createExpression(
id,
name); });
82 avatarEditor.addFunc(
"deleteSelectedExpression", [bind](ScriptAvatarDocumentEditor* self) {
83 return bind.checked(self,
"avatar editor must not be null",
84 [&] {
return self->editor().deleteSelectedExpression(); });
86 editor::registerEditorHistory<ScriptAvatarDocumentEditor>(avatarEditor, bind,
"avatar editor must not be null");
87 avatarEditor.addFunc(
"getPreviewRevision", [](ScriptAvatarDocumentEditor* self) {
88 return self ?
static_cast<int>(self->editor().previewRevision()) : 0;
90 avatarEditor.addFunc(
"getKind", [](ScriptAvatarDocumentEditor* self) {
91 return self ? self->editor().kind() : std::string{};
93 avatarEditor.addFunc(
"getSelectedId", [](ScriptAvatarDocumentEditor* self) {
94 return self ? self->editor().selectedId() : std::string{};
96 avatarEditor.addFunc(
"getSelectedType", [](ScriptAvatarDocumentEditor* self) {
97 return self ? self->editor().selectedType() : std::string{};
99 avatarEditor.addFunc(
"getLayerCount", [](ScriptAvatarDocumentEditor* self) {
100 return self ? self->editor().layerCount() : 0;
102 avatarEditor.addFunc(
"getLayerId", [](ScriptAvatarDocumentEditor* self,
int index) {
103 return self ? self->editor().layerId(
index) : std::string{};
105 avatarEditor.addFunc(
"getLayerName", [](ScriptAvatarDocumentEditor* self,
int index) {
106 return self ? self->editor().layerName(
index) : std::string{};
108 avatarEditor.addFunc(
"getLayerVisible", [](ScriptAvatarDocumentEditor* self,
int index) {
109 return self && self->editor().layerVisible(
index);
111 avatarEditor.addFunc(
"getLayerZ", [](ScriptAvatarDocumentEditor* self,
int index) {
112 return self ? self->editor().layerZ(
index) : 0;
114 avatarEditor.addFunc(
"getLayerSelected", [](ScriptAvatarDocumentEditor* self,
int index) {
115 return self && self->editor().isLayerSelected(
index);
117 avatarEditor.addFunc(
"getPreviewLayerCount", [](ScriptAvatarDocumentEditor* self) {
118 return self ? self->editor().previewLayerCount() : 0;
120 avatarEditor.addFunc(
"getPreviewX", [](ScriptAvatarDocumentEditor* self,
int index) {
121 return self ? self->editor().previewX(
index) : 0.0f;
123 avatarEditor.addFunc(
"getPreviewY", [](ScriptAvatarDocumentEditor* self,
int index) {
124 return self ? self->editor().previewY(
index) : 0.0f;
126 avatarEditor.addFunc(
"getPreviewW", [](ScriptAvatarDocumentEditor* self,
int index) {
127 return self ? self->editor().previewW(
index) : 0.0f;
129 avatarEditor.addFunc(
"getPreviewH", [](ScriptAvatarDocumentEditor* self,
int index) {
130 return self ? self->editor().previewH(
index) : 0.0f;
132 avatarEditor.addFunc(
"getPreviewR", [](ScriptAvatarDocumentEditor* self,
int index) {
133 return self ? self->editor().previewR(
index) : 0.0f;
135 avatarEditor.addFunc(
"getPreviewG", [](ScriptAvatarDocumentEditor* self,
int index) {
136 return self ? self->editor().previewG(
index) : 0.0f;
138 avatarEditor.addFunc(
"getPreviewB", [](ScriptAvatarDocumentEditor* self,
int index) {
139 return self ? self->editor().previewB(
index) : 0.0f;
141 avatarEditor.addFunc(
"getPreviewA", [](ScriptAvatarDocumentEditor* self,
int index) {
142 return self ? self->editor().previewA(
index) : 0.0f;
144 avatarEditor.addFunc(
"getPreviewSelected", [](ScriptAvatarDocumentEditor* self,
int index) {
145 return self && self->editor().isPreviewSelected(
index);
147 avatarEditor.addFunc(
"getPreviewName", [](ScriptAvatarDocumentEditor* self,
int index) {
148 return self ? self->editor().previewName(
index) : std::string{};
150 avatarEditor.addFunc(
"getParameterCount", [](ScriptAvatarDocumentEditor* self) {
151 return self ? self->editor().parameterCount() : 0;
153 avatarEditor.addFunc(
"getParameterId", [](ScriptAvatarDocumentEditor* self,
int index) {
154 return self ? self->editor().parameterId(
index) : std::string{};
156 avatarEditor.addFunc(
"getParameterName", [](ScriptAvatarDocumentEditor* self,
int index) {
157 return self ? self->editor().parameterName(
index) : std::string{};
159 avatarEditor.addFunc(
"getParameterValue", [](ScriptAvatarDocumentEditor* self,
int index) {
160 return self ? self->editor().parameterValue(
index) : 0.0f;
162 avatarEditor.addFunc(
"getParameterMinimum", [](ScriptAvatarDocumentEditor* self,
int index) {
163 return self ? self->editor().parameterMinimum(
index) : 0.0f;
165 avatarEditor.addFunc(
"getParameterMaximum", [](ScriptAvatarDocumentEditor* self,
int index) {
166 return self ? self->editor().parameterMaximum(
index) : 1.0f;
168 avatarEditor.addFunc(
"getParameterSelected", [](ScriptAvatarDocumentEditor* self,
int index) {
169 return self && self->editor().isParameterSelected(
index);
171 avatarEditor.addFunc(
"getExpressionCount", [](ScriptAvatarDocumentEditor* self) {
172 return self ? self->editor().expressionCount() : 0;
174 avatarEditor.addFunc(
"getExpressionId", [](ScriptAvatarDocumentEditor* self,
int index) {
175 return self ? self->editor().expressionId(
index) : std::string{};
177 avatarEditor.addFunc(
"getExpressionName", [](ScriptAvatarDocumentEditor* self,
int index) {
178 return self ? self->editor().expressionName(
index) : std::string{};
180 avatarEditor.addFunc(
"getExpressionSelected", [](ScriptAvatarDocumentEditor* self,
int index) {
181 return self && self->editor().isExpressionSelected(
index);
183 avatarEditor.addFunc(
"getExpressionChannelCount", [](ScriptAvatarDocumentEditor* self,
int index) {
184 return self ? self->editor().expressionChannelCount(
index) : 0;
186 avatarEditor.addFunc(
"getExpressionChannelName",
187 [](ScriptAvatarDocumentEditor* self,
int expression,
int channel) {
188 return self ? self->editor().expressionChannelName(expression, channel) : std::string{};
191 editor::registerEditorOwnedCreate<ScriptAvatarDocumentEditor, AvatarEditorModule>(moduleClass, bind,
"avatar target id must not be empty");