Enfusion Script API
|
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 | GetEntityLayerId (int subscene, string name) |
proto external int | GetCurrentEntityLayerId () |
proto external void | SetCurrentEntityLayerId (int subscene, int layerID) |
proto external bool | IsEntityLayerVisible (int subscene, int layerID) |
proto external void | DeleteEntityLayer (int subscene, int layerID) |
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 bool WorldEditorAPI.AddPrefabMembers | ( | IEntitySource | prefabMember, |
notnull array< IEntitySource > | members | ||
) |
Puts new (nowhere used) entity source instances as children of an entity in prefab.
proto external bool WorldEditorAPI.AreGeneratorEventsEnabled | ( | ) |
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.
proto external bool WorldEditorAPI.BeginEntityAction | ( | string | historyPointName = string.Empty , |
string | historyPointIcon = string.Empty |
||
) |
Beginning of logical edit action.
proto external bool WorldEditorAPI.BeginTerrainAction | ( | TerrainToolType | toolType, |
string | historyPointName = string.Empty , |
||
string | historyPointIcon = string.Empty |
||
) |
proto external void WorldEditorAPI.ClearEntitySelection | ( | ) |
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.
topLevel | Container from which the search is started. |
containerIdPath | Path to the variable we want to clear. |
key | The actual variable to clear. |
true
if successful, false
otherwise. proto external IEntityComponentSource WorldEditorAPI.CreateComponent | ( | IEntitySource | owner, |
string | className | ||
) |
proto external bool WorldEditorAPI.CreateEntityTemplate | ( | IEntitySource | entitySrc, |
string | templateFileAbs | ||
) |
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
.
topLevel | Container from which the search is started |
containerIdPath | Path to the variable we want to set |
key | How is the array of object property in container called |
baseClassName | What type of object should be created to the array |
memberIndex | At which index should be the new element inserted |
true
if successful, false
otherwise. proto external bool WorldEditorAPI.CreateObjectVariableMember | ( | notnull BaseContainer | topLevel, |
array< ref ContainerIdPathEntry > | containerIdPath, | ||
string | key, | ||
string | baseClassName | ||
) |
Creates a new container in object property.
topLevel | Container from which the search is started |
containerIdPath | Path to the variable we want to set |
key | How is the object property in container called |
baseClassName | What type of object should be created to the property |
true
if successful, false
otherwise. proto external bool WorldEditorAPI.DeleteComponent | ( | IEntitySource | owner, |
IEntityComponentSource | component | ||
) |
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.
proto external bool WorldEditorAPI.EndEntityAction | ( | string | historyPointName = string.Empty | ) |
Ending of edit action.
proto external void WorldEditorAPI.EndTerrainAction | ( | string | historyPointName = string.Empty | ) |
proto external IEntitySource WorldEditorAPI.EntityToSource | ( | IEntity | ent | ) |
proto external IEntitySource WorldEditorAPI.FindEntityByID | ( | EntityID | id | ) |
proto external IEntitySource WorldEditorAPI.FindEntityByName | ( | string | name | ) |
proto external int WorldEditorAPI.GetCurrentEntityLayerId | ( | ) |
proto external int WorldEditorAPI.GetCurrentSubScene | ( | ) |
proto external string WorldEditorAPI.GetCurrentToolName | ( | ) |
proto external IEntitySource WorldEditorAPI.GetEditorEntity | ( | int | index | ) |
Returns an entity in the editor on given index. To obtain count, use GetEditorEntityCount().
proto external int WorldEditorAPI.GetEditorEntityCount | ( | ) |
Returns the number of entities in the editor.
proto external IEntitySource WorldEditorAPI.GetEntityUnderCursor | ( | ) |
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).
clamped | Whether returned values should be clamped in a range between zero and screen width (window width in fact). |
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).
clamped | Whether returned values should be clamped in a range between zero and screen height (window height in fact). |
proto external int WorldEditorAPI.GetNumSubScenes | ( | ) |
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).
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).
proto external int WorldEditorAPI.GetSelectedEntitiesCount | ( | ) |
proto external IEntitySource WorldEditorAPI.GetSelectedEntity | ( | int | n = 0 | ) |
Returns terrain height (world space) in given point x,z (world space). Very fast method.
proto external BaseWorld WorldEditorAPI.GetWorld | ( | ) |
proto external bool WorldEditorAPI.IsCreatingEntityInWindow | ( | ) |
Check whether user created an entity in editor window. Eg. drag and drop from hierarchy, etc.
proto external bool WorldEditorAPI.IsDoingEditAction | ( | ) |
proto external bool WorldEditorAPI.IsEditSequenceActive | ( | IEntitySource | entSrc | ) |
Check whether we are between BeginEditSequence() and EndEditSequence().
proto external bool WorldEditorAPI.IsModifyingData | ( | ) |
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.
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.
xWorldPos | X coordinate of the modification position. |
zWorldPos | Z coordinate of the modification position. |
operation | Operation to perform on the terrain. |
toolDesc | Parameters of the operation. |
shape | Shape of the brush. |
interpFunc | Interpolation function used when creating the brush. |
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.
xWorldPos | X coordinate of the modification position. |
zWorldPos | Z coordinate of the modification position. |
operation | Operation to perform on the terrain. |
toolDesc | Parameters of the operation. |
userShape | NxN array describing the modification brush. Values from 0.0 to 1.0 describing no to maximum strength. |
userShapeFilter | Filtering to use when the tool size is not the same as the userShape array dimension. |
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.
xWorldPos | X coordinate of the modification position. |
zWorldPos | Z coordinate of the modification position. |
operation | Operation to perform on the terrain. |
toolDesc | Parameters of the operation. |
shape | Shape of the brush. |
interpFunc | Interpolation function used when creating the brush. |
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.
xWorldPos | X coordinate of the modification position. |
zWorldPos | Z coordinate of the modification position. |
operation | Operation to perform on the terrain. |
toolDesc | Parameters of the operation. |
userShape | NxN array describing the modification brush. Values from 0.0 to 1.0 describing no to maximum strength. |
userShapeFilter | Filtering to use when the tool size is not the same as the userShape array dimension. |
proto external bool WorldEditorAPI.MoveEntitiesToPrefab | ( | IEntitySource | newParentInMap, |
IEntitySource | newParentInPrefab, | ||
notnull array< IEntitySource > | entitiesInMap | ||
) |
Moves existing entity instances from map into a prefab.
newParentInMap | It'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 |
newParentInPrefab | It's a further parent entity in the prefab. It can be root or any sub-child entity stored in a prefab. |
entitiesInMap | Any entity instancies that currently exist in a map. These entities will be deleted from map and added into a prefab as children of newParentInPrefab. |
proto external bool WorldEditorAPI.ParentEntity | ( | notnull IEntitySource | parent, |
notnull IEntitySource | child, | ||
bool | transformChildToParentSpace | ||
) |
proto external bool WorldEditorAPI.RemoveEntityFromParent | ( | notnull IEntitySource | child | ) |
proto external void WorldEditorAPI.RemoveFromEntitySelection | ( | notnull IEntitySource | ent | ) |
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
.
topLevel | Container from which the search is started |
containerIdPath | Path to the variable we want to set |
key | How is the array of object property in container called |
memberIndex | Which element to remove |
true
if successful, false
otherwise. proto external bool WorldEditorAPI.RemovePrefabMembers | ( | notnull array< IEntitySource > | members | ) |
proto external bool WorldEditorAPI.RenameEntity | ( | notnull IEntitySource | ent, |
string | newName | ||
) |
proto external bool WorldEditorAPI.SaveEntityTemplate | ( | IEntitySource | tmpl | ) |
proto external void WorldEditorAPI.SetPropertySelection | ( | string | id | ) |
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))
To set a name of the second shape point to "secondPoint" we do:
topLevel | Container from which the search is started. |
containerIdPath | Path to the variable we want to set. |
key | The actual variable to set. |
value | Value which will be set to variable. |
true
if successful, false
otherwise. 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.
title | Title of the dialog window. |
message | Message shown in the dialog window. |
width | Width of the dialog window. |
height | Height of the dialog window. |
items | List of items that will be shown in the dialog MenuBase. |
selectedItems | List of indices that will be filled up after selection in the dialog corresponding to selected items. |
currentItem | Item selected by default. |
proto external IEntity WorldEditorAPI.SourceToEntity | ( | IEntitySource | entSrc | ) |
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.
proto external bool WorldEditorAPI.UndoOrRedoIsRestoring | ( | ) |
Check whether editor is restoring undo or redo state.
proto external void WorldEditorAPI.UpdateSelectionGui | ( | ) |