BabylonJS / Editor

Community managed visual editor for Babylon.js
http://editor.babylonjs.com/
813 stars 232 forks source link

Would it make sense to also have "Add > Behaviour", "Add > Material", etc? #77

Closed julien-moreau closed 5 years ago

julien-moreau commented 5 years ago

Would it make sense to also have "Add > Behaviour", "Add > Material", etc?

julien-moreau commented 5 years ago

@Nodragem can you give me some scenarios how adding a behaviour may work ? Should it be added by default to the selected node in the graph ? Thanks :)

Nodragem commented 5 years ago

For Behaviour, you could have the option it in "Add > Behaviour", and that would open the behaviour editor and show you to which object the behaviour has been added (i.e. the selected object in scenegraph) by writing the object name on top of the editor (maybe make a small/short animation there to catch the eye). In addition to that, the scenegraph would unfold to show the newly added script, selected.

You would also have the option to right-click on any objects in the scene graph to add a script/behaviour.

I think you could follow the same idea materials and other stuffs.

julien-moreau commented 5 years ago

I added "Add Script" and "Attach Script" ("Attach" will move to the assets panel in future) I'm working on adding scripts in the scene graph

Nodragem commented 5 years ago

Very nice!

I don't want to provide bad news though, but Attach Script does not seem to work properly. I added a script named "name" to Sphere Standard, then I right-clicked on Sphere Animated (in the scenegraph) and selected "Attach Existing Script".

Here the results: image

It seems that the list is missing the script I created (named "name")?

julien-moreau commented 5 years ago

Damn! It is due to the minified JS version, works here using the non modified version (index-debug.html): image

julien-moreau commented 5 years ago

Okay just fixed :)

Nodragem commented 5 years ago

Yes it works on my side in the index-debug.html version!

By the way, I am not convinced it is a good idea to have the scripts shown within their parent object in this menu. Indeed, if you have the same script on 100 objects, you will see 100 objects with it in that menu. It makes it hard to find another script. As this menu is about selecting a script, we just need to see a list of the existing scripts I believe.

Also I can see that you already programmed a search option for the scenegraph :) that search option would be quite useful to have in the Attach Existing Script menu too (to filter the scripts, if we have 100 scripts to choose from).

julien-moreau commented 5 years ago

I planned it and it doesn't show the attached scripts. Only the source scripts Good idea for the search! Adding right now :)

julien-moreau commented 5 years ago

Done and deployed :)

Nodragem commented 5 years ago

Ho... I see, the scripts are created under a parent object, and then they can be attached to any other object, is it correct? Is it useful that they are created under a parent object though? could they be standalone?

julien-moreau commented 5 years ago

Absolutely not necessary useful. The update will come with the assets panel where the project will have a list of scripts and nodes will just have links to these scripts. You’ll be able to add new scripts using the assets panel

julien-moreau commented 5 years ago

@Nodragem done! Just added the assets panel. Now you have scripts that you can modify. You can add references to these scripts in the nodes. The context menu options are also working (add new script, attach script). Will do the same for graph editor :) What do you think?

Nodragem commented 5 years ago

Very nice addition!

For now when you select an object that has scripts attached to it, you have a list of the scripts attached to it on the left of the script text editor. Maybe when we select a script from the asset panel, we could have a list of the object using it on the left of the script text editor. You would also have the Add option to add an object to which you want to attach the script. Maybe make a button to switch from one list to another. And an option to hide the list (to only see the code).

Also, maybe highlight the currently/lastly selected asset?

Now that you have an Asset panel, maybe you want to have the material viewer integrated to it instead of being a separated panel. Same thing with Textures and maybe other stuffs?

Concerning the right-click menu of the Assets, it looks weird on my machine: image

Finally, it could be nice to see the script attached to an object in the Scenegraph. Then you could also be able to attach a script by drag-and-drop a script from the Asset panel on a object in the Scenegraph panel.

julien-moreau commented 5 years ago

Good catch! Will try to reproduce and fix ASAP :) Good idea! Will implement the attached nodes list on the next update :)

Nodragem commented 5 years ago

hi, I still experienced the right click bug earlier this week, how are thing going?

julien-moreau commented 5 years ago

Unfortunately I never reproduced the bug :( Tried different ppi configurations etc but did not reproduce :( If you are familiar with css and blabla, do you mind to try to fix and pull request ? I would appreciate a lot :)

julien-moreau commented 5 years ago

@Nodragem I'm focusing on opened issues, do you mind trying to fix that CSS issue ? I still cannot reproduce unfortunately :'(

julien-moreau commented 5 years ago

Fixed! will be released for 2.5.3