Load and edit custom Controls in SceneComposer

Hi,



I added a preliminary version of a pretty big improvement to the way scenes are loaded. You can now use Controls that you have in your code or that are contained in libraries of your project directly in the SceneComposer. Actually all kinds of classes that are in your project can be used directly in the editors now. Just make sure you have “compile on save” enabled in your project settings under “Build->Compiling” so you don’t have to build your project after each change. At the moment the scene has to be reopened to reflect changes in the code but its already a quite convenient way to test code of Controls.



In this example I created a simple Control class in my project, added it to the sword of Sinbad via the new “Custom Control” entry in the SceneExplorer “Add Control” menu and then directly saw the movement caused by the Control and its parameters.





Update:

Heres a video example on how to make a simple windmill with it (IDE in dev mode is a bit slow with assertions enabled and video recording):

http://www.youtube.com/watch?v=MNDiZ9YHIpM



Update2:

Scenes are now automatically reloaded when a class has changed, this way the effects of changes in the code can be directly observed in the scene.



Cheers,

Normen

13 Likes

I wonder what kind of Controls are abstract enough to be used like this … Any ideas?

A control containing data, or one that controls an entity like a VehicleControl or CharacterControl or extensions of these. You don’t necessarily have to “use” it in the SceneComposer, maybe you just want to save it along with your j3o with prepared data. A good, simple example might be the turning wind blades of a windmill, I’ll post a video on that some time, I have that lying around from my very very first AI-driven game ^^ Its about generally being able to use classes of the project in the editors.

2 Likes

For turning a windmill you should use the new SpatialAnimation system



Also, stop giving yourself +1 normen, its not appropriate.

Added a short video on how to create a windmill without the new SpatialAnimation system :stuck_out_tongue:

Neat!!



@Momoko_Fan, speaking of the new Spatial animation system, the API is way to complicated IMO. It’s not like Bone animation that’s gonna be loaded from a file, people will actually want to create it from code. To do the equivalent of what Normen did with SpatialAnimation right now is a bit bloated …

wow! cool!



I hope its not too silly to ask what’s the new Spatial animation system is and what’s it for? :slight_smile:



@normen I’ve always under the impression that I am the only one who is suffering from NetBeans slowdown and occasional dfkasjdofjasodf. Now, I see the same things happens to you. So, don’t you think the more you add to jMP the slower/the more crash prone it will be? Why not make the Scene Editor a complete stand alone module? a rather light version?

The ide is so slow in the video because its run in the development IDE with assertions enabled as written in the description. I don’t excatly know what you mean by that random character combination though.

Great way of integrating controls in the editor! I think a lot of generic controls can be coded this way and its also a nice way of testing basic behaviour without having restart you own application all the time, much like particles. I guess where it becomes harder to use is if your control needs some initialisation besides simple properties, like how it should interact with other objects in the scene. Although this is also possible through the use of strings to locate objects in the scene. For example if the windmill object itself should start vibrating if the speed is very high. :slight_smile:



Other examples I can think of that I know I will try out in my game soon:


  • Animation to simulate rocking of a boat on the sea (e.g. using two parameters to adjust rocking amount for x and z axis)
  • Animation to simulate a soaring bird in the sky (even the ability to birds behaviour based on other birds in the scene through parent lookup to make e.g. “follow the leader” behaviour)



    I guess a problem could be that objects that also exists in physics space shouldnt use translate or rotate calls on the spatial itself but its equivalent physics space.
1 Like

So, you don’t get any slowdown from jMP or NetBeans related stuff? I suffer from very frequent slow down ,crashed and freezes. Sometimes I get around the slowdown by setting jMP program on high priority. But, then even VLC player starts stuttering.

We can even have/create a generic control library from the community. :smiley:

@johncl said:
I guess where it becomes harder to use is if your control needs some initialisation besides simple properties, like how it should interact with other objects in the scene.

Yeah, I plan to add base Applications that have some limited way to communicate with the IDE so these kinds of things become easier as well. Think like an ApplicationHarness for the IDE. You can also use this with physics controls btw, thats why I added the little physics play/stop buttons. Things like little entities with CharacterControls that chase each other or smth should be completely doable in the SceneComposer now. Also something like a "WaterControl" that simulates buoyancy for physics objects would be a useful and possible Control that can be used with this.
@iamcreasy said:
So, you don't get any slowdown from jMP or NetBeans related stuff?

I get some slowdown when the OpenGL window is opened, especially with the new AWT workaround in place, mostly its due to the OpenGL and AWT thread fighting though. Also some things are done in an over-safe way or unnecessarily blocking like some of the new camera and material editor options like the Front/Side view thing and the texture preview in the MaterialEditor. Other than that NetBeans sometimes thrashes up some memory due to code scanning, normally only when I have lots of / large projects open.. Crashes or freezes are only happening with the OpenGL window open for me, lwjgl needs to get their act together here ^^ The thing that was most annoying in the video is that I have to click once in the OpenGL window for the dragging etc to work.. Gotta change that to take focus on mouseover..

I have learned that Java on a 32bit OS = crashes and out of memory troubles. Generally it seems that Java on 32bit is being somewhat neglected and ignored. People (including me) have a lot of problems with e.g. Minecraft, proabably because most developers sit on 12GB memory 64bit OS machines these days and never see the problems others have with 32bit OS’s. Rather than fight the problem I plan to move onto 64bit myself as its getting rather tiresome to get into these problems when developing myself. jMonkey always locks completely up if I let the IDE be open over the night.

Yeh, I am running on 64bit OS and everything else is 32bit. That might cause some instability I’m facing.

Added a screen with a list of results from a scan for classes that extend AbstractControl or implement Control for easy selection:

A very welcome addition, it’s going to help simplify things a lot, great work normen :smiley:

i would also like to know about this new SpatialAnimation system that has been mentioned.

great job!!!

Thanks, SpatialAnimation is only interesting when loading animations from some other animation application. The blender importer uses it for object animation.

Really god job! This is a vary useful feature.



Thanks normen

Thanks Normen. This is a very nice feature.