Ver código fonte

Change the save and load function from prefab, for macros

ShiroSmith 5 anos atrás
pai
commit
5a570def1b
2 arquivos alterados com 4 adições e 4 exclusões
  1. 2 1
      hrt/prefab/Object3D.hx
  2. 2 3
      hrt/prefab/Prefab.hx

+ 2 - 1
hrt/prefab/Object3D.hx

@@ -41,6 +41,7 @@ class Object3D extends Prefab {
 	}
 
 	override function load( obj : Dynamic ) {
+		super.load(obj);
 		x = obj.x == null ? 0. : obj.x;
 		y = obj.y == null ? 0. : obj.y;
 		z = obj.z == null ? 0. : obj.z;
@@ -65,7 +66,7 @@ class Object3D extends Prefab {
 	}
 
 	override function save() {
-		var o : Dynamic = {};
+		var o : Dynamic = super.save();
 		if( x != 0 ) o.x = x;
 		if( y != 0 ) o.y = y;
 		if( z != 0 ) o.z = z;

+ 2 - 3
hrt/prefab/Prefab.hx

@@ -110,15 +110,14 @@ class Prefab {
 		Override to implement your custom prefab data loading
 	**/
 	function load( v : Dynamic ) {
-		throw "Not implemented";
+
 	}
 
 	/**
 		Override to implement your custom prefab data saving
 	**/
 	function save() : {} {
-		throw "Not implemented";
-		return null;
+		return {};
 	}
 
 	/**