Select or Edit inputComponents of a polyModifier node

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
Old 08 August 2014   #1
Select or Edit inputComponents of a polyModifier node

This is probably a totally futile question, but I've always wondered if it's possible to see/select/change what components a polyModifier node is affecting.

For example: You have a mesh. You bevel some edges on the mesh. You continue doing other edits. You realize a few edits down the road, that you actually meant to include some more edges in your earlier bevel operation.

I know of two ways to proceed.
1) Undo repeatedly until the bevel has been undone. Redo your selection as you had originally meant it, and then redo all subsequent edits (could be lots of work)
2) Open the node editor or hyper graph. Find the bevel node and delete it. Hope it doesn't blow up your mesh. Redo your selection as you had meant it, and bevel again.

in the help docs, the Bevel node is listed as a type of polyModifier node. The polyModifier node is listed as having an inputComponents connection. Presumably, this is a list of what edges/faces/vertices that node is editing. However, I can't see this connection on a bevel node in the Node Editor/Hypergraph. I can see Input Polymesh, and Manip Matrix, which probably have something to do with it, but I don't see a way to actually see what values are being passed into those connections, only where they are coming from.

Anybody have a clue? This could save people tons of time.

I can post this in the programming forum if you all feel that's more appropriate
 
Old 08 August 2014   #2
The polyBevel2 node (and I think other polyModifier nodes) has an attribute called "inputComponents". This is of type "componentList".

If you bevel some edges and get the value of the inputComponents you might see something like this.

import pymel.core as pm
bev = pm.PyNode('polyBevel1')
bev.inputComponents.get()
# Result: [u'e[1:2]', u'e[5]', u'e[7]', u'e[9]'] # 

This is mayas funny way of listing the edges in a compact format.

So if you wanted to redefine which edges get bevelled you just need write in a new componentList. For example to bevel just edges 1 and 3...
bev.inputComponents.set((2,'e[1]', 'e[3]'))

Note that the 1st element in that tuple specifys the number of elements in the componentList (in this case 2). And if you were to do this with mel you would also have to specify -type "componentList".

David
__________________
http://www.djx.com.au
 
Old 08 August 2014   #3
Originally Posted by evantron3000: I can't see this connection on a bevel node in the Node Editor/Hypergraph. I can see Input Polymesh, and Manip Matrix, which probably have something to do with it, but I don't see a way to actually see what values are being passed into those connections, only where they are coming from.


The 'inputComponents' attribute just has no input connection. So, it is not interactively reset when the actual source data change. The Value of that attribute is set when the 'bevel' node or any other polyModifier node is integrated with the dependency graph. In principal, the attribute could be set interactively if it would have a proper input connection, but this is not the case.
 
Old 08 August 2014   #4
Thanks for the reply. I haven't tried this yet, but I'm glad to know it's possible.

I'm a bit rusty with my MEL, is there a way I could both select the edges that had been beveled, add to the selection, and then replace inputComponents with my current selection? or a way to select some additional edges, and append them to the list?
 
Old 08 August 2014   #5
I have been thinking about your question and my answer. At first I thought "yeah, it should be easy to write a bit of code to update the componentList and add to the edges being bevelled", so I threw a few lines together to do just that... Based on a simple test with a polySphere that already has a polyBevel node on it. Select some verts or edges and run this code to add them to the bevel...
import pymel.core as pm
 	
 def edgesToEdgeString(edges):
 	return [e.split('.')[1] for e in edges]
 
 geo = pm.PyNode('pSphere1')
 bev = geo.history(type='polyBevel')[0]
 inputComponents = bev.inputComponents.get()
 
 edgesFromInputComponents = []
 for i in inputComponents:
 	edgesFromInputComponents.extend(pm.ls(geo.name()+'  .'+i, fl=True))
 edgesFromInputComponentsAsStrings = edgesToEdgeString(edgesFromInputComponents)
 	  
 edgesFromSelection = pm.ls(pm.polyListComponentConversion(pm.selected()  , toEdge=True), fl=True)
 edgesFromSelectionAsStrings = edgesToEdgeString(edgesFromSelection)
 
 inputComponentsUpdate = list(set(edgesFromInputComponentsAsStrings + edgesFromSelectionAsStrings))
 inputComponentsUpdate.insert(0, len(inputComponentsUpdate))
 
 bev.inputComponents.set(inputComponentsUpdate)
 


At first I thought it worked. But then I realized that the edge ids that you set in the polyBevel nodes inputComponents need to come from the original shape node (ie before the bevel). So my code will bevel some edges, but probably not the ones you selected.

I'm going to leave it there. Even though the code I've posted does not have much practical use, it might be of interest to someone.

David


edit: looks like cgsociety's code tag still mangles my code. There should not be a space before the period in this line...
edgesFromInputComponents.extend(pm.ls(geo.name()+' .'+i, fl=True))
__________________
http://www.djx.com.au
 
Old 08 August 2014   #6
You guys might find this useful:
http://petershipkov.com/development...tionhistory.htm
 
Old 08 August 2014   #7
Well, thanks for taking a crack at it djx.

goleafsgo, I did stumble on that page, I haven't tried it yet. have you? does it work well?
 
Old 08 August 2014   #8
I tried it once and it worked just fine. If I remember correctly it's just some MEL scripts which help you manage all this stuff...probably similar to what djx was headed towards.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:48 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.