Skip to content

Conversation

@ivaylo-matov
Copy link
Contributor

Purpose

This PR aims to address DYN-7838 where two input ports (colors and indices) were not showing as blue to indicate they have default values. Default values are now assigned during initialization, and the ports can toggle between using default values and user-supplied inputs.

I've added initialization for default values DefaultColorsNode and DefaultIndicesNode.
Updated the initialization logic for input ports to correctly display their default state.
Users can still override default values when needed.

DYN-7838-ColorRangeInPortsFix

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

This PR aims to address DYN-7838 where two input ports (colors and indices) were not showing as blue to indicate they have default values. Default values are now assigned during initialization, and the ports can toggle between using default values and user-supplied inputs.

Reviewers

@QilongTang
@reddyashish

FYIs

@dnenov

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-7838

@github-actions
Copy link

github-actions bot commented Dec 9, 2024

UI Smoke Tests

Test: success. 11 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests

@QilongTang QilongTang added this to the 3.5 milestone Dec 9, 2024
Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, do you mind adding a unit test? Just to test the default behavior of the node, it looks like such baseline might be missing

[JsonConstructor]
private ColorRange(IEnumerable<PortModel> inPorts, IEnumerable<PortModel> outPorts) : base(inPorts, outPorts)
{
if (inPorts.Count() == 3 && outPorts.Count() == 1)
Copy link
Member

@mjkkirschner mjkkirschner Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QilongTang I think we should come up with something better than this pattern - for example default value attributes or something where the author only needs to specify the default value once and not need to consider it in their json constructor unless they want to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracked this in Jira


// If there are colors supplied
if (InPorts[0].IsConnected)
if (InPorts[0].Connectors.Any())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public class ColorRange : NodeModel
{
private List<Color> _defaultColors;
private List<Color> DefaultColors => _defaultColors ??= DefaultColorRanges.Analysis.ToList();
Copy link
Member

@mjkkirschner mjkkirschner Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not look like you use any dynamic resizing list functionality here, is there a reason you use this type here and in the create helpers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateParametersForColors() was already accepting List and didn't want to chage existing code unless I really have to. Hepe the latest commit is okay.

@zeusongit
Copy link
Contributor

@ivaylo-matov Can you address the questions in this PR, so that we can move forward with the review ? Thanks.

@ivaylo-matov
Copy link
Contributor Author

@ivaylo-matov Can you address the questions in this PR, so that we can move forward with the review ? Thanks.

@zeusongit , I can see one question and I have responded to it

@zeusongit
Copy link
Contributor

@ivaylo-matov Can you address the questions in this PR, so that we can move forward with the review ? Thanks.

@zeusongit , I can see one question and I have responded to it

Oh I was referring to this: #15715 (comment)

@ivaylo-matov
Copy link
Contributor Author

@ivaylo-matov Can you address the questions in this PR, so that we can move forward with the review ? Thanks.

@zeusongit , I can see one question and I have responded to it

Oh I was referring to this: #15715 (comment)

@zeusongit If the question is why I've replaced IsConnected with Connectors.Any(), the reason is that after adding the AssociativeNodes, .DefaultValue, and .UsingDefaultValue, the .IsConnected property will always return true, even when nothing is connected. So I used Connectors.Any() to check for connections.

@zeusongit zeusongit merged commit 02b3fc6 into DynamoDS:master Feb 21, 2025
23 of 24 checks passed
AstFactory.BuildFunctionCall(
new Func<int, int, int, int, Color>(DSCore.Color.ByARGB),
new List<AssociativeNode>
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed the Opacity, A here resulting in that issue. Fixing in 3.6.1 with a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants