Adds test shapes of Kork and SpaceOrc

Sidestep of memleak from CSF at the moment
Minor fixes and corrections with asset importing and loose files
WIP of updated options menu
This commit is contained in:
Areloch 2019-05-28 17:24:29 -05:00
parent 6eb997c449
commit 6073bc5551
41 changed files with 804 additions and 193 deletions

View file

@ -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();
}

View file

@ -71,7 +71,7 @@ public:
bool isValid() { return mIsValidImage; }
GFXTexHandle* getImage() { return &mImage; }
GFXTexHandle getImage() { return mImage; }
protected:
virtual void initializeAsset(void);

View file

@ -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();

View file

@ -944,7 +944,12 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount )
Material* mat = dynamic_cast<Material*>(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();

View file

@ -4523,7 +4523,7 @@ void GuiTreeViewCtrl::reparentItems(Vector<Item*> 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<Item*> 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(),

View file

@ -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();
}
}
}

View file

@ -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<ImageAsset> 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<ImageAsset> mOverlayMapAsset[MAX_STAGES];
FileName mLightMapFilename[MAX_STAGES];
StringTableEntry mLightMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mLightMapAsset[MAX_STAGES];
FileName mToneMapFilename[MAX_STAGES];
StringTableEntry mToneMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mToneMapAsset[MAX_STAGES];
FileName mDetailMapFilename[MAX_STAGES];
StringTableEntry mDetailMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mDetailMapAsset[MAX_STAGES];
FileName mNormalMapFilename[MAX_STAGES];
StringTableEntry mNormalMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mNormalMapAsset[MAX_STAGES];
bool mIsSRGb[MAX_STAGES];
bool mInvertSmoothness[MAX_STAGES];
FileName mSpecularMapFilename[MAX_STAGES];
StringTableEntry mSpecularMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mSpecularMapAsset[MAX_STAGES];
FileName mRoughMapFilename[MAX_STAGES];
StringTableEntry mRoughMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mRoughMapAsset[MAX_STAGES];
F32 mSmoothnessChan[MAX_STAGES];
FileName mAOMapFilename[MAX_STAGES];
StringTableEntry mAOMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> mAOMapAsset[MAX_STAGES];
F32 mAOChan[MAX_STAGES];
FileName mMetalMapFilename[MAX_STAGES];
StringTableEntry mMetalMapAssetId[MAX_STAGES];
AssetPtr<ImageAsset> 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<ImageAsset> mDetailNormalMapAsset[MAX_STAGES];
/// The strength scalar for the detail normal map.
F32 mDetailNormalMapStrength[MAX_STAGES];

View file

@ -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())

View file

@ -0,0 +1,9 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="player_Albedo"
imageFile="@assetFile=player_Albedo.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/TorqueCharacters/OrcMage/player_Albedo.png"
VersionId="1" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

View file

@ -0,0 +1,10 @@
function Kork::onCreate(%this)
{
}
function Kork::onDestroy(%this)
{
}

View file

@ -0,0 +1,25 @@
<ModuleDefinition
canSave="true"
canSaveDynamicFields="true"
ModuleId="Kork"
VersionId="1"
Group="Game"
scriptFile="Kork.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="GUIAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -0,0 +1,9 @@
<ShapeAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="OrcMage"
fileName="@assetFile=OrcMage.dts"
isNewShape="1"
materialSlot0="@Asset=Kork:player_mat"
originalFilePath="E:/Gamedev/Art/TorqueCharacters/OrcMage/OrcMage.dts"
VersionId="1" />

View file

@ -0,0 +1,5 @@
singleton TSShapeConstructor(OrcMageDts)
{
baseShape = "./OrcMage.dts";
};

Binary file not shown.

View file

@ -0,0 +1,9 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="player_mat"
scriptFile="@assetFile=player_mat.cs"
materialDefinitionName="player_mat"
imageMap0="@Asset=Kork:player_Albedo"
shaderGraph="data/Kork/materials/player.sgf"
VersionId="1" />

View file

@ -0,0 +1,6 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(player_mat) {
mapTo = "player";
DiffuseMapAsset[0] = "Kork:player_Albedo";
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,9 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_BaseColor"
imageFile="@assetFile=Orc_Material_BaseColor.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_BaseColor.png"
VersionId="1" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View file

@ -0,0 +1,9 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_Metallic"
imageFile="@assetFile=Orc_Material_Metallic.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_Metallic.png"
VersionId="1" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

View file

@ -0,0 +1,9 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_Roughness"
imageFile="@assetFile=Orc_Material_Roughness.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_Roughness.png"
VersionId="1" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

View file

@ -0,0 +1,9 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_normal"
imageFile="@assetFile=Orc_Material_normal.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_normal.png"
VersionId="1" />

View file

@ -0,0 +1,9 @@
<ShapeAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="SpaceOrcMage"
fileName="@assetFile=SpaceOrcMage.dts"
isNewShape="1"
materialSlot0="@Asset=SpaceOrc:Orc_Material"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/SpaceOrcMage.dts"
VersionId="1" />

View file

@ -0,0 +1,5 @@
singleton TSShapeConstructor(SpaceOrcMageDts)
{
baseShape = "./SpaceOrcMage.dts";
};

View file

@ -0,0 +1,10 @@
function SpaceOrc::onCreate(%this)
{
}
function SpaceOrc::onDestroy(%this)
{
}

View file

@ -0,0 +1,25 @@
<ModuleDefinition
canSave="true"
canSaveDynamicFields="true"
ModuleId="SpaceOrc"
VersionId="1"
Group="Game"
scriptFile="SpaceOrc.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="GUIAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -0,0 +1,9 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material"
scriptFile="@assetFile=Orc_Material.cs"
materialDefinitionName="Orc_Material"
imageMap0="@Asset=SpaceOrc:Orc_Material_BaseColor"
shaderGraph="data/SpaceOrc/materials/Orc_Material.sgf"
VersionId="1" />

View file

@ -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 ---

View file

@ -256,20 +256,48 @@ new Scene(PbrMatTestLevel) {
canSave = "1";
canSaveDynamicFields = "1";
};
/*new ConvexShape() {
Material = "Grid_512_Orange";
position = "1.69488 -1.65352 0.772905";
rotation = "1 0 0 0";
new StaticShapeObject() {
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
position = "-0.158338 -2.2037 0.5";
rotation = "0 -0 172.868";
LocalPosition = "0 0 0";
LocalRotation = "1 0 0 0";
lifetimeMS = "0";
GameObject = "Core_GameObjects:StaticShapeObject";
dirtyGameObject = "0";
surface = "0 0 0 1 0 0 0.272904 0 0 0 1 1 0 0 0";
surface = "0 1 0 0 0 0 -0.272904 0 0 0 1 1 0 0 0";
surface = "0.707107 0 0 0.707107 0 0.05 0 0 0 0 1 1 0 0 0";
surface = "0 0.707107 -0.707107 0 0 -0.05 0 0 0 0 1 1 0 0 0";
surface = "0.5 0.5 -0.5 0.5 -0.370958 0 0 0 0 0 1 1 0 0 0";
surface = "0.5 -0.5 0.5 0.5 0.370958 0 0 0 0 0 1 1 0 0 0";
};*/
new MeshComponent() {
componentType = "Render";
friendlyName = "Mesh Component";
description = "Causes the object to render a non-animating 3d shape using the file provided.";
networked = "1";
Enabled = "1";
internalName = "MeshComponent";
MeshAsset = "SpaceOrc:SpaceOrcMage";
};
new ShapeCollisionComponent() {
componentType = "Collision";
friendlyName = "Shape Collision";
description = "A stub component class that physics components should inherit from.";
networked = "0";
Enabled = "1";
internalName = "CollisionComponent";
CollisionType = "Collision Mesh";
LineOfSightType = "Collision Mesh";
DecalType = "Collision Mesh";
CollisionMeshPrefix = "Collision";
BlockCollisions = "1";
};
new AnimationComponent() {
componentType = "Animation";
friendlyName = "Animation(Component)";
description = "Allows a rendered mesh to be animated";
networked = "1";
Enabled = "1";
internalName = "AnimationComponent";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -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;

View file

@ -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">
<GuiBitmapCtrl
bitmap="data/ui/art/hudfill.png"
color="255 255 255 255"
wrap="false"
position="0 0"
extent="450 35"
extent="739 35"
minExtent="8 2"
horizSizing="right"
horizSizing="relative"
vertSizing="bottom"
profile="GuiDefaultProfile"
visible="true"
@ -35,104 +36,6 @@
isContainer="false"
canSave="true"
canSaveDynamicFields="false" />
<GuiContainer
margin="0 0 0 0"
padding="0 0 0 0"
anchorTop="true"
anchorBottom="false"
anchorLeft="true"
anchorRight="false"
position="450 0"
extent="250 35"
minExtent="8 2"
horizSizing="right"
vertSizing="bottom"
profile="GuiDefaultProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="true"
canSave="true"
canSaveDynamicFields="false">
<GuiBitmapCtrl
bitmap="data/ui/art/hudfill.png"
wrap="false"
position="35 0"
extent="180 35"
minExtent="8 2"
horizSizing="right"
vertSizing="bottom"
profile="GuiDefaultProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="false"
canSave="true"
canSaveDynamicFields="false" />
<GuiTextCtrl
text="High"
maxLength="1024"
margin="0 0 0 0"
padding="0 0 0 0"
anchorTop="true"
anchorBottom="false"
anchorLeft="true"
anchorRight="false"
position="35 0"
extent="180 35"
minExtent="8 2"
horizSizing="right"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="true"
internalName="SettingText"
canSave="true"
canSaveDynamicFields="false" />
<GuiButtonCtrl
text="&gt;"
groupNum="-1"
buttonType="PushButton"
useMouseEvents="true"
position="215 0"
extent="35 35"
minExtent="8 8"
horizSizing="relative"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="false"
class="OptionsMenuForwardSetting"
canSave="true"
canSaveDynamicFields="false" />
<GuiButtonCtrl
text="&lt;"
groupNum="-1"
buttonType="PushButton"
useMouseEvents="true"
position="0 0"
extent="35 35"
minExtent="8 8"
horizSizing="relative"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="false"
class="OptionsMenuBackSetting"
canSave="true"
canSaveDynamicFields="false" />
</GuiContainer>
<GuiTextCtrl
text="Shadow Quality"
maxLength="1024"
@ -143,9 +46,9 @@
anchorLeft="true"
anchorRight="false"
position="0 0"
extent="450 35"
extent="350 35"
minExtent="8 2"
horizSizing="right"
horizSizing="relative"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
@ -156,4 +59,65 @@
internalName="nameText"
canSave="true"
canSaveDynamicFields="false" />
<GuiTextCtrl
text="High"
maxLength="1024"
margin="0 0 0 0"
padding="0 0 0 0"
anchorTop="true"
anchorBottom="false"
anchorLeft="true"
anchorRight="false"
position="350 0"
extent="350 35"
minExtent="8 2"
horizSizing="relative"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="true"
internalName="SettingText"
canSave="true"
canSaveDynamicFields="false" />
<GuiButtonCtrl
text=">"
groupNum="-1"
buttonType="PushButton"
useMouseEvents="true"
position="682 0"
extent="36 35"
minExtent="8 8"
horizSizing="relative"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="false"
class="OptionsMenuForwardSetting"
canSave="true"
canSaveDynamicFields="false" />
<GuiButtonCtrl
text="<"
groupNum="-1"
buttonType="PushButton"
useMouseEvents="true"
position="348 0"
extent="36 35"
minExtent="8 8"
horizSizing="relative"
vertSizing="bottom"
profile="GuiMenuButtonProfile"
visible="true"
active="true"
tooltipProfile="GuiToolTipProfile"
hovertime="1000"
isContainer="false"
class="OptionsMenuBackSetting"
canSave="true"
canSaveDynamicFields="false" />
</GuiContainer>

View file

@ -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();";

View file

@ -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 ---

View file

@ -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 )

View file

@ -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;

View file

@ -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";

View file

@ -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";