Re:- Print used files by execute button

11 views
Skip to first unread message

kinjal gajera

unread,
May 22, 2012, 4:53:52 AM5/22/12
to python_inside_maya
Hi Team

I have gone through the cmds detail which mike has posted...i am
little away to make button executable in python.

I am unable to make a button executable programme in Py.
Can you please make one smiler example of execute button in PY.

See i have MEL script for FILE TEXTURE MANAGER,it has the things which
i want make in PY.
My requirement in Py is One we press the button "Analise scene file
texture" used texture list getting generates in UI.

Please help me to find the above detail,hopes that you are getting
what i need in PY

I will get back to you with my Py detail.
Kinjal Gajera
RCVFX
tech...@gmail.com

David Moulder

unread,
May 22, 2012, 5:29:24 AM5/22/12
to python_in...@googlegroups.com
If I understand you correctly your struggling with python for loop and all the buttons using the last value ("i" in this case) in the loop?

I was asked about this the other day and forgot about partial and callback objects.  PyMel has solved this for you.

Anyway.  This is the correct way to deal with this scenario using PyMel,  The same can be achieved with cmds and the partial methods.

def func(*args):
    print args
    
with pCore.window(menuBar=True,menuBarVisible=True) as win:
    with pCore.columnLayout( rowSpacing=5 ):
        with pCore.frameLayout():
            with pCore.columnLayout():
                for i in range(10):
                    button = pCore.button("test%s" % i, c=pCore.CallbackWithArgs(func, i))
win.show()



kinjal gajera

unread,
May 22, 2012, 6:02:04 AM5/22/12
to python_inside_maya
HI TEAM
Her what i made in Python.

import maya.cmds as cmds
alllist=cmd.ls(type='file')
print list
for each in alllist:
attrstr=each+'FTN'
print
print cmds.getAttr(attrstr)

The above has run successfully,i am getting the used texture list with
path maya in script editor...
Can i make a button by i can run this py command and get the list.....

I want the above things running through button
> > techki...@gmail.com

David Moulder

unread,
May 22, 2012, 6:30:11 AM5/22/12
to python_in...@googlegroups.com
You can highlight the script and middle mouse drag to the shelf if this is what your after?  I assume your new to Maya or learning Python?
Reply all
Reply to author
Forward
0 new messages