Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Live control of transforms for animated scenes. #9

Open
madhephaestus opened this issue Oct 20, 2022 · 4 comments
Open

Comments

@madhephaestus
Copy link

It would be desirable to bind JavaFX Transform objects to specific Dayflower Transform objects. The purpose would be to animate objects in the scene and render again.

This feature would be useful for animation software to animate and render without having to make a new scene for each frame.

This would also be VERY useful for Robotics applications. Using the virtual range finder code a robot simulation could provide virtual sensor data as fast as a real sensor. This would let roboticsts test control code in virtual environments. (I would LOVE to include this feature in BowlerStudio https://commonwealthrobotics.com/ )

@macroing
Copy link
Owner

I just added support for animations to the GPU-renderer. It does not seem to work as expected in the CPU-renderer, though.

The Scene class contains an addSceneObserver(SceneObserver) method. The SceneObserver interface now contains an onUpdate(Scene, float) method that can be implemented. You could use the AbstractSceneObserver class and only override that method, instead of implementing them all.

I'm not sure if this could be used by you, or you need something else?

An example scene, called Animation.java, has been added as well.

@madhephaestus
Copy link
Author

Thats so awesome!

An observer on the Transforms would be the easiest interface. That said i guess i can look into a stateful update. I will look closely at Animation.java when im back at work tomorrow morning.

@macroing
Copy link
Owner

The Transform class already has methods to add TransformObservers to it. But they are only called by the Transform class, when it is updated by its methods. You perhaps need some adapter class that delegates changes from the JavaFX Transform to something equivalent in its associated Dayflower Transform? Or even in both directions; from JavaFX to Dayflower and from Dayflower to JavaFX.

@madhephaestus
Copy link
Author

madhephaestus commented Oct 24, 2022

In what use case would Dayflower modify a Transform itself? I think one directional binding is sufficient. If your transform implemented

cube.localToSceneTransformProperty().addListener((value, oldValue, newValue) -> {
     System.out.println("Transformation has changed");
});

and applied that in a way that the renderer is aware, then a User can write code to attach the Dayflower transfomr to the JavaFX transform (where animations are targeted by other software to be rendered)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants