New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add property viewer to DrawVisualiser #780
Conversation
Also fixes #291
For better reading in PropertyDisplay
osu.Framework/Audio/AudioManager.cs
Outdated
@@ -371,5 +371,7 @@ private void checkAudioDeviceChanged() | |||
{ | |||
} | |||
} | |||
|
|||
public override string ToString() => $@"AudioManager ({currentAudioDevice})"; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
osu.Framework/Lists/SortedList.cs
Outdated
@@ -63,6 +63,8 @@ private int getAdditionIndex(T value) | |||
return index; | |||
} | |||
|
|||
public override string ToString() => $@"{GetType().Name} ({Count} items)"; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Looks very nice now! I have only a few more requests before I think this is ready for merging:
|
|
if (viz.highlighted == this) | ||
HighlightTarget?.Invoke(null); | ||
|
||
else HighlightTarget?.Invoke(this); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
The property window gets enabled when re-targeting other drawables. That shouldn't happen. The properties window state should be totally independent from drawable selection. Only highlighting via right-click or toggling via the "Properties" button should change its state. |
osu.Framework/MathUtils/Precision.cs
Outdated
|
||
return AlmostEquals(value, rounded, acceptableDifference) ? rounded : value; | ||
return rounded == value ? rounded : value; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
osu.Framework/MathUtils/Precision.cs
Outdated
@@ -53,7 +53,7 @@ public static double Round(double value, int numOfDigits = 7) | |||
|
|||
public static float Round(float value, int numOfDigits = 3) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more improvements I'd like to see to the draw visualiser but this is a good start 👍
{ | ||
if (args.Button == MouseButton.Right) | ||
{ | ||
HighlightTarget?.Invoke(viz.Highlighted == this ? null : this); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
public void Collapse() | ||
{ | ||
if (viz.Highlighted == this) | ||
return; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
updateSpecifics(); | ||
if (Flow.IsPresent) | ||
Collapse(); | ||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -30,7 +31,8 @@ public int Compare(VisualisedDrawable x, VisualisedDrawable y) | |||
|
|||
public Drawable Target { get; } | |||
|
|||
private readonly Box textBg; | |||
private readonly Box background; | |||
internal readonly Box highlightBackground; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -186,6 +269,26 @@ private VisualisedDrawable createVisualisedDrawable(VisualisedDrawable parent, D | |||
|
|||
return vis; | |||
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -159,6 +226,21 @@ private void runUpdate() | |||
|
|||
visualise(Target, targetDrawable); | |||
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
propertyDisplay.Add( | ||
((IEnumerable<MemberInfo>)type.GetProperties(BindingFlags.Instance | BindingFlags.Public)) // Get all properties | ||
.Concat(type.GetFields(BindingFlags.Instance | BindingFlags.Public)) // And all fields |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
{ | ||
Depth = float.MinValue, | ||
Depth = float.MinValue |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@paparony03 you still alive? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are more code styling improvements that can be made, but I will do so a bit later.
@@ -1,391 +1,392 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
protected override bool OnClick(InputState state) | ||
{ | ||
Flow.Alpha = Flow.Alpha > 0 ? 0 : 1; | ||
updateSpecifics(); | ||
if (Flow.IsPresent) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
{ | ||
get | ||
{ | ||
return highlightBackground.Alpha > 0; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
} | ||
} | ||
|
||
internal class PropertyItem : Container |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
namespace osu.Framework.Graphics.Visualisation | ||
{ | ||
public class DrawVisualiser : OverlayContainer | ||
{ | ||
private readonly TreeContainer treeContainer; | ||
internal readonly TreeContainer TreeContainer; | ||
internal VisualisedDrawable HighlightedTarget; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Properties panel looks bad hiding when selecting a new drawable. |
Added PropertyDisplay which lists all public property values and some graphical changes like highlighting.
Also a commit which simply overrides some ToString()s for better property viewing.