forked from gildor2/UEViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectViewer.cpp
More file actions
91 lines (71 loc) · 1.76 KB
/
Copy pathObjectViewer.cpp
File metadata and controls
91 lines (71 loc) · 1.76 KB
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
#include "Core.h"
#include "UnrealClasses.h"
#if RENDERING
#include "ObjectViewer.h"
#include "UnPackage.h" // for CObjectViewer::Draw2D()
#include "Exporters/Exporters.h"
CObjectViewer::CObjectViewer(UObject* Obj, CApplication *Win)
: Object(Obj)
, Window(Win)
{
SetDistScale(1);
ResetView();
SetViewOffset(nullVec3);
}
void CObjectViewer::Dump()
{
if (Object)
{
appPrintf("\nObject info:\n============\n");
appPrintf("ClassName: %s ObjectName: %s\n", Object->GetClassName(), Object->Name);
Object->GetTypeinfo()->DumpProps(Object);
}
}
void CObjectViewer::Export()
{
if (Object)
{
ExportObject(Object);
ResetExportedList();
}
}
void CObjectViewer::ProcessKey(int key)
{
guard(CObjectViewer::ProcessKey);
if (!Object) return;
switch (key)
{
case 'x'|KEY_CTRL:
Export();
break;
case 'd':
Dump();
break;
}
unguard;
}
void CObjectViewer::ShowHelp()
{
if (!Object) return;
DrawKeyHelp("D", "dump info");
DrawKeyHelp("Ctrl+X", "export object");
}
void CObjectViewer::Draw2D()
{
if (!Object)
{
DrawTextLeft(S_RED "There's no visual object loaded now.");
DrawTextLeft(S_RED "Press <O> to load a different package.");
return;
}
const char *CookedPkgName = Object->Package->Name;
const char *UncookedPkgName = Object->GetUncookedPackageName();
if (stricmp(CookedPkgName, UncookedPkgName) == 0)
DrawTextLeft(S_GREEN "Package :" S_WHITE " %s", Object->Package->Filename);
else
DrawTextLeft(S_GREEN "Package :" S_WHITE " %s (%s)", Object->Package->Filename, UncookedPkgName);
DrawTextLeft(S_GREEN "Class :" S_WHITE " %s\n"
S_GREEN "Object :" S_WHITE " %s\n",
Object->GetRealClassName(), Object->Name);
}
#endif // RENDERING