Hey,
Well, I was stupid not to find the override color was also controlled by shape 
node....
It is controlled by shape node, transform node and layer... But will response 
to shape node if its override color is enabled.
Thanks😊
Jerry

-----原始邮件-----
发件人: "[email protected]" <[email protected]>
发送时间: ‎2013/‎8/‎1 上午 3:12
收件人: "Digest Recipients" <[email protected]>
主题: [Maya-Python] Digest for [email protected] - 13Messages 
in 6 Topics

  Today's Topic Summary
Group: http://groups.google.com/group/python_inside_maya/topics
How can I change a curve's display color when it is used as a controller? [1 
Update] 
How can I change a curve's display color when it is used as a controller? [1 
Update] 
Loop with name change - not maya related [4 Updates] 
styleSheet on pushButton problem [4 Updates] 
Drag-Drop, draw on Maya's viewport [1 Update] 
Question on PyQt Layouts [2 Updates] 
 How can I change a curve's display color when it is used as a controller?
郭金锋 <[email protected]> Jul 31 08:19AM -0700  

Hi there,
 
Good day!
 
The other day a co-worker of mine asked me to write a script to quick color 
controllers(nurbsCurve), and I first did that in following way(no internet 
access in my company thus no pasted codes here :P):
1 enable the curve's(transform node) overRide color, then make the override 
color attr keyable
2 if there is any display layer connected with the curve, break the override 
color attr connection
3 pick one color and delete other previous keys in this attr
I created several curves with hierarchy and repeating node names under 
different hierarchies(I don't know why I see this so often, but there are just 
repeating dag names in lots of scenes...), and it worked.
BUT... when I tried this tiny function in a rigged character, it just didn't 
work on all of them. Some of the curves had colors in the first place, and I 
could not change them even by hand...though others worked well with the 
script...
Could some one please help me ? Is there any other way to color a curve? And if 
I missed some in the previous way, do please point out:)
 
Thanks!
 
Jerry

 
 How can I change a curve's display color when it is used as a controller?
郭金锋 <[email protected]> Jul 31 08:18AM -0700  

Hi there,
 
Good day!
 
The other day a co-worker of mine asked me to write a script to quick color 
controllers(nurbsCurve), and I first did that in following way(no internet 
access in my company thus no pasted codes here :P):
1 enable the curve's(transform node) overRide color, then make the override 
color attr keyable
2 if there is any display layer connected with the curve, break the override 
color attr connection
3 pick one color and delete other previous keys in this attr
I created several curves with hierarchy and repeating node names under 
different hierarchies(I don't know why I see this so often, but there are just 
repeating dag names in lots of scenes...), and it worked.
BUT... when I tried this tiny function in a rigged character, it just didn't 
work on all of them. Some of the curves had colors in the first place, and I 
could not change them even by hand...though others worked well with the 
script...
Could some one please help me ? Is there any other way to color a curve? And if 
I missed some in the previous way, do please point out:)
 
Thanks!
 
Jerry

 
 Loop with name change - not maya related
Daz <[email protected]> Jul 31 05:27AM -0700  

Heya
 
Uhh this is not really maya related but maybe some1 can help me with it.
 
Basically I have a list of objects and I want to add a number to each object 
each time loop goes over it so. Basically in maya terms if I remember it 
correctly :
 
obj = cmds.select("*cat*")
 
for list in obj:
print "test" + str(1)
 
so if I have 4 objects I want to have names 
test1
test2
test3
test4
 
How can I do it? I know I'm missing something basic uhh.

 
Justin Israel <[email protected]> Aug 01 12:32AM +1200  

Do you mean just using a counter? You can do it a couple ways. If I am looping 
over a list, then I tend to use enumerate:
 
aList = someListofStuff()
 
for i, item in enumerate(aList):
print "{0}{1}".format(item, i)
 
Is that what you are after?
 
 
On Aug 1, 2013, at 12:27 AM, Daz wrote:
 

 
Justin Israel <[email protected]> Aug 01 12:33AM +1200  

It is essentially a shorter and probably more performant version of this:
 
i = 0
for item in aList:
print "{0}{1}".format(item, i)
i += 1
 
 
 
On Aug 1, 2013, at 12:32 AM, Justin Israel wrote:
 

 
Daz <[email protected]> Jul 31 05:40AM -0700  

enumerate worked like dream, I cant believe I forgot about it.
 
Thanks !

 
 styleSheet on pushButton problem
drchickins <[email protected]> Jul 30 03:57PM -0700  

hi all,
 
having a small issue with a simple pushButton change of color. 
 
so the stylesheet is this
 
color = QtGui.QColor()
color.setGreen(125)
self.create_button.setStyleSheet( "QPushButton:checked { background-color: %s 
}" % color.name())
 
 
then i have a callback triggered from a clicked() signal attached to that 
pushButton. 
 
when its clicked its supposed to turn green, which it has up untill i put a 
cmds.confirmDialog() within the callback 
 
the problem is that i gather because the callback hasnt completed i think the 
styleSheet doesnt get to finish. and even when i except the button doesnt 
change color.
 
when i changed the styleSheet to "QPushButton:pressed it worked however when i 
use button.setChecked(False) it dosnt return to its defualt color.
 
so it works fine without the maya comfim Dialog but with it in the mix i'm 
missing somthing.
 
when is a styleSheet activated ? i gather there is a signal that happens.
 
anyway any solutions would be great
 
john

 
Justin Israel <[email protected]> Jul 31 04:09PM +1200  

I would wager is it because signals emitted and received within the same
thread use a direct connection, which means that the button has probably
not fully completed its "clicked" state until it returns back to the event
loop.
You could either called QApplication.processEvents() in your slot before
you launch a modal dialog to flush the event loop, or you could make the
signal/slot connection be of type QueuedConnection, making it put the
callback into the event loop to get picked up.
In terms of the stylesheet behavior, did you want it to respond to a color
change only for the time when it is "pressed down"? or are you using a
checkable button that it should be green while in the checked state? There
are a couple different pseudo-states for the variations.
 
 
 

 
johnvdz <[email protected]> Jul 31 08:00PM -0700  

Hi justin,
 
thanks thats some good leads. yes i need it to be in a state where is 
stays in color in its "pressed down"state while the tool is active. 
until i need the setChecked(False) called.
 
if there is an easier way please let me know.
 
thanks again
 
john
 
On 30/07/2013 9:09 PM, Justin Israel wrote:

 
Justin Israel <[email protected]> Aug 01 12:27AM +1200  

This works as expected for me, using the ":checked" pseudo-state on a checkable 
button
You could also just use the QMessageBox instead of the cmds.confirmDialog, 
since you are already using Qt
 
###
def clicked(checked):
print "Checked?", checked
cmds.confirmDialog()
# QtGui.QMessageBox.question(None, "A Question", "Yes?")
 
button = QtGui.QPushButton("Click me")
button.setCheckable(True)
button.toggled.connect(clicked)
 
button.setStyleSheet("""
QPushButton:checked {
background-color: green;
}
""")

button.show()
button.raise_()
button.resize(300,200)
###
 
 
On Aug 1, 2013, at 3:00 PM, johnvdz wrote:
 

 
 Drag-Drop, draw on Maya's viewport
illunara <[email protected]> Jul 30 11:03PM -0700  

Hi everybody
This is one part in our project, our goal is create a tool which allow user can 
draw some path on viewport (If possible)then use it to select element (Faces, 
vertex, edge....). 
 
So like the title said, what i want to ask is, can i change some Maya's 
behavior (like drag-drop on viewport) or tool (like lasso select tool) to make 
it happend?
 
If not, then i can i create a new UI (use PyQt or PySide) which contain Maya's 
viewport?
 
Thanks

 
 Question on PyQt Layouts
Joe Weidenbach <[email protected]> Jul 30 02:04PM -0700  

Thanks Justin--
 
Great videos on CMIVFX btw :)
 
Sent from my iPhone
 

 
Justin Israel <[email protected]> Jul 31 10:53AM +1200  

No problem (and thanks). If you get hung up, post some example code and we
can look at it from there.
I have some similar stuff with "pill boxes" where the custom widgets are in
a vertical scrolling layout and can be individually collapsed to just their
title bars.

 
-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to