Bläddra i källkod

[fx] Review cleanup

Clément Espeute 1 månad sedan
förälder
incheckning
163b666f7b

+ 1 - 1
hide/tools/ThumbnailGenerator.hx

@@ -280,7 +280,7 @@ class ThumbnailGenerator {
 						// Forward the animations a little bit to show something more usefull
 						if (fxAnim != null) {
 							var duration = fxAnim.duration;
-							fxAnim.setTimeInternal(duration * 0.25, 0, true, true);
+							fxAnim.seek(duration * 0.25);
 						}
 					}
 				}

+ 0 - 1
hide/view/FXEditor.hx

@@ -640,7 +640,6 @@ class FXEditor extends hide.view.FileView {
 			@:privateAccess
 			if (fxAnim != null) {
 				fxAnim.loop = v;
-				fxAnim.reset();
 				if (!fxAnim.loop) {
 					fxAnim.playState = End;
 				} else {

+ 1 - 1
hide/view/shadereditor/ShaderEditor.hx

@@ -1470,7 +1470,7 @@ class ShaderEditor extends hide.view.FileView implements GraphInterface.IGraphEd
 		var anims = meshPreviewRoot3d.findAll((f) -> Std.downcast(f, hrt.prefab.fx.FX.FXAnimation));
 		for (anim in anims) {
 			if (@:privateAccess anim.parentFX != null) {
-				@:privateAccess anim.setTimeInternal(meshPreviewScene.s3d.renderer.ctx.time % anim.duration, meshPreviewScene.s3d.renderer.ctx.elapsedTime, false);
+				@:privateAccess anim.update(meshPreviewScene.s3d.renderer.ctx.elapsedTime);
 			}
 		}
 	}

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

@@ -41,7 +41,6 @@ class FXAnimation extends h3d.scene.Object {
 		return loop;
 	}
 
-	var playStateSetLock : Int = 0;
 	function set_playState(newPlayState: FXPlayState) : FXPlayState {
 		playState = newPlayState;
 		onPlayStateChange(playState);
@@ -141,8 +140,6 @@ class FXAnimation extends h3d.scene.Object {
 			return;
 
 		for (event in events) {
-			//if (event.evt.getEventPrefab().getRoot().findFirstLocal3d() != this)
-			//	continue;
 			var nameLower = event.evt.name.toLowerCase();
 			if (nameLower == "loop") {
 				loopStart = event.evt.time;
@@ -320,7 +317,7 @@ class FXAnimation extends h3d.scene.Object {
 	/**
 		Increase the current playtime of the animation by a small ammount
 	**/
-	public function update(dt: Float, fullsync: Bool) {
+	public function update(dt: Float, fullsync: Bool = true) {
 		setTimeInternal(localTime + dt, dt, false, fullsync);
 	}
 
@@ -618,23 +615,6 @@ class FXAnimation extends h3d.scene.Object {
 			}
 		}
 
-		// var sub = Std.downcast(elt, SubFX);
-		// if (sub != null) {
-		// 	var eventLen = out?.length ?? 0;
-		// 	out = initEvents(@:privateAccess sub.resolveRef(), out);
-		// 	var fxAnimation = Std.downcast(sub.refInstance.findFirstLocal3d(), FXAnimation);
-		// 	if (fxAnimation != null) {
-		// 		fxAnimation.events = null;
-		// 	}
-		// 	if (out != null) {
-		// 		// Offset the start time of the events that were added to our array in
-		// 		// init events
-		// 		for (i in eventLen...out.length) {
-		// 			out[i].evt.time += sub.time;
-		// 		}
-		// 	}
-		// }
-
 		for(child in elt.children) {
 			out = initEvents(child, out);
 		}