Browse Source

[fxparam] Renaming param now updates all linked curves

Clement Espeute 1 year ago
parent
commit
f17d75cbcb
1 changed files with 13 additions and 1 deletions
  1. 13 1
      hrt/prefab/fx/FX.hx

+ 13 - 1
hrt/prefab/fx/FX.hx

@@ -630,9 +630,21 @@ class FX extends Object3D implements BaseFX {
 
 						var old = p.name;
 						var fn = function(isUndo: Bool) {
-							p.name = isUndo ? old : v;
+							var from = isUndo ? v : old;
+							var to = isUndo ? old : v;
+							p.name = to;
+
+							// rename all curves that used this param as a blendParam
+							var curves = flatten(Curve);
+							for (c in curves) {
+								if (c.blendMode == Blend && c.blendParam == from) {
+									c.blendParam = to;
+								}
+							}
+
 							editable.value = p.name;
 							ctx.onChange(this, "parameters");
+							ctx.rebuildPrefab(this);
 						}
 						ctx.properties.undo.change(Custom(fn));
 						fn(false);