Git Product home page Git Product logo

Comments (3)

jstone-lucasfilm avatar jstone-lucasfilm commented on May 14, 2024 1

Yes, I believe it's just an oversight that add2.setConnectedNode('in1', None) doesn't break the connection, and we'll fix this in an upcoming change. My sense is that this call should actually remove the input element from the node, rather than leaving the input with an empty nodename string.

We don't yet have a high-level method that removes all invalid connections from the document, but this sounds like a good suggestion for a future improvement.

from materialx.

jstone-lucasfilm avatar jstone-lucasfilm commented on May 14, 2024

Your description is exactly right, and creating a new node named node1 will neatly replace the original, restoring the connection between node1 and node2.

From a high level, the philosophy of the MaterialX API is that all document edits are local, so modifying or deleting an element in one place (e.g. node1) doesn't edit any other elements in the document. If you'd like to remove the input element from node2, you can delete it in the usual way by calling add2.removeInput('in1').

In a future update, I'd like to add support for calling add2.setConnectedNode('in1', None), which would perform the same work and make a clearer parallel with add2.setConnectedNode('in1', add1).

from materialx.

alister-chowdhury avatar alister-chowdhury commented on May 14, 2024

Oh I see, thank you for taking the time to explain this, the layering paradigm makes perfect sense.

Is there any general way to remove "ghost" references of this kind (or would that basically be, iterating every node, checking if it has a connection string but no connected node and pruning it at such).
I can imagine some sticky problems arising from a unexpected reference popping back into play, due to a lapse in remembering to break connections.

That's interesting that add2.setConnectedNode('in1', None) doesn't do the equivalent of add2.removeInput('in1') as add2.getInput('in1').setConnectedNode(None) does prune the reference.
Would the intention be that add2.setConnectedNode('in1', None) edits the underlying noderef?

from materialx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.