Skip to content

Commit

Permalink
[fx] Fix emitter parameters being reset when emitter was re-init in e…
Browse files Browse the repository at this point in the history
…ditor
  • Loading branch information
EspeuteClement committed Dec 19, 2024
1 parent f4cca2b commit 2512905
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 11 additions & 0 deletions hrt/prefab/fx/Emitter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,17 @@ class EmitterObject extends h3d.scene.Object {
randomValues = [for(i in 0...(maxCount * randSlots)) 0];
evaluator = new Evaluator(randomValues, randSlots);

{
var p = parent;
while (p != null && Std.downcast(p, hrt.prefab.fx.FX.FXAnimation) == null) {
p = p.parent;
}
if (p != null) {
var fx : hrt.prefab.fx.FX.FXAnimation = cast p;
@:privateAccess evaluator.parameters = fx.evaluator.parameters;
}
}

reset();
}

Expand Down
3 changes: 0 additions & 3 deletions hrt/prefab/fx/FX.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ class FXAnimation extends h3d.scene.Object {
}
}

for (emitter in this.findAll((f) -> Std.downcast(f, hrt.prefab.fx.Emitter.EmitterObject))) {
@:privateAccess emitter.evaluator.parameters = evaluator.parameters;
}

events = initEvents(root, events);
var root = hrt.prefab.fx.BaseFX.BaseFXTools.getFXRoot(def);
Expand Down

0 comments on commit 2512905

Please sign in to comment.