Enfusion Script API
Loading...
Searching...
No Matches
WorldEditorAPI Interface Reference

Public Member Functions

proto external bool BeginEntityAction (string historyPointName=string.Empty, string historyPointIcon=string.Empty)
 Beginning of logical edit action.
 
proto external bool EndEntityAction (string historyPointName=string.Empty)
 Ending of edit action.
 
proto external bool IsDoingEditAction ()
 
proto external bool BeginEditSequence (IEntitySource entSrc)
 Together with EndEditSequence() it can be used to define a block where entity will never be re-initialized. Useful for multiple edit actions upon single entity.
 
proto external bool EndEditSequence (IEntitySource entSrc)
 Together with BeginEditSequence() it can be used to define a block where entity will never be re-initialized. Useful for multiple edit actions upon single entity.
 
proto external bool IsEditSequenceActive (IEntitySource entSrc)
 Check whether we are between BeginEditSequence() and EndEditSequence().
 
proto external bool UndoOrRedoIsRestoring ()
 Check whether editor is restoring undo or redo state.
 
proto external bool IsCreatingEntityInWindow ()
 Check whether user created an entity in editor window. Eg. drag and drop from hierarchy, etc.
 
proto external bool IsModifyingData ()
 
proto external bool IsPrefabEditMode ()
 Check whether editor is running in a prefab edit mode where all edit actions should apply their changes directly to a prefab instead of entity instance.
 
proto external IEntity SourceToEntity (IEntitySource entSrc)
 
proto external IEntitySource EntityToSource (IEntity ent)
 
proto external IEntitySource FindEntityByName (string name)
 
proto external IEntitySource FindEntityByID (EntityID id)
 
proto external int GetEditorEntityCount ()
 Returns the number of entities in the editor.
 
proto external IEntitySource GetEditorEntity (int index)
 Returns an entity in the editor on given index. To obtain count, use GetEditorEntityCount().
 
proto external bool ParentEntity (notnull IEntitySource parent, notnull IEntitySource child, bool transformChildToParentSpace)
 
proto external bool RemoveEntityFromParent (notnull IEntitySource child)
 
proto external IEntityComponentSource CreateComponent (IEntitySource owner, string className)
 
proto external bool DeleteComponent (IEntitySource owner, IEntityComponentSource component)
 
proto external int GetSelectedEntitiesCount ()
 
proto external IEntitySource GetSelectedEntity (int n=0)
 
proto external void ClearEntitySelection ()
 
proto external void RemoveFromEntitySelection (notnull IEntitySource ent)
 
proto external void SetPropertySelection (string id)
 
proto external void UpdateSelectionGui ()
 
proto external bool CreateEntityTemplate (IEntitySource entitySrc, string templateFileAbs)
 
proto external bool SaveEntityTemplate (IEntitySource tmpl)
 
proto external IEntitySource GetEntityUnderCursor ()
 
proto external bool RenameEntity (notnull IEntitySource ent, string newName)
 
proto external int GetCurrentSubScene ()
 
proto external int GetNumSubScenes ()
 
proto external int GetScreenWidth ()
 Returns width of active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).
 
proto external int GetScreenHeight ()
 Returns height of active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).
 
proto external int GetMousePosX (bool clamped)
 Returns horizontal mouse cursor position in active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).
 
proto external int GetMousePosY (bool clamped)
 Returns vertical mouse cursor position in active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).
 
proto external void ToggleGeneratorEvents (bool isEnabled)
 Enable/disable calling of events on generators. Must be enabled for the VectorTool and generators to work properly.
 
proto external bool AreGeneratorEventsEnabled ()
 
proto external void ModifyHeightMap (float xWorldPos, float zWorldPos, FilterMorphOperation operation, notnull TerrainToolDesc toolDesc, FilterMorphShape shape, FilterMorphLerpFunc interpFunc)
 Modifies the terrain height at specified position based on given brush.
 
proto external void ModifyHeightMapUserShape (float xWorldPos, float zWorldPos, FilterMorphOperation operation, notnull TerrainToolDesc toolDesc, array< float > userShape, UserShapeFilter userShapeFilter)
 Modifies the terrain height at specified position based on given map.
 
proto external void ModifyLayers (float xWorldPos, float zWorldPos, FilterMorphOperation operation, notnull TerrainToolDesc toolDesc, FilterMorphShape shape, FilterMorphLerpFunc interpFunc)
 Modifies the terrain layers at specified position based on given brush.
 
proto external void ModifyLayersUserShape (float xWorldPos, float zWorldPos, FilterMorphOperation operation, notnull TerrainToolDesc toolDesc, array< float > userShape, UserShapeFilter userShapeFilter)
 Modifies the terrain height at specified position based on given map.
 
proto external bool BeginTerrainAction (TerrainToolType toolType, string historyPointName=string.Empty, string historyPointIcon=string.Empty)
 
proto external void EndTerrainAction (string historyPointName=string.Empty)
 
proto external float GetTerrainSurfaceY (float x, float z)
 Returns terrain height (world space) in given point x,z (world space). Very fast method.
 
proto external bool SetVariableValue (notnull BaseContainer topLevel, array< ref ContainerIdPathEntry > containerIdPath, string key, string value)
 Returns terrain height (world space) for given tile.
 
proto external bool ClearVariableValue (notnull BaseContainer topLevel, array< ref ContainerIdPathEntry > containerIdPath, string key)
 Clear value of potentially nested variable.
 
proto external bool CreateObjectVariableMember (notnull BaseContainer topLevel, array< ref ContainerIdPathEntry > containerIdPath, string key, string baseClassName)
 Creates a new container in object property.
 
proto external bool CreateObjectArrayVariableMember (notnull BaseContainer topLevel, array< ref ContainerIdPathEntry > containerIdPath, string key, string baseClassName, int memberIndex)
 Creates a new element in array of objects property in container.
 
proto external bool RemoveObjectArrayVariableMember (notnull BaseContainer topLevel, array< ref ContainerIdPathEntry > containerIdPath, string key, int memberIndex)
 Removes an element from array of objects of property key in container.
 
proto external int ShowItemListDialog (string title, string message, int width, int height, notnull array< string > items, notnull out array< int > selectedItems, int currentItem)
 Shows a selection dialog with provided items where user can select one or multiple items.
 
proto external bool AddPrefabMembers (IEntitySource prefabMember, notnull array< IEntitySource > members)
 Puts new (nowhere used) entity source instances as children of an entity in prefab.
 
proto external bool RemovePrefabMembers (notnull array< IEntitySource > members)
 
proto external bool MoveEntitiesToPrefab (IEntitySource newParentInMap, IEntitySource newParentInPrefab, notnull array< IEntitySource > entitiesInMap)
 Moves existing entity instances from map into a prefab.
 
proto external string GetCurrentToolName ()
 
proto external BaseWorld GetWorld ()
 
proto external string CreateSubsceneLayer (int subScene, string name, string parentPath=string.Empty)
 
proto external string CreateSubsceneFolder (int subScene, string name, string parentPath=string.Empty)
 
proto external bool RenameSubsceneFolder (int subScene, string itemPath, string newItemName)
 
proto external bool DeleteSubsceneFolder (int subScene, string itemPath)
 
proto external bool SetSubsceneFolderParent (int subScene, string itemPath, string parentPath)
 
proto external void GetSubsceneFolders (int subscene, out notnull array< string > outItemPaths)
 
proto external bool SetEntitySubsceneLayer (int subScene, IEntitySource pEntitySource, string itemPath)
 
proto external string GetEntitySubsceneLayer (int subScene, IEntitySource pEntitySource)
 
proto external string GetActiveSubsceneLayer (int subScene)
 
proto external void SetActiveSubsceneLayer (int subScene, string layerPath)
 
proto external int GetSubsceneLayerId (int subscene, string layerPath)
 
proto external string GetSubsceneLayerPath (int subscene, int layerId)
 
proto external bool IsSubsceneLayerVisible (int subscene, string layerPath)
 
proto external bool IsEntityLayerVisible (int subscene, int layerId)
 
proto external int GetCurrentEntityLayerId ()
 

Member Function Documentation

◆ AddPrefabMembers()

proto external bool WorldEditorAPI.AddPrefabMembers ( IEntitySource prefabMember,
notnull array< IEntitySource > members )

Puts new (nowhere used) entity source instances as children of an entity in prefab.

◆ AreGeneratorEventsEnabled()

proto external bool WorldEditorAPI.AreGeneratorEventsEnabled ( )

◆ BeginEditSequence()

proto external bool WorldEditorAPI.BeginEditSequence ( IEntitySource entSrc)

Together with EndEditSequence() it can be used to define a block where entity will never be re-initialized. Useful for multiple edit actions upon single entity.

◆ BeginEntityAction()

proto external bool WorldEditorAPI.BeginEntityAction ( string historyPointName = string.Empty,
string historyPointIcon = string.Empty )

Beginning of logical edit action.

◆ BeginTerrainAction()

proto external bool WorldEditorAPI.BeginTerrainAction ( TerrainToolType toolType,
string historyPointName = string.Empty,
string historyPointIcon = string.Empty )

◆ ClearEntitySelection()

proto external void WorldEditorAPI.ClearEntitySelection ( )

◆ ClearVariableValue()

proto external bool WorldEditorAPI.ClearVariableValue ( notnull BaseContainer topLevel,
array< ref ContainerIdPathEntry > containerIdPath,
string key )

Clear value of potentially nested variable.

The whole path must exist, this function is just to clear the value.

Parameters
topLevelContainer from which the search is started.
containerIdPathPath to the variable we want to clear.
keyThe actual variable to clear.
Returns
true if successful, false otherwise.

◆ CreateComponent()

proto external IEntityComponentSource WorldEditorAPI.CreateComponent ( IEntitySource owner,
string className )

◆ CreateEntityTemplate()

proto external bool WorldEditorAPI.CreateEntityTemplate ( IEntitySource entitySrc,
string templateFileAbs )

◆ CreateObjectArrayVariableMember()

proto external bool WorldEditorAPI.CreateObjectArrayVariableMember ( notnull BaseContainer topLevel,
array< ref ContainerIdPathEntry > containerIdPath,
string key,
string baseClassName,
int memberIndex )

Creates a new element in array of objects property in container.

Parameters
topLevelContainer from which the search is started
containerIdPathPath to the variable we want to set
keyHow is the array of object property in container called
baseClassNameWhat type of object should be created to the array
memberIndexAt which index should be the new element inserted
Returns
true if successful, false otherwise.

◆ CreateObjectVariableMember()

proto external bool WorldEditorAPI.CreateObjectVariableMember ( notnull BaseContainer topLevel,
array< ref ContainerIdPathEntry > containerIdPath,
string key,
string baseClassName )

Creates a new container in object property.

Parameters
topLevelContainer from which the search is started
containerIdPathPath to the variable we want to set
keyHow is the object property in container called
baseClassNameWhat type of object should be created to the property
Returns
true if successful, false otherwise.

◆ CreateSubsceneFolder()

proto external string WorldEditorAPI.CreateSubsceneFolder ( int subScene,
string name,
string parentPath = string.Empty )

◆ CreateSubsceneLayer()

proto external string WorldEditorAPI.CreateSubsceneLayer ( int subScene,
string name,
string parentPath = string.Empty )

◆ DeleteComponent()

proto external bool WorldEditorAPI.DeleteComponent ( IEntitySource owner,
IEntityComponentSource component )

◆ DeleteSubsceneFolder()

proto external bool WorldEditorAPI.DeleteSubsceneFolder ( int subScene,
string itemPath )

◆ EndEditSequence()

proto external bool WorldEditorAPI.EndEditSequence ( IEntitySource entSrc)

Together with BeginEditSequence() it can be used to define a block where entity will never be re-initialized. Useful for multiple edit actions upon single entity.

◆ EndEntityAction()

proto external bool WorldEditorAPI.EndEntityAction ( string historyPointName = string.Empty)

Ending of edit action.

◆ EndTerrainAction()

proto external void WorldEditorAPI.EndTerrainAction ( string historyPointName = string.Empty)

◆ EntityToSource()

proto external IEntitySource WorldEditorAPI.EntityToSource ( IEntity ent)

◆ FindEntityByID()

proto external IEntitySource WorldEditorAPI.FindEntityByID ( EntityID id)

◆ FindEntityByName()

proto external IEntitySource WorldEditorAPI.FindEntityByName ( string name)

◆ GetActiveSubsceneLayer()

proto external string WorldEditorAPI.GetActiveSubsceneLayer ( int subScene)

◆ GetCurrentEntityLayerId()

proto external int WorldEditorAPI.GetCurrentEntityLayerId ( )

◆ GetCurrentSubScene()

proto external int WorldEditorAPI.GetCurrentSubScene ( )

◆ GetCurrentToolName()

proto external string WorldEditorAPI.GetCurrentToolName ( )

◆ GetEditorEntity()

proto external IEntitySource WorldEditorAPI.GetEditorEntity ( int index)

Returns an entity in the editor on given index. To obtain count, use GetEditorEntityCount().

◆ GetEditorEntityCount()

proto external int WorldEditorAPI.GetEditorEntityCount ( )

Returns the number of entities in the editor.

◆ GetEntitySubsceneLayer()

proto external string WorldEditorAPI.GetEntitySubsceneLayer ( int subScene,
IEntitySource pEntitySource )

◆ GetEntityUnderCursor()

proto external IEntitySource WorldEditorAPI.GetEntityUnderCursor ( )

◆ GetMousePosX()

proto external int WorldEditorAPI.GetMousePosX ( bool clamped)

Returns horizontal mouse cursor position in active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).

Parameters
clampedWhether returned values should be clamped in a range between zero and screen width (window width in fact).

◆ GetMousePosY()

proto external int WorldEditorAPI.GetMousePosY ( bool clamped)

Returns vertical mouse cursor position in active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).

Parameters
clampedWhether returned values should be clamped in a range between zero and screen height (window height in fact).

◆ GetNumSubScenes()

proto external int WorldEditorAPI.GetNumSubScenes ( )

◆ GetScreenHeight()

proto external int WorldEditorAPI.GetScreenHeight ( )

Returns height of active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).

◆ GetScreenWidth()

proto external int WorldEditorAPI.GetScreenWidth ( )

Returns width of active scene window (usually it's perspective window but it can be also one of Top, Back, Right view).

◆ GetSelectedEntitiesCount()

proto external int WorldEditorAPI.GetSelectedEntitiesCount ( )

◆ GetSelectedEntity()

proto external IEntitySource WorldEditorAPI.GetSelectedEntity ( int n = 0)

◆ GetSubsceneFolders()

proto external void WorldEditorAPI.GetSubsceneFolders ( int subscene,
out notnull array< string > outItemPaths )

◆ GetSubsceneLayerId()

proto external int WorldEditorAPI.GetSubsceneLayerId ( int subscene,
string layerPath )

◆ GetSubsceneLayerPath()

proto external string WorldEditorAPI.GetSubsceneLayerPath ( int subscene,
int layerId )

◆ GetTerrainSurfaceY()

proto external float WorldEditorAPI.GetTerrainSurfaceY ( float x,
float z )

Returns terrain height (world space) in given point x,z (world space). Very fast method.

◆ GetWorld()

proto external BaseWorld WorldEditorAPI.GetWorld ( )

◆ IsCreatingEntityInWindow()

proto external bool WorldEditorAPI.IsCreatingEntityInWindow ( )

Check whether user created an entity in editor window. Eg. drag and drop from hierarchy, etc.

◆ IsDoingEditAction()

proto external bool WorldEditorAPI.IsDoingEditAction ( )

◆ IsEditSequenceActive()

proto external bool WorldEditorAPI.IsEditSequenceActive ( IEntitySource entSrc)

Check whether we are between BeginEditSequence() and EndEditSequence().

◆ IsEntityLayerVisible()

proto external bool WorldEditorAPI.IsEntityLayerVisible ( int subscene,
int layerId )

◆ IsModifyingData()

proto external bool WorldEditorAPI.IsModifyingData ( )

◆ IsPrefabEditMode()

proto external bool WorldEditorAPI.IsPrefabEditMode ( )

Check whether editor is running in a prefab edit mode where all edit actions should apply their changes directly to a prefab instead of entity instance.

◆ IsSubsceneLayerVisible()

proto external bool WorldEditorAPI.IsSubsceneLayerVisible ( int subscene,
string layerPath )

◆ ModifyHeightMap()

proto external void WorldEditorAPI.ModifyHeightMap ( float xWorldPos,
float zWorldPos,
FilterMorphOperation operation,
notnull TerrainToolDesc toolDesc,
FilterMorphShape shape,
FilterMorphLerpFunc interpFunc )

Modifies the terrain height at specified position based on given brush.

Parameters
xWorldPosX coordinate of the modification position.
zWorldPosZ coordinate of the modification position.
operationOperation to perform on the terrain.
toolDescParameters of the operation.
shapeShape of the brush.
interpFuncInterpolation function used when creating the brush.

◆ ModifyHeightMapUserShape()

proto external void WorldEditorAPI.ModifyHeightMapUserShape ( float xWorldPos,
float zWorldPos,
FilterMorphOperation operation,
notnull TerrainToolDesc toolDesc,
array< float > userShape,
UserShapeFilter userShapeFilter )

Modifies the terrain height at specified position based on given map.

Parameters
xWorldPosX coordinate of the modification position.
zWorldPosZ coordinate of the modification position.
operationOperation to perform on the terrain.
toolDescParameters of the operation.
userShapeNxN array describing the modification brush. Values from 0.0 to 1.0 describing no to maximum strength.
userShapeFilterFiltering to use when the tool size is not the same as the userShape array dimension.

◆ ModifyLayers()

proto external void WorldEditorAPI.ModifyLayers ( float xWorldPos,
float zWorldPos,
FilterMorphOperation operation,
notnull TerrainToolDesc toolDesc,
FilterMorphShape shape,
FilterMorphLerpFunc interpFunc )

Modifies the terrain layers at specified position based on given brush.

Parameters
xWorldPosX coordinate of the modification position.
zWorldPosZ coordinate of the modification position.
operationOperation to perform on the terrain.
toolDescParameters of the operation.
shapeShape of the brush.
interpFuncInterpolation function used when creating the brush.

◆ ModifyLayersUserShape()

proto external void WorldEditorAPI.ModifyLayersUserShape ( float xWorldPos,
float zWorldPos,
FilterMorphOperation operation,
notnull TerrainToolDesc toolDesc,
array< float > userShape,
UserShapeFilter userShapeFilter )

Modifies the terrain height at specified position based on given map.

Parameters
xWorldPosX coordinate of the modification position.
zWorldPosZ coordinate of the modification position.
operationOperation to perform on the terrain.
toolDescParameters of the operation.
userShapeNxN array describing the modification brush. Values from 0.0 to 1.0 describing no to maximum strength.
userShapeFilterFiltering to use when the tool size is not the same as the userShape array dimension.

◆ MoveEntitiesToPrefab()

proto external bool WorldEditorAPI.MoveEntitiesToPrefab ( IEntitySource newParentInMap,
IEntitySource newParentInPrefab,
notnull array< IEntitySource > entitiesInMap )

Moves existing entity instances from map into a prefab.

Parameters
newParentInMapIt's any entity of the prefab instance that exists in map (can be any child or sub-child). This it's only an optional parameter which ensures that transformations of the entitiesInMap after move to the prefab will be relative to the entity that exists in map. If this parameter is null then world transformations of the entitiesInMap will be stored into a prefab
newParentInPrefabIt's a further parent entity in the prefab. It can be root or any sub-child entity stored in a prefab.
entitiesInMapAny entity instances that currently exist in a map. These entities will be deleted from map and added into a prefab as children of newParentInPrefab.

◆ ParentEntity()

proto external bool WorldEditorAPI.ParentEntity ( notnull IEntitySource parent,
notnull IEntitySource child,
bool transformChildToParentSpace )

◆ RemoveEntityFromParent()

proto external bool WorldEditorAPI.RemoveEntityFromParent ( notnull IEntitySource child)

◆ RemoveFromEntitySelection()

proto external void WorldEditorAPI.RemoveFromEntitySelection ( notnull IEntitySource ent)

◆ RemoveObjectArrayVariableMember()

proto external bool WorldEditorAPI.RemoveObjectArrayVariableMember ( notnull BaseContainer topLevel,
array< ref ContainerIdPathEntry > containerIdPath,
string key,
int memberIndex )

Removes an element from array of objects of property key in container.

Parameters
topLevelContainer from which the search is started
containerIdPathPath to the variable we want to set
keyHow is the array of object property in container called
memberIndexWhich element to remove
Returns
true if successful, false otherwise.

◆ RemovePrefabMembers()

proto external bool WorldEditorAPI.RemovePrefabMembers ( notnull array< IEntitySource > members)

◆ RenameEntity()

proto external bool WorldEditorAPI.RenameEntity ( notnull IEntitySource ent,
string newName )

◆ RenameSubsceneFolder()

proto external bool WorldEditorAPI.RenameSubsceneFolder ( int subScene,
string itemPath,
string newItemName )

◆ SaveEntityTemplate()

proto external bool WorldEditorAPI.SaveEntityTemplate ( IEntitySource tmpl)

◆ SetActiveSubsceneLayer()

proto external void WorldEditorAPI.SetActiveSubsceneLayer ( int subScene,
string layerPath )

◆ SetEntitySubsceneLayer()

proto external bool WorldEditorAPI.SetEntitySubsceneLayer ( int subScene,
IEntitySource pEntitySource,
string itemPath )

◆ SetPropertySelection()

proto external void WorldEditorAPI.SetPropertySelection ( string id)

◆ SetSubsceneFolderParent()

proto external bool WorldEditorAPI.SetSubsceneFolderParent ( int subScene,
string itemPath,
string parentPath )

◆ SetVariableValue()

proto external bool WorldEditorAPI.SetVariableValue ( notnull BaseContainer topLevel,
array< ref ContainerIdPathEntry > containerIdPath,
string key,
string value )

Returns terrain height (world space) for given tile.

Data are in final form - with applied roads and other modifiers. Very fast method. Output array will be resized by this method and size will be: (GetTerrainSizeX(terrainIndex) / GetTerrainTilesX(terrainIndex)) * (GetTerrainSizeY(terrainIndex) / GetTerrainTilesY(terrainIndex))

auto api = we.GetApi();
array<float> heightMap = {};
api.BeginTerrainAction(TerrainToolType.HEIGHT_EXACT);
if (api.GetTerrainSurfaceTile(0, 1, 8, heightMap))
{
for (int i = 0; i < heightMap.Count(); i++)
heightMap[i] = heightMap[i] + Math.RandomFloat(-0.3, 0.3);
api.SetTerrainSurfaceTile(0, 1, 8, heightMap);
}
api.EndTerrainAction();
/endcode
/
proto external bool GetTerrainSurfaceTile(int terrainIndex, int tileX, int tileY, out notnull array<float> surfaceY);
proto external bool SetTerrainSurfaceTile(int terrainIndex, int tileX, int tileY, notnull array<float> surfaceY);
* Returns terrain X resolution of height map.
proto external int GetTerrainResolutionX(int terrainIndex = 0);
* Returns terrain Y resolution of height map.
proto external int GetTerrainResolutionY(int terrainIndex = 0);
* Returns terrain number of tiles.
proto external int GetTerrainTilesX(int terrainIndex = 0);
* Returns terrain number of tiles.
proto external int GetTerrainTilesY(int terrainIndex = 0);
* Returns terrain Planar resolution (meters).
proto external float GetTerrainUnitScale(int terrainIndex = 0);
* Adds entity to list of terrain flatters and updates heightmap
proto external void RemoveTerrainFlatterEntity(IEntity entity, bool bUpdateTerrain = true);
//--------------------------------- Rivers ----------------------------------
proto external void RegenerateFlowMaps(bool preview = true, bool save = true, bool asyncReturn = true, bool noWarning = false);
//--------------------------------- Shore -----------------------------------
proto external void BuildShoreMap();
* Returns true, if entity is hidden by functions HIDE/UNHIDE or is hidden because of hidden layer etc.
proto external bool IsEntityVisible(IEntitySource entity);
proto external void SetEntityVisible(IEntitySource entity, bool isVisible, bool recursive);
* Whether entity is selected (any member of multi-selection)
proto external bool IsEntitySelected(IEntitySource entity);
* Whether entity is selected and it's a main member of multi-selection
proto external bool IsEntitySelectedAsMain(IEntitySource entity);
proto external bool IsEditMode();
proto external bool IsGameMode();
* Set world editor perspective view camera position and look direction.
proto external void SetCamera(vector pos, vector lookVec);
proto external void AddTerrainFlatterEntity(IEntity entity, vector mins, vector maxs, int iPriority, float fFalloffStart, float fFalloff, bool bForceUpdate = true, array<vector> updateMins = null, array<vector> updateMaxes = null);
* Fills `y` with GetTerrainSurfaceY() and returns true if on x, z position is terrain, returns false otherwise.
proto external bool TryGetTerrainSurfaceY(float x, float z, out float y);
proto external void AddToEntitySelection(notnull IEntitySource ent);
proto external void SetEntitySelection(notnull IEntitySource ent);
[Obsolete("Use SetVariableValue instead!")]
proto external bool ModifyEntityKey(notnull IEntitySource ent, string key, string value);
[Obsolete("Use SetVariableValue instead!")]
proto external bool ModifyComponentKey(notnull IEntitySource ent, string componentName, string key, string value);
proto external IEntitySource CreateEntity(string className, string name, int layerId, IEntitySource parent, vector coords, vector angles);
* Extended version of base method that will use randomization/placement parameters set in Template Library (if any).
proto external IEntitySource CreateEntityExt(string className, string name, int layerId, IEntitySource parent, vector coords, vector angles, int traceFlags);
proto external IEntitySource CreateClonedEntity(notnull IEntitySource ent, string name, IEntitySource parent, bool cloneChildren);
proto external IEntitySource CreateEntityInWindow(RenderTargetWidget window, int winX, int winY, string className, string name, int layerID);
proto external IEntitySource CreateEntityInWindowEx(int windowType, int winX, int winY, string className, string name, int layerID);
* Parent childs to parent and resolve previous parent->child dependencies
proto external bool ParentEntities(notnull IEntitySource parent, notnull array<IEntitySource> childs, bool transformChildToParentSpace);
proto external bool DeleteEntity(notnull IEntitySource ent);
proto external bool DeleteEntities(notnull array<IEntitySource> ents);
* Trace inside WorldEditor window, x and y coords are window coordinates.
proto external bool TraceWorldPos(int x, int y, TraceFlags traceFlags, out vector traceStart, out vector traceEnd, out vector traceDir, out IEntity hitEntity = null);
proto external void GetWorldPath(out string path);
proto external string GetEntityNiceName(IEntitySource entSrc);
* Generates unique name for a particular entity which is based on class/prefab name and numerical postfix
proto external string GenerateDefaultEntityName(IEntitySource entSrc);
TerrainToolType
Definition TerrainToolType.c:13
Definition ShoreTool.c:3
Definition IEntitySource.c:13
Definition IEntity.c:13
Definition Math.c:13
static proto float RandomFloat(float min, float max)
Returns a random float number between min [inclusive] and max [exclusive].
Definition Workbench.c:15
static proto WBModuleDef GetModule(TypeName type)
Definition WorldEditor.c:15
proto external WorldEditorAPI GetApi()
Definition Types.c:154
proto native int Count()
O(1) complexity.
Associative array template.
Definition Types.c:485

To set a name of the second shape point to "secondPoint" we do:

auto containerPath = new array<ref ContainerIdPathEntry>();
auto entry1 = new ContainerIdPathEntry("Points", 0); // Take the first point
containerPath.Insert(entry1);
auto entry2 = new ContainerIdPathEntry("Metadata"); // Go to metadata of the first point
containerPath.Insert(entry2);
m_API.SetVariableValue(topLevelShapeContainer, containerPath, "Name", "firstPoint"); // Set Name to given value
Definition worldEditor.c:26
Parameters
topLevelContainer from which the search is started.
containerIdPathPath to the variable we want to set.
keyThe actual variable to set.
valueValue which will be set to variable.
Returns
true if successful, false otherwise.

◆ ShowItemListDialog()

proto external int WorldEditorAPI.ShowItemListDialog ( string title,
string message,
int width,
int height,
notnull array< string > items,
notnull out array< int > selectedItems,
int currentItem )

Shows a selection dialog with provided items where user can select one or multiple items.

Parameters
titleTitle of the dialog window.
messageMessage shown in the dialog window.
widthWidth of the dialog window.
heightHeight of the dialog window.
itemsList of items that will be shown in the dialog MenuBase.
selectedItemsList of indices that will be filled up after selection in the dialog corresponding to selected items.
currentItemItem selected by default.

◆ SourceToEntity()

proto external IEntity WorldEditorAPI.SourceToEntity ( IEntitySource entSrc)

◆ ToggleGeneratorEvents()

proto external void WorldEditorAPI.ToggleGeneratorEvents ( bool isEnabled)

Enable/disable calling of events on generators. Must be enabled for the VectorTool and generators to work properly.

◆ UndoOrRedoIsRestoring()

proto external bool WorldEditorAPI.UndoOrRedoIsRestoring ( )

Check whether editor is restoring undo or redo state.

◆ UpdateSelectionGui()

proto external void WorldEditorAPI.UpdateSelectionGui ( )

The documentation for this interface was generated from the following file: