CloneContext Class

Summary

A dictionary which maps objects to their copies.
Assembly
Animancer.dll
Namespace
Animancer
Base Types
  • Dictionary<Object, Object>
graph BT Type-->Base0["Dictionary<Object, Object>"] Type["CloneContext"] class Type type-node

Syntax

public class CloneContext : Dictionary<Object, Object>

Remarks

This class is used to clone complex object trees with potentially interconnected references so that references to original objects can be replaced with references to their equivalent clones.

Properties

Name Value Summary
WillCloneUpdatables bool
Will the Animancer.IUpdatables be cloned as part of the current operation?

Methods

Name Value Summary
Clone<T>(ICloneable<T>) T
Calls Animancer.ICloneable`1.Clone(Animancer.CloneContext) and registers the clone.
GetClone<T>(T) T
Returns the clone of the `original` if one was registered. Otherwise, throws.
GetCloneOrOriginal<T>(T) T
Returns the clone of the `original` if one is registered. Otherwise, returns the `original`.
GetOrCreateClone<T>(ICloneable<T>) T
Returns the value registered using `original` as its key if there is one. Otherwise, calls Animancer.CloneableExtensions.Clone``1(Animancer.ICloneable{``0}), adds the clone to this dictionary, and returns it.
GetOrCreateCloneOrOriginal<T>(T) T
Returns the value registered using `original` as its key if there is one. Otherwise, if the `original` is Animancer.ICloneable`1 it calls Animancer.CloneableExtensions.Clone``1(Animancer.ICloneable{``0}), adds the clone to this dictionary, and returns it. Otherwise, just returns the `original`.
TryGetClone<T>(T) bool
Replaces the `item` with its clone and returns true if one is registered.
TryGetClone<T>(T, T) bool
Calls System.Collections.Generic.Dictionary`2.TryGetValue(`0,`1@) and casts the result.
TryGetOrCreateCloneOrOriginal<T>(T, T) bool
Returns true if there is a `clone` registered for the `original`. Otherwise, if the `original` is Animancer.ICloneable`1 it calls Animancer.CloneableExtensions.Clone``1(Animancer.ICloneable{``0}), adds the `clone` to this dictionary, and returns true. Otherwise, outputs the `original` as the `clone` and returns false.