deleting a shader node while keeping up and down connections?

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  06 June 2013
deleting a shader node while keeping up and down connections?

Hey would anyone happen to know of a script, that deletes a node in hypershade, while keeping what it's plugged into? I have a file node, then a gamma correction node, then an actual shader. Deleting gamma breaks the connection and i have to rewire it by hand. I have quite a few files to go through to do it, and quite a few shaders within each file. Trying to automate. Any help would be appreciated.
__________________








=================================
Available for freelance or local full time work


 
  06 June 2013
Quote: I have a file node, then a gamma correction node, then an actual shader. Deleting gamma breaks the connection and i have to rewire it by hand.


I don't quite understand, do you want the file node to automatically connect into the same input that the gamma node was plugged into? I'm assuming you are deleting the gamma nodes to use the file nodes built in colour management?
 
  06 June 2013
Possibly something like this?


'''
delete selected nodes and pass incoming connections directly to destination
'''
import pymel.core as pm

def jgPassNode():
    
    nodes = pm.ls(sl=1, fl=1)

    if nodes:
        for n in nodes:
            sourceConn = pm.listConnections(n, p = 1, s=1, d=0)
            destConn = pm.listConnections(n, p=1, s=0, d=1)
                
            for s, d in zip(sourceConn, destConn):
                pm.connectAttr(s, d, f=1)
             
            pm.delete(n)
    else:
        print '_______Nothing Selected_______'
__________________

gibby3d.com
 
  06 June 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed 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 08:47 PM.


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