3class SCR_MarkShapesEditorOnlyPlugin : WorkbenchPlugin
6 protected bool ActiveLayerOnly;
8 protected ref array<string> m_aEditorOnlyGenerators = {
9 "ForestGeneratorEntity",
10 "PrefabGeneratorEntity",
11 "RoadGeneratorEntity",
12 "SCR_PowerlineGeneratorEntity",
18 protected bool OkButton()
26 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
34 BaseWorld world = worldEditorAPI.GetWorld();
38 if (!Workbench.ScriptDialog(
"Configure editor only marking",
"",
this))
41 if (!worldEditorAPI.BeginEntityAction())
44 Print(
"--- Start marking shapes editor only",
LogLevel.NORMAL);
47 int approximateCount = worldEditorAPI.GetEditorEntityCount();
48 WBProgressDialog progress =
new WBProgressDialog(
"Marking", worldEditor);
50 worldEditorAPI.ToggleGeneratorEvents(
false);
54 float prevProgress, currProgress;
60 currProgress = iter.GetCurrentIdx() / approximateCount;
61 if (currProgress - prevProgress >= 0.01)
63 progress.SetProgress(currProgress);
64 prevProgress = currProgress;
68 worldEditorAPI.ToggleGeneratorEvents(
true);
69 worldEditorAPI.EndEntityAction();
71 Print(
"--- Done marking shapes editor only",
LogLevel.NORMAL);
78 src.Get(
"Flags",
flags);
82 worldEditorAPI.SetVariableValue(src, null,
"Flags",
flags.ToString());
91 int activeLayer = worldEditorAPI.GetCurrentEntityLayerId();
92 if (src.GetLayerID() != activeLayer)
96 int childCount = src.GetNumChildren();
97 string classname = src.GetClassName();
99 if (classname ==
"PolylineShapeEntity" || classname ==
"SplineShapeEntity")
102 bool shapeEdOnly =
true;
106 for (
int i = 0; i < childCount; ++i)
109 bool isEdOnlyGenerator =
false;
110 childSrc = src.GetChild(i);
111 foreach (
string editorOnlyGenerator : m_aEditorOnlyGenerators)
113 if (childSrc.GetClassName() == editorOnlyGenerator)
115 isEdOnlyGenerator =
true;
117 SetEditorOnly(worldEditorAPI, childSrc);
123 if (!isEdOnlyGenerator)
131 SetEditorOnly(worldEditorAPI, src);
135 for (
int i = 0; i < childCount; ++i)
SCR_EAIThreatSectorFlags flags
bool ProcessEntity(IEntity ent)
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EntityFlags
Various entity flags.