Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodes "chaining" format can cause some problems #25526

Open
LeviPesin opened this issue Feb 17, 2023 · 0 comments
Open

Nodes "chaining" format can cause some problems #25526

LeviPesin opened this issue Feb 17, 2023 · 0 comments
Labels

Comments

@LeviPesin
Copy link
Contributor

LeviPesin commented Feb 17, 2023

Description

Related issues: #25074 #25240 (comment) #25498

The new nodes chaining format can cause some problems, which aren't very severe but still exist:

  • Doesn't allow autocompletion (an IDE doesn't know there exists ShaderNodeObject.add() or ShadedNodeObject.sub() method)
  • It can break type checking (types also don't know there exist such methods)
  • It can break if a needed file is not imported before the one using. This is solvable in the internal Nodes system (just by exporting some files first) and isn't really a problem in "external" Nodes system -- i.e., for user. But it can break if a compiler/minifier decide to tree-shake a file.

The first two problems can be solved by 1) not adding very much node methods to node chaning and 2) adding such node methods to the TS types of ShaderNodeObject -- but this only resolves these problems for built-in nodes (such that their types can be added to TS) and not user-added nodes.
Possibly, then, user must create a new class that node-chaining user-defined-methods will be added to (user also manages TS types for it) -- so possibly we should add another argument to addNodeElement -- the class that a node must extend so that it can use passed method.

Solution

This is just an issue for discussing these problems.

Alternatives

N/A

Additional context

/ping @sunag @epreston @three-types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants