DrawStyle

DrawStyle

Anonymous
Not applicable
1,895 Views
3 Replies
Message 1 of 4

DrawStyle

Anonymous
Not applicable

Hi all, how're you?. 

I'm doing a script, but i'm really beginner in that, so i searching help...i holpe that anyone can help me.

Well, i did some lines of code that the funtion of that it's turn on the drawstyle(none). It's my first line 

My second code its to put my drowStyle in bone. 

But my question i'ts, how can i turn off and turn on my draw style with only a few clicks? 

 

I resolved that with two bottoms but i just want one bottom. 

1 click = drawStyle in none 

2 click = drawStyle in Bone 

and vicebersa.

thx!

 

 
 
0 Likes
Accepted solutions (1)
1,896 Views
3 Replies
Replies (3)
Message 2 of 4

jmreinhart
Advisor
Advisor
Accepted solution

The easiest way to set up a button is to create one of the shelf. In case you don't know how do that here is a video:

https://www.youtube.com/watch?v=yraBRus3Q7w

 

Once you have a button you can set up a different script for single and double click by right clicking on the button and choosing edit

jonahrnhrt_0-1593674564132.png

Single click (to set the drawStyle on the selected joints to none)

import maya.cmds as cmds
sel = cmds.ls(sl = True)
for each_joint in sel:
    if cmds.nodeType(each_joint) == 'joint':
        cmds.setAttr(each_joint + '.drawStyle', 2)
        

Double click   (to set the drawStyle on the selected joints to bone)

import maya.cmds as cmds
sel = cmds.ls(sl = True)
for each_joint in sel:
    if cmds.nodeType(each_joint) == 'joint':
        cmds.setAttr(each_joint + '.drawStyle', 0)
        
Message 3 of 4

Anonymous
Not applicable

Thanks!!

0 Likes
Message 4 of 4

arshkumarmishra
Participant
Participant
thanks a lot
0 Likes