add blocks counter when processing & fix type variables to remove warning logs
This commit is contained in:
parent
7555131ad0
commit
7608c38221
@ -1,6 +1,8 @@
|
|||||||
bool menu_visibility = false;
|
bool menu_visibility = false;
|
||||||
int mode;
|
int mode;
|
||||||
int lightmaptoselect = -1;
|
int lightmaptoselect = -1;
|
||||||
|
int nbblocksdone;
|
||||||
|
int nbtotalblocks;
|
||||||
bool searchmode;
|
bool searchmode;
|
||||||
array<CGameEditorPluginMap::EMapElemLightmapQuality> activelm;
|
array<CGameEditorPluginMap::EMapElemLightmapQuality> activelm;
|
||||||
|
|
||||||
@ -14,10 +16,15 @@ void Main() {
|
|||||||
auto editor = cast<CGameCtnEditorFree>(GetApp().Editor);
|
auto editor = cast<CGameCtnEditorFree>(GetApp().Editor);
|
||||||
auto pluginmap = cast<CGameEditorPluginMapMapType>(editor.PluginMapType);
|
auto pluginmap = cast<CGameEditorPluginMapMapType>(editor.PluginMapType);
|
||||||
|
|
||||||
pluginmap.EditMode = CGameEditorPluginMap::EditMode::SelectionAdd;
|
|
||||||
auto blocks = GetApp().RootMap.Blocks;
|
auto blocks = GetApp().RootMap.Blocks;
|
||||||
for (int i = 0; i < blocks.Length;) {
|
auto items = GetApp().RootMap.AnchoredObjects;
|
||||||
print("Block number: " + i);
|
|
||||||
|
nbblocksdone = 0;
|
||||||
|
nbtotalblocks = blocks.Length + items.Length;
|
||||||
|
|
||||||
|
pluginmap.EditMode = CGameEditorPluginMap::EditMode::SelectionAdd;
|
||||||
|
|
||||||
|
for (uint i = 0; i < blocks.Length;) {
|
||||||
if (!(lightmaptoselect >= 0) || pluginmap.PlaceMode != CGameEditorPluginMap::EPlaceMode::CopyPaste) break; //ability to cancel
|
if (!(lightmaptoselect >= 0) || pluginmap.PlaceMode != CGameEditorPluginMap::EPlaceMode::CopyPaste) break; //ability to cancel
|
||||||
if (pluginmap.EditMode == CGameEditorPluginMap::EditMode::SelectionAdd) {
|
if (pluginmap.EditMode == CGameEditorPluginMap::EditMode::SelectionAdd) {
|
||||||
if (blocks[i].MapElemLmQuality == lightmaptoselect && blocks[i].BlockModel.Name != "Grass") {
|
if (blocks[i].MapElemLmQuality == lightmaptoselect && blocks[i].BlockModel.Name != "Grass") {
|
||||||
@ -29,13 +36,14 @@ void Main() {
|
|||||||
}
|
}
|
||||||
if (i % 5 == 0) yield();
|
if (i % 5 == 0) yield();
|
||||||
i++;
|
i++;
|
||||||
|
nbblocksdone++;
|
||||||
} else {
|
} else {
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto items = GetApp().RootMap.AnchoredObjects;
|
|
||||||
for (int i = 0; i < items.Length;) {
|
for (uint i = 0; i < items.Length;) {
|
||||||
if (! (lightmaptoselect >= 0) || pluginmap.PlaceMode != CGameEditorPluginMap::EPlaceMode::CopyPaste) break; //ability to cancel
|
if (! (lightmaptoselect >= 0) || pluginmap.PlaceMode != CGameEditorPluginMap::EPlaceMode::CopyPaste) break; //ability to cancel
|
||||||
if (pluginmap.EditMode == CGameEditorPluginMap::EditMode::SelectionAdd) {
|
if (pluginmap.EditMode == CGameEditorPluginMap::EditMode::SelectionAdd) {
|
||||||
if (items[i].MapElemLmQuality == lightmaptoselect) {
|
if (items[i].MapElemLmQuality == lightmaptoselect) {
|
||||||
@ -47,6 +55,7 @@ void Main() {
|
|||||||
}
|
}
|
||||||
if (i % 5 == 0) yield();
|
if (i % 5 == 0) yield();
|
||||||
i++;
|
i++;
|
||||||
|
nbblocksdone++;
|
||||||
} else {
|
} else {
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
@ -61,14 +70,13 @@ void UpdateSelectedLightmap() {
|
|||||||
auto editor = cast<CGameCtnEditorFree>(GetApp().Editor);
|
auto editor = cast<CGameCtnEditorFree>(GetApp().Editor);
|
||||||
auto pluginmap = cast<CGameEditorPluginMapMapType>(editor.PluginMapType);
|
auto pluginmap = cast<CGameEditorPluginMapMapType>(editor.PluginMapType);
|
||||||
if (pluginmap.PlaceMode == CGameEditorPluginMap::EPlaceMode::CopyPaste) {
|
if (pluginmap.PlaceMode == CGameEditorPluginMap::EPlaceMode::CopyPaste) {
|
||||||
|
|
||||||
// Value in CopyPaste_GetLightmapQualityInSelection_Results is broken
|
// Value in CopyPaste_GetLightmapQualityInSelection_Results is broken
|
||||||
|
|
||||||
/*pluginmap.CopyPaste_GetLightmapQualityInSelection();
|
pluginmap.CopyPaste_GetLightmapQualityInSelection();
|
||||||
activelm = {};
|
activelm = {};
|
||||||
for (int i=0 ; i < pluginmap.CopyPaste_GetLightmapQualityInSelection_Results.Length; i++) {
|
for (uint i=0 ; i < pluginmap.CopyPaste_GetLightmapQualityInSelection_Results.Length; i++) {
|
||||||
print("" + pluginmap.CopyPaste_GetLightmapQualityInSelection_Results[i]);
|
print("" + pluginmap.CopyPaste_GetLightmapQualityInSelection_Results[i]);
|
||||||
}*/
|
}
|
||||||
} else {
|
} else {
|
||||||
activelm = {pluginmap.NextMapElemLightmapQuality};
|
activelm = {pluginmap.NextMapElemLightmapQuality};
|
||||||
}
|
}
|
||||||
@ -104,6 +112,10 @@ void Render() {
|
|||||||
if (UI::Button(Icons::Search)) {
|
if (UI::Button(Icons::Search)) {
|
||||||
lightmaptoselect = -1; //ability to cancel
|
lightmaptoselect = -1; //ability to cancel
|
||||||
searchmode = !searchmode;
|
searchmode = !searchmode;
|
||||||
|
|
||||||
|
//reset status info
|
||||||
|
nbblocksdone = 0;
|
||||||
|
nbtotalblocks = 0;
|
||||||
if (!searchmode) UI::PopStyleColor();
|
if (!searchmode) UI::PopStyleColor();
|
||||||
} else {
|
} else {
|
||||||
if (searchmode) UI::PopStyleColor();
|
if (searchmode) UI::PopStyleColor();
|
||||||
@ -232,6 +244,13 @@ void Render() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode == CGameEditorPluginMap::EPlaceMode::CopyPaste && nbtotalblocks == 0) {
|
||||||
|
UI::Text("Note: buttons highlighting doesn't work in this mode,\nseems to be a bug of Openplanet");
|
||||||
|
} else if (mode == CGameEditorPluginMap::EPlaceMode::CopyPaste) {
|
||||||
|
UI::Text("Progress: " + nbblocksdone + " / " + nbtotalblocks);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UI::Text("Open this plugin in the map editor");
|
UI::Text("Open this plugin in the map editor");
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,5 @@ author = "Beu"
|
|||||||
category = "Map Editor"
|
category = "Map Editor"
|
||||||
|
|
||||||
siteid = 137
|
siteid = 137
|
||||||
version = "1.0"
|
version = "1.3"
|
||||||
|
perms = "paid"
|
||||||
[script]
|
|
||||||
imports = [ "Icons.as" ]
|
|
Loading…
Reference in New Issue
Block a user