本文整理汇总了Python中pymel.core.setParent函数的典型用法代码示例。如果您正苦于以下问题:Python setParent函数的具体用法?Python setParent怎么用?Python setParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setParent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gui
def gui():
'''
creates the gui for the tool
'''
win = 'uvtools'
if(pm.window(win, ex = True)):
pm.deleteUI(win)
if(pm.windowPref(win, ex = True)):
pm.windowPref(win, remove = True)
global scroll_list, dyn_uis
myWin = pm.window(win, title='Anim UV Tool' , sizeable = True, mnb = True, width = 500, height = 400, backgroundColor= [.68,.68,.68])
pm.scrollLayout(width= 500)
pm.button(label= 'Creates Nodes', command= create_nodes, width= 500)
row_layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= [[1, 150], [2, 10], [3, 340]])
pm.columnLayout(adjustableColumn= False, width=150)
scroll_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(create_ui))
pm.button(label= 'List Nodes', command= list_nodes, width= 148)
pm.setParent(row_layout)
pm.text(label= '')
dyn_uis = pm.columnLayout(adjustableColumn= False, width= 340)
# listing the nodes at start up
list_nodes()
myWin.show()
示例2: __init__
def __init__(self, questions_file):
self.file = open(questions_file, 'r')
self.questions = self.file.readlines()
self.file.close()
self.main_layout = pm.columnLayout()
self.name_field = pm.textFieldGrp(label= 'Quiz Name')
self.layout = pm.rowColumnLayout(numberOfColumns= 2,
columnWidth= ([1, 75], [2, 475]))
pm.columnLayout()
pm.text(label= 'Questions')
self.question_scroll_list = pm.textScrollList(width= 60, height= 400,
selectCommand= pm.Callback(self.read_questions),
allowMultiSelection= True)
pm.setParent(self.layout)
pm.columnLayout()
pm.text(label= 'Questions Info')
self.question_scroll_field = pm.scrollField(wordWrap= True,
height= 400, width= 475)
pm.setParent(self.main_layout)
pm.button(label= 'Create Quiz', command= pm.Callback(self.create_quiz),
width= 550, height= 50)
self.list_questions()
示例3: show
def show(self):
self.window = pm.window(self.name, wh=(self.w, self.h), title=self.name)
self.fl = pm.formLayout(nd=100)
#create the main form layout of the window
self.frame_layout = pm.frameLayout(bgc=(.3,.1,.25), li=self.w/4, la='center', fn='boldLabelFont',
label='AW Binary Proxy Tools', borderStyle='in', mh=self.h/12,h=self.h-40)
self.cl = pm.columnLayout(adj=True, cal='left', cat=['both',0], rs=5)
pm.text(label='mip_renderProxy Creation', al='center')
pm.button (label='Create Render Proxies', bgc=(.4,.5,.2),
command= lambda *args: self._createRenderProxy( pm.ls(sl=True) ))
pm.separator(st='doubleDash', h=25)
pm.text(label='mip_renderProxy Assignment', al='center')
self.fileInput = TextFieldBrowserInput( width=300, name='Proxy Input', option_name='Proxy Browse Type', options=['from file', 'from folder'], button_name='Browse', parent=self.cl )
pm.button (label='Assign Render Proxies', bgc=(.4,.5,.2),
command= lambda *args: self._attachRenderProxy( pm.ls(sl=True) ))
pm.button (label='DELETE ALL BINARY PROXIES', bgc=(.4, .2, .2), command=self._removeAllBipx)
pm.setParent('..')
pm.setParent('..')
#add the close window button
self.close_btn = pm.button (w=self.bw, label='Close', bgc = (.4, .2, .2), command=self.close_UI)
#finalize form layout
pm.formLayout(self.fl, edit=True,
attachForm = [(self.frame_layout, 'top', 0),
(self.frame_layout, 'left', 0),
(self.frame_layout, 'right', 0),
(self.close_btn, 'bottom', 10),
(self.close_btn, 'right', 10)])
pm.showWindow(self.window)
示例4: loadDriven
def loadDriven(self, *args):
"""
Load object name for driven object in text field
"""
sel = pm.ls(sl=True, fl=True)
pm.textFieldButtonGrp(self.drivenField, edit=True, text=sel[0])
# Clear the menu items so list doesn't grow
items = pm.optionMenu(self.drivenAttField, q=True, ill=True)
if(items):
pm.setParent(self.drivenAttField, menu=True)
for each in items:
pm.deleteUI(each)
# Check if blendshape
if 'BlendShape' in str(type(sel[0])):
bs = sel[0]
temp = pm.aliasAttr(bs, q=1)
temp.sort()
targets = []
for each in temp:
if each.startswith('weight'): continue
targets.append(each)
for tgt in targets:
try:
pm.menuItem(parent=self.drivenAttField, label=tgt)
except Exception, e:
print e
pm.warning('%s failed to create / connect' % tgt)
示例5: __init__
def __init__(self, template):
self.template = template
self.win = "arnold_filter_list_win"
if pm.window(self.win, exists=True):
pm.deleteUI(self.win)
pm.window(self.win, title="Add Light Filter",
sizeable=False,
resizeToFitChildren=True)
#pm.windowPref(removeAll=True)
pm.columnLayout(adjustableColumn=True,
columnOffset=("both", 10),
#columnAttach=('both',1),
rowSpacing=10)
self.scrollList = pm.textScrollList('alf_filter_list', nr=4, ams=False)
pm.textScrollList(self.scrollList,
e=True,
doubleClickCommand=Callback(self.addFilterAndHide))
for label, nodeType in self.filters():
pm.textScrollList(self.scrollList, edit=True, append=label)
pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center"))
pm.button(width=100, label="Add", command=Callback(self.addFilterAndHide))
pm.button(width=100, label="Cancel", command=Callback(pm.deleteUI, self.win, window=True))
pm.setParent('..')
pm.setParent('..')
pm.showWindow(self.win)
示例6: leftInfo_area
def leftInfo_area():
rightInfo_layout = pm.rowColumnLayout(nr=1) # ral=[[1, 'right'], [2, 'right']]
global refresh_btn
refresh_btn = pm.button(l='Refresh', al='center', w=150, h=45, bgc=primary_componentColor, c=refreshWindow, ann='Refresh the interface when lights are deleted or not showing up') # NOT CONNECTED
pm.setParent(info_layout)
示例7: _categoryUpdated
def _categoryUpdated(self, add=None, rename=None, delete=None):
_pmCore.setParent(self._uiWidget[_UiWidgetEnum.categoryTabLayout])
if add:
# Add a tab in main asset view.
childLayout = _pmCore.scrollLayout(width=300, height=200, childResizable=True)
self._uiWidget[add] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize)
_pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], tabLabel=((childLayout, add),), edit=True)
# Add a menu item in category list. From example in Maya doc optionMenuGrp.
newMenuItem = _pmCore.menuItem(label=add, parent=self._uiWidget[_UiWidgetEnum.categoryCombox]+'|OptionMenu')
self._uiWidget[_UiWidgetEnum.categoryMenuList].append(newMenuItem)
if rename:
tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True)
childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True)
_pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], edit=True, tabLabel=((childLayoutList[tabNameList.index(rename[0])], rename[1])))
for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]:
if _pmCore.menuItem(item, query=True, label=True) != rename[0]:
continue
_pmCore.menuItem(item, edit=True, label=rename[1])
break
if delete:
tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True)
childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True)
_pmCore.deleteUI(childLayoutList[tabNameList.index(delete)])
for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]:
if _pmCore.menuItem(item, query=True, label=True) != delete:
continue
_pmCore.deleteUI(item)
break
示例8: UI_custom
def UI_custom(self):
numJoints = len(self.jointInfo)
pm.rowLayout(numberOfColumns = 2, columnWidth = [1, 100], adjustableColumn = 2)
pm.text(label = "Number of Joints: ")
self.numberOfJointsField = pm.intField(value = numJoints, minValue = 2, changeCommand = self.ChangeNumberOfJoints)
pm.setParent('..')
joints = self.GetJoints()
self.CreateRotationOrderUIControl(joints[0])
pm.separator(style = 'in')
pm.text(label = "Orientation: ", align = "left")
pm.rowLayout(numberOfColumns = 3)
pm.attrEnumOptionMenu(attribute = "%s:module_grp.sao_local" %self.moduleNamespace, label = "Local: ")
pm.text(label = " will be oriented to ")
pm.attrEnumOptionMenu(attribute = "%s:module_grp.sao_world" %self.moduleNamespace, label = "World: ")
pm.setParent('..')
pm.separator(style = 'in')
interpolating = False
if pm.objExists("%s:interpolation_container" %self.moduleNamespace):
interpolating = True
pm.rowLayout(numberOfColumns = 2, columnWidth = [1, 80], adjustableColumn = 2)
pm.text(label = "Interpolate: ")
pm.checkBox(label = "", value = interpolating, onCommand = partial(self.SetupInterpolation, True), offCommand = self.DeleteInterpolation)
示例9: create_ui
def create_ui(* args):
'''
# this creates the ui for the selected light from the scrollField
'''
# dictionary for class
# the script get the light type each type is a key
# and based on that it will pick which class to instance
light_classes = {'spotLight': lights.Light_spot,
'directionalLight': lights.Light_directional,
'ambientLight': lights.Light_ambient,
'areaLight': lights.Light_area,
'pointLight': lights.Light_point,
'volumeLight': lights.Light_volume}
selected = scroll_list.getSelectItem()
global lights_dict
global obj_ui_list
# deleteting existing ui objects
for obj in obj_ui_list:
try:
obj.delete()
except:
pass
for sel in selected:
pm.setParent(ui_row)
# getting the node type
obj_type = pm.nodeType('%s' % (lights_dict[u'%s' %(str(sel))]))
# using the ^^ dictionarry to instance the appropritate class
light = light_classes[obj_type](light= '%s' % (sel)).create()
# appending that object to the global objects list
obj_ui_list.append(light)
示例10: __init__
def __init__(self):
self.parti_nodes = []
self.scene_lights = []
self.parti_lights = []
self.parti_dict = {}
self.parti_lights_dict = {}
self.scene_lights_dict = {}
pm.columnLayout(adjustableColumn= True)
main = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,180],
[2, 180], [3,180]))
pm.columnLayout(adjustableColumn= True)
pm.text(label= 'Parti Volumes')
self.parti_scroll = pm.textScrollList(width= 180, height= 125,
selectCommand = pm.Callback(self.get_input_lights))
pm.button(label= 'Refresh', command= pm.Callback(self.refresh_nodes))
pm.setParent('..')
pm.columnLayout(adjustableColumn= True)
pm.text(label= 'Parti Lights')
self.parti_light_scroll = pm.textScrollList(width= 180, height= 125)
pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 90], [2, 90]))
pm.button(label= '+', command= pm.Callback(self.add_light))
pm.button(label= '-', command= pm.Callback(self.remove_light))
pm.setParent(main)
pm.columnLayout(adjustableColumn= True)
pm.text(label= 'Scene Lights')
self.light_scroll = pm.textScrollList(width= 180, height= 125)
pm.button(label= 'Refresh', command= pm.Callback(self.refresh_lights))
self.refresh_lights()
self.refresh_nodes()
示例11: aiHyperShadeCreateMenu_BuildMenu
def aiHyperShadeCreateMenu_BuildMenu():
"""
Function: aiHyperShadeCreateMenu_BuildMenu()
Purpose: Builds menu items for creating arnold nodes, organized
into submenus by category.
Notes: When this function is invoked, it is inside of the Create menu.
This function mimics the buildCreateSubmenu() function in
hyperShadePanel.mel, and in fact calls that function with a slightly
different set of arguments than the other Maya node types. For
arnold nodes, the menu items are set up to call back to the
aiCreateCustomNode() function for node creation.
"""
# build a submenu for each node category
#
for (staticClass, runtimeClass, nodePath, nodeTypes) in getTypeInfo():
# skip unclassified
if staticClass == 'rendernode/arnold' or staticClass == 'rendernode/arnold/shader':
continue
pm.menuItem(label = nodePath.replace('/', ' '),
tearOff = True, subMenu = True)
# call buildCreateSubMenu() to create the menu entries. The specified
# creation command is aiCreateCustomNode runtimeClassification. The
# buildCreateSubMenu will append to that argument list the name of the
# node type, thereby completing the correct argument list for the
# creation routine.
#
pm.mel.buildCreateSubMenu(staticClass, '%s %s ""' % (_createNodeCallbackProc,
runtimeClass) )
pm.setParent('..', menu=True)
示例12: create_ui
def create_ui(*args):
'''
creates uis for the selected node from the text scroll list
'''
selected = scroll_list.getSelectItem()
print selected
global obj_list
print obj_list
for obj in obj_list:
# try except in case ui was already deleted or could not be found
try:
# deleting the uis
obj.delete_ui()
obj.delete_obj()
except:
continue
# clearign the list
obj_list = []
for sel in selected:
# setting parent to the appropriate layout
pm.setParent(dyn_uis)
my_ui = Node_UI(node='%s' %(sel)) # creating instance
my_ui.create() # invoking create
my_ui.toggle_vis() # toggling visibilty
obj_list.append(my_ui) # appending to global list
示例13: _buildWidgets
def _buildWidgets( self, parent ):
for field in self.optionmodel.fields:
pm.setParent( parent )
if hasattr( field, 'updateWidget'):
field.buildWidget( changeCommand=lambda * args: ( self._updateOptions(), self._updateWidgets() ) )
elif hasattr( field, 'buildWidget'):
field.buildWidget()
示例14: populate_selection_layout
def populate_selection_layout(self):
pm.setParent(self.widgets['selectionSet_vertical'])
self.widgets['selectionSet_vertical'].clear()
treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True)
if not treeViewSelected:
return
pm.scrollLayout(cr=True)
path = os.path.abspath(treeViewSelected[0])
set_paths = []
for dir in os.listdir(path):
if dir.find(self.library_objects_suffix[2]) != -1: #.set
set_paths.append(os.path.abspath(os.path.join(path, dir)))
for set_path in set_paths:
print "create button"
set_obj = Set(set_path)
infos = set_obj.get_info()
label = infos['name'].split('.')[0]
pm.iconTextButton(style='textOnly',label=label, c=pm.Callback(self.selection_set_button_load, set_obj))
pm.popupMenu()
pm.menuItem(label='Save Pose', c=pm.Callback(self.selection_set_button_save, set_obj))
pm.menuItem(label='Load Pose', c=pm.Callback(self.selection_set_button_load, set_obj))
self.widgets["selectionSet_vertical"].redistribute()
示例15: __init__
def __init__(self):
'''
# class to sort and give info on shaders
'''
self.layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth=([1, 150],
[2, 150], [3, 250]))
pm.columnLayout()
pm.text(label= 'Shaders')
self.shader_list = pm.textScrollList(width= 150, height= 200,
selectCommand= pm.Callback(self.update_connections_list))
pm.button(label= 'Refresh', width= 150,
command= pm.Callback(self.update_shader_list))
pm.setParent(self.layout)
pm.columnLayout()
pm.text(label='Connections')
self.connections_list = pm.textScrollList(width= 150, height= 200,
selectCommand= pm.Callback(self.write_info))
self.check_box = pm.checkBox(label= 'Select Node')
pm.setParent(self.layout)
pm.columnLayout()
pm.text(label='Node Info')
self.info_field = pm.scrollField(wordWrap= True, width= 250, height= 200)
self.attr_check_box = pm.checkBox(label= 'Show All')
self.update_shader_list()