@@ -43,6 +43,8 @@ const defaultAppParams = {
4343 refresh : "auto"
4444}
4545
46+ const defaultCodeScript = "etc.assets.scene\\.flecs" ;
47+
4648function newAppParams ( ) {
4749 let result = structuredClone ( defaultAppParams ) ;
4850
@@ -274,6 +276,14 @@ Promise.all(components).then((values) => {
274276 // Load URL parameters
275277 this . fromUrlParams ( ) ;
276278
279+ // If code is provided, open the script inspector for it.
280+ if ( this . app_params . code !== undefined ) {
281+ if ( ! this . app_params . entities . path ) {
282+ this . app_params . entities . path = this . getCodeScriptPath ( ) ;
283+ }
284+ this . app_params . entities . inspector_tab = "Script" ;
285+ }
286+
277287 let explicitHost = true ;
278288 if ( ! this . app_params . host ) {
279289 this . app_params . host = "localhost" ;
@@ -302,7 +312,7 @@ Promise.all(components).then((values) => {
302312 if ( status == flecs . ConnectionStatus . Connected ) {
303313 if ( this . conn . mode == flecs . ConnectionMode . Wasm ) {
304314 if ( this . app_params . code ) {
305- this . conn . scriptUpdate ( "etc.assets.scene\\.flecs" , this . app_params . code , {
315+ this . conn . scriptUpdate ( this . getCodeScriptPath ( ) , this . app_params . code , {
306316 try : true
307317 } , ( ) => { } ) ;
308318 }
@@ -368,6 +378,15 @@ Promise.all(components).then((values) => {
368378 } ,
369379
370380 methods : {
381+ getCodeScriptPath ( ) {
382+ if ( this . app_params . entities && this . app_params . entities . path ) {
383+ return this . app_params . entities . path ;
384+ }
385+ if ( this . app_params . script ) {
386+ return this . app_params . script ;
387+ }
388+ return defaultCodeScript ;
389+ } ,
371390 convertTo ( type , value ) {
372391 if ( type === "undefined" ) {
373392 return value ;
0 commit comments