瀏覽代碼

don't create spline points at runtime

Nicolas Cannasse 4 年之前
父節點
當前提交
c69eccce4b
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      hrt/prefab/l3d/Spline.hx

+ 8 - 4
hrt/prefab/l3d/Spline.hx

@@ -55,6 +55,7 @@ class SplinePoint extends Object3D {
 	}
 
 	override function makeInstance(ctx:Context):Context {
+		#if editor
 		ctx = ctx.clone(this);
 		ctx.local3d = createObject(ctx);
 		pointViewer = new h3d.scene.Mesh(h3d.prim.Sphere.defaultUnitSphere(), null, ctx.local3d.getScene());
@@ -103,6 +104,7 @@ class SplinePoint extends Object3D {
 			pointViewer.remove();
 		}
 		updateInstance(ctx);
+		#end
 		return ctx;
 	}
 
@@ -121,10 +123,10 @@ class SplinePoint extends Object3D {
 				spline.editor.setSelected(spline.editor.editContext.getContext(spline), true);
 				spline.editor.update(spline.editor.editContext.getContext(spline));
 			}
+			for (sp in spline.points) {
+				sp.computeName(ctx);
+			}
 		#end
-		for (sp in spline.points) {
-			sp.computeName(ctx);
-		}
 	}
 
 	override function removeInstance( ctx : Context) : Bool {
@@ -137,12 +139,14 @@ class SplinePoint extends Object3D {
 		return super.removeInstance(ctx);
 	}
 
+
+	#if editor
+
 	public function computeName(ctx) {
 		name = "SplinePoint" + spline.points.indexOf(this);
 		ctx.local3d.name = name;
 	}
 
-	#if editor
 	override function edit(ctx : EditContext) {
 		super.edit(ctx);
 		if( spline.editor == null ) {