Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Eden export size, and split it into multiple parts if estimated size is too big #114

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion @ArmaMapStudio/addons/eden/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ PREP(export);
PREP(getPosWrp);
PREP(recreateHidden);
PREP(transformObject);
PREP(editObject);
PREP(editObject);
PREP(copyPart);
15 changes: 15 additions & 0 deletions @ArmaMapStudio/addons/eden/functions/fnc_copyPart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

copyToClipboard (GVAR(results) # GVAR(current));
GVAR(current) = GVAR(current) + 1;
systemChat (format ["Part %1 on %2 copied", GVAR(current), count GVAR(results)]);

if ( GVAR(current) < count GVAR(results)) then {
[
format [LLSTRING(NextPartMessage),GVAR(current), count GVAR(results)],
LLSTRING(ExportToGrmStudio),
[LLSTRING(NextPartButton),{ 0 spawn { sleep 0.1; call FUNC(copyPart); }; }]
] call BIS_fnc_3DENShowMessage;
} else {
[LLSTRING(ExportDone), 0, 5] call BIS_fnc_3DENNotification;
}
40 changes: 32 additions & 8 deletions @ArmaMapStudio/addons/eden/functions/fnc_export.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ private _toRemoveLayer = if ( count _existingLayers > 0 ) then { _existingLayer
private _progress = 0;
private _progressTotal = count _objects + count _systems;

_data pushBack [".map", worldName, worldSize, getNumber (configFile >> "CfgWorlds" >> worldName >> "grma3_revision")];
private _prelude = (str [".map", worldName, worldSize, getNumber (configFile >> "CfgWorlds" >> worldName >> "grma3_revision")]);

{
if ( _x isKindOf "ModuleHideTerrainObjects_F" ) then {
_x set3DENLayer _toRemoveLayer;
private _hidden = _x getVariable ["#objects",[]];
{
_data pushBack [".hide", (getModelInfo _x) select 1, getPosWorld _x, [_x] call FUNC(getPosWrp), vectorUp _x, vectorDir _x, surfaceNormal (getPosASL _x), getObjectScale _x, getObjectID _x];
_data pushBack [".hide", (getModelInfo _x) select 1, [], [_x] call FUNC(getPosWrp), vectorUp _x, vectorDir _x, surfaceNormal (getPosASL _x), getObjectScale _x, getObjectID _x];
} foreach _hidden;
};

Expand All @@ -31,7 +31,7 @@ _data pushBack [".map", worldName, worldSize, getNumber (configFile >> "CfgWorld
if ( _value == 5 ) then {
private _building = _x getVariable ["#building", objNull];
if ( !isNull _building ) then {
_data pushBack [".hide", (getModelInfo _building) select 1, getPosWorld _building, [_building] call FUNC(getPosWrp), vectorUp _building, vectorDir _building, surfaceNormal (getPosASL _building), getObjectScale _building, getObjectID _building];
_data pushBack [".hide", (getModelInfo _building) select 1, [], [_building] call FUNC(getPosWrp), vectorUp _building, vectorDir _building, surfaceNormal (getPosASL _building), getObjectScale _building, getObjectID _building];
};
_x set3DENLayer _toRemoveLayer;
};
Expand All @@ -42,6 +42,8 @@ _data pushBack [".map", worldName, worldSize, getNumber (configFile >> "CfgWorld

} foreach _systems;

private _deleteCount = count _data;

{
if (_x get3DENAttribute "GRMA3_Exclude" select 0) then {
// Ignored
Expand Down Expand Up @@ -74,7 +76,7 @@ _data pushBack [".map", worldName, worldSize, getNumber (configFile >> "CfgWorld
_classes set [_class,_classData];
};
if ( _classData select 0 ) then {
_data pushBack [".add", _class, getPosWorld _x, [_x] call FUNC(getPosWrp), vectorUp _x, vectorDir _x, surfaceNormal (getPosASL _x), getObjectScale _x];
_data pushBack [".add", _class, [], [_x] call FUNC(getPosWrp), vectorUp _x, vectorDir _x, surfaceNormal (getPosASL _x), getObjectScale _x];
_x set3DENLayer _toRemoveLayer;
};
};
Expand All @@ -85,20 +87,42 @@ _data pushBack [".map", worldName, worldSize, getNumber (configFile >> "CfgWorld

} foreach _objects;


private _addCount = (count _data) - _deleteCount - (count _classes);
private _elevationCount = 0;

// Deformer related data
if ( !isNil "GF_gridMap") then {
_data pushBack [".dhmap", GF_gridMap apply { [_x#0, _x#1, _y#0] }];
toFixed 3;
private _hmap = GF_gridMap apply { [_x#0, _x#1, _y#0] };
_elevationCount = count _hmap;
for "_i" from 0 to (count _hmap) step 25 do {
_data pushBack ((str [".dhmap", _hmap select [_i, 25] ]) regexReplace ["\.000/gio", ""]);
};
};

endloadingscreen;

INFO_1("%1 items", count _data);

private _results = [];

toFixed 20;

private _result = _data joinString endl;
for "_i" from 0 to (count _data) step 20000 do {
_results pushBack (([_prelude] + (_data select [_i, 20000])) joinString endl);
};

toFixed -1;

copyToClipboard _result;
systemChat (format ["Total: %1 deletes, %2 adds, %3 elevation changes", _deleteCount, _addCount, _elevationCount]);

[LLSTRING(ExportDone), 0, 5] call BIS_fnc_3DENNotification;
if ( count _results <= 1 ) then {
copyToClipboard (_results # 0);
[LLSTRING(ExportDone), 0, 5] call BIS_fnc_3DENNotification;
}
else {
GVAR(results) = _results;
GVAR(current) = 0;
call FUNC(copyPart);
};
8 changes: 8 additions & 0 deletions @ArmaMapStudio/addons/eden/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@
<English>Edit object</English>
<French>Modifier l'objet</French>
</Key>
<Key ID="STR_grma3_eden_NextPartButton">
<English>Next Part</English>
<French>Suivant</French>
</Key>
<Key ID="STR_grma3_eden_NextPartMessage">
<English>Part %1 on %2 of export have been copied. Import it in GameRealisticMap Studio, and then click on Next Part button to continue.</English>
<French>Partie %1 sur %2 de l'export a été copié. Importer le dans GameRealisticMap Studio, puis ensuite cliquer sur le bouton Suivant pour continuer.</French>
</Key>
</Package>
</Project>
2 changes: 1 addition & 1 deletion @ArmaMapStudio/addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 0
#define MINOR 3
#define PATCH 0
#define PATCH 1
#define BUILD 0
Loading