|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| # Error: line 1: # with rampColorPort and attrColorSliderGrp
|
|
|
Hiya,
I’ve had a look about and not found anything on this error I get whilst trying to hook up an attColorSliderGrp to a rampColorPort control. It still works fine, but I get this annoying error. Has anyone any ideas? (Maya2010)
I’ve abstracted the offending code…
import maya.cmds as mc
def ui():
ramp = createColourRamp()
uiWindow = 'window'
mc.window(uiWindow)
form = mc.formLayout()
mc.frameLayout('colour_Frame')
mc.columnLayout(adj=True)
mc.rampColorPort('port',node=ramp,selectedColorControl='colorSliderGrp')
mc.attrColorSliderGrp('colorSliderGrp',label='Colour',columnWidth4=[130,50,50,50],columnAlign4=['right','left','left','left'],showButton=False)
mc.formLayout(form, edit=True, attachForm=[('colour_Frame', "top", 10),('colour_Frame', "left", 10),('colour_Frame', "right", 10)])
mc.showWindow(uiWindow)
def createColourRamp():
ramp = 'myRamp'
if not mc.objExists(ramp):
ramp = mc.shadingNode('ramp',asTexture=1,n=ramp)
mc.setAttr(ramp+'.colorEntryList[0].position', 0)
mc.setAttr(ramp+'.colorEntryList[1].position', 1.0)
mc.setAttr(ramp+'.colorEntryList[0].color', 0,0,0)
mc.setAttr(ramp+'.colorEntryList[1].color', 0,0,1)
return ramp
ui()
When run, I get this output..
attrColorSliderGrp -e -at myRamp.colorEntryList[0].color colorSliderGrp; # Error: line 1: #
|
|
|
|
besides a couple of indent errors i dont get any error like you mentioned, it runs fine;
import maya.cmds as mc
def ui():
ramp = createColourRamp()
uiWindow = 'window'
mc.window(uiWindow)
form = mc.formLayout()
mc.frameLayout('colour_Frame')
mc.columnLayout(adj=True)
mc.rampColorPort('port',node=ramp,selectedColorControl='colorSliderGrp')
mc.attrColorSliderGrp('colorSliderGrp',label='Colour',columnWidth4=[130,50,50,50],columnAlign4=['right','left','left','left'],showButton=False)
mc.formLayout(form, edit=True, attachForm=[('colour_Frame', "top", 10),('colour_Frame', "left", 10),('colour_Frame', "right", 10)])
mc.showWindow(uiWindow)
def createColourRamp():
ramp = 'myRamp'
if not mc.objExists(ramp):
ramp = mc.shadingNode('ramp',asTexture=1,n=ramp)
mc.setAttr(ramp+'.colorEntryList[0].position', 0)
mc.setAttr(ramp+'.colorEntryList[1].position', 1.0)
mc.setAttr(ramp+'.colorEntryList[0].color', 0,0,0)
mc.setAttr(ramp+'.colorEntryList[1].color', 0,0,1)
return ramp
ui()
Lee Dunham | Character TD
ldunham.blogspot.com
|
|
|
|
|
Thanks for the response. The error is more of a warning really, the ui still runs and performs well regardless.
I now know that this error is caused by placing the attColorSliderGrp after the rampColorPort, possibly to do with assigning selectedColorControl=’colorSliderGrp’ before ‘colorSliderGrp’ was created.
And the indent errors are of course from the forum’s crappy code tags.
Thanks again
Paul
Author: PaulAtkinson
|
| Replied: 21 September 2011 09:25 PM
|
|
|
|
|