-
Notifications
You must be signed in to change notification settings - Fork 2
/
Export Interior Items-Temporary.pas
102 lines (86 loc) · 4.26 KB
/
Export Interior Items-Temporary.pas
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
Build a list of interior cell temporary items in csv format
}
unit ListInteriorCells;
var
slCells: TStringList;
function Initialize: integer;
var
f, Blocks, Block, SubBlock, Cell, CellItems, e, Linke : IInterface;
i, j, k, z : integer;
LocName, CellID, CellName, ItemName, Sig, Sig2: String;
begin
slCells := TStringList.Create;
slCells.Add('FormID,Name,Signature,BaseSignature,CellID,CellName,Location,Position-X,Position-Y,Position-Z,Rotation-X,Rotation-Y,Rotation-Z,Bounds-X1,Bounds-Y1,Bounds-Z1,Bounds-X2,Bounds-Y2,Bounds-Z2');
f := FileByIndex(0); //Main ESM
Blocks := GroupBySignature(f, 'CELL');
// addmessage('Found Cell Blocks: '+IntToStr(ElementCount(Blocks)));
for i := 0 to ElementCount(Blocks) -1 do begin
Block := ElementByIndex(Blocks,i);
// addmessage('Found SubBlocks: '+IntToStr(ElementCount(Block)));
for j := 0 to ElementCount(Block) -1 do begin
SubBlock := ElementByIndex(Block,j);
// addmessage('Found Cells: '+IntToStr(ElementCount(SubBlock)));
for k := 0 to ElementCount(SubBlock) -1 do begin
Cell := ElementByIndex(SubBlock,k);
// AddMessage('CellGroup Count '+IntToStr(ElementCount(Cell)));
if GetElementNativeValues(Cell, 'DATA') and 1 > 0 then begin
LocName: = EditorID(LinksTo(ElementBySignature(Cell, 'XLCN')));
If (LocName <> '') then begin //Only include items with External Locations
CellID : = IntToHex(FixedFormID(Cell), 8);
CellName := DisplayName(Cell);
CellItems := FindChildGroup(ChildGroup(Cell),9,Cell);
for z := 0 to ElementCount(CellItems) -1 do begin
e := ElementByIndex(CellItems,z);
Linke := LinksTo(ElementByName(e,'NAME - Base'));
ItemName := StringReplace(Name(Linke),'"','""',[rfReplaceAll]);
sig := Signature(e);
sig2 := Signature(Linke);
If (sig2 <> 'LIGH') AND (sig <> 'NAVM') AND (sig2 <> 'SOUN') AND (sig <> 'PHZD') AND (sig2 <> 'IDLM') AND (sig2 <> 'BNDS')
AND (pos('Debug',LocName)=0) AND (pos('Babylon',LocName)=0) AND (pos('Test',LocName)=0) AND (pos('CUT_',LocName)=0)
AND (pos('76CharGen',LocName)=0) AND (pos('76TrailerLocation',LocName)=0) AND (pos('LeveledItemSpawnLocation',LocName)=0) AND (pos('Holding',LocName)=0)
AND (pos('Test', Cellname)=0)
AND (ItemName <> 'CollisionMarker [STAT:00000021]') AND (ItemName <> 'StaticCollectionPivotDummy [STAT:00035812]') AND (ItemName <> 'CubeMapVolume [STAT:00000024]') then begin //Let's filter some items out
slCells.Add(Format('"%s","%s",%s,%s,"%s","%s","%s",%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s', [
IntToHex(FormID(e), 8),
ItemName,
sig,
sig2,
CellID,
CellName,
LocName,
GetEditValue(ElementByName(ElementByName(ElementByName(e,'DATA - Position/Rotation'),'Position'),'X')),
GetEditValue(ElementByName(ElementByName(ElementByName(e,'DATA - Position/Rotation'),'Position'),'Y')),
GetEditValue(ElementByName(ElementByName(ElementByName(e,'DATA - Position/Rotation'),'Position'),'Z')),
GetEditValue(ElementByName(ElementByName(ElementByName(e,'DATA - Position/Rotation'),'Rotation'),'X')),
GetEditValue(ElementByName(ElementByName(ElementByName(e,'DATA - Position/Rotation'),'Rotation'),'Y')),
GetEditValue(ElementByName(ElementByName(ElementByName(e,'DATA - Position/Rotation'),'Rotation'),'Z')),
GetEditValue(ElementByName(ElementByName(Linke,'OBND - Object Bounds'),'X1')),
GetEditValue(ElementByName(ElementByName(Linke,'OBND - Object Bounds'),'Y1')),
GetEditValue(ElementByName(ElementByName(Linke,'OBND - Object Bounds'),'Z1')),
GetEditValue(ElementByName(ElementByName(Linke,'OBND - Object Bounds'),'X2')),
GetEditValue(ElementByName(ElementByName(Linke,'OBND - Object Bounds'),'Y2')),
GetEditValue(ElementByName(ElementByName(Linke,'OBND - Object Bounds'),'Z2'))
]));
end;
//if (z > 200) then break; //Shorten run for testing
end;
end;
end;
end; //End SubBlock
end; //End Block
end; //End Blocks
end;
function Finalize: integer;
var
fname: string;
begin
if slCells.Count > 1 then begin
fname := ProgramPath + 'Cells.csv';
AddMessage('Saving report to ' + fname);
slCells.SaveToFile(fname);
end else
AddMessage('No cells found in selection.');
slCells.Free;
end;
end.