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:
Areloch 2019-05-17 01:48:45 -05:00
parent 13fb5cd5b9
commit af14de2bb7
19 changed files with 626 additions and 12 deletions

View file

@ -3615,7 +3615,7 @@
isContainer = "0";
HorizSizing = "left";
VertSizing = "bottom";
position = "86 1";
position = "66 1";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
@ -3636,7 +3636,7 @@
Profile = "ToolsGuiDefaultProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "106 1";
position = "86 1";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
@ -3658,7 +3658,7 @@
Profile = "ToolsGuiDefaultProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "123 1";
position = "106 1";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
@ -3672,6 +3672,27 @@
useMouseEvents = "0";
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(){
position = "147 1";
Extent = "2 16";

View file

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

View file

@ -32,9 +32,13 @@ function initializeMaterialEditor()
// Load Properties Window
exec("~/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui");
//Material Instance viewer
exec("~/materialEditor/gui/materialInstancesView.ed.gui");
// Load Client Scripts.
exec("./scripts/materialEditor.ed.cs");
exec("./scripts/materialEditorUndo.ed.cs");
exec("./scripts/materialInstanceView.ed.cs");
//exec("./gui/profiles.ed.cs");
MaterialEditorPreviewWindow.setVisible( false );

View file

@ -2116,6 +2116,32 @@ function MaterialEditorGui::refreshMaterial(%this)
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

View file

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