浏览代码

Spline: recompute tangents on backward compatibility

lviguier 5 月之前
父节点
当前提交
e42572add4
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      hrt/prefab/l3d/Spline.hx

+ 5 - 0
hrt/prefab/l3d/Spline.hx

@@ -117,6 +117,7 @@ class Spline extends hrt.prefab.Object3D {
 		points = [];
 		points = [];
 
 
 		// Backwards compatibility
 		// Backwards compatibility
+		var shouldRecomputeTan = false;
 		var children = Reflect.field(obj, "children");
 		var children = Reflect.field(obj, "children");
 		if (children != null) {
 		if (children != null) {
 			var i = children.length - 1;
 			var i = children.length - 1;
@@ -137,6 +138,7 @@ class Spline extends hrt.prefab.Object3D {
 
 
 					points.push(sp);
 					points.push(sp);
 					children.remove(children[i]);
 					children.remove(children[i]);
+					shouldRecomputeTan = true;
 				}
 				}
 				i--;
 				i--;
 			}
 			}
@@ -166,6 +168,9 @@ class Spline extends hrt.prefab.Object3D {
 		}
 		}
 
 
 		shape = obj.shape == null ? Linear : SplineShape.createByIndex(obj.shape);
 		shape = obj.shape == null ? Linear : SplineShape.createByIndex(obj.shape);
+
+		if (shouldRecomputeTan)
+			recomputeTangents();
 	}
 	}
 
 
 	override function copy(obj : hrt.prefab.Prefab) {
 	override function copy(obj : hrt.prefab.Prefab) {