Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SendToBlender.c
Go to the documentation of this file.
1[WorkbenchPluginAttribute(name: "EBT: Send To Blender", wbModules: { "ResourceManager" }, resourceTypes: { "fbx", "xob", "et" }, awesomeFontCode: 0xf1d8)]
2class SendToBlenderPlugin : WorkbenchPlugin
3{
4 //------------------------------------------------------------------------------------------------
5 [Attribute("true", UIWidgets.CheckBox, "Import the mesh with the Import Settings of gamemats and layer presets from engine, that were overwritten by the user. This will overwrite the previous FBX settings.")]
6 bool ImportColliderSettings;
7
8 override void OnResourceContextMenu(notnull array<ResourceName> resources)
9 {
10 if (!EBTConfigPlugin.HasBlenderRegistered())
11 return;
12 if (resources.IsEmpty())
13 {
14 Print("No selected resources", LogLevel.WARNING);
15 return;
16 }
17
18 BlenderOperatorDescription operatorDescription = new BlenderOperatorDescription("core");
19
20 operatorDescription.blIDName = "ebt.import_fbx";
21 if (resources[0].EndsWith(".et"))
22 operatorDescription.blIDName = "ebt.import_prefab";
23
24 string absPath;
25
26 if (GetPathToResource(resources[0], absPath))
27 {
28 operatorDescription.AddParam("filepath", absPath); // ImportHelper is using self.file_path
29 operatorDescription.AddParam("remove_all_objects", true);
30 StartBlenderWithOperator(operatorDescription, false);
31 return;
32
33 Print("Resource couldn't be imported to blender because requested resource file is missing or is locked", LogLevel.WARNING);
34 }
35
36 }
37
38 protected bool GetPathToResource(ResourceName resource, inout string absPath)
39 {
40 string path = resource.GetPath();
41 Workbench.GetAbsolutePath(path, absPath);
42
43
44 if (!FileIO.FileExists(absPath) || absPath == string.Empty)
45 return false;
46
47 if (resource.EndsWith(".et"))
48 return true;
49
50 if (absPath.EndsWith(".xob"))
51 absPath.Replace(".xob", ".fbx");
52
53 if (!FileIO.FileExists(absPath))
54 return false;
55
56 return true;
57 }
58
59 //------------------------------------------------------------------------------------------------
60 [ButtonAttribute("Send")]
61 protected bool ButtonOK()
62 {
63 return true;
64 }
65
66 //------------------------------------------------------------------------------------------------
67 [ButtonAttribute("Cancel")]
68 protected bool ButtonCancel()
69 {
70 return false;
71 }
72}
string path
GenerateFlowMaps WorkbenchPlugin WorkbenchPluginAttribute("Regenerate river flow-maps", "Generate and save/overwrite river flow-maps", "", "", {"WorldEditor"}, "", 0xf773)
Definition FlowmapTool.c:59
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
bool GetPathToResource(ResourceName resource, inout string absPath)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute