Procházet zdrojové kódy

only enable serialization on h3d with heaps_enable_serialize

ncannasse před 7 roky
rodič
revize
f27f5e1d05

+ 1 - 1
h3d/anim/Animation.hx

@@ -261,7 +261,7 @@ class Animation implements hxd.impl.Serializable {
 		return name;
 	}
 
-	#if (hxbit && !macro)
+	#if (hxbit && !macro && heaps_enable_serialize)
 	public function unserialize(ctx) {
 		super.unserialize(ctx);
 		if( objects == null ) objects = [];

+ 1 - 1
h3d/col/Collider.hx

@@ -81,7 +81,7 @@ class GroupCollider implements Collider {
 	}
 
 
-	#if (hxbit && !macro)
+	#if (hxbit && !macro && heaps_enable_serialize)
 
 	function customSerialize(ctx:hxbit.Serializer) {
 		ctx.addInt(colliders.length);

+ 1 - 1
h3d/parts/GpuParticles.hx

@@ -928,7 +928,7 @@ class GpuParticles extends h3d.scene.MultiMaterial {
 		}
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function serialize( ctx : hxbit.Serializer ) {
 		var old = primitive;
 		var oldMat = materials;

+ 2 - 2
h3d/scene/Graphics.hx

@@ -273,7 +273,7 @@ class Graphics extends Mesh {
 
 			push(u);
 			push(v);
-			
+
 			push(curR);
 			push(curG);
 			push(curB);
@@ -297,7 +297,7 @@ class Graphics extends Mesh {
 		curZ = z;
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customUnserialize(ctx:hxbit.Serializer) {
 		super.customUnserialize(ctx);
 		lineShader = material.mainPass.getShader(h3d.shader.LineShader);

+ 2 - 2
h3d/scene/Light.hx

@@ -39,10 +39,10 @@ class Light extends Object {
 	}
 
 	function getShadowDirection() : h3d.Vector {
-		return null;	
+		return null;
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customSerialize(ctx:hxbit.Serializer) {
 		super.customSerialize(ctx);
 		ctx.addDouble(color.x);

+ 1 - 1
h3d/scene/Mesh.hx

@@ -84,7 +84,7 @@ class Mesh extends Object {
 		super.dispose();
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customSerialize(ctx:hxbit.Serializer) {
 		super.customSerialize(ctx);
 		ctx.addKnownRef(primitive);

+ 1 - 1
h3d/scene/MultiMaterial.hx

@@ -54,7 +54,7 @@ class MultiMaterial extends Mesh {
 		super.draw(ctx);
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customSerialize(ctx:hxbit.Serializer) {
 		super.customSerialize(ctx);
 		ctx.addInt(materials.length);

+ 1 - 1
h3d/scene/Object.hx

@@ -899,7 +899,7 @@ class Object implements hxd.impl.Serializable {
 			c.dispose();
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	function customSerialize( ctx : hxbit.Serializer ) {
 
 		var children = [for( o in children ) if( o.allowSerialize ) o];

+ 1 - 1
h3d/scene/Scene.hx

@@ -443,7 +443,7 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 		#end
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customSerialize(ctx:hxbit.Serializer) {
 		throw this + " should not be serialized";
 	}

+ 1 - 1
h3d/scene/Skin.hx

@@ -271,7 +271,7 @@ class Skin extends MultiMaterial {
 		}
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customUnserialize(ctx:hxbit.Serializer) {
 		super.customUnserialize(ctx);
 		var prim = Std.instance(primitive, h3d.prim.HMDModel);

+ 1 - 1
h3d/scene/World.hx

@@ -583,7 +583,7 @@ class World extends Object {
 		return b;
 	}
 
-	#if hxbit
+	#if (hxbit && !macro && heaps_enable_serialize)
 	override function customUnserialize(ctx:hxbit.Serializer) {
 		super.customUnserialize(ctx);
 		allChunks = [];

+ 4 - 0
hxd/fmt/hsd/Serializer.hx

@@ -301,8 +301,12 @@ class Serializer extends hxbit.Serializer {
 
 		var objs = includeRoot ? [obj] : [for( o in obj ) if( o.allowSerialize ) o];
 		addInt(objs.length);
+		#if heaps_enable_serialize
 		for( o in objs )
 			addAnyRef(o);
+		#else
+		throw "HSD support requires -D heaps_enable_serialize";
+		#end
 
 		addBool(camera != null);
 		if( camera != null ) {

+ 1 - 1
hxd/impl/Serializable.hx

@@ -1,6 +1,6 @@
 package hxd.impl;
 
-#if (!hxbit || macro)
+#if (!hxbit || macro || !heaps_enable_serialize)
 
 // disable serialization support
 private interface NoSerializeSupport {