Skip to content

Commit

Permalink
Merge branch 'master' into AddNullableType
Browse files Browse the repository at this point in the history
  • Loading branch information
saintentropy authored Nov 14, 2023
2 parents fc202fb + 8af516c commit 4879391
Show file tree
Hide file tree
Showing 34 changed files with 48,859 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.1.0
uses: metcalfc/changelog-generator@v4.2.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
head-ref: ${{ github.event.inputs.head-ref }}
Expand Down
47 changes: 47 additions & 0 deletions src/Libraries/CoreNodeModels/CoreNodeModelsImages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,53 @@
f66KxdT5Mc9gSmp03qAW9gD5lfwobNUbvjVjAU0UNacLobgfWBUOJrhkXnc2pc08O3uXcsnTdV1Kw+dw
IPQxh9M1WA0uyLqE0AAGIW/Key8ihlALTQmXWtgG1VZGV7BDhxVyKQowQnFEcOlzsDI4jR14HIzwmO9p
2zaJFT8arCiKovwdxnwAzk7Zcq1S2RAAAAAASUVORK5CYII=
</value>
</data>
<data name="CoreNodeModels.Remember.Large" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAABmhJREFUeF7tnFmMFEUYx9cDDyDeikrECxHFF8ErMTGoMNPVXT2uD2M0PhkJhBgf
TFRUYIEYFW/lUIknKEbREEUlwC7bxy4ryIqwEGVBBR5Qg0YTTbwIO/5r/IYMPbWzs9PTs7PT3y/5pZed
Pqr+9FZXddd0A8MwDMMwDMMwDMMwccGZOPGEHen0ce0p86qNQpxEv2aqwXopR3qWmOFZxvueFBksF7da
ook+ZqKkzbIuQuhdvhQHsu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5p0sifNqo0P0OwspEMzOZz0
xOGuFK4usEqqHlvSIZkgnRgnoGlQz1m14YU2Dv38sKinSfRYTx9iODvUhZ8OxfTGP/v3j/1i6pRuTYAV
0NykusB0KCZIJpMZDe/vOXiwu6tplibACohBIH+RQgOF/wDshplMT09m+9wmfYghVc3cpsZGbo5yIO5L
oAp/l8o+n+3z5mhDDKUt9rgpMZ2/cA2QsQr/QVgQfo4dj87TBxnOzzyZvEbNxqOixA9kOwbOgLtV0EXo
6rz3nm80IYbxRzeVmExFiR8IteTw4Rw4EqGpW9m6MMvx71bLSFJx4gXCVOE/BL+FxdgGm+DhKd4IbkUg
yHJVL+pI0G7jA8K8FKrwv4PFKAg/B4J7Ly/IsnQtsW5N3F4zgDDHwodhKeHPhr3OrUeIy4OhlqorxU+u
bdwXq+9vIcxc+N/DYmyFKvw+B0tquqIu4BLsbreT42g39Q/CvAw+AksJfxYseaSKMJcGwu3LXxxbXEeb
1z8IMxf+HliMr6AKfwRtWjJqCqEm6KBqIsDPraZ5LW1W/yBMFf5MWEr4ar1+h58DF9UFaNt3BkLPuRuf
taHdv5pWr38Q5uVQndF7YTG2QBV+6Ne9IGQb/xGzPWns8myxE//eCF3HNu5Wc1NptfoHYfYnfNU8Vexd
O046PdxJJUe3mOaY9TI53jGMC2LV3USY46DqxeyDxfgSql4R35+vJAj0DsjhDwQIdBhcCf+FvdEJ1UiY
37NWaRDqxbAZ9kYufH4YEgUIdjhcAnVshuruJ4cfFQj3WHgbXAsVPbTMhc/v2IwahDwU3gTnw1fgXGhA
Dr9aIOyj4RDI79JkGIZhGIZhGIZhGIZhGIZhGIbJ0tDwH0GDC8n0ME7kAAAAAElFTkSuQmCC
</value>
</data>
<data name="CoreNodeModels.Remember.Small" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAAd1JREFUWEftlTtLw2AUhnvxAt2sqIOr4ij4AxxENGm+1oIUBx1cnN0ULziJWtRd
xd1JEMFBvDS1Hbx0kqKLk3/ASW2hNL6nnkhIQ40mjSB94KGSL995QmxSX4N/x4UQwbSQh1RF7uZD3pFP
JPyI78MSfIWDvOQN2Xg8gOgz1Ng3FXeDl70BwVnDBZDvcISX60taRNoQuzbEdQtQ4dPqw9Vn/MYQNVuE
Y3y6u6SFFMbwWnHdYkrIEm9zBwyl+K0h8p3HvPVnqCLSj2d74DImN/Eh3PZK/M4UsPIE0qNZwIxp3m4f
bFyFb5CG0a0OId6OTzvx7coMRerB372VgT8BmyYNw3TzMGc6ZuUWj/k9GHJgGmrXTR7hDAyaMQ22Y5K3
O+c8FqMfF3q/W4Ws3OCt7pFRlABesTsWMbPrvMV9ckL4s4nxWnfiBRcZ5tPdR9O0Dq1cPnva27WK6z6m
o5EQb3EPxDvhBSSK9yvLGYs4K03xNndAsAteVtKIwyVIX8xkdVwu4U03zFudgxDFU5Cg+CIM8jI9omum
CzjKRkebedkZCFFchQTFF+BXXAdfvAmED/E5r0alVj7sDIT88BQSFJ+HVfG6gVgLfIAFOAcDvOQdiNK/
oO9P4g0aeIfP9wFYbEj5mAMhlQAAAABJRU5ErkJggg==
</value>
</data>
<data name="CoreNodeModels.Logic.Gate.Large" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
27 changes: 27 additions & 0 deletions src/Libraries/CoreNodeModels/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/Libraries/CoreNodeModels/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,15 @@ Default value: {0}</value>
<data name="TooltipTextQuery" xml:space="preserve">
<value>Nodes that query data</value>
</data>
<data name="RememberDescription" xml:space="preserve">
<value>Store data passing through this node to the Dynamo file. Return the stored data if the input is null.</value>
</data>
<data name="RememberInputToolTip" xml:space="preserve">
<value>Data to sample and store in the file.</value>
</data>
<data name="RememberOuputToolTip" xml:space="preserve">
<value>Data</value>
</data>
<data name="GateDescription" xml:space="preserve">
<value>Block data passing through this node to downstream nodes. Node returns the input data only if the node value is set to Open.

Expand Down
9 changes: 9 additions & 0 deletions src/Libraries/CoreNodeModels/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,15 @@ Default value: {0}</value>
<data name="TooltipTextQuery" xml:space="preserve">
<value>Nodes that query data</value>
</data>
<data name="RememberDescription" xml:space="preserve">
<value>Store data passing through this node to the Dynamo file. Return the stored data if the input is null.</value>
</data>
<data name="RememberInputToolTip" xml:space="preserve">
<value>Data to sample and store in the file.</value>
</data>
<data name="RememberOuputToolTip" xml:space="preserve">
<value>Data</value>
</data>
<data name="GateDescription" xml:space="preserve">
<value>Block data passing through this node to downstream nodes. Node returns the input data only if the node value is set to Open.

Expand Down
124 changes: 124 additions & 0 deletions src/Libraries/CoreNodeModels/Remember.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
using Dynamo.Graph;
using Dynamo.Graph.Nodes;
using Newtonsoft.Json;
using ProtoCore.AST.AssociativeAST;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using VMDataBridge;

namespace CoreNodeModels
{
[NodeName("Remember")]
[NodeDescription(nameof(Properties.Resources.RememberDescription), typeof(Properties.Resources))]
[NodeCategory("Core.Data")]
[InPortNames(">")]
[InPortTypes("var[]..[]")]
[InPortDescriptions(typeof(Properties.Resources), nameof(Properties.Resources.RememberInputToolTip))]
[OutPortNames(">")]
[OutPortTypes("var[]..[]")]
[OutPortDescriptions(typeof(Properties.Resources), nameof(Properties.Resources.RememberOuputToolTip))]
[IsDesignScriptCompatible]
public class Remember : NodeModel
{
private string cache = "";

public string Cache
{
get { return cache; }
set
{
var valueToSet = value == null ? "" : value;
if (valueToSet != cache)
{
cache = valueToSet;
MarkNodeAsModified();
}
}
}

[JsonConstructor]
private Remember(IEnumerable<PortModel> inPorts, IEnumerable<PortModel> outPorts) : base(inPorts, outPorts)
{
PropertyChanged += OnPropertyChanged;
}

public Remember()
{
RegisterAllPorts();
PropertyChanged += OnPropertyChanged;
}

private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(State):
if (State == ElementState.Warning)
{
Cache = "";
}
break;

default:
// Nothing to handle
break;
}
}

protected override void OnBuilt()
{
base.OnBuilt();
DataBridge.Instance.RegisterCallback(GUID.ToString(), DataBridgeCallback);
}

public override void Dispose()
{
PropertyChanged -= OnPropertyChanged;
base.Dispose();
DataBridge.Instance.UnregisterCallback(GUID.ToString());
}

private static readonly string BuiltinDictionaryTypeName = typeof(DesignScript.Builtin.Dictionary).FullName;
private static readonly string BuiltinDictionaryGet = nameof(DesignScript.Builtin.Dictionary.ValueAtKey);

public override IEnumerable<AssociativeNode> BuildOutputAst(List<AssociativeNode> inputAstNodes)
{
var resultAst = new List<AssociativeNode>();

var funtionInputs = new List<AssociativeNode> { inputAstNodes[0], AstFactory.BuildStringNode(Cache) };

//First build the function call
var functionCall = AstFactory.BuildFunctionCall(
new Func<object, string, Dictionary<string, object>>(DSCore.Data.Remember), funtionInputs);

var functionCallIndent = AstFactory.BuildIdentifier(GUID + "_func");

resultAst.Add(AstFactory.BuildAssignment(functionCallIndent, functionCall));

//Next add the first key value pair to the output port
var getFirstKey = AstFactory.BuildFunctionCall(BuiltinDictionaryTypeName, BuiltinDictionaryGet,
new List<AssociativeNode> { functionCallIndent, AstFactory.BuildStringNode(">") });

resultAst.Add(AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), getFirstKey));

//Second get the key value pair to pass to the databridge callback
var getSecondKey = AstFactory.BuildFunctionCall(BuiltinDictionaryTypeName, BuiltinDictionaryGet,
new List<AssociativeNode> { functionCallIndent, AstFactory.BuildStringNode("Cache") });

resultAst.Add(AstFactory.BuildAssignment(
AstFactory.BuildIdentifier(GUID + "_db"),
DataBridge.GenerateBridgeDataAst(GUID.ToString(), getSecondKey)));

return resultAst;
}

private void DataBridgeCallback(object callbackObject)
{
if (DSCore.Data.CanObjectBeCached(callbackObject))
{
Cache = callbackObject as String;
}
}
}
}
5 changes: 5 additions & 0 deletions src/Libraries/CoreNodes/CoreNodes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<Project>{c0d6dee5-5532-4345-9c66-4c00d7fdb8be}</Project>
<Name>DesignScriptBuiltin</Name>
</ProjectReference>
<ProjectReference Include="..\DynamoUnits\UnitsCore.csproj">
<Project>{6e0a079e-85f1-45a1-ad5b-9855e4344809}</Project>
<Name>Units</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="DSCoreNodes.Migrations.xml">
Expand Down
Loading

0 comments on commit 4879391

Please sign in to comment.