diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png new file mode 100644 index 000000000..381dcee84 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png new file mode 100644 index 000000000..3f83a2ff3 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png new file mode 100644 index 000000000..cbaf56990 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png new file mode 100644 index 000000000..6b285daae Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png new file mode 100644 index 000000000..ffeb015f1 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png new file mode 100644 index 000000000..7fdb61d1b Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png new file mode 100644 index 000000000..0e6c456a6 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png new file mode 100644 index 000000000..316cb2c83 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png new file mode 100644 index 000000000..1a2433dea Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png new file mode 100644 index 000000000..f65bccb39 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png new file mode 100644 index 000000000..9705c33d8 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png new file mode 100644 index 000000000..95ef798ee Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml new file mode 100644 index 000000000..a442ab0a8 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui new file mode 100644 index 000000000..eb2bf15e6 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui @@ -0,0 +1,217 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(GameObjectCreator) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + selectedEntity = "20054"; + + new GuiWindowCtrl(CreateGameObjectWindow) { + text = "Create GameObject"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(GameObjectCreator);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 322"; + extent = "368 123"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(GameObjectCreateBtn) { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 92"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_importAssetWindow.ImportAssets();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 92"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(GameObjectCreator);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(GameObjectCreatorObjectName) { + text = "Game Object Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 60"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(GameObjectCreatorPkgBtn) { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_addModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(GameObjectModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + text = "Characters"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(GameObjectCreatorName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "116 60"; + extent = "234 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui new file mode 100644 index 000000000..e8f35a13a --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui @@ -0,0 +1,142 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_AddModule) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + Enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_addModuleWindow) { + text = "Create New Module"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "88 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ModuleName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Module Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "72 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addModuleWindow.CreateNewModule();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addModuleWindow.Close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui new file mode 100644 index 000000000..48a48f5be --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui @@ -0,0 +1,142 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_AddPackage) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + Enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_addPackageWindow) { + text = "Create New Package"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "88 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "PackageName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Package Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "72 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addPackageWindow.CreateNewPackage();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addPackageWindow.Close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui new file mode 100644 index 000000000..fd06f7561 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -0,0 +1,934 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + AddNewArtAssetPopup = "18801"; + AddNewAssetPopup = "18802"; + AddNewScriptAssetPopup = "18800"; + currentPreviewPage = "0"; + enabled = "1"; + importAssetFinalListArray = "20465"; + importAssetNewListArray = "20463"; + importAssetUnprocessedListArray = "20464"; + totalPages = "1"; + + new GuiWindowCtrl(AssetBrowser_addFilterWindow) { + text = "Create New Tag"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "321 334"; + extent = "381 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "64 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "tagName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Tag Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "52 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "64 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.createFilter( AssetBrowser_addFilterWindow-->tagName.getText() );AssetBrowser_addFilterWindow.setVisible(0);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "196 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addFilterWindow.setVisible(0);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiWindowCtrl(AssetBrowserWindow) { + text = "Asset Browser"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "AssetBrowser::hideDialog();"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "256 107"; + extent = "512 554"; + minExtent = "383 274"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(CreateAssetButton) { + text = "New"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "3 22"; + extent = "45 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ImportAssetButton) { + text = "Import"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "50 22"; + extent = "45 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiWindowCtrl(TagFilterWindow) { + text = "New Window"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + docking = "None"; + margin = "4 4 4 4"; + padding = "0 0 0 0"; + anchorTop = "0"; + anchorBottom = "0"; + anchorLeft = "0"; + anchorRight = "0"; + position = "129 62"; + extent = "161 250"; + minExtent = "161 86"; + horizSizing = "windowRelative"; + vertSizing = "windowRelative"; + profile = "ToolsGuiToolbarWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "VisibilityLayerWindow"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "2 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 9"; + extent = "159 238"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl(TagFilterList) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "-2"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "3 1"; + extent = "153 16"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "theVisOptionsList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiSplitContainer() { + orientation = "Vertical"; + splitterSize = "2"; + splitPoint = "149 100"; + fixedPanel = "None"; + fixedSize = "356"; + docking = "None"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "3 42"; + extent = "505 509"; + minExtent = "64 64"; + horizSizing = "relative"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPanel() { + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 509"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Panel1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 31"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Filters"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "30 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconNew.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "113 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.viewTagsFilter();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Show assets grouped and filtered via tags."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconList.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "130 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.viewListFilter();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Views assets via module-oriented list tree."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 17"; + extent = "147 493"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 493"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiEditorScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiDefaultProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTreeViewCtrl(AssetBrowserFilterTree) { + tabSize = "16"; + textOffset = "2"; + fullRowSelect = "0"; + itemHeight = "21"; + destroyTreeOnSleep = "1"; + mouseDragging = "1"; + multipleSelections = "1"; + deleteObjectAllowed = "1"; + dragToItemAllowed = "1"; + clearAllOnSingleSelection = "1"; + showRoot = "1"; + useInspectorTooltips = "0"; + tooltipOnWidthOnly = "0"; + showObjectIds = "1"; + showClassNames = "1"; + showObjectNames = "1"; + showInternalNames = "1"; + showClassNameForUnnamedObjects = "0"; + compareToObjectID = "1"; + canRenameObjects = "1"; + renameInternal = "0"; + position = "1 1"; + extent = "145 294"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTreeViewProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "filterTree"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + }; + new GuiPanel() { + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "151 0"; + extent = "354 509"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "panel2"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 0"; + extent = "354 41"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/new"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "42 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.createNewAsset();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Create New Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/delete"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "23 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showDeleteDialog();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(AssetBrowserSearchFilter) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "\c2Filter..."; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 19"; + extent = "273 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserSearchFilterText"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(TagFilterButton) { + bitmap = "tools/gui/images/visible"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "4 19"; + extent = "20 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.toggleTagFilterPopup();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Assets"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "53 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/delete"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "337 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showDeleteDialog();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "1"; + position = "1 40"; + extent = "354 468"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl(AssetListPanel) { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "354 448"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiEditorScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiDefaultProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl() { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "0"; + position = "1 1"; + extent = "352 254"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiModelessDialogProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiControl() { + position = "0 0"; + extent = "352 4"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiDynamicCtrlArrayControl() { + colCount = "3"; + colSize = "100"; + rowCount = "2"; + rowSize = "124"; + rowSpacing = "2"; + colSpacing = "2"; + frozen = "0"; + autoCellSize = "1"; + fillRowFirst = "1"; + dynamicSize = "1"; + padding = "0 0 0 0"; + position = "3 4"; + extent = "352 250"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "materialSelection"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiContainer() { + docking = "Bottom"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 448"; + extent = "354 20"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "materialPreviewControlContainer"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "242 491"; + extent = "53 19"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "SelectButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "300 491"; + extent = "52 19"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.hideDialog();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui new file mode 100644 index 000000000..199ad91b8 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui @@ -0,0 +1,613 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetImportCtrl) { + position = "0 0"; + extent = "1440 900"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(ImportAssetOptionsWindow) { + text = "Import Options"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "633 358"; + extent = "346 409"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "271 377"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetOptionsWindow.saveAssetOptions();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 26"; + extent = "326 344"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(ImportOptionsList) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "309 64"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiWindowCtrl(ImportAssetConfigEditorWindow) { + text = "Import Options Config"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "562 251"; + extent = "376 503"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Configuration Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "10 26"; + extent = "100 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(AssetImportConfigName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "113 25"; + extent = "250 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "301 471"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.saveAssetOptionsConfig();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 50"; + extent = "356 414"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(ImportOptionsConfigList) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "339 64"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiWindowCtrl(ImportAssetWindow) { + text = "Import Assets"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "536 205"; + extent = "368 502"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 470"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetWindow.ImportAssets();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 470"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ImportAssetModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_addModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Module"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Import Options Config:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 56"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ImportAssetConfigList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "126 53"; + extent = "175 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "305 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.addNewConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconInformation.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "325 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.editConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Edit Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconDelete.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "346 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.deleteConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 82"; + extent = "348 381"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl(ImportingAssetList) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "1 1"; + extent = "345 20"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui new file mode 100644 index 000000000..45d411f20 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui @@ -0,0 +1,147 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_editAsset) { + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_editAssetWindow) { + text = "Asset Properties"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "1"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_editAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "710 375"; + extent = "500 329"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 21"; + extent = "498 283"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiInspector(AssetEditInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "481 101"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiInspectorProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Save"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "402 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_editAsset.saveAsset();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "450 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_editAsset);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui new file mode 100644 index 000000000..90ff639dd --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui @@ -0,0 +1,147 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_editModule) { + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_editModuleWindow) { + text = "Module Properties"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "1"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_editModule);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "710 375"; + extent = "500 329"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 21"; + extent = "498 283"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiInspector(ModuleEditInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "481 101"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiInspectorProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Save"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "402 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_editModule.saveModule();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "450 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_editModule);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui new file mode 100644 index 000000000..09fcb997d --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui @@ -0,0 +1,237 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_newAsset) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_newAssetWindow) { + text = "Create Asset"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_newAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 140"; + extent = "368 450"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(NewAssetCreateBtn) { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "227 419"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "CreateNewAsset();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "295 419"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_newAssetWindow.onClose();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(NewAssetModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(NewAssetModuleBtn) { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiControl(NewComponentAssetSettings) { + position = "12 120"; + extent = "344 107"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOn"; + vScrollBar = "alwaysOn"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "7 56"; + extent = "354 357"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(NewAssetPropertiesInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "337 338"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui new file mode 100644 index 000000000..65896dccc --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui @@ -0,0 +1,434 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_newComponentAsset) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_newComponentAssetWindow) { + text = "Create Component"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_newComponentAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 250"; + extent = "368 268"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "NewComponentModuleList"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "NewComponentModuleBtn"; + class = "NewAssetModuleBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Component Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 83"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 83"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Parent Component:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 57"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ParentComponentList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 54"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "NewAssetTypeList.onSelected();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentFriendlyName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 109"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Friendly Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 109"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentGroup) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 134"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Component Group:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 134"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 159"; + extent = "203 64"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiMLTextEditCtrl(NewComponentDescription) { + lineSpacing = "2"; + allowColorChars = "0"; + maxChars = "-1"; + useURLMouseCursor = "0"; + position = "1 0"; + extent = "201 64"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTextCtrl() { + text = "Description:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 159"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 240"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "createNewComponentAsset();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 240"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_newComponentAsset);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui new file mode 100644 index 000000000..a1c4293ab --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui @@ -0,0 +1,144 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_SelectModule) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_SelectModuleWindow) { + text = "Select Module"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "39 34"; + extent = "217 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserModuleList"; + internalName = "ModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "260 32"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + class = "SelectPackage_NewAssetModuleBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_SelectModule);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_addModule);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui new file mode 100644 index 000000000..055763d35 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui @@ -0,0 +1,144 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_SelectPackage) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_SelectPackageWindow) { + text = "Select Package"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "39 34"; + extent = "217 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserPackageList"; + internalName = "PackageList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "260 32"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + class = "SelectPackage_NewAssetPackageBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_SelectPackage);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_addPackage);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.cs b/Templates/BaseGame/game/tools/assetBrowser/main.cs new file mode 100644 index 000000000..32ae4682f --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/main.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +if( !isObject( ToolsGuiDefaultNonModalProfile ) ) +new GuiControlProfile (ToolsGuiDefaultNonModalProfile : ToolsGuiDefaultProfile) +{ + modal = false; +}; + +function initializeAssetBrowser() +{ + echo(" % - Initializing Asset Browser"); + + exec("./guis/assetBrowser.gui"); + exec("./guis/addModuleWindow.gui"); + exec("./guis/gameObjectCreator.gui"); + exec("./guis/newAsset.gui"); + exec("./guis/newComponentAsset.gui"); + exec("./guis/editAsset.gui"); + exec("./guis/assetImport.gui"); + exec("./guis/selectModule.gui"); + exec("./guis/editModule.gui"); + + exec("./scripts/assetBrowser.cs"); + exec("./scripts/popupMenus.cs"); + exec("./scripts/addModuleWindow.cs"); + exec("./scripts/assetImport.cs"); + exec("./scripts/assetImportConfig.cs"); + exec("./scripts/gameObjectCreator.cs"); + exec("./scripts/newAsset.cs"); + exec("./scripts/editAsset.cs"); + exec("./scripts/editModule.cs"); + + exec("./scripts/fieldTypes.cs"); + + new ScriptObject( AssetBrowserPlugin ) + { + superClass = "EditorPlugin"; + }; + + Input::GetEventManager().subscribe( AssetBrowser, "BeginDropFiles" ); + Input::GetEventManager().subscribe( AssetBrowser, "DropFile" ); + Input::GetEventManager().subscribe( AssetBrowser, "EndDropFiles" ); + + AssetBrowser.buildPopupMenus(); +} + +function AssetBrowserPlugin::onWorldEditorStartup( %this ) +{ + // Add ourselves to the toolbar. + AssetBrowser.addToolbarButton(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs new file mode 100644 index 000000000..784ed7d63 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs @@ -0,0 +1,112 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function AssetBrowser_addModuleWindow::onGainFirstResponder(%this) +{ + %this-->moduleName.setFirstResponder(); +} + +function AssetBrowser_addModuleWindow::close() +{ + Canvas.popDialog(AssetBrowser_addModule); + eval(AssetBrowser_addModuleWindow.callbackFunction); +} + +function AssetBrowser_addModuleWindow::CreateNewModule(%this) +{ + %newModuleName = %this-->moduleName.getText(); + + if(%newModuleName $= "") + return; + + echo("Creating a new Module named: " @ %newModuleName); + + %moduleFilePath = "data/" @ %newModuleName; + %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module"; + %moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".cs"; + + %newModule = new ModuleDefinition() + { + ModuleId = %newModuleName; + versionId = 1; + ScriptFile = %newModuleName @ ".cs"; + CreateFunction="onCreate"; + DestroyFunction="onDestroy"; + Group = "Game"; + + new DeclaredAssets() + { + Extension = "asset.taml"; + Recurse = true; + }; + }; + + TAMLWrite(%newModule, %moduleDefinitionFilePath); + + //Now generate the script file for it + %file = new FileObject(); + + if(%file.openForWrite(%moduleScriptFilePath)) + { + %file.writeline("function " @ %newModuleName @ "::onCreate(%this)\n{\n\n}\n"); + %file.writeline("function " @ %newModuleName @ "::onDestroy(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //force a refresh of our modules list + ModuleDatabase.ignoreLoadedGroups(true); + ModuleDatabase.scanModules(); + %success = ModuleDatabase.loadExplicit(%newModuleName, 1); + ModuleDatabase.ignoreLoadedGroups(false); + + //force a reload of the Module lists + NewAssetModuleList.refresh(); + GameObjectModuleList.refresh(); + ImportAssetModuleList.refresh(); + + AssetBrowser.newModuleId = %newModuleName; + + Canvas.popDialog(AssetBrowser_addModule); + eval(AssetBrowser_addModuleWindow.callbackFunction); +} + +function AssetBrowserModuleList::onWake(%this) +{ + %this.refresh(); +} + +function AssetBrowserModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs new file mode 100644 index 000000000..90d999b8e --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs @@ -0,0 +1,110 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function AssetBrowser_addPackageWindow::onGainFirstResponder(%this) +{ + %this-->packageName.setFirstResponder(); +} + +function AssetBrowser_addPackageWindow::close() +{ + Canvas.popDialog(AssetBrowser_addPackage); + eval(AssetBrowser_addPackageWindow.callbackFunction); +} + +function AssetBrowser_addPackageWindow::CreateNewPackage(%this) +{ + %newPackageName = %this-->packageName.getText(); + + if(%newPackageName $= "") + return; + + echo("Creating a new package named: " @ %newPackageName); + + %moduleFilePath = "data/" @ %newPackageName; + %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".module"; + %moduleScriptFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".cs"; + + %newPackage = new ModuleDefinition() + { + ModuleId = %newPackageName; + versionId = 1; + ScriptFile = %newPackageName @ ".cs"; + CreateFunction="onCreate"; + DestroyFunction="onDestroy"; + Group = "Game"; + + new DeclaredAssets() + { + Extension = "asset.taml"; + Recurse = true; + }; + }; + + TAMLWrite(%newPackage, %moduleDefinitionFilePath); + + //Now generate the script file for it + %file = new FileObject(); + + if(%file.openForWrite(%moduleScriptFilePath)) + { + %file.writeline("function " @ %newPackageName @ "::onCreate(%this)\n{\n\n}\n"); + %file.writeline("function " @ %newPackageName @ "::onDestroy(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //force a refresh of our modules list + ModuleDatabase.ignoreLoadedGroups(true); + ModuleDatabase.scanModules(); + %success = ModuleDatabase.loadExplicit(%newPackageName, 1); + ModuleDatabase.ignoreLoadedGroups(false); + + //force a reload of the package lists + NewAssetPackageList.refresh(); + GameObjectPackageList.refresh(); + ImportAssetPackageList.refresh(); + + Canvas.popDialog(AssetBrowser_addPackage); + eval(AssetBrowser_addPackageWindow.callbackFunction); +} + +function AssetBrowserPackageList::onWake(%this) +{ + %this.refresh(); +} + +function AssetBrowserPackageList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs new file mode 100644 index 000000000..0979f219e --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs @@ -0,0 +1,1304 @@ + +new SimGroup(AssetBrowserPreviewCache); + +//AssetBrowser.addToolbarButton +function AssetBrowser::addToolbarButton(%this) +{ + %filename = expandFilename("tools/gui/images/iconOpen"); + %button = new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = AssetBrowserBtn; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "180 0"; + Extent = "25 19"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "AssetBrowser.ShowDialog();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Asset Browser"; + hovertime = "750"; + bitmap = %filename; + bitmapMode = "Centered"; + buttonType = "PushButton"; + groupNum = "0"; + useMouseEvents = "0"; + }; + ToolsToolbarArray.add(%button); + EWToolsToolbar.setExtent((25 + 8) * (ToolsToolbarArray.getCount()) + 12 SPC "33"); +} +// +function AssetBrowser::onAdd(%this) +{ + %this.isReImportingAsset = false; +} + +function AssetBrowser::onWake(%this) +{ + %this.importAssetNewListArray = new ArrayObject(); + %this.importAssetUnprocessedListArray = new ArrayObject(); + %this.importAssetFinalListArray = new ArrayObject(); +} + +//Drag-Drop functionality +function AssetBrowser::selectAsset( %this, %asset ) +{ + if(AssetBrowser.selectCallback !$= "") + { + // The callback function should be ready to intake the returned material + //eval("materialEd_previewMaterial." @ %propertyField @ " = " @ %value @ ";"); + if( AssetBrowser.returnType $= "name" ) + { + eval( "" @ AssetBrowser.selectCallback @ "(" @ %name @ ");"); + } + else + { + %command = "" @ AssetBrowser.selectCallback @ "(\"" @ %asset @ "\");"; + eval(%command); + } + } + else + { + //try just setting the asset + %this.changeAsset(); + } + + Inspector.refresh(); + + AssetBrowser.hideDialog(); +} + +function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %targetObj, %fieldName, %returnType) +{ + // Set the select callback + AssetBrowser.selectCallback = %selectCallback; + AssetBrowser.returnType = %returnType; + AssetBrowser.assetTypeFilter = %AssetTypeFilter; + AssetBrowser.fieldTargetObject = %targetObj; + AssetBrowser.fieldTargetName = %fieldName; + + Canvas.add(AssetBrowser); + AssetBrowser.setVisible(1); + AssetBrowserWindow.setVisible(1); + AssetBrowserWindow.selectWindow(); + + if(%selectCallback $= "") + { + //we're not in selection mode, so just hide the select button + %this-->SelectButton.setHidden(true); + } + else + { + %this-->SelectButton.setHidden(false); + } + + //AssetBrowser_importAssetWindow.setVisible(0); + //AssetBrowser_importAssetConfigWindow.setVisible(0); + AssetBrowser.loadFilters(); +} + +function AssetBrowser::hideDialog( %this ) +{ + AssetBrowser.setVisible(1); + AssetBrowserWindow.setVisible(1); + Canvas.popDialog(AssetBrowser_addModule); + Canvas.popDialog(ImportAssetWindow); + + Canvas.popDialog(AssetBrowser); +} + +function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName ) +{ + %assetDesc = AssetDatabase.acquireAsset(%asset); + %assetName = AssetDatabase.getAssetName(%asset); + %previewImage = "core/art/warnmat"; + + AssetPreviewArray.empty(); + + // it may seem goofy why the checkbox can't be instanciated inside the container + // reason being its because we need to store the checkbox ctrl in order to make changes + // on it later in the function. + + %previewSize = "80 80"; + %previewBounds = 20; + + %assetType = AssetDatabase.getAssetType(%asset); + + %container = new GuiControl(){ + profile = "ToolsGuiDefaultProfile"; + Position = "0 0"; + Extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24; + HorizSizing = "right"; + VertSizing = "bottom"; + isContainer = "1"; + assetName = %assetName; + moduleName = %moduleName; + assetType = %assetType; + }; + + %tooltip = %assetName; + + if(%assetType $= "ShapeAsset") + { + %previewButton = new GuiObjectView() + { + className = "AssetPreviewControl"; + internalName = %matName; + HorizSizing = "right"; + VertSizing = "bottom"; + Profile = "ToolsGuiDefaultProfile"; + position = "7 4"; + extent = %previewSize; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + renderMissionArea = "0"; + GizmoProfile = "GlobalGizmoProfile"; + cameraZRot = "0"; + forceFOV = "0"; + gridColor = "0 0 0 0"; + renderNodes = "0"; + renderObjBox = "0"; + renderMounts = "0"; + renderColMeshes = "0"; + selectedNode = "-1"; + sunDiffuse = "255 255 255 255"; + sunAmbient = "180 180 180 255"; + timeScale = "1.0"; + fixedDetail = "0"; + orbitNode = "0"; + + new GuiBitmapButtonCtrl() + { + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "0 0"; + extent = %previewSize; + Variable = ""; + buttonType = "ToggleButton"; + bitmap = "tools/materialEditor/gui/cubemapBtnBorder"; + groupNum = "0"; + text = ""; + }; + }; + + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + + %previewButton.setModel(%asset.fileName); + //%previewButton.refreshShape(); + //%previewButton.currentDL = 0; + //%previewButton.fitToShape(); + + break; + } + } + } + else + { + if(%assetType $= "ComponentAsset") + { + %assetPath = "data/" @ %moduleName @ "/components/" @ %assetName @ ".cs"; + %doubleClickCommand = "EditorOpenFileInTorsion( "@%assetPath@", 0 );"; + + %previewImage = "tools/assetBrowser/art/componentIcon"; + + %assetFriendlyName = %assetDesc.friendlyName; + %assetDesc = %assetDesc.description; + %tooltip = %assetFriendlyName @ "\n" @ %assetDesc; + } + else if(%assetType $= "GameObjectAsset") + { + %assetPath = "data/" @ %moduleName @ "/gameObjects/" @ %assetName @ ".cs"; + %doubleClickCommand = "EditorOpenFileInTorsion( "@%assetPath@", 0 );"; + + %previewImage = "tools/assetBrowser/art/gameObjectIcon"; + + %tooltip = %assetDesc.gameObjectName; + } + else if(%assetType $= "ImageAsset") + { + //nab the image and use it for the preview + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + %previewImage = %asset.imageFile; + break; + } + } + } + else if(%assetType $= "StateMachineAsset") + { + %previewImage = "tools/assetBrowser/art/stateMachineIcon"; + } + else if(%assetType $= "SoundAsset") + { + %previewImage = "tools/assetBrowser/art/soundIcon"; + } + else if(%assetType $= "LevelAsset") + { + %previewImage = "tools/assetBrowser/art/levelIcon"; + } + else if(%assetType $= "PostEffectAsset") + { + %previewImage = "tools/assetBrowser/art/postEffectIcon"; + } + else if(%assetType $= "GUIAsset") + { + %previewImage = "tools/assetBrowser/art/guiIcon"; + } + else if(%assetType $= "ScriptAsset") + { + if(%assetDesc.isServerSide) + %previewImage = "tools/assetBrowser/art/serverScriptIcon"; + else + %previewImage = "tools/assetBrowser/art/clientScriptIcon"; + } + else if(%assetType $= "MaterialAsset") + { + %previewImage = ""; + //nab the image and use it for the preview + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + %previewImage = %asset.materialDefinitionName.diffuseMap[0]; + break; + } + } + + if(%previewImage $= "") + %previewImage = "tools/assetBrowser/art/materialIcon"; + } + if(%assetType $= "ShapeAnimationAsset") + { + %previewImage = "tools/assetBrowser/art/animationIcon"; + } + + %previewButton = new GuiBitmapButtonCtrl() + { + className = "AssetPreviewControl"; + internalName = %assetName; + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "10 4"; + extent = %previewSize; + buttonType = "PushButton"; + bitmap = %previewImage; + Command = ""; + text = ""; + useStates = false; + + new GuiBitmapButtonCtrl() + { + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "0 0"; + extent = %previewSize; + Variable = ""; + buttonType = "toggleButton"; + bitmap = "tools/materialEditor/gui/cubemapBtnBorder"; + groupNum = "0"; + text = ""; + }; + }; + } + + %previewBorder = new GuiButtonCtrl(){ + class = "AssetPreviewButton"; + internalName = %assetName@"Border"; + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiThumbHighlightButtonProfile"; + position = "0 0"; + extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24; + Variable = ""; + buttonType = "radioButton"; + tooltip = %tooltip; + Command = "AssetBrowser.updateSelection( $ThisControl.getParent().assetName, $ThisControl.getParent().moduleName );"; + altCommand = %doubleClickCommand; + groupNum = "0"; + useMouseEvents = true; + text = ""; + icon = %previewImage; + }; + + %previewNameCtrl = new GuiTextEditCtrl(){ + position = 0 SPC %previewSize.y + %previewBounds - 16; + profile = ToolsGuiTextEditCenterProfile; + extent = %previewSize.x + %previewBounds SPC 16; + text = %assetName; + originalAssetName = %assetName; //special internal field used in renaming assets + internalName = "AssetNameLabel"; + class = "AssetNameField"; + active = false; + }; + + %container.add(%previewButton); + %container.add(%previewBorder); + %container.add(%previewNameCtrl); + + // add to the gui control array + AssetBrowser-->materialSelection.add(%container); + + // add to the array object for reference later + AssetPreviewArray.add( %previewButton, %previewImage ); +} + +function AssetBrowser::loadImages( %this, %materialNum ) +{ + // this will save us from spinning our wheels in case we don't exist + /*if( !AssetBrowser.visible ) + return; + + // this schedule is here to dynamically load images + %previewButton = AssetPreviewArray.getKey(%materialNum); + %previewImage = AssetPreviewArray.getValue(%materialNum); + + if(%previewButton.getClassName() !$= "GuiObjectView") + { + %previewButton.setBitmap(%previewImage); + %previewButton.setText(""); + } + + %materialNum++; + + /*if( %materialNum < AssetPreviewArray.count() ) + { + %tempSchedule = %this.schedule(64, "loadImages", %materialNum); + MatEdScheduleArray.add( %tempSchedule, %materialNum ); + }*/ +} + +function AssetBrowser::loadFilters( %this ) +{ + AssetBrowser-->filterTree.clear(); + + AssetBrowser-->filterTree.buildIconTable(":tools/classIcons/prefab"); + + AssetBrowser-->filterTree.insertItem(0, "Assets"); + + //First, build our our list of active modules + %modulesList = ModuleDatabase.findModules(true); + + for(%i=0; %i < getWordCount(%modulesList); %i++) + { + %moduleName = getWord(%modulesList, %i).ModuleId; + + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + } + + //Next, go through and list the asset categories + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName $= "CoreComponentsModule") + continue; + + //first, see if this module Module is listed already + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + + %assetType = AssetDatabase.getAssetCategory(%assetId); + + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + if(%assetType $= "") + %assetType = "Misc"; + } + + if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType) + continue; + + %assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%moduleItemId, %assetType); + + if(%assetTypeId == 0) + %assetTypeId = AssetBrowser-->filterTree.insertItem(%moduleItemId, %assetType); + } + + AssetBrowser-->filterTree.buildVisibleTree(true); + + //special handling for selections + if(AssetBrowser.newModuleId !$= "") + { + AssetBrowser-->filterTree.clearSelection(); + %newModuleItem = AssetBrowser-->filterTree.findItemByName(AssetBrowser.newModuleId); + AssetBrowser-->filterTree.selectItem(%newModuleItem); + AssetBrowser.newModuleId = ""; + } + + %selectedItem = AssetBrowser-->filterTree.getSelectedItem(); + AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem); +} + +// create category and update current material if there is one +function AssetBrowser::createFilter( %this, %filter ) +{ + if( %filter $= %existingFilters ) + { + MessageBoxOK( "Error", "Can not create blank filter."); + return; + } + + for( %i = AssetBrowser.staticFilterObjects; %i < AssetBrowser-->filterArray.getCount() ; %i++ ) + { + %existingFilters = AssetBrowser-->filterArray.getObject(%i).getObject(0).filter; + if( %filter $= %existingFilters ) + { + MessageBoxOK( "Error", "Can not create two filters of the same name."); + return; + } + } + %container = new GuiControl(){ + profile = "ToolsGuiDefaultProfile"; + Position = "0 0"; + Extent = "128 18"; + HorizSizing = "right"; + VertSizing = "bottom"; + isContainer = "1"; + + new GuiCheckBoxCtrl(){ + Profile = "ToolsGuiCheckBoxListProfile"; + position = "5 1"; + Extent = "118 18"; + Command = ""; + groupNum = "0"; + buttonType = "ToggleButton"; + text = %filter @ " ( " @ MaterialFilterAllArray.countKey(%filter) @ " )"; + filter = %filter; + Command = "AssetBrowser.preloadFilter();"; + }; + }; + + AssetBrowser-->filterArray.add( %container ); + + // if selection exists, lets reselect it to refresh it + if( isObject(AssetBrowser.selectedMaterial) ) + AssetBrowser.updateSelection( AssetBrowser.selectedMaterial, AssetBrowser.selectedPreviewImagePath ); + + // material category text field to blank + AssetBrowser_addFilterWindow-->tagName.setText(""); +} + +function AssetBrowser::updateSelection( %this, %asset, %moduleName ) +{ + // the material selector will visually update per material information + // after we move away from the material. eg: if we remove a field from the material, + // the empty checkbox will still be there until you move fro and to the material again + + %isAssetBorder = 0; + eval("%isAssetBorder = isObject(AssetBrowser-->"@%asset@"Border);"); + if( %isAssetBorder ) + { + eval( "AssetBrowser-->"@%asset@"Border.setStateOn(1);"); + } + + %isAssetBorderPrevious = 0; + eval("%isAssetBorderPrevious = isObject(AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border);"); + if( %isAssetBorderPrevious ) + { + eval( "AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border.setStateOn(0);"); + } + + AssetBrowser.selectedMaterial = %asset; + AssetBrowser.selectedAsset = %moduleName@":"@%asset; + AssetBrowser.selectedAssetDef = AssetDatabase.acquireAsset(AssetBrowser.selectedAsset); + //AssetBrowser.selectedPreviewImagePath = %previewImagePath; + + %this.prevSelectedMaterialHL = %asset; +} + +// +//needs to be deleted with the persistence manager and needs to be blanked out of the matmanager +//also need to update instances... i guess which is the tricky part.... +function AssetBrowser::showDeleteDialog( %this ) +{ + %material = AssetBrowser.selectedMaterial; + %secondFilter = "MaterialFilterMappedArray"; + %secondFilterName = "Mapped"; + + for( %i = 0; %i < MaterialFilterUnmappedArray.count(); %i++ ) + { + if( MaterialFilterUnmappedArray.getValue(%i) $= %material ) + { + %secondFilter = "MaterialFilterUnmappedArray"; + %secondFilterName = "Unmapped"; + break; + } + } + + if( isObject( %material ) ) + { + MessageBoxYesNoCancel("Delete Material?", + "Are you sure you want to delete

" @ %material.getName() @ "

Material deletion won't take affect until the engine is quit.", + "AssetBrowser.deleteMaterial( " @ %material @ ", " @ %secondFilter @ ", " @ %secondFilterName @" );", + "", + "" ); + } +} + +function AssetBrowser::deleteMaterial( %this, %materialName, %secondFilter, %secondFilterName ) +{ + if( !isObject( %materialName ) ) + return; + + for( %i = 0; %i <= MaterialFilterAllArray.countValue( %materialName ); %i++) + { + %index = MaterialFilterAllArray.getIndexFromValue( %materialName ); + MaterialFilterAllArray.erase( %index ); + } + MaterialFilterAllArrayCheckbox.setText("All ( " @ MaterialFilterAllArray.count() - 1 @ " ) "); + + %checkbox = %secondFilter @ "Checkbox"; + for( %k = 0; %k <= %secondFilter.countValue( %materialName ); %k++) + { + %index = %secondFilter.getIndexFromValue( %materialName ); + %secondFilter.erase( %index ); + } + %checkbox.setText( %secondFilterName @ " ( " @ %secondFilter.count() - 1 @ " ) "); + + for( %i = 0; %materialName.getFieldValue("materialTag" @ %i) !$= ""; %i++ ) + { + %materialTag = %materialName.getFieldValue("materialTag" @ %i); + + for( %j = AssetBrowser.staticFilterObjects; %j < AssetBrowser-->filterArray.getCount() ; %j++ ) + { + if( %materialTag $= AssetBrowser-->filterArray.getObject(%j).getObject(0).filter ) + { + %count = getWord( AssetBrowser-->filterArray.getObject(%j).getObject(0).getText(), 2 ); + %count--; + AssetBrowser-->filterArray.getObject(%j).getObject(0).setText( %materialTag @ " ( "@ %count @ " )"); + } + } + + } + + UnlistedMaterials.add( "unlistedMaterials", %materialName ); + + if( %materialName.getFilename() !$= "" && + %materialName.getFilename() !$= "tools/gui/AssetBrowser.ed.gui" && + %materialName.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.cs" ) + { + AssetBrowserPerMan.removeObjectFromFile(%materialName); + AssetBrowserPerMan.saveDirty(); + } + + AssetBrowser.preloadFilter(); +} + +function AssetBrowser::thumbnailCountUpdate(%this) +{ + $Pref::AssetBrowser::ThumbnailCountIndex = AssetBrowser-->materialPreviewCountPopup.getSelected(); + AssetBrowser.LoadFilter( AssetBrowser.currentFilter, AssetBrowser.currentStaticFilter ); +} + +function AssetBrowser::toggleTagFilterPopup(%this) +{ + if(TagFilterWindow.visible) + TagFilterWindow.visible = false; + else + TagFilterWindow.visible = true; + + return; + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + //check that we don't re-add it + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == -1 || %moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %module.moduleId, "", "", 1, 1); + + //now, add the asset's category + %assetType = AssetDatabase.getAssetCategory(%assetId); + + %checkBox = new GuiCheckBoxCtrl() + { + canSaveDynamicFields = "0"; + isContainer = "0"; + Profile = "ToolsGuiCheckBoxListProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = (%textLength * 4) @ " 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Variable = %var; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + text = %text; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + useInactiveState = "0"; + Command = %cmd; + }; + + TagFilterList.add(%checkBox); + } +} + +function AssetBrowser::changeAsset(%this) +{ + //alright, we've selectd an asset for a field, so time to set it! + %cmd = %this.fieldTargetObject @ "." @ %this.fieldTargetName @ "=\"" @ %this.selectedAsset @ "\";"; + echo("Changing asset via the " @ %cmd @ " command"); + eval(%cmd); +} + +function AssetBrowser::reImportAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = AssetDatabase.getAssetType(EditAssetPopup.assetId); + + if(%assetType $= "ShapeAsset" || %assetType $= "ImageAsset" || %assetType $= "SoundAsset") + { + AssetBrowser.isAssetReImport = true; + AssetBrowser.reImportingAssetId = EditAssetPopup.assetId; + + AssetBrowser.onBeginDropFiles(); + AssetBrowser.onDropFile(%assetDef.originalFilePath); + AssetBrowser.onEndDropFiles(); + + %module = AssetDatabase.getAssetModule(EditAssetPopup.assetId); + + //get the selected module data + ImportAssetModuleList.setText(%module.ModuleId); + } +} + +//------------------------------------------------------------------------------ +function AssetPreviewButton::onRightClick(%this) +{ + AssetBrowser.selectedAssetPreview = %this.getParent(); + EditAssetPopup.assetId = %this.getParent().moduleName @ ":" @ %this.getParent().assetName; + %assetType = %this.getParent().assetType; + + //Do some enabling/disabling of options depending on asset type + EditAssetPopup.enableItem(0, true); + EditAssetPopup.enableItem(7, true); + + //Is it an editable type? + if(%assetType $= "ImageAsset" || %assetType $= "GameObjectAsset" || %assetType $= "SoundAsset") + { + EditAssetPopup.enableItem(0, false); + } + + //Is it an importable type? + if(%assetType $= "GameObjectAsset" || %assetType $= "ComponentAsset" || %assetType $= "GUIAsset" || %assetType $= "LevelAsset" + || %assetType $= "MaterialAsset" || %assetType $= "ParticleAsset" || %assetType $= "PostEffectAsset" || %assetType $= "ScriptAsset" + || %assetType $= "StateMachineAsset") + { + EditAssetPopup.enableItem(7, false); + } + + EditAssetPopup.showPopup(Canvas); +} + +function AssetListPanel::onRightMouseDown(%this) +{ + AddNewAssetPopup.showPopup(Canvas); +} + +//------------------------------------------------------------------------------ +function AssetBrowser::refreshPreviews(%this) +{ + AssetBrowserFilterTree.onSelect(AssetBrowser.selectedItem); +} + +function AssetBrowserFilterTree::onSelect(%this, %itemId) +{ + if(%itemId == 1) + //can't select root + return; + + //Make sure we have an actual module selected! + %parentId = %this.getParentItem(%itemId); + + if(%parentId != 1) + AssetBrowser.selectedModule = %this.getItemText(%parentId);//looks like we have one of the categories selected, not the module. Nab the parent so we have the correct thing! + else + AssetBrowser.selectedModule = %this.getItemText(%itemId); + + AssetBrowser.selectedItem = %itemId; + + //alright, we have a module or sub-filter selected, so now build our asset list based on that filter! + echo("Asset Browser Filter Tree selected filter #:" @ %itemId); + + // manage schedule array properly + if(!isObject(MatEdScheduleArray)) + new ArrayObject(MatEdScheduleArray); + + // if we select another list... delete all schedules that were created by + // previous load + for( %i = 0; %i < MatEdScheduleArray.count(); %i++ ) + cancel(MatEdScheduleArray.getKey(%i)); + + // we have to empty out the list; so when we create new schedules, these dont linger + MatEdScheduleArray.empty(); + + // manage preview array + if(!isObject(AssetPreviewArray)) + new ArrayObject(AssetPreviewArray); + + // we have to empty out the list; so when we create new guicontrols, these dont linger + AssetPreviewArray.empty(); + AssetBrowser-->materialSelection.deleteAllObjects(); + //AssetBrowser-->materialPreviewPagesStack.deleteAllObjects(); + + %assetArray = new ArrayObject(); + + //First, Query for our assets + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + //module name per our selected filter: + %moduleItemId = %this.getParentItem(%itemId); + + //check if we've selected a Module + if(%moduleItemId == 1) + { + %FilterModuleName = %this.getItemText(%itemId); + } + else + { + %FilterModuleName = %this.getItemText(%moduleItemId); + } + + //now, we'll iterate through, and find the assets that are in this module, and this category + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + if(%FilterModuleName $= %moduleName) + { + //it's good, so test that the category is right! + %assetType = AssetDatabase.getAssetCategory(%assetId); + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + } + + if(%this.getItemText(%itemId) $= %assetType || (%assetType $= "" && %this.getItemText(%itemId) $= "Misc") + || %moduleItemId == 1) + { + //stop adding after previewsPerPage is hit + %assetName = AssetDatabase.getAssetName(%assetId); + + %searchText = AssetBrowserSearchFilter.getText(); + if(%searchText !$= "\c2Filter...") + { + if(strstr(strlwr(%assetName), strlwr(%searchText)) != -1) + %assetArray.add( %moduleName, %assetId); + } + else + { + //got it. + %assetArray.add( %moduleName, %assetId ); + } + } + } + } + + AssetBrowser.currentPreviewPage = 0; + AssetBrowser.totalPages = 1; + + for(%i=0; %i < %assetArray.count(); %i++) + AssetBrowser.buildPreviewArray( %assetArray.getValue(%i), %assetArray.getKey(%i) ); + + AssetBrowser.loadImages( 0 ); +} + +function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId) +{ + if( %this.getSelectedItemsCount() > 0 && %itemId != 1) + { + //AddNewAssetPopup.showPopup(Canvas); + + //We have something clicked, so figure out if it's a sub-filter or a module filter, then push the correct + //popup menu + if(%this.getParentItem(%itemId) == 1) + { + //yep, module, push the all-inclusive popup + EditModulePopup.showPopup(Canvas); + //also set the module value for creation info + AssetBrowser.selectedModule = %this.getItemText(%itemId); + } + else + { + //get the parent, and thus our module + %moduleId = %this.getParentItem(%itemId); + + //set the module value for creation info + AssetBrowser.selectedModule = %this.getItemText(%moduleId); + + if(%this.getItemText(%itemId) $= "ComponentAsset") + { + AddNewComponentAssetPopup.showPopup(Canvas); + //Canvas.popDialog(AssetBrowser_newComponentAsset); + //AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule); + } + else + { + + } + } + } + else if( %this.getSelectedItemsCount() > 0 && %itemId == 1) + { + AddNewModulePopup.showPopup(Canvas); + } +} + +// +// +function AssetBrowserSearchFilterText::onWake( %this ) +{ + /*%filter = %this.treeView.getFilterText(); + if( %filter $= "" ) + %this.setText( "\c2Filter..." ); + else + %this.setText( %filter );*/ +} + +//------------------------------------------------------------------------------ + +function AssetBrowserSearchFilterText::onGainFirstResponder( %this ) +{ + %this.selectAllText(); +} + +//--------------------------------------------------------------------------------------------- + +// When Enter is pressed in the filter text control, pass along the text of the control +// as the treeview's filter. +function AssetBrowserSearchFilterText::onReturn( %this ) +{ + %text = %this.getText(); + if( %text $= "" ) + %this.reset(); + else + { + //%this.treeView.setFilterText( %text ); + %curItem = AssetBrowserFilterTree.getSelectedItem(); + AssetBrowserFilterTree.onSelect(%curItem); + } +} + +//--------------------------------------------------------------------------------------------- + +function AssetBrowserSearchFilterText::reset( %this ) +{ + %this.setText( "\c2Filter..." ); + //%this.treeView.clearFilterText(); + %curItem = AssetBrowserFilterTree.getSelectedItem(); + AssetBrowserFilterTree.onSelect(%curItem); +} + +//--------------------------------------------------------------------------------------------- + +function AssetBrowserSearchFilterText::onClick( %this ) +{ + %this.textCtrl.reset(); +} + +// +// +// +function AssetBrowser::reloadModules(%this) +{ + ModuleDatabase.unloadGroup("Game"); + + %modulesList = ModuleDatabase.findModules(); + + %count = getWordCount(%modulesList); + + for(%i=0; %i < %count; %i++) + { + %moduleId = getWord(%modulesList, %i).ModuleId; + ModuleDatabase.unloadExplicit(%moduleId); + } + + ModuleDatabase.scanModules(); + + %modulesList = ModuleDatabase.findModules(); + + %count = getWordCount(%modulesList); + + for(%i=0; %i < %count; %i++) + { + %moduleId = getWord(%modulesList, %i).ModuleId; + ModuleDatabase.loadExplicit(%moduleId); + } + + //ModuleDatabase.loadGroup("Game"); +} +// + +function AssetPreviewButton::onMouseDragged(%this) +{ + %payload = new GuiBitmapButtonCtrl(); + %payload.assignFieldsFrom( %this ); + %payload.className = "AssetPreviewControl"; + %payload.position = "0 0"; + %payload.dragSourceControl = %this; + %payload.bitmap = %this.icon; + %payload.extent.x /= 2; + %payload.extent.y /= 2; + + %xOffset = getWord( %payload.extent, 0 ) / 2; + %yOffset = getWord( %payload.extent, 1 ) / 2; + + // Compute the initial position of the GuiDragAndDrop control on the cavas based on the current + // mouse cursor position. + + %cursorpos = Canvas.getCursorPos(); + %xPos = getWord( %cursorpos, 0 ) - %xOffset; + %yPos = getWord( %cursorpos, 1 ) - %yOffset; + + if(!isObject(EditorDragAndDropLayer)) + { + new GuiControl(EditorDragAndDropLayer) + { + position = "0 0"; + extent = Canvas.extent; + }; + } + + // Create the drag control. + %ctrl = new GuiDragAndDropControl() + { + canSaveDynamicFields = "0"; + Profile = "GuiSolidDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %xPos SPC %yPos; + extent = %payload.extent; + MinExtent = "4 4"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + + // Let the GuiDragAndDropControl delete itself on mouse-up. When the drag is aborted, + // this not only deletes the drag control but also our payload. + deleteOnMouseUp = true; + + useWholeCanvas = true; + + // To differentiate drags, use the namespace hierarchy to classify them. + // This will allow a color swatch drag to tell itself apart from a file drag, for example. + class = "AssetPreviewControlType_AssetDrop"; + }; + + // Add the temporary color swatch to the drag control as the payload. + %ctrl.add( %payload ); + + // Start drag by adding the drag control to the canvas and then calling startDragging(). + //Canvas.getContent().add( %ctrl ); + EditorDragAndDropLayer.add(%ctrl); + Canvas.pushDialog(EditorDragAndDropLayer); + + %ctrl.startDragging( %xOffset, %yOffset ); +} + +function AssetPreviewButton::onControlDragCancelled(%this) +{ + Canvas.popDialog(EditorDragAndDropLayer); +} + +function AssetPreviewButton::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + // If dropped on same button whence we came from, + // do nothing. + + if( %payload.dragSourceControl == %this ) + return; + + // If a swatch button control is dropped onto this control, + // copy it's color. + + if( %payload.isMemberOfClass( "AssetPreviewButton" ) ) + { + // If the swatch button is part of a color-type inspector field, + // remember the inspector field so we can later set the color + // through it. + + if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorI" ) ) + %this.parentGroup.apply( ColorFloatToInt( %payload.color ) ); + else if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorF" ) ) + %this.parentGroup.apply( %payload.color ); + else + %this.setColor( %payload.color ); + } +} + +function EWorldEditor::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + // If dropped on same button whence we came from, + // do nothing. + + if( %payload.dragSourceControl == %this ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + %pos = EWCreatorWindow.getCreateObjectPosition(); //LocalClientConnection.camera.position; + %module = %payload.dragSourceControl.parentGroup.moduleName; + %asset = %payload.dragSourceControl.parentGroup.assetName; + + if(%assetType $= "ImageAsset") + { + echo("DROPPED AN IMAGE ON THE EDITOR WINDOW!"); + } + else if(%assetType $= "ShapeAsset") + { + echo("DROPPED A SHAPE ON THE EDITOR WINDOW!"); + + %newEntity = new Entity() + { + position = %pos; + + new MeshComponent() + { + MeshAsset = %module @ ":" @ %asset; + }; + + //new CollisionComponent(){}; + }; + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + else if(%assetType $= "MaterialAsset") + { + echo("DROPPED A MATERIAL ON THE EDITOR WINDOW!"); + } + else if(%assetType $= "GameObjectAsset") + { + echo("DROPPED A GAME OBJECT ON THE EDITOR WINDOW!"); + + %GO = spawnGameObject(%asset, true); + + %pos = EWCreatorWindow.getCreateObjectPosition(); //LocalClientConnection.camera.position; + + %GO.position = %pos; + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%GO); + } + else if(%assetType $= "ComponentAsset") + { + %newEntity = new Entity() + { + position = %pos; + }; + + %assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset); + + if(%assetDef.componentClass $= "Component") + eval("$tmpVar = new " @ %assetDef.componentClass @ "() { class = " @ %assetDef.componentName @ "; }; %newEntity.add($tmpVar);"); + else + eval("$tmpVar = new " @ %assetDef.componentClass @ "() {}; %newEntity.add($tmpVar);"); + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + else if(%assetType $= "ScriptAsset") //do we want to do it this way? + { + %newEntity = new Entity() + { + position = %pos; + class = %asset; + }; + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + + EWorldEditor.isDirty = true; +} + +function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "ShapeAsset") + { + echo("DROPPED A SHAPE ON A SHAPE ASSET COMPONENT FIELD!"); + + %module = %payload.dragSourceControl.parentGroup.moduleName; + %asset = %payload.dragSourceControl.parentGroup.assetName; + + %targetComponent = %this.ComponentOwner; + %targetComponent.MeshAsset = %module @ ":" @ %asset; + + //Inspector.refresh(); + } + + EWorldEditor.isDirty= true; +} + +function GuiInspectorTypeImageAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "ImageAsset") + { + echo("DROPPED A IMAGE ON AN IMAGE ASSET COMPONENT FIELD!"); + } + + EWorldEditor.isDirty = true; +} + +function GuiInspectorTypeMaterialAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "MaterialAsset") + { + echo("DROPPED A MATERIAL ON A MATERIAL ASSET COMPONENT FIELD!"); + } + + EWorldEditor.isDirty = true; +} + +function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + %assetName = %payload.dragSourceControl.parentGroup.assetName; + %moduleName = %payload.dragSourceControl.parentGroup.moduleName; + + echo("DROPPED A " @ %assetType @ " ON THE ASSET BROWSER NAVIGATION TREE!"); + + %item = %this.getItemAtPosition(%position); + + echo("DROPPED IT ON ITEM " @ %item); + + %parent = %this.getParentItem(%item); + + if(%parent == 1) + { + //we're a module entry, cool + %targetModuleName = %this.getItemText(%item); + echo("DROPPED IT ON MODULE " @ %targetModuleName); + + if(%moduleName !$= %targetModuleName) + { + //we're trying to move the asset to a different module! + MessageBoxYesNo( "Move Asset", "Do you wish to move asset " @ %assetName @ " to module " @ %targetModuleName @ "?", + "AssetBrowser.moveAsset("@%assetName@", "@%targetModuleName@");", ""); + } + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs new file mode 100644 index 000000000..8732ac8a5 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs @@ -0,0 +1,1525 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// +function isImageFormat(%fileExt) +{ + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") || (%fileExt $= ".tif")) + return true; + + return false; +} + +function isShapeFormat(%fileExt) +{ + if( (%fileExt $= ".dae") || (%fileExt $= ".dts") || (%fileExt $= ".fbx") || (%fileExt $= ".obj") || (%fileExt $= ".blend")) + return true; + + return false; +} + +function isSoundFormat(%fileExt) +{ + if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + return true; + + return false; +} + +function getImageInfo(%file) +{ + //we're going to populate a GuiTreeCtrl with info of the inbound image file +} + +//This lets us go and look for a image at the importing directory as long as it matches the material name +function findImageFile(%path, %materialName, %type) +{ + + if(isFile(%path @ "/" @ %materialName @ ".jpg")) + return %path @ "/" @ %materialName @ ".jpg"; + else if(isFile(%path @ "/" @ %materialName @ ".png")) + return %path @ "/" @ %materialName @ ".png"; + else if(isFile(%path @ "/" @ %materialName @ ".dds")) + return %path @ "/" @ %materialName @ ".dds"; + else if(isFile(%path @ "/" @ %materialName @ ".tif")) + return %path @ "/" @ %materialName @ ".tif"; +} + +function AssetBrowser::onBeginDropFiles( %this ) +{ + error("% DragDrop - Beginning files dropping."); + %this.importAssetNewListArray.empty(); + %this.importAssetUnprocessedListArray.empty(); + %this.importAssetFinalListArray.empty(); +} + +function AssetBrowser::onDropFile( %this, %filePath ) +{ + if(!%this.isVisible()) + return; + + %fileExt = fileExt( %filePath ); + //add it to our array! + if(isImageFormat(%fileExt)) + %this.addImportingAsset("Image", %filePath); + else if( isShapeFormat(%fileExt)) + %this.addImportingAsset("Model", %filePath); + else if( isSoundFormat(%fileExt)) + %this.addImportingAsset("Sound", %filePath); + else if (%fileExt $= ".zip") + %this.onDropZipFile(%filePath); +} + +function AssetBrowser::onDropZipFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + %zip = new ZipObject(); + %zip.openArchive(%filePath); + %count = %zip.getFileEntryCount(); + + echo("Dropped in a zip file with" SPC %count SPC "files inside!"); + + return; + for (%i = 0; %i < %count; %i++) + { + %fileEntry = %zip.getFileEntry(%i); + %fileFrom = getField(%fileEntry, 0); + + //First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale + //and not process their contents. + + //If not modules, it's likely an art pack or other mixed files, so we'll import them as normal + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) + %this.importAssetListArray.add("Image", %filePath); + else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) + %this.importAssetListArray.add("Model", %filePath); + else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + %this.importAssetListArray.add("Sound", %filePath); + else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso")) + %this.importAssetListArray.add("GUI", %filePath); + //else if( (%fileExt $= ".cs") || (%fileExt $= ".dso")) + // %this.importAssetListArray.add("Script", %filePath); + else if( (%fileExt $= ".mis")) + %this.importAssetListArray.add("Level", %filePath); + + // For now, if it's a .cs file, we'll assume it's a behavior. + if (fileExt(%fileFrom) !$= ".cs") + continue; + + %fileTo = expandFilename("^game/behaviors/") @ fileName(%fileFrom); + %zip.extractFile(%fileFrom, %fileTo); + exec(%fileTo); + } +} + +function AssetBrowser::onDropImageFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + // File Information madness + %fileName = %filePath; + %fileOnlyName = fileName( %fileName ); + %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); + + // [neo, 5/17/2007 - #3117] + // Check if the file being dropped is already in data/images or a sub dir by checking if + // the file path up to length of check path is the same as check path. + %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); + + %checkPath = expandFilename( "^"@%defaultPath ); + %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); + %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); + + if( %checkPath !$= %fileBasePath ) + { + // No match so file is from outside images directory and we need to copy it in + %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + + // Move to final location + if( !pathCopy( %filePath, %fileNewLocation ) ) + return; + } + else + { + // Already in images path somewhere so just link to it + %fileNewLocation = %filePath; + } + + addResPath( filePath( %fileNewLocation ) ); + + %matName = fileBase( %fileName ); + + // Create Material + %imap = new Material(%matName) + { + mapTo = fileBase( %matName ); + diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + }; + //%imap.setName( %fileBase ); + //%imap.imageName = %fileNewLocation; + //%imap.imageMode = "FULL"; + //%imap.filterPad = false; + //%imap.compile(); + + %diffusecheck = %imap.diffuseMap[0]; + + // Bad Creation! + if( !isObject( %imap ) ) + return; + + %this.addDatablock( %fileBase, false ); +} + +function AssetBrowser::onDropSoundFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + // File Information madness + %fileName = %filePath; + %fileOnlyName = fileName( %fileName ); + %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); + + // [neo, 5/17/2007 - #3117] + // Check if the file being dropped is already in data/images or a sub dir by checking if + // the file path up to length of check path is the same as check path. + %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); + + %checkPath = expandFilename( "^"@%defaultPath ); + %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); + %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); + + if( %checkPath !$= %fileBasePath ) + { + // No match so file is from outside images directory and we need to copy it in + %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + + // Move to final location + if( !pathCopy( %filePath, %fileNewLocation ) ) + return; + } + else + { + // Already in images path somewhere so just link to it + %fileNewLocation = %filePath; + } + + addResPath( filePath( %fileNewLocation ) ); + + %matName = fileBase( %fileName ); + + // Create Material + %imap = new Material(%matName) + { + mapTo = fileBase( %matName ); + diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + }; + //%imap.setName( %fileBase ); + //%imap.imageName = %fileNewLocation; + //%imap.imageMode = "FULL"; + //%imap.filterPad = false; + //%imap.compile(); + + %diffusecheck = %imap.diffuseMap[0]; + + // Bad Creation! + if( !isObject( %imap ) ) + return; + + %this.addDatablock( %fileBase, false ); +} + +function AssetBrowser::onEndDropFiles( %this ) +{ + if(!%this.isVisible()) + return; + + //we have assets to import, so go ahead and display the window for that now + Canvas.pushDialog(AssetImportCtrl); + ImportAssetWindow.visible = true; + //ImportAssetWindow.validateAssets(); + ImportAssetWindow.refresh(); + ImportAssetWindow.selectWindow(); + + // Update object library + GuiFormManager::SendContentMessage($LBCreateSiderBar, %this, "refreshAll 1"); + + if(ImportAssetWindow.importConfigsList.count() == 0) + { + MessageBoxOK( "Warning", "No base import config. Please create an import configuration set to simplify asset importing."); + } +} +// +// +// + +function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentAssetItem ) +{ + %assetName = fileBase(%filePath); + %filePath = filePath(%filePath) @ "/" @ fileBase(%filePath) @ fileExt(%filePath); //sanitize the file path + + %moduleName = AssetBrowser.SelectedModule; + ImportAssetModuleList.text = %moduleName; + + //Add to our main list + %assetItem = new ScriptObject() + { + assetType = %assetType; + filePath = %filePath; + assetName = %assetName; + moduleName = %moduleName; + dirty = true; + parentAssetItem = %parentAssetItem; + status = ""; + statusType = ""; + statusInfo = ""; + skip = false; + }; + + //little bit of interception here + if(%assetItem.assetType $= "Model") + { + %fileExt = fileExt(%assetItem.filePath); + if(%fileExt $= ".dae") + { + %shapeInfo = new GuiTreeViewCtrl(); + enumColladaForImport(%assetItem.filePath, %shapeInfo); + } + else + { + %shapeInfo = GetShapeInfo(%assetItem.filePath); + } + + %assetItem.shapeInfo = %shapeInfo; + + %shapeItem = %assetItem.shapeInfo.findItemByName("Shape"); + %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem); + + %animItem = %assetItem.shapeInfo.findItemByName("Animations"); + %animCount = %assetItem.shapeInfo.getItemValue(%animItem); + + //If the model has shapes AND animations, then it's a normal shape with embedded animations + //if it has shapes and no animations it's a regular static mesh + //if it has no shapes and animations, it's a special case. This means it's a shape animation only file so it gets flagged as special + if(%shapeCount == 0 && %animCount != 0) + { + %assetItem.assetType = "Animation"; + } + else if(%shapeCount == 0 && %animCount == 0) + { + //either it imported wrong or it's a bad file we can't read. Either way, don't try importing it + error("Error - attempted to import a model file with no shapes or animations! Model in question was: " @ %filePath); + + %assetItem.delete(); + return 0; + } + } + + if(%parentAssetItem $= "") + { + %assetItem.parentDepth = 0; + %this.importAssetNewListArray.add(%assetItem); + %this.importAssetUnprocessedListArray.add(%assetItem); + } + else + { + %assetItem.parentDepth = %parentAssetItem.parentDepth + 1; + %parentIndex = %this.importAssetUnprocessedListArray.getIndexFromKey(%parentAssetItem); + + %parentAssetItem.dependencies = %parentAssetItem.dependencies SPC %assetItem; + trim(%parentAssetItem.dependencies); + + %this.importAssetUnprocessedListArray.insert(%assetItem, "", %parentIndex + 1); + } + + return %assetItem; +} + +// +function ImportAssetButton::onClick(%this) +{ + %dlg = new OpenFileDialog() + { + Filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts|Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds|Any Files (*.*)|*.*|"; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = false; + OverwritePrompt = true; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = makeRelativePath( %dlg.FileName, getMainDotCSDir() ); + %file = fileBase( %fullPath ); + } + + %dlg.delete(); + + if ( !%ret ) + return; + + AssetBrowser.importAssetListArray.empty(); + + %fileExt = fileExt( %fullPath ); + //add it to our array! + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) + AssetBrowser.importAssetListArray.add("Image", %fullPath); + else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) + AssetBrowser.importAssetListArray.add("Model", %fullPath); + else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + AssetBrowser.importAssetListArray.add("Sound", %fullPath); + else if (%fileExt $= ".zip") + AssetBrowser.onDropZipFile(%fullPath); + + ImportAssetConfigWindow.visible = true; + ImportAssetConfigWindow.refresh(); + ImportAssetConfigWindow.selectWindow(); +} +// + +// +function ImportAssetWindow::onWake(%this) +{ + //We've woken, meaning we're trying to import assets + //Lets refresh our list + if(!ImportAssetWindow.isVisible()) + return; + + $AssetBrowser::importConfigsFile = "tools/assetBrowser/assetImportConfigs.xml"; + + %this.reloadImportOptionConfigs(); +} + +function ImportAssetWindow::reloadImportOptionConfigs(%this) +{ + ImportAssetWindow.importConfigsList = new ArrayObject(); + ImportAssetConfigList.clear(); + + %xmlDoc = new SimXMLDocument(); + if(%xmlDoc.loadFile($AssetBrowser::importConfigsFile)) + { + //StateMachine element + %xmlDoc.pushFirstChildElement("AssetImportConfigs"); + + //Configs + %configCount = 0; + while(%xmlDoc.pushChildElement(%configCount)) + { + %configObj = new ScriptObject(){}; + + %configObj.Name = %xmlDoc.attribute("Name"); + + %xmlDoc.pushFirstChildElement("Mesh"); + %configObj.ImportMesh = %xmlDoc.attribute("ImportMesh"); + %configObj.DoUpAxisOverride = %xmlDoc.attribute("DoUpAxisOverride"); + %configObj.UpAxisOverride = %xmlDoc.attribute("UpAxisOverride"); + %configObj.DoScaleOverride = %xmlDoc.attribute("DoScaleOverride"); + %configObj.ScaleOverride = %xmlDoc.attribute("ScaleOverride"); + %configObj.IgnoreNodeScale = %xmlDoc.attribute("IgnoreNodeScale"); + %configObj.AdjustCenter = %xmlDoc.attribute("AdjustCenter"); + %configObj.AdjustFloor = %xmlDoc.attribute("AdjustFloor"); + %configObj.CollapseSubmeshes = %xmlDoc.attribute("CollapseSubmeshes"); + %configObj.LODType = %xmlDoc.attribute("LODType"); + %configObj.ImportedNodes = %xmlDoc.attribute("ImportedNodes"); + %configObj.IgnoreNodes = %xmlDoc.attribute("IgnoreNodes"); + %configObj.ImportMeshes = %xmlDoc.attribute("ImportMeshes"); + %configObj.IgnoreMeshes = %xmlDoc.attribute("IgnoreMeshes"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Materials"); + %configObj.ImportMaterials = %xmlDoc.attribute("ImportMaterials"); + %configObj.CreateComposites = %xmlDoc.attribute("CreateComposites"); + %configObj.UseDiffuseSuffixOnOriginImg = %xmlDoc.attribute("UseDiffuseSuffixOnOriginImg"); + %configObj.UseExistingMaterials = %xmlDoc.attribute("UseExistingMaterials"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Animations"); + %configObj.ImportAnimations = %xmlDoc.attribute("ImportAnimations"); + %configObj.SeparateAnimations = %xmlDoc.attribute("SeparateAnimations"); + %configObj.SeparateAnimationPrefix = %xmlDoc.attribute("SeparateAnimationPrefix"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Collisions"); + %configObj.GenerateCollisions = %xmlDoc.attribute("GenerateCollisions"); + %configObj.GenCollisionType = %xmlDoc.attribute("GenCollisionType"); + %configObj.CollisionMeshPrefix = %xmlDoc.attribute("CollisionMeshPrefix"); + %configObj.GenerateLOSCollisions = %xmlDoc.attribute("GenerateLOSCollisions"); + %configObj.GenLOSCollisionType = %xmlDoc.attribute("GenLOSCollisionType"); + %configObj.LOSCollisionMeshPrefix = %xmlDoc.attribute("LOSCollisionMeshPrefix"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Images"); + %configObj.ImageType = %xmlDoc.attribute("ImageType"); + %configObj.DiffuseTypeSuffixes = %xmlDoc.attribute("DiffuseTypeSuffixes"); + %configObj.NormalTypeSuffixes = %xmlDoc.attribute("NormalTypeSuffixes"); + %configObj.SpecularTypeSuffixes = %xmlDoc.attribute("SpecularTypeSuffixes"); + %configObj.MetalnessTypeSuffixes = %xmlDoc.attribute("MetalnessTypeSuffixes"); + %configObj.RoughnessTypeSuffixes = %xmlDoc.attribute("RoughnessTypeSuffixes"); + %configObj.SmoothnessTypeSuffixes = %xmlDoc.attribute("SmoothnessTypeSuffixes"); + %configObj.AOTypeSuffixes = %xmlDoc.attribute("AOTypeSuffixes"); + %configObj.CompositeTypeSuffixes = %xmlDoc.attribute("CompositeTypeSuffixes"); + %configObj.TextureFilteringMode = %xmlDoc.attribute("TextureFilteringMode"); + %configObj.UseMips = %xmlDoc.attribute("UseMips"); + %configObj.IsHDR = %xmlDoc.attribute("IsHDR"); + %configObj.Scaling = %xmlDoc.attribute("Scaling"); + %configObj.Compressed = %xmlDoc.attribute("Compressed"); + %configObj.GenerateMaterialOnImport = %xmlDoc.attribute("GenerateMaterialOnImport"); + %configObj.PopulateMaterialMaps = %xmlDoc.attribute("PopulateMaterialMaps"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Sounds"); + %configObj.VolumeAdjust = %xmlDoc.attribute("VolumeAdjust"); + %configObj.PitchAdjust = %xmlDoc.attribute("PitchAdjust"); + %configObj.Compressed = %xmlDoc.attribute("Compressed"); + %xmlDoc.popElement(); + + %xmlDoc.popElement(); + %configCount++; + + ImportAssetWindow.importConfigsList.add(%configObj); + } + + %xmlDoc.popElement(); + } + + for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) + { + %configObj = ImportAssetWindow.importConfigsList.getKey(%i); + ImportAssetConfigList.add(%configObj.Name); + } + + ImportAssetConfigList.setSelected(0); +} + +function ImportAssetWindow::setImportOptions(%this, %optionsObj) +{ + //Todo, editor + load from files for preconfigs + + //Meshes + %optionsObj.ImportMesh = true; + %optionsObj.UpAxisOverride = "Z_AXIS"; + %optionsObj.OverrideScale = 1.0; + %optionsObj.IgnoreNodeScale = false; + %optionsObj.AdjustCenter = false; + %optionsObj.AdjustFloor = false; + %optionsObj.CollapseSubmeshes = false; + %optionsObj.LODType = "TrailingNumber"; + %optionsObj.TrailingNumber = 2; + %optionsObj.ImportedNodes = ""; + %optionsObj.IgnoreNodes = ""; + %optionsObj.ImportMeshes = ""; + %optionsObj.IgnoreMeshes = ""; + + //Materials + %optionsObj.ImportMaterials = true; + %optionsObj.CreateComposites = true; + + //Animations + %optionsObj.ImportAnimations = true; + %optionsObj.SeparateAnimations = true; + %optionsObj.SeparateAnimationPrefix = ""; + + //Collision + %optionsObj.GenerateCollisions = true; + %optionsObj.GenCollisionType = "CollisionMesh"; + %optionsObj.CollisionMeshPrefix = "Collision"; + %optionsObj.GenerateLOSCollisions = true; + %optionsObj.GenLOSCollisionType = "CollisionMesh"; + %optionsObj.LOSCollisionMeshPrefix = "LOS"; + + //Images + %optionsObj.ImageType = "Diffuse"; + %optionsObj.DiffuseTypeSuffixes = "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL"; + %optionsObj.NormalTypeSuffixes = "_NORMAL,_NORM"; + %optionsObj.SpecularTypeSuffixes = "_SPECULAR,_SPEC"; + %optionsObj.MetalnessTypeSuffixes = "_METAL,_MET,_METALNESS,_METALLIC"; + %optionsObj.RoughnessTypeSuffixes = "_ROUGH,_ROUGHNESS"; + %optionsObj.SmoothnessTypeSuffixes = "_SMOOTH,_SMOOTHNESS"; + %optionsObj.AOTypeSuffixes = "_AO,_AMBIENT,_AMBIENTOCCLUSION"; + %optionsObj.CompositeTypeSuffixes = "_COMP,_COMPOSITE"; + %optionsObj.TextureFilteringMode = "Bilinear"; + %optionsObj.UseMips = true; + %optionsObj.IsHDR = false; + %optionsObj.Scaling = 1.0; + %optionsObj.Compressed = true; + + //Sounds + %optionsObj.VolumeAdjust = 1.0; + %optionsObj.PitchAdjust = 1.0; + %optionsObj.Compressed = false; +} + +// +function ImportAssetWindow::processNewImportAssets(%this) +{ + %unprocessedCount = AssetBrowser.importAssetUnprocessedListArray.count(); + while(AssetBrowser.importAssetUnprocessedListArray.count() > 0) + { + %assetItem = AssetBrowser.importAssetUnprocessedListArray.getKey(0); + + %assetConfigObj = ImportAssetWindow.activeImportConfig.clone(); + %assetConfigObj.assetIndex = %i; + %assetConfigObj.assetName = %assetItem.assetName; + %assetItem.importConfig = %assetConfigObj; + + if(%assetItem.assetType $= "Model") + { + %fileExt = fileExt(%assetItem.filePath); + if(%fileExt $= ".dae") + { + %shapeInfo = new GuiTreeViewCtrl(); + enumColladaForImport(%assetItem.filePath, %shapeInfo); + } + else + { + %shapeInfo = GetShapeInfo(%assetItem.filePath); + } + + %assetItem.shapeInfo = %shapeInfo; + + %shapeItem = %assetItem.shapeInfo.findItemByName("Shape"); + %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem); + + if(%assetConfigObj.ImportMesh == 1 && %shapeCount > 0) + { + + } + + %animItem = %assetItem.shapeInfo.findItemByName("Animations"); + %animCount = %assetItem.shapeInfo.getItemValue(%animItem); + + if(%assetConfigObj.ImportAnimations == 1 && %animCount > 0) + { + %animationItem = %assetItem.shapeInfo.getChild(%animItem); + + %animName = %assetItem.shapeInfo.getItemText(%animationItem); + //%animName = %assetItem.shapeInfo.getItemValue(%animationItem); + + AssetBrowser.addImportingAsset("Animation", %animName, %assetItem); + + %animationItem = %assetItem.shapeInfo.getNextSibling(%animationItem); + while(%animationItem != 0) + { + %animName = %assetItem.shapeInfo.getItemText(%animationItem); + //%animName = %assetItem.shapeInfo.getItemValue(%animationItem); + + AssetBrowser.addImportingAsset("Animation", %animName, %assetItem); + + %animationItem = %shapeInfo.getNextSibling(%animationItem); + } + } + + %matItem = %assetItem.shapeInfo.findItemByName("Materials"); + %matCount = %assetItem.shapeInfo.getItemValue(%matItem); + + if(%assetConfigObj.importMaterials == 1 && %matCount > 0) + { + %materialItem = %assetItem.shapeInfo.getChild(%matItem); + + %matName = %assetItem.shapeInfo.getItemText(%materialItem); + + %filePath = %assetItem.shapeInfo.getItemValue(%materialItem); + if(%filePath !$= "") + { + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + } + else + { + //we need to try and find our material, since the shapeInfo wasn't able to find it automatically + %filePath = findImageFile(filePath(%assetItem.filePath), %matName); + if(%filePath !$= "") + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + else + AssetBrowser.addImportingAsset("Material", %matName, %assetItem); + } + + %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem); + while(%materialItem != 0) + { + %matName = %assetItem.shapeInfo.getItemText(%materialItem); + %filePath = %assetItem.shapeInfo.getItemValue(%materialItem); + if(%filePath !$= "") + { + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + } + else + { + //we need to try and find our material, since the shapeInfo wasn't able to find it automatically + %filePath = findImageFile(filePath(%assetItem.filePath), %matName); + if(%filePath !$= "") + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + else + AssetBrowser.addImportingAsset("Material", %matName, %assetItem); + } + + %materialItem = %shapeInfo.getNextSibling(%materialItem); + } + } + } + else if(%assetItem.assetType $= "Animation") + { + //if we don't have our own file, that means we're gunna be using our parent shape's file so reference that + if(!isFile(%assetItem.filePath)) + { + %assetItem.filePath = %assetItem.parentAssetItem.filePath; + } + } + else if(%assetItem.assetType $= "Material") + { + //Iterate over to find appropriate images for + + //Fetch just the fileBase name + %fileDir = filePath(%assetItem.filePath); + %filename = fileBase(%assetItem.filePath); + %fileExt = fileExt(%assetItem.filePath); + + if(%assetItem.importConfig.PopulateMaterialMaps == 1) + { + if(%assetItem.diffuseImageAsset $= "") + { + //First, load our diffuse map, as set to the material in the shape + %diffuseAsset = AssetBrowser.addImportingAsset("Image", %fileDir @ "/" @ %filename @ %fileExt, %assetItem); + %assetItem.diffuseImageAsset = %diffuseAsset; + + if(%assetItem.importConfig.UseDiffuseSuffixOnOriginImg == 1) + { + %diffuseToken = getToken(%assetItem.importConfig.DiffuseTypeSuffixes, ",", 0); + %diffuseAsset.AssetName = %diffuseAsset.AssetName @ %diffuseToken; + } + } + + if(%assetItem.normalImageAsset $= "") + { + //Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any. + //First, normal map + %listCount = getTokenCount(%assetItem.importConfig.NormalTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.NormalTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.normalImageAsset = %normalAsset; + break; + } + } + } + if(%assetItem.specularImageAsset $= "") + { + //Specular + %listCount = getTokenCount(%assetItem.importConfig.SpecularTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.SpecularTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %specularAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.specularImageAsset = %specularAsset; + break; + } + } + } + + if(%assetItem.metalImageAsset $= "") + { + //Metal + %listCount = getTokenCount(%assetItem.importConfig.MetalnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.MetalnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.metalImageAsset = %metalAsset; + break; + } + } + } + + if(%assetItem.roughnessImageAsset $= "") + { + //Roughness + %listCount = getTokenCount(%assetItem.importConfig.RoughnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.RoughnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.roughnessImageAsset = %roughnessAsset; + break; + } + } + } + + if(%assetItem.smoothnessImageAsset $= "") + { + //Smoothness + %listCount = getTokenCount(%assetItem.importConfig.SmoothnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.SmoothnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.SmoothnessImageAsset = %smoothnessAsset; + break; + } + } + } + + if(%assetItem.AOImageAsset $= "") + { + //AO + %listCount = getTokenCount(%assetItem.importConfig.AOTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.AOTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.AOImageAsset = %AOAsset; + break; + } + } + } + + if(%assetItem.compositeImageAsset $= "") + { + //Composite + %listCount = getTokenCount(%assetItem.importConfig.CompositeTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.CompositeTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.compositeImageAsset = %compositeAsset; + break; + } + } + } + } + } + else if(%assetItem.assetType $= "Image") + { + if(%assetConfigObj.GenerateMaterialOnImport == 1 && %assetItem.parentAssetItem $= "") + { + %filePath = %assetItem.filePath; + if(%filePath !$= "") + %materialAsset = AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + + %materialAsset.diffuseImageAsset = %assetItem; + + if(%assetConfigObj.UseDiffuseSuffixOnOriginImg == 1) + { + %diffuseToken = getToken(%assetItem.importConfig.DiffuseTypeSuffixes, ",", 0); + %assetItem.AssetName = %assetItem.AssetName @ %diffuseToken; + } + } + } + + AssetBrowser.importAssetUnprocessedListArray.erase(0); + //Been processed, so add it to our final list + AssetBrowser.importAssetFinalListArray.add(%assetItem); + } +} + +function ImportAssetWindow::refresh(%this) +{ + ImportingAssetList.clear(); + + //Go through and process any newly, unprocessed assets + %this.processNewImportAssets(); + + if(AssetBrowser.importAssetUnprocessedListArray.count() == 0) + { + //We've processed them all, prep the assets for actual importing + //Initial set of assets + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + + for(%i=0; %i < %assetCount; %i++) + { + %assetItem = AssetBrowser.importAssetFinalListArray.getKey(%i); + %assetType = %assetItem.assetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + + //validate + %this.validateAsset(%assetItem); + + //Once validated, attempt any fixes for issues + %this.resolveIssue(%assetItem); + + //Make sure we size correctly + ImportingAssetList.extent.x = ImportingAssetList.getParent().extent.x - 15; + + //create! + %width = mRound(mRound(ImportingAssetList.extent.x) / 2); + %height = 20; + %indent = %assetItem.parentDepth * 16; + %toolTip = ""; + + %iconPath = "tools/gui/images/iconInformation"; + %configCommand = "ImportAssetOptionsWindow.editImportSettings(" @ %assetItem @ ");"; + + if(%assetType $= "Model" || %assetType $= "Animation" || %assetType $= "Image" || %assetType $= "Sound") + { + if(%assetItem.status $= "Error") + { + %iconPath = "tools/gui/images/iconError"; + %configCommand = "ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; + } + else if(%assetItem.status $= "Warning") + { + %iconPath = "tools/gui/images/iconWarn"; + %configCommand = "ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");"; + + if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset") + %assetName = %assetItem.assetName @ " "; + } + + %toolTip = %assetItem.statusInfo; + } + else + { + if(%assetItem.status $= "Error") + { + %iconPath = "tools/gui/images/iconError"; + %configCommand = "";//"ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; + } + else if(%assetItem.status $= "Warning") + { + %iconPath = "tools/gui/images/iconWarn"; + %configCommand = "";//"ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");"; + + if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset") + %assetName = %assetItem.assetName @ " "; + } + } + + %importEntry = new GuiControl() + { + position = "0 0"; + extent = ImportingAssetList.extent.x SPC %height; + + new GuiTextCtrl() + { + Text = %assetName; + position = %indent SPC "0"; + extent = %width - %indent SPC %height; + internalName = "AssetName"; + }; + + new GuiTextCtrl() + { + Text = %assetType; + position = %width SPC "0"; + extent = %width - %height - %height SPC %height; + internalName = "AssetType"; + }; + + new GuiBitmapButtonCtrl() + { + position = ImportingAssetList.extent.x - %height - %height SPC "0"; + extent = %height SPC %height; + command = %configCommand; + bitmap = %iconPath; + tooltip = %toolTip; + }; + new GuiBitmapButtonCtrl() + { + position = ImportingAssetList.extent.x - %height SPC "0"; + extent = %height SPC %height; + command = "ImportAssetOptionsWindow.deleteImportingAsset(" @ %assetItem @ ");"; + bitmap = "tools/gui/images/iconDelete"; + }; + }; + + ImportingAssetList.add(%importEntry); + } + } + else + { + //Continue processing + %this.refresh(); + } +} +// + +function ImportAssetWindow::validateAssets(%this) +{ + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + %moduleName = ImportAssetModuleList.getText(); + %assetQuery = new AssetQuery(); + + %hasIssues = false; + + //First, check the obvious: name collisions. We should have no asset that shares a similar name. + //If we do, prompt for it be renamed first before continuing + + for(%i=0; %i < %assetCount; %i++) + { + %assetItemA = AssetBrowser.importAssetFinalListArray.getKey(%i); + + //First, check our importing assets for name collisions + for(%j=0; %j < %assetCount; %j++) + { + %assetItemB = AssetBrowser.importAssetFinalListArray.getKey(%j); + if( (%assetItemA.assetName $= %assetItemB.assetName) && (%i != %j) ) + { + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!");*/ + + %assetItemA.status = "Warning"; + %assetItemA.statusType = "DuplicateImportAsset"; + %assetItemA.statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!"; + + %hasIssues = true; + } + } + + //No collisions of for this name in the importing assets. Now, check against the existing assets in the target module + if(!AssetBrowser.isAssetReImport) + { + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + %foundCollision = false; + for( %f=0; %f < %numAssetsFound; %f++) + { + %assetId = %assetQuery.getAsset(%f); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %testModuleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName !$= %testModuleName) + continue; + + %testAssetName = AssetDatabase.getAssetName(%assetId); + + if(%testAssetName $= %assetItemA.assetName) + { + %foundCollision = true; + + %assetItemA.status = "Warning"; + %assetItemA.statusType = "DuplicateAsset"; + %assetItemA.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!"; + + break; + } + } + + if(%foundCollision == true) + { + %hasIssues = true; + + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ + + //%assetQuery.delete(); + //return false; + } + } + + if(!isFile(%assetItemA.filePath)) + { + %hasIssues = true; + %assetItemA.status = "error"; + %assetItemA.statusType = "MissingFile"; + %assetItemA.statusInfo = "Unable to find file to be imported. Please select asset file."; + } + } + + //Clean up our queries + %assetQuery.delete(); + + if(%hasIssues) + return false; + else + return true; +} + +function ImportAssetWindow::ImportAssets(%this) +{ + //do the actual importing, now! + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + + //get the selected module data + %moduleName = ImportAssetModuleList.getText(); + + %module = ModuleDatabase.findModule(%moduleName, 1); + + if(!isObject(%module)) + { + MessageBoxOK( "Error!", "No module selected. You must select or create a module for the assets to be added to."); + return; + } + + /*if(!%this.validateAssets()) + { + //Force a refresh, as some things may have changed, such as errors and failure info! + refresh(); + + return; + }*/ + + for(%i=0; %i < %assetCount; %i++) + { + %assetItem = AssetBrowser.importAssetFinalListArray.getKey(%i); + %assetType = %assetItem.AssetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + %assetImportSuccessful = false; + %assetId = %moduleName@":"@%assetName; + + if(%assetType $= "Image") + { + %assetPath = "data/" @ %moduleName @ "/Images"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ImageAsset() + { + assetName = %assetName; + versionId = 1; + imageFile = %assetFullPath; + originalFilePath = %filePath; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Model") + { + %assetPath = "data/" @ %moduleName @ "/Shapes"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ShapeAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + isNewShape = true; + }; + + %dependencyCount = getWordCount(%assetItem.dependencies); + for(%d=0; %d < %dependencyCount; %d++) + { + %dependencyAssetItem = getWord(%assetItem.dependencies, %d); + + %depAssetType = %dependencyAssetItem.assetType; + if(%depAssetType $= "Material") + { + %matSet = "%newAsset.materialSlot"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + if(%depAssetType $= "Animation") + { + %matSet = "%newAsset.animationSequence"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + } + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + + //now, force-load the file if it's collada + %fileExt = fileExt(%assetFullPath); + if(isSupportedFormat(getSubStr(%fileExt,1))) + { + %tempShape = new TSStatic() + { + shapeName = %assetFullPath; + }; + + %tempShape.delete(); + } + } + else if(%assetType $= "Animation") + { + %assetPath = "data/" @ %moduleName @ "/ShapeAnimations"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ShapeAnimationAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + animationFile = %assetFullPath; + animationName = %assetName; + startFrame = 0; + endFrame = -1; + padRotation = false; + padTransforms = false; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Sound") + { + %assetPath = "data/" @ %moduleName @ "/Sounds"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new SoundAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Material") + { + %assetPath = "data/" @ %moduleName @ "/materials"; + %tamlpath = %assetPath @ "/" @ %assetName @ ".asset.taml"; + %sgfPath = %assetPath @ "/" @ %assetName @ ".sgf"; + %scriptPath = %assetPath @ "/" @ %assetName @ ".cs"; + + %newAsset = new MaterialAsset() + { + assetName = %assetName; + versionId = 1; + shaderGraph = %sgfPath; + scriptFile = %scriptPath; + originalFilePath = %filePath; + materialDefinitionName = %assetName; + }; + + %dependencyCount = getWordCount(%assetItem.dependencies); + for(%d=0; %d < %dependencyCount; %d++) + { + %dependencyAssetItem = getWord(%assetItem.dependencies, %d); + + %depAssetType = %dependencyAssetItem.assetType; + if(%depAssetType $= "Image") + { + %matSet = "%newAsset.imageMap"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + } + + %assetImportSuccessful = TamlWrite(%newAsset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + %file.writeline("//--- OBJECT WRITE BEGIN ---"); + %file.writeline("singleton Material(" @ %assetName @ ") {"); + + //TODO: pass along the shape's target material for this just to be sure + %file.writeLine(" mapTo = \"" @ %assetName @ "\";"); + + if(%assetItem.diffuseImageAsset !$= "") + { + %diffuseAssetPath = "data/" @ %moduleName @ "/Images/" @ fileName(%assetItem.diffuseImageAsset.filePath); + %file.writeline(" DiffuseMap[0] = \"" @ %diffuseAssetPath @"\";"); + %file.writeline(" DiffuseMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.diffuseImageAsset.assetName @"\";"); + } + if(%assetItem.normalImageAsset) + { + %normalAssetPath = "data/" @ %moduleName @ "/Images/" @ fileName(%assetItem.normalImageAsset.filePath); + %file.writeline(" NormalMap[0] = \"" @ %normalAssetPath @"\";"); + %file.writeline(" NormalMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.normalImageAsset.assetName @"\";"); + } + /*if(%assetItem.specularImageAsset) + { + %file.writeline(" SpecularMap[0] = \"" @ %assetItem.specularImageAsset.filePath @"\";"); + %file.writeline(" SpecularMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.specularImageAsset.assetName @"\";"); + }*/ + if(%assetItem.roughnessImageAsset) + { + %file.writeline(" RoughMap[0] = \"" @ %assetItem.roughnessImageAsset.filePath @"\";"); + %file.writeline(" RoughMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.roughnessImageAsset.assetName @"\";"); + } + if(%assetItem.smoothnessImageAsset) + { + %file.writeline(" SmoothnessMap[0] = \"" @ %assetItem.smoothnessImageAsset.filePath @"\";"); + %file.writeline(" SmoothnessMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.smoothnessImageAsset.assetName @"\";"); + } + if(%assetItem.metalnessImageAsset) + { + %file.writeline(" MetalMap[0] = \"" @ %assetItem.metalnessImageAsset.filePath @"\";"); + %file.writeline(" MetalMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.metalnessImageAsset.assetName @"\";"); + } + if(%assetItem.AOImageAsset) + { + %file.writeline(" AOMap[0] = \"" @ %assetItem.AOImageAsset.filePath @"\";"); + %file.writeline(" AOMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.AOImageAsset.assetName @"\";"); + } + if(%assetItem.compositeImageAsset) + { + %file.writeline(" CompositeMap[0] = \"" @ %assetItem.compositeImageAsset.filePath @"\";"); + %file.writeline(" CompositeMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.compositeImageAsset.assetName @"\";"); + } + %file.writeline("};"); + %file.writeline("//--- OBJECT WRITE END ---"); + + %file.close(); + } + } + + if(%assetImportSuccessful) + { + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + + if(!AssetBrowser.isAssetReImport) + AssetDatabase.addDeclaredAsset(%moduleDef, %assetPath @ "/" @ %assetName @ ".asset.taml"); + else + AssetDatabase.refreshAsset(%assetId); + } + } + + //force an update of any and all modules so we have an up-to-date asset list + AssetBrowser.loadFilters(); + AssetBrowser.refreshPreviews(); + Canvas.popDialog(AssetImportCtrl); + AssetBrowser.isAssetReImport = false; +} + +// +function ImportAssetWindow::validateAsset(%this, %assetItem) +{ + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + %moduleName = ImportAssetModuleList.getText(); + + %hasIssues = false; + + //First, check the obvious: name collisions. We should have no asset that shares a similar name. + //If we do, prompt for it be renamed first before continuing + + for(%i=0; %i < %assetCount; %i++) + { + %assetItemA = AssetBrowser.importAssetFinalListArray.getKey(%i); + + if( (%assetItemA.assetName $= %assetItem.assetName) && (%assetItemA.getId() != %assetItem.getId()) ) + { + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!");*/ + + %assetItem.status = "Warning"; + %assetItem.statusType = "DuplicateImportAsset"; + %assetItem.statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" have matching names.\nPlease rename one of them and try again!"; + + %hasIssues = true; + return false; + } + } + + //No collisions of for this name in the importing assets. Now, check against the existing assets in the target module + if(!AssetBrowser.isAssetReImport) + { + %assetQuery = new AssetQuery(); + + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + %foundCollision = false; + for( %f=0; %f < %numAssetsFound; %f++) + { + %assetId = %assetQuery.getAsset(%f); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %testModuleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName !$= %testModuleName) + continue; + + %testAssetName = AssetDatabase.getAssetName(%assetId); + + if(%testAssetName $= %assetItem.assetName) + { + %foundCollision = true; + + %assetItem.status = "Warning"; + %assetItem.statusType = "DuplicateAsset"; + %assetItem.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" has a matching name.\nPlease rename it and try again!"; + + //Clean up our queries + %assetQuery.delete(); + + return false; + } + } + + if(%foundCollision == true) + { + %hasIssues = true; + + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ + + //%assetQuery.delete(); + //return false; + } + + //Clean up our queries + %assetQuery.delete(); + } + + if(!isFile(%assetItem.filePath)) + { + %hasIssues = true; + %assetItem.status = "error"; + %assetItem.statusType = "MissingFile"; + %assetItem.statusInfo = "Unable to find file to be imported. Please select asset file."; + + return false; + } + + return true; +} + +function ImportAssetWindow::resolveIssue(%this, %assetItem) +{ + if(%assetItem.status !$= "Warning") + return; + + //Ok, we actually have a warning, so lets resolve + if(%assetItem.statusType $= "DuplicateImportAsset" || %assetItem.statusType $= "DuplicateAsset") + { + + } + else if(%assetItem.statusType $= "MissingFile") + { + %this.findMissingFile(%assetItem); + } +} +// + +// +function ImportAssetModuleList::onWake(%this) +{ + %this.refresh(); +} + +function ImportAssetModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} +// diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs new file mode 100644 index 000000000..bdd4c2851 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs @@ -0,0 +1,472 @@ +function ImportAssetConfigList::onSelect( %this, %id, %text ) +{ + //Apply our settings to the assets + echo("Changed our import config!"); + AssetBrowser.importAssetUnprocessedListArray.empty(); + AssetBrowser.importAssetUnprocessedListArray.duplicate(AssetBrowser.importAssetNewListArray); + AssetBrowser.importAssetFinalListArray.empty(); + + ImportAssetWindow.activeImportConfigIndex = %id; + ImportAssetWindow.activeImportConfig = ImportAssetWindow.importConfigsList.getKey(%id); + ImportAssetWindow.refresh(); +} + +function ImportAssetOptionsWindow::findMissingFile(%this, %assetItem) +{ + if(%assetItem.assetType $= "Model") + %filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts"; + else if(%assetItem.assetType $= "Image") + %filters = "Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds"; + + %dlg = new OpenFileDialog() + { + Filters = %filters; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = true; + OverwritePrompt = true; + forceRelativePath = false; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = %dlg.FileName;//makeRelativePath( %dlg.FileName, getMainDotCSDir() ); + } + + %dlg.delete(); + + if ( !%ret ) + return; + + %assetItem.filePath = %fullPath; + + ImportAssetWindow.refresh(); +} + +// +function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem) +{ + ImportAssetOptionsWindow.setVisible(1); + ImportAssetOptionsWindow.selectWindow(); + + ImportOptionsList.clearFields(); + + %assetType = %assetItem.assetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + %assetConfigObj = %assetItem.importConfig; + + ImportOptionsList.startGroup("Asset"); + ImportOptionsList.addField("AssetName", "Asset Name", "string", "", "NewAsset", "", %assetItem); + ImportOptionsList.endGroup(); + + if(%assetType $= "Model") + { + //Get the shape info, so we know what we're doing with the mesh + %shapeInfo = GetShapeInfo(%filePath); + %meshItem = %shapeInfo.findItemByName("Meshes"); + %matItem = %shapeInfo.findItemByName("Materials"); + + %meshCount = %shapeInfo.getItemValue(%meshItem); + %matCount = %shapeInfo.getItemValue(%matItem); + + %firstMat = %shapeInfo.getChild(%matItem); + echo("Mesh's first material texture path is: " @ %shapeInfo.getItemValue(%firstMat)); + + if(%meshCount > 0) + { + ImportOptionsList.startGroup("Mesh"); + ImportOptionsList.addField("AutogenCollisions", "Auto-gen Collisions", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("UpAxisOverride", "Up-Axis Override", "list", "", "Z_AXIS", "Z_AXIS,Y_AXIS,X_AXIS", %assetConfigObj); + ImportOptionsList.addField("OverrideScale", "Override Scale", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.addField("IgnoreNodeScale", "IgnoreNodeScaling", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("AdjustCenter", "Adjust Center", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("AdjustFloor", "Adjust Floor", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS", %assetConfigObj); + ImportOptionsList.endGroup(); + } + + if(%matItem > 0) + { + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addCallbackField("ImportMaterials", "Import Materials", "bool", "", "1", "", "ImportMaterialsChanged", %assetConfigObj); + ImportOptionsList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } + } + else if(%assetType $= "Material") + { + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addField("CreateComposites", "Create Composite Textures", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } + else if(%assetType $= "Image") + { + ImportOptionsList.startGroup("Formatting"); + ImportOptionsList.addField("ImageType", "Image Type", "string", "", "Diffuse", "", %assetConfigObj); + ImportOptionsList.addField("TextureFiltering", "Texture Filtering", "list", "", "Bilinear", "None,Bilinear,Trilinear", %assetConfigObj); + ImportOptionsList.addField("UseMips", "Use Mips", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.addField("IsHDR", "Is HDR", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Scaling"); + ImportOptionsList.addField("Scaling", "Scaling", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Compression"); + ImportOptionsList.addField("IsCompressed", "Is Compressed", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addField("GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("UseDiffuseSuffixOnOriginImg", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsList.endGroup(); + } + else if(%assetType $= "Sound") + { + ImportOptionsList.startGroup("Adjustment"); + ImportOptionsList.addField("VolumeAdjust", "VolumeAdjustment", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.addField("PitchAdjust", "PitchAdjustment", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Compression"); + ImportOptionsList.addField("IsCompressed", "Is Compressed", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } +} + +function ImportAssetOptionsWindow::deleteImportingAsset(%this, %assetItem) +{ + %assetIndex = AssetBrowser.importAssetNewListArray.getIndexFromKey(%assetItem); + AssetBrowser.importAssetNewListArray.erase(%assetIndex); + + //check if we have any child assets and remove them as well + for(%i=0; %i < AssetBrowser.importAssetNewListArray.count(); %i++) + { + %asset = AssetBrowser.importAssetNewListArray.getKey(%i); + if(%asset.ParentAssetItem == %assetItem) + { + AssetBrowser.importAssetNewListArray.erase(%i); + %i--; + } + } + + %assetIndex = AssetBrowser.importAssetFinalListArray.getIndexFromKey(%assetItem); + AssetBrowser.importAssetFinalListArray.erase(%assetIndex); + + //check if we have any child assets and remove them as well + for(%i=0; %i < AssetBrowser.importAssetFinalListArray.count(); %i++) + { + %asset = AssetBrowser.importAssetFinalListArray.getKey(%i); + if(%asset.ParentAssetItem == %assetItem) + { + AssetBrowser.importAssetFinalListArray.erase(%i); + %i--; + } + } + + ImportAssetWindow.refresh(); + ImportAssetOptionsWindow.setVisible(0); +} + +function ImportAssetOptionsWindow::saveAssetOptions(%this) +{ + ImportAssetWindow.refresh(); + ImportAssetOptionsWindow.setVisible(0); +} + +function ImportOptionsList::ImportMaterialsChanged(%this, %fieldName, %newValue, %ownerObject) +{ + echo("CHANGED IF OUR IMPORTED MATERIALS WERE HAPPENING!"); +} + +function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj) +{ + AssetImportConfigName.setText(%optionsObj.Name); + + ImportOptionsConfigList.clear(); + + ImportOptionsConfigList.startGroup("Mesh"); + ImportOptionsConfigList.addCallbackField("ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh", %optionsObj); + ImportOptionsConfigList.addField("DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("UpAxisOverride", "Up-axis Override", "list", "", "Z_AXIS", "X_AXIS,Y_AXIS,Z_AXIS", %optionsObj); + ImportOptionsConfigList.addField("DoScaleOverride", "Do Scale Override", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("ScaleOverride", "Scale Override", "float", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreNodeScale", "Ignore Node Scale", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("AdjustCenter", "Adjust Center", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("AdjustFloor", "Adjust Floor", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS", %optionsObj); + //ImportOptionsConfigList.addField("TrailingNumber", "Trailing Number", "float", "", "2", "", %optionsObj, "Mesh"); + ImportOptionsConfigList.addField("ImportedNodes", "Imported Nodes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreNodes", "Ignore Nodes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("ImportMeshes", "Import Meshes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreMeshes", "Imported Meshes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Materials + ImportOptionsConfigList.startGroup("Material"); + ImportOptionsConfigList.addField("ImportMaterials", "Import Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("CreateComposites", "Create Composites", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("UseDiffuseSuffixOnOriginImg", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreMaterials", "Ignore Materials", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Animations + ImportOptionsConfigList.startGroup("Animations"); + ImportOptionsConfigList.addField("ImportAnimations", "Import Animations", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("SeparateAnimations", "Separate Animations", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("SeparateAnimationPrefix", "Separate Animation Prefix", "string", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Collision + ImportOptionsConfigList.startGroup("Collision"); + ImportOptionsConfigList.addField("GenerateCollisions", "Generate Collisions", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenCollisionType", "Generate Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull", %optionsObj); + ImportOptionsConfigList.addField("CollisionMeshPrefix", "CollisionMesh Prefix", "string", "", "Col", "", %optionsObj); + ImportOptionsConfigList.addField("GenerateLOSCollisions", "Generate LOS Collisions", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenLOSCollisionType", "Generate LOS Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull", %optionsObj); + ImportOptionsConfigList.addField("LOSCollisionMeshPrefix", "LOS CollisionMesh Prefix", "string", "", "LOS", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Images + ImportOptionsConfigList.startGroup("Image"); + ImportOptionsConfigList.addField("ImageType", "Image Type", "list", "", "N/A", "N/A,Diffuse,Normal,Specular,Metalness,Roughness,AO,Composite,GUI", %optionsObj); + ImportOptionsConfigList.addField("DiffuseTypeSuffixes", "Diffuse Type Suffixes", "command", "", "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL", "", %optionsObj); + ImportOptionsConfigList.addField("NormalTypeSuffixes", "Normal Type Suffixes", "command", "", "_NORMAL,_NORM", "", %optionsObj); + + if(EditorSettings.lightingModel $= "Legacy") + { + ImportOptionsConfigList.addField("SpecularTypeSuffixes", "Specular Type Suffixes", "command", "", "_SPECULAR,_SPEC", "", %optionsObj); + } + else + { + ImportOptionsConfigList.addField("MetalnessTypeSuffixes", "Metalness Type Suffixes", "command", "", "_METAL,_MET,_METALNESS,_METALLIC", "", %optionsObj); + ImportOptionsConfigList.addField("RoughnessTypeSuffixes", "Roughness Type Suffixes", "command", "", "_ROUGH,_ROUGHNESS", "", %optionsObj); + ImportOptionsConfigList.addField("SmoothnessTypeSuffixes", "Smoothness Type Suffixes", "command", "", "_SMOOTH,_SMOOTHNESS", "", %optionsObj); + ImportOptionsConfigList.addField("AOTypeSuffixes", "AO Type Suffixes", "command", "", "_AO,_AMBIENT,_AMBIENTOCCLUSION", "", %optionsObj); + ImportOptionsConfigList.addField("CompositeTypeSuffixes", "Composite Type Suffixes", "command", "", "_COMP,_COMPOSITE", "", %optionsObj); + } + + ImportOptionsConfigList.addField("TextureFilteringMode", "Texture Filtering Mode", "list", "", "Bilinear", "None,Bilinear,Trilinear", %optionsObj); + ImportOptionsConfigList.addField("UseMips", "Use Mipmaps", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IsHDR", "Is HDR", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("Scaling", "Scaling", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("Compressed", "Is Compressed", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Sounds + ImportOptionsConfigList.startGroup("Sound"); + ImportOptionsConfigList.addField("VolumeAdjust", "Volume Adjustment", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("PitchAdjust", "Pitch Adjustment", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("Compressed", "Is Compressed", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.endGroup(); +} + +function ImportAssetConfigEditorWindow::addNewConfig(%this) +{ + ImportAssetConfigEditorWindow.setVisible(1); + ImportAssetConfigEditorWindow.selectWindow(); + + %optionsObj = new ScriptObject(){}; + + ImportAssetWindow.importConfigsList.add(%optionsObj); + + //Initial, blank configuration + %optionsObj.ImportMesh = true; + %optionsObj.DoUpAxisOverride = false; + %optionsObj.UpAxisOverride = "Z_AXIS"; + %optionsObj.DoScaleOverride = false; + %optionsObj.ScaleOverride = 1.0; + %optionsObj.IgnoreNodeScale = false; + %optionsObj.AdjustCenter = false; + %optionsObj.AdjustFloor = false; + %optionsObj.CollapseSubmeshes = false; + %optionsObj.LODType = "TrailingNumber"; + //%optionsObj.TrailingNumber = 2; + %optionsObj.ImportedNodes = ""; + %optionsObj.IgnoreNodes = ""; + %optionsObj.ImportMeshes = ""; + %optionsObj.IgnoreMeshes = ""; + + //Materials + %optionsObj.ImportMaterials = true; + %optionsObj.CreateComposites = true; + %optionsObj.UseDiffuseSuffixOnOriginImg = true; + %optionsObj.UseExistingMaterials = true; + + //Animations + %optionsObj.ImportAnimations = true; + %optionsObj.SeparateAnimations = true; + %optionsObj.SeparateAnimationPrefix = ""; + + //Collision + %optionsObj.GenerateCollisions = true; + %optionsObj.GenCollisionType = "CollisionMesh"; + %optionsObj.CollisionMeshPrefix = "Col"; + %optionsObj.GenerateLOSCollisions = true; + %optionsObj.GenLOSCollisionType = "CollisionMesh"; + %optionsObj.LOSCollisionMeshPrefix = "LOS"; + + //Images + %optionsObj.ImageType = "N/A"; + %optionsObj.DiffuseTypeSuffixes = "_ALBEDO;_DIFFUSE;_ALB;_DIF;_COLOR;_COL;_BASECOLOR;_BASE_COLOR"; + %optionsObj.NormalTypeSuffixes = "_NORMAL;_NORM"; + %optionsObj.SpecularTypeSuffixes = "_SPECULAR;_SPEC"; + %optionsObj.MetalnessTypeSuffixes = "_METAL;_MET;_METALNESS;_METALLIC"; + %optionsObj.RoughnessTypeSuffixes = "_ROUGH;_ROUGHNESS"; + %optionsObj.SmoothnessTypeSuffixes = "_SMOOTH;_SMOOTHNESS"; + %optionsObj.AOTypeSuffixes = "_AO;_AMBIENT;_AMBIENTOCCLUSION"; + %optionsObj.CompositeTypeSuffixes = "_COMP;_COMPOSITE"; + %optionsObj.TextureFilteringMode = "Bilinear"; + %optionsObj.UseMips = true; + %optionsObj.IsHDR = false; + %optionsObj.Scaling = 1.0; + %optionsObj.Compressed = true; + %optionsObj.GenerateMaterialOnImport = true; + %optionsObj.PopulateMaterialMaps = true; + + //Sounds + %optionsObj.VolumeAdjust = 1.0; + %optionsObj.PitchAdjust = 1.0; + %optionsObj.Compressed = false; + + //Hook in the UI + %this.populateConfigList(%optionsObj); +} + +function ImportAssetConfigEditorWindow::editConfig(%this) +{ + ImportAssetConfigEditorWindow.setVisible(1); + ImportAssetConfigEditorWindow.selectWindow(); + + %this.populateConfigList(ImportAssetWindow.activeImportConfig); +} + +function ImportAssetConfigEditorWindow::deleteConfig(%this) +{ + ImportAssetWindow.importConfigsList.erase(ImportAssetWindow.activeImportConfigIndex); + ImportAssetConfigList.setSelected(0); //update it + + ImportAssetConfigEditorWindow.saveAssetOptionsConfig(); +} + +function ImportAssetConfigEditorWindow::saveAssetOptionsConfig(%this) +{ + %xmlDoc = new SimXMLDocument(); + + %xmlDoc.pushNewElement("AssetImportConfigs"); + + for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) + { + %configObj = ImportAssetWindow.importConfigsList.getKey(%i); + + %xmlDoc.pushNewElement("Config"); + + if(%configObj.Name $= "") + %configObj.Name = AssetImportConfigName.getText(); + + %xmlDoc.setAttribute("Name", %configObj.Name); + + %xmlDoc.pushNewElement("Mesh"); + %xmlDoc.setAttribute("ImportMesh", %configObj.ImportMesh); + %xmlDoc.setAttribute("DoUpAxisOverride", %configObj.DoUpAxisOverride); + %xmlDoc.setAttribute("UpAxisOverride", %configObj.UpAxisOverride); + %xmlDoc.setAttribute("DoScaleOverride", %configObj.DoScaleOverride); + %xmlDoc.setAttribute("ScaleOverride", %configObj.ScaleOverride); + %xmlDoc.setAttribute("IgnoreNodeScale", %configObj.IgnoreNodeScale); + %xmlDoc.setAttribute("AdjustCenter", %configObj.AdjustCenter); + %xmlDoc.setAttribute("AdjustFloor", %configObj.AdjustFloor); + %xmlDoc.setAttribute("CollapseSubmeshes", %configObj.CollapseSubmeshes); + %xmlDoc.setAttribute("LODType", %configObj.LODType); + %xmlDoc.setAttribute("ImportedNodes", %configObj.ImportedNodes); + %xmlDoc.setAttribute("IgnoreNodes", %configObj.IgnoreNodes); + %xmlDoc.setAttribute("ImportMeshes", %configObj.ImportMeshes); + %xmlDoc.setAttribute("IgnoreMeshes", %configObj.IgnoreMeshes); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Materials"); + %xmlDoc.setAttribute("ImportMaterials", %configObj.ImportMaterials); + %xmlDoc.setAttribute("CreateComposites", %configObj.CreateComposites); + %xmlDoc.setAttribute("UseDiffuseSuffixOnOriginImg", %configObj.UseDiffuseSuffixOnOriginImg); + %xmlDoc.setAttribute("UseExistingMaterials", %configObj.UseExistingMaterials); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Animations"); + %xmlDoc.setAttribute("ImportAnimations", %configObj.ImportAnimations); + %xmlDoc.setAttribute("SeparateAnimations", %configObj.SeparateAnimations); + %xmlDoc.setAttribute("SeparateAnimationPrefix", %configObj.SeparateAnimationPrefix); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Collisions"); + %xmlDoc.setAttribute("GenerateCollisions", %configObj.GenerateCollisions); + %xmlDoc.setAttribute("GenCollisionType", %configObj.GenCollisionType); + %xmlDoc.setAttribute("CollisionMeshPrefix", %configObj.CollisionMeshPrefix); + %xmlDoc.setAttribute("GenerateLOSCollisions", %configObj.GenerateLOSCollisions); + %xmlDoc.setAttribute("GenLOSCollisionType", %configObj.GenLOSCollisionType); + %xmlDoc.setAttribute("LOSCollisionMeshPrefix", %configObj.LOSCollisionMeshPrefix); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Images"); + %xmlDoc.setAttribute("ImageType", %configObj.ImageType); + %xmlDoc.setAttribute("DiffuseTypeSuffixes", %configObj.DiffuseTypeSuffixes); + %xmlDoc.setAttribute("NormalTypeSuffixes", %configObj.NormalTypeSuffixes); + %xmlDoc.setAttribute("SpecularTypeSuffixes", %configObj.SpecularTypeSuffixes); + %xmlDoc.setAttribute("MetalnessTypeSuffixes", %configObj.MetalnessTypeSuffixes); + %xmlDoc.setAttribute("RoughnessTypeSuffixes", %configObj.RoughnessTypeSuffixes); + %xmlDoc.setAttribute("SmoothnessTypeSuffixes", %configObj.SmoothnessTypeSuffixes); + %xmlDoc.setAttribute("AOTypeSuffixes", %configObj.AOTypeSuffixes); + %xmlDoc.setAttribute("CompositeTypeSuffixes", %configObj.CompositeTypeSuffixes); + %xmlDoc.setAttribute("TextureFilteringMode", %configObj.TextureFilteringMode); + %xmlDoc.setAttribute("UseMips", %configObj.UseMips); + %xmlDoc.setAttribute("IsHDR", %configObj.IsHDR); + %xmlDoc.setAttribute("Scaling", %configObj.Scaling); + %xmlDoc.setAttribute("Compressed", %configObj.Compressed); + %xmlDoc.setAttribute("GenerateMaterialOnImport", %configObj.GenerateMaterialOnImport); + %xmlDoc.setAttribute("PopulateMaterialMaps", %configObj.PopulateMaterialMaps); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Sounds"); + %xmlDoc.setAttribute("VolumeAdjust", %configObj.VolumeAdjust); + %xmlDoc.setAttribute("PitchAdjust", %configObj.PitchAdjust); + %xmlDoc.setAttribute("Compressed", %configObj.Compressed); + %xmlDoc.popElement(); + + %xmlDoc.popElement(); + } + + %xmlDoc.popElement(); + + %xmlDoc.saveFile($AssetBrowser::importConfigsFile); + + ImportAssetConfigEditorWindow.setVisible(0); + ImportAssetWindow.reloadImportOptionConfigs(); +} + +function ImportOptionsConfigList::ToggleImportMesh(%this, %fieldName, %newValue, %ownerObject) +{ + %this.setFieldEnabled("DoUpAxisOverride", %newValue); + %this.setFieldEnabled("UpAxisOverride", %newValue); + %this.setFieldEnabled("DoScaleOverride", %newValue); + %this.setFieldEnabled("ScaleOverride", %newValue); + %this.setFieldEnabled("IgnoreNodeScale", %newValue); + %this.setFieldEnabled("AdjustCenter", %newValue); + %this.setFieldEnabled("AdjustFloor", %newValue); + %this.setFieldEnabled("CollapseSubmeshes", %newValue); + %this.setFieldEnabled("LODType", %newValue); + %this.setFieldEnabled("ImportedNodes", %newValue); + %this.setFieldEnabled("IgnoreNodes", %newValue); + %this.setFieldEnabled("ImportMeshes", %newValue); + %this.setFieldEnabled("IgnoreMeshes", %newValue); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs new file mode 100644 index 000000000..bc80f8977 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs @@ -0,0 +1,371 @@ +function AssetBrowser_editAsset::saveAsset(%this) +{ + %file = AssetDatabase.getAssetFilePath(%this.editedAssetId); + %success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file); + + AssetBrowser.loadFilters(); + + Canvas.popDialog(AssetBrowser_editAsset); +} + +function AssetBrowser::editAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = %assetDef.getClassName(); + + if(%assetType $= "MaterialAsset") + { + //if(EditorSettings.materialEditMode $= "MaterialEditor") + //{ + %assetDef.materialDefinitionName.reload(); + + EditorGui.setEditor(MaterialEditorPlugin); + + MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName; + MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName ); + + AssetBrowser.hideDialog(); + /*} + else + { + Canvas.pushDialog(ShaderEditor); + ShaderEditorGraph.loadGraph(%assetDef.shaderGraph); + $ShaderGen::targetShaderFile = filePath(%assetDef.shaderGraph) @"/"@fileBase(%assetDef.shaderGraph); + }*/ + } + else if(%assetType $= "StateMachineAsset") + { + eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();"); + AssetBrowser.tempAsset.assignFieldsFrom(%assetDef); + + SMAssetEditInspector.inspect(AssetBrowser.tempAsset); + AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId; + AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset; + + //remove some of the groups we don't need: + for(%i=0; %i < SMAssetEditInspector.getCount(); %i++) + { + %caption = SMAssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + SMAssetEditInspector.remove(SMAssetEditInspector.getObject(%i)); + %i--; + } + } + + Canvas.pushDialog(StateMachineEditor); + StateMachineEditor.loadStateMachineAsset(EditAssetPopup.assetId); + StateMachineEditor-->Window.text = "State Machine Editor ("@EditAssetPopup.assetId@")"; + } + else if(%assetType $= "ComponentAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFile; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "GameObjectAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFilePath; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "ScriptAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFilePath; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "ShapeAsset") + { + %this.hideDialog(); + ShapeEditorPlugin.openShapeAsset(EditAssetPopup.assetId); + } + else if(%assetType $= "ShapeAnimationAsset") + { + %this.hideDialog(); + ShapeEditorPlugin.openShapeAsset(EditAssetPopup.assetId); + } + else if(%assetType $= "LevelAsset") + { + schedule( 1, 0, "EditorOpenMission", %assetDef.LevelFile); + } + else if(%assetType $= "GUIAsset") + { + if(!isObject(%assetDef.assetName)) + { + exec(%assetDef.GUIFilePath); + exec(%assetDef.mScriptFilePath); + } + + GuiEditContent(%assetDef.assetName); + } +} + +function AssetBrowser::editAssetInfo(%this) +{ + Canvas.pushDialog(AssetBrowser_editAsset); + + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();"); + AssetBrowser.tempAsset.assignFieldsFrom(%assetDef); + + AssetEditInspector.inspect(AssetBrowser.tempAsset); + AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId; + AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset; + + //remove some of the groups we don't need: + for(%i=0; %i < AssetEditInspector.getCount(); %i++) + { + %caption = AssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + AssetEditInspector.remove(AssetEditInspector.getObject(%i)); + %i--; + } + } +} + +//------------------------------------------------------------ + +function AssetBrowser::refreshAsset(%this, %assetId) +{ + if(%assetId $= "") + { + //if we have no passed-in asset ID, we're probably going through the popup menu, so get our edit popup id + %assetId = EditAssetPopup.assetId; + } + + AssetDatabase.refreshAsset(%assetId); + AssetBrowser.refreshPreviews(); +} + +//------------------------------------------------------------ + +function AssetBrowser::renameAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + %curFirstResponder = AssetBrowser.getFirstResponder(); + + if(%curFirstResponder != 0) + %curFirstResponder.clearFirstResponder(); + + AssetBrowser.selectedAssetPreview-->AssetNameLabel.setActive(true); + AssetBrowser.selectedAssetPreview-->AssetNameLabel.setFirstResponder(); +} + +function AssetNameField::onReturn(%this) +{ + //if the name is different to the asset's original name, rename it! + %newName = %this.getText(); + if(%this.originalAssetName !$= %this.getText()) + { + %moduleName = AssetBrowser.selectedModule; + + //do a rename! + %success = AssetDatabase.renameDeclaredAsset(%moduleName @ ":" @ %this.originalAssetName, %moduleName @ ":" @ %this.getText()); + + if(%success) + { + %newAssetId = %moduleName @ ":" @ %this.getText(); + %assetPath = AssetDatabase.getAssetFilePath(%newAssetId); + + //Rename any associated files as well + %assetDef = AssetDatabase.acquireAsset(%newAssetId); + %assetType = %assetDef.getClassName(); + + //rename the file to match + %path = filePath(%assetPath); + + if(%assetType $= "ComponentAsset") + { + %oldScriptFilePath = %assetDef.scriptFile; + %scriptFilePath = filePath(%assetDef.scriptFile); + %scriptExt = fileExt(%assetDef.scriptFile); + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + + %assetDef.componentName = %newName; + %assetDef.scriptFile = %newScriptFileName; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + exec(%newScriptFileName); + } + else if(%assetType $= "StateMachineAsset") + { + %oldScriptFilePath = %assetDef.stateMachineFile; + %scriptFilePath = filePath(%assetDef.stateMachineFile); + %scriptExt = fileExt(%assetDef.stateMachineFile); + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + + %assetDef.stateMachineFile = %newScriptFileName; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + } + else if(%assetType $= "GameObjectAsset") + { + %oldScriptFilePath = %assetDef.scriptFilePath; + %scriptFilePath = filePath(%assetDef.scriptFilePath); + %scriptExt = fileExt(%assetDef.scriptFilePath); + + %oldGOFilePath = %assetDef.TAMLFilePath; + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + %newGOFile = %path @ "/" @ %this.getText() @ ".taml"; + + %assetDef.gameObjectName = %newName; + %assetDef.scriptFilePath = %newScriptFileName; + %assetDef.TAMLFilePath = %newGOFile; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + + pathCopy(%oldGOFilePath, %newGOFile); + fileDelete(%oldGOFilePath); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + exec(%newScriptFileName); + + //Rename in the TAML file as well + %file = new FileObject(); + if ( %file.openForRead( %newGOFile ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newGOFile); + + %file.writeline(%editedFileContents); + + %file.close(); + } + } + } + } + + %this.clearFirstResponder(); + %this.setActive(false); +} + +//------------------------------------------------------------ + +function AssetBrowser::duplicateAsset(%this) +{ + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + %this.setupCreateNewAsset(%assetDef.getClassName(), AssetBrowser.selectedModule); +} + +function AssetBrowser::deleteAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = %assetDef.getClassName(); + + MessageBoxOKCancel("Warning!", "This will delete the selected asset and the files associated to it, do you wish to continue?", + "AssetBrowser.confirmDeleteAsset();", ""); +} + +function AssetBrowser::confirmDeleteAsset(%this) +{ + %currentSelectedItem = AssetBrowserFilterTree.getSelectedItem(); + %currentItemParent = AssetBrowserFilterTree.getParentItem(%currentSelectedItem); + + AssetDatabase.deleteAsset(EditAssetPopup.assetId, false); + + %this.loadFilters(); + + if(!AssetBrowserFilterTree.selectItem(%currentSelectedItem)) + { + //if it failed, that means we deleted the last item in that category, and we need to do the parent + AssetBrowserFilterTree.selectItem(%currentItemParent); + AssetBrowserFilterTree.expandItem(%currentItemParent); + } +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs new file mode 100644 index 000000000..996bec6f0 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs @@ -0,0 +1,127 @@ +// +function AssetBrowser::CreateNewModule(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); + + AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadFilters();"; +} + +function AssetBrowser_editModule::saveModule(%this) +{ + //Check what special actions we may need to do, such as renames + %moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1); + + %oldModuleName = %moduleDef.ModuleID; + + if(%oldModuleName !$= AssetBrowser.tempModule.ModuleID) + { + //rename the script file and script namespaces + %oldScriptFilePath = "data/" @ %oldModuleName @ "/" @ %moduleDef.scriptFile; + %newscriptFilePath = "data/" @ AssetBrowser.tempModule.ModuleID @ "/"; + %scriptExt = fileExt(%moduleDef.scriptFile); + + %newScriptFileName = %newscriptFilePath @ "/" @ AssetBrowser.tempModule.ModuleID @ %scriptExt; + %newScriptFileOldName = %newscriptFilePath @ "/" @ %oldModuleName @ %scriptExt; + + %moduleDef.ModuleId = AssetBrowser.tempModule.ModuleID; + %moduleDef.scriptFile = AssetBrowser.tempModule.ModuleID @ %scriptExt; + + ModuleDatabase.copyModule(%moduleDef, AssetBrowser.tempModule.ModuleID, "data/" @ AssetBrowser.tempModule.ModuleID); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileOldName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %oldModuleName, AssetBrowser.tempModule.ModuleID) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + %success = fileDelete(%newScriptFileOldName); + + ModuleDatabase.unloadExplicit(%oldModuleName); + + %success = fileDelete("data/" @ %oldModuleName); + + ModuleDatabase.loadExplicit(AssetBrowser.tempModule.ModuleID); + } + + //Now, update the module file itself + //%file = ModuleDatabase.getAssetFilePath(%moduleDef.ModuleID); + //%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file); + + AssetBrowser.loadFilters(); + + Canvas.popDialog(AssetBrowser_editModule); +} + +function AssetBrowser::editModuleInfo(%this) +{ + Canvas.pushDialog(AssetBrowser_editModule); + + %moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1); + + AssetBrowser.tempModule = new ModuleDefinition(); + AssetBrowser.tempModule.assignFieldsFrom(%moduleDef); + + ModuleEditInspector.inspect(AssetBrowser.tempModule); + AssetBrowser_editModule.editedModuleId = AssetBrowser.selectedModule; + AssetBrowser_editModule.editedModule = AssetBrowser.tempModule; + + //remove some of the groups we don't need: + for(%i=0; %i < ModuleEditInspector.getCount(); %i++) + { + %caption = ModuleEditInspector.getObject(%i).caption; + + if(%caption $= "BuildId" || %caption $= "type" || %caption $= "Dependencies" || %caption $= "scriptFile" + || %caption $= "AssetTagsManifest" || %caption $= "ScopeSet" || %caption $= "ModulePath" + || %caption $= "ModuleFile" || %caption $= "ModuleFilePath" || %caption $= "ModuleScriptFilePath" ) + { + ModuleEditInspector.remove(ModuleEditInspector.getObject(%i)); + %i--; + } + } +} + +function AssetBrowser::renameModule(%this) +{ + +} + +function AssetBrowser::reloadModule(%this) +{ + ModuleDatabase.unregisterModule(AssetBrowser.SelectedModule, 1); + ModuleDatabase.loadExplicit(AssetBrowser.SelectedModule); +} + +function AssetBrowser::deleteModule(%this) +{ + +} + +function AssetBrowser::RefreshModuleDependencies(%this) +{ + //Iterate through all our modules + + //then, iterate through the module's assets + + //if an asset has a module that isn't us, queue that into the dependencies list +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs new file mode 100644 index 000000000..fe524ce65 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs @@ -0,0 +1,127 @@ +function GuiVariableInspector::onInspectorFieldModified(%this, %targetObj, %fieldName, %index, %oldValue, %newValue) +{ + echo("FIELD CHANGED: " @ %fieldName @ " from " @ %oldValue @ " to " @ %newValue); +} + +function GuiInspectorVariableGroup::onConstructField(%this, %fieldName, %fieldLabel, %fieldTypeName, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) +{ + %makeCommand = %this @ ".build" @ %fieldTypeName @ "Field(\""@ %fieldName @ "\",\"" @ %fieldLabel @ "\",\"" @ %fieldDesc @ "\",\"" @ + %fieldDefaultVal @ "\",\"" @ %fieldDataVals @ "\",\"" @ %ownerObj @"\");"; + eval(%makeCommand); +} + +function GuiInspectorVariableGroup::buildListField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) +{ + %extent = 200; + + %fieldCtrl = %this.createInspectorField(); + + %extent = %this.stack.getExtent(); + + %width = mRound(%extent/2); + %height = 20; + %inset = 10; + + /*%container = new GuiControl() { + canSaveDynamicFields = "0"; + Profile = "EditorContainerProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = %extent.x SPC %height; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = %tooltip; + tooltipProfile = "EditorToolTipProfile"; + }; + + %labelControl = new GuiTextCtrl() { + canSaveDynamicFields = "0"; + Profile = "EditorFontHLBold"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %inset SPC "0"; + Extent = %width + %inset SPC %height; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = %tooltip; + tooltipProfile = "EditorToolTipProfile"; + text = %fieldLabel; + maxLength = "1024"; + };*/ + + %editControl = new GuiPopUpMenuCtrl() { + class = "guiInspectorListField"; + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + maxLength = "1024"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + isContainer = "0"; + Profile = "ToolsGuiPopUpMenuProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %fieldCtrl.edit.position; + Extent = %fieldCtrl.edit.extent; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + tooltip = %tooltip; + text = %fieldDefaultVal; + hovertime = "1000"; + ownerObject = %ownerObj; + fieldName = %fieldName; + }; + + //set the field value + if(getSubStr(%this.fieldName, 0, 1) $= "$") + { + if(%fieldName $= "") + %editControl.setText(%fieldName); + } + else + { + //regular variable + %setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");"; + eval(%setCommand); + } + + %listCount = getTokenCount(%fieldDataVals, ","); + + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%fieldDataVals, ",", %i); + %editControl.add(%entryText); + } + + %fieldCtrl.setCaption(%fieldLabel); + %fieldCtrl.setEditControl(%editControl); + + %this.addInspectorField(%fieldCtrl); +} + +function guiInspectorListField::onSelect( %this, %id, %text ) +{ + if(getSubStr(%this.fieldName, 0, 1) $= "$") + { + //ah, a global var, just do it straight, then + %setCommand = %this.fieldName @ " = \"" @ %text @ "\";"; + } + else + { + //regular variable + %setCommand = %this.ownerObject @ "." @ %this.fieldName @ " = \"" @ %text @ "\";"; + } + eval(%setCommand); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs new file mode 100644 index 000000000..a2c526251 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs @@ -0,0 +1,130 @@ +function GameObjectModuleList::onWake(%this) +{ + %this.refresh(); +} + +function GameObjectModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} + +function GameObjectCreatorPkgBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); +} + +function GameObjectCreateBtn::onClick(%this) +{ + %className = GameObjectCreatorName.getText(); + + if(%className $= "") + { + error("Attempted to make a new Game Object with no name!"); + Canvas.popDialog(GameObjectCreator); + return; + } + + //First, find out if this one already exists. If so, we're obviously merely updating it + //also, exec any components that may exist + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + %createNew = true; + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + if(%gameObjectAsset.gameObjectName $= %className) + { + %createNew = false; + break; + } + } + + %selectedEntity = GameObjectCreator.selectedEntity; + + %selectedEntity.class = %className; + Inspector.inspect(%selectedEntity); + + if(%createNew) + { + //get the selected module data + %moduleName = GameObjectModuleList.getText(); + + %selectedEntity.gameObjectAsset = %moduleName @ ":" @ %className; + + %path = "data/" @ %moduleName @ "/gameObjects/"; + + %file = new FileObject(); + + if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) + { + %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //set up the paths + %tamlPath = %path @ %className @ ".taml"; + %scriptPath = %path @ %className @ ".cs"; + saveGameObject(%className, %tamlPath, %scriptPath); + + %asset = new GameObjectAsset() + { + AssetName = %className; + VersionId = 1; + gameObjectName=%className; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + %assetPath = %path @ %className @ ".asset.taml"; + + //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. + TamlWrite(%selectedEntity, %tamlpath); + TamlWrite(%asset, %assetPath); + + GameObjectCreator.selectedEntity = ""; + + Canvas.popDialog(GameObjectCreator); + + //Load it + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + AssetDatabase.addDeclaredAsset(%moduleDef, %assetPath); + } + else + { + %moduleDef = AssetDatabase.getAssetModule(%assetId); + %moduleName = %moduleDef.ModuleId; + %path = "data/" @ %moduleName @ "/gameObjects/"; + + %selectedEntity.gameObjectAsset = %moduleName @ ":" @ %className; + + %tamlPath = %path @ %className @ ".taml"; + TamlWrite(%selectedEntity, %tamlpath); + + GameObjectCreator.selectedEntity = ""; + + Canvas.popDialog(GameObjectCreator); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs new file mode 100644 index 000000000..ee351a192 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs @@ -0,0 +1,663 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function CreateAssetButton::onClick(%this) +{ + AddNewAssetPopup.showPopup(Canvas); +} + +function AssetBrowser_newAsset::onWake(%this) +{ + NewAssetModuleList.refresh(); + //NewComponentParentClass.setText("Component"); +} + +function AssetBrowser_newAssetWindow::onClose(%this) +{ + NewAssetPropertiesInspector.clearFields(); + Canvas.popDialog(AssetBrowser_newAsset); +} + +function NewAssetTypeList::onWake(%this) +{ + %this.refresh(); +} + +function NewAssetTypeList::refresh(%this) +{ + %this.clear(); + + //TODO: make this more automated + //%this.add("GameObject", 0); + %this.add("Component", 0); + %this.add("Image", 1); + %this.add("Material", 2); + %this.add("Shape", 3); + %this.add("Sound", 4); + %this.add("State Machine", 5); +} + +function NewAssetTypeList::onSelected(%this) +{ + %assetType = %this.getText(); + + if(%assetType $= "Component") + { + NewComponentAssetSettings.hidden = false; + } +} + +function NewAssetModuleBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); +} + +function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName) +{ + Canvas.pushDialog(AssetBrowser_newAsset); + + AssetBrowser_newAssetWindow.text = "New" SPC %assetType SPC "Asset"; + + NewAssetPropertiesInspector.clear(); + + NewAssetModuleList.setText(%moduleName); + + //get rid of the old one if we had one. + if(isObject(%this.newAssetSettings)) + %this.newAssetSettings.delete(); + + %this.newAssetSettings = new ScriptObject(); + + %this.newAssetSettings.assetType = %assetType; + %this.newAssetSettings.moduleName = %moduleName; + + %shortAssetTypeName = strreplace(%assetType, "Asset", ""); + + NewAssetPropertiesInspector.startGroup("General"); + NewAssetPropertiesInspector.addField("assetName", "New Asset Name", "String", "Name of the new asset", "New" @ %shortAssetTypeName, "", %this.newAssetSettings); + //NewAssetPropertiesInspector.addField("AssetType", "New Asset Type", "List", "Type of the new asset", %assetType, "Component,Image,Material,Shape,Sound,State Machine", %newAssetSettings); + + NewAssetPropertiesInspector.addField("friendlyName", "Friendly Name", "String", "Human-readable name of new asset", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("description", "Description", "Command", "Description of the new asset", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + + if(%assetType $= "ComponentAsset") + { + NewAssetPropertiesInspector.startGroup("Components"); + NewAssetPropertiesInspector.addField("parentClass", "New Asset Parent Class", "String", "Name of the new asset's parent class", "Component", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("componentGroup", "Component Group", "String", "Name of the group of components this component asset belongs to", "", "", %this.newAssetSettings); + //NewAssetPropertiesInspector.addField("componentName", "Component Name", "String", "Name of the new component", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + else if(%assetType $= "LevelAsset") + { + NewAssetPropertiesInspector.startGroup("Level"); + NewAssetPropertiesInspector.addField("levelPreviewImage", "LevePreviewImage", "Image", "Preview Image for the level", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + else if(%assetType $= "ScriptAsset") + { + NewAssetPropertiesInspector.startGroup("Script"); + NewAssetPropertiesInspector.addField("isServerScript", "Is Server Script", "bool", "Is this script used on the server?", "1", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + /*else if(%assetType $= "ShapeAnimationAsset") + { + NewAssetPropertiesInspector.startGroup("Animation"); + NewAssetPropertiesInspector.addField("sourceFile", "Source File", "filename", "Source file this animation will pull from", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("animationName", "Animation Name", "string", "Name of the animation clip when used in a shape", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("startFrame", "Starting Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("endFrame", "Ending Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("padRotation", "Pad Rotations", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("padTransforms", "Pad Transforms", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + }*/ + + return; + + if(%moduleName $= "") + { + Canvas.pushDialog(AssetBrowser_selectModule); + } + else + { + AssetBrowser.SelectedModule = %moduleName; + + if(%assetType $= "MaterialAsset") + { + createNewMaterialAsset("NewMaterial", %moduleName); + } + else if(%assetType $= "StateMachineAsset") + { + createNewStateMachineAsset("NewStateMachine", %moduleName); + } + else if(%assetType $= "ScriptAsset") + { + createNewScriptAsset("NewScriptAsset", %moduleName); + } + } +} + +//We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function +function CreateNewAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + if(%assetName $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no name!"); + return; + } + + //get the selected module data + %moduleName = NewAssetModuleList.getText(); + + if(%moduleName $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no module!"); + return; + } + + AssetBrowser.newAssetSettings.moduleName = %moduleName; + + %assetType = AssetBrowser.newAssetSettings.assetType; + if(%assetType $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no type!"); + return; + } + + if(%assetType $= "ComponentAsset") + { + //Canvas.popDialog(AssetBrowser_newComponentAsset); + //AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule); + %assetFilePath = createNewComponentAsset(%assetName, %path); + } + else if(%assetType $= "MaterialAsset") + { + %assetFilePath = createNewMaterialAsset(); + } + else if(%assetType $= "StateMachineAsset") + { + %assetFilePath = createNewStateMachineAsset(); + } + else if(%assetType $= "GUIAsset") + { + %assetFilePath = createNewGUIAsset(); + } + else if(%assetType $= "LevelAsset") + { + %assetFilePath = createNewLevelAsset(); + } + else if(%assetType $= "ScriptAsset") + { + %assetFilePath = createNewScriptAsset(); + } + else if(%assetType $= "ShapeAnimationAsset") + { + %assetFilePath = createShapeAnimationAsset(); + } + + Canvas.popDialog(AssetBrowser_newAsset); + + //Load it + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath); + + AssetBrowser.loadFilters(); +} + +function createNewComponentAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/components/" @ %assetName @ ".asset.taml"; + %scriptPath = %modulePath @ "/components/" @ %assetName @ ".cs"; + + %asset = new ComponentAsset() + { + AssetName = %assetName; + versionId = 1; + componentName = %assetName; + componentClass = AssetBrowser.newAssetSettings.parentClass; + friendlyName = AssetBrowser.newAssetSettings.friendlyName; + componentType = AssetBrowser.newAssetSettings.componentGroup; + description = AssetBrowser.newAssetSettings.description; + scriptFile = %scriptPath; + }; + + TamlWrite(%asset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + //TODO: enable ability to auto-embed a header for copyright or whatnot + %file.writeline("//onAdd is called when the component is created and then added to it's owner entity.\n"); + %file.writeline("//You would also add any script-defined component fields via addComponentField().\n"); + %file.writeline("function " @ %assetName @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("//onAdd is called when the component is removed and deleted from it's owner entity."); + %file.writeline("function " @ %assetName @ "::onRemove(%this)\n{\n\n}\n"); + %file.writeline("//onClientConnect is called any time a new client connects to the server."); + %file.writeline("function " @ %assetName @ "::onClientConnect(%this, %client)\n{\n\n}\n"); + %file.writeline("//onClientDisconnect is called any time a client disconnects from the server."); + %file.writeline("function " @ %assetName @ "::onClientDisonnect(%this, %client)\n{\n\n}\n"); + %file.writeline("//update is called when the component does an update tick.\n"); + %file.writeline("function " @ %assetName @ "::Update(%this)\n{\n\n}\n"); + + %file.close(); + } + + Canvas.popDialog(AssetBrowser_newComponentAsset); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Components"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewMaterialAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %tamlpath = %modulePath @ "/materials/" @ %assetName @ ".asset.taml"; + %sgfPath = %modulePath @ "/materials/" @ %assetName @ ".sgf"; + + %asset = new MaterialAsset() + { + AssetName = %assetName; + versionId = 1; + shaderData = ""; + shaderGraph = %sgfPath; + }; + + TamlWrite(%asset, %tamlpath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Materials"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewScriptAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/scripts/" @ %assetName @ ".asset.taml"; + %scriptPath = %modulePath @ "/scripts/" @ %assetName @ ".cs"; + + %asset = new ScriptAsset() + { + AssetName = %assetName; + versionId = 1; + scriptFilePath = %scriptPath; + }; + + TamlWrite(%asset, %tamlpath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Scripts"); + + AssetBrowserFilterTree.onSelect(%smItem); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + %file.close(); + } + + return %tamlpath; +} + +function createNewStateMachineAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + %assetQuery = new AssetQuery(); + + %matchingAssetCount = AssetDatabase.findAssetName(%assetQuery, %assetName); + + %i=1; + while(%matchingAssetCount > 0) + { + %newAssetName = %assetName @ %i; + %i++; + + %matchingAssetCount = AssetDatabase.findAssetName(%assetQuery, %newAssetName); + } + + %assetName = %newAssetName; + + %assetQuery.delete(); + + %tamlpath = "data/" @ %moduleName @ "/stateMachines/" @ %assetName @ ".asset.taml"; + %smFilePath = "data/" @ %moduleName @ "/stateMachines/" @ %assetName @ ".xml"; + + %asset = new StateMachineAsset() + { + AssetName = %assetName; + versionId = 1; + stateMachineFile = %smFilePath; + }; + + %xmlDoc = new SimXMLDocument(); + %xmlDoc.saveFile(%smFilePath); + %xmlDoc.delete(); + + TamlWrite(%asset, %tamlpath); + + //Now write our XML file + %xmlFile = new FileObject(); + %xmlFile.openForWrite(%smFilePath); + %xmlFile.writeLine(""); + %xmlFile.writeLine(""); + %xmlFile.close(); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "StateMachines"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewGUIAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/GUIs/" @ %assetName @ ".asset.taml"; + %guipath = %modulePath @ "/GUIs/" @ %assetName @ ".gui"; + %scriptPath = %modulePath @ "/GUIs/" @ %assetName @ ".cs"; + + %asset = new GUIAsset() + { + AssetName = %assetName; + versionId = 1; + scriptFilePath = %scriptPath; + guiFilePath = %guipath; + }; + + TamlWrite(%asset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%guipath)) + { + %file.writeline("//--- OBJECT WRITE BEGIN ---"); + %file.writeline("%guiContent = new GuiControl(" @ %assetName @ ") {"); + %file.writeline(" position = \"0 0\";"); + %file.writeline(" extent = \"100 100\";"); + %file.writeline("};"); + %file.writeline("//--- OBJECT WRITE END ---"); + + %file.close(); + } + + if(%file.openForWrite(%scriptPath)) + { + %file.writeline("function " @ %assetName @ "::onWake(%this)\n{\n\n}\n"); + %file.writeline("function " @ %assetName @ "::onSleep(%this)\n{\n\n}\n"); + + %file.close(); + } + + //load the gui + exec(%guipath); + exec(%scriptPath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "GUIs"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewLevelAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; + %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + + %asset = new LevelAsset() + { + AssetName = %assetName; + versionId = 1; + LevelFile = %levelPath; + LevelDescription = AssetBrowser.newAssetSettings.levelDescription; + PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; + }; + + TamlWrite(%asset, %tamlpath); + + if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false)) + { + echo("Unable to copy template level file!"); + } + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewShapeAnimationAsset() +{ + %dlg = new OpenFileDialog() + { + Filters = "Animation Files(*.dae, *.cached.dts)|*.dae;*.cached.dts"; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = false; + OverwritePrompt = true; + forceRelativePath = false; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = %dlg.FileName; + } + + %dlg.delete(); + + if ( !%ret ) + return; + + /*%moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; + %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + + %asset = new ShapeAnimationAsset() + { + AssetName = %assetName; + versionId = 1; + LevelFile = %levelPath; + LevelDescription = AssetBrowser.newAssetSettings.levelDescription; + PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; + }; + + TamlWrite(%asset, %tamlpath); + + if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false)) + { + echo("Unable to copy template level file!"); + } + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath;*/ +} + +function ParentComponentList::onWake(%this) +{ + %this.refresh(); +} + +function ParentComponentList::refresh(%this) +{ + %this.clear(); + + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "ComponentAsset")) + return; //if we didn't find ANY, just exit + + // Find all the types. + %count = %assetQuery.getCount(); + + /*%categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentName = %componentAsset.componentName; + + if(%componentName $= "") + %componentName = %componentAsset.componentClass; + + %this.add(%componentName, %i); + }*/ + + %categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentClass = %componentAsset.componentClass; + if (!isInList(%componentClass, %categories)) + %categories = %categories TAB %componentClass; + } + + %categories = trim(%categories); + + %index = 0; + %categoryCount = getFieldCount(%categories); + for (%i = 0; %i < %categoryCount; %i++) + { + %category = getField(%categories, %i); + %this.addCategory(%category); + + for (%j = 0; %j < %count; %j++) + { + %assetId = %assetQuery.getAsset(%j); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentName = %componentAsset.componentName; + %componentClass = %componentAsset.componentClass; + + if (%componentClass $= %category) + { + if(%componentName !$= "") + %this.add(" "@%componentName, %i); + } + } + } +} + +//---------------------------------------------------------- +// Game Object creation +//---------------------------------------------------------- +function EWorldEditor::createGameObject( %this ) +{ + GameObjectCreatorObjectName.text = ""; + + %activeSelection = %this.getActiveSelection(); + if( %activeSelection.getCount() == 0 ) + return; + + GameObjectCreator.selectedEntity = %activeSelection.getObject( 0 ); + + Canvas.pushDialog(GameObjectCreator); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs new file mode 100644 index 000000000..12f422485 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs @@ -0,0 +1,154 @@ +function AssetBrowser::buildPopupMenus(%this) +{ + if( !isObject( AddNewModulePopup ) ) + { + new PopupMenu( AddNewModulePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + isPopup = true; + + item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; + item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();"; + }; + } + + if( !isObject( EditAssetPopup ) ) + { + new PopupMenu( EditAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Edit Asset" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 1 ] = "Rename Asset" TAB "" TAB "AssetBrowser.renameAsset();"; + item[ 2 ] = "Refresh Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; + item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();"; + item[ 4 ] = "-"; + Item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; + item[ 6 ] = "-"; + item[ 7 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; + item[ 8 ] = "-"; + item[ 9 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; + + jumpFileName = ""; + jumpLineNumber = ""; + }; + } + + if( !isObject( AddNewComponentAssetPopup ) ) + { + new PopupMenu( AddNewComponentAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + //item[ 0 ] = "Create Component" TAB "" TAB "Canvas.pushDialog(AssetBrowser_newComponentAsset); AssetBrowser_newComponentAsset-->NewComponentPackageList.setText(AssetBrowser.selectedModule);"; + item[ 0 ] = "Component" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ComponentAsset\", AssetBrowser.selectedModule);"; + + //list other common component types here to shortcut the creation process + }; + } + + if( !isObject( AddNewScriptAssetPopup ) ) + { + %this.AddNewScriptAssetPopup = new PopupMenu( AddNewScriptAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create Component" TAB AddNewComponentAssetPopup; + item[ 1 ] = "Create Script" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ScriptAsset\", AssetBrowser.selectedModule);"; + item[ 2 ] = "Create State Machine" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"StateMachineAsset\", AssetBrowser.selectedModule);"; + //item[ 3 ] = "-"; + //item[ 3 ] = "Create Game Object" TAB "" TAB "AssetBrowser.createNewGameObjectAsset(\"NewGameObject\", AssetBrowser.selectedModule);"; + }; + //%this.AddNewScriptAssetPopup.insertSubMenu(0, "Create Component", AddNewComponentAssetPopup); + } + + if( !isObject( AddNewArtAssetPopup ) ) + { + %this.AddNewArtAssetPopup = new PopupMenu( AddNewArtAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"MaterialAsset\", AssetBrowser.selectedModule);";//"createNewMaterialAsset(\"NewMaterial\", AssetBrowser.selectedModule);"; + item[ 1 ] = "Create Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);"; + item[ 2 ] = "-"; + item[ 3 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);"; + item[ 4 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);"; + item[ 5 ] = "-"; + item[ 6 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);"; + item[ 7 ] = "-"; + item[ 8 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);"; + item[ 9 ] = "-"; + item[ 10 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);"; + item[ 11 ] = "-"; + item[ 12 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);"; + }; + } + + if( !isObject( AddNewAssetPopup ) ) + { + %this.AddNewAssetPopup = new PopupMenu( AddNewAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + + item[0] = "Create Code Asset" TAB AddNewScriptAssetPopup; + item[1] = "-"; + item[2] = "Create Art Asset" TAB AddNewArtAssetPopup; + item[3] = "-"; + item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);"; + }; + } + + if( !isObject( EditModulePopup ) ) + { + new PopupMenu( EditModulePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create New Asset" TAB AddNewAssetPopup; + item[ 1 ] = "Reload Module" TAB "" TAB "AssetBrowser.reloadModule();"; + Item[ 2 ] = "-"; + Item[ 3 ] = "Edit Module" TAB "" TAB "AssetBrowser.editModuleInfo();"; + Item[ 4 ] = "-"; + Item[ 5 ] = "Duplicate Module" TAB "" TAB "AssetBrowser.copyModule();"; + Item[ 6 ] = "-"; + Item[ 7 ] = "Delete Module" TAB "" TAB "AssetBrowser.deleteModule();"; + }; + } + + //Some assets are not yet ready/implemented, so disable their creation here + AddNewArtAssetPopup.enableItem(3, false); //shape + AddNewArtAssetPopup.enableItem(4, false); //shape animation + AddNewArtAssetPopup.enableItem(8, false); //post effect + AddNewArtAssetPopup.enableItem(10, false); //sound asset + AddNewArtAssetPopup.enableItem(12, false); //particle effect + + AddNewScriptAssetPopup.enableItem(2, false); //state machine +} + +function AddNewScriptAssetPopupMenu::onSelectItem(%this, %id, %text) +{ + return true; +} +function AddNewScriptAssetPopupMenu::setupDefaultState(%this) +{ + // Setup camera speed gui's. Both menu and editorgui + %this.setupGuiControls(); + + Parent::setupDefaultState(%this); +} + +function AddNewScriptAssetPopupMenu::setupGuiControls(%this) +{ +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs new file mode 100644 index 000000000..3c2c7c1ea --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs @@ -0,0 +1,17 @@ +function AssetBrowser_selectModule::onWake(%this) +{ + AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); +} + +function SelectModule_NewAssetModuleBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); + + AssetBrowser_AddModule.callback = "AssetBrowser_selectModule.newModuleAdded();"; +} + +function AssetBrowser_selectModule::newModuleAdded(%this) +{ + AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs new file mode 100644 index 000000000..42f66ddb1 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs @@ -0,0 +1,17 @@ +function AssetBrowser_selectPackage::onWake(%this) +{ + AssetBrowser_SelectPackageWindow-->packageList.refresh(); +} + +function SelectPackage_NewAssetPackageBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddPackage); + AssetBrowser_addPackageWindow.selectWindow(); + + AssetBrowser_AddPackage.callback = "AssetBrowser_selectPackage.newPackageAdded();"; +} + +function AssetBrowser_selectPackage::newPackageAdded(%this) +{ + AssetBrowser_SelectPackageWindow-->packageList.refresh(); +} \ No newline at end of file