Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditableEntityMaterialChildComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Editor (Editables)", description: "")]
3 {
4 }
5 
7 
9 class SCR_EditableEntityMaterialChildComponent : SCR_EditableEntityBaseChildComponent
10 {
11  //[Attribute()]
12  //private ref array<ref SCR_EditableEntityMaterialChildState> m_States;
13 
14  [Attribute("", UIWidgets.ResourcePickerThumbnail, "", "emat")]
15  private ResourceName m_DefaultMaterial;
16 
17  [Attribute("", UIWidgets.ResourcePickerThumbnail, "", "emat")]
18  private ResourceName m_StateMaterial;
19 
20  //------------------------------------------------------------------------------------------------
21  protected void SetMaterial(ResourceName material)
22  {
23  if (!m_Owner)
24  return;
25 
27  if (area)
28  {
29  area.SetMaterial(material);
30  return;
31  }
32  VObject obj = m_Owner.GetVObject();
33  string remap = "";
34  string materials[256];
35  int numMats = obj.GetMaterials(materials);
36  for (int i = 0; i < numMats; i++)
37  {
38  remap += string.Format("$remap '%1' '%2';", materials[i], material);
39  }
40  m_Owner.SetObject(obj, remap);
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  override void EOnStateChanged(EEditableEntityState states, EEditableEntityState changedState, bool toSet)
45  {
46  if ((states & m_State) > 0)
48  else
49  SetMaterial(m_DefaultMaterial);
50  }
51 
52  //------------------------------------------------------------------------------------------------
53  override void OnPostInit(IEntity owner)
54  {
55  if (SCR_Global.IsEditMode(owner))
56  return; //--- Run-time only
57 
58  //SetMaterial(m_DefaultMaterial);
60  }
61 }
SetMaterial
protected void SetMaterial(ResourceName material)
Definition: SCR_EditableEntityMaterialChildComponent.c:21
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
EEditableEntityState
EEditableEntityState
Definition: EEditableEntityState.c:37
UpdateFromCurrentState
void UpdateFromCurrentState()
Update based on current state of editable entity.
Definition: SCR_EditableEntityBaseChildComponent.c:29
m_StateMaterial
private ResourceName m_StateMaterial
Definition: SCR_EditableEntityMaterialChildComponent.c:18
EOnStateChanged
override void EOnStateChanged(EEditableEntityState states, EEditableEntityState changedState, bool toSet)
Definition: SCR_EditableEntityMaterialChildComponent.c:44
SCR_EditableEntityMaterialChildComponentClass
Definition: SCR_EditableEntityMaterialChildComponent.c:2
SCR_EditableEntityBaseChildComponentClass
Definition: SCR_EditableEntityBaseChildComponent.c:2
Attribute
SCR_EditableEntityMaterialChildComponentClass SCR_EditableEntityBaseChildComponentClass Attribute("", UIWidgets.ResourcePickerThumbnail, "", "emat")] private ResourceName m_DefaultMaterial
Change material based on specific states.
OnPostInit
override void OnPostInit(IEntity owner)
Editable Mine.
Definition: SCR_EditableEntityMaterialChildComponent.c:53
SCR_EditableEntityBaseChildComponent
void SCR_EditableEntityBaseChildComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_EditableEntityBaseChildComponent.c:70
SCR_VirtualAreaEntity
Definition: SCR_VirtualAreaEntity.c:6
SCR_Global
Definition: Functions.c:6
m_State
private EEditableEntityState m_State
Definition: SCR_BaseEntitiesEditorUIEffect.c:3
m_Owner
SCR_AIGroupUtilityComponentClass m_Owner
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180