Skip to content

Commit

Permalink
gh-2-SubGraphParts fixing a bunch of node maps and a scrolling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNCatz committed Jan 1, 2022
1 parent 85d3fe7 commit 1e79185
Show file tree
Hide file tree
Showing 11 changed files with 1,196 additions and 2,633 deletions.
1 change: 1 addition & 0 deletions Code/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public bool HasUnsavedChanges
if(!_hasUnsavedChanges)
{
_mainView.SetNodesClean();
_mainView.ClearScrollLock();
}
}
get => _hasUnsavedChanges;
Expand Down
40 changes: 38 additions & 2 deletions Code/NodeCode/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ public class MainView : ColorRect
private App _app;

public int CurrentParentIndex {set; get;}


public static bool ScrollLock
{
set
{
if(value)
{
_scrollLock++;
}
else
{
_scrollLock--;
}
}
get => _scrollLock != 0;
}
private static int _scrollLock = 0;
private Vector2 _scrollCurrent;

public Color GridMajorColor
{
Expand Down Expand Up @@ -233,6 +252,7 @@ public override void _Ready()
_graph.Connect( "paste_nodes_request", this, nameof(RequestPasteNode) );
_graph.Connect( "delete_nodes_request", this, nameof(RequestDeleteNode) );
_graph.Connect( "gui_input", this, nameof(GraphClick) );
_graph.Connect( "scroll_offset_changed", this, nameof(GraphOnScroll) );

_tween = new Tween();
AddChild( _tween );
Expand All @@ -253,7 +273,6 @@ public override void _Ready()
}
catch( Exception e )
{
throw e;
_app.CatchException( e );
}
}
Expand Down Expand Up @@ -421,7 +440,19 @@ private void OnSearch( string text )

CenterViewOnKeyedNode( text );
}


private void GraphOnScroll(Vector2 offset)
{
if(ScrollLock)
{
_graph.ScrollOffset = _scrollCurrent;
}
else
{
_scrollCurrent = offset;
}
}

private void GraphClick( InputEvent @event )
{
if( @event is InputEventMouseButton eventMouse )
Expand Down Expand Up @@ -895,6 +926,11 @@ public void SetNodesClean()
node.Dirty = false;
}
}

public void ClearScrollLock()
{
_scrollLock = 0;
}
#endregion

#region Connections
Expand Down
12 changes: 12 additions & 0 deletions Code/NodeCode/NodeSlots/TextAreaRichSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public override void _Ready()
_display = this.GetNodeFromPath<RichTextLabel>( _displayPath );

_field.Connect( "text_changed", this, nameof(OnTextChanged) );
_field.Connect("mouse_entered",this,nameof(OnEnter));
_field.Connect("mouse_exited",this,nameof(OnExit));
}

public void Init(GenericDataDictionary template, GenericDataObject parentModel)
Expand Down Expand Up @@ -63,5 +65,15 @@ private void OnTextChanged()
_model.value = _field.Text;
OnValueUpdated?.Invoke();
}

private void OnEnter()
{
MainView.ScrollLock = true;
}

private void OnExit()
{
MainView.ScrollLock = false;
}
}
}
17 changes: 15 additions & 2 deletions Code/NodeCode/NodeSlots/TextAreaSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ public override void _Ready()
{
_label = this.GetNodeFromPath<Label>( _labelPath );
_field = this.GetNodeFromPath<TextEdit>( _fieldPath );
_field.Connect("text_changed",this,nameof(OnChanged));
_field.Connect("text_changed",this,nameof(OnTextChanged));
_field.Connect("mouse_entered",this,nameof(OnEnter));
_field.Connect("mouse_exited",this,nameof(OnExit));
}

public void Init(GenericDataDictionary template, GenericDataObject parentModel)
{
template.GetValue( "label", out string label );
Expand Down Expand Up @@ -50,10 +53,20 @@ public void Init(GenericDataDictionary template, GenericDataObject parentModel)
_field.RectMinSize = new Vector2(0,height);
}

private void OnChanged()
private void OnTextChanged()
{
_model.value = _field.Text;
OnValueUpdated?.Invoke();
}

private void OnEnter()
{
MainView.ScrollLock = true;
}

private void OnExit()
{
MainView.ScrollLock = false;
}
}
}
2 changes: 1 addition & 1 deletion Nodes/Scenes/MainView.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ _fileMenuButtonPath = NodePath("HBoxContainer/FileMenu")
_editMenuButtonPath = NodePath("HBoxContainer/EditMenu")
_settingsMenuButtonPath = NodePath("HBoxContainer/Settings")
_navUpButtonPath = NodePath("HBoxContainer/NavUpButton")
_addressBarPath = NodePath("HBoxContainer/AddressBar/Label")
_addressBarLabelPath = NodePath("HBoxContainer/AddressBar/Label")
_searchBarPath = NodePath("HBoxContainer/SearchBar")
_searchButtonPath = NodePath("HBoxContainer/SearchButton")
_backupTimerPath = NodePath("BackupTimer")
Expand Down
81 changes: 25 additions & 56 deletions Templates-and-Graphs/DebugCommand.ngmap
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"metaMakerVersion": "0.6.0",
"metaMakerVersion": "0.7.0",
"defaultListing": "_commandHub",
"explicitNode": "Commands",
"reuseDll": false,
"exportScript": {},
"reuseDll": true,
"exportScript": "",
"nestingColors": [
{
"r": 0.21875,
Expand All @@ -18,38 +18,7 @@
"a": 1.0
}
],
"keyColors": [
{
"r": 0.5,
"g": 1.0,
"b": 0.0,
"a": 1.0
},
{
"r": 0.39,
"g": 0.58,
"b": 0.93,
"a": 1.0
},
{
"r": 1.0,
"g": 0.97,
"b": 0.86,
"a": 1.0
},
{
"r": 0.29,
"g": 0.0,
"b": 0.51,
"a": 1.0
},
{
"r": 1.0,
"g": 0.41,
"b": 0.71,
"a": 1.0
}
],
"keyColors": [],
"nodeList": [
{
"title": "Commands",
Expand All @@ -60,19 +29,19 @@
"a": 1.0
},
"parentType": -1,
"fields": {
"0": {
"fields": [
{
"fieldType": "FIELD_LIST",
"label": "_commandHub",
"field": {
"fieldType": "LINK_TO_CHILD",
"label": "CMD",
"label": "2",
"slotType": 0,
"explicitNode": "",
"emptyHandling": "SKIP"
}
}
}
]
},
{
"title": "Command Set",
Expand All @@ -83,40 +52,40 @@
"a": 1.0
},
"parentType": 0,
"fields": {
"0": {
"fields": [
{
"fieldType": "TYPE",
"Class Assembly": "Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Class Type": "CommandSet"
},
"1": {
{
"fieldType": "TEXT_LINE",
"label": "Id",
"defaultValue": "String"
},
"2": {
{
"fieldType": "TEXT_AREA",
"label": "Description",
"minHeight": 40.0,
"defaultValue": "Some text"
},
"3": {
{
"fieldType": "TEXT_LINE",
"label": "Format",
"defaultValue": "String"
},
"4": {
{
"fieldType": "FIELD_LIST",
"label": "SubCommands",
"field": {
"fieldType": "LINK_TO_CHILD",
"label": "children",
"label": "3",
"slotType": 0,
"explicitNode": "",
"emptyHandling": "EMPTY_OBJECT"
}
}
}
]
},
{
"title": "Command",
Expand All @@ -127,44 +96,44 @@
"a": 1.0
},
"parentType": 0,
"fields": {
"0": {
"fields": [
{
"fieldType": "TYPE",
"Class Assembly": "Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Class Type": "CommandTerminal"
},
"1": {
{
"fieldType": "TEXT_LINE",
"label": "Id",
"defaultValue": "String"
},
"2": {
{
"fieldType": "TEXT_AREA",
"label": "Description",
"minHeight": 40.0,
"defaultValue": "Some text"
},
"3": {
{
"fieldType": "TEXT_LINE",
"label": "Format",
"defaultValue": "String"
},
"4": {
{
"fieldType": "TEXT_LINE",
"label": "EventId",
"defaultValue": "String"
},
"5": {
{
"fieldType": "INT",
"label": "ParameterCount",
"MinStepSize": 0.0,
"MinStepSize": "0",
"hasMax": false,
"max": 0,
"hasMin": true,
"min": 0,
"defaultValue": 0
}
}
]
}
],
"data": {
Expand Down
Loading

0 comments on commit 1e79185

Please sign in to comment.