// Shared File Last Modified: 2022-12-05. // Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2023 Kybernetik // // FlexiMotion // https://kybernetik.com.au/flexi-motion // Copyright 2018-2023 Kybernetik // #define ANIMANCER // #define FLEXI_MOTION namespace Animancer { /// Interface for objects that can be copied. /// https://kybernetik.com.au/animancer/api/Animancer/ICopyable_1 /// https://kybernetik.com.au/flexi-motion/api/FlexiMotion/ICopyable_1 /// public interface ICopyable { /************************************************************************************************************************/ /// Copies the contents of `copyFrom` into this object, replacing its previous contents. /// uses this method internally. void CopyFrom(T copyFrom); /************************************************************************************************************************/ } /// https://kybernetik.com.au/animancer/api/Animancer/AnimancerUtilities public static partial class AnimancerUtilities { /************************************************************************************************************************/ /// Creates a new and calls on it. public static T Clone(this T original) where T : class, ICopyable, new() { if (original == null) return null; var clone = new T(); clone.CopyFrom(original); return clone; } /************************************************************************************************************************/ } }