Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
766a20a
Fixed the help overlay which was too big to be able to resize the rig…
Kersoph Aug 12, 2021
db62cf2
Added block text and visual highlights to the descriptions
Kersoph Aug 12, 2021
e1e0b43
Increased the contrast of the scroll bar
Kersoph Aug 12, 2021
8935412
Improved selection color
Kersoph Aug 12, 2021
e04e26a
The help is now filling the view
Kersoph Aug 12, 2021
1a26f2d
Added hint and removed focus marker for breakpoints
Kersoph Aug 12, 2021
331b2ed
Pressed right mouse button can scroll as well even if it was consumed
Kersoph Aug 12, 2021
d9f0c03
Added possibility to move the diagram with arrow keys and the mouse w…
Kersoph Aug 12, 2021
d397b73
It should be possible to build in all directions in the sfc diagram. …
Kersoph Aug 16, 2021
d203b75
Improved caret color to make it more visible
Kersoph Aug 16, 2021
da60f00
Improved the transition appearance
Kersoph Aug 16, 2021
1e8a18b
Steps and jumps will now grab the focus on change and mark the comman…
Kersoph Aug 16, 2021
eadda03
Replacing spaces with underlines for step names. Directly preventing …
Kersoph Aug 16, 2021
c2f92eb
Steps can now be deleted at dropdown
Kersoph Aug 16, 2021
803714e
The focus change needs to be called deferred. If another text exit ha…
Kersoph Aug 16, 2021
3fc9aa3
Only allow breakpoints at steps
Kersoph Aug 16, 2021
63ccf73
Added the possibility to directly reset the whole simulation page
Kersoph Aug 16, 2021
86f6dcc
Colored the run/pause button to underline its state.
Kersoph Aug 16, 2021
5e70d44
Added possibility to directly assign boolean targets without the need…
Kersoph Aug 16, 2021
14eea1b
Increased star visibility
Kersoph Aug 17, 2021
a267b38
Updated keys
Kersoph Aug 17, 2021
5357dd0
Overhauled Lesson 4 to be an introduction to parallel processes.
Kersoph Aug 17, 2021
b01420b
Improved the descriptions
Kersoph Aug 17, 2021
6590414
Spelling
Kersoph Aug 23, 2021
ceaa924
The offset and scale is now restored, when the user changes the conta…
Kersoph Aug 23, 2021
13d1ccf
Added better simulation support for slow devices.
Kersoph Aug 23, 2021
e63d7f5
Removed print
Kersoph Aug 23, 2021
a1fccc0
Using the same result text and addressing annoyed drivers.
Kersoph Aug 23, 2021
78b18df
Changed simulation symbol to be better understandable
Kersoph Aug 23, 2021
f620dc5
Improved lesson 2 title
Kersoph Aug 23, 2021
5486365
Added version
Kersoph Aug 23, 2021
bfa455c
Directly show a lesson at startup
Kersoph Aug 23, 2021
d178a47
Updated export configuration
Kersoph Aug 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions data/core/landing_page/LandingPageNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using Godot;


namespace Osls.LandingPage
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions data/core/landing_page/LessonSelectionGridNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public override void _Ready()
GD.PrintErr(e);
GD.PushError(e.Message);
}
if (_lessonNodes != null && _lessonNodes.Length > 0) CallDeferred(nameof(SelectionChangedTo), _lessonNodes[0]);
}
#endregion

Expand Down
6 changes: 5 additions & 1 deletion data/core/lesson/viewer/LessonView.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]

[ext_resource path="res://data/core/lesson/viewer/LessonInfo.cs" type="Script" id=1]
[ext_resource path="res://data/core/lesson/viewer/PlantView.cs" type="Script" id=2]
Expand All @@ -9,6 +9,8 @@
[ext_resource path="res://data/core/landing_page/RichTextLabel.tscn" type="PackedScene" id=7]
[ext_resource path="res://data/core/theme/font/RobotoBoldFont.tres" type="DynamicFont" id=8]

[sub_resource type="StyleBoxEmpty" id=1]

[node name="LessonView" type="Control"]
anchor_left = 1.0
anchor_right = 1.0
Expand Down Expand Up @@ -57,6 +59,8 @@ margin_top = 2.0
margin_right = -2.0
margin_bottom = -2.0
focus_mode = 2
custom_styles/focus = SubResource( 1 )
custom_colors/selection_color = Color( 0, 0, 0, 0.196078 )
selection_enabled = true

[node name="ColorRect" type="ColorRect" parent="LessonInfo"]
Expand Down
16 changes: 15 additions & 1 deletion data/core/scene_manager/navigation_steps/NavigationSteps.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://data/core/scene_manager/navigation_steps/NavigationSteps.cs" type="Script" id=1]
[ext_resource path="res://data/core/scene_manager/navigation_steps/NavigationButton.tscn" type="PackedScene" id=2]
Expand All @@ -7,6 +7,7 @@
[ext_resource path="res://data/core/scene_manager/navigation_steps/symbols/EditorStep.png" type="Texture" id=5]
[ext_resource path="res://data/core/scene_manager/navigation_steps/symbols/MenuStep.png" type="Texture" id=6]
[ext_resource path="res://data/core/theme/LightTheme.tres" type="Theme" id=7]
[ext_resource path="res://data/core/theme/font/RobotoRegularFont.tres" type="DynamicFont" id=8]

[node name="NavigationSteps" type="ReferenceRect"]
anchor_bottom = 1.0
Expand All @@ -27,6 +28,19 @@ margin_bottom = -80.0
disabled = true
icon = null

[node name="Version" type="Label" parent="FillerButton"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -24.0
custom_fonts/font = ExtResource( 8 )
custom_colors/font_color = Color( 0.470588, 0.470588, 0.470588, 1 )
text = "v0.9.0"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ExaminationStepButton" parent="." instance=ExtResource( 2 )]
anchor_top = 0.0
anchor_bottom = 0.0
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions data/core/theme/LightTheme.tres
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[ext_resource path="res://data/core/theme/rect/LightHoverStyle.tres" type="StyleBox" id=5]

[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.470588, 0.470588, 0.470588, 0.588235 )
bg_color = Color( 0.627451, 0.627451, 0.627451, 1 )
corner_detail = 5

[sub_resource type="StyleBoxFlat" id=2]
Expand All @@ -18,7 +18,7 @@ bg_color = Color( 1, 1, 0.705882, 1 )

[sub_resource type="StyleBoxFlat" id=4]
content_margin_bottom = 5.0
bg_color = Color( 0.313726, 0.313726, 0.313726, 1 )
bg_color = Color( 0.235294, 0.235294, 0.235294, 1 )
anti_aliasing = false

[sub_resource type="StyleBoxEmpty" id=5]
Expand Down Expand Up @@ -56,7 +56,7 @@ border_width_bottom = 1
border_color = Color( 0.470588, 0.470588, 0.470588, 1 )

[sub_resource type="StyleBoxFlat" id=9]
bg_color = Color( 0.470588, 0.470588, 0.470588, 0.588235 )
bg_color = Color( 0.627451, 0.627451, 0.627451, 1 )

[sub_resource type="StyleBoxFlat" id=10]
bg_color = Color( 1, 1, 0.705882, 1 )
Expand All @@ -66,7 +66,7 @@ bg_color = Color( 1, 1, 0.705882, 1 )

[sub_resource type="StyleBoxFlat" id=12]
content_margin_left = 5.0
bg_color = Color( 0.313726, 0.313726, 0.313726, 1 )
bg_color = Color( 0.235294, 0.235294, 0.235294, 1 )

[sub_resource type="StyleBoxEmpty" id=13]

Expand Down
13 changes: 13 additions & 0 deletions data/core/theme/font/RobotoT0FontShaded.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]

[ext_resource path="res://data/core/theme/font/RobotoRegularData.tres" type="DynamicFontData" id=1]

[resource]
size = 32
outline_size = 3
outline_color = Color( 0, 0, 0, 0.588235 )
use_filter = true
extra_spacing_top = -4
extra_spacing_bottom = -4
extra_spacing_char = -1
font_data = ExtResource( 1 )
4 changes: 2 additions & 2 deletions data/core/theme/nodes/HscRelative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Osls
public class HscRelative : HSplitContainer
{
#region ==================== Fields / Properties ====================
[Export] public float RelativeOffst = 1320f/1840f;
[Export] public float RelativeOffset = 1320f/1840f;
#endregion


Expand All @@ -22,7 +22,7 @@ public override void _Ready()
{
minSizeOffset = control.RectMinSize.x;
}
SplitOffset = Mathf.RoundToInt(RectSize.x * RelativeOffst - minSizeOffset);
SplitOffset = Mathf.RoundToInt(RectSize.x * RelativeOffset - minSizeOffset);
}
#endregion
}
Expand Down
6 changes: 5 additions & 1 deletion data/diagram_models/sfc/data/SfcEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class SfcEntity
{
#region ==================== Fields / Properties ====================
public const int XKeyShift = 16;
public const int YKeyMask = 0b1111111111111111;
public const int KeyOffset = 1 << 15;
private readonly Dictionary<int, PatchEntity> _patchMap = new Dictionary<int, PatchEntity>();

/// <summary>
Expand Down Expand Up @@ -45,7 +47,9 @@ public void AddPatch(PatchEntity patch)
/// </summary>
public static int CalculateMapKey(int x, int y)
{
return checked((x << XKeyShift) | y);
int xKey = (KeyOffset + x) << XKeyShift;
int yKey = (KeyOffset + y) & YKeyMask;
return checked(xKey | yKey);
}

/// <summary>
Expand Down
87 changes: 83 additions & 4 deletions data/diagram_models/sfc/editor/2d_editor/Sfc2dEditorNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class Sfc2dEditorNode : Control
private static readonly float[] zoomLevels = new float[] { 0.5f, 1f, 1.5f, 2f, 3f };
private bool _isDragging;
private Vector2 _lastDragPosition;
private bool _markedToRestore;
private Vector2 _currentScale;
private Vector2 _currentPosition;

public Sfc2dEditorControl Sfc2dEditorControl { get; private set; }
#endregion
Expand All @@ -27,6 +30,8 @@ public void InitializeEditor(ProcessingData data, bool isEditable)
{
_renderViewportReferenceRect = GetNode<ReferenceRect>("RenderViewportReferenceRect");
Sfc2dEditorControl = new Sfc2dEditorControl(_renderViewportReferenceRect, data, isEditable);
Connect("resized", this, nameof(MarkForResizeOffsetRestore));
_currentScale = new Vector2(1f, 1f);
}

public override void _Process(float delta)
Expand All @@ -38,6 +43,7 @@ public override void _Process(float delta)
ApplyDiagramOffset(deltaPosition + _renderViewportReferenceRect.RectPosition);
_lastDragPosition = currentMousePosition;
}
if (_markedToRestore) OnResizeOffsetRestore();
}

/// <summary>
Expand Down Expand Up @@ -90,17 +96,17 @@ public override void _Input(InputEvent @event)
{
if (@event.IsActionPressed("ui_translate"))
{
_lastDragPosition = GetViewport().GetMousePosition();
_isDragging = true;
StartDrag();
}
else if (@event.IsActionReleased("ui_translate"))
{
_isDragging = false;
StopDrag();
}
}

/// <summary>
/// Using secondary move buttons only when they are not used for another control
/// Generally used here for mouse interactions.
/// </summary>
public override void _GuiInput(InputEvent @event)
{
Expand All @@ -112,6 +118,56 @@ public override void _GuiInput(InputEvent @event)
{
StopDrag();
}
else if (@event.IsActionPressed("ui_left", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(50f, 0f);
}
else if (@event.IsActionPressed("ui_right", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(-50f, 0f);
}
else if (@event.IsActionPressed("ui_up", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(0f, 50f);
}
else if (@event.IsActionPressed("ui_down", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(0f, -50f);
}
}

/// <summary>
/// Called when an Godot.InputEvent hasn't been consumed by Godot.Node._Input(Godot.InputEvent)
/// or any GUI. The input event propagates up through the node tree until a node consumes it.
/// Generally used here for key interactions.
/// </summary>
public override void _UnhandledInput(InputEvent @event)
{
if (@event.IsActionPressed("ui_left", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(50f, 0f);
GetTree().SetInputAsHandled();
}
else if (@event.IsActionPressed("ui_right", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(-50f, 0f);
GetTree().SetInputAsHandled();
}
else if (@event.IsActionPressed("ui_up", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(0f, 50f);
GetTree().SetInputAsHandled();
}
else if (@event.IsActionPressed("ui_down", true))
{
_renderViewportReferenceRect.RectPosition += new Vector2(0f, -50f);
GetTree().SetInputAsHandled();
}
else if (@event.IsActionPressed("ui_home"))
{
_renderViewportReferenceRect.RectPosition = new Vector2(0f, 0f);
GetTree().SetInputAsHandled();
}
}

/// <summary>
Expand All @@ -130,6 +186,27 @@ public void StopDrag()
{
_isDragging = false;
}

/// <summary>
/// Called when the RECT size changed and we have to restore the position and scale in the next process update.
/// This is a workaround for this issue where pos/scale gets reset if the scroll container changes.
/// </summary>
public void MarkForResizeOffsetRestore()
{
_markedToRestore = true;
}

/// <summary>
/// Called when the RECT size changed and we have to restore the position and scale.
/// </summary>
public void OnResizeOffsetRestore()
{
_markedToRestore = false;
Vector2 currentScale = _currentScale;
Vector2 currentPosition = _currentPosition;
CallDeferred(nameof(ApplyDiagramScale), currentScale);
CallDeferred(nameof(ApplyDiagramOffset), currentPosition);
}
#endregion


Expand All @@ -139,13 +216,15 @@ private void ApplyDiagramScale(Vector2 scale)
Vector2 oldPosition = _renderViewportReferenceRect.RectPosition;
Vector2 oldScale = _renderViewportReferenceRect.RectScale;
_renderViewportReferenceRect.RectScale = scale;
_currentScale = scale;
ApplyDiagramOffset(new Vector2((oldPosition.x * scale.x) / oldScale.x, (oldPosition.y * scale.y) / oldScale.y));
}

private void ApplyDiagramOffset(Vector2 position)
{
_renderViewportReferenceRect.RectPosition = position;
_currentPosition = position;
}
#endregion
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ custom_styles/normal = SubResource( 3 )
custom_fonts/font = ExtResource( 2 )
custom_colors/symbol_color = Color( 0, 0, 0, 1 )
custom_colors/selection_color = Color( 1, 1, 0.705882, 1 )
custom_colors/caret_color = Color( 0, 0, 0, 1 )
custom_colors/font_color_selected = Color( 0, 0, 0, 1 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_colors/mark_color = Color( 0, 0, 0, 1 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ custom_constants/line_spacing = -2
text = "StepName"
wrap_enabled = true
caret_blink = true
caret_blink_speed = 0.5
__meta__ = {
"_edit_use_anchors_": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void NotifyStepSelected(StepType selectedType)
{
SfcPatchControl controller = GetNode<SfcPatchNode>("..").SfcPatchControl;
controller.UpdateSfcStepTo(selectedType);
_stepNode.OnCreationFocus();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,18 @@ public override void MarkStep(bool setMark)
public override void ApplyEdits()
{
string stepName = GetNode<TextEdit>("StepNameEditor").Text;
if (!string.IsNullOrEmpty(stepName)) stepName = stepName.Replace(' ', '_');
GetNode<SfcStepNode>("..").NotifyUserUpdatedName(stepName);
}

/// <summary>
/// Called when this step was changed to directly delegate the focus to the control if needed.
/// </summary>
public override void OnCreationFocus()
{
GetNode<TextEdit>("StepNameEditor").CallDeferred("grab_focus");
GetNode<TextEdit>("StepNameEditor").CallDeferred("select_all");
}
#endregion


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="StepMark" parent="." instance=ExtResource( 4 )]
visible = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,12 @@ public virtual void MarkStep(bool setMark)
public virtual void ApplyEdits()
{
}

/// <summary>
/// Called when this step was changed to directly delegate the focus to the control if needed.
/// </summary>
public virtual void OnCreationFocus()
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ public override void ApplyEdits()
string stepName = GetNode<TextEdit>("StepNameEditor").Text;
GetNode<SfcStepNode>("..").NotifyUserUpdatedName(stepName);
}

/// <summary>
/// Called when this step was changed to directly delegate the focus to the control if needed.
/// </summary>
public override void OnCreationFocus()
{
GetNode<TextEdit>("StepNameEditor").CallDeferred("grab_focus");
GetNode<TextEdit>("StepNameEditor").CallDeferred("select_all");
}
#endregion


Expand Down
Loading