diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 56530b53b..38f11d6c8 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -149,12 +149,12 @@ void ImageAsset::loadImage() void ImageAsset::initializeAsset() { - loadImage(); + setImageFileName(mImageFileName); } void ImageAsset::onAssetRefresh() { - loadImage(); + setImageFileName(mImageFileName); } void ImageAsset::setImageFileName(const char* pScriptFile) @@ -162,16 +162,16 @@ void ImageAsset::setImageFileName(const char* pScriptFile) // Sanity! AssertFatal(pScriptFile != NULL, "Cannot use a NULL image file."); - // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); - - // Ignore no change, - if (pScriptFile == mImageFileName) - return; - // Update. mImageFileName = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile); // Refresh the asset. - refreshAsset(); + loadImage(); +} + +DefineEngineMethod(ImageAsset, getImageFilename, const char*, (), , + "Creates an instance of the given GameObject given the asset definition.\n" + "@return The GameObject entity created from the asset.") +{ + return object->getImageFileName(); } diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index 5a3d7f9af..8be1f092d 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -71,7 +71,7 @@ public: bool isValid() { return mIsValidImage; } - GFXTexHandle* getImage() { return &mImage; } + GFXTexHandle getImage() { return mImage; } protected: virtual void initializeAsset(void); diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index cace59c49..661d508f7 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -121,12 +121,17 @@ void MaterialAsset::initializeAsset() compileShader(); + if (!Platform::isFullPath(mScriptFile)) + mScriptFile = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptFile; + if (Platform::isFile(mScriptFile)) Con::executeFile(mScriptFile, false, false); } void MaterialAsset::onAssetRefresh() { + mScriptFile = expandAssetFilePath(mScriptFile); + if (Platform::isFile(mScriptFile)) Con::executeFile(mScriptFile, false, false); @@ -151,12 +156,8 @@ void MaterialAsset::setScriptFile(const char* pScriptFile) // Fetch image file. pScriptFile = StringTable->insert(pScriptFile); - // Ignore no change, - if (pScriptFile == mScriptFile) - return; - // Update. - mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile); + mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 52ea5ef17..3f9267797 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -944,7 +944,12 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount ) Material* mat = dynamic_cast(mMatInst->getMaterial()); if(mat) { - GFXTexHandle tex(mat->mDiffuseMapFilename[0], &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check" ); + GFXTexHandle tex; + if (!mat->mDiffuseMapFilename[0].isEmpty()) + tex = GFXTexHandle(mat->mDiffuseMapFilename[0], &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check"); + else if (!mat->mDiffuseMapAsset[0].isNull()) + tex = mat->mDiffuseMapAsset[0]->getImage(); + if(tex.isValid()) { U32 w = tex.getWidth(); diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 69eabde90..2a98d9228 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -4523,7 +4523,7 @@ void GuiTreeViewCtrl::reparentItems(Vector selectedItems, Item* newParent // update the parent's children // check if we an only child - if (item->mParent->mChild == item) + if (item->mParent && item->mParent->mChild == item) { if (item->mNext) item->mParent->mChild = item->mNext; @@ -4805,7 +4805,7 @@ void GuiTreeViewCtrl::reparentItems(Vector selectedItems, Item* newParent if (item->isInspectorData()) { - if (item->getObject() && oldParent->getObject() && item->mParent->getObject()) + if (item->getObject() && (oldParent && oldParent->getObject()) && item->mParent->getObject()) onReparent_callback( item->getObject()->getId(), oldParent->getObject()->getId(), diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 43f6e459d..eb449ef37 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -116,6 +116,7 @@ Material::Material() { mDiffuse[i].set( 1.0f, 1.0f, 1.0f, 1.0f ); mDiffuseMapSRGB[i] = true; + mDiffuseMapAsset[i] = StringTable->EmptyString(); mSmoothness[i] = 0.0f; mMetalness[i] = 0.0f; @@ -172,8 +173,10 @@ Material::Material() // Deferred Shading mMatInfoFlags[i] = 0.0f; mRoughMapFilename[i].clear(); + mRoughMapAsset[i] = StringTable->EmptyString(); mAOMapFilename[i].clear(); mMetalMapFilename[i].clear(); + mMetalMapAsset[i] = StringTable->EmptyString(); } dMemset(mCellIndex, 0, sizeof(mCellIndex)); @@ -235,6 +238,9 @@ void Material::initPersistFields() addField("diffuseMap", TypeImageFilename, Offset(mDiffuseMapFilename, Material), MAX_STAGES, "The diffuse color texture map." ); + addField("diffuseMapAsset", TypeImageAssetPtr, Offset(mDiffuseMapAsset, Material), MAX_STAGES, + "The diffuse color texture map." ); + addField("diffuseMapSRGB", TypeBool, Offset(mDiffuseMapSRGB, Material), MAX_STAGES, "Enable sRGB for the diffuse color texture map."); @@ -636,7 +642,7 @@ void Material::_mapMaterial() // If mapTo not defined in script, try to use the base texture name instead if( mMapTo.isEmpty() ) { - if ( mDiffuseMapFilename[0].isEmpty() ) + if ( mDiffuseMapFilename[0].isEmpty() && mDiffuseMapAsset->isNull()) return; else @@ -652,6 +658,10 @@ void Material::_mapMaterial() // use everything after the last slash mMapTo = mDiffuseMapFilename[0].substr(slashPos+1, mDiffuseMapFilename[0].length() - slashPos - 1); } + else if (!mDiffuseMapAsset->isNull()) + { + mMapTo = mDiffuseMapAsset[0]->getImageFileName(); + } } } diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index 289627855..346218158 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -45,6 +45,13 @@ #include "shaderGen/customShaderFeature.h" #endif +#ifndef IMAGE_ASSET_H +#include "T3D/assets/ImageAsset.h" +#endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + class CubemapData; class SFXTrack; struct SceneData; @@ -203,6 +210,8 @@ public: // Data //----------------------------------------------------------------------- FileName mDiffuseMapFilename[MAX_STAGES]; + StringTableEntry mDiffuseMapAssetId[MAX_STAGES]; + AssetPtr mDiffuseMapAsset[MAX_STAGES]; bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse bool mAccuEnabled[MAX_STAGES]; F32 mAccuScale[MAX_STAGES]; @@ -211,24 +220,44 @@ public: F32 mAccuCoverage[MAX_STAGES]; F32 mAccuSpecular[MAX_STAGES]; FileName mOverlayMapFilename[MAX_STAGES]; + StringTableEntry mOverlayMapAssetId[MAX_STAGES]; + AssetPtr mOverlayMapAsset[MAX_STAGES]; FileName mLightMapFilename[MAX_STAGES]; + StringTableEntry mLightMapAssetId[MAX_STAGES]; + AssetPtr mLightMapAsset[MAX_STAGES]; FileName mToneMapFilename[MAX_STAGES]; + StringTableEntry mToneMapAssetId[MAX_STAGES]; + AssetPtr mToneMapAsset[MAX_STAGES]; FileName mDetailMapFilename[MAX_STAGES]; + StringTableEntry mDetailMapAssetId[MAX_STAGES]; + AssetPtr mDetailMapAsset[MAX_STAGES]; FileName mNormalMapFilename[MAX_STAGES]; + StringTableEntry mNormalMapAssetId[MAX_STAGES]; + AssetPtr mNormalMapAsset[MAX_STAGES]; bool mIsSRGb[MAX_STAGES]; bool mInvertSmoothness[MAX_STAGES]; FileName mSpecularMapFilename[MAX_STAGES]; + StringTableEntry mSpecularMapAssetId[MAX_STAGES]; + AssetPtr mSpecularMapAsset[MAX_STAGES]; FileName mRoughMapFilename[MAX_STAGES]; + StringTableEntry mRoughMapAssetId[MAX_STAGES]; + AssetPtr mRoughMapAsset[MAX_STAGES]; F32 mSmoothnessChan[MAX_STAGES]; FileName mAOMapFilename[MAX_STAGES]; + StringTableEntry mAOMapAssetId[MAX_STAGES]; + AssetPtr mAOMapAsset[MAX_STAGES]; F32 mAOChan[MAX_STAGES]; FileName mMetalMapFilename[MAX_STAGES]; + StringTableEntry mMetalMapAssetId[MAX_STAGES]; + AssetPtr mMetalMapAsset[MAX_STAGES]; F32 mMetalChan[MAX_STAGES]; /// A second normal map which repeats at the detail map /// scale and blended with the base normal map. FileName mDetailNormalMapFilename[MAX_STAGES]; + StringTableEntry mDetailNormalMapAssetId[MAX_STAGES]; + AssetPtr mDetailNormalMapAsset[MAX_STAGES]; /// The strength scalar for the detail normal map. F32 mDetailNormalMapStrength[MAX_STAGES]; diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 2d6540f95..9fd8aff7e 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -409,6 +409,16 @@ void ProcessedMaterial::_setStageData() mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile)); } } + else if (!mMaterial->mDiffuseMapAsset[i].isNull()) + { + mStages[i].setTex(MFT_DiffuseMap, mMaterial->mDiffuseMapAsset[i]->getImage()); + if (!mStages[i].getTex(MFT_DiffuseMap)) + { + // Load a debug texture to make it clear to the user + // that the texture for this stage was missing. + mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile)); + } + } // OverlayMap if (mMaterial->mOverlayMapFilename[i].isNotEmpty()) diff --git a/Templates/BaseGame/game/data/Kork/Images/player_Albedo.asset.taml b/Templates/BaseGame/game/data/Kork/Images/player_Albedo.asset.taml new file mode 100644 index 000000000..206391ce3 --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/Images/player_Albedo.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/Kork/Images/player_Albedo.png b/Templates/BaseGame/game/data/Kork/Images/player_Albedo.png new file mode 100644 index 000000000..155ab087a Binary files /dev/null and b/Templates/BaseGame/game/data/Kork/Images/player_Albedo.png differ diff --git a/Templates/BaseGame/game/data/Kork/Kork.cs b/Templates/BaseGame/game/data/Kork/Kork.cs new file mode 100644 index 000000000..10a60f95b --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/Kork.cs @@ -0,0 +1,10 @@ +function Kork::onCreate(%this) +{ + +} + +function Kork::onDestroy(%this) +{ + +} + diff --git a/Templates/BaseGame/game/data/Kork/Kork.module b/Templates/BaseGame/game/data/Kork/Kork.module new file mode 100644 index 000000000..5e369c1f0 --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/Kork.module @@ -0,0 +1,25 @@ + + + + + diff --git a/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.asset.taml b/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.asset.taml new file mode 100644 index 000000000..2d388c636 --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.cs b/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.cs new file mode 100644 index 000000000..6eeb7c0de --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.cs @@ -0,0 +1,5 @@ + +singleton TSShapeConstructor(OrcMageDts) +{ + baseShape = "./OrcMage.dts"; +}; diff --git a/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.dts b/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.dts new file mode 100644 index 000000000..2be05c66c Binary files /dev/null and b/Templates/BaseGame/game/data/Kork/Shapes/OrcMage.dts differ diff --git a/Templates/BaseGame/game/data/Kork/materials/player_mat.asset.taml b/Templates/BaseGame/game/data/Kork/materials/player_mat.asset.taml new file mode 100644 index 000000000..b6ce43996 --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/materials/player_mat.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/Kork/materials/player_mat.cs b/Templates/BaseGame/game/data/Kork/materials/player_mat.cs new file mode 100644 index 000000000..e55ed8ec1 --- /dev/null +++ b/Templates/BaseGame/game/data/Kork/materials/player_mat.cs @@ -0,0 +1,6 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(player_mat) { + mapTo = "player"; + DiffuseMapAsset[0] = "Kork:player_Albedo"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_BaseColor.asset.taml b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_BaseColor.asset.taml new file mode 100644 index 000000000..09c67d083 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_BaseColor.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_BaseColor.png b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_BaseColor.png new file mode 100644 index 000000000..4630832d0 Binary files /dev/null and b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_BaseColor.png differ diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Metallic.png b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Metallic.png new file mode 100644 index 000000000..0f0289d5b Binary files /dev/null and b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Metallic.png differ diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Metallic.taml b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Metallic.taml new file mode 100644 index 000000000..8b5c70a88 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Metallic.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Roughness.png b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Roughness.png new file mode 100644 index 000000000..cdbc2a298 Binary files /dev/null and b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Roughness.png differ diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Roughness.taml b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Roughness.taml new file mode 100644 index 000000000..d3fd5df5d --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_Roughness.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_normal.png b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_normal.png new file mode 100644 index 000000000..a60d459a3 Binary files /dev/null and b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_normal.png differ diff --git a/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_normal.taml b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_normal.taml new file mode 100644 index 000000000..a73277e13 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/Images/Orc_Material_normal.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.asset.taml b/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.asset.taml new file mode 100644 index 000000000..8ecad1219 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.cs b/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.cs new file mode 100644 index 000000000..5410cda78 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.cs @@ -0,0 +1,5 @@ + +singleton TSShapeConstructor(SpaceOrcMageDts) +{ + baseShape = "./SpaceOrcMage.dts"; +}; diff --git a/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.dts b/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.dts new file mode 100644 index 000000000..13de557d4 Binary files /dev/null and b/Templates/BaseGame/game/data/SpaceOrc/Shapes/SpaceOrcMage.dts differ diff --git a/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs b/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs new file mode 100644 index 000000000..41ebb96aa --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs @@ -0,0 +1,10 @@ +function SpaceOrc::onCreate(%this) +{ + +} + +function SpaceOrc::onDestroy(%this) +{ + +} + diff --git a/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.module b/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.module new file mode 100644 index 000000000..9d226ea28 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.module @@ -0,0 +1,25 @@ + + + + + diff --git a/Templates/BaseGame/game/data/SpaceOrc/materials/Orc_Material.asset.taml b/Templates/BaseGame/game/data/SpaceOrc/materials/Orc_Material.asset.taml new file mode 100644 index 000000000..01e55a374 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/materials/Orc_Material.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/BaseGame/game/data/SpaceOrc/materials/Orc_Material.cs b/Templates/BaseGame/game/data/SpaceOrc/materials/Orc_Material.cs new file mode 100644 index 000000000..cdfc2c6a2 --- /dev/null +++ b/Templates/BaseGame/game/data/SpaceOrc/materials/Orc_Material.cs @@ -0,0 +1,12 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Orc_Material) { + mapTo = "Orc_Material"; + DiffuseMapAsset[0] = "SpaceOrc:Orc_Material_BaseColor"; + diffuseMap[0] = "data/SpaceOrc/Images/Orc_Material_BaseColor.png"; + normalMap[0] = "data/SpaceOrc/Images/Orc_Material_normal.png"; + invertSmoothness[0] = "1"; + roughMap[0] = "data/SpaceOrc/Images/Orc_Material_Roughness.png"; + metalMap[0] = "data/SpaceOrc/Images/Orc_Material_Metallic.png"; + DiffuseMapAsset0 = "SpaceOrc:Orc_Material_BaseColor"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs b/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs index 7189d11c2..5af6257c3 100644 --- a/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs +++ b/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs @@ -372,7 +372,7 @@ function _makePrettyResString( %resString ) function GraphicsMenuSetting::init( %this ) { assert( isObject( %this ) ); - assert( isObject( %this.qualitySettingGroup ) ); + //assert( isObject( %this.qualitySettingGroup ) ); // Fill it. %select = -1; diff --git a/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsCtrl.taml b/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsCtrl.taml index b5beaf713..69fbd781f 100644 --- a/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsCtrl.taml +++ b/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsCtrl.taml @@ -5,10 +5,10 @@ anchorBottom="false" anchorLeft="true" anchorRight="false" - position="0 0" - extent="700 35" + position="0 105" + extent="739 35" minExtent="8 2" - horizSizing="right" + horizSizing="width" vertSizing="bottom" profile="GuiDefaultProfile" visible="true" @@ -21,11 +21,12 @@ canSaveDynamicFields="false"> - - - - - - + + + diff --git a/Templates/BaseGame/game/data/ui/scripts/guis/mainMenu.gui b/Templates/BaseGame/game/data/ui/scripts/guis/mainMenu.gui index 88bd1d4c5..7b109a6e0 100644 --- a/Templates/BaseGame/game/data/ui/scripts/guis/mainMenu.gui +++ b/Templates/BaseGame/game/data/ui/scripts/guis/mainMenu.gui @@ -18,7 +18,7 @@ exec( "tools/gui/profiles.ed.cs" ); isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; - enabled = "1"; + Enabled = "1"; isDecoy = "0"; new GuiBitmapButtonCtrl(MainMenuAppLogo) { @@ -47,10 +47,10 @@ exec( "tools/gui/profiles.ed.cs" ); canSaveDynamicFields = "1"; }; new GuiControl(MainMenuButtonContainer) { - position = "557 193"; + position = "20 193"; extent = "442 381"; minExtent = "8 2"; - horizSizing = "left"; + horizSizing = "right"; vertSizing = "center"; profile = "GuiDefaultProfile"; visible = "1"; @@ -97,7 +97,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "MainMenuGui.openSinglePlayerMenu();"; @@ -117,7 +117,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "MainMenuGui.openMultiPlayerMenu();"; @@ -137,7 +137,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "Canvas.pushDialog(JoinServerMenu);"; @@ -157,7 +157,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "MainMenuGui.openOptionsMenu();"; @@ -177,7 +177,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "fastLoadWorldEdit(1);"; @@ -197,7 +197,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "fastLoadGUIEdit(1);"; @@ -217,7 +217,7 @@ exec( "tools/gui/profiles.ed.cs" ); minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; + profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; command = "quit();"; diff --git a/Templates/BaseGame/game/data/ui/scripts/guis/optionsMenu.gui b/Templates/BaseGame/game/data/ui/scripts/guis/optionsMenu.gui index e347500a5..0f06fb375 100644 --- a/Templates/BaseGame/game/data/ui/scripts/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/ui/scripts/guis/optionsMenu.gui @@ -60,7 +60,7 @@ canSaveDynamicFields = "0"; }; new GuiControl() { - position = "139 118"; + position = "162 125"; extent = "700 518"; minExtent = "8 2"; horizSizing = "center"; @@ -5698,5 +5698,222 @@ }; }; }; + new GuiControl() { + position = "20 70"; + extent = "380 602"; + minExtent = "8 2"; + horizSizing = "relative"; + vertSizing = "relative"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "380 602"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiControl() { + position = "0 0"; + extent = "380 20"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "380 20"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Options"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "380 20"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + 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 = "0 25"; + extent = "380 577"; + 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(OptionsSettingStack) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "380 64"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiControl() { + position = "416 96"; + extent = "576 576"; + minExtent = "8 2"; + horizSizing = "relative"; + vertSizing = "relative"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl(OptionsPreviewCtrl) { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "576 576"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapCtrl() { + bitmap = "data/ui/art/no-preview.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "577 528"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "relative"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiMLTextCtrl() { + lineSpacing = "2"; + allowColorChars = "0"; + maxChars = "-1"; + text = "This is a test message to act as a tooltip for any selected options menus for more information on the given option."; + useURLMouseCursor = "0"; + position = "0 528"; + extent = "578 14"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiMLWhiteTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/scripts/optionsMenu.cs b/Templates/BaseGame/game/data/ui/scripts/optionsMenu.cs index 40807691c..03cd0ca07 100644 --- a/Templates/BaseGame/game/data/ui/scripts/optionsMenu.cs +++ b/Templates/BaseGame/game/data/ui/scripts/optionsMenu.cs @@ -58,6 +58,87 @@ function OptionsMenu::onWake(%this) OptionsOKButton.hidden = false; OptionsCancelButton.hidden = false; OptionsDefaultsButton.hidden = false; + + OptionsMenu.tamlReader = new Taml(); + + OptionsSettingStack.clear(); + + %array = OptionsSettingStack; + %array.clear(); + + %controllerMenuBtn = new GuiButtonCtrl(){ + text = "Keyboard and Mouse"; + profile = GuiMenuButtonProfile; + extent = %array.extent.x SPC "35"; + }; + + %displayMenuBtn = new GuiButtonCtrl(){ + text = "Controller"; + profile = GuiMenuButtonProfile; + extent = %array.extent.x SPC "35"; + }; + + %keyboardMenuBtn = new GuiButtonCtrl(){ + text = "Display"; + profile = GuiMenuButtonProfile; + extent = %array.extent.x SPC "35"; + }; + + %graphicsMenuBtn = new GuiButtonCtrl(){ + text = "Graphics"; + profile = GuiMenuButtonProfile; + extent = %array.extent.x SPC "35"; + }; + + %audioMenuBtn = new GuiButtonCtrl(){ + text = "Audio"; + profile = GuiMenuButtonProfile; + extent = %array.extent.x SPC "35"; + }; + + %gameplayMenuBtn = new GuiButtonCtrl(){ + text = "Gameplay"; + profile = GuiMenuButtonProfile; + extent = %array.extent.x SPC "35"; + }; + + %array.add(%keyboardMenuBtn); + %array.add(%controllerMenuBtn); + %array.add(%displayMenuBtn); + %array.add(%graphicsMenuBtn); + %array.add(%audioMenuBtn); + %array.add(%gameplayMenuBtn); + + //We programmatically set up our settings here so we can do some prepwork on the fields/controls + //Presets + /*OptionsMenu.addSettingOption(%array, "Preset", "High", ShadowQualityList, $pref::Video::Resolution); + + //AA + OptionsMenu.addSettingOption(%array, "AntiAliasing", "FXAA 4x", ShadowQualityList, $pref::Video::Resolution); + + //Lighting + OptionsMenu.addSettingOption(%array, "Shadow Quality", "High", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Shadow Caching", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Soft Shadows", "High", ShadowQualityList, $pref::Video::Resolution); + + //Models and Textures + OptionsMenu.addSettingOption(%array, "Level of Detail", "High", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Texture Quality", "High", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Material Quality", "High", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Terrain Detail", "High", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Decal Lifetime", "High", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Ground Clutter Density", "High", ShadowQualityList, $pref::Video::Resolution); + + //Effects + OptionsMenu.addSettingOption(%array, "HDR", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Parallax", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Ambient Occlusion", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Light Rays", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Depth of Field", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Vignetting", "On", ShadowQualityList, $pref::Video::Resolution); + OptionsMenu.addSettingOption(%array, "Water Reflections", "On", ShadowQualityList, $pref::Video::Resolution); + + OptionsMenu.addSettingOption(%array, "Anisotropic Filtering", "16x", ShadowQualityList, $pref::Video::Resolution);*/ } function OptionsMenuOKButton::onClick(%this) @@ -139,53 +220,62 @@ function OptionsMenu::backOut(%this) } } -function OptionsMenu::addSettingOption(%this, %arrayTarget) +function OptionsMenu::addSettingOption(%this, %arrayTarget, %optionName, %defaultValue, %settingsGroup, %targetVar) { - %graphicsOption = OptionsMenu.tamlReader.read("data/ui/scripts/guis/graphicsMenuSettingsCtrl.taml"); + %option = TAMLRead("data/ui/scripts/guis/graphicsMenuSettingsCtrl.taml"); + + %option-->nameText.text = %optionName; + %option-->SettingText.text = %defaultValue; + %option.qualitySettingGroup = %settingsGroup; + %option.targetVar = %targetVar; + + %option.init(); - %arrayTarget.add(%graphicsOption); + %arrayTarget.add(%option); - return %graphicsOption; + return %option; } -function OptionsMenu::addSliderOption(%this, %arrayTarget, %range, %ticks, %variable, %value, %class) +function OptionsMenu::addSliderOption(%this, %arrayTarget, %optionName, %variable, %range, %ticks, %value, %class) { - %graphicsOption = OptionsMenu.tamlReader.read("data/ui/scripts/guis/graphicsMenuSettingsSlider.taml"); + %option = TAMLRead("data/ui/scripts/guis/graphicsMenuSettingsSlider.taml"); + + %option-->nameText.text = %optionName; - %arrayTarget.add(%graphicsOption); + %arrayTarget.add(%option); if(%range !$= "") { - %graphicsOption-->slider.range = %range; + %option-->slider.range = %range; } if(%ticks !$= "") { - %graphicsOption-->slider.ticks = %ticks; + %option-->slider.ticks = %ticks; } if(%variable !$= "") { - %graphicsOption-->slider.variable = %variable; + %option-->slider.variable = %variable; } if(%value !$= "") { - %graphicsOption-->slider.setValue(%value); + %option-->slider.setValue(%value); } if(%class !$= "") { - %graphicsOption-->slider.className = %class; + %option-->slider.className = %class; } else - %graphicsOption-->slider.className = OptionsMenuSlider; + %option-->slider.className = OptionsMenuSlider; - %graphicsOption-->slider.snap = true; + %option-->slider.snap = true; - %graphicsOption-->slider.onValueSet(); + %option-->slider.onValueSet(); - return %graphicsOption; + return %option; } function OptionsMenuSlider::onMouseDragged(%this) @@ -208,6 +298,65 @@ function FOVOptionSlider::onValueSet(%this) %this.getParent().getParent()-->valueText.setText(mRound(%this.value)); } +function OptionsMenuForwardSetting::onClick(%this) +{ + //we need to advance through the value list, unless it's the end, in which case we do nothing + echo("Move forward in the list!"); + + %settingCtrl = %this.getParent(); + for ( %i=0; %i < %settingCtrl.qualitySettingGroup.getCount(); %i++ ) + { + %level = %settingCtrl.qualitySettingGroup.getObject( %i ); + + if(%settingCtrl.selectedLevel == %i) + { + //k, shift it + if(%i == %settingCtrl.qualitySettingGroup.getCount() - 1) + { + //oh, we're at the end. Do nothing. + return; + } + else + { + %newLevel = %settingCtrl.qualitySettingGroup.getObject( %i + 1 ); + %settingCtrl-->SettingText.setText( %newLevel.displayName ); + OptionsPreviewCtrl.bitmap = %newLevel.previewImage; + %settingCtrl.selectedLevel = %i + 1; + return; + } + } + } +} + +function OptionsMenuBackSetting::onClick(%this) +{ + //we need to advance through the value list, unless it's the end, in which case we do nothing + echo("Move back in the list!"); + + %settingCtrl = %this.getParent(); + for ( %i=0; %i < %settingCtrl.qualitySettingGroup.getCount(); %i++ ) + { + %level = %settingCtrl.qualitySettingGroup.getObject( %i ); + + if(%settingCtrl.selectedLevel == %i) + { + //k, shift it + if(%i == 0) + { + //oh, we're at the end. Do nothing. + return; + } + else + { + %newLevel = %settingCtrl.qualitySettingGroup.getObject( %i - 1 ); + %settingCtrl-->SettingText.setText( %newLevel.displayName ); + %settingCtrl.selectedLevel = %i - 1; + return; + } + } + } +} + /// Returns true if the current quality settings equal /// this graphics quality level. function OptionsMenuSettingLevel::isCurrent( %this ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs index 8ff07e492..09baff973 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs @@ -71,10 +71,13 @@ function AssetBrowser::onBeginDropFiles( %this ) %this.importAssetUnprocessedListArray.empty(); %this.importAssetFinalListArray.empty(); + ImportAssetWindow.assetHeirarchyChanged = false; + //prep the import control Canvas.pushDialog(AssetImportCtrl); AssetImportCtrl.setHidden(true); ImportAssetTree.clear(); + ImportAssetTree.insertItem(0, "Importing Assets"); AssetBrowser.unprocessedAssetsCount = 0; } @@ -380,6 +383,12 @@ function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentA %shapeInfo = new GuiTreeViewCtrl(); enumColladaForImport(%assetItem.filePath, %shapeInfo, false); } + else if(%fileExt $= ".dts") + { + %shapeInfo = new GuiTreeViewCtrl(); + %shapeInfo.insertItem(0, "Shape", 1); + %shapeInfo.insertItem(0, "Animations", 0); + } else { %shapeInfo = GetShapeInfo(%assetItem.filePath); @@ -412,7 +421,7 @@ function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentA if(%parentAssetItem $= "") { - ImportAssetTree.insertObject(0, %assetItem); + ImportAssetTree.insertObject(1, %assetItem); //%assetItem.parentDepth = 0; //%this.importAssetNewListArray.add(%assetItem); @@ -422,14 +431,6 @@ function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentA { %parentid = ImportAssetTree.findItemByObjectId(%parentAssetItem); ImportAssetTree.insertObject(%parentid, %assetItem); - - //%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); } %this.unprocessedAssetsCount++; @@ -669,7 +670,7 @@ function ImportAssetWindow::processNewImportAssets(%this, %id) { %assetItem = ImportAssetTree.getItemObject(%id); - if(%assetItem.processed == false) + if(isObject(%assetItem) && %assetItem.processed == false) { %assetConfigObj = ImportAssetWindow.activeImportConfig.clone(); %assetConfigObj.assetIndex = %i; @@ -794,10 +795,6 @@ function ImportAssetWindow::processNewImportAssets(%this, %id) %assetItem.processed = true; } - //AssetBrowser.importAssetUnprocessedListArray.erase(0); - //Been processed, so add it to our final list - //AssetBrowser.importAssetFinalListArray.add(%assetItem); - if(ImportAssetTree.isParentItem(%id)) { %childItem = ImportAssetTree.getChild(%id); @@ -806,13 +803,25 @@ function ImportAssetWindow::processNewImportAssets(%this, %id) %this.processNewImportAssets(%childItem); } - %id = ImportAssetTree.getNextSibling(%id); + //It's possible we restructured our asset heirarchy(generated assets being parents, etc + //If that's happened, we need to back out of the current processing and restart to ensure we catch everything + if(ImportAssetWindow.assetHeirarchyChanged) + %id = -1; //breaks the loop + else + %id = ImportAssetTree.getNextSibling(%id); } + + //We have a forced break out of the loop, so lets check if it's because the heirarchy changed. + //If so, reprocess + /*if(%id == -1 && ImportAssetWindow.assetHeirarchyChanged) + { + ImportAssetWindow.refresh(); + }*/ } function ImportAssetWindow::findImportingAssetByName(%this, %assetName) { - %id = ImportAssetTree.getFirstRootItem(); + %id = ImportAssetTree.getChild(1); return %this._findImportingAssetByName(%id, %assetName); } @@ -823,9 +832,9 @@ function ImportAssetWindow::_findImportingAssetByName(%this, %id, %assetName) { %assetItem = ImportAssetTree.getItemObject(%id); - if(%assetItem.cleanAssetName $= %assetName) + if(isObject(%assetItem) && %assetItem.cleanAssetName $= %assetName) { - return %asset; + return %assetItem; } if(ImportAssetTree.isParentItem(%id)) @@ -1023,7 +1032,9 @@ function refreshImportAssetWindow() function ImportAssetWindow::refresh(%this) { //Go through and process any newly, unprocessed assets - %id = ImportAssetTree.getFirstRootItem(); + %id = ImportAssetTree.getChild(1); + + ImportAssetWindow.assetHeirarchyChanged = false; %this.processNewImportAssets(%id); @@ -1035,9 +1046,9 @@ function ImportAssetWindow::refresh(%this) { //We've processed them all, prep the assets for actual importing //Initial set of assets - %id = ImportAssetTree.getFirstRootItem(); + %id = ImportAssetTree.getChild(1); - //recurse! + //recurse! %this.refreshChildItem(%id); } else @@ -1053,7 +1064,7 @@ function ImportAssetWindow::refreshChildItem(%this, %id) { %assetItem = ImportAssetTree.getItemObject(%id); - if(%assetItem.skip) + if(!isObject(%assetItem) || %assetItem.skip) { %id = ImportAssetTree.getNextSibling(%id); continue; @@ -1395,7 +1406,7 @@ function ImportAssetWindow::ImportAssets(%this) return; } - %id = ImportAssetTree.getFirstRootItem(); + %id = ImportAssetTree.getChild(1); %this.doImportAssets(%id); @@ -1412,7 +1423,7 @@ function ImportAssetWindow::doImportAssets(%this, %id) { %assetItem = ImportAssetTree.getItemObject(%id); - if(%assetItem.skip) + if(!isObject(%assetItem) || %assetItem.skip) { %id = ImportAssetTree.getNextSibling(%id); continue; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs index 4270711d5..5cadf69b0 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs @@ -17,7 +17,7 @@ function AssetBrowser::prepareImportImageAsset(%this, %assetItem) //Check if our material already exists //First, lets double-check that we don't already have an - %materialAsset = AssetBrowser.doesAssetItemAlreadyExist(%noSuffixName); + %materialAsset = ImportAssetWindow.findImportingAssetByName(%noSuffixName); if(%materialAsset == 0) { %filePath = %assetItem.filePath; @@ -32,9 +32,12 @@ function AssetBrowser::prepareImportImageAsset(%this, %assetItem) %materialItemId = ImportAssetTree.findItemByObjectId(%materialAsset); %assetItem.parentId = %materialItemId; + %assetItem.parentAssetItem = %materialAsset; ImportAssetTree.reparentItem(%itemId, %materialItemId); + ImportAssetWindow.assetHeirarchyChanged = true; + ImportAssetTree.buildVisibleTree(true); } @@ -134,8 +137,9 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) %previewData.assetPath = %assetDef.scriptFile; //%previewData.doubleClickCommand = "EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );"; - if(isFile(%assetDef.imageFile)) - %previewData.previewImage = %assetDef.imageFile; + %imageFilePath = %assetDef.getImageFilename(); + if(isFile(%imageFilePath)) + %previewData.previewImage = %imageFilePath; else %previewData.previewImage = "core/rendering/images/unavailable"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs index a3c2d578a..ef3641181 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs @@ -314,7 +314,7 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem) %assetPath = "data/" @ %moduleName @ "/materials"; %tamlpath = %assetPath @ "/" @ %assetName @ ".asset.taml"; %sgfPath = %assetPath @ "/" @ %assetName @ ".sgf"; - %scriptPath = %assetPath @ "/" @ %assetName @ ".cs"; + %scriptPath = %assetName @ ".cs"; %newAsset = new MaterialAsset() { @@ -363,7 +363,6 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem) 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) @@ -434,6 +433,11 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) if(isFile(%assetDef.materialDefinitionName.diffuseMap[0])) %previewData.previewImage = %assetDef.materialDefinitionName.diffuseMap[0]; + else if(%assetDef.materialDefinitionName.diffuseMapAsset[0] !$= "") + { + %imgAsset = AssetDatabase.acquireAsset(%assetDef.materialDefinitionName.diffuseMapAsset[0]); + %previewData.previewImage = %imgAsset.getImageFilename(); + } else %previewData.previewImage = "tools/assetBrowser/art/materialIcon";