How do I automatically set texture and gamma via python in my current window

How do I automatically set texture and gamma via python in my current window

Peteman12
Advocate Advocate
1,127 Views
2 Replies
Message 1 of 3

How do I automatically set texture and gamma via python in my current window

Peteman12
Advocate
Advocate

I am working on skinning some characters but I do a lot of new scenes as part of the workflow. Unfortunately, this means I need to set the textures to on and the gamma to 2.0 every time. I want to make a script to automate this process. I see a modelEditor command that looks like it might help, but it only creates the window inside the script editor when I want it on my main display screen.

My script attempt so far:

cmds.modelEditor(displayTextures=True, gamma=2, displayAppearance='smoothShaded')

 

Any ideas on how to make it only apply to the standard viewport?

Accepted solutions (1)
1,128 Views
2 Replies
Replies (2)
Message 2 of 3

g2m.agent
Collaborator
Collaborator
Accepted solution
for vp in cmds.getPanel(type="modelPanel"):
        # check if current viewport.
	if cmds.modelEditor(vp, q=True, av=True):
		cmds.modelEditor(vp,e=True,da="smoothShaded")
		cmds.modelEditor(vp,e=True,dtx=True)
		cmds.modelEditor(vp,e=True,ga=2.0)
		break
Message 3 of 3

Peteman12
Advocate
Advocate

Thanks!

0 Likes