7 Replies Latest reply on Mar 15, 2013 10:01 PM by KonradZuse

    hierarchy of "nodes" in FX

      So I realized that your top level will always be STAGE... Is there anything else besides the normal STAGE?

      After stage you need to set the SCENE, is there anything else besides the normal SCENE?

      Every scene needs a PARENT ROOT which could be a control, a region, or a group.

      Within that you place everything?

      Now what I'm curious about is if I want to create a group of boxes, that was part of an even bigger group, which I just use "group" classes within each other?

      I figured you would have a scene, with many groups inside the scene, but it seems like you have 1 ROOT group, and you add groups to that ONE ROOT GROUP...

      Also what is the differences between getX() getScreenX() and getSceneX()? It seems that getX() stays constant, SceneX() works within the scene area or maybe the group area? and getScreenX() should be like getX() but might be offsetted? IT seems like this is what I got when I was doing tests with the "SphereandBox" example. Whenever I entered the "Sphere and Box" it would give me a different Scene reading(I believe), while the others stayed the same.

      From the Rectangle Builder example of "CubeSystem" in the Ensemble pack I see they extend Group, and then return itself as a group, and each was added to another group? Seems like the tutorials do that as well... :)

      Edited by: KonradZuse on Mar 13, 2013 12:10 PM
        • 1. Re: hierarchy of "nodes" in FX
          Hi. Take a look at the new javafx8 container: javafx.scene.SubScene
          • 2. Re: hierarchy of "nodes" in FX
            Now what do I do with this? Do I add it to a stage? Can you have multiple scenes per stage?

            Edited by: KonradZuse on Mar 13, 2013 3:01 PM
            • 3. Re: hierarchy of "nodes" in FX
              Anything? I aslo am curious how we exactly work mouse events... I have a Box, inside a Group, inside a scene. I would think the mouse events would register via the group, but only seems to work with the scene... I've been having lots of issues tho >(

              Edited by: KonradZuse on Mar 15, 2013 12:04 PM
              • 4. Re: hierarchy of "nodes" in FX
                A SubScene has some similar properties to a Scene - in particular a Camera, but it's a subclass of Node, not of Scene. So you cannot use a SubScene as the Scene in a Stage, but you can add it as a child to other parent nodes. Thus, as I undersatand it, you can effectively have multiple SubScenes per Stage with something like
                HBox root = new HBox();
                SubScene sscene1 = new SubScene();
                sscene1.setCamera(new PerspectiveCamera());
                SubScene sscene2 = new SubScene();
                sscene2.setCamera(new ParallelCamera());
                root.getChildren().addAll(sscene1, sscene2);
                Scene scene = new Scene(root, 800, 600, true);
                • 5. Re: hierarchy of "nodes" in FX
                  Yeah that isn't confusing terminology or anything :p.

                  Thanks james_D I appreciate it! So instead of using multiple groups, we use 1 group with multiple "subscenes" in it...?

                  Also by looking at your code you throw up 2 cams, how exactly does the computer look at each cam? Is it individually looked at as if we were a security guard looking at a bunch of security cams on the screen, or does it all work together in some craziness? :P

                  Also how does each individual cam with against the SCENE cam? Does SCENE take priority or, does it all work together? :p

                  Edited by: KonradZuse on Mar 15, 2013 12:10 PM
                  • 6. Re: hierarchy of "nodes" in FX
                    I haven't tried it (yet); probably won't for a little while. (I'm kind of waiting for the Shape3D stuff to be available on the Mac before I experiment with most of the new features.)

                    I recommend you try it and see how it plays out...
                    1 person found this helpful
                    • 7. Re: hierarchy of "nodes" in FX
                      Yeah I understand, the beta builds for 3D are having some issues, and it's all still coming together, but it's very good thus far, just some tweaks, and bug fixes needed :)

                      I'll try it out and report back to you!

                      One last thing, I remember reading somewhere that you can set the FX Window to change the child nodes when resized. I notice sometimes you can shrink/enlarge objects to fit the screen 100% of the time, and not to clip out areas, but I also notice with a camera that if you have a 3D object that when resized will change "perspective." Which I noticed is from the PerspectiveCamera, and I see you used a ParallelCam in your example, does that just stay forward? Are these connected in some way(and are there other "tasks" that you can do with the resizing of the window)? I will have to check again in the tutorials, but I know there was mention of things that happen during resize.

                      Thanks again!!!