you should provide object arguments when coding to edit stuff, relying on
selection only can cause issues, you can use cmds.ls(sl=True) as the
argument as well
to edit the enum you have to provide the object.attr argument
using ln= tries to rename the longname
cmds.addAttr('locator1', at = 'enum', keyable=True, en =
'string1:string2:string3:string4:string5:string6', ln='Parent')
cmds.addAttr('locator1.Parent', e=True, en = 'string1:string2:string4:')
or
cmds.addAttr(cmds.ls(sl=True)[0], at = 'enum', keyable=True, en =
'string1:string2:string3:string4:string5:string6', ln='Parent')
cmds.addAttr(cmds.ls(sl=True)[0]+'.Parent', e=True, en =
'string1:string2:string4:')
or
obj_name = cmds.ls(sl=True)[0]
cmds.addAttr(obj_name, at = 'enum', keyable=True, en =
'string1:string2:string3:string4:string5:string6', ln='Parent')
cmds.addAttr(obj_name+'.Parent', e=True, en = 'string1:string2:string4:')
On Mon, Feb 23, 2015 at 5:04 PM, Bay <[email protected]> wrote:
> Hi guys,
> I've been working with an user interface that requires me to
> edit the content of an enum attribute (basically removing and adding to its
> contents) but i seemed to run into a snag so would appreciate any input.
>
> I created the attribute like so :
> cmds.addAttr(at = 'enum', keyable=True, en =
> 'string1:string2:string3:string4:string5:string6', ln='Parent')
>
> and sought to adjust its content like so
>
> cmds.addAttr(e=True, en = 'string1:string2:string4:', ln='Parent')
>
> But i kept getting a
> # Error: line 1: RuntimeError: file <maya console> line 1: Attribute not
> found/supplied #
>
> Would anyone happen to know what I'm doing wrong ?
>
> Thank you
> Gann Boon Bay
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/f98e24dd-ebdd-43a4-9cc4-97f5902ae9c8%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/f98e24dd-ebdd-43a4-9cc4-97f5902ae9c8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAM9RXoJYneh0paAyV7_qWhKZP7A%2B%3D9N42gbptknYvamrcrSAWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.