Undo action object.
| 14 | /// </summary> |
| 15 | /// <seealso cref="IUndoAction" /> |
| 16 | [Serializable] |
| 17 | public class UndoActionObject : UndoActionBase<UndoActionObject.DataStorage> |
| 18 | { |
| 19 | /// <summary> |
| 20 | /// The data value storage to solve issue for flax objects and editor scene tree nodes which are serialized by ref id. |
| 21 | /// </summary> |
| 22 | [Serializable] |
| 23 | public struct DataValue |
| 24 | { |
| 25 | /// <summary> |
| 26 | /// The generic value (anything). |
| 27 | /// </summary> |
| 28 | public object Generic; |
| 29 | |
| 30 | /// <summary> |
| 31 | /// The flax object. |
| 32 | /// </summary> |
| 33 | public FlaxEngine.Object FlaxObject; |
| 34 | |
| 35 | /// <summary> |
| 36 | /// The editor node object. |
| 37 | /// </summary> |
| 38 | public SceneGraph.SceneGraphNode EditorNode; |
| 39 | |
| 40 | /// <summary> |
| 41 | /// The id. |
| 42 | /// </summary> |
| 43 | public Guid? Id; |
| 44 | |
| 45 | /// <summary> |
| 46 | /// Gets the proper value. |
| 47 | /// </summary> |
| 48 | [NoSerialize] |
| 49 | public object Value => EditorNode ?? FlaxObject ?? Generic ?? Id; |
| 50 | |
| 51 | /// <summary> |
| 52 | /// Initializes a new instance of the <see cref="DataValue"/> struct. |
| 53 | /// </summary> |
| 54 | /// <param name="value">The value.</param> |
| 55 | public DataValue(object value) |
| 56 | { |
| 57 | Generic = null; |
| 58 | FlaxObject = null; |
| 59 | EditorNode = null; |
| 60 | Id = null; |
| 61 | |
| 62 | if (value is SceneGraph.SceneGraphNode editorNode) |
| 63 | { |
| 64 | EditorNode = editorNode; |
| 65 | } |
| 66 | else if (value is FlaxEngine.Object flaxObject) |
| 67 | { |
| 68 | FlaxObject = flaxObject; |
| 69 | } |
| 70 | else if (value is Guid guid) |
| 71 | { |
| 72 | Id = guid; |
| 73 | } |
nothing calls this directly
no test coverage detected