Browse Source

Fixed connection bug and visual property aligment

Krzysztof Krysiński 5 months ago
parent
commit
eecdb6249d

+ 5 - 0
src/PixiEditor.ChangeableDocument/Changeables/Graph/InputProperty.cs

@@ -225,6 +225,11 @@ public class InputProperty<T> : InputProperty, IInputProperty<T>
             if (value is T tValue)
                 return tValue;
 
+            if (value is ShaderExpressionVariable shaderExpression)
+            {
+                value = shaderExpression.GetConstant();
+            }
+
             var validated = Validator.GetClosestValidValue(value);
 
             if (!ConversionTable.TryConvert(validated, ValueType, out object result))

+ 13 - 10
src/PixiEditor/Views/Nodes/Properties/DoublePropertyView.axaml

@@ -17,7 +17,18 @@
     </Design.DataContext>
     <StackPanel Orientation="Vertical"
                 HorizontalAlignment="{Binding IsInput, Converter={converters:BoolToValueConverter FalseValue='Right', TrueValue='Stretch'}}">
-        <TextBlock VerticalAlignment="Center" ui:Translator.Key="{Binding DisplayName}" />
+
+        <Grid>
+            <TextBlock VerticalAlignment="Center" ui:Translator.Key="{Binding DisplayName}" />
+            <input:NumberInput EnableScrollChange="False" Name="input"
+                               HorizontalAlignment="Right"
+                               MinWidth="100" Decimals="6"
+                               IsVisible="{Binding NumberPickerMode,
+                                                        Converter={converters:EnumBooleanConverter}, ConverterParameter=NumberInput}"
+                               Min="{Binding Min}" Max="{Binding Max}"
+                               Value="{Binding DoubleValue, Mode=TwoWay}" />
+        </Grid>
+
         <Panel IsVisible="{Binding ShowInputField}">
             <DockPanel
                 LastChildFill="True"
@@ -39,7 +50,7 @@
                             <Setter Property="Background" Value="{Binding SliderSettings.BackgroundBrush}" />
                             <Setter Property="BorderThickness" Value="0" />
                             <Setter Property="Height" Value="8" />
-                            <Setter Property="Margin" Value="0"/>
+                            <Setter Property="Margin" Value="0" />
                         </Style>
                         <Style Selector="Slider.colorSlider Thumb">
                             <Setter Property="Width" Value="10" />
@@ -64,15 +75,7 @@
                         </Style>
                     </Slider.Styles>
                 </Slider>
-
-
             </DockPanel>
-            <input:NumberInput EnableScrollChange="False" Name="input"
-                               MinWidth="100" Decimals="6"
-                               IsVisible="{Binding NumberPickerMode,
-                                            Converter={converters:EnumBooleanConverter}, ConverterParameter=NumberInput}"
-                               Min="{Binding Min}" Max="{Binding Max}"
-                               Value="{Binding DoubleValue, Mode=TwoWay}" />
         </Panel>
     </StackPanel>
 </properties:NodePropertyView>