Skip to content

Commit

Permalink
Plugin updated for Noesis SDK 3.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
s-fernandez-v committed Feb 8, 2024
1 parent 6db7bfc commit a24c854
Show file tree
Hide file tree
Showing 33 changed files with 3,832 additions and 433 deletions.
22 changes: 22 additions & 0 deletions Assets/Theme/NoesisTheme.Styles.xaml
Expand Up @@ -571,6 +571,28 @@
<Setter Property="FocusVisualStyle" Value="{StaticResource Style.Focus.Outer.Padded}"/>
</Style>

<!-- Thumb -->
<ControlTemplate x:Key="Template.Thumb" TargetType="Thumb">
<Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Over}" TargetName="Border"/>
<Setter Property="BorderThickness" Value="{DynamicResource Border.Over}" TargetName="Border"/>
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter Property="Background" Value="{DynamicResource Brush.Background.Pressed}" TargetName="Border"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Pressed}" TargetName="Border"/>
<Setter Property="BorderThickness" Value="{DynamicResource Border.Normal}" TargetName="Border"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="Thumb" BasedOn="{StaticResource {x:Type Control}}">
<Setter Property="Background" Value="{DynamicResource Brush.Background.Normal}"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Normal}"/>
<Setter Property="BorderThickness" Value="{DynamicResource Border.Normal}"/>
<Setter Property="Template" Value="{StaticResource Template.Thumb}"/>
</Style>

<!-- ProgressBar -->
<ControlTemplate x:Key="Template.ProgressBar" TargetType="ProgressBar">
<ControlTemplate.Resources>
Expand Down
16 changes: 16 additions & 0 deletions Shaders/Private/NoesisCustomEffectPS.usf
@@ -1,4 +1,5 @@
#include "/Engine/Private/Common.ush"
#include "/Engine/Private/GammaCorrectionCommon.ush"
#include "/Engine/Private/ScreenPass.ush"

#ifndef POST_PROCESS_MATERIAL
Expand Down Expand Up @@ -73,6 +74,8 @@ SamplerState PostProcessInput_BilinearSampler;

#include "/Engine/Generated/Material.ush"

half4 gammaAndAlphaValues;

struct In
{
float4 position: SV_POSITION;
Expand Down Expand Up @@ -139,5 +142,18 @@ Out NoesisPS(in In i)

o.color = half4(Color * Opacity, Opacity); // Premultiplied alpha

#if GAMMA_CORRECTION
#if !LINEAR_COLOR
o.color.rgb = sRGBToLinear(o.color.rgb);
#endif
float contrastMidpoint = 0.25; //TODO We may want to make the midpoint configurable so that users can pick a different one, based on the overall saturation of their UI.
o.color.rgb = saturate(((o.color.rgb - contrastMidpoint) * gammaAndAlphaValues.w) + contrastMidpoint);
#if LINEAR_COLOR
o.color.rgb = pow(o.color.rgb, gammaAndAlphaValues.x);
#else
o.color.rgb = ApplyGammaCorrection(o.color.rgb, gammaAndAlphaValues.x);
#endif
#endif

return o;
}
17 changes: 16 additions & 1 deletion Shaders/Private/NoesisMaterialPS.usf
Expand Up @@ -355,6 +355,8 @@ SamplerState imageSampler;
Texture2D glyphsTex;
SamplerState glyphsSampler;

half4 gammaAndAlphaValues;

struct In
{
float4 position: SV_POSITION;
Expand Down Expand Up @@ -436,7 +438,7 @@ Out NoesisPS(in In i)

half4 paint = half4(Color * Opacity, Opacity); // Premultiplied alpha
half opacity_ = NoesisPSOpacityConstants.opacity;
#if PATTERN_LINEAR
#if LINEAR_COLOR
paint.xyz = sRGBToLinear(paint.xyz);
#endif
#endif
Expand Down Expand Up @@ -504,5 +506,18 @@ Out NoesisPS(in In i)

#endif

#if GAMMA_CORRECTION
#if !LINEAR_COLOR
o.color.rgb = sRGBToLinear(o.color.rgb);
#endif
float contrastMidpoint = 0.25; //TODO We may want to make the midpoint configurable so that users can pick a different one, based on the overall saturation of their UI.
o.color.rgb = saturate(((o.color.rgb - contrastMidpoint) * gammaAndAlphaValues.w) + contrastMidpoint);
#if LINEAR_COLOR
o.color.rgb = pow(o.color.rgb, gammaAndAlphaValues.x);
#else
o.color.rgb = ApplyGammaCorrection(o.color.rgb, gammaAndAlphaValues.x);
#endif
#endif

return o;
}
15 changes: 15 additions & 0 deletions Shaders/Private/NoesisPS.usf
Expand Up @@ -363,6 +363,8 @@ SamplerState glyphsSampler;
Texture2D shadowTex;
SamplerState shadowSampler;

half4 gammaAndAlphaValues;

struct In
{
float4 position: SV_POSITION;
Expand Down Expand Up @@ -559,5 +561,18 @@ Out NoesisPS(in In i)

#endif

#if GAMMA_CORRECTION
#if !LINEAR_COLOR
o.color.rgb = sRGBToLinear(o.color.rgb);
#endif
float contrastMidpoint = 0.25; //TODO We may want to make the midpoint configurable so that users can pick a different one, based on the overall saturation of their UI.
o.color.rgb = saturate(((o.color.rgb - contrastMidpoint) * gammaAndAlphaValues.w) + contrastMidpoint);
#if LINEAR_COLOR
o.color.rgb = pow(o.color.rgb, gammaAndAlphaValues.x);
#else
o.color.rgb = ApplyGammaCorrection(o.color.rgb, gammaAndAlphaValues.x);
#endif
#endif

return o;
}
2 changes: 2 additions & 0 deletions Source/Noesis/Noesis.Build.cs
Expand Up @@ -20,6 +20,7 @@ public Noesis(ReadOnlyTargetRules Target) : base(Target)
string NoesisRiveBaseIncludePath = Path.Combine(NoesisBasePath, "Src", "Packages", "App", "RiveBase", "Include");
string NoesisRiveIncludePath = Path.Combine(NoesisBasePath, "Src", "Packages", "App", "Rive", "Include");
string RiveIncludePath = Path.Combine(NoesisBasePath, "Src", "Packages", "App", "RiveBase", "Src", "rive", "include");
string RiveSheenBidiIncludePath = Path.Combine(NoesisBasePath, "Src", "Packages", "App", "RiveBase", "Src", "SheenBidi", "Headers");

// In monolithic builds we don't want the Interactivity and MediaElement functions
// dllexported or dllimported from any modules.
Expand All @@ -44,6 +45,7 @@ public Noesis(ReadOnlyTargetRules Target) : base(Target)
PublicIncludePaths.Add(NoesisRiveBaseIncludePath);
PublicIncludePaths.Add(NoesisRiveIncludePath);
PublicIncludePaths.Add(RiveIncludePath);
PublicIncludePaths.Add(RiveSheenBidiIncludePath);

if (Target.Type == TargetType.Editor)
{
Expand Down
27 changes: 23 additions & 4 deletions Source/NoesisEditor/Private/NoesisEditorModule.cpp
Expand Up @@ -44,6 +44,7 @@
#include "NoesisXamlThumbnailRenderer.h"
#include "NoesisRiveThumbnailRenderer.h"
#include "NoesisStyle.h"
#include "NoesisLangServerResourceProvider.h"

// KismetCompiler includes
#include "KismetCompiler.h"
Expand Down Expand Up @@ -118,6 +119,15 @@ void PremultiplyAlpha(UTexture2D* Texture)
}
}

static void SetLangServerCallbacks(FNoesisLangServerTextureProvider* textureProvider)
{
NoesisApp::LangServer::SetDocumentClosedCallback(textureProvider, [](void* user, const Noesis::Uri& uri)
{
FNoesisLangServerTextureProvider* provider = (FNoesisLangServerTextureProvider*)user;
provider->ClearShrinkTextures();
});
}

static void DestroyThumbnails()
{
for (TObjectIterator<UNoesisXaml> It; It; ++It)
Expand Down Expand Up @@ -264,9 +274,18 @@ class FNoesisEditorModule : public INoesisEditorModuleInterface
// Register slate style overrides
FNoesisStyle::Initialize();

Noesis::Ptr<FNoesisLangServerTextureProvider> LangTextureProvider = Noesis::MakePtr<FNoesisLangServerTextureProvider>();

// Set LangServer Scheme Providers
NoesisApp::LangServer::SetXamlProvider(Noesis::MakePtr<FNoesisLangServerXamlProvider>());
NoesisApp::LangServer::SetTextureProvider(LangTextureProvider);
NoesisApp::LangServer::SetFontProvider(Noesis::MakePtr<FNoesisLangServerFontProvider>());

SetLangServerCallbacks(LangTextureProvider);

// Initialize LangServer
Noesis::LangServer::SetDetails("Unreal", 1000);
Noesis::LangServer::Run();
NoesisApp::LangServer::SetName("Unreal");
NoesisApp::LangServer::Init();

// Register asset type actions
IAssetTools& AssetTools = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools").Get();
Expand Down Expand Up @@ -319,7 +338,7 @@ class FNoesisEditorModule : public INoesisEditorModuleInterface
TickerHandle = FTSTicker::GetCoreTicker().AddTicker(TEXT("NoesisEditor"), 0.0f, [this](float DeltaTime)
{
Noesis::GUI::UpdateInspector();
Noesis::LangServer::Tick();
NoesisApp::LangServer::RunTick();
return true;
});

Expand Down Expand Up @@ -401,7 +420,7 @@ class FNoesisEditorModule : public INoesisEditorModuleInterface
FNoesisStyle::Shutdown();

// Disable LangServer
Noesis::LangServer::Shutdown();
NoesisApp::LangServer::Shutdown();

// Unregister asset type actions
if (FModuleManager::Get().IsModuleLoaded("AssetTools"))
Expand Down

0 comments on commit a24c854

Please sign in to comment.