|
Enfusion Script API
|
Component for handling world subscene attached to entity for light portals, interior audio, visibility, etc. More...
Public Member Functions | |
| proto external int | GetPortalCount () |
| Returns portal count of the subscene or 0. | |
| proto external string | GetPortalName () |
| Returns the name of the portal or an empty string if the index is out of bounds or the portal doesn't have a name. | |
| proto external int | FindPortalByOBB (vector mins, vector maxs, vector worldTransform[4]) |
| Spatial based lookup for portals using oriented bounding box, there are no guarantees which portal gets returned when the area of interest covers multiple portals. | |
| proto external int | FindPortalByName (string name) |
| Name based portal lookup. | |
| proto void | RegisterApertureByOBB (vector mins, vector maxs, vector worldTransform[4], out int portalIdx, out int apertureIdx) |
| Spatial based aperture registration for portals using oriented bounding box, there are no guarantees which portal gets returned when the area of interest covers multiple portals. | |
| proto external int | RegisterApertureByPortalId (int portalIdx) |
| Registers aperture for a specified portal by its index (see FindPortalByName() on how to obtain such an index). | |
| proto external void | SetPortalOpening (int portalIdx, int apertureIdx, float value) |
| Sets how open/closed the portal is using values from range [0, 1]: 0 - fully closed, 1 - fully open. | |
| proto external float | GetPortalOpening (int portalIdx) |
| Gets how open/closed the portal (aggregate value for all apertures) is using values from range [0, 1] 0 - fully closed, 1 - fully open. | |
| proto external void | SetPortalIntensity (int portalIdx, float value) |
| Set the portal intensity in range [0, 1] (default = 1) for fine-grained control over the visual output. | |
| proto external float | GetPortalIntensity (int portalIdx) |
| Get the portal intensity in range [0, 1] (default = 1) for fine-grained control over the visual output. | |
| proto external bool | IsPortalEnabled (int portalIdx) |
| Returns whether the specified portal is enabled or disabled. | |
| proto external void | SetPortalEnabled (int portalIdx, bool value) |
| Sets/clears the portal enabled/disabled state - disabled portals are ignored during subscene traversal. | |
| proto external bool | IsPortalBlockingSound (int portalIdx) |
| Returns the state of the sound blocking portal flag (B), by default this setting comes from a portal material. | |
| proto external void | SetPortalBlockingSound (int portalIdx, bool value) |
| Sets/clears the state of the sound blocking portal flag (B) overriding any material settings - when set the portal blocks sound (e.g., window unless broken). | |
| proto external bool | IsPortalPassingSound (int portalIdx) |
| Returns the state of the sound passing portal flag (S). | |
| proto external void | SetPortalPassingSound (int portalIdx, bool value) |
| Sets/clears the state of the sound passing portal flag (S) potentially overriding any material settings w.r.t. | |
Public Member Functions inherited from GenericComponent | |
| proto external EntityComponentPrefabData | GetComponentData (notnull IEntity ent) |
| Gets GenericComponentClass descendant instance with the prefab data. | |
| proto external BaseContainer | GetComponentSource (notnull IEntity ent) |
| Gets config container with the prefab data. | |
| proto external int | GetEventMask () |
| Gets current eventmask of the component. | |
| proto external int | SetEventMask (notnull IEntity owner, int mask) |
| Sets eventmask. | |
| proto external int | ClearEventMask (notnull IEntity owner, int mask) |
| Clears bitmask. | |
| proto external GenericComponent | FindComponent (TypeName typeName) |
| Finds first occurance of the coresponding component. | |
| proto external int | FindComponents (TypeName typeName, notnull array< GenericComponent > outComponents) |
| Finds all occurances of the coresponding component. | |
| proto external void | Activate (IEntity owner) |
| Activate component and calls EOnActivate(). | |
| proto external void | Deactivate (IEntity owner) |
| Deactivate component and calls EOnDectivate(). | |
| proto external bool | IsActive () |
| Returns activity state. | |
| proto external void | OnTransformReset (bool isCorrection=false, vector newVelocity=vector.Zero) |
| Notifies the component that a transformation of the owner entity has been discontinuously changed. | |
| void | _WB_SetTransform (IEntity owner, inout vector mat[4], IEntitySource src) |
| Editor changed entity transformation matrix source. Do not call editor API here! | |
| void | _WB_OnInit (IEntity owner, inout vector mat[4], IEntitySource src) |
| Called always after entity creation. It's purpose is to prepare entity for editing. Do not edit anything through editor API here because it's too early for undoable actions! Use plain BaseContainer API for changes through src parameter if needed! | |
| bool | _WB_CanDelete (IEntity owner, IEntitySource src) |
| Editor needs to know if this entity can be deleted. Do not call editor API here! | |
| bool | _WB_CanRename (IEntity owner, IEntitySource src) |
| Editor needs to know if this entity can be renamed. Do not call editor API here! | |
| bool | _WB_CanCopy (IEntity owner, IEntitySource src) |
| Editor needs to know if this entity can be copied. Do not call editor API here! | |
| bool | _WB_CanSelect (IEntity owner, IEntitySource src) |
| Editor needs to know whether this entity can be selected in scene window or not. | |
| void | _WB_GetBoundBox (IEntity owner, inout vector min, inout vector max, IEntitySource src) |
| Editor needs to know a bound box of entity (For ray-casting, visualizers etc.). You can return any custom size you need. Do not call editor API here! | |
| void | _WB_SetExtraVisualiser (IEntity owner, EntityVisualizerType type, IEntitySource src) |
| If entity needs to have a special visualizer instead of default one, here is the place where you can implement it. Do not call editor API here! | |
| array< ref WB_UIMenuItem > | _WB_GetContextMenuItems (IEntity owner) |
| An opportunity to append items into editor's "Component" context menu. Do not call editor API here! | |
| bool | _WB_OnPhysSimulPlacementBegin (IEntity owner, IEntitySource src) |
| Does this entity support editing transformation using physics simulation? Do not call editor API here! | |
| bool | _WB_EnablePhysics (IEntity owner, IEntitySource src, bool physics) |
| Prepare to edit transformation using physics simulation. Return previous status. Do not call editor API here! | |
| bool | _WB_OnKeyChanged (IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent) |
| Any property value has been changed. You can use editor API here and do some additional edit actions which will be part of the same "key changed" action. | |
| bool | _WB_GetKeySpaceMatrixWorld (IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent, out vector transformSpaceWorld[4]) |
| Some "coords" or "angles" vector property is being to be edited. Entity can provide a world matrix which represents their local space and which is needed by editor to edit the key by a gizmo. | |
| void | _WB_AfterWorldUpdate (IEntity owner, float timeSlice) |
| Called after updating world in Workbench. The entity must be selected. You can use editor API here and do some edit actions if needed. | |
| int | _WB_GetAfterWorldUpdateSpecs (IEntity owner, IEntitySource src) |
| Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to be called and when. Return value can be either 0 (event will not be called at all) or any combination of EEntityFrameUpdateSpecs. Avoid CALL_ALWAYS flag whenever possible to prevent performance issues. | |
| void | _WB_OnContextMenu (IEntity owner, int id) |
| User has chosen any of your menu item from editor's "Component" menu which you have recently provided in WB_GetContextMenuItems(). You can use editor API here and do some edit actions. | |
| void | _WB_OnKeyDown (IEntity owner, int keyCode) |
| User pressed a key and this entity is main member of entity selection. You can use editor API here and do some edit actions which will be undoable. | |
| void | _WB_OnCreate (IEntity owner, IEntitySource src) |
| Called after entity gets created in map during editing or when deleted entity gets restored after undo action. This event isn't called by loading map!!! If you need an event that is being called after every entity creation then use WB_OnInit instead it. You can use editor API here and do some additional edit actions which will be part of the same "create entity" action. | |
| void | _WB_OnParentChange (IEntity owner, IEntitySource src, IEntitySource prevParentSrc) |
| Parent entity has been changed ( it's available through src->GetParent() ). prevParentSrc is a pointer to a previous parent (if any) | |
| void | _WB_OnDelete (IEntity owner, IEntitySource src) |
| Entity is going to be deleted. You can use editor API here and do some additional edit actions which will be part of the same "entity delete" action. | |
| void | _WB_OnRename (IEntity owner, IEntitySource src, string oldName) |
| Entity has been renamed. You can use editor API here and do some additional edit actions which will be part of the same "entity rename" action. | |
| array< ref ParamEnum > | _WB_GetUserEnums (string varName, IEntity owner, IEntityComponentSource src) |
| Possibility to get variable value choices dynamically. | |
Additional Inherited Members | |
Static Public Member Functions inherited from GenericComponent | |
| static bool | Preload (IEntityComponentSource src) |
Protected Member Functions inherited from GenericComponent | |
| proto void | Rpc (func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL) |
| Attempts to run a remote procedure call (RPC) of this instance with parameters specified in method RplRpc attribute. | |
| proto external void | ConnectToDiagSystem (IEntity owner) |
| proto external void | DisconnectFromDiagSystem (IEntity owner) |
| void | OnTransformResetImpl (TransformResetParams params) |
| Script-side implementation of OnTransformReset. | |
Component for handling world subscene attached to entity for light portals, interior audio, visibility, etc.
Name based portal lookup.
Use with caution, involves linear search, i.e., not meant for runtime routine searches for portal indices. Returns a first occurrence of a portal with the given name, i.e., when two portals have the same name, the second one won't ever be hit.
| name | Name of the portal to find |
| proto external int WorldSubsceneComponent.FindPortalByOBB | ( | vector | mins, |
| vector | maxs, | ||
| vector | worldTransform[4] ) |
Spatial based lookup for portals using oriented bounding box, there are no guarantees which portal gets returned when the area of interest covers multiple portals.
| mins | Minimum of the local space oriented bounding box |
| maxs | Maximum of the local space oriented bounding box |
| worldTransform | World transformation matrix for the bounding box |
| proto external int WorldSubsceneComponent.GetPortalCount | ( | ) |
Returns portal count of the subscene or 0.
Get the portal intensity in range [0, 1] (default = 1) for fine-grained control over the visual output.
| portalIdx | Index of the target portal |
| proto external string WorldSubsceneComponent.GetPortalName | ( | ) |
Returns the name of the portal or an empty string if the index is out of bounds or the portal doesn't have a name.
Gets how open/closed the portal (aggregate value for all apertures) is using values from range [0, 1] 0 - fully closed, 1 - fully open.
| portalIdx | Index of the target portal |
Returns the state of the sound blocking portal flag (B), by default this setting comes from a portal material.
When true the portal blocks sound (e.g., window unless broken). It is mutually exclusive with the portal sound passing flag (S), see further.
| portalIdx | Index of the target portal |
Returns whether the specified portal is enabled or disabled.
Disabled portals are ignored during subscene traversal.
| portalIdx | Index of the target portal |
Returns the state of the sound passing portal flag (S).
When set the portal passes sound even if the opening value is 0 (e.g., closed door with broken glass inset). It is mutually exclusive with the sound blocking flag (B) see above.
| portalIdx | Index of the target portal |
| proto void WorldSubsceneComponent.RegisterApertureByOBB | ( | vector | mins, |
| vector | maxs, | ||
| vector | worldTransform[4], | ||
| out int | portalIdx, | ||
| out int | apertureIdx ) |
Spatial based aperture registration for portals using oriented bounding box, there are no guarantees which portal gets returned when the area of interest covers multiple portals.
Returned aperture index starts at 0 and for subsequent calls for the same portal the index is increased by 1. The aperture index is then used to identify who is trying to affect the portal, e.g., situation where the portal is controlled by two separate door components. Up to 4 independent apertures per single portal are supported.
| mins | Minimum of the local space oriented bounding box | |
| maxs | Maximum of the local space oriented bounding box | |
| worldTransform | World transformation matrix for the bounding box | |
| [out] | portalIdx | The index of a portal if one was found or 0xFFFF |
| [out] | apertureIdx | Unique aperture index for each portal or 0xFF when no portal was found |
Registers aperture for a specified portal by its index (see FindPortalByName() on how to obtain such an index).
Aperture index starts at 0 and for subsequent calls for the same portal the index is increased by 1. The aperture index is then used to identify who is trying to affect the portal, e.g., situation where the portal is controlled by two separate door components. Up to 4 independent apertures per single portal are supported.
| portalIdx | The index of a portal to register aperture to |
Sets/clears the state of the sound blocking portal flag (B) overriding any material settings - when set the portal blocks sound (e.g., window unless broken).
It is mutually exclusive with the portal sound passing flag (S), see further, so when blocking sound is enabled the pass sound flag (S) is cleared.
| portalIdx | Index of the target portal |
| value | Intended portal sound blocking flag (B) state: true = blocking sound, false = not set (driven by aperture) |
Sets/clears the portal enabled/disabled state - disabled portals are ignored during subscene traversal.
| portalIdx | Index of the target portal |
| value | Intended portal state: true = enabled, false = disabled |
Set the portal intensity in range [0, 1] (default = 1) for fine-grained control over the visual output.
| portalIdx | Index of the target portal |
| value | Intensity value from range [0, 1] |
| proto external void WorldSubsceneComponent.SetPortalOpening | ( | int | portalIdx, |
| int | apertureIdx, | ||
| float | value ) |
Sets how open/closed the portal is using values from range [0, 1]: 0 - fully closed, 1 - fully open.
| portalIdx | Index of the target portal |
| apertureIdx | Which registered aperture triggered the action |
| value | Value from [0, 1] setting the opening of the portal for the selected aperture |
Sets/clears the state of the sound passing portal flag (S) potentially overriding any material settings w.r.t.
the sound blocking flag (B) which can be set from the material - because these two flags are mutually exclusive, setting the sound passing flag (S) clears the sound blocking flag (B), see SetPortalBlockingSound(). When set the portal passes sound even if the opening value is 0 (e.g., closed door with broken glass inset).
When clearing this flag the sound blocking flag (B) is restored if it was set originally in the material
| portalIdx | Index of the target portal |
| value | Intended portal sound passing flag (S) state: true = passing sound even if closed, false = not set (driven by aperture) |