Advanced Controls and the Scene Composer

Hi there,

I’m a big fan of the Jme composer. I am trying to use the Custom Controls to set the material of the object in the scene.

Is it possible for the control to have access to the asset manager within the scene composer?

I will say “Yes” by adding your own method where you send the AssetManager’s instance as a parameter.

Just know that you will have to program the rest of your game to know that that control has that added ability. edit: And if you are using it to dynamically load Assets… er… just make sure to account for a lot of “resource not loaded yet” in code.

Other than that… the question becomes more… “Should you?” and that is up to you.

The spirit of a “Control” pretty much equates to “Automated Update Thingy” to me… I like Appstate for anything like: “triggered behavior” or “events”

Does this help?

edit: I’m on netbeans, atm, so I’m having a hard time remembering my JME stuff. So I may be Waaaaaay off. lol

What Im attempting to do is have it work directly in the scene composer. I can attempt to pass it in the constructor, but technically, there is no application (Im actually unsure how the scene composer works under the hood) but it doesn’t like that at all.

I have no doubt that I could do this at run time. Id just like to use a primitive cube and simply change the material of many linked objects.

You can access the AssetManager in the read() method of a Savable but when you add it in the SceneComposer you’d have to create your own “Add Spatial” action for the SceneComposer (which isn’t that hard really) or use an AppState on the scene that looks for Controls that don’t have an AssetManager assigned yet.

@normen

I think the app state route sounds more attractive.

Is this possible with the scene editor already, having an appstate run within the scenecomposer?

Yes, just right-click the AppState and select “Run in Scene”

Awesome, @BigBob!

Good luck! And make sure to strut your stuff, and show off the cool things you do with your game! I’d love to see it all in motion, and whirly with the textures!

Game On,
Charles

Note that when you open a j3o the read() method is always executed though, so if you just add the Control once it would always be able to get the AssetManager on subsequent loads of the j3o file.

Well my plans are essentials (and we discussed this before) is to use the primitive cube object in the asset pack

and create a bunch of different objects by linking it over and over again. Then I just add a control to give it the proper control to materialize it.

Imagine a windmill

The building is a cube that simply needs to get its material set.
Another cube for the door as a another material.
Then 2 cubes stretched to rectangles as blades which will be set material and spinning.

I want to be able to visualize all this in the scene composer using.

This way I can just use the one cube model, link it over and over, and have a fully functional and visual windmill.

Im sure with this advice I can pull it off and use the scenecomposer to its full potential.

Using single objects for every nook and cranny isn’t really a good idea as the object count is what drives the performance down. But for what you want to do it sounds as if you shouldn’t do this with a control at all but simply use an AppState that manages that.