DayZ 1.24
Loading...
Searching...
No Matches
PPEMatClassParameterCommandData Class Reference
Collaboration diagram for PPEMatClassParameterCommandData:
[legend]

Protected Member Functions

void PPEMatClassParameterBool (int mat_idx, int parameter_idx, PPEClassBase parent)
 
override void InitDefaults ()
 
override void InitCuttent ()
 
override int GetParameterVarType ()
 
override void Update (float timeslice, out Param p_total, out bool setting_defaults, int order)
 
void PrepareLayerInfo (int layer, bool value, int operator)
 
override void SetParameterValueDefault (inout Param p_total)
 No active requests for the mat. parameter value change, sets the value to DEFAULT.
 
void PPEMatClassParameterCommandData (int mat_idx, int parameter_idx, PPEClassBase parent)
 
int GetParameterVarType ()
 
void SetMaterialIndex (int value)
 
void SetParameterIndex (int value)
 
void SetParent (PPEClassBase parent)
 
void InsertRequestData (PPERequestParamDataBase request_data)
 
void Update (float timeslice, out Param p_total, out bool setting_defaults, int order)
 
void ModifyResultValues (inout Param result_values)
 Modifies values to be used for setter methods later in the manager update. Currently used only on PPEMatClassParameterColor, TODO!!
 
void AddPriorityInfo (int priority)
 Adds 'layers' to be iterated throug.
 
void RemovePriorityInfo (int priority)
 Currently unused; layer info gets cleared every update.
 
void RegisterDefaults (Param p)
 Adds name and default values from material registration, override on children to properly add for each type.
 
void InitDefaults ()
 
void InitCuttent ()
 
void SetParameterValueDefault (inout Param p_total)
 
Param GetDefaultValues ()
 Careful, formating is such, that param1 is ALWAYS string, containing parameter name, should it be needed. Actual values follow.
 
Param GetCurrentValues ()
 Careful, only actual values, WITHOUT string.
 
void DbgPrnt (string text)
 
void PPEMatClassParameterFloat (int mat_idx, int parameter_idx, PPEClassBase parent)
 
override void InitDefaults ()
 
override void InitCuttent ()
 
override int GetParameterVarType ()
 
override void Update (float timeslice, out Param p_total, out bool setting_defaults, int order)
 
void PrepareLayerInfo (int layer, float value, int operator)
 
override void SetParameterValueDefault (inout Param p_total)
 No active requests for the mat. parameter value change, sets the value to DEFAULT (zero?)
 
void PPEMatClassParameterInt (int mat_idx, int parameter_idx, PPEClassBase parent)
 
override void InitDefaults ()
 
override void InitCuttent ()
 
override int GetParameterVarType ()
 
override void Update (float timeslice, out Param p_total, out bool setting_defaults, int order)
 
void PrepareLayerInfo (int layer, int value, int operator)
 
override void SetParameterValueDefault (inout Param p_total)
 No active requests for the mat. parameter value change, sets the value to DEFAULT.
 

Protected Attributes

ref map< int, ref array< bool, int > > m_LayerInfo
 
PPETemplateDefBool m_Bool
 
bool m_ValueDefault
 
int m_UpdatedCount
 
int m_MaterialIndex
 
int m_ParameterIndex
 
ref ActiveParameterRequestsMap m_RequestMap
 
PPEClassBase m_Parent
 
ref Param m_Defaults
 
ref Param m_CurrentValues
 
ref map< int, ref array< int > > m_Dependencies
 
ref map< int, ref array< float, int > > m_LayerInfo
 
PPETemplateDefFloat m_Float
 
float m_ValueDefault
 
float m_ValueMin
 
float m_ValueMax
 
ref map< int, ref array< int, int > > m_LayerInfo
 
PPETemplateDefInt m_Int
 
int m_ValueDefault
 

Private Member Functions

override int GetParameterVarType ()
 
override int GetParameterVarType ()
 
override int GetParameterVarType ()
 

Private Attributes

const int LAYER_INFO_VALUE = 0
 
const int LAYER_INFO_OPERATOR = 1
 
ref array< intm_CommandLayersArray
 

Detailed Description

Definition at line 1 of file PPEMatClassParameterBool.c.

Constructor & Destructor Documentation

◆ PPEMatClassParameterCommandData()

void PPEMatClassParameterCommandData::PPEMatClassParameterCommandData ( int mat_idx,
int parameter_idx,
PPEClassBase parent )
inlineprotected

Member Function Documentation

◆ AddPriorityInfo()

void PPEMatClassParameterCommandData::AddPriorityInfo ( int priority)
inlineprotected

Adds 'layers' to be iterated throug.

Definition at line 81 of file PPEMatClassParameterCommandData.c.

82 {
83 if (m_CommandLayersArray.Find(priority) == -1)
84 {
87 }
88 else
89 {
90 //DbgPrnt("PPEDebug | PPEMatClassParameterCommandData - AddPriorityInfo | Already exists, values have been overwritten!");
91 }
92 }

References m_CommandLayersArray.

Referenced by PrepareLayerInfo(), PrepareLayerInfo(), and PrepareLayerInfo().

◆ DbgPrnt()

void PPEMatClassParameterCommandData::DbgPrnt ( string text)
inlineprotected

Definition at line 127 of file PPEMatClassParameterCommandData.c.

128 {
129 //Debug.Log(""+text);
130 }

◆ GetCurrentValues()

Param PPEMatClassParameterCommandData::GetCurrentValues ( )
inlineprotected

◆ GetDefaultValues()

Param PPEMatClassParameterCommandData::GetDefaultValues ( )
inlineprotected

Careful, formating is such, that param1 is ALWAYS string, containing parameter name, should it be needed. Actual values follow.

Definition at line 116 of file PPEMatClassParameterCommandData.c.

References m_Defaults.

◆ GetParameterVarType() [1/7]

override int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprotected

Definition at line 24 of file PPEMatClassParameterBool.c.

25 {
26 return PPEConstants.VAR_TYPE_BOOL;
27 }

Referenced by PPEClassBase::SetFinalParameterValue().

◆ GetParameterVarType() [2/7]

int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprotected

Definition at line 31 of file PPEMatClassParameterCommandData.c.

32 {
33 return -1;
34 }

◆ GetParameterVarType() [3/7]

override int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprotected

Definition at line 29 of file PPEMatClassParameterFloat.c.

30 {
31 return PPEConstants.VAR_TYPE_FLOAT;
32 }

◆ GetParameterVarType() [4/7]

override int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprotected

Definition at line 24 of file PPEMatClassParameterInt.c.

25 {
26 return PPEConstants.VAR_TYPE_INT;
27 }

◆ GetParameterVarType() [5/7]

override int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprivate

Definition at line 3 of file PPEMatClassParameterResource.c.

4 {
5 return PPEConstants.VAR_TYPE_RESOURCE;
6 }

◆ GetParameterVarType() [6/7]

override int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprivate

Definition at line 3 of file PPEMatClassParameterTexture.c.

4 {
5 return PPEConstants.VAR_TYPE_TEXTURE;
6 }

◆ GetParameterVarType() [7/7]

override int PPEMatClassParameterCommandData::GetParameterVarType ( )
inlineprivate

Definition at line 3 of file PPEMatClassParameterVector.c.

4 {
5 return PPEConstants.VAR_TYPE_VECTOR;
6 }

◆ InitCuttent() [1/4]

override void PPEMatClassParameterCommandData::InitCuttent ( )
inlineprotected

◆ InitCuttent() [2/4]

void PPEMatClassParameterCommandData::InitCuttent ( )
inlineprotected

Definition at line 109 of file PPEMatClassParameterCommandData.c.

109{};

◆ InitCuttent() [3/4]

override void PPEMatClassParameterCommandData::InitCuttent ( )
inlineprotected

Definition at line 24 of file PPEMatClassParameterFloat.c.

References m_ValueDefault.

◆ InitCuttent() [4/4]

override void PPEMatClassParameterCommandData::InitCuttent ( )
inlineprotected

Definition at line 19 of file PPEMatClassParameterInt.c.

References m_ValueDefault.

◆ InitDefaults() [1/4]

override void PPEMatClassParameterCommandData::InitDefaults ( )
inlineprotected

Definition at line 13 of file PPEMatClassParameterBool.c.

14 {
16 m_ValueDefault = m_Bool.param2;
17 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), and m_ValueDefault.

Referenced by RegisterDefaults().

◆ InitDefaults() [2/4]

void PPEMatClassParameterCommandData::InitDefaults ( )
inlineprotected

Definition at line 107 of file PPEMatClassParameterCommandData.c.

107{};

◆ InitDefaults() [3/4]

override void PPEMatClassParameterCommandData::InitDefaults ( )
inlineprotected

Definition at line 15 of file PPEMatClassParameterFloat.c.

16 {
18 //m_Float = PPETemplateDefFloat.Cast(m_Defaults);
19 m_ValueDefault = m_Float.param2;
20 m_ValueMin = m_Float.param3;
21 m_ValueMax = m_Float.param4;
22 }

References Class::CastTo(), m_Float, m_ValueDefault, m_ValueMax, and m_ValueMin.

◆ InitDefaults() [4/4]

override void PPEMatClassParameterCommandData::InitDefaults ( )
inlineprotected

Definition at line 13 of file PPEMatClassParameterInt.c.

References Class::CastTo(), and m_ValueDefault.

◆ InsertRequestData()

void PPEMatClassParameterCommandData::InsertRequestData ( PPERequestParamDataBase request_data)
inlineprotected

Definition at line 51 of file PPEMatClassParameterCommandData.c.

52 {
53 m_RequestMap.Set(request_data.GetRequesterIDX(), request_data); //<request_ID, data>
54 }

References m_RequestMap.

◆ ModifyResultValues()

void PPEMatClassParameterCommandData::ModifyResultValues ( inout Param result_values)
inlineprotected

Modifies values to be used for setter methods later in the manager update. Currently used only on PPEMatClassParameterColor, TODO!!

Definition at line 76 of file PPEMatClassParameterCommandData.c.

77 {
78 }

◆ PPEMatClassParameterBool()

void PPEMatClassParameterCommandData::PPEMatClassParameterBool ( int mat_idx,
int parameter_idx,
PPEClassBase parent )
inlineprotected

Definition at line 8 of file PPEMatClassParameterBool.c.

9 {
11 }
ref map< int, ref array< bool, int > > m_LayerInfo

References m_LayerInfo.

◆ PPEMatClassParameterFloat()

void PPEMatClassParameterCommandData::PPEMatClassParameterFloat ( int mat_idx,
int parameter_idx,
PPEClassBase parent )
inlineprotected

Definition at line 10 of file PPEMatClassParameterFloat.c.

References m_LayerInfo.

◆ PPEMatClassParameterInt()

void PPEMatClassParameterCommandData::PPEMatClassParameterInt ( int mat_idx,
int parameter_idx,
PPEClassBase parent )
inlineprotected

Definition at line 8 of file PPEMatClassParameterInt.c.

References m_LayerInfo.

◆ PrepareLayerInfo() [1/3]

void PPEMatClassParameterCommandData::PrepareLayerInfo ( int layer,
bool value,
int operator )
inlineprotected

Definition at line 170 of file PPEMatClassParameterBool.c.

171 {
172 m_LayerInfo.Set(layer, {value, operator});
174 }
void AddPriorityInfo(int priority)
Adds 'layers' to be iterated throug.

References AddPriorityInfo(), and m_LayerInfo.

Referenced by Update().

◆ PrepareLayerInfo() [2/3]

void PPEMatClassParameterCommandData::PrepareLayerInfo ( int layer,
float value,
int operator )
inlineprotected

Definition at line 219 of file PPEMatClassParameterFloat.c.

220 {
221 m_LayerInfo.Set(layer, {value, operator});
223 }

References AddPriorityInfo(), and m_LayerInfo.

◆ PrepareLayerInfo() [3/3]

void PPEMatClassParameterCommandData::PrepareLayerInfo ( int layer,
int value,
int operator )
inlineprotected

Definition at line 170 of file PPEMatClassParameterInt.c.

171 {
172 m_LayerInfo.Set(layer, {value, operator});
174 }

References AddPriorityInfo(), and m_LayerInfo.

◆ RegisterDefaults()

void PPEMatClassParameterCommandData::RegisterDefaults ( Param p)
inlineprotected

Adds name and default values from material registration, override on children to properly add for each type.

Definition at line 100 of file PPEMatClassParameterCommandData.c.

References InitCuttent(), InitDefaults(), and m_Defaults.

◆ RemovePriorityInfo()

void PPEMatClassParameterCommandData::RemovePriorityInfo ( int priority)
inlineprotected

Currently unused; layer info gets cleared every update.

Definition at line 95 of file PPEMatClassParameterCommandData.c.

96 {
97 }

◆ SetMaterialIndex()

void PPEMatClassParameterCommandData::SetMaterialIndex ( int value)
inlineprotected

Definition at line 36 of file PPEMatClassParameterCommandData.c.

37 {
39 }

References m_MaterialIndex.

◆ SetParameterIndex()

void PPEMatClassParameterCommandData::SetParameterIndex ( int value)
inlineprotected

Definition at line 41 of file PPEMatClassParameterCommandData.c.

42 {
44 }

References m_ParameterIndex.

◆ SetParameterValueDefault() [1/4]

override void PPEMatClassParameterCommandData::SetParameterValueDefault ( inout Param p_total)
inlineprotected

No active requests for the mat. parameter value change, sets the value to DEFAULT.

Definition at line 177 of file PPEMatClassParameterBool.c.

178 {
181 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | exit 3 - zero value");
182 }

Referenced by Update().

◆ SetParameterValueDefault() [2/4]

void PPEMatClassParameterCommandData::SetParameterValueDefault ( inout Param p_total)
inlineprotected

Definition at line 111 of file PPEMatClassParameterCommandData.c.

112 {
113 }

◆ SetParameterValueDefault() [3/4]

override void PPEMatClassParameterCommandData::SetParameterValueDefault ( inout Param p_total)
inlineprotected

No active requests for the mat. parameter value change, sets the value to DEFAULT (zero?)

Definition at line 226 of file PPEMatClassParameterFloat.c.

227 {
230 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | exit 3 - zero value");
231 }

◆ SetParameterValueDefault() [4/4]

override void PPEMatClassParameterCommandData::SetParameterValueDefault ( inout Param p_total)
inlineprotected

No active requests for the mat. parameter value change, sets the value to DEFAULT.

Definition at line 177 of file PPEMatClassParameterInt.c.

178 {
181 //DbgPrnt("PPEDebug | PPEMatClassParameterInt - UpdateParameterValues | exit 3 - zero value");
182 }

◆ SetParent()

void PPEMatClassParameterCommandData::SetParent ( PPEClassBase parent)
inlineprotected

Definition at line 46 of file PPEMatClassParameterCommandData.c.

47 {
48 m_Parent = parent;
49 }

References m_Parent.

◆ Update() [1/4]

override void PPEMatClassParameterCommandData::Update ( float timeslice,
out Param p_total,
out bool setting_defaults,
int order )
inlineprotected

Definition at line 29 of file PPEMatClassParameterBool.c.

30 {
32
34
36
37 bool setting_value_zero = false;
38
39 bool bool_value_temp = false;
41
42 if (p_total == null)
43 p_total = new Param1<bool>(false);
44
45 if (m_RequestMap.Count() > 0)
46 m_LayerInfo.Clear();
47 else
48 {
49 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
52 return;
53 }
54
55 for (int i = 0; i < m_RequestMap.Count(); i++)
56 {
58
59 if (req_data == null)
60 {
61 Error("PPEMatClassParameterBool | req_data not found! | " + this + " | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
62 continue;
63 }
64
65 setting_value_zero = req_data.IsSettingDefaultValues();
66
67 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
68 {
69 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
70 continue;
71 }
72
74 {
75 req_data.m_BoolTarget = false;
76 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | !data.m_DefaultTargetSet | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | req_data.m_BoolTarget: " + req_data.m_BoolTarget);
77 }
78 else
80
81 //evaluation
82 //--------------------------------
83 req_data.m_BoolLast = req_data.m_BoolCurrent;
84
85 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
86 {
87 bool_value_temp = req_data.m_BoolCurrent;
88 PrepareLayerInfo(req_data.GetPriorityLayer(), bool_value_temp, req_data.GetInteractionMask());
89 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | !req_data.m_UpdatingData | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | not updating, addaing current value into mix: " + bool_value_temp);
90 continue;
91 }
92
93 bool_value_temp = req_data.m_BoolTarget;
94
95 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
96 req_data.SetUpdatingDataValues(false);
98 {
99 req_data.SetDataActive(false);
100 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
101 }
102 else
103 {
104 bool_value_temp = req_data.m_BoolTarget;
105 PrepareLayerInfo(req_data.GetPriorityLayer(), bool_value_temp, req_data.GetInteractionMask());
106 }
107
108 req_data.m_BoolCurrent = bool_value_temp;
109 }
110
111 if (active_request_count == 0)
113 else
114 {
115 //---------------------------
116 //MASK handling and calculation
117 bool value;
118 int operator;
119 bool override_active = false;
120
121 for (i = 0; i < m_LayerInfo.Count(); i++)
122 {
123 if (override_active)
124 break;
125
127 operator = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
128
129 switch (operator)
130 {
131 case PPOperators.LOWEST:
133 break;
134
135 case PPOperators.HIGHEST:
137 break;
138
139 case PPOperators.OVERRIDE:
141 break;
142
143 case PPOperators.SET:
145 break;
146
147 default:
148 Error("PPEMatClassParameterBool | Invalid operator " + operator + " in mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
149 break;
150 }
151
152 if (operator == PPOperators.OVERRIDE)
153 {
154 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
155 override_active = true;
156 }
157 }
158
159 m_CommandLayersArray.Clear();
160
162 }
163
164 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
166
168 }
PPOperators
PP operators, specify operation between subsequent layers.
void PPERequestParamDataBool(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
Definition EnMath.c:7
void ParamUpdateRemove(int parameter_idx)
Queue selected parameter for removal from the update queue.
void PrepareLayerInfo(int layer, bool value, int operator)
override void SetParameterValueDefault(inout Param p_total)
No active requests for the mat. parameter value change, sets the value to DEFAULT.
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.

References Error(), m_LayerInfo, m_Parent, m_ValueDefault, Math::Max(), Math::Min(), PPERequestParamDataBool(), PrepareLayerInfo(), and SetParameterValueDefault().

◆ Update() [2/4]

void PPEMatClassParameterCommandData::Update ( float timeslice,
out Param p_total,
out bool setting_defaults,
int order )
inlineprotected

Definition at line 56 of file PPEMatClassParameterCommandData.c.

57 {
58 //insert dependencies to another update round
59 if (m_Dependencies && m_Dependencies.Count() > 0 && order < PPEConstants.DEPENDENCY_ORDER_HIGHEST)
60 {
61 int key_mat = -1;
62 int element_par = -1;
63 for (int i = 0; i < m_Dependencies.Count(); i++)
64 {
65 key_mat = m_Dependencies.GetKey(i);
66 for (int j = 0; j < m_Dependencies.GetElement(i).Count(); j++)
67 {
68 element_par = m_Dependencies.GetElement(i).Get(j);
69 PPEManagerStatic.GetPPEManager().SetMaterialParamUpdating(key_mat, element_par, order + 1); // TODO - revise, currently only does one more update
70 }
71 }
72 }
73 }
Static component of PPE manager, used to hold the instance.
Definition PPEManager.c:3
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Definition PPEManager.c:27
ref map< int, ref array< int > > m_Dependencies

References Count, PPEManagerStatic::GetPPEManager(), and m_Dependencies.

◆ Update() [3/4]

override void PPEMatClassParameterCommandData::Update ( float timeslice,
out Param p_total,
out bool setting_defaults,
int order )
inlineprotected

Definition at line 34 of file PPEMatClassParameterFloat.c.

35 {
37
39
41
42 bool setting_value_zero = false;
43
44 float float_value_temp = 0.0;
45 float float_value_default = 0.0;
46 float float_value_total = 0.0;
47
48 if (p_total == null)
49 p_total = new Param1<float>(0.0);
50
51 if (m_RequestMap.Count() > 0)
52 m_LayerInfo.Clear();
53 else
54 {
55 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
58 return;
59 }
60
61 for (int i = 0; i < m_RequestMap.Count(); i++)
62 {
64
65 if (req_data == null)
66 {
67 Error("Debug | PPEMatClassParameterFloat | req_data not found! | " + this + " | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
68 continue;
69 }
70
71 setting_value_zero = req_data.IsSettingDefaultValues();
72
73 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
74 {
75 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
76 continue;
77 }
78
80 {
81 req_data.m_FloatTarget = 0;//min;
82 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | !data.m_DefaultTargetSet | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | req_data.m_FloatTarget: " + req_data.m_FloatTarget);
83 }
84 else
86
87 //evaluation
88 //--------------------------------
89 req_data.m_FloatLast = req_data.m_FloatCurrent;
90
91 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
92 {
93 float_value_temp = req_data.m_FloatCurrent;
94 PrepareLayerInfo(req_data.GetPriorityLayer(), float_value_temp, req_data.GetInteractionMask());
95 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | !req_data.m_UpdatingData | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | not updating, addaing current value into mix: " + float_value_temp);
96 continue;
97 }
98
99 float_value_temp = req_data.m_FloatTarget;
100
101 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
102 req_data.SetUpdatingDataValues(false);
104 {
105 req_data.SetDataActive(false);
106 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
107 }
108 else
109 {
110 float_value_temp = req_data.m_FloatTarget;
111 PrepareLayerInfo(req_data.GetPriorityLayer(), float_value_temp, req_data.GetInteractionMask());
112 }
113
114 req_data.m_FloatCurrent = float_value_temp;
115 }
116
117 //---------------------------
118 //MASK handling and calculation
119 float value;
120 int operator;
121 bool override_active = false;
122
123 if (m_ValueMax == 0.0)
125 else
127
128 //float_value_total = Math.InverseLerp(m_ValueMin,m_ValueMax,m_ValueDefault);
130
131 for (i = 0; i < m_LayerInfo.Count(); i++)
132 {
133 if (override_active)
134 break;
135
137 operator = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
138
139 switch (operator)
140 {
141 case PPOperators.LOWEST:
143 break;
144
145 case PPOperators.HIGHEST:
147 break;
148
149 case PPOperators.ADD:
150 //float_value_total = float_value_total + value - float_value_default;
152 break;
153
154 case PPOperators.ADD_RELATIVE:
156 break;
157
158 case PPOperators.SUBSTRACT:
159 //float_value_total = float_value_total - value + float_value_default;
161 break;
162
163 case PPOperators.SUBSTRACT_RELATIVE:
165 break;
166
167 case PPOperators.SUBSTRACT_REVERSE:
168 //float_value_total = value - float_value_default - float_value_total;
170 break;
171
172 case PPOperators.SUBSTRACT_REVERSE_RELATIVE:
174 break;
175
176 case PPOperators.MULTIPLICATIVE:
177 //float_value_total = Math.Lerp(float_value_default, float_value_total, value);
179 break;
180
181 case PPOperators.OVERRIDE:
183 break;
184
185 case PPOperators.SET:
187 break;
188 }
189
190 //DbgPrnt("m_LayerInfo | float_value_total pre-clamp: " + float_value_total + " | i: " + i);
192
193 if (operator == PPOperators.OVERRIDE)
194 {
195 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
196 override_active = true;
197 }
198
199 //RemovePriorityInfo(m_CommandLayersArray.Get(i));
200 }
201
202 m_CommandLayersArray.Clear();
203
204 //TODO - consider moving this up, if possible
205 if (active_request_count == 0)
207 else
208 {
210 Param1<float>.Cast(p_total).param1 = res; //converts back to absolute values
211 }
212
213 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
215
217 }
void PPERequestParamDataFloat(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

References Math::Clamp(), Error(), Math::Lerp(), m_LayerInfo, m_Parent, m_ValueDefault, m_ValueDefault, m_ValueMax, m_ValueMax, m_ValueMin, Math::Max(), Math::Min(), PPERequestParamDataFloat(), PrepareLayerInfo(), and SetParameterValueDefault().

◆ Update() [4/4]

override void PPEMatClassParameterCommandData::Update ( float timeslice,
out Param p_total,
out bool setting_defaults,
int order )
inlineprotected

Definition at line 29 of file PPEMatClassParameterInt.c.

30 {
32
34
35 PPERequestParamDataInt req_data;
36
37 bool setting_value_zero = false;
38
39 bool int_value_temp = false;
41
42 if (p_total == null)
43 p_total = new Param1<int>(0);
44
45 if (m_RequestMap.Count() > 0)
46 m_LayerInfo.Clear();
47 else
48 {
49 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
52 return;
53 }
54
55 for (int i = 0; i < m_RequestMap.Count(); i++)
56 {
57 req_data = PPERequestParamDataInt.Cast(m_RequestMap.GetElement(i));
58
59 if (req_data == null)
60 {
61 Error("Debug | PPEMatClassParameterInt | req_data not found! | " + this + " | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
62 continue;
63 }
64
65 setting_value_zero = req_data.IsSettingDefaultValues();
66
67 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
68 {
69 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
70 continue;
71 }
72
74 {
75 req_data.m_IntTarget = false;
76 //DbgPrnt("PPEDebug | PPEMatClassParameterInt - UpdateParameterValues | !data.m_DefaultTargetSet | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | req_data.m_IntTarget: " + req_data.m_IntTarget);
77 }
78 else
80
81 //evaluation
82 //--------------------------------
83 req_data.m_IntLast = req_data.m_IntCurrent;
84
85 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
86 {
87 int_value_temp = req_data.m_IntCurrent;
88 PrepareLayerInfo(req_data.GetPriorityLayer(), int_value_temp, req_data.GetInteractionMask());
89 //DbgPrnt("PPEDebug | PPEMatClassParameterInt - UpdateParameterValues | !req_data.m_UpdatingData | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | not updating, addaing current value into mix: " + int_value_temp);
90 continue;
91 }
92
93 int_value_temp = req_data.m_IntTarget;
94
95 //DbgPrnt("PPEDebug | PPEMatClassParameterInt - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
96 req_data.SetUpdatingDataValues(false);
98 {
99 req_data.SetDataActive(false);
100 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
101 }
102 else
103 {
104 int_value_temp = req_data.m_IntTarget;
105 PrepareLayerInfo(req_data.GetPriorityLayer(), int_value_temp, req_data.GetInteractionMask());
106 }
107
108 req_data.m_IntCurrent = int_value_temp;
109 }
110
111 if (active_request_count == 0)
113 else
114 {
115 //---------------------------
116 //MASK handling and calculation
117 int value;
118 int operator;
119 bool override_active = false;
120
121 for (i = 0; i < m_LayerInfo.Count(); i++)
122 {
123 if (override_active)
124 break;
125
127 operator = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
128
129 switch (operator)
130 {
131 case PPOperators.LOWEST:
133 break;
134
135 case PPOperators.HIGHEST:
137 break;
138
139 case PPOperators.OVERRIDE:
141 break;
142
143 case PPOperators.SET:
145 break;
146
147 default:
148 Error("PPEMatClassParameterInt | Invalid operator " + operator + " in mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
149 break;
150 }
151
152 if (operator == PPOperators.OVERRIDE)
153 {
154 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
155 override_active = true;
156 }
157 }
158
159 m_CommandLayersArray.Clear();
160
161 Param1<int>.Cast(p_total).param1 = int_value_total;
162 }
163
164 //DbgPrnt("PPEDebug | PPEMatClassParameterInt - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
166
168 }

References Error(), m_LayerInfo, m_Parent, m_ValueDefault, Math::Max(), Math::Min(), PrepareLayerInfo(), and SetParameterValueDefault().

Member Data Documentation

◆ LAYER_INFO_OPERATOR

const int PPEMatClassParameterCommandData::LAYER_INFO_OPERATOR = 1
private

Definition at line 7 of file PPEMatClassParameterCommandData.c.

◆ LAYER_INFO_VALUE

const int PPEMatClassParameterCommandData::LAYER_INFO_VALUE = 0
private

Definition at line 6 of file PPEMatClassParameterCommandData.c.

◆ m_Bool

PPETemplateDefBool PPEMatClassParameterCommandData::m_Bool
protected

Definition at line 5 of file PPEMatClassParameterBool.c.

◆ m_CommandLayersArray

ref array<int> PPEMatClassParameterCommandData::m_CommandLayersArray
private

◆ m_CurrentValues

ref Param PPEMatClassParameterCommandData::m_CurrentValues
protected

Definition at line 16 of file PPEMatClassParameterCommandData.c.

Referenced by GetCurrentValues().

◆ m_Defaults

ref Param PPEMatClassParameterCommandData::m_Defaults
protected

Definition at line 15 of file PPEMatClassParameterCommandData.c.

Referenced by GetDefaultValues(), and RegisterDefaults().

◆ m_Dependencies

ref map<int, ref array<int> > PPEMatClassParameterCommandData::m_Dependencies
protected

Definition at line 18 of file PPEMatClassParameterCommandData.c.

Referenced by Update().

◆ m_Float

PPETemplateDefFloat PPEMatClassParameterCommandData::m_Float
protected

Definition at line 5 of file PPEMatClassParameterFloat.c.

◆ m_Int

PPETemplateDefInt PPEMatClassParameterCommandData::m_Int
protected

Definition at line 5 of file PPEMatClassParameterInt.c.

◆ m_LayerInfo [1/3]

ref map<int, ref array<bool, int> > PPEMatClassParameterCommandData::m_LayerInfo
protected

Definition at line 3 of file PPEMatClassParameterBool.c.

◆ m_LayerInfo [2/3]

ref map<int, ref array<float, int> > PPEMatClassParameterCommandData::m_LayerInfo
protected

Definition at line 3 of file PPEMatClassParameterFloat.c.

◆ m_LayerInfo [3/3]

ref map<int, ref array<int, int> > PPEMatClassParameterCommandData::m_LayerInfo
protected

Definition at line 3 of file PPEMatClassParameterInt.c.

◆ m_MaterialIndex

int PPEMatClassParameterCommandData::m_MaterialIndex
protected

◆ m_ParameterIndex

int PPEMatClassParameterCommandData::m_ParameterIndex
protected

◆ m_Parent

PPEClassBase PPEMatClassParameterCommandData::m_Parent
protected

Definition at line 14 of file PPEMatClassParameterCommandData.c.

Referenced by PPEMatClassParameterCommandData(), and SetParent().

◆ m_RequestMap

ref ActiveParameterRequestsMap PPEMatClassParameterCommandData::m_RequestMap
protected

◆ m_UpdatedCount

int PPEMatClassParameterCommandData::m_UpdatedCount
protected

Definition at line 10 of file PPEMatClassParameterCommandData.c.

Referenced by PPEMatClassParameterCommandData().

◆ m_ValueDefault [1/3]

bool PPEMatClassParameterCommandData::m_ValueDefault
protected

Definition at line 6 of file PPEMatClassParameterBool.c.

Referenced by Update().

◆ m_ValueDefault [2/3]

float PPEMatClassParameterCommandData::m_ValueDefault
protected

Definition at line 6 of file PPEMatClassParameterFloat.c.

◆ m_ValueDefault [3/3]

int PPEMatClassParameterCommandData::m_ValueDefault
protected

Definition at line 6 of file PPEMatClassParameterInt.c.

◆ m_ValueMax

float PPEMatClassParameterCommandData::m_ValueMax
protected

Definition at line 8 of file PPEMatClassParameterFloat.c.

Referenced by Update().

◆ m_ValueMin

float PPEMatClassParameterCommandData::m_ValueMin
protected

Definition at line 7 of file PPEMatClassParameterFloat.c.


The documentation for this class was generated from the following files: