Skip to content

Commit 1f37751

Browse files
committed
Do not invalidate values from inside nodes.
1 parent eceb578 commit 1f37751

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

‎Sources/BuiltInNodes/BI_InputUINodes.cpp‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ void BooleanNode::RegisterParameters (NUIE::NodeParameterList& parameterList) co
131131
return NE::ValuePtr (new NE::BooleanValue (GetTypedNode (uiNode)->GetValue ()));
132132
}
133133

134-
virtual bool SetValueInternal (NUIE::NodeUIManager&, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
134+
virtual bool SetValueInternal (NUIE::NodeUIManager& uiManager, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
135135
{
136136
GetTypedNode (uiNode)->SetValue (NE::BooleanValue::Get (value));
137+
uiManager.InvalidateNodeValue (uiNode);
138+
uiManager.InvalidateNodeDrawing (uiNode);
137139
return true;
138140
}
139141
};
@@ -166,7 +168,6 @@ bool BooleanNode::GetValue () const
166168
void BooleanNode::SetValue (bool newVal)
167169
{
168170
val = newVal;
169-
InvalidateValue ();
170171
}
171172

172173
NumericUpDownNode::Layout::Layout ( const std::string& leftButtonId,
@@ -298,9 +299,11 @@ void IntegerUpDownNode::RegisterParameters (NUIE::NodeParameterList& parameterLi
298299
return NE::ValuePtr (new NE::IntValue (GetTypedNode (uiNode)->GetValue ()));
299300
}
300301

301-
virtual bool SetValueInternal (NUIE::NodeUIManager&, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
302+
virtual bool SetValueInternal (NUIE::NodeUIManager& uiManager, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
302303
{
303304
GetTypedNode (uiNode)->SetValue (NE::IntValue::Get (value));
305+
uiManager.InvalidateNodeValue (uiNode);
306+
uiManager.InvalidateNodeDrawing (uiNode);
304307
return true;
305308
}
306309
};
@@ -319,9 +322,11 @@ void IntegerUpDownNode::RegisterParameters (NUIE::NodeParameterList& parameterLi
319322
return NE::ValuePtr (new NE::IntValue (GetTypedNode (uiNode)->GetStep ()));
320323
}
321324

322-
virtual bool SetValueInternal (NUIE::NodeUIManager&, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
325+
virtual bool SetValueInternal (NUIE::NodeUIManager& uiManager, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
323326
{
324327
GetTypedNode (uiNode)->SetStep (NE::IntValue::Get (value));
328+
uiManager.InvalidateNodeValue (uiNode);
329+
uiManager.InvalidateNodeDrawing (uiNode);
325330
return true;
326331
}
327332
};
@@ -352,13 +357,11 @@ NE::Stream::Status IntegerUpDownNode::Write (NE::OutputStream& outputStream) con
352357
void IntegerUpDownNode::Increase ()
353358
{
354359
val = val + step;
355-
InvalidateValue ();
356360
}
357361

358362
void IntegerUpDownNode::Decrease ()
359363
{
360364
val = val - step;
361-
InvalidateValue ();
362365
}
363366

364367
int IntegerUpDownNode::GetValue () const
@@ -369,7 +372,6 @@ int IntegerUpDownNode::GetValue () const
369372
void IntegerUpDownNode::SetValue (int newValue)
370373
{
371374
val = newValue;
372-
InvalidateValue ();
373375
}
374376

375377
int IntegerUpDownNode::GetStep () const
@@ -422,9 +424,11 @@ void DoubleUpDownNode::RegisterParameters (NUIE::NodeParameterList& parameterLis
422424
return NE::ValuePtr (new NE::DoubleValue (GetTypedNode (uiNode)->GetValue ()));
423425
}
424426

425-
virtual bool SetValueInternal (NUIE::NodeUIManager&, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
427+
virtual bool SetValueInternal (NUIE::NodeUIManager& uiManager, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
426428
{
427429
GetTypedNode (uiNode)->SetValue (NE::DoubleValue::Get (value));
430+
uiManager.InvalidateNodeValue (uiNode);
431+
uiManager.InvalidateNodeDrawing (uiNode);
428432
return true;
429433
}
430434
};
@@ -443,9 +447,11 @@ void DoubleUpDownNode::RegisterParameters (NUIE::NodeParameterList& parameterLis
443447
return NE::ValuePtr (new NE::DoubleValue (GetTypedNode (uiNode)->GetStep ()));
444448
}
445449

446-
virtual bool SetValueInternal (NUIE::NodeUIManager&, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
450+
virtual bool SetValueInternal (NUIE::NodeUIManager& uiManager, NE::EvaluationEnv&, NUIE::UINodePtr& uiNode, const NE::ValueConstPtr& value) override
447451
{
448452
GetTypedNode (uiNode)->SetStep (NE::DoubleValue::Get (value));
453+
uiManager.InvalidateNodeValue (uiNode);
454+
uiManager.InvalidateNodeDrawing (uiNode);
449455
return true;
450456
}
451457
};
@@ -476,13 +482,11 @@ NE::Stream::Status DoubleUpDownNode::Write (NE::OutputStream& outputStream) cons
476482
void DoubleUpDownNode::Increase ()
477483
{
478484
val = val + step;
479-
InvalidateValue ();
480485
}
481486

482487
void DoubleUpDownNode::Decrease ()
483488
{
484489
val = val - step;
485-
InvalidateValue ();
486490
}
487491

488492
double DoubleUpDownNode::GetValue () const
@@ -493,7 +497,6 @@ double DoubleUpDownNode::GetValue () const
493497
void DoubleUpDownNode::SetValue (double newValue)
494498
{
495499
val = newValue;
496-
InvalidateValue ();
497500
}
498501

499502
double DoubleUpDownNode::GetStep () const

‎Sources/NodeEngineTest/UINodeTest.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ class EnumerationParamTestNode : public SerializableTestUINode
156156
return NE::ValuePtr (new NE::IntValue ((int) GetTypedNode (uiNode)->GetMyEnumValue ()));
157157
}
158158

159-
virtual bool SetValueInternal (NodeUIManager&, NE::EvaluationEnv&, UINodePtr& uiNode, const NE::ValueConstPtr& value) override
159+
virtual bool SetValueInternal (NodeUIManager& uiManager, NE::EvaluationEnv&, UINodePtr& uiNode, const NE::ValueConstPtr& value) override
160160
{
161161
GetTypedNode (uiNode)->SetMyEnumValue ((MyEnumValue) NE::IntValue::Get (value));
162+
uiManager.InvalidateNodeValue (uiNode);
163+
uiManager.InvalidateNodeDrawing (uiNode);
162164
return true;
163165
}
164166
};

‎Sources/NodeUIEngine/NUIE_InteractionHandler.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ EventHandlerResult NodeInputEventHandler::ForwardEventToNode (const std::functio
396396
handlerResult = forwardEvent ();
397397
if (handlerResult == EventHandlerResult::EventHandled) {
398398
uiManager.RequestRecalculateAndRedraw ();
399+
uiManager.InvalidateNodeValue (uiNode);
399400
uiManager.InvalidateNodeDrawing (uiNode);
400401
}
401402
}

0 commit comments

Comments
 (0)