for maya how do i call a function within another function - python

trying to make this work
import maya.cmds as mc
def firstFace():
FaceToSel = 'first' def allFace():
FaceToSel = 'all'
def execute():
if FaceToSel == 'first':
print Yes
elif FaceToSel == 'all':
print No
def ui():
if mc.window('face_Select', exists = True):
mc.deleteUI('face_Select')
FaceWin = mc.window('face_Select', mxb = False)
mc.columnLayout( adjustableColumn = True )
mc.intFieldGrp( 'numberOfFaces', label = 'Number Of Facess', value1 = 10 )
ButtonOne = mc.radioButtonGrp( label='Type', labelArray3=['TopFaces', 'Allfaces'], numberOfRadioButtons = 2, onCommand1 = 'firstFace()', onCommand2 = 'lastFace()')
mc.button( label = 'Select faces', command = 'execute()', align = 'center', aop = True)
mc.showWindow('face_Select')
ui()

First ask a question.
Then provide a code with indentation, put Yes and No with comma, check that your functions has a def that exists, command flags that has correct datas and it will be more easy to make you an answer.....
So here is a working code, if you want more explanation, check question about ui I've answered
How to use a slider value in calculations?
import maya.cmds as mc
from functools import partial
def execute(FaceToSel, *args):
option = mc.radioButtonGrp(FaceToSel, q=True, select=True)
if option == 1:
print True
elif option == 2:
print False
def ui():
if mc.window('face_Select', exists = True):
mc.deleteUI('face_Select')
FaceWin = mc.window('face_Select', mxb = False)
mc.columnLayout( adjustableColumn = True )
mc.intFieldGrp( 'numberOfFaces', label = 'Number Of Facess', value1 = 10 )
ButtonOne = mc.radioButtonGrp( label='Type', labelArray2=['TopFaces', 'Allfaces'], numberOfRadioButtons = 2, select=1)
mc.button( label = 'Select faces', command = partial(execute, ButtonOne), align = 'center', aop = True)
mc.showWindow('face_Select')
ui()

Related

how to get focus in TitleText input from npyscreen?

I need to get the focus back to the first input after write and press the enter key in another input. For instance, after enter a value in myPrecio input and press enter i need to get the focus back to myCodigo input, how can i achieve this?
import npyscreen
class MyGrid(npyscreen.GridColTitles):
# You need to override custom_print_cell to manipulate how
# a cell is printed. In this example we change the color of the
# text depending on the string value of cell.
def custom_print_cell(self, actual_cell, cell_display_value):
if cell_display_value =='FAIL':
actual_cell.color = 'DANGER'
elif cell_display_value == 'PASS':
actual_cell.color = 'GOOD'
else:
actual_cell.color = 'DEFAULT'
class nuevoIngreso(npyscreen.FormBaseNew):
def afterEditing(self):
self.parentApp.setNextForm(none)
def create(self):
self.myDepartment = self.add(npyscreen.TitleSelectOne, scroll_exit=True, max_height=3, name='Departmento', values = ['M', 'C', 'L'])
self.myCodigo = self.add(npyscreen.TitleText, name='CODIGO: ')
self.myDescripcion = self.add(npyscreen.TitleText, name='DESCRIPCION: ')
self.myKit = self.add(npyscreen.TitleText, name='UN/KIT: ')
self.myPrecio = self.add(npyscreen.TitleText, name='$/UN')
self.myGrid = self.add(MyGrid,select_whole_line = True,editable = False)
# Adding values to the Grid, this code just randomly
# fills a 2 x 4 grid with random PASS/FAIL strings.
self.myGrid.values = []
for x in range(3):
row = []
for y in range(4):
if bool(random.getrandbits(1)):
row.append("PASS")
else:
row.append("FAIL")
self.myGrid.values.append(row)
class MyApplication(npyscreen.NPSAppManaged):
def onStart(self):
F=self.addForm('MAIN', nuevoIngreso, name='Nuevo Ingreso')
# A real application might define more forms here.......
if __name__ == '__main__':
TestApp = MyApplication().run()
UPDATE: after some test, i added to my code:
self.myPrecio.entry_widget.handlers.update({curses.ascii.CR: self.input_send})
At the end of def Create(self) and i added this function to attach bind to enter key on TitleText widget:
def input_send(self, _input):
#self.myCodigo.editing = False
#self.myDescripcion.editing = False
#self.myKit.editing = False
#self.myGrid.editing = False
#self.myPrecio.editing =
self.display()
self.editw=1
self.myPrecio.editing = False
self.editing = False
self.edit()
Now i can set focus on field myCodigo, but the cursor is also displayed on field myPrecio as follow:

How can I assign a value to a color slider from three menu items in an option menu?

I am doing a rigging tool and I want to assign a different color to the controllers for right and left using a slider. the idea is to select en item from the menu and get the color for that. but for now it is working just the first item and none the others.
My code is inside a class, at this point I have the window, the function to select a joint and a function to change the color. I am querying the selection for the option menu. This information is use by the three conditionals to set a color for each menu item. However, it works just the first option and none the other two. I tried to do the same code but without a class just defining the function and it works. What can I be doing wrong inside the class? I am kind of new in python and this is my first time doing a tool for ringing.
import maya.cmds as cmds
import maya.OpenMaya as om
import maya.mel as mel
import sys
import math
class rigCreator:
def __init__(self, *args):
#self.startFunction()
self.window = "uiWindow"
self.title = "Rigging Tool Bipeds"
self.winSize = (150, 200)
self.createUI()
def createUI(self, *args):
#check if window and prefs exist. If yes, delete
if cmds.window(self.window, ex=True):
cmds.deleteUI(self.window, wnd=True)
elif cmds.windowPref(self.window, ex=True):
cmds.windowPref(self.window, r=True)
self.window = cmds.window(self.window, t=self.title, wh = self.winSize, s=1, mnb=1, mxb=1)
self.mainForm = cmds.formLayout(nd=100)
self.tagLine= cmds.text(label = "Rig Tool")
cmds.frameLayout(label="1. Choose the root joint")
self.Layout = cmds.columnLayout(adj=1)
#Add a saparator to the window
cmds.separator()
# button to select the first joint
cmds.rowColumnLayout (nc = 2, cs=[(1,6), (2,6)])
rootBt = cmds.textField ('rootJnt', tx = 'First joint of your Arm chain', w = 250)
#cmds.textFieldButtonGrp('rootJnt', width=380, cal=(8, "center"), cw3=(100, 200, 75), h=40, pht="First joint of your Arm chain", l="First Joint", bl="Select", bc = lambda x: findJnt(), p=self.Layout)
cmds.button(l = 'Select', c = lambda x:self.findJnt())
cmds.setParent(self.Layout)
frame = cmds.frameLayout("2. Name options", lv=1, li=1, w=250)
#cmds.text(label="", align = "left")
cmds.rowColumnLayout(nc=4, cs=[(1,6), (2,6), (3,6), (4,6)])
#cmds.text('Side', l='Side:')
cmds.optionMenu('Part_Side', l='Side:', cc=lambda x:self.colorChange(), acc=1, ni=1)
cmds.menuItem(label='L_')
cmds.menuItem(label='R_')
cmds.menuItem(label='_')
cmds.text('Part', l='Part:')
cmds.optionMenu('part_Body')
cmds.menuItem(label='Arm')
cmds.menuItem(label='Leg')
cmds.menuItem(label='Spine')
cmds.setParent(self.Layout)
frame2 = cmds.frameLayout("3. Type of rig", lv=True, li=1, w=250)
cmds.rowColumnLayout(nc=3, cs=[(1,6), (2,6), (3,6)])
cmds.radioCollection("limb side")
cmds.radioButton(label='IK/FK', select=True)
cmds.radioButton(label='IK')
cmds.radioButton(label='FK')
cmds.setParent(self.Layout)
frame3 = cmds.frameLayout("4. Thick if you want to apply stretch", lv=True, li=1, w=250)
cmds.rowColumnLayout(nc=1, cs=[(1,6)])
cmds.checkBox( label='Stretchy limb', align='center' )
cmds.setParent(self.Layout)
cmds.setParent(self.Layout)
frame4 = cmds.frameLayout("5. Pick icon color", lv=True, li=1, w=250)
cmds.gridLayout(nr=1, nc=5, cwh=[62,20])
cmds.iconTextButton('darkBlue_Btn', bgc=[.000,.016,.373])
cmds.iconTextButton('lightBlue_Btn', bgc=[0,0,1])
cmds.iconTextButton('Brown_Btn', bgc=[.537,.278,.2])
cmds.iconTextButton('red_Btn', bgc=[1,0,0])
cmds.iconTextButton('Yellow_Btn', bgc=[1,1,0])
cmds.setParent(self.Layout)
colorBt = cmds.colorIndexSliderGrp('rigColor', w=250, h=50, cw2=(150,0), min=0, max=31, v=7)
#This button will creat the chain of joins with streatch and squach
cmds.button('b_create', label='Create', h=30, c='create()')
#show the window
cmds.showWindow(self.window)
def findJnt(self, *args):
self.root = cmds.ls(sl=True)
if len(self.root) == 1:
selRoot = self.root[0]
rootBt = cmds.textField ('rootJnt', e=1, tx=selRoot)
else:
cmds.warning ('Please select only the first joint!')
def colorChange(self, *args):
self.limbSide = cmds.optionMenu('Part_Side', q=1, sl=1)
if self.limbSide ==1:
self.sideColor = 7
if self.limbSide == 2:
self.sideColor = 14
if self.limbSide ==3:
self.sideColor = 18
colorBt = cmds.colorIndexSliderGrp('rigColor', e=1, v=self.sideColor)
def partBody(self, *args):
pass
def rigType(self, *args):
pass
rigCreator()
I did just clean the lambda and comma function and it was working as expected for me.
Because you don't seem to be familiar with maya ui/class, I've cleaned your whole script with some line comments beginning with DW :
So you can find how to manage maya ui more easily !
Don't hesitate to look at partial, I've lots of posts with some tips, hope it helps :
import maya.cmds as cmds
import maya.OpenMaya as om
import maya.mel as mel
import sys
import math
from functools import partial
def create(rigType, sideColor, isStretch, *args):
# DW : refreshed every time by property that is executing before being passed
if rigType == 0:
print('IK/FK mode')
elif rigType == 1:
print('IK mode')
elif rigType == 2:
print('FK mode')
# DW : in this state of the script, it will return always 7 because there is no refresh query
# so you can see to pass outside your class some arguments
# below an example for an alternative of property
print('color picked is {}'.format(sideColor))
# DW : in this example the function for getting the status is passed
# it is different from property because we still use to execute the command
if isStretch():
print('rig is stretchy')
else:
print('no stretch')
# Dw : note that if you create an instance of your window inside a variable :
# ui = rigCreator()
# ui.ikfkPick is something you can print at any moment to debug
# any variable with 'self' would be replaced by 'ui' in this case
class rigCreator:
# DW : default colour, self don't need to be specify but it is like so
# personally I put the important parameters or parameters that set default values on top
# it is easier when parsing the code few month later
sideColor = 7 #: DW : don't hesitate to do inline comment to say this is RED color (im followng google doctstring https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
isStretch = 0
ikfkPick = 0 #: pick IK/FK option, 1 for IK, 2 for FK
def __init__(self, *args):
#self.startFunction()
self.window = "uiWindow"
self.title = "Rigging Tool Bipeds"
self.winSize = (150, 200)
self.createUI()
def createUI(self):
# DW : only put *args if you are using maya command flags, otherwise no need
#check if window and prefs exist. If yes, delete
if cmds.window(self.window, ex=True):
cmds.deleteUI(self.window, wnd=True)
elif cmds.windowPref(self.window, ex=True):
cmds.windowPref(self.window, r=True)
self.window = cmds.window(self.window, t=self.title, wh = self.winSize, s=1, mnb=1, mxb=1)
self.mainForm = cmds.formLayout(nd=100)
self.tagLine= cmds.text(label = "Rig Tool")
cmds.frameLayout(label="1. Choose the root joint")
self.Layout = cmds.columnLayout(adj=1)
#Add a saparator to the window
cmds.separator()
# button to select the first joint
cmds.rowColumnLayout (nc = 2, cs=[(1,6), (2,6)])
self.tf_rootBt = cmds.textField ('rootJnt', tx = 'First joint of your Arm chain', w = 250)
#cmds.textFieldButtonGrp('rootJnt', width=380, cal=(8, "center"), cw3=(100, 200, 75), h=40, pht="First joint of your Arm chain", l="First Joint", bl="Select", bc = lambda x: findJnt(), p=self.Layout)
# DW : use lambda only to parse arguments, the better way to not make confusion is to use partial module
cmds.button(l = 'Select', c = self.findJnt)
cmds.setParent(self.Layout)
frame = cmds.frameLayout("2. Name options", lv=1, li=1, w=250)
#cmds.text(label="", align = "left")
cmds.rowColumnLayout(nc=4, cs=[(1,6), (2,6), (3,6), (4,6)])
#cmds.text('Side', l='Side:')
# DW : string naming can be dangerous, if another script create this type of name, it will conflict
# put your ctrl name into a variable or a class variable if you are using it somewhere else
# Same don't use lambda if you are not parsing arguments
self.om_partside = cmds.optionMenu('Part_Side', l='Side:', cc=self.colorChange, acc=1, ni=1)
cmds.menuItem(label='L_')
cmds.menuItem(label='R_')
cmds.menuItem(label='_')
cmds.text('Part', l='Part:')
cmds.optionMenu('part_Body')
cmds.menuItem(label='Arm')
cmds.menuItem(label='Leg')
cmds.menuItem(label='Spine')
cmds.setParent(self.Layout)
frame2 = cmds.frameLayout("3. Type of rig", lv=True, li=1, w=250)
cmds.rowColumnLayout(nc=3, cs=[(1,6), (2,6), (3,6)])
# DW :conforming to the default user settings on top of the class
# demonstrate property in class
self.rc_ikfk = cmds.radioCollection("limb side")
for x, lb in enumerate(['IK/FK', 'IK', 'FK']):
if x == self.ikfkPick:
defvalue = True
else:
defvalue = False
cmds.radioButton(label=lb, select=defvalue)
cmds.setParent(self.Layout)
frame3 = cmds.frameLayout("4. Thick if you want to apply stretch", lv=True, li=1, w=250)
cmds.rowColumnLayout(nc=1, cs=[(1,6)])
# DW : adding default value, class variable naming
self.ckb_stretch = cmds.checkBox( label='Stretchy limb', align='center', value=self.isStretch, cc=self.getStretch)
cmds.setParent(self.Layout)
cmds.setParent(self.Layout)
frame4 = cmds.frameLayout("5. Pick icon color", lv=True, li=1, w=250)
cmds.gridLayout(nr=1, nc=5, cwh=[62,20])
cmds.iconTextButton('darkBlue_Btn', bgc=[.000,.016,.373])
cmds.iconTextButton('lightBlue_Btn', bgc=[0,0,1])
cmds.iconTextButton('Brown_Btn', bgc=[.537,.278,.2])
cmds.iconTextButton('red_Btn', bgc=[1,0,0])
cmds.iconTextButton('Yellow_Btn', bgc=[1,1,0])
cmds.setParent(self.Layout)
self.sl_colorBt = cmds.colorIndexSliderGrp('rigColor', w=250, h=50, cw2=(150,0), min=0, max=31, v= self.sideColor)
#This button will creat the chain of joins with streatch and squach
# DW : never use comma for executing some function, if you use this script as a module afterward, you will have problems dealing with python namespacing
# maya is always passing a default argument True, so put *args in any command that is used by your ui controls
cmds.button('b_create', label='Create', h=30, c=partial(create, self.rigType, self.sideColor, self.getStretch))
#show the window
cmds.showWindow(self.window)
def findJnt(self, *args):
self.root = cmds.ls(sl=True, type='joint', l=True)
# DW : just becaue I was toying around the concept of root, sorry... ignor below
rootAbove = [i for i in self.root[0].split('|')[1:] if cmds.nodeType(i) == 'joint']
if rootAbove[0] != self.root[0].split('|')[-1]:
cmds.warning('you didn\'t choose the top joint !')
if len(self.root) == 1:
selRoot = self.root[0]
# DW : you dont have to store your edit, use class variable instead of string name
cmds.textField (self.tf_rootBt, e=1, tx=selRoot.split('|')[-1])
else:
cmds.warning ('Please select only the first joint!')
def colorChange(self, *args):
# DW : you don't need to put self on limbSide has you are not using it anywhere else
limbSide = cmds.optionMenu(self.om_partside, q=1, sl=1)
# DW : putting some elif
if limbSide == 1:
self.sideColor = 7
elif limbSide == 2:
self.sideColor = 14
elif limbSide ==3:
self.sideColor = 18
# DW : conforming editing controls
cmds.colorIndexSliderGrp(self.sl_colorBt, e=1, v=self.sideColor)
def partBody(self, *args):
pass
#property
def rigType(self):
'''Returns:
int: option selected in ui'''
# DW : demonstrating property usage and partial
rb = cmds.radioCollection(self.rc_ikfk, q=True, select=True)
cia = [i.split('|')[-1] for i in cmds.radioCollection(self.rc_ikfk, q=True, cia=True)]
return cia.index(rb)
def getStretch(self, *args):
"""function to get if the user need stretchy things
Note:
*args is just here to bypass maya default added True argument
Returns:
bool: use stretch or not
"""
# dw making some example function with some docstring
self.isStretch = cmds.checkBox(self.ckb_stretch, q=True, value=True)
return self.isStretch
rigCreator()

Maya Python referencing optionMenu returns as non-existent

I am trying to write a script that, on button press with a joint selected, will copy the transform values from the selected joint(s) and then create a controller selected from an option menu. My problem is getting the code to read the option menu. I've tried several variations and all say there is no option menu with the selected name.
Code follows....
import maya.cmds as maya
def testWin():
winName = maya.window(title="test", rtf = True, mxb = False)
maya.columnLayout()
maya.button(label = "run test", c = "test()")
shapeMenu = maya.optionMenu( label='Shape Menu', changeCommand="test()" )
maya.menuItem( label='Circle' )
maya.menuItem( label='Square' )
maya.menuItem( label='Triangle' )
maya.showWindow(winName)
testWin()
def test():
sel = maya.ls(type = "joint", sl=True)
if not sel:
print "select at least 1 JOINT"
else:
new_pos = maya.xform(q=True, t=True, ws=True)
new_rot = maya.xform(q=True, rotation=True, ws=True)
shape = maya.optionMenu("Shape Menu", q = True, value = True)
if shape == "Circle":
new_control = maya.circle(center = new_pos)
elif shape == "Square":
new_control = maya.nurbsSquare(center = new_pos)
elif shape == "Triangle":
new_control = maya.circle(center = new_pos, degree = 1, sections = 3)
You can't be sure that maya will give you the name you asked for when creating a GUI object -- an in this case it will never work because the name that comes back will not have the space.
You should capture the name of the option menu by returning the value of shapeMenu from your testWin() function then use that in your test() function

Pop up warning box

I have a method that checks that a pyqt spinbox value has been entered, the required values are 1 through 18 inclusive so I initiate the spinbox with the value 0 so that I can easily tell its not been changed to the correct number. I thought that if the check finds its still 0 the user forget to set it and a warning pops up to let them know..
The problem I have is that the window pops up, user presses OK, the pop up closes but immediately opens again before the user has had time to set the correct value ... how can I have the pop up close and allow the user time to change the spinbox to the correct value before it checks for 0 and pops up again (if still not correct)
the signal that triggers group_check was originally triggering the pickFile method until I realised that the code executed whether Group No was set in the spinbox or not, I had tried to build the check into the pickFile method but then though it might be best to separate it out.
import sys
import time
from PyQt4 import QtGui, uic
import xlrd
import csv
import os
import re
qtCreatorFile = "UI1.ui" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class MyApp(QtGui.QMainWindow, Ui_MainWindow):
group = ''
group_1 = ''
Var_1 = ''
Var_2 = ''
Var_3 = ''
error_string = ''
def __init__(self):
QtGui.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.file_picker_button.clicked.connect(self.group_check)
self.radioButton_1.clicked.connect(self.onRadioButton1)
self.radioButton_2.clicked.connect(self.onRadioButton2)
self.radioButton_3.clicked.connect(self.onRadioButton3)
self.spinBox.valueChanged.connect(self.valuechange)
def group_check(self):
while True:
if self.spinBox.value() == 0:
error_string ='You must select your\nGroup No first ! ok ? '
self.error_msg(error_string)
else:
self.pickFile()
def pickFile(self):
while True:
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '.')
if 'Monday' in filename:
break
elif 'Monday' not in filename or filename == '':
error_string ='Wrong file ? \nWant to try again ?'
self.error_msg1(error_string)
else:
self.filename = filename
x = first_file()
x.csv_from_excel(filename)
def onRadioButton1(self, group):
MyApp.Var_1 = 'PGDE SECONDARY ONLY'
MyApp.Var_2 = 'MA4 ONLY'
MyApp.Var_3 = 'PGDE'
def onRadioButton2(self, group):
MyApp.Var_1 = 'PGDE PRIMARY ONLY'
MyApp.Var_2 = 'MA4 ONLY'
MyApp.Var_3 = 'PGDE'
def onRadioButton3(self, group):
MyApp.Var_1 = 'PGDE PRIMARY ONLY'
MyApp.Var_2 = 'PGDE SECONDARY ONLY'
MyApp.Var_3 = 'MA4'
def valuechange(self, value):
MyApp.group_1 = ('Group '+ str(self.spinBox.value()))
if self.spinBox.value() >= 10:
MyApp.group = "1-9 ONLY"
if self.spinBox.value() >= 1 and self.spinBox.value() <= 9:
MyApp.group = "10-18 ONLY"
def error_msg(self, error_string):
choice = QtGui.QMessageBox.question(self, 'Error!', error_string)
Instead of using while True just display the error message and return from the function. Make them click the button again after they fix the error
def group_check(self):
if self.spinBox.value() == 0:
error_string ='You must select your\nGroup No first ! ok ? '
self.error_msg(error_string)
return
self.pickFile()

Python - Calling to a function within a method from another class

I'm using Python inside of Autodesk Maya but this should apply anywhere.
I have a class called bRigUI and it inherits from another class called wingUtils inside of the file wingUtilities.py
I can get to the self.gPrefix / etc. names by using inheritance. But I don't know how to get to the functions inside of the function that's inside of the class such as def cName(txt):
Here is the wingUtilities script:
import maya.cmds as cmds
class wingUtils():
def __init__(self):
pass
def wingUtil(self, *args):
self.gPrefix = cmds.textField(self.prefixField, q = True, text = True)
self.lPrefix = cmds.textField(self.leftPrefixField, q = True, text = True)
self.rPrefix = cmds.textField(self.rightPrefixField, q = True, text = True)
def cName(txt):
n = self.gPrefix + (txt)
def lName(txt):
n = self.gPrefix + self.lPrefix + (txt)
def rName(txt):
n = self.gPrefix + self.rPrefix + (txt)
w = wingUtils()
And here is a VERY dumbed down UI script that is trying to call it (and is also the class with the inheritance) - this script wont work, it's just a shell to show you what I'm doing without all the clutter.
import maya.cmds as cmds
import jtWingRigAutomation.wingUtilities as wingUtilities
reload(wingUtilities)
class bRigUI(wingUtilities.wingUtils):
def __init__(self):
bRigUI = 'bRigUI'
if cmds.window(bRigUI, exists = True):
cmds.deleteUI(bRigUI)
bRigUI = cmds.window('bRigUI', title = 'JT Wing Rig Automation')
form = cmds.formLayout()
tabs = cmds.tabLayout(innerMarginWidth = 5, innerMarginHeight = 5)
cmds.formLayout(form, e = True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0)))
tab2 = cmds.rowColumnLayout('Wing Setup', parent = tabs)
cmds.text(self.naming(), parent = tab2)
cmds.showWindow(bRigUI)
cmds.window(bRigUI, e = True, w = 250, h = 500)
b = bRigUI()
What do I enter in the UI script to call to the function cName within the method within the wingUtils class?
You can't. cName is a local variable which only exists within the function context of wingUtils.wingUtil, and is only accessible via code within that function.
The only way would be to move the inner functions to the outer scope. Do you have a good reason for them to be function-internal? If so, there's no way to do what you want. Otherwise you may consider rewriting that class. Currently the three functions cName(), lName() and rName() do absolutely nothing, because no code can call them from outside, and they're not being called inside. In this case it's as easy as unindenting them, and adding self:
class wingUtils():
def __init__(self):
pass
def wingUtil(self, *args):
self.gPrefix = cmds.textField(self.prefixField, q = True, text = True)
self.lPrefix = cmds.textField(self.leftPrefixField, q = True, text = True)
self.rPrefix = cmds.textField(self.rightPrefixField, q = True, text = True)
def cName(self, txt):
n = self.gPrefix + (txt)
def lName(self, txt):
n = self.gPrefix + self.lPrefix + (txt)
def rName(self, txt):
n = self.gPrefix + self.rPrefix + (txt)

Categories