MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetValue

Method SetValue

Source/Editor/Surface/SurfaceNode.cs:992–1015  ·  view source on GitHub ↗

Sets the value of the node parameter. The value index. The value. True if graph has been edited (nodes structure or parameter value).

(int index, object value, bool graphEdited = true)

Source from the content-addressed store, hash-verified

990 /// <param name="value">The value.</param>
991 /// <param name="graphEdited">True if graph has been edited (nodes structure or parameter value).</param>
992 public virtual void SetValue(int index, object value, bool graphEdited = true)
993 {
994 if (_isDuringValuesEditing || (Surface != null && !Surface.CanEdit))
995 return;
996 if (FlaxEngine.Json.JsonSerializer.ValueEquals(value, Values[index]))
997 return;
998 if (value is byte[] && Values[index] is byte[] && Utils.ArraysEqual((byte[])value, (byte[])Values[index]))
999 return;
1000
1001 _isDuringValuesEditing = true;
1002
1003 var before = Surface?.Undo != null ? (object[])Values.Clone() : null;
1004
1005 Values[index] = value;
1006 OnValuesChanged();
1007 Surface?.MarkAsEdited(graphEdited);
1008
1009 if (Surface != null)
1010 Surface.AddBatchedUndoAction(new EditNodeValuesAction(this, before, graphEdited));
1011
1012 _isDuringValuesEditing = false;
1013
1014 UpdateSize();
1015 }
1016
1017 /// <summary>
1018 /// Sets the values of the node parameters.

Callers 15

LoadIconsMethod · 0.45
OnEditSignatureMethod · 0.45
SetBoxValueMethod · 0.45
SetBoxValueMethod · 0.45
SetAssetMethod · 0.45
SetMethod · 0.45
OnValueChangedMethod · 0.45
TextBoxViewMethod · 0.45
OnSelectedItemChangedMethod · 0.45
SetMethod · 0.45
SetMethod · 0.45

Calls 4

ArraysEqualMethod · 0.80
ValueEqualsMethod · 0.45
CloneMethod · 0.45
AddBatchedUndoActionMethod · 0.45

Tested by

no test coverage detected