Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / Python / # Error: line 1: # with rampColorPort and attrColorSliderGrp
  RSS 2.0 ATOM  

# Error: line 1: # with rampColorPort and attrColorSliderGrp
Rate this thread
 
59955
 
Permlink of this thread  
avatar
  • Total Posts: 2
  • Joined: 24 May 2007 08:56 AM

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(formedit=TrueattachForm=[('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 --at myRamp.colorEntryList[0].color colorSliderGrp;
# Error: line 1:  #


Replies: 0
avatar
  • ldunham1
  • Posted: 16 September 2011 11:01 PM

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(formedit=TrueattachForm=[('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

Replies: 1
/img/forum/dark/default_avatar.png

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