Implements material asset handling for GroundPlane object

Adds handling for finding material asset akin to shape and image assets
Updates the material asset inspector field to follow the current standard
Updates prototyping material assets to correctly have materialDefinitionName assigned
Fixed material asset import step to properly assign materialDefinitionName
Fixed typo in material editor icon name
Added logic to editAsset function call so it can also parse assetIds
Changed DefaultEditorLevel to utilize FloorGray material
Adds proper NoMaterial asset for fallback purposes
This commit is contained in:
Areloch 2020-11-01 23:32:34 -06:00
parent 302a64edd1
commit 388a700a53
26 changed files with 279 additions and 127 deletions

View file

@ -42,9 +42,7 @@
#include "gfx/gfxDevice.h"
#endif
#ifndef _GUI_INSPECTOR_TYPES_H_
#include "gui/editor/guiInspectorTypes.h"
#endif
#include "materials/matTextureTarget.h"
#include "materials/materialDefinition.h"
@ -77,6 +75,9 @@ public:
inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
static StringTableEntry getAssetIdByMaterialName(StringTableEntry fileName);
static bool getAssetById(StringTableEntry assetId, AssetPtr<MaterialAsset>* materialAsset);
/// Declare Console Object.
DECLARE_CONOBJECT(MaterialAsset);
@ -89,26 +90,32 @@ protected:
};
DefineConsoleType(TypeMaterialAssetPtr, MaterialAsset)
DefineConsoleType(TypeMaterialAssetId, String)
//-----------------------------------------------------------------------------
// TypeAssetId GuiInspectorField Class
//-----------------------------------------------------------------------------
class GuiInspectorTypeMaterialAssetPtr : public GuiInspectorField
class GuiInspectorTypeMaterialAssetPtr : public GuiInspectorTypeFileName
{
typedef GuiInspectorField Parent;
typedef GuiInspectorTypeFileName Parent;
public:
GuiControl* mMatEdContainer;
GuiBitmapButtonCtrl *mMatPreviewButton;
GuiTextEditCtrl *mMatAssetIdTxt;
GuiBitmapButtonCtrl* mEditButton;
DECLARE_CONOBJECT(GuiInspectorTypeMaterialAssetPtr);
static void consoleInit();
virtual GuiControl* constructEditControl();
virtual bool updateRects();
virtual bool resize(const Point2I& newPosition, const Point2I& newExtent);
void setMaterialAsset(String assetId);
};
class GuiInspectorTypeMaterialAssetId : public GuiInspectorTypeMaterialAssetPtr
{
typedef GuiInspectorTypeMaterialAssetPtr Parent;
public:
DECLARE_CONOBJECT(GuiInspectorTypeMaterialAssetId);
static void consoleInit();
};
#endif // _ASSET_BASE_H_