Re: Noob questions about wether some things are possible or
Posted: 27 Aug 2013, 13:08
Yes, please, keep up informed with that problem. We are unable to reproduce it here.
And thanks for buying!
And thanks for buying!
Welcome to our official discussion site. You’ll find topics on features, bugs, development, and general support here
https://www.noesisengine.com/forums/
Our plugin doesn't support the modification of scripts during play, but a warning Dialog should appear explaining this situation. If this is not your case, please register at bugs.noesisengine.com and create a ticket attaching the minidump you can generate within our error dialog.Hi,
I have other remarks, i will continue putting them in this thread in order not to flood the forum.
Stability :
Unity crashes when i modify a script while in play mode.
This all depends on how the Label template is defined. If the template contains an element that binds the templated parent Background property, changes to control Background property will be reflected by the template. Our default Label template is not doing it. But you can create a new template like this:Features :
Label doesn't behave the same in NoesisGUI and VisualStudio. The Background property doesn't seem to work with label.
<ControlTemplate x:Key="LabelTemplate" TargetType="{x:Type Label}">
<Border Background="{TemplateBinding Background}" UseLayoutRounding="True">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
RecognizesAccessKey="True"/>
</Border>
</ControlTemplate>
<Label Template="{StaticResource LabelTemplate}" Content="This is a label" Background="Red"/>
To continue receiving mouse move events when mouse goes beyond control bounds you should capture the mouse.The missing dragndrop is a little bit annoying, i have been able to reproduce the dragndrop behavior by making a target panel follow the cursor based on MouseLeftButtonDown and MouseLeftButtonUp but it doesn't work very well as moving the mouse too fast can cause the cursor to exit the bounds of the target panel, then loosing the event of MouseLeftButtonUp.
// assuming your script attached to these mouse events
private _dragging = false;
void OnMouseDown(BaseComponent sender, MouseButtonEventArgs args)
{
UIElement element = sender.As<UIElement>();
element.CaptureMouse();
this._dragging = true;
}
void OnMouseUp(BaseComponent sender, MouseButtonEventArgs args)
{
UIElement element = sender.As<UIElement>();
element.ReleaseMouseCapture();
this._dragging = false;
}
void OnMouseMove(BaseComponent sender, MouseEventArgs args)
{
if (this._dragging)
{
// dragging code
}
}
GridSplitter class is not implemented. We will add it to our feature request list if you need it, but we are trying to fix critical bugs before implementing new features.When i use GridSplitter, NoesisGUI tells me it will ignore this command, is it not supported or did i miss something? I managed to reproduce the behavior i wanted but i have the same problem than with dragndrop, if i move to fast i loose the MouseLeftButtonUp event.
These classes are not implemented. As said before, if you need them we will add them to the feature request list. Anyway, as you noticed, parser should give ignore warnings instead of errors. We will fix it as soon as possible.There are some other classes that seem to be unsupported :
TextSearch
RenderOptions
TextOptions
Theses give a parsing error instead of an ignore warning.
If I correctly understand your question, you are asking about how NoesisGUI deals with small texts. We implemented Subpixel Rendering and Subpixel Positioning for our text render, obtaining great results even on small font sizes. Take a look at this image:How is handeld the small text displaying in NoesisGUI? If there is nothing special done for it i think it wold be nice to have TextOptions.TextFormattingMode="Display" available.
We missed to expose that API to Unity. We will fix that in a future realease. Sorry for the inconvenienceAlso, i can't find how to set up a binding procedurally, could you please give me some example code?
That is why we advised to use MonoBehavior.Start() to access NoesisGUIPanel data, but maybe this is too restrictive. We will take a look at execution priority as you suggested, thanks for thatAt last, i would suggest that you put the script NoesisGUIPanel at a priority execution order when importing the Unity asset, because when you want to access the Noesis.Kernel class and the static methods of NoesisGUISystem in the Awake of another Monobehaviour, without correct script execution order you cannot guarantee that Noesis.NoesisGUISystem will be created before you access to it.
No, you could add as many NoesisGUI components as you want. Normally you would have one in the Main Camera for the HUD interface, and many others as textures in other game objects.By the way, this makes me think that you cannot have more than one NoesisGUIPanel per scene, is this correct?
Yes, UserControl are supported and in fact are being used by the people a lot. I don't know exactly what could be the problem you are having and sergio will help you later for sure. But I think that the problem is that you are using the keyword UserControl directly in the xaml and the rest of our examples are using a class that inherits from UserControl. This could be a bug, although I am not sure if if got any sense directly using UserControl in the xaml.I have another question. I am trying to create a custom control by following your tutorial, however i have a parsing error in unity when using the keyword "UserControl". Aren't user controls supported in Unity?
Yes. You nailed it! It is a problem relate to precision. We are using float16 (a version of float with less precision) and it seems that above 1024px the precision is not enough to get a perfect text alignment.I did so more test for the maximize/not maximized issue. Actually it's now about maximization, it is about the distance in pixel from the left side of the screen. All the text which is more than 1024px from the left of the screen gets blurred here. I attached an image which shows this issue.
using UnityEngine;
using System;
using System.Runtime.InteropServices;
using Noesis;
namespace CustomControls
{
public class NumericUpDown : UserControl
{
private HandleRef swigCPtr;
public static DependencyProperty ValueProperty;
// This function is required (even if empty) to register the class in NoesisGUI
// automatically, so objects of this type can be created when XAML is parsed
public static void Register()
{
// Register the dependency properties
ValueProperty = DependencyProperty.Register("Value", typeof(int),
typeof(NumericUpDown), new PropertyMetadata((int)0));
// Here you indicate the xaml file where this UserControl defines its
// contents
UserControl.SourceProperty.OverrideMetadata(typeof(NumericUpDown),
new PropertyMetadata("Assets/CustomControls/NumericUpDown.xaml"));
}
public int Value
{
get { return GetValue<int>(ValueProperty); }
set { SetValue<int>(ValueProperty, value); }
}
public NumericUpDown(IntPtr cPtr, bool cMemoryOwn)
: base(cPtr, cMemoryOwn)
{
swigCPtr = new HandleRef(this, cPtr);
}
public NumericUpDown()
: this(Noesis.Extend.New(typeof(NumericUpDown)), true)
{
Noesis.Extend.Register(typeof(NumericUpDown), swigCPtr.Handle, this);
}
public override void Dispose()
{
lock (this)
{
if (swigCPtr.Handle != IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
if (Noesis.Kernel.IsInitialized())
{
Noesis.Extend.Delete(typeof(NumericUpDown), swigCPtr.Handle);
}
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
// Initialize the user control here
public void OnPostInit()
{
RepeatButton upButton = FindName<RepeatButton>("UpButton");
upButton.Click += OnUpButtonClick;
RepeatButton downButton = FindName<RepeatButton>("DownButton");
downButton.Click += OnDownButtonClick;
}
void OnUpButtonClick(BaseComponent sender, RoutedEventArgs e)
{
Value = Value + 1;
}
void OnDownButtonClick(BaseComponent sender, RoutedEventArgs e)
{
Value = Value - 1;
}
}
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="CustomControls.NumericUpDown"
x:Name="NumericUpDownControl"
UseLayoutRounding="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.RowSpan="2" Grid.ColumnSpan="2" BorderThickness="1"
BorderBrush="Gray"/>
<TextBlock Grid.RowSpan="2" VerticalAlignment="Center" Margin="5,3,4,3"
Text="{Binding Value, ElementName=NumericUpDownControl}"/>
<RepeatButton Name="UpButton" Grid.Column="1" Grid.Row="0" Padding="4,1"
Margin="0,2,2,0">
<Path Data="M1,1L4,4 7,1" Stroke="Black" StrokeThickness="2"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"
RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
</Path.RenderTransform>
</Path>
</RepeatButton>
<RepeatButton Name="DownButton" Grid.Column="1" Grid.Row="1" Padding="4,1"
Margin="0,0,2,2">
<Path Data="M1,1L4,4 7,1" Stroke="Black" StrokeThickness="2"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</RepeatButton>
</Grid>
</UserControl>
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CustomControls">
<StackPanel Width="100" VerticalAlignment="Center">
<local:NumericUpDown Margin="5"/>
<local:NumericUpDown Margin="5"/>
<local:NumericUpDown Margin="5"/>
</StackPanel>
</Grid>
I am a little bit lost on what i am doing wrong here. Do you have any suggestion for helping me to debug that?[DX9] Assets/GUI/CustomControls/NumericUpDown.xaml
Parsing UserControl (@1,0)
Unknown type 'CustomControls.NumericUpDown'
UnityEngine.Debug:LogError(Object)
Noesis.BuildToolKernel:OnLog(Int32, String) (at Assets/Editor/NoesisGUI/NoesisBuildToolKernel.cs:163)
System.Object:wrapper_native_26730780()
Noesis.BuildToolKernel:Build() (at Assets/Editor/NoesisGUI/NoesisBuildToolKernel.cs:114)
NoesisPostProcessor:Build(String, Boolean, Boolean) (at Assets/Editor/NoesisGUI/NoesisPostProcessor.cs:207)
NoesisPostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/Editor/NoesisGUI/NoesisPostProcessor.cs:170)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])
// ...
public static void Register()
{
// Register the dependency properties
ValueProperty = DependencyProperty.Register("Value", typeof(int),
typeof(NumericUpDown), new PropertyMetadata((int)0));
// Here you indicate the xaml file where this UserControl defines its
// contents
UserControl.SourceProperty.OverrideMetadata(typeof(NumericUpDown),
new PropertyMetadata("Assets/GUI/CustomControls/NumericUpDown.xaml"));
}
// ...