7 [
Attribute(defvalue:
"1",
category:
"Composition",
desc:
"When enabled, children will be snapped and oriented to terrain when the composition is transformed.")]
10 [
Attribute(defvalue:
"1",
category:
"Composition",
desc:
"When enabled, children will not be turned into editable entities. The composition will appear as a single entity in in-game editor.")]
36 componentSource.Get(
"m_SlotPrefab", slotPrefab);
118 transform[3] = transform[3] +
Vector(0, height, 0);
121 SCR_HorizontalAlignComponent horizontalAlignComponent = SCR_HorizontalAlignComponent.Cast(owner.
FindComponent(SCR_HorizontalAlignComponent));
122 if (horizontalAlignComponent)
136 vector pos = transform[3];
139 vector parentTransform[3];
141 Math3D.MatrixInvMultiply3(parentTransform, transform, transform);
146 api.SetVariableValue(ownerSrc, null,
"coords", pos.ToString(
false));
147 api.SetVariableValue(ownerSrc, null,
"angles",
string.Format(
"%1 %2 %3",
angles[1],
angles[0],
angles[2]));
214 hierarchySource.Set(
"Enabled",
true);
221 SCR_SlotCompositionHelperEntity.CreateHierarchy(api, entitySource);
223 api.CreateComponent(entitySource,
"Hierarchy");
227 for (
int i = 0, count = entitySource.GetNumChildren(); i < count; i++)
229 isChange |= _WB_ConfigureComposition(api, entitySource.GetChild(i),
false);
239 new WB_UIMenuItem(
"Configure composition", 0),
240 new WB_UIMenuItem(
"Orient to terrain", 1)
247 WorldEditorAPI api = GenericEntity.Cast(owner)._WB_GetEditorAPI();
253 IEntitySource entitySource = api.EntityToSource(owner);
254 if (!entitySource)
break;
257 entitySource = entitySource.GetAncestor();
258 if (!entitySource)
break;
261 api.BeginEntityAction();
262 _WB_ConfigureComposition(api, entitySource,
true,
true);
263 api.EndEntityAction();
266 api.BeginEntityAction();
268 api.EndEntityAction();
277class SCR_SlotCompositionHelperEntityClass : GenericEntityClass {}
280 protected IEntitySource m_EntitySource;
286 static void CreateHierarchy(WorldEditorAPI api, IEntitySource entitySource)
288 IEntitySource src = api.CreateEntity(
"SCR_SlotCompositionHelperEntity",
"SCR_SlotCompositionHelperEntity", 0, null, vector.Zero, vector.Zero);
289 SCR_SlotCompositionHelperEntity helper = SCR_SlotCompositionHelperEntity.Cast(api.SourceToEntity(src));
290 helper.m_EntitySource = src;
294 override int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
296 return EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
300 override void _WB_AfterWorldUpdate(
float timeSlice)
305 WorldEditorAPI api = _WB_GetEditorAPI();
306 api.BeginEntityAction();
307 api.CreateComponent(m_EntitySource,
"Hierarchy");
308 api.DeleteEntity(m_EntitySource);
309 api.EndEntityAction();
ref array< string > angles
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_CharacterSoundComponentClass GetComponentData()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
enum EVehicleType IEntity
proto external int SetEventMask(notnull IEntity owner, int mask)
event 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...
event 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!
proto external WorldEditorAPI _WB_GetEditorAPI()
This returns world editor API, which is safe to use from editor events bellow.
proto external vector GetLocalTransformAxis(int axis)
See IEntity::GetTransformAxis.
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external IEntity GetChildren()
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
proto external bool SetWorldTransform(vector mat[4])
See IEntity::SetTransform. Returns false, if there is no change in transformation.
proto external IEntity GetParent()
proto external IEntity GetSibling()
proto external vector CoordToLocal(vector coord)
ResourceName m_SlotPrefab
bool m_bOrientChildrenToTerrain
static ResourceName GetSlotPrefab(IEntityComponentSource componentSource)
bool CanOrientChildrenToTerrain()
ResourceName GetSlotPrefab()
Entity composition which is supposed to fit into a slot.
void SetChildTransform(IEntity owner, BaseWorld world)
override void OnPostInit(IEntity owner)
ResourceName GetSlotPrefab()
bool CanOrientChildrenToTerrain()
static void IgnoreOrientChildrenToTerrain()
Bool to disable the terrain snapping for next spawned composition.
static bool m_bIgnoreOrientChildrenToTerrain
override void EOnInit(IEntity owner)
static float GetHeightAboveTerrain(vector pos, BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
static bool SnapToTerrain(out vector transform[4], BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
static bool SnapAndOrientToTerrain(out vector transform[4], BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
proto native vector Vector(float x, float y, float z)