本文整理匯總了Python中pymel.core.select方法的典型用法代碼示例。如果您正苦於以下問題:Python core.select方法的具體用法?Python core.select怎麽用?Python core.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymel.core
的用法示例。
在下文中一共展示了core.select方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _event_edtFrame_changed
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def _event_edtFrame_changed(self, iRow):
"""
Manage a frame change in the frame info table
"""
pCellQLine = self.ui.tblFrameInfo.cellWidget(iRow, self.ID_COL_FRAME)
if pCellQLine.text() != "":
pCellFrame = self.ui.tblFrameInfo.item(iRow, self.ID_COL_FRAME)
iOldFrame = pCellFrame.data(QtCore.Qt.UserRole)
# pCellParent = self.ui.tblFrameInfo.item(iRow, self.ID_COL_PARENT)
# iParentIdx = pCellParent.data(QtCore.Qt.UserRole)
iNewFrame = int(pCellQLine.text())
# Prevent the user to move a key on a frame already constrained
if not (iNewFrame in self.aConstrainedFrame):
self.pSelSpSys.moveKey(iNewFrame, iOldFrame)
self._update_tblFrameInfo(self.pSelSpSys)
else:
pCellQLine.setText(str(iOldFrame))
pymel.select(self.nSelDriven)
示例2: gear_curvecns_op
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def gear_curvecns_op(crv, inputs=[]):
"""
create mGear curvecns node.
Arguments:
crv (nurbsCurve): Nurbs curve.
inputs (List of dagNodes): Input object to drive the curve. Should be
same number as crv points.
Also the order should be the same as the points
Returns:
pyNode: The curvecns node.
"""
pm.select(crv)
node = pm.deformer(type="mgear_curveCns")[0]
for i, item in enumerate(inputs):
pm.connectAttr(item + ".worldMatrix", node + ".inputs[%s]" % i)
return node
示例3: controllerWalkUp
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def controllerWalkUp(node, add=False):
"""Walk up in the hierachy using the controller tag
Arguments:
node (dagNode or list of dagNode): Node with controller tag
add (bool, optional): If true add to selection
"""
oParent = []
if not isinstance(node, list):
node = [node]
for n in node:
tag = getWalkTag(n)
if tag:
cnx = tag.parent.connections()
if cnx:
oParent.append(cnx[0])
else:
pm.displayWarning("The selected object: %s without Controller tag "
"will be skipped" % n.name())
if oParent:
pm.select(_getControllerWalkNodes(oParent), add=add)
else:
pm.displayWarning("No parent to walk Up.")
示例4: transformWalkUp
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def transformWalkUp(node, add=False):
"""Walks to the parent transform dagNode on the hierarcy
Arguments:
node (dagNode or list of dagNode): dagNode to walk
add (bool, optional): if True, will add to the selection
"""
oParent = []
if not isinstance(node, list):
node = [node]
for n in node:
p = n.listRelatives(p=True)
if p:
oParent.append(p)
if oParent:
pm.select(oParent, add=add)
else:
pm.displayWarning("No parent to walk Up.")
示例5: transformWalkDown
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def transformWalkDown(node, add=False, multi=False):
"""Walks to the child transform dagNode on the hierarcy
Arguments:
node (dagNode or list of dagNode): dagNode to walk
add (bool, optional): if True, will add to the selection
multi (bool, optional): if True will select all the childrens
"""
oChild = []
if not isinstance(node, list):
node = [node]
for n in node:
relatives = n.listRelatives(typ='transform')
if relatives:
if multi:
oChild = oChild + relatives
else:
oChild.append(relatives[0])
if oChild:
pm.select(oChild, add=add)
else:
pm.displayWarning("No child to walk Down.")
示例6: transformWalkRight
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def transformWalkRight(node, add=False, multi=False):
"""Pick walks to the right the next sibling transform on the hierarchy
Arguments:
node (dagNode or list of dagNode): dagNode transform to navegate
the hierarchy
add (bool, optional): If true add to selection
multi (bool, optional): If true, selects all the siblings
"""
sib = _getTransformWalkSiblings(node, "right", multi)
pm.select(sib, add=add)
# =====================================================
# Walk mirror
示例7: select_all_child_controls
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def select_all_child_controls(control, *args): # @unusedVariable
""" Selects all child controls from the given control
This function uses Maya's controller nodes and commands to find relevant
dependencies between controls
Args:
control (str): parent animation control (transform node)
*args: State of the menu item (if existing) send by mgear's dagmenu
"""
# gets controller node from the given control. Returns if none is found
tag = cmds.ls(cmds.listConnections(control), type="controller")
if not tag:
return
# query child controls
children = get_all_tag_children(tag)
# adds to current selection the children elements
cmds.select(children, add=True)
示例8: setup_stretchy_spline_ik_curve
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def setup_stretchy_spline_ik_curve(cls):
"""
"""
selection = pm.ls(sl=1)
curve = selection[0]
curve_info = pm.createNode("curveInfo")
mult_div = pm.createNode("multiplyDivide")
curve_shape = pm.listRelatives(curve, s=1)
curve_shape[0].worldSpace >> curve_info.ic
curve_info.arcLength >> mult_div.input1X
curve_length = curve_info.arcLength.get()
mult_div.input2X.set(curve_length)
mult_div.operation.set(2)
pm.select(mult_div, curve_info, curve_shape[0], add=True)
示例9: finalize_setup
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def finalize_setup(self):
"""does final clean up
"""
self.check_main_control()
# group the node together
parent_group = pm.nt.Transform(name='SquashStretchBendRiggerGroup#')
pm.parent(self.main_control.getParent(), parent_group)
pm.parent(self.aim_locator1, parent_group)
if self.use_squash:
pm.parent(self.squash_handle, parent_group)
pm.parent(self.bend_handle, parent_group)
# set visibilities
self.aim_locator1.v.set(0)
if self.use_squash:
self.squash_handle.v.set(0)
self.bend_handle.v.set(0)
# as a gesture select the main control
pm.select(self.main_control)
示例10: assign_random_material_color
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def assign_random_material_color(cls):
"""assigns a lambert with a random color to the selected object
"""
selected = pm.selected()
# create the lambert material
lambert = pm.shadingNode('lambert', asShader=1)
# create the shading engine
shading_engine = pm.nt.ShadingEngine()
lambert.outColor >> shading_engine.surfaceShader
# randomize the lambert color
import random
h = random.random() # 0-1
s = random.random() * 0.5 + 0.25 # 0.25-0.75
v = random.random() * 0.5 + 0.5 # 0.5 - 1
from anima.utils import hsv_to_rgb
r, g, b = hsv_to_rgb(h, s, v)
lambert.color.set(r, g, b)
pm.sets(shading_engine, fe=selected)
pm.select(selected)
示例11: check_sequence_name
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def check_sequence_name(progress_controller=None):
"""Sequence name is properly set
checks if the sequence name attribute is properly set
"""
if progress_controller is None:
progress_controller = ProgressControllerBase()
# do not consider referenced shot nodes
shots = pm.ls(type='shot')
progress_controller.maximum = len(shots)
shot = None
for s in shots:
if s.referenceFile() is None:
shot = s
break
progress_controller.increment()
progress_controller.complete()
sequencer = shot.outputs(type='sequencer')[0]
sequence_name = sequencer.sequence_name.get()
if sequence_name == '' or sequence_name is None:
pm.select(sequencer)
raise PublishError('Please enter a sequence name!!!')
示例12: jobReloadUI
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def jobReloadUI(self, *args):
""" This scriptJob active when we got one new scene in order to reload the UI.
"""
import maya.cmds as cmds
cmds.select(clear=True)
cmds.evalDeferred("import sys; sys.modules['dpAutoRigSystem.dpAutoRig'].DP_AutoRig_UI()", lowestPriority=True)
示例13: populateJoints
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def populateJoints(self, *args):
""" This function is responsable to list all joints or only dpAR joints in the interface in order to use in skinning.
"""
# get current jointType (all or just dpAutoRig joints):
jntSelectedRadioButton = cmds.radioCollection(self.allUIs["jntCollection"], query=True, select=True)
chooseJnt = cmds.radioButton(jntSelectedRadioButton, query=True, annotation=True)
# list joints to be populated:
jointList, sortedJointList = [], []
allJointList = cmds.ls(selection=False, type="joint")
if chooseJnt == "allJoints":
jointList = allJointList
cmds.checkBox(self.allUIs["_JntCB"], edit=True, enable=False)
cmds.checkBox(self.allUIs["_JisCB"], edit=True, enable=False)
elif chooseJnt == "dpARJoints":
cmds.checkBox(self.allUIs["_JntCB"], edit=True, enable=True)
cmds.checkBox(self.allUIs["_JisCB"], edit=True, enable=True)
displayJnt = cmds.checkBox(self.allUIs["_JntCB"], query=True, value=True)
displayJis = cmds.checkBox(self.allUIs["_JisCB"], query=True, value=True)
for jointNode in allJointList:
if cmds.objExists(jointNode+'.'+BASE_NAME+'joint'):
if displayJnt:
if "_Jnt" in jointNode:
jointList.append(jointNode)
if displayJis:
if "_Jis" in jointNode:
jointList.append(jointNode)
# sort joints by name filter:
jointName = cmds.textField(self.allUIs["jointNameTF"], query=True, text=True)
if jointList:
if jointName:
sortedJointList = utils.filterName(jointName, jointList, " ")
else:
sortedJointList = jointList
# populate the list:
cmds.textScrollList( self.allUIs["jntTextScrollLayout"], edit=True, removeAll=True)
cmds.textScrollList( self.allUIs["jntTextScrollLayout"], edit=True, append=sortedJointList)
# atualize of footerB text:
self.atualizeSkinFooter()
示例14: reloadPopulatedGeoms
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def reloadPopulatedGeoms(self, *args):
""" This function reloads the list all selected geometries in the interface in order to use in skinning if necessary.
"""
# store current selected items in the geometry list to skin:
geomSelectedList = cmds.textScrollList( self.allUIs["modelsTextScrollLayout"], query=True, selectItem=True)
# populate again the list of geometries:
self.populateGeoms()
# re-select the old selected items in the list if possible:
if geomSelectedList:
try:
cmds.textScrollList( self.allUIs["modelsTextScrollLayout"], edit=True, selectItem=geomSelectedList)
except:
pass
示例15: mousePressEventEdt
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import select [as 別名]
def mousePressEventEdt(self, event, iCol=0, iRow=0):
if event.button() == QtCore.Qt.RightButton:
pCell = self.ui.tblData.item(iRow,iCol)
pData = pCell.data(QtCore.Qt.UserRole) #Attr set function
menu = QtWidgets.QMenu()
action_sel_child = menu.addAction('Select Child')
action_sel_child.triggered.connect(partial(pymel.select, pData.nChildLoc))
action_sel_parent = menu.addAction('Select Parent');
action_sel_parent.triggered.connect(partial(pymel.select, pData.nParentLoc))
action_sel_parent = menu.addAction('Select Bones');
action_sel_parent.triggered.connect(partial(pymel.select, [pData.nParent, pData.nChild]))
action_sel_parent = menu.addAction('Delete');
action_sel_parent.triggered.connect(partial(self.deleteSystem, pData))
menu.exec_(QtGui.QCursor.pos())