mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Implements a Material Instance viewer to the material editor to see a feature-filtered dump of the generated shaders for a given material.
This commit is contained in:
parent
13fb5cd5b9
commit
af14de2bb7
19 changed files with 626 additions and 12 deletions
|
|
@ -59,7 +59,7 @@ struct GFXStateBlockDesc;
|
||||||
class GFXVertexFormat;
|
class GFXVertexFormat;
|
||||||
class MatrixSet;
|
class MatrixSet;
|
||||||
class ProcessedMaterial;
|
class ProcessedMaterial;
|
||||||
|
class GuiTreeViewCtrl;
|
||||||
|
|
||||||
///
|
///
|
||||||
class BaseMatInstance
|
class BaseMatInstance
|
||||||
|
|
@ -216,6 +216,7 @@ public:
|
||||||
virtual const GFXVertexFormat* getVertexFormat() const = 0;
|
virtual const GFXVertexFormat* getVertexFormat() const = 0;
|
||||||
|
|
||||||
virtual void dumpShaderInfo() const = 0;
|
virtual void dumpShaderInfo() const = 0;
|
||||||
|
virtual void getShaderInfo(GuiTreeViewCtrl* tree, U32 item) const = 0;
|
||||||
|
|
||||||
/// Fast test for use of normal maps in this material.
|
/// Fast test for use of normal maps in this material.
|
||||||
bool hasNormalMap() const { return mHasNormalMaps; }
|
bool hasNormalMap() const { return mHasNormalMaps; }
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@
|
||||||
#include "core/util/safeDelete.h"
|
#include "core/util/safeDelete.h"
|
||||||
#include "ts/tsShape.h"
|
#include "ts/tsShape.h"
|
||||||
|
|
||||||
|
#include "gui/controls/guiTreeViewCtrl.h"
|
||||||
|
|
||||||
class MatInstParameters;
|
class MatInstParameters;
|
||||||
|
|
||||||
class MatInstanceParameterHandle : public MaterialParameterHandle
|
class MatInstanceParameterHandle : public MaterialParameterHandle
|
||||||
|
|
@ -591,3 +593,35 @@ void MatInstance::dumpShaderInfo() const
|
||||||
|
|
||||||
mProcessedMaterial->dumpMaterialInfo();
|
mProcessedMaterial->dumpMaterialInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MatInstance::getShaderInfo(GuiTreeViewCtrl* tree, U32 item) const
|
||||||
|
{
|
||||||
|
if (mMaterial == NULL)
|
||||||
|
{
|
||||||
|
Con::errorf("Trying to get Material information on an invalid MatInstance");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mProcessedMaterial == NULL)
|
||||||
|
{
|
||||||
|
Con::printf(" [no processed material!]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FeatureSet features = mProcessedMaterial->getFeatures();
|
||||||
|
|
||||||
|
String featureDesc = "";
|
||||||
|
for (U32 i = 0; i < features.getCount(); i++)
|
||||||
|
{
|
||||||
|
const FeatureType& ft = features.getAt(i);
|
||||||
|
|
||||||
|
featureDesc += ft.getName();
|
||||||
|
|
||||||
|
if(i+1 < features.getCount())
|
||||||
|
featureDesc += ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 newItem = tree->insertItem(item, featureDesc);
|
||||||
|
|
||||||
|
mProcessedMaterial->getMaterialInfo(tree, newItem);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class ShaderFeature;
|
||||||
class MatInstanceParameterHandle;
|
class MatInstanceParameterHandle;
|
||||||
class MatInstParameters;
|
class MatInstParameters;
|
||||||
class ProcessedMaterial;
|
class ProcessedMaterial;
|
||||||
|
class GuiTreeViewCtrl;
|
||||||
|
|
||||||
///
|
///
|
||||||
class MatInstance : public BaseMatInstance
|
class MatInstance : public BaseMatInstance
|
||||||
|
|
@ -86,6 +86,7 @@ public:
|
||||||
virtual const FeatureSet& getFeatures() const;
|
virtual const FeatureSet& getFeatures() const;
|
||||||
virtual const FeatureSet& getRequestedFeatures() const { return mFeatureList; }
|
virtual const FeatureSet& getRequestedFeatures() const { return mFeatureList; }
|
||||||
virtual void dumpShaderInfo() const;
|
virtual void dumpShaderInfo() const;
|
||||||
|
virtual void getShaderInfo(GuiTreeViewCtrl* tree, U32 item) const;
|
||||||
|
|
||||||
|
|
||||||
ProcessedMaterial *getProcessedMaterial() const { return mProcessedMaterial; }
|
ProcessedMaterial *getProcessedMaterial() const { return mProcessedMaterial; }
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#include "sfx/sfxTypes.h"
|
#include "sfx/sfxTypes.h"
|
||||||
#include "core/util/safeDelete.h"
|
#include "core/util/safeDelete.h"
|
||||||
#include "T3D/accumulationVolume.h"
|
#include "T3D/accumulationVolume.h"
|
||||||
|
#include "gui/controls/guiTreeViewCtrl.h"
|
||||||
|
|
||||||
IMPLEMENT_CONOBJECT( Material );
|
IMPLEMENT_CONOBJECT( Material );
|
||||||
|
|
||||||
|
|
@ -647,6 +647,12 @@ DefineEngineMethod( Material, dumpInstances, void, (),,
|
||||||
MATMGR->dumpMaterialInstances( object );
|
MATMGR->dumpMaterialInstances( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(Material, getMaterialInstances, void, (GuiTreeViewCtrl* matTree), (nullAsType< GuiTreeViewCtrl*>()),
|
||||||
|
"Dumps a formatted list of the currently allocated material instances for this material to the console.")
|
||||||
|
{
|
||||||
|
MATMGR->getMaterialInstances(object, matTree);
|
||||||
|
}
|
||||||
|
|
||||||
DefineEngineMethod( Material, getAnimFlags, const char*, (U32 id), , "" )
|
DefineEngineMethod( Material, getAnimFlags, const char*, (U32 id), , "" )
|
||||||
{
|
{
|
||||||
char * animFlags = Con::getReturnBuffer(512);
|
char * animFlags = Con::getReturnBuffer(512);
|
||||||
|
|
@ -706,6 +712,13 @@ DefineEngineMethod( Material, setAutoGenerated, void, (bool isAutoGenerated), ,
|
||||||
object->setAutoGenerated(isAutoGenerated);
|
object->setAutoGenerated(isAutoGenerated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(Material, getAutogeneratedFile, const char*, (), , "Get filename of autogenerated shader file")
|
||||||
|
{
|
||||||
|
SimObject *material = static_cast<SimObject *>(object);
|
||||||
|
return material->getFilename();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Accumulation
|
// Accumulation
|
||||||
bool Material::_setAccuEnabled( void *object, const char *index, const char *data )
|
bool Material::_setAccuEnabled( void *object, const char *index, const char *data )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "console/consoleTypes.h"
|
#include "console/consoleTypes.h"
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
|
|
||||||
|
#include "gui/controls/guiTreeViewCtrl.h"
|
||||||
|
|
||||||
MODULE_BEGIN( MaterialManager )
|
MODULE_BEGIN( MaterialManager )
|
||||||
|
|
||||||
|
|
@ -399,6 +400,36 @@ void MaterialManager::dumpMaterialInstances( BaseMaterialDefinition *target ) co
|
||||||
Con::printf( "---------------------- Dump complete ----------------------");
|
Con::printf( "---------------------- Dump complete ----------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaterialManager::getMaterialInstances(BaseMaterialDefinition* target, GuiTreeViewCtrl* materailInstanceTree)
|
||||||
|
{
|
||||||
|
if (!mMatInstanceList.size())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!target)
|
||||||
|
{
|
||||||
|
Con::errorf("Can't form a list without a specific MaterialDefinition");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!materailInstanceTree)
|
||||||
|
{
|
||||||
|
Con::errorf("Requires a valid GuiTreeViewCtrl object to populate data into!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 matItem = materailInstanceTree->insertItem(0, target->getName());
|
||||||
|
|
||||||
|
for (U32 i = 0; i < mMatInstanceList.size(); i++)
|
||||||
|
{
|
||||||
|
BaseMatInstance* inst = mMatInstanceList[i];
|
||||||
|
|
||||||
|
if (target && inst->getMaterial() != target)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
inst->getShaderInfo(materailInstanceTree, matItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MaterialManager::_track( MatInstance *matInstance )
|
void MaterialManager::_track( MatInstance *matInstance )
|
||||||
{
|
{
|
||||||
mMatInstanceList.push_back( matInstance );
|
mMatInstanceList.push_back( matInstance );
|
||||||
|
|
@ -488,6 +519,16 @@ DefineEngineFunction( dumpMaterialInstances, void, (), ,
|
||||||
MATMGR->dumpMaterialInstances();
|
MATMGR->dumpMaterialInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineFunction(getMaterialInstances, void, (BaseMaterialDefinition* target, GuiTreeViewCtrl* tree), (nullAsType<BaseMaterialDefinition*>(), nullAsType<GuiTreeViewCtrl*>()),
|
||||||
|
"@brief Dumps a formatted list of currently allocated material instances to the console.\n\n"
|
||||||
|
"@ingroup Materials")
|
||||||
|
{
|
||||||
|
if (target == nullptr || tree == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MATMGR->getMaterialInstances(target, tree);
|
||||||
|
}
|
||||||
|
|
||||||
DefineEngineFunction( getMapEntry, const char*, (const char * texName), ,
|
DefineEngineFunction( getMapEntry, const char*, (const char * texName), ,
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
class SimSet;
|
class SimSet;
|
||||||
class MatInstance;
|
class MatInstance;
|
||||||
|
class GuiTreeViewCtrl;
|
||||||
|
|
||||||
class MaterialManager : public ManagedSingleton<MaterialManager>
|
class MaterialManager : public ManagedSingleton<MaterialManager>
|
||||||
{
|
{
|
||||||
|
|
@ -97,6 +98,8 @@ public:
|
||||||
|
|
||||||
void dumpMaterialInstances( BaseMaterialDefinition *target = NULL ) const;
|
void dumpMaterialInstances( BaseMaterialDefinition *target = NULL ) const;
|
||||||
|
|
||||||
|
void getMaterialInstances(BaseMaterialDefinition* target, GuiTreeViewCtrl* tree);
|
||||||
|
|
||||||
void updateTime();
|
void updateTime();
|
||||||
F32 getTotalTime() const { return mAccumTime; }
|
F32 getTotalTime() const { return mAccumTime; }
|
||||||
F32 getDeltaTime() const { return mDt; }
|
F32 getDeltaTime() const { return mDt; }
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class SceneRenderState;
|
||||||
class GFXVertexBufferHandleBase;
|
class GFXVertexBufferHandleBase;
|
||||||
class GFXPrimitiveBufferHandle;
|
class GFXPrimitiveBufferHandle;
|
||||||
class MatrixSet;
|
class MatrixSet;
|
||||||
|
class GuiTreeViewCtrl;
|
||||||
|
|
||||||
/// This contains the common data needed to render a pass.
|
/// This contains the common data needed to render a pass.
|
||||||
struct RenderPassData
|
struct RenderPassData
|
||||||
|
|
@ -218,6 +218,8 @@ public:
|
||||||
/// Dump shader info, or FF texture info?
|
/// Dump shader info, or FF texture info?
|
||||||
virtual void dumpMaterialInfo() { }
|
virtual void dumpMaterialInfo() { }
|
||||||
|
|
||||||
|
virtual void getMaterialInfo(GuiTreeViewCtrl* tree, U32 item) {}
|
||||||
|
|
||||||
/// Returns the source material.
|
/// Returns the source material.
|
||||||
Material* getMaterial() const { return mMaterial; }
|
Material* getMaterial() const { return mMaterial; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
// We need to include customMaterialDefinition for ShaderConstHandles::init
|
// We need to include customMaterialDefinition for ShaderConstHandles::init
|
||||||
#include "materials/customMaterialDefinition.h"
|
#include "materials/customMaterialDefinition.h"
|
||||||
|
|
||||||
|
#include "gui/controls/guiTreeViewCtrl.h"
|
||||||
#include "ts/tsShape.h"
|
#include "ts/tsShape.h"
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
@ -1421,3 +1421,26 @@ void ProcessedShaderMaterial::dumpMaterialInfo()
|
||||||
Con::printf( " [%i] %s", i, shader->describeSelf().c_str() );
|
Con::printf( " [%i] %s", i, shader->describeSelf().c_str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProcessedShaderMaterial::getMaterialInfo(GuiTreeViewCtrl* tree, U32 item)
|
||||||
|
{
|
||||||
|
for (U32 i = 0; i < getNumPasses(); i++)
|
||||||
|
{
|
||||||
|
const ShaderRenderPassData* passData = _getRPD(i);
|
||||||
|
|
||||||
|
if (passData == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char passStr[64];
|
||||||
|
dSprintf(passStr, 64, "Pass Number: %i", i);
|
||||||
|
|
||||||
|
U32 passItem = tree->insertItem(item, passStr);
|
||||||
|
|
||||||
|
const GFXShader * shader = passData->shader;
|
||||||
|
|
||||||
|
if (shader == NULL)
|
||||||
|
tree->insertItem(passItem, "[NULL shader]");
|
||||||
|
else
|
||||||
|
tree->insertItem(passItem, shader->describeSelf().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ class ShaderMaterialParameterHandle;
|
||||||
class ShaderFeatureConstHandles;
|
class ShaderFeatureConstHandles;
|
||||||
class CustomMaterial;
|
class CustomMaterial;
|
||||||
|
|
||||||
|
|
||||||
class ShaderConstHandles
|
class ShaderConstHandles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -136,6 +135,7 @@ public:
|
||||||
virtual void setBuffers(GFXVertexBufferHandleBase* vertBuffer, GFXPrimitiveBufferHandle* primBuffer);
|
virtual void setBuffers(GFXVertexBufferHandleBase* vertBuffer, GFXPrimitiveBufferHandle* primBuffer);
|
||||||
virtual bool stepInstance();
|
virtual bool stepInstance();
|
||||||
virtual void dumpMaterialInfo();
|
virtual void dumpMaterialInfo();
|
||||||
|
virtual void getMaterialInfo(GuiTreeViewCtrl* tree, U32 item);
|
||||||
virtual MaterialParameters* allocMaterialParameters();
|
virtual MaterialParameters* allocMaterialParameters();
|
||||||
virtual MaterialParameters* getDefaultMaterialParameters() { return mDefaultParameters; }
|
virtual MaterialParameters* getDefaultMaterialParameters() { return mDefaultParameters; }
|
||||||
virtual MaterialParameterHandle* getMaterialParameterHandle(const String& name);
|
virtual MaterialParameterHandle* getMaterialParameterHandle(const String& name);
|
||||||
|
|
|
||||||
|
|
@ -3615,7 +3615,7 @@
|
||||||
isContainer = "0";
|
isContainer = "0";
|
||||||
HorizSizing = "left";
|
HorizSizing = "left";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "86 1";
|
position = "66 1";
|
||||||
Extent = "16 16";
|
Extent = "16 16";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
|
|
@ -3636,7 +3636,7 @@
|
||||||
Profile = "ToolsGuiDefaultProfile";
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
HorizSizing = "left";
|
HorizSizing = "left";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "106 1";
|
position = "86 1";
|
||||||
Extent = "16 16";
|
Extent = "16 16";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
|
|
@ -3658,7 +3658,7 @@
|
||||||
Profile = "ToolsGuiDefaultProfile";
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
HorizSizing = "left";
|
HorizSizing = "left";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "123 1";
|
position = "106 1";
|
||||||
Extent = "16 16";
|
Extent = "16 16";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
|
|
@ -3672,6 +3672,27 @@
|
||||||
useMouseEvents = "0";
|
useMouseEvents = "0";
|
||||||
bitmap = "tools/gui/images/save-icon";
|
bitmap = "tools/gui/images/save-icon";
|
||||||
};
|
};
|
||||||
|
new GuiBitmapButtonCtrl() {
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
Enabled = "1";
|
||||||
|
isContainer = "0";
|
||||||
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
|
HorizSizing = "left";
|
||||||
|
VertSizing = "bottom";
|
||||||
|
position = "126 1";
|
||||||
|
Extent = "16 16";
|
||||||
|
MinExtent = "8 2";
|
||||||
|
canSave = "1";
|
||||||
|
Visible = "1";
|
||||||
|
Command = "MaterialEditorGui.lookupMaterialInstances();";
|
||||||
|
hovertime = "1000";
|
||||||
|
groupNum = "-1";
|
||||||
|
text ="";
|
||||||
|
tooltip = "Lookup Material Instances";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
bitmap = "tools/gui/images/visible";
|
||||||
|
};
|
||||||
new GuiBitmapCtrl(){
|
new GuiBitmapCtrl(){
|
||||||
position = "147 1";
|
position = "147 1";
|
||||||
Extent = "2 16";
|
Extent = "2 16";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,170 @@
|
||||||
|
//--- OBJECT WRITE BEGIN ---
|
||||||
|
%guiContent = new GuiControl(MaterialInstanceViewCtrl) {
|
||||||
|
position = "0 0";
|
||||||
|
extent = "1024 768";
|
||||||
|
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(MaterialInstanceViewWindow) {
|
||||||
|
text = "Material Instances Viewer";
|
||||||
|
resizeWidth = "1";
|
||||||
|
resizeHeight = "1";
|
||||||
|
canMove = "1";
|
||||||
|
canClose = "1";
|
||||||
|
canMinimize = "1";
|
||||||
|
canMaximize = "1";
|
||||||
|
canCollapse = "0";
|
||||||
|
closeCommand = "Canvas.popDialog(MaterialInstanceViewCtrl);";
|
||||||
|
edgeSnap = "1";
|
||||||
|
margin = "0 0 0 0";
|
||||||
|
padding = "0 0 0 0";
|
||||||
|
anchorTop = "1";
|
||||||
|
anchorBottom = "0";
|
||||||
|
anchorLeft = "1";
|
||||||
|
anchorRight = "0";
|
||||||
|
position = "429 123";
|
||||||
|
extent = "550 550";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "right";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
profile = "ToolsGuiWindowProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
isContainer = "1";
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
|
||||||
|
new GuiTextEditCtrl(MaterialInstanceFilter) {
|
||||||
|
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 = "11 21";
|
||||||
|
extent = "516 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(MaterialInstanceFilterBtn) {
|
||||||
|
bitmap = "tools/gui/images/delete";
|
||||||
|
bitmapMode = "Stretched";
|
||||||
|
autoFitExtents = "0";
|
||||||
|
useModifiers = "0";
|
||||||
|
useStates = "1";
|
||||||
|
masked = "0";
|
||||||
|
groupNum = "-1";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
position = "529 22";
|
||||||
|
extent = "15 15";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
profile = "ToolsGuiDefaultProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
tooltip = "Delete Asset";
|
||||||
|
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 = "0 38";
|
||||||
|
extent = "550 510";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "ToolsGuiScrollProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
isContainer = "1";
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
|
||||||
|
new GuiTreeViewCtrl(MaterialInstanceViewTree) {
|
||||||
|
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 = "550 510";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "ToolsGuiTreeViewProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
isContainer = "1";
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//--- OBJECT WRITE END ---
|
||||||
|
|
@ -32,9 +32,13 @@ function initializeMaterialEditor()
|
||||||
// Load Properties Window
|
// Load Properties Window
|
||||||
exec("~/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui");
|
exec("~/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui");
|
||||||
|
|
||||||
|
//Material Instance viewer
|
||||||
|
exec("~/materialEditor/gui/materialInstancesView.ed.gui");
|
||||||
|
|
||||||
// Load Client Scripts.
|
// Load Client Scripts.
|
||||||
exec("./scripts/materialEditor.ed.cs");
|
exec("./scripts/materialEditor.ed.cs");
|
||||||
exec("./scripts/materialEditorUndo.ed.cs");
|
exec("./scripts/materialEditorUndo.ed.cs");
|
||||||
|
exec("./scripts/materialInstanceView.ed.cs");
|
||||||
//exec("./gui/profiles.ed.cs");
|
//exec("./gui/profiles.ed.cs");
|
||||||
|
|
||||||
MaterialEditorPreviewWindow.setVisible( false );
|
MaterialEditorPreviewWindow.setVisible( false );
|
||||||
|
|
|
||||||
|
|
@ -2116,6 +2116,32 @@ function MaterialEditorGui::refreshMaterial(%this)
|
||||||
MaterialEditorGui.setMaterialNotDirty();
|
MaterialEditorGui.setMaterialNotDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Looking up material instances/getting mat info
|
||||||
|
function MaterialEditorGui::lookupMaterialInstances( %this )
|
||||||
|
{
|
||||||
|
if( MaterialEditorGui.currentMaterial.getName() $= "" )
|
||||||
|
{
|
||||||
|
MessageBoxOK("Cannot perform operation", "Unable to look up a material with a blank name" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInstanceViewTree.clear();
|
||||||
|
MaterialInstanceViewTree.setFilterChildren(false);
|
||||||
|
MaterialInstanceViewTree.setItemFilterException(1, true);
|
||||||
|
|
||||||
|
MaterialEditorGui.currentMaterial.getMaterialInstances(MaterialInstanceViewTree);
|
||||||
|
|
||||||
|
if(MaterialInstanceFilter.Text !$= "\c2Filter...")
|
||||||
|
{
|
||||||
|
MaterialInstanceViewTree.setFilterText(MaterialInstanceFilter.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInstanceViewTree.buildVisibleTree(true);
|
||||||
|
|
||||||
|
Canvas.pushDialog(MaterialInstanceViewCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Switching and Changing Materials
|
// Switching and Changing Materials
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
function MaterialInstanceFilter::onGainFirstResponder( %this )
|
||||||
|
{
|
||||||
|
%this.selectAllText();
|
||||||
|
}
|
||||||
|
|
||||||
|
function MaterialInstanceFilter::onReturn( %this )
|
||||||
|
{
|
||||||
|
%text = %this.getText();
|
||||||
|
if( %text $= "" )
|
||||||
|
{
|
||||||
|
%this.reset();
|
||||||
|
MaterialInstanceViewTree.clearFilterText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaterialInstanceViewTree.setFilterText(%text);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInstanceViewTree.buildVisibleTree(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function MaterialInstanceFilterBtn::onClick(%this)
|
||||||
|
{
|
||||||
|
MaterialInstanceFilter.reset();
|
||||||
|
MaterialInstanceViewTree.clearFilterText();
|
||||||
|
MaterialInstanceViewTree.buildVisibleTree(true);
|
||||||
|
}
|
||||||
|
|
@ -3615,7 +3615,7 @@
|
||||||
isContainer = "0";
|
isContainer = "0";
|
||||||
HorizSizing = "left";
|
HorizSizing = "left";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "86 1";
|
position = "66 1";
|
||||||
Extent = "16 16";
|
Extent = "16 16";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
|
|
@ -3636,7 +3636,7 @@
|
||||||
Profile = "ToolsGuiDefaultProfile";
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
HorizSizing = "left";
|
HorizSizing = "left";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "106 1";
|
position = "86 1";
|
||||||
Extent = "16 16";
|
Extent = "16 16";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
|
|
@ -3658,7 +3658,7 @@
|
||||||
Profile = "ToolsGuiDefaultProfile";
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
HorizSizing = "left";
|
HorizSizing = "left";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "123 1";
|
position = "106 1";
|
||||||
Extent = "16 16";
|
Extent = "16 16";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
|
|
@ -3672,6 +3672,27 @@
|
||||||
useMouseEvents = "0";
|
useMouseEvents = "0";
|
||||||
bitmap = "tools/gui/images/save-icon";
|
bitmap = "tools/gui/images/save-icon";
|
||||||
};
|
};
|
||||||
|
new GuiBitmapButtonCtrl() {
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
Enabled = "1";
|
||||||
|
isContainer = "0";
|
||||||
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
|
HorizSizing = "left";
|
||||||
|
VertSizing = "bottom";
|
||||||
|
position = "126 1";
|
||||||
|
Extent = "16 16";
|
||||||
|
MinExtent = "8 2";
|
||||||
|
canSave = "1";
|
||||||
|
Visible = "1";
|
||||||
|
Command = "MaterialEditorGui.lookupMaterialInstances();";
|
||||||
|
hovertime = "1000";
|
||||||
|
groupNum = "-1";
|
||||||
|
text ="";
|
||||||
|
tooltip = "Lookup Material Instances";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
bitmap = "tools/gui/images/visible";
|
||||||
|
};
|
||||||
new GuiBitmapCtrl(){
|
new GuiBitmapCtrl(){
|
||||||
position = "147 1";
|
position = "147 1";
|
||||||
Extent = "2 16";
|
Extent = "2 16";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,170 @@
|
||||||
|
//--- OBJECT WRITE BEGIN ---
|
||||||
|
%guiContent = new GuiControl(MaterialInstanceViewCtrl) {
|
||||||
|
position = "0 0";
|
||||||
|
extent = "1024 768";
|
||||||
|
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(MaterialInstanceViewWindow) {
|
||||||
|
text = "Material Instances Viewer";
|
||||||
|
resizeWidth = "1";
|
||||||
|
resizeHeight = "1";
|
||||||
|
canMove = "1";
|
||||||
|
canClose = "1";
|
||||||
|
canMinimize = "1";
|
||||||
|
canMaximize = "1";
|
||||||
|
canCollapse = "0";
|
||||||
|
closeCommand = "Canvas.popDialog(MaterialInstanceViewCtrl);";
|
||||||
|
edgeSnap = "1";
|
||||||
|
margin = "0 0 0 0";
|
||||||
|
padding = "0 0 0 0";
|
||||||
|
anchorTop = "1";
|
||||||
|
anchorBottom = "0";
|
||||||
|
anchorLeft = "1";
|
||||||
|
anchorRight = "0";
|
||||||
|
position = "429 123";
|
||||||
|
extent = "550 550";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "right";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
profile = "ToolsGuiWindowProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
isContainer = "1";
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
|
||||||
|
new GuiTextEditCtrl(MaterialInstanceFilter) {
|
||||||
|
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 = "11 21";
|
||||||
|
extent = "516 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(MaterialInstanceFilterBtn) {
|
||||||
|
bitmap = "tools/gui/images/delete";
|
||||||
|
bitmapMode = "Stretched";
|
||||||
|
autoFitExtents = "0";
|
||||||
|
useModifiers = "0";
|
||||||
|
useStates = "1";
|
||||||
|
masked = "0";
|
||||||
|
groupNum = "-1";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
position = "529 22";
|
||||||
|
extent = "15 15";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
profile = "ToolsGuiDefaultProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
tooltip = "Delete Asset";
|
||||||
|
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 = "0 38";
|
||||||
|
extent = "550 510";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "ToolsGuiScrollProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
isContainer = "1";
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
|
||||||
|
new GuiTreeViewCtrl(MaterialInstanceViewTree) {
|
||||||
|
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 = "550 510";
|
||||||
|
minExtent = "8 2";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "ToolsGuiTreeViewProfile";
|
||||||
|
visible = "1";
|
||||||
|
active = "1";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
isContainer = "1";
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//--- OBJECT WRITE END ---
|
||||||
|
|
@ -32,9 +32,13 @@ function initializeMaterialEditor()
|
||||||
// Load Properties Window
|
// Load Properties Window
|
||||||
exec("~/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui");
|
exec("~/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui");
|
||||||
|
|
||||||
|
//Material Instance viewer
|
||||||
|
exec("~/materialEditor/gui/materialInstancesView.ed.gui");
|
||||||
|
|
||||||
// Load Client Scripts.
|
// Load Client Scripts.
|
||||||
exec("./scripts/materialEditor.ed.cs");
|
exec("./scripts/materialEditor.ed.cs");
|
||||||
exec("./scripts/materialEditorUndo.ed.cs");
|
exec("./scripts/materialEditorUndo.ed.cs");
|
||||||
|
exec("./scripts/materialInstanceView.ed.cs");
|
||||||
//exec("./gui/profiles.ed.cs");
|
//exec("./gui/profiles.ed.cs");
|
||||||
|
|
||||||
MaterialEditorPreviewWindow.setVisible( false );
|
MaterialEditorPreviewWindow.setVisible( false );
|
||||||
|
|
|
||||||
|
|
@ -2116,6 +2116,32 @@ function MaterialEditorGui::refreshMaterial(%this)
|
||||||
MaterialEditorGui.setMaterialNotDirty();
|
MaterialEditorGui.setMaterialNotDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Looking up material instances/getting mat info
|
||||||
|
function MaterialEditorGui::lookupMaterialInstances( %this )
|
||||||
|
{
|
||||||
|
if( MaterialEditorGui.currentMaterial.getName() $= "" )
|
||||||
|
{
|
||||||
|
MessageBoxOK("Cannot perform operation", "Unable to look up a material with a blank name" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInstanceViewTree.clear();
|
||||||
|
MaterialInstanceViewTree.setFilterChildren(false);
|
||||||
|
MaterialInstanceViewTree.setItemFilterException(1, true);
|
||||||
|
|
||||||
|
MaterialEditorGui.currentMaterial.getMaterialInstances(MaterialInstanceViewTree);
|
||||||
|
|
||||||
|
if(MaterialInstanceFilter.Text !$= "\c2Filter...")
|
||||||
|
{
|
||||||
|
MaterialInstanceViewTree.setFilterText(MaterialInstanceFilter.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInstanceViewTree.buildVisibleTree(true);
|
||||||
|
|
||||||
|
Canvas.pushDialog(MaterialInstanceViewCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Switching and Changing Materials
|
// Switching and Changing Materials
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
function MaterialInstanceFilter::onGainFirstResponder( %this )
|
||||||
|
{
|
||||||
|
%this.selectAllText();
|
||||||
|
}
|
||||||
|
|
||||||
|
function MaterialInstanceFilter::onReturn( %this )
|
||||||
|
{
|
||||||
|
%text = %this.getText();
|
||||||
|
if( %text $= "" )
|
||||||
|
{
|
||||||
|
%this.reset();
|
||||||
|
MaterialInstanceViewTree.clearFilterText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaterialInstanceViewTree.setFilterText(%text);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInstanceViewTree.buildVisibleTree(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function MaterialInstanceFilterBtn::onClick(%this)
|
||||||
|
{
|
||||||
|
MaterialInstanceFilter.reset();
|
||||||
|
MaterialInstanceViewTree.clearFilterText();
|
||||||
|
MaterialInstanceViewTree.buildVisibleTree(true);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue