Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
EBTEmatUtils.c
Go to the documentation of this file.
1#ifdef WORKBENCH
2
3class EBTContainerFields
4{
5 // EMAT
6 static const string conf = "Configurations";
7 static const string materialAssigns = "MaterialAssigns";
8 static const string UVTransform = "MatUVTransform";
9 // EDDS
10 static const string conversion = "Conversion";
11 static const string colorSpace = "ColorSpace";
12 static const string mips = "ContainsMips";
13 static const string rgHQCompression = "RedGreenHQCompression";
14 static const string colorHQCompression = "ColorHQCompression";
15 static const string tosRGB = "TosRGB";
16 static const string toLinear = "ToLinear";
17 static const string raw = "Raw";
18 static const string sRGB = "sRGB";
19 static const string redHQCompression = "RedHQCompression";
20 //PREFAB
21 static const string coords = "coords";
22 static const string angles = "angles";
23 static const string scale = "scale";
24 static const string pivot = "PivotID";
25 static const string hierarchy = "Hierarchy";
26 static const string components = "components";
27 static const string meshObject = "MeshObject";
28 static const string object = "Object";
29 static const ref array<string> supportedTypes = {"GenericEntity", "Building", "GameEntity", "StaticModelEntity","DestructibleEntity","SCR_DestructibleEntity"};
30}
31
32
33class GetRelativePathRequest : JsonApiStruct
34{
35 string absPath;
36
37 void GetRelativePathRequest()
38 {
39 RegV("absPath");
40 }
41}
42
43class GetRelativePathResponse : JsonApiStruct
44{
45 string relPath;
46 string errorString;
47
48 void GetRelativePathResponse()
49 {
50 RegV("relPath");
51 RegV("errorString");
52 }
53}
54
55
56class GetRelativePath : NetApiHandler
57{
58 //------------------------------------------------------------------------------------------------
59 override JsonApiStruct GetRequest()
60 {
61 return new GetRelativePathRequest();
62 }
63
64 //------------------------------------------------------------------------------------------------
65 override JsonApiStruct GetResponse(JsonApiStruct request)
66 {
67 GetRelativePathRequest req = GetRelativePathRequest.Cast(request);
68 GetRelativePathResponse res = GetRelativePathResponse();
69
70 if (req.absPath.StartsWith("{"))
71 {
72 res.relPath = req.absPath;
73 return res;
74 }
75
76 ResourceManager resourceManager = Workbench.GetModule(ResourceManager);
77 MetaFile metaFile = resourceManager.GetMetaFile(req.absPath);
78
79 if (!metaFile)
80 {
81 res.errorString = "No Resource found at given absolute path " + req.absPath;
82 return res;
83 }
84
85 res.relPath = metaFile.GetResourceID();
86
87
88 return res;
89 }
90}
91
92class EBTEmatUtils
93{
94 bool GetMaterials(string xobPath, out map<string,ResourceName> AssignedMats)
95 {
96 // Get xob meta file
97 ResourceManager resourceManager = Workbench.GetModule(ResourceManager);
98 MetaFile meta = resourceManager.GetMetaFile(xobPath);
99 // return false if meta is missing
100 if(!meta)
101 {
102 return false;
103 }
104 // Get assigned materials from Meta file
105 BaseContainerList configurations = meta.GetObjectArray(EBTContainerFields.conf);
106 BaseContainer cfg = configurations.Get(0);
107 string materialAssigns;
108 array<string> pairs = new array<string>;
109 cfg.Get(EBTContainerFields.materialAssigns, materialAssigns);
110
111 // format them into map and pair correct name - path
112 materialAssigns.Split(";", pairs, true);
113 foreach (string pair : pairs)
114 {
115 array<string> keyValue = new array<string>;
116 pair.Split(",", keyValue, true);
117 AssignedMats.Set(keyValue[0], keyValue[1]);
118 }
119 return true;
120 }
121
122
123}
124
125#endif
override JsonApiStruct GetResponse(JsonApiStruct request)
vector scale
ref array< string > coords
ref array< string > angles
SCR_AICombatMoveRequestBase GetRequest()
Configs ServerBrowser KickDialogs conf
base classes for filtering in server browser