Sfoglia il codice sorgente

[fxparam] Renaming param now updates all linked curves

Clement Espeute 1 anno fa
parent
commit
f17d75cbcb
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  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 old = p.name;
 						var fn = function(isUndo: Bool) {
 						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;
 							editable.value = p.name;
 							ctx.onChange(this, "parameters");
 							ctx.onChange(this, "parameters");
+							ctx.rebuildPrefab(this);
 						}
 						}
 						ctx.properties.undo.change(Custom(fn));
 						ctx.properties.undo.change(Custom(fn));
 						fn(false);
 						fn(false);