Skip to content

Commit

Permalink
gh-2-SubGraphParts fixing merge issues and getting it semistable
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNCatz committed Jan 1, 2022
1 parent 2643cf1 commit 821cb1e
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Code/NodeCode/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ private void OnDisconnectionRequest( string from, int fromSlot, string to, int t
if( !( rightSlot is LinkToParentSlot rightLink) || !rightLink.IsLinked ) return;
if( !leftLink.UnLinkChild( rightGraph ) ) return;

rightLink.Unlink();
rightLink.Unlink(leftLink);
_graph.DisconnectNode( @from, fromSlot, to, toSlot );
}
}
Expand Down
3 changes: 1 addition & 2 deletions Code/NodeCode/NodeSlots/KeySlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public override void _Ready()
_field = this.GetNodeFromPath<Label>( _fieldPath );
}

public void Init(GenericDataDictionary template, GenericDataObject parentModel)
public override void _GuiInput( InputEvent @event )
{
if (@event is InputEventMouseButton mouseButton && mouseButton.Doubleclick)
Expand All @@ -38,7 +37,7 @@ public override void _GuiInput( InputEvent @event )
}
}

public void Init(GenericDataArray template, GenericDataArray parentModel)
public void Init(GenericDataDictionary template, GenericDataObject parentModel)
{
template.GetValue( "label", out string label );
_label.Text = label;
Expand Down
50 changes: 23 additions & 27 deletions Code/NodeCode/NodeSlots/LinkToParentSlot.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using Godot;
using LibT;

Expand All @@ -12,11 +13,10 @@ public class LinkToParentSlot : Control
[Export] public NodePath _downButtonPath;
private Button _downButton;

private LinkToChildSlot _link;
private List<LinkToChildSlot> _links = new List<LinkToChildSlot>();

public bool IsLinked => _links.Count > 0;

public bool IsLinked { get; private set; }
public bool IsLinked => _links >0;
private int _links = 0;
public int Index
{
get => _index;
Expand All @@ -31,7 +31,6 @@ public int Index

public override void _Ready()
{
_links++;
_indexLabel = this.GetNodeFromPath<Label>( _indexPath );
_upButton = this.GetNodeFromPath<Button>( _upButtonPath );
_downButton = this.GetNodeFromPath<Button>( _downButtonPath );
Expand All @@ -42,51 +41,48 @@ public override void _Ready()

public void Link(LinkToChildSlot link)
{
IsLinked = true;

_link = link;
if(_link.parentListing != null)
_links.Add(link);
if(link.parentListing != null)
{
_link.parentListing.OnValueUpdated += ListingChange;
link.parentListing.OnValueUpdated += UpdateDisplay;
}
UpdateDisplay(_link.Label);
UpdateDisplay();
}

public void Unlink()
public void Unlink(LinkToChildSlot link)
{
_links--;

if(_link != null)
if(_links.Contains(link))
{
if(_link.parentListing != null)
if(link.parentListing != null)
{
_link.parentListing.OnValueUpdated -= ListingChange;
link.parentListing.OnValueUpdated -= UpdateDisplay;
}
_link = null;
_links.Remove(link);
}

UpdateDisplay();
}

private void ListingChange()
{
UpdateDisplay(_link.Label);
}

private void UpdateDisplay(string link = null)
private void UpdateDisplay()
{
if(string.IsNullOrEmpty(link))
if(_links.Count == 0)
{
_indexLabel.Text = "UNLINKED";
_upButton.Visible = false;
_downButton.Visible = false;
}
else
else if(_links.Count == 1)
{
_indexLabel.Text = link;
_indexLabel.Text = _links[0].Label;
//_upButton.Visible = true;
//_downButton.Visible = true;
}
else
{
_indexLabel.Text = "MULTIPLE";
_upButton.Visible = false;
_downButton.Visible = false;
}
}

private void OnUpPressed()
Expand Down
6 changes: 3 additions & 3 deletions Templates-and-Graphs/SerialSweatHeart.ngmap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"metaMakerVersion": "0.6.0",
"metaMakerVersion": "0.7.0",
"defaultListing": "States",
"explicitNode": "",
"reuseDll": false,
Expand Down Expand Up @@ -374,7 +374,7 @@
"label": "choices",
"field": {
"fieldType": "LINK_TO_CHILD",
"label": "-",
"label": "1",
"slotType": 0,
"explicitNode": "",
"emptyHandling": "SKIP"
Expand Down Expand Up @@ -605,7 +605,7 @@
"label": "scoreEvents",
"field": {
"fieldType": "LINK_TO_CHILD",
"label": "-",
"label": "0",
"slotType": 1,
"explicitNode": "",
"emptyHandling": "SKIP"
Expand Down
133 changes: 130 additions & 3 deletions Templates-and-Graphs/SerialSweatHeartTEMPLATE.ngmap
Original file line number Diff line number Diff line change
Expand Up @@ -1666,11 +1666,10 @@
}
]
},
"metaMakerVersion": "0.6.0",
"defaultListing": "nodeList",
"explicitNode": "Graph",
"reuseDll": false,
"exportScript": "using System.Collections.Generic;\nusing LibT.Serialization;\nusing MetaMakerLib;\n\nnamespace Rules\n{\n\tpublic class ExportRules : ExportRulesAbstract\n\t{\n\t\tpublic ExportRules()\n\t\t{\n\t\t\t_exportTargets[\"Template\"] = new ExportSet(){relativeSavePath = \"$name.tmplt\", gdoExportTarget = \"data\" };\n\t\t}\n\n\t\tpublic override void PreprocessExportGDA(GenericDataArray genericDataArray, List<string> keysToRemove, string exportName, string exportLocation, int exportIndex)\n\t\t{\n\t\t\tgenericDataArray.AddValue( graphVersionKey, metaMakerVersion );\n\t\t}\n\t}\n}",
"exportScript": "using System.Collections.Generic;\nusing LibT.Serialization;\nusing MetaMakerLib;\n\nnamespace Rules\n{\n\tpublic class ExportRules : ExportRulesAbstract\n\t{\n\t\tpublic ExportRules()\n\t\t{\n\t\t\t_exportTargets[\"Template\"] = new ExportSet(){relativeSavePath = \"$name.tmplt\", gdoExportTarget = \"data\" };\n\t\t}\n\n\t\tpublic override void PreprocessExportGdo(GenericDataObject genericDataObject, List<string> keysToRemove, string exportName, string exportLocation, int exportIndex)\n\t\t{\n\t\t\tgenericDataObject.TryAddValue( graphVersionKey, metaMakerVersion );\n\t\t}\n\t}\n}",
"nestingColors": [
{
"r": 0.0,
Expand Down Expand Up @@ -1929,11 +1928,91 @@
"label": "emptyHandling",
"values": [
"EMPTY_STRING",
"NULL_STRING",
"SKIP"
]
}
]
},
{
"title": "Graph List Slot",
"color": {
"r": 0.875,
"g": 0.7667193,
"b": 0.4358614,
"a": 1.0
},
"parentType": -1,
"fields": [
{
"fieldType": "AUTO",
"label": "fieldType",
"defaultValue": "SUB_GRAPH_LIST"
},
{
"fieldType": "TEXT_LINE",
"label": "label",
"defaultValue": "children"
},
{
"fieldType": "INT",
"label": "slotType",
"MinStepSize": "0",
"hasMax": false,
"max": 0,
"hasMin": true,
"min": 0,
"defaultValue": 0
},
{
"fieldType": "TEXT_LINE",
"label": "explicitNode",
"defaultValue": ""
}
]
},
{
"title": "Graph Dictionary Slot",
"color": {
"r": 0.8812586,
"g": 0.890625,
"b": 0.5370435,
"a": 1.0
},
"parentType": -1,
"fields": [
{
"fieldType": "AUTO",
"label": "fieldType",
"defaultValue": "SUB_GRAPH_DICTIONARY"
},
{
"fieldType": "TEXT_LINE",
"label": "label",
"defaultValue": "children"
},
{
"fieldType": "INT",
"label": "slotType",
"MinStepSize": "0",
"hasMax": false,
"max": 0,
"hasMin": true,
"min": 0,
"defaultValue": 0
},
{
"fieldType": "TEXT_LINE",
"label": "explicitNode",
"defaultValue": ""
},
{
"fieldType": "TEXT_LINE",
"label": "keyField",
"defaultValue": "id"
}
]
},
{
"title": "Link To Child Slot",
"color": {
Expand Down Expand Up @@ -1974,6 +2053,7 @@
"label": "emptyHandling",
"values": [
"EMPTY_OBJECT",
"NULL",
"SKIP"
]
}
Expand Down Expand Up @@ -2890,6 +2970,53 @@
"asSeconds": false
}
]
},
{
"title": "Relative Path Slot",
"color": {
"r": 0.3984375,
"g": 0.0,
"b": 0.298418134,
"a": 1.0
},
"parentType": 1,
"fields": [
{
"fieldType": "AUTO",
"label": "fieldType",
"defaultValue": "RELATIVE_PATH"
},
{
"fieldType": "TEXT_LINE",
"label": "label",
"defaultValue": "Path"
},
{
"fieldType": "INT",
"label": "startOffset",
"MinStepSize": "0",
"hasMax": false,
"max": 0,
"hasMin": true,
"min": 0,
"defaultValue": 0
},
{
"fieldType": "TEXT_LINE",
"label": "prefix",
"defaultValue": ""
},
{
"fieldType": "FIELD_LIST",
"label": "extensions",
"field": {
"fieldType": "TEXT_LINE",
"label": "-",
"defaultValue": "*.png"
}
}
]
}
]
],
"metaMakerVersion": "0.7.0"
}

0 comments on commit 821cb1e

Please sign in to comment.