33 auto biomeEditor = editor::addScriptClass<ScriptBiomeRulesEditor>(table,
"BiomeRulesEditor");
34 editor::registerEditorWorkspace<ScriptBiomeRulesEditor>(biomeEditor, bind,
35 "biome editor and workspace must not be null");
36 biomeEditor.addFunc(
"selectLayer", [bind](ScriptBiomeRulesEditor* self,
const std::string&
id) {
37 return bind.checked(self,
"biome editor must not be null", [&] {
return self->editor().selectLayer(
id); });
39 biomeEditor.addFunc(
"selectAsset", [bind](ScriptBiomeRulesEditor* self,
const std::string&
id) {
40 return bind.checked(self,
"biome editor must not be null", [&] {
return self->editor().selectAsset(
id); });
42 biomeEditor.addFunc(
"setLayerDensity", [bind](ScriptBiomeRulesEditor* self,
float density) {
43 return bind.checked(self,
"biome editor must not be null",
44 [&] {
return self->editor().setLayerDensity(
static_cast<double>(density)); });
46 biomeEditor.addFunc(
"setLayerPriority", [bind](ScriptBiomeRulesEditor* self,
int priority) {
47 return bind.checked(self,
"biome editor must not be null",
48 [&] {
return self->editor().setLayerPriority(
priority); });
50 biomeEditor.addFunc(
"setAssetWeight", [bind](ScriptBiomeRulesEditor* self,
float weight) {
51 return bind.checked(self,
"biome editor must not be null",
52 [&] {
return self->editor().setAssetWeight(
static_cast<double>(
weight)); });
54 biomeEditor.addFunc(
"createLayer",
55 [bind](ScriptBiomeRulesEditor* self,
const std::string&
id,
const std::string&
name) {
56 return bind.checked(self,
"biome editor must not be null",
57 [&] {
return self->editor().createLayer(
id,
name); });
59 biomeEditor.addFunc(
"deleteSelectedLayer", [bind](ScriptBiomeRulesEditor* self) {
60 return bind.checked(self,
"biome editor must not be null",
61 [&] {
return self->editor().deleteSelectedLayer(); });
63 biomeEditor.addFunc(
"createAsset",
64 [bind](ScriptBiomeRulesEditor* self,
const std::string&
id,
const std::string& asset) {
65 return bind.checked(self,
"biome editor must not be null",
66 [&] {
return self->editor().createAsset(
id, asset); });
68 biomeEditor.addFunc(
"deleteSelectedAsset", [bind](ScriptBiomeRulesEditor* self) {
69 return bind.checked(self,
"biome editor must not be null",
70 [&] {
return self->editor().deleteSelectedAsset(); });
72 biomeEditor.addFunc(
"addExclusion", [bind](ScriptBiomeRulesEditor* self,
const std::string& spatialAsset) {
73 return bind.checked(self,
"biome editor must not be null",
74 [&] {
return self->editor().addExclusion(spatialAsset); });
76 biomeEditor.addFunc(
"removeExclusion", [bind](ScriptBiomeRulesEditor* self,
const std::string& spatialAsset) {
77 return bind.checked(self,
"biome editor must not be null",
78 [&] {
return self->editor().removeExclusion(spatialAsset); });
80 biomeEditor.addFunc(
"setSeed", [bind](ScriptBiomeRulesEditor* self,
int seed) {
81 return bind.checked(self,
"biome editor must not be null",
82 [&] {
return self->editor().setSeed(
static_cast<std::uint32_t
>(
seed)); });
84 biomeEditor.addFunc(
"setSpacing", [bind](ScriptBiomeRulesEditor* self,
float spacing) {
85 return bind.checked(self,
"biome editor must not be null", [&] {
return self->editor().setSpacing(
spacing); });
87 editor::registerEditorHistory<ScriptBiomeRulesEditor>(biomeEditor, bind,
"biome editor must not be null");
88 biomeEditor.addFunc(
"getPreviewRevision", [](ScriptBiomeRulesEditor* self) {
89 return self ?
static_cast<int>(self->editor().previewRevision()) : 0;
91 biomeEditor.addFunc(
"getSeed", [](ScriptBiomeRulesEditor* self) {
92 return self ?
static_cast<int>(self->editor().seed()) : 0;
94 biomeEditor.addFunc(
"getSpacing", [](ScriptBiomeRulesEditor* self) {
95 return self ? self->editor().spacing() : 0.0f;
97 biomeEditor.addFunc(
"getSelectedId", [](ScriptBiomeRulesEditor* self) {
98 return self ? self->editor().selectedId() : std::string{};
100 biomeEditor.addFunc(
"getSelectedType", [](ScriptBiomeRulesEditor* self) {
101 return self ? self->editor().selectedType() : std::string{};
103 biomeEditor.addFunc(
"getLayerCount", [](ScriptBiomeRulesEditor* self) {
104 return self ? self->editor().layerCount() : 0;
106 biomeEditor.addFunc(
"getLayerId", [](ScriptBiomeRulesEditor* self,
int index) {
107 return self ? self->editor().layerId(
index) : std::string{};
109 biomeEditor.addFunc(
"getLayerName", [](ScriptBiomeRulesEditor* self,
int index) {
110 return self ? self->editor().layerName(
index) : std::string{};
112 biomeEditor.addFunc(
"getLayerDensity", [](ScriptBiomeRulesEditor* self,
int index) {
113 return self ? self->editor().layerDensity(
index) : 0.0f;
115 biomeEditor.addFunc(
"getLayerPriority", [](ScriptBiomeRulesEditor* self,
int index) {
116 return self ? self->editor().layerPriority(
index) : 0;
118 biomeEditor.addFunc(
"getLayerSelected", [](ScriptBiomeRulesEditor* self,
int index) {
119 return self && self->editor().isLayerSelected(
index);
121 biomeEditor.addFunc(
"getAssetCount", [](ScriptBiomeRulesEditor* self) {
122 return self ? self->editor().assetCount() : 0;
124 biomeEditor.addFunc(
"getAssetId", [](ScriptBiomeRulesEditor* self,
int index) {
125 return self ? self->editor().assetId(
index) : std::string{};
127 biomeEditor.addFunc(
"getAssetRef", [](ScriptBiomeRulesEditor* self,
int index) {
128 return self ? self->editor().assetRef(
index) : std::string{};
130 biomeEditor.addFunc(
"getAssetWeight", [](ScriptBiomeRulesEditor* self,
int index) {
131 return self ? self->editor().assetWeight(
index) : 0.0f;
133 biomeEditor.addFunc(
"getAssetSelected", [](ScriptBiomeRulesEditor* self,
int index) {
134 return self && self->editor().isAssetSelected(
index);
136 biomeEditor.addFunc(
"getExclusionCount", [](ScriptBiomeRulesEditor* self) {
137 return self ? self->editor().exclusionCount() : 0;
139 biomeEditor.addFunc(
"getExclusionAsset", [](ScriptBiomeRulesEditor* self,
int index) {
140 return self ? self->editor().exclusionAsset(
index) : std::string{};
142 biomeEditor.addFunc(
"getPointCount", [](ScriptBiomeRulesEditor* self) {
143 return self ? self->editor().pointCount() : 0;
145 biomeEditor.addFunc(
"getPointX", [](ScriptBiomeRulesEditor* self,
int index) {
146 return self ? self->editor().pointX(
index) : 0.0f;
148 biomeEditor.addFunc(
"getPointZ", [](ScriptBiomeRulesEditor* self,
int index) {
149 return self ? self->editor().pointZ(
index) : 0.0f;
151 biomeEditor.addFunc(
"getPointAsset", [](ScriptBiomeRulesEditor* self,
int index) {
152 return self ? self->editor().pointAsset(
index) : std::string{};
155 editor::registerEditorOwnedCreate<ScriptBiomeRulesEditor, BiomeEditorModule>(moduleClass, bind,
"biome target id must not be empty");