-
Notifications
You must be signed in to change notification settings - Fork 233
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
Mesh Switch node #2359
Mesh Switch node #2359
Conversation
When testing a particular node tree on a given mesh I often times needed a way to be able to change the mesh to see how the nodetree works on different models. For this I usually had to connect and disconnect the input verts/edges/polys.. hence the need for such a node where I could connect all the different meshes to the node once.. and be able to select through the meshes via a single input :) Any thoughts, suggestions, critique are appreciated as usual. It is perhaps arguable whetheer such node would necessarily need both the edges and polys sockets or whether a unified poly/edge socket would be sufficient. Having 3 sockets created for every connected mesh could grow the node tall pretty fast. |
e393d21
to
c909246
Compare
The node allows to connect multiple mesh inputs (verts/edges/polys) and to select one of them to output. Useful for changing the input mesh model to be processed by a node tree. New input sockets are added as new meshes are connected to allow the next mesh (verts/edges/polys) to be connected.
c909246
to
6c5ba13
Compare
Btw, I added this node to the "modifier change" category. If there's a better category this should go into let me know. |
@enzyme69 you mean.. can Mesh Switch node do this? 😃 Well.. now it does :) The Selected input needed to take multiple inputs. I didn't think it needed to output more than one selection, but it makes sense for this sort of applications. |
@DolphinDream Cool node! |
@vicdoval Hm.. This switch node is a bit confusing to me. Why is it "single" has multiple set of inputs and "multiple" has only one set of inputs? :) |
Ooh 😮 cool so there is Mesh Switch and Switch node also! With Mesh switch
it supports edge and poly both at the same time? Maybe we can also have
Macro that quickly hook mesh data to mesh switch.. will think.
--
…------------------------------------------------------------
- Jimmy Gunawan
http://blendersushi.blogspot.com.au
http://mayaspiral.blogspot.com.au
http://houdoodles.blogspot.com.au
http://puppetar.blogspot.com.au
|
@enzyme69 yeah. i was thinking the same. select a bunch of generator nodes + macro => links all generator V-EP outputs to the mesh switch node :) |
By the way, I made some improvements of the #2217 |
Well.. here's my latest incarnation of the "switcher" node.. which is now generalized to not only take any input (not necessarily verts / edgePoly), but also to take an arbitrary number of what I call "bunches" :) Some improvement ideas and considerations:
|
Here are some other improvement ideas: (feel free to add yours)
Btw can we bet the Node Wrangler type of functionality with SV nodes? Like Ctrl+Cmd+LMB drag from one node to the switch node could automatically ask what output sockets to link (V, VE, VP, VEP) etc. |
Btw, how does the "right click menu" command links the node to the viewer draw nodes ? I get the option when i CMD+click on the node but it only spawns the viewer draw node without connecting the sockets. Does this option look for a vertex socket in the input node to connect to the VD input verts socket? |
Btw.. I discovered that VDMK2 node has some issues .. when you feed it a list of meshes that are not all vert/poly or vert/edge. :) I posted this in a separate thread (see #2361 ). And it's not a mesh switcher node related, I even replicated that with regular list join nodes. |
Anyone knows (@zeffii) how to insert new input sockets without disconnecting the already connected sockets? E.g. If the switch node has two inputs per set (bunch = 2) and the first inputs in each set is connected (e.g. verts and edges inputs are both connected) when increasing the number of inputs to 3, each set would need to have a third socket added to the set, but I'd like to be able to keep the already connected sockets (1&2) connected. Essentially go from:
to
One way I can think of doing this (if possible) is to first query the nodes/sockets connected to each input sockets of the switch node.. then delete all input sockets (of the switch node), recreate them with larger number of inputs per set, and then reconnect the previously connected sockets of the external nodes to their sockets they were previously connected to. Another way, though I don't think this is possible, is to directly INSERT sockets in between other sockets already created in the input sockets variable (which seems to be a prop collection). |
i do not like the idea of arbitrary colors at all. for input switch... so.. without lookingthe implementation, i'm not in favour. There must be some other way to differentiate the socket grouping. |
OK.. any other ideas how to better differentiate between sets? And how about the last issue i'm having about inserting sockets without disconnecting others? |
because we have limited options to control the layout of a socket ui, beyond color.. you could make a new dummy-like socket with an entirely transparent nodule, that would act as a faux-separator between sets. regarding inserting sockets, it might be that the pynodes API is limited in our high need for dynamic ui.. i do not have a fast answer :/ |
With a dummy fully transparent socket you'd still be able to connect to it, right? If so that would be a bit confusing, I think. I would be cool if you could change the background color of a socket to make the group of sockets be like alternating row colors of sort. |
you can implement code that automatically disconnects any input into the 'separator' socket,, if that's a real issue... or automatically connect the link to the next appropriate socket. it would be nice to be able to set the socket+label background colors, sadly it's not an option in the layout engine. but imagine for a moment..
|
@zeffii I don't' know what you mean by "layout.warning" |
row = self.layout.row()
row.alert = True any operator buttons on that row will be a different "warning" color. |
there's also |
@zeffii cool. Thanks for the suggestions. Unfortunately, I don't find this hack appealing. I tried to see if layout.separator() inserted in the socket drawing level can space the sockets apart but I can't see any effect. maybe I 'm not putting it in the right place. Another idea would be to add custom icons before socket labels? (alternating between white/black or something). Ideally, I would like to have something like this (if possible) from left to right in the increasing order of preference. |
@zeffii how could I remove a link automatically? I'm creating a faux SvSeparatorSocket and i want the socket to be disconnected if you try to connect to it.
Could this auto-detach be done directly in the separator socket class? What method gets called in the socket class when a socket is connected? Also.. can you make the socket completely transparent? Including the stroke? |
@zeffii I added this to my node's update method and it does the job of detaching any connection to Separator socket however I wonder if this could/should be done instead in the node_tree in the SvSeparatorNode class itself (if so what method?)
|
the more i think about this, the more it feels more appropriate to just keep it simple and use conventional sockets. which are sufficient to act as indicator of the group.
but i get your position, for this particular node the default ui/layout features are showing their sparsity. |
and if you really have to, insert the SvSeparatorSocket inbetween sets. as for the update function, you could stick most of the working code for the disconnection into the socket definitino, and call it from within the node update function. |
I like the idea of putting the disconnection code in the SvSeparatorSocket class but unfortunately this is not going to be a lot of code since in my node I would still have to search for each socket and only call the disconnection code (two lines of code) if the socket is a separator type and is it’s connected. A more effective way (if possible) would be if the socket received a call whenever it’s connected and let the socket class automatically handle the disconnection without being prompted by the node. I assume this would be done at the lower level infrastructure. |
since the socket class doesn't have an # ... socket class...
def remove_links(self):
for link in self.links:
self.id_data.links.remove(link)
# ... in the node class ....
def update( ):
... other stuff ...
_ = [s.remove_links() for s in self.inputs if s.bl_idname == '....'] |
@DolphinDream , @Durman In which way this is supposed to be in 2.8x? Considering there is #2671 issue. |
This node was replaced by the Input Switch node So i don’t think it has to be ported to 2.8 |
The node allows to connect multiple mesh inputs (verts/edges/polys) and to select one of them to output. Useful for changing the input mesh model to be processed by a node tree.
The input sockets are added as new meshes are connected to allow the next mesh (verts/edges/polys) to be connected.