3 "World Window DataDrop Plugin",
4 "Allows to handle dropped data into a world edit window and completely reimplement default editor functionality",
5 wbModules: {
"WorldEditor" })]
6class SCR_WorldWindowDataDropPlugin : WorldEditorPlugin
8 protected static const string DATA_TYPE_ENTITY_CLASSNAME =
"WorldEditor/EntityType";
9 protected static const string DATA_TYPE_RESOURCE_FILES =
"Workbench/ResourceFiles";
12 override bool OnWorldEditWindowDataDropped(
int windowType,
int posX,
int posY,
string dataType, array<string>
data)
14 if (dataType == DATA_TYPE_ENTITY_CLASSNAME)
16 string className =
data[0];
19 if (className ==
"SomeNotExistingClassAsExample")
22 SpawnCustomizedEntityAsExample(windowType, posX, posY, className);
26 else if (dataType == DATA_TYPE_RESOURCE_FILES)
29 for (
int n = 0; n <
data.Count(); n++)
31 string resName =
data[n];
34 FilePath.StripExtension(resName, ext);
53 WorldEditorAPI worldEditorAPI = ((WorldEditor)Workbench.GetModule(WorldEditor)).GetApi();
54 if (worldEditorAPI.BeginEntityAction(
"Creating entity"))
56 worldEditorAPI.ClearEntitySelection();
59 IEntitySource ent = worldEditorAPI.CreateEntityInWindowEx(windowType, posX, posY,
"ParticleEffectEntity",
"", worldEditorAPI.GetCurrentEntityLayerId());
62 worldEditorAPI.SetVariableValue(ent, null,
"EffectPath", resName);
63 worldEditorAPI.AddToEntitySelection(ent);
66 worldEditorAPI.EndEntityAction();
71 protected void SpawnCustomizedEntityAsExample(
int windowType,
int posX,
int posY,
string className)
74 WorldEditorAPI worldEditorAPI = ((WorldEditor)Workbench.GetModule(WorldEditor)).GetApi();
75 if (worldEditorAPI.BeginEntityAction(
"Creating entity"))
77 worldEditorAPI.ClearEntitySelection();
80 IEntitySource ent = worldEditorAPI.CreateEntityInWindowEx(windowType, posX, posY, className,
"", worldEditorAPI.GetCurrentEntityLayerId());
82 worldEditorAPI.AddToEntitySelection(ent);
84 worldEditorAPI.EndEntityAction();
Get all prefabs that have the spawner data
ParticleEffectEntityClass GenericEntityClass SpawnParticleEffect(ResourceName effectPath, notnull ParticleEffectEntitySpawnParams spawnParams)