Added new Material Editor tab window which lists all the used Custom Primitive Data parameter reads from material expression nodes in the material. They will show up red if there is a potential conflict in reading a specific slot.

#jira UE-84277
#rb none


#ROBOMERGE-SOURCE: CL 10863756 via CL 10863769 via CL 10863771
#ROBOMERGE-BOT: (v610-10636431)

[CL 10863772 by kevin ortegren in Main branch]
This commit is contained in:
kevin ortegren
2019-12-20 16:08:33 -05:00
parent 082b2286d4
commit 7837062732
4 changed files with 293 additions and 3 deletions
@@ -130,6 +130,7 @@
#include "Materials/MaterialExpression.h"
#include "SMaterialParametersOverviewWidget.h"
#include "SMaterialEditorCustomPrimitiveDataWidget.h"
#include "IPropertyRowGenerator.h"
#include "Widgets/Layout/SScrollBox.h"
#include "UObject/TextProperty.h"
@@ -151,7 +152,8 @@ const FName FMaterialEditor::PropertiesTabId( TEXT( "MaterialEditor_MaterialProp
const FName FMaterialEditor::PaletteTabId( TEXT( "MaterialEditor_Palette" ) );
const FName FMaterialEditor::FindTabId( TEXT( "MaterialEditor_Find" ) );
const FName FMaterialEditor::PreviewSettingsTabId( TEXT ("MaterialEditor_PreviewSettings" ) );
const FName FMaterialEditor::ParameterDefaultsTabId( TEXT ("MaterialEditor_ParameterDefaults" ) );
const FName FMaterialEditor::ParameterDefaultsTabId(TEXT("MaterialEditor_ParameterDefaults"));
const FName FMaterialEditor::CustomPrimitiveTabId(TEXT("MaterialEditor_CustomPrimitiveData"));
const FName FMaterialEditor::LayerPropertiesTabId(TEXT("MaterialInstanceEditor_MaterialLayerProperties"));
///////////////////////////
// FMatExpressionPreview //
@@ -287,6 +289,11 @@ void FMaterialEditor::RegisterTabSpawners(const TSharedRef<class FTabManager>& I
.SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));
InTabManager->RegisterTabSpawner(CustomPrimitiveTabId, FOnSpawnTab::CreateSP(this, &FMaterialEditor::SpawnTab_CustomPrimitiveData))
.SetDisplayName(LOCTEXT("CustomPrimitiveTab", "Custom Primitive Data"))
.SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));
IMaterialEditorModule* MaterialEditorModule = &FModuleManager::LoadModuleChecked<IMaterialEditorModule>("MaterialEditor");
if (MaterialEditorModule->MaterialLayersEnabled())
{
@@ -312,7 +319,8 @@ void FMaterialEditor::UnregisterTabSpawners(const TSharedRef<class FTabManager>&
InTabManager->UnregisterTabSpawner( PaletteTabId );
InTabManager->UnregisterTabSpawner( FindTabId );
InTabManager->UnregisterTabSpawner( PreviewSettingsTabId );
InTabManager->UnregisterTabSpawner( ParameterDefaultsTabId );
InTabManager->UnregisterTabSpawner(ParameterDefaultsTabId);
InTabManager->UnregisterTabSpawner(CustomPrimitiveTabId);
InTabManager->UnregisterTabSpawner( LayerPropertiesTabId );
MaterialStatsManager->UnregisterTabs();
@@ -478,7 +486,8 @@ void FMaterialEditor::InitMaterialEditor( const EToolkitMode::Type Mode, const T
FTabManager::NewStack()
->AddTab( PropertiesTabId, ETabState::OpenedTab )
->AddTab( PreviewSettingsTabId, ETabState::ClosedTab )
->AddTab( ParameterDefaultsTabId, ETabState::OpenedTab )
->AddTab(ParameterDefaultsTabId, ETabState::OpenedTab)
->AddTab(CustomPrimitiveTabId, ETabState::ClosedTab)
->AddTab( LayerPropertiesTabId, ETabState::ClosedTab )
->SetForegroundTab( PropertiesTabId )
)
@@ -967,6 +976,7 @@ void FMaterialEditor::CreateInternalWidgets()
MaterialParametersOverviewWidget = SNew(SMaterialParametersOverviewPanel)
.InMaterialEditorInstance(MaterialEditorInstance);
MaterialParametersOverviewWidget->GetGenerator()->OnFinishedChangingProperties().AddSP(this, &FMaterialEditor::OnFinishedChangingParametersFromOverview);
MaterialCustomPrimitiveDataWidget = SNew(SMaterialCustomPrimitiveDataPanel, MaterialEditorInstance);
IMaterialEditorModule* MaterialEditorModule = &FModuleManager::LoadModuleChecked<IMaterialEditorModule>("MaterialEditor");
if (MaterialEditorModule->MaterialLayersEnabled())
@@ -1020,6 +1030,7 @@ void FMaterialEditor::OnFinishedChangingProperties(const FPropertyChangedEvent&
RefreshPreviewViewport();
UpdatePreviewMaterial();
MaterialParametersOverviewWidget->UpdateEditorInstance(MaterialEditorInstance);
MaterialCustomPrimitiveDataWidget->UpdateEditorInstance(MaterialEditorInstance);
}
}
@@ -3379,6 +3390,7 @@ void FMaterialEditor::OnPromoteToParameter()
if (MaterialEditorInstance != nullptr)
{
MaterialParametersOverviewWidget->UpdateEditorInstance(MaterialEditorInstance);
MaterialCustomPrimitiveDataWidget->UpdateEditorInstance(MaterialEditorInstance);
}
}
@@ -3731,6 +3743,21 @@ TSharedRef<SDockTab> FMaterialEditor::SpawnTab_ParameterDefaults(const FSpawnTab
return SpawnedTab;
}
TSharedRef<SDockTab> FMaterialEditor::SpawnTab_CustomPrimitiveData(const FSpawnTabArgs& Args)
{
TSharedRef<SDockTab> SpawnedTab = SNew(SDockTab)
.Icon(FEditorStyle::GetBrush("LevelEditor.Tabs.Details"))
.Label(LOCTEXT("CustomPrimitiveData", "Custom Primitive Data"))
[
SNew(SBox)
[
MaterialCustomPrimitiveDataWidget.ToSharedRef()
]
];
return SpawnedTab;
}
TSharedRef<SDockTab> FMaterialEditor::SpawnTab_LayerProperties(const FSpawnTabArgs& Args)
{
TSharedRef<SDockTab> SpawnedTab = SNew(SDockTab)
@@ -4505,6 +4532,8 @@ void FMaterialEditor::NotifyPostChange( const FPropertyChangedEvent& PropertyCha
MaterialLayersFunctionsInstance->SetEditorInstance(MaterialEditorInstance);
}
MaterialParametersOverviewWidget->UpdateEditorInstance(MaterialEditorInstance);
MaterialCustomPrimitiveDataWidget->UpdateEditorInstance(MaterialEditorInstance);
const FName NameOfPropertyThatChanged( *PropertyThatChanged->GetName() );
if ((NameOfPropertyThatChanged == GET_MEMBER_NAME_CHECKED(UMaterialInterface, PreviewMesh)) ||
(NameOfPropertyThatChanged == GET_MEMBER_NAME_CHECKED(UMaterial, bUsedWithSkeletalMesh)))
@@ -4763,6 +4792,7 @@ void FMaterialEditor::OnColorPickerCommitted(FLinearColor LinearColor)
RefreshExpressionPreviews();
MaterialParametersOverviewWidget->UpdateEditorInstance(MaterialEditorInstance);
MaterialCustomPrimitiveDataWidget->UpdateEditorInstance(MaterialEditorInstance);
}
TSharedRef<SGraphEditor> FMaterialEditor::CreateGraphEditorWidget()
@@ -5255,6 +5285,7 @@ void FMaterialEditor::OnNodeTitleCommitted(const FText& NewText, ETextCommit::Ty
NodeBeingChanged->Modify();
NodeBeingChanged->OnRenameNode(NewText.ToString());
MaterialParametersOverviewWidget->UpdateEditorInstance(MaterialEditorInstance);
MaterialCustomPrimitiveDataWidget->UpdateEditorInstance(MaterialEditorInstance);
}
}