public override void onURL(string url) { // Remove 'gamelink:' from front string gui = Util.getSubStr(url, 9, 1024); GuiEditorGui.GuiEditContent(gui); }
public static void GE_OpenGUIFile() { GuiCanvas Canvas = "Canvas"; string openFileName = omni.console.Call_Classname("GuiBuilder", "getOpenName"); if (openFileName == "") { return; } // Make sure the file is valid. if ((!omni.Util.isFile(openFileName)) && (!omni.Util.isFile(openFileName + ".dso"))) { return; } // Allow stomping objects while exec'ing the GUI file as we want to // pull the file's objects even if we have another version of the GUI // already loaded. string oldRedefineBehavior = omni.sGlobal["$Con::redefineBehavior"]; omni.sGlobal["$Con::redefineBehavior"] = "replaceExisting"; // Load up the level. SimObject guiContent = omni.Util.eval(openFileName); omni.sGlobal["$Con::redefineBehavior"] = oldRedefineBehavior; // The level file should have contained a scenegraph, which should now be in the instant // group. And, it should be the only thing in the group. //TODO if (!guiContent.isObject()) { omni.Util.messageBox(omni.console.Call("getEngineName"), "You have loaded a Gui file that was created before this version. It has been loaded but you must open it manually from the content list dropdown", "Ok", "Information"); GuiEditorGui.GuiEditContent(Canvas.getContent().AsString()); return; } GuiEditorGui.GuiEditContent(guiContent); }
public void onOK() { GuiTextEditCtrl nameField = this.FOT("nameField"); GuiPopUpMenuCtrl classDropdown = this.FOT("classDropdown"); editor Editor = "Editor"; string name = nameField.getValue(); string className = classDropdown.getText(); // Make sure we don't clash with an existing object. // If there's an existing GUIControl with the name, ask to replace. // If there's an existing non-GUIControl with the name, or the name is invalid, refuse to create. if (name.isObject() && ((SimObject)name).isMemberOfClass("GuiControl")) { if ( Util.messageBox("Warning", "Replace the existing control '" + name + "'?", "OkCancel", "Question") == iGlobal["$MROk"]) { name.delete(); } else { return; } } if (Editor.validateObjectName(name, false)) { ((GuiCanvas)this.getRoot()).popDialog(this); SimObject obj = Util.eval("return new " + className + "(" + name + ");"); // Make sure we have no association with a filename. obj.setFilename(""); GuiEditorGui.GuiEditContent(obj); } }