html-button direct eval
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
dfd5932675
commit
84e5d33173
@ -16,5 +16,5 @@ mainPanel {
|
|||||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Show Rooms</button>
|
<button onclick="hook('ROOM_TOOL_TOGGLE')">Show Rooms</button>
|
||||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Select Furniture Spots</button>
|
<button onclick="hook('ROOM_TOOL_TOGGLE')">Select Furniture Spots</button>
|
||||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Show Furniture Spots</button>
|
<button onclick="hook('ROOM_TOOL_TOGGLE')">Show Furniture Spots</button>
|
||||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Detect Room</button>
|
<button onclick="console.log(Object.keys(engine))">Detect Room</button>
|
||||||
</div>
|
</div>
|
||||||
@ -69,15 +69,17 @@ export const clientHooks: Hook[] = [
|
|||||||
{
|
{
|
||||||
signal: "ROOM_TOOL_TOGGLE",
|
signal: "ROOM_TOOL_TOGGLE",
|
||||||
callback: (engine: Engine) => {
|
callback: (engine: Engine) => {
|
||||||
engine.singletons.loggerScripts.WARNING('asdf')
|
// engine.singletons.loggerScripts.WARNING('asdf')
|
||||||
engine.singletons.loggerScripts.WARNING(JSON.stringify(globalThis))
|
// engine.singletons.loggerScripts.WARNING(JSON.stringify(globalThis))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
signal: "ROOM_TOOL_MENU",
|
signal: "ROOM_TOOL_MENU",
|
||||||
callback: (engine: Engine) => {
|
callback: (engine: Engine) => {
|
||||||
engine.singletons.loggerScripts.WARNING('asdf')
|
console.log(JSON.stringify({}))
|
||||||
engine.singletons.loggerScripts.WARNING(JSON.stringify(globalThis))
|
console.log(Object.keys(globalThis))
|
||||||
|
// engine.singletons.loggerScripts.WARNING('asdf')
|
||||||
|
// engine.singletons.loggerScripts.WARNING(JSON.stringify(globalThis))
|
||||||
engine.classes.menuUtils.static.openDialog('Data/menu/room/roomToolConfig.html')
|
engine.classes.menuUtils.static.openDialog('Data/menu/room/roomToolConfig.html')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1844,6 +1844,7 @@ Out-of-context typescript compilation that falls back to in-context compilation
|
|||||||
Fix opengl bug
|
Fix opengl bug
|
||||||
Fix typescript out-of-context compilation caching
|
Fix typescript out-of-context compilation caching
|
||||||
Script recompilation work
|
Script recompilation work
|
||||||
|
HTML-defined buttons now directly eval in the js context instead of going through hook manager
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,5 +20,17 @@ public class ClientScriptUtils {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates a string
|
||||||
|
* @param evalCode The string to evaluate
|
||||||
|
*/
|
||||||
|
public static void eval(String evalCode){
|
||||||
|
Globals.engineState.scriptEngine.getScriptContext().executeSynchronously(() -> {
|
||||||
|
if(Globals.engineState.scriptEngine != null && Globals.engineState.scriptEngine.isInitialized()){
|
||||||
|
Globals.engineState.scriptEngine.getScriptContext().eval(evalCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ public class HtmlParser {
|
|||||||
callback = () -> {};
|
callback = () -> {};
|
||||||
} else {
|
} else {
|
||||||
callback = () -> {
|
callback = () -> {
|
||||||
ClientScriptUtils.fireSignal("uiButton", onClick);
|
ClientScriptUtils.eval(onClick);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
rVal = Button.createEmptyButton(callback);
|
rVal = Button.createEmptyButton(callback);
|
||||||
|
|||||||
@ -517,4 +517,13 @@ public class ScriptContext {
|
|||||||
fireSignal.execute(sceneInstanceId,signal,args);
|
fireSignal.execute(sceneInstanceId,signal,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates a string
|
||||||
|
* @param evalString The string
|
||||||
|
*/
|
||||||
|
public void eval(String evalString){
|
||||||
|
Source source = Source.create("js",evalString);
|
||||||
|
context.eval(source);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user