forked from reyhard/o2scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport_current_lod_bitxt.bio2s
73 lines (59 loc) · 1.64 KB
/
export_current_lod_bitxt.bio2s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Exports current lod as BITXT file at the same location as the p3d
*/
#include "std\lodNames.inc"
console = openStandardIO;
if (this in ["options"]) exitWith {MessageBox ["No options!",0];-1};
private ["_sel","_curLod","_obj","_activeLod","_resols","_lodsToDeleteAr","_p3dname","_txtName","_lodname"];
_p3dName = nameof this;
if (_p3dname == "") exitWith {messageBox ["Please save the file first",0];};
_resols = getResolutions this;
_obj = getActiveObject this;
_curLod = activeLevel this;
_lodsToDeleteAr = [];
// delete all lods except current
for "_b" from 0 to ((count this) - 1) do
{
_activeLod = _resols @ _b;
if (_b != _curLod) then
{
_lodsToDeleteAr = _lodsToDeleteAr + [_activeLod];
}
else
{
_lodname = _activeLod call lodNameGetName;
};
};
if (count _lodsToDeleteAr > 0) then
{
{
this setActiveSpecial _x;
this deleteLevel (activeLevel this);
} forEach _lodsToDeleteAr;
};
{
// delete all proxies
if (_x @ [0,6]=="proxy:") then
{
_sel = _obj loadSelection _x;
deleteSelected _sel;
};
// delete all selections
_obj deleteSelection _x;
} forEach (getSelections _obj);
// save all as selection "filename"
_sel = newSelection _obj;
selectAll _sel;
_obj save _sel as (((splitpath _p3dName) @ 2) + "_Lod" + _lodname);
// save as bitxt
_txtName = ((splitpath _p3dName) @ 0) + ((splitpath _p3dName) @ 1) + ((splitpath _p3dName) @ 2) + "_Lod" + _lodname + ".txt";
if (this exportBiTXT_SG _txtName) then
{
console<<"Exported current lod as: "<<eoln<<_txtName<<eoln;
}
else
{
console<<"Error exporting "<<_txtName<<eoln;
};
// revert
if (true) exitWith {-1};