summaryrefslogtreecommitdiff
path: root/Runtime/GameCode/CloneObject.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/GameCode/CloneObject.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/GameCode/CloneObject.h')
-rw-r--r--Runtime/GameCode/CloneObject.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/Runtime/GameCode/CloneObject.h b/Runtime/GameCode/CloneObject.h
new file mode 100644
index 0000000..f6ee068
--- /dev/null
+++ b/Runtime/GameCode/CloneObject.h
@@ -0,0 +1,29 @@
+#ifndef CLONEOBJECT_H
+#define CLONEOBJECT_H
+
+#include <vector>
+#include "Runtime/Utilities/vector_map.h"
+#include "Runtime/Allocator/MemoryMacros.h"
+
+class Object;
+class Vector3f;
+class Quaternionf;
+
+typedef std::pair<SInt32, SInt32> IntPair;
+typedef vector_map<SInt32, SInt32, std::less<SInt32>, STL_ALLOCATOR(kMemTempAlloc, IntPair) > TempRemapTable;
+
+/// Clones a vector objects. Cloning will clone all islands of connected objects through pptrs.
+/// This will not properly clone editorextensionimpl data and should only be used in gamemode
+/// After all objects are loaded, all gameobjects will be Activated and if the original
+/// was in an animation the clone it will be added to it
+Object& CloneObject (Object& objects);
+
+/// The same as above, but set position and rotation of the first objects' transform component.
+/// It also performs a delayed activation of all instantiated objects.
+Object& InstantiateObject (Object& objects, const Vector3f& worldPos, const Quaternionf& worldRot);
+
+/// Use these in succession if you need to setup some data prior to activation/awake
+Object& InstantiateObject (Object& inObject, const Vector3f& worldPos, const Quaternionf& worldRot, TempRemapTable& ptrs);
+void AwakeAndActivateClonedObjects (const TempRemapTable& ptrs);
+
+#endif