Skip to content

Commit

Permalink
Plugin updated for Noesis SDK 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
s-fernandez-v committed Nov 21, 2022
1 parent 456f900 commit bf24cf1
Show file tree
Hide file tree
Showing 19 changed files with 730 additions and 59 deletions.
2 changes: 1 addition & 1 deletion NoesisGUI.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"Name": "NoesisBlueprint",
"Type": "UncookedOnly",
"LoadingPhase": "Default"
"LoadingPhase": "PreDefault"
},
{
"Name": "NoesisEditor",
Expand Down
12 changes: 0 additions & 12 deletions Source/Noesis/NoesisSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,4 @@

#pragma once

#ifdef PLATFORM_WINDOWS
#if PLATFORM_WINDOWS
#include "Windows/AllowWindowsPlatformTypes.h"
#endif
#endif

#include "NoesisPCH.h"

#ifdef PLATFORM_WINDOWS
#if PLATFORM_WINDOWS
#include "Windows/HideWindowsPlatformTypes.h"
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include "K2Node_NoesisAssignAndNotify.h"

// Core includes
#include "CoreMinimal.h"
#include "Misc/EngineVersionComparison.h"

// BlueprintGraph includes
#include "BlueprintActionDatabaseRegistrar.h"
#include "BlueprintFieldNodeSpawner.h"
Expand All @@ -15,7 +19,11 @@
#include "K2Node_VariableSet.h"

// EditorStyle includes
#if UE_VERSION_OLDER_THAN(5, 1, 0)
#include "Classes/EditorStyleSettings.h"
#else
#include "Settings/EditorStyleSettings.h"
#endif

// Engine includes
#include "ObjectEditorUtils.h"
Expand Down
6 changes: 6 additions & 0 deletions Source/NoesisBlueprint/Private/NoesisBlueprintPrivatePCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#pragma once

// Core includes
#include "CoreMinimal.h"
#include "Misc/EngineVersionComparison.h"
#include "Modules/ModuleManager.h"

// Engine includes
Expand Down Expand Up @@ -34,7 +36,11 @@
#include "K2Node_Variable.h"

// EditorStyle includes
#if UE_VERSION_OLDER_THAN(5, 1, 0)
#include "Classes/EditorStyleSettings.h"
#else
#include "Settings/EditorStyleSettings.h"
#endif

// KismetCompiler includes
#include "KismetCompiler.h"
Expand Down
8 changes: 8 additions & 0 deletions Source/NoesisEditor/Private/NoesisBlueprintEditorToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ void FNoesisBlueprintEditorToolbar::FillNoesisBlueprintEditorModesToolbar(FToolB
SNew(SModeWidget, FNoesisBlueprintApplicationModes::GetLocalizedMode(FNoesisBlueprintApplicationModes::PreviewMode), FNoesisBlueprintApplicationModes::PreviewMode)
.OnGetActiveMode(GetActiveMode)
.OnSetActiveMode(SetActiveMode)
#if UE_VERSION_OLDER_THAN(5, 1, 0)
.IconImage(FEditorStyle::GetBrush("UMGEditor.SwitchToDesigner"))
#else
.IconImage(FAppStyle::GetBrush("UMGEditor.SwitchToDesigner"))
#endif
#if UE_VERSION_OLDER_THAN(5, 0, 0)
.SmallIconImage(FEditorStyle::GetBrush("UMGEditor.SwitchToDesigner.Small"))
#endif
Expand All @@ -84,7 +88,11 @@ void FNoesisBlueprintEditorToolbar::FillNoesisBlueprintEditorModesToolbar(FToolB
.OnSetActiveMode(SetActiveMode)
.CanBeSelected(BlueprintEditorPtr.Get(), &FBlueprintEditor::IsEditingSingleBlueprint)
.ToolTipText(LOCTEXT("GraphModeButtonTooltip", "Switch to Graph Editing Mode"))
#if UE_VERSION_OLDER_THAN(5, 1, 0)
.IconImage(FEditorStyle::GetBrush("FullBlueprintEditor.SwitchToScriptingMode"))
#else
.IconImage(FAppStyle::GetBrush("FullBlueprintEditor.SwitchToScriptingMode"))
#endif
#if UE_VERSION_OLDER_THAN(5, 0, 0)
.SmallIconImage(FEditorStyle::GetBrush("FullBlueprintEditor.SwitchToScriptingMode.Small"))
#endif
Expand Down
3 changes: 2 additions & 1 deletion Source/NoesisEditor/Private/NoesisEditorPrivatePCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ THIRD_PARTY_INCLUDES_END

// BlueprintGraph includes
#include "BlueprintNodeTemplateCache.h"

// AssetRegistry includes
#include "AssetRegistryModule.h"
#include "AssetRegistry/AssetRegistryModule.h"

// Kismet includes
#include "BlueprintCompilationManager.h"
Expand Down
20 changes: 18 additions & 2 deletions Source/NoesisEditor/Private/NoesisXamlAssetTypeActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "Misc/EngineVersionComparison.h"

// AssetRegistry includes
#include "AssetRegistryModule.h"
#include "AssetRegistry/AssetRegistryModule.h"

// BlueprintGraph includes
#include "BlueprintNodeTemplateCache.h"
Expand Down Expand Up @@ -67,7 +67,11 @@ void FNoesisXamlAssetTypeActions::GetActions(const TArray<UObject*>& InObjects,
"NoesisXaml_AddToViewport",
LOCTEXT("NoesisXaml_AddToViewport", "Add to Viewport"),
LOCTEXT("NoesisXaml_AddToViewportTooltip", "Create a NoesisView and add it to the Viewport in the current Level."),
#if UE_VERSION_OLDER_THAN(5, 1, 0)
FSlateIcon(FEditorStyle::GetStyleSetName(), "ClassIcon.Widget"),
#else
FSlateIcon(FAppStyle::GetAppStyleSetName(), "ClassIcon.Widget"),
#endif
FUIAction(
FExecuteAction::CreateSP(this, &FNoesisXamlAssetTypeActions::AddToViewport, Xamls),
FCanExecuteAction()
Expand Down Expand Up @@ -122,11 +126,19 @@ static bool ShouldRender(const FAssetData& AssetData)
return !CachedThumbnail->IsEmpty();
}

#if UE_VERSION_OLDER_THAN(5, 1, 0)
if (AssetData.AssetClass != UBlueprint::StaticClass()->GetFName())
#else
if (AssetData.AssetClassPath != UBlueprint::StaticClass()->GetClassPathName())
#endif
{
// If we are not a blueprint, see if the CDO of the asset's class has a rendering info
// Blueprints can't do this because the rendering info is based on the generated class
UClass* AssetClass = FindObject<UClass>(ANY_PACKAGE, *AssetData.AssetClass.ToString());
#if UE_VERSION_OLDER_THAN(5, 1, 0)
UClass* AssetClass = FindObject<UClass>(nullptr, *AssetData.AssetClass.ToString());
#else
UClass* AssetClass = FindObject<UClass>(nullptr, *AssetData.AssetClassPath.ToString());
#endif

if (AssetClass)
{
Expand Down Expand Up @@ -184,7 +196,11 @@ TSharedPtr<SWidget> FNoesisXamlAssetTypeActions::GetThumbnailOverlay(const FAsse
const FSlateBrush* Icon = FSlateIconFinder::FindIconBrushForClass(UNoesisXaml::StaticClass());

return SNew(SBorder)
#if UE_VERSION_OLDER_THAN(5, 1, 0)
.BorderImage(FEditorStyle::GetNoBrush())
#else
.BorderImage(FAppStyle::GetNoBrush())
#endif
.Visibility(EVisibility::HitTestInvisible)
.Padding(FMargin(0.0f, 0.0f, 0.0f, 3.0f))
.HAlign(HAlign_Right)
Expand Down
12 changes: 11 additions & 1 deletion Source/NoesisEditor/Private/NoesisXamlFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#include "NoesisXamlFactory.h"

// AssetRegistry includes
#include "AssetRegistryModule.h"
#include "AssetRegistry/AssetRegistryModule.h"

// AssetTools includes
#include "AssetToolsModule.h"

// Core includes
#include "CoreMinimal.h"
#include "Misc/EngineVersionComparison.h"
#include "GenericPlatform/GenericPlatformFile.h"
#include "HAL/PlatformFilemanager.h"
#include "Misc/FileHelper.h"
Expand Down Expand Up @@ -339,7 +340,11 @@ FString GetDependencyPath(const Noesis::Uri& Uri)
void ConfigureFilter(FARFilter& Filter, UClass* Class, bool RecursiveClasses)
{
Filter.bRecursiveClasses = RecursiveClasses;
#if UE_VERSION_OLDER_THAN(5, 1, 0)
Filter.ClassNames.Add(Class->GetFName());
#else
Filter.ClassPaths.Add(Class->GetClassPathName());
#endif

Filter.bRecursivePaths = true;
Filter.PackagePaths.Add(TEXT("/Game"));
Expand Down Expand Up @@ -637,6 +642,11 @@ UObject* UNoesisXamlFactory::FactoryCreateBinary(UClass* Class, UObject* Parent,
Noesis::RegisterComponent<LocTableExtension>();
}

if (GetDefault<UNoesisSettings>()->ApplicationResources == FSoftObjectPath(NoesisXaml))
{
GetDefault<UNoesisSettings>()->SetApplicationResources();
}

StaticRecursive = Recursive;

// If this is not the first level XAML and nothing has changed we return null here so that the
Expand Down
4 changes: 4 additions & 0 deletions Source/NoesisEditor/Private/SBlueprintModeSeparator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ void SBlueprintModeSeparator::Construct(const FArguments& InArg)
{
SBorder::Construct(
SBorder::FArguments()
#if UE_VERSION_OLDER_THAN(5, 1, 0)
.BorderImage(FEditorStyle::GetBrush("BlueprintEditor.PipelineSeparator"))
#else
.BorderImage(FAppStyle::GetBrush("BlueprintEditor.PipelineSeparator"))
#endif
.Padding(0.0f)
);
}
Expand Down
7 changes: 5 additions & 2 deletions Source/NoesisRuntime/Classes/NoesisInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class NOESISRUNTIME_API UNoesisInstance : public UUserWidget
typedef TSharedPtr<class FNoesisSlateElement, ESPMode::ThreadSafe> FNoesisSlateElementPtr;
FNoesisSlateElementPtr NoesisSlateElement;

class UWidgetComponent* WidgetComponent;

UPROPERTY()
class UNoesisXaml* BaseXaml;

Expand Down Expand Up @@ -181,7 +183,7 @@ class NOESISRUNTIME_API UNoesisInstance : public UUserWidget
void OnPreviewGotKeyboardFocus(Noesis::BaseComponent* Component, const Noesis::KeyboardFocusChangedEventArgs& Args);
void OnPreviewLostKeyboardFocus(Noesis::BaseComponent* Component, const Noesis::KeyboardFocusChangedEventArgs& Args);

bool HitTest(FVector2D Position);
bool HitTest(FVector2D Position) const;

void TermInstance();

Expand All @@ -191,8 +193,9 @@ class NOESISRUNTIME_API UNoesisInstance : public UUserWidget
virtual void PostLoad();
// End of UObject interface

#if WITH_EDITOR
// UWidget interface
virtual void OnWidgetRebuilt() override;
#if WITH_EDITOR
virtual void SetDesignerFlags(EWidgetDesignFlags NewFlags) override;
// End of UWidget interface

Expand Down
Loading

0 comments on commit bf24cf1

Please sign in to comment.