32 auto voxelEditor = editor::addScriptClass<ScriptVoxelCatalogEditor>(table,
"VoxelCatalogEditor");
34 editor::registerEditorWorkspace<ScriptVoxelCatalogEditor>(voxelEditor, bind,
35 "voxel editor and workspace must not be null");
36 voxelEditor.addFunc(
"selectModel", [bind](ScriptVoxelCatalogEditor* self,
const std::string&
id) {
37 return bind.checked(self,
"voxel editor must not be null", [&] {
return self->editor().selectModel(
id); });
39 voxelEditor.addFunc(
"setTool", [bind](ScriptVoxelCatalogEditor* self,
const std::string& tool) {
40 return bind.checked(self,
"voxel editor must not be null", [&] {
return self->editor().setTool(tool); });
42 voxelEditor.addFunc(
"setViewport", [bind](ScriptVoxelCatalogEditor* self,
float width,
float height) {
43 return bind.checked(self,
"voxel editor must not be null",
44 [&] {
return self->editor().setViewport(
width,
height); });
46 voxelEditor.addFunc(
"orbit", [bind](ScriptVoxelCatalogEditor* self,
float yaw,
float pitch) {
47 return bind.checked(self,
"voxel editor must not be null", [&] {
return self->editor().orbit(
yaw,
pitch); });
49 voxelEditor.addFunc(
"pointerDown", [bind](ScriptVoxelCatalogEditor* self,
float x,
float y) {
50 return bind.checked(self,
"voxel editor must not be null", [&] {
return self->editor().pointerDown(
x,
y); });
52 voxelEditor.addFunc(
"pointerWorldRay", [bind](ScriptVoxelCatalogEditor* self,
float ox,
float oy,
float oz,
53 float dx,
float dy,
float dz) {
54 return bind.checked(self,
"voxel editor must not be null",
55 [&] {
return self->editor().pointerWorldRay(
ox,
oy, oz,
dx,
dy,
dz); });
57 voxelEditor.addFunc(
"setVoxel", [bind](ScriptVoxelCatalogEditor* self,
int x,
int y,
int z,
bool occupied) {
58 return bind.checked(self,
"voxel editor must not be null",
59 [&] {
return self->editor().setVoxel(
x,
y,
z,
occupied); });
61 voxelEditor.addFunc(
"setSelectedSocket",
62 [bind](ScriptVoxelCatalogEditor* self,
const std::string&
tag,
const std::string&
kind) {
63 return bind.checked(self,
"voxel editor must not be null",
64 [&] {
return self->editor().setSelectedSocket(
tag,
kind); });
66 voxelEditor.addFunc(
"selectFace", [bind](ScriptVoxelCatalogEditor* self,
int face) {
67 return bind.checked(self,
"voxel editor must not be null", [&] {
return self->editor().selectFace(face); });
69 voxelEditor.addFunc(
"createModel", [bind](ScriptVoxelCatalogEditor* self,
const std::string&
id,
70 const std::string&
name,
int sx,
int sy,
int sz) {
71 return bind.checked(self,
"voxel editor must not be null",
72 [&] {
return self->editor().createModel(
id,
name,
sx,
sy,
sz); });
74 voxelEditor.addFunc(
"deleteSelectedModel", [bind](ScriptVoxelCatalogEditor* self) {
75 return bind.checked(self,
"voxel editor must not be null",
76 [&] {
return self->editor().deleteSelectedModel(); });
78 editor::registerEditorHistory<ScriptVoxelCatalogEditor>(voxelEditor, bind,
"voxel editor must not be null");
79 voxelEditor.addFunc(
"getSelectedId", [](ScriptVoxelCatalogEditor* self) {
80 return self ? self->editor().selectedId() : std::string{};
82 voxelEditor.addFunc(
"getTool", [](ScriptVoxelCatalogEditor* self) {
83 return self ? self->editor().toolName() : std::string{};
85 voxelEditor.addFunc(
"getSelectedFace", [](ScriptVoxelCatalogEditor* self) {
86 return self ? self->editor().selectedFace() : 0;
88 voxelEditor.addFunc(
"getModelCount", [](ScriptVoxelCatalogEditor* self) {
89 return self ? self->editor().modelCount() : 0;
91 voxelEditor.addFunc(
"getModelId", [](ScriptVoxelCatalogEditor* self,
int index) {
92 return self ? self->editor().modelId(
index) : std::string{};
94 voxelEditor.addFunc(
"getModelName", [](ScriptVoxelCatalogEditor* self,
int index) {
95 return self ? self->editor().modelName(
index) : std::string{};
97 voxelEditor.addFunc(
"getModelFill", [](ScriptVoxelCatalogEditor* self,
int index) {
98 return self ? self->editor().modelFill(
index) : std::string{};
100 voxelEditor.addFunc(
"getModelSelected", [](ScriptVoxelCatalogEditor* self,
int index) {
101 return self && self->editor().isModelSelected(
index);
103 voxelEditor.addFunc(
"getVoxelCount", [](ScriptVoxelCatalogEditor* self) {
104 return self ? self->editor().voxelCount() : 0;
106 voxelEditor.addFunc(
"getVoxelX", [](ScriptVoxelCatalogEditor* self,
int index) {
107 return self ? self->editor().voxelX(
index) : 0;
109 voxelEditor.addFunc(
"getVoxelY", [](ScriptVoxelCatalogEditor* self,
int index) {
110 return self ? self->editor().voxelY(
index) : 0;
112 voxelEditor.addFunc(
"getVoxelZ", [](ScriptVoxelCatalogEditor* self,
int index) {
113 return self ? self->editor().voxelZ(
index) : 0;
115 voxelEditor.addFunc(
"getModelSizeX", [](ScriptVoxelCatalogEditor* self) {
116 return self ? self->editor().modelSizeX() : 0;
118 voxelEditor.addFunc(
"getModelSizeY", [](ScriptVoxelCatalogEditor* self) {
119 return self ? self->editor().modelSizeY() : 0;
121 voxelEditor.addFunc(
"getModelSizeZ", [](ScriptVoxelCatalogEditor* self) {
122 return self ? self->editor().modelSizeZ() : 0;
124 voxelEditor.addFunc(
"getScreenVoxelCount", [](ScriptVoxelCatalogEditor* self) {
125 return self ? self->editor().screenVoxelCount() : 0;
127 voxelEditor.addFunc(
"getScreenVoxelX", [](ScriptVoxelCatalogEditor* self,
int index) {
128 return self ? self->editor().screenVoxelX(
index) : 0.0f;
130 voxelEditor.addFunc(
"getScreenVoxelY", [](ScriptVoxelCatalogEditor* self,
int index) {
131 return self ? self->editor().screenVoxelY(
index) : 0.0f;
133 voxelEditor.addFunc(
"getScreenVoxelW", [](ScriptVoxelCatalogEditor* self,
int index) {
134 return self ? self->editor().screenVoxelW(
index) : 0.0f;
136 voxelEditor.addFunc(
"getScreenVoxelH", [](ScriptVoxelCatalogEditor* self,
int index) {
137 return self ? self->editor().screenVoxelH(
index) : 0.0f;
139 voxelEditor.addFunc(
"getSelectedSocketTag", [](ScriptVoxelCatalogEditor* self) {
140 return self ? self->editor().selectedSocketTag() : std::string{};
142 voxelEditor.addFunc(
"getSelectedSocketKind", [](ScriptVoxelCatalogEditor* self) {
143 return self ? self->editor().selectedSocketKind() : std::string{};
145 voxelEditor.addFunc(
"getJoinPartnerCount", [](ScriptVoxelCatalogEditor* self) {
146 return self ? self->editor().joinPartnerCount() : 0;
148 voxelEditor.addFunc(
"getJoinPartnerId", [](ScriptVoxelCatalogEditor* self,
int index) {
149 return self ? self->editor().joinPartnerId(
index) : std::string{};
152 editor::registerEditorOwnedCreate<ScriptVoxelCatalogEditor, VoxelEditorModule>(moduleClass, bind,
"voxel target id must not be empty");