Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WrapEntitiesPlugin.c
Go to the documentation of this file.
1#ifdef WORKBENCH
2[WorkbenchPluginAttribute(name: "Wrap Entities", wbModules: { "WorldEditor" }, awesomeFontCode: 0xF1B2)]
3class SCR_WrapEntitiesPlugin : WorkbenchPlugin
4{
5 [Attribute(params: "et")]
6 protected ResourceName m_sEntityPrefab;
7
8 [Attribute(defvalue: "GenericEntity")]
9 protected string m_sPrefabClass;
10
11 //------------------------------------------------------------------------------------------------
12 override void Run()
13 {
14 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
15 WorldEditorAPI worldEditorAPI = worldEditor.GetApi();
16
17 int selectedCount = worldEditorAPI.GetSelectedEntitiesCount();
18 if (selectedCount == 0)
19 return;
20
21 IEntity pivotEntity = worldEditorAPI.SourceToEntity(worldEditorAPI.GetSelectedEntity(selectedCount - 1));
22
23 string entityClass;
24 if (!m_sEntityPrefab.IsEmpty())
25 entityClass = m_sEntityPrefab;
26 else if (!m_sPrefabClass.IsEmpty())
27 entityClass = m_sPrefabClass;
28 else
29 entityClass = "GenericEntity";
30
31 worldEditorAPI.BeginEntityAction("WrapEntitiesPlugin");
32 IEntitySource parentSrc = worldEditorAPI.CreateEntity(entityClass, "", worldEditorAPI.GetCurrentEntityLayerId(), null, pivotEntity.GetOrigin(), pivotEntity.GetAngles());
33 for (int i = 0; i < selectedCount; i++)
34 {
35 worldEditorAPI.ParentEntity(parentSrc, worldEditorAPI.GetSelectedEntity(i), true);
36 }
37 worldEditorAPI.EndEntityAction();
38 }
39
40 //------------------------------------------------------------------------------------------------
41 override void Configure()
42 {
43 Workbench.ScriptDialog("Configure 'Wrap Entities' plugin", "", this);
44 }
45
46 //------------------------------------------------------------------------------------------------
47 [ButtonAttribute("Close")]
48 protected bool ButtonClose()
49 {
50 return false;
51 }
52}
53#endif // WORKBENCH
GenerateFlowMaps WorkbenchPlugin WorkbenchPluginAttribute("Regenerate river flow-maps", "Generate and save/overwrite river flow-maps", "", "", {"WorldEditor"}, "", 0xf773)
Definition FlowmapTool.c:59
override void Run()
override void Configure()
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
proto external vector GetAngles()
Same as GetYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
proto external vector GetOrigin()
SCR_FieldOfViewSettings Attribute