本文整理汇总了Python中pymel.core.selected函数的典型用法代码示例。如果您正苦于以下问题:Python selected函数的具体用法?Python selected怎么用?Python selected使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了selected函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: export
def export(self, dirpath, all=False, center=True, child=True):
if os.path.isfile(self.opts['presetFile']):
pm.mel.FBXLoadExportPresetFile(f=self.opts['presetFile'])
ext = '.fbx'
if all:
pm.select(self.meshList.getAllItems())
sel = pm.selected()
else:
sel = pm.selected()
if len(sel) == 0:
pm.warning('Nothing is selected!')
else:
for obj in sel:
pm.select(obj)
if center:
oldLoc = obj.getRotatePivot()
self.centerPiv(obj)
exportPath = self._get_filename(dirpath, obj.name(), ext)
if child:
children = obj.getChildren()
for i in children:
if isinstance(i, pm.nt.Transform):
pm.select(i, add=True)
pm.mel.FBXExport(f=exportPath, s=True)
if center:
obj.setTranslation([oldLoc[0], oldLoc[1], oldLoc[2]])
开发者ID:cmcpasserby,项目名称:pbUDK,代码行数:28,代码来源:pbUDK.py
示例2: createLocToCenter
def createLocToCenter():
old_selection = pymel.selected()
p3Pos = get_center(pymel.selected(flatten=True))
pPoint = pymel.general.spaceLocator()
pPoint.setTranslation(p3Pos, space='world')
if old_selection:
pymel.select(old_selection)
开发者ID:SqueezeStudioAnimation,项目名称:omtk,代码行数:7,代码来源:libUtils.py
示例3: create_new_pose_prompt
def create_new_pose_prompt(self):
if not pm.selected():
pm.warning ("Please Select an Object")
return
namespace = pm.selected()[0].split(":")[0]
targetObj = "%s:geo"%(namespace)
result = pm.promptDialog(
title='Create New Pose',
message='Enter Pose Name:',
button=['OK', 'Cancel'],
defaultButton='OK',
cancelButton='Cancel',
dismissString='Cancel')
if result == 'OK':
name = pm.promptDialog(query=True, text=True)
directory = self.get_active_directory()
path = os.path.join(directory, "%s.pose" %name)
pose_obj = Pose(path)
pose_obj.create()
pose_obj.save_pose()
pose_obj.update_thumbnail(targetObj)
self.populate_library_layout()
开发者ID:adamfok,项目名称:afok_toolset,代码行数:28,代码来源:pixo_poseLibrary.py
示例4: save_set
def save_set(self):
if not pm.selected():
pm.warning ("Please Select an Object")
return
selected = [obj.name().split(":")[-1] for obj in pm.selected()]
with open(self.set_path, 'w') as outfile:
json.dump(selected, outfile, separators=(',',':'))
开发者ID:adamfok,项目名称:afok_toolset,代码行数:9,代码来源:pixo_poseLibrary.py
示例5: one_cam_to_shots
def one_cam_to_shots():
if not pm.ls(type='shot'):
raise RuntimeError('There are no Shots in this scene.')
if len(pm.selected()) != 1 or pm.selected()[0].getShape().type() != 'camera':
raise RuntimeError('Select just 1 camera.')
the_cam = pm.selected()[0]
for shot in pm.ls(type='shot'):
shot.set_camera(the_cam)
开发者ID:eoyilmaz,项目名称:anima,代码行数:11,代码来源:previs.py
示例6: snapPivot
def snapPivot(self):
haircap = self.capName.getText()
oldSel = pm.selected()
self.transform()
if pm.objExists(haircap):
geo = pm.ls(haircap)[0]
for sel in pm.selected():
point = geo.getClosestPoint(sel.getTranslation())
pm.move( point[0][0], point[0][1], point[0][2], sel)
pm.select(oldSel)
else: pm.error('hair cap doesnt exist in scene')
开发者ID:aaronfang,项目名称:personal_scripts,代码行数:11,代码来源:hairGrabber2.py
示例7: selectSkinnedJoints
def selectSkinnedJoints(node=None):
'''
selects all joints bound to the specified node
'''
if node==None:
if len(pmc.selected())==1:
node=pmc.selected()[0]
else:
return 'Please select or specify a skinCluster node'
influences = pmc.skinCluster(node, q=1, influence=1)
pmc.select(influences)
开发者ID:duncanrudd,项目名称:rooftops,代码行数:12,代码来源:common.py
示例8: library_button_save_pose
def library_button_save_pose(self, obj):
if not pm.selected():
pm.warning ("Please Select an Object")
return
namespace = pm.selected()[0].split(":")[0]
targetObj = "%s:geo"%(namespace)
obj.save_pose()
obj.update_thumbnail(targetObj)
self.populate_library_layout()
开发者ID:adamfok,项目名称:afok_toolset,代码行数:12,代码来源:pixo_poseLibrary.py
示例9: create_ribbon_callback
def create_ribbon_callback(self, *args):
startObj = None
endObj = None
if len(pm.selected()) == 2:
startObj = pm.selected()[0]
endObj = pm.selected()[-1]
prefix = self.widgets["prefix_textField"].getText()
numJoints = self.widgets["numJoint_intField"].getValue()[0]
numSpans = self.widgets["spans_intField"].getValue()[0]
utils.create_ribbon(numJoints=numJoints, prefix=prefix, numSpans=numSpans, startObj=startObj, endObj=endObj)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:14,代码来源:ribbon_tool.py
示例10: create_BTN_pressed
def create_BTN_pressed(self):
ctrl_suffix = self.widgets['suffix_TFG'].getText()
create_offsetNode = self.widgets['offsetNode_CB'].getValue()
offsetNode_suffix = self.widgets['offsetNode_TF'].getText()
create_cluster = self.widgets['cluster_CB'].getValue()
cluster_group = self.widgets['clusterGroup_RBG'].getSelect()
create_shape = self.widgets['shape_CB'].getValue()
shape_type = self.widgets['shape_TSL'].getSelectItem()[0]
shape_axis = self.widgets['shapeAxis_OM'].getValue()
hierarchy = self.widgets['hierarchry_RB'].getSelect()
tConst = self.widgets['tConst_CB'].getValue()
rConst = self.widgets['rConst_CB'].getValue()
pConst = self.widgets['pConst_CB'].getValue()
sConst = self.widgets['sConst_CB'].getValue()
clusterHandles = []
if create_cluster:
if cluster_group == 1: #each
for obj in pm.selected():
c, hdl = pm.cluster(obj, name='%s_cluster'%obj.name())
clusterHandles.append(hdl)
elif cluster_group == 2: #all
c, hdl = pm.cluster(pm.selected())
clusterHandles.append(hdl)
ctrls = []
objects = clusterHandles or pm.selected()
for i, obj in enumerate(objects):
ctrlName = "%s_%s" %(obj.name(), ctrl_suffix)
ctrl = obj.add_ctrl(name=ctrlName, point=tConst, orient=rConst, scale=sConst, parent=pConst)
ctrls.append(ctrl)
if hierarchy == 2 and i != 0: #selectionOrder
pm.parent(ctrl, ctrls[ i-1 ])
if create_offsetNode:
ctrl.add_parent_group(suffix=offsetNode_suffix)
if create_shape:
ctrl.add_shape(shape=shape_type, axis=shape_axis)
开发者ID:pombredanne,项目名称:pixo_rigging_dev,代码行数:49,代码来源:controller_tool.py
示例11: getSkinBones
def getSkinBones():
aInfluences = []
for oCurObj in pymel.selected():
oSkinCluster = getSkinCluster(oCurObj)
if oSkinCluster is not None:
aInfluences += libSkinning.get_skin_cluster_influence_objects(oSkinCluster)
pymel.select(aInfluences)
开发者ID:SqueezeStudioAnimation,项目名称:omtk,代码行数:7,代码来源:libUtils.py
示例12: zero_out_bend
def zero_out_bend(**kwargs):
"""
Zero out all the bend joint
Here we assume it already has a optimised rotate order
- joint_list: (list) List of joint to zero out te bend
- axis: (str) Which axis is the joint bending
- rotate_order: (str) What is the current rotate order
@return the rotate order
"""
joint_list = libUtilities.pyList(kwargs.get("joint_list") or get_joint_children(pm.selected()[0]))
libUtilities.freeze_rotation(joint_list)
libUtilities.freeze_scale(joint_list)
rotate_order = kwargs.get("rotate_order") or joint_list[0].rotateOrder.get(asString=True)
target_axis = kwargs.get("axis", rotate_order[0])
new_rotate_order = None
if target_axis != rotate_order[0]:
new_rotate_order = "{}{}{}".format(target_axis, rotate_order[0], rotate_order[2])
pm.undoInfo(openChunk=True)
for joint in joint_list:
for rotate_axis in rotate_order:
if rotate_axis != target_axis:
joint.attr("jointOrient{}".format(rotate_axis.upper())).set(0)
if new_rotate_order:
joint.rotateOrder.set(new_rotate_order)
pm.undoInfo(closeChunk=True)
return new_rotate_order
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:26,代码来源:libJoint.py
示例13: printSelection
def printSelection(longNames=True):
"""Print the selection in an organized, numbered list"""
selList = pm.selected()
print '\n//{0} Nodes Selected'.format(len(selList))
nameMethod = None
if longNames:
nameMethod = 'longName'
else:
nameMethod = 'name'
maxLen = 0
for obj in selList:
if hasattr(obj, nameMethod):
name = getattr(obj, nameMethod)()
else:
name = obj.name()
if len(name) > maxLen:
maxLen = len(name)
for i in range(len(selList)):
obj = selList[i]
typ = pm.nodeType(obj)
if hasattr(obj, nameMethod):
name = getattr(obj, nameMethod)()
else:
name = obj.name()
print '{index:03}. {name:<{maxLen}} - {type}'.format(index=i, name=name, type=typ, maxLen=maxLen)
开发者ID:bohdon,项目名称:boTools,代码行数:27,代码来源:utils.py
示例14: init
def init(discard=False):
selection = pm.selected()
if len(selection) != 1:
print 'Must select one object'
else:
selection = selection[0]
uuid = cmds.ls(selection.name(), uuid=True)[0]
#bn = BridgedNode(uuid)
#bn = BRIDGE_NODE
if BRIDGE_NODE.uuid == None:
BRIDGE_NODE.uuid = uuid
BRIDGE_NODE.ingest()
if discard:
BRIDGE_NODE.erase_history()
if BRIDGE_NODE.is_valid():
if BRIDGE_NODE.has_history():
print '> file has history. opening source.'
else:
BRIDGE_NODE.dump_geo()
BRIDGE_NODE.dump_metadata()
else:
BRIDGE_NODE.dump_geo()
BRIDGE_NODE.dump_metadata()
open_port(PORT)
BRIDGE_NODE.edit_in_app()
开发者ID:woelper,项目名称:maya_edit_outside,代码行数:29,代码来源:m2b.py
示例15: fixedSeed
def fixedSeed():
sel = pm.selected()
animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
for attr in sel:
animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
xVal = attr.rotateX.get()
yVal = attr.rotateY.get()
zVal = attr.rotateZ.get()
print animStartTime
print animEndTime
print xVal
print yVal
print zVal
while animStartTime<=animEndTime:
attr.rotateX.set(xVal+random.uniform(-.1,.1))
attr.rotateY.set(yVal+random.uniform(-.1,.1))
attr.rotateZ.set(zVal+random.uniform(-.1,.1))
pm.setKeyframe(attribute="rotate", time=animStartTime)
animStartTime+=1
开发者ID:maitelels,项目名称:maya_scripts,代码行数:26,代码来源:tim_bakeJitter.py
示例16: align_selected_joints_to_active_view
def align_selected_joints_to_active_view(default_cam='persp'):
sel = pymel.selected()
cam = get_active_camera()
if not cam:
pymel.warning("Can't find active camera, will use {0}.".format(default_cam))
cam = pymel.PyNode(default_cam)
align_joints_to_view(sel, cam)
开发者ID:renaudll,项目名称:omtk,代码行数:7,代码来源:libRigging.py
示例17: remove_cache_tag
def remove_cache_tag(self, *args):
selection = pm.selected()
if selection:
for obj in selection:
try:
if pm.objExists(obj + ".arc_renderable"):
pm.deleteAttr(obj, at='arc_renderable')
self.log.insertText(" %s%s\n" %('Remove arc_renderable Tag'.ljust(40, "."), obj))
except:
self.log.insertText(" %s%s\n" %('Unable To Remove arc_renderable Tag'.ljust(40, "."), obj))
try:
self.cacheSet.remove(obj)
self.tempSet.add(obj)
except:
pass
#===============================================================================
#
# class CheckGeoTags(Check):
# def __init__(self):
# super(CheckGeoTags, self).__init__()
#
# self.main_button_label = "Geometry Tags"
# self.options_label = "Geo Tags Options"
# self.options = True
#
# def check(self, *args):
# status = True
# objs = []
# log = "Checking Geometry Tags... \n"
#
# pm.select('md', hi=True)
# all_geos = pm.ls(sl=True, type='mesh')
#
# attrs = ['objectName', 'arc_full_path', 'arc_master_path', 'tagName', 'arc_renderable']
#
# for geo in all_geos:
# for attr in attrs:
# geo_attr = '%s.%s'%(geo, attr)
# if not pm.objExists(geo_attr):
# log += " %s%s\n"%(geo_attr.ljust(40, '.'), "FAIL")
# status = False
# if geo not in objs:
# objs.append(geo)
#
# return [status, objs, log]
#
# def options_buttons(self, *args):
# pm.button(label = "Add Tag", c=self.add_control_tag)
#
# def add_control_tag(self, *args):
# selection = pm.selected()
# if selection:
# for obj in selection:
# pm.addAttr(obj, ln='ClientAnimCtrl', at="bool")
# print "Added ClientAnimCtrl tag to %s" %obj
#
#
#===============================================================================
开发者ID:adamfok,项目名称:afok_toolset,代码行数:60,代码来源:asset_check_tool.py
示例18: convert_hierarchies_main
def convert_hierarchies_main(settings=SETTINGS_DEFAULT):
nodes = pmc.selected(type='transform')
if not nodes:
pmc.warning('No transforms selected.')
return
new_roots = convert_hierarchies(nodes, settings)
print 'Created:', ','.join([r.name() for r in new_roots])
开发者ID:AdricEpic,项目名称:practicalmayapython,代码行数:7,代码来源:charcreator.py
示例19: lock_child
def lock_child(self):
selection = pm.selected()
child_locker = pm.createNode("transform", name="PKD_child_locker")
child_joint = pm.listRelatives(self.joint)[0]
pm.parentConstraint(child_locker, child_joint, maintainOffset=True)
if selection:
pm.select(selection)
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:7,代码来源:gui.py
示例20: createMiddleCrv
def createMiddleCrv( curves=[], parameter=0.5 ):
'''
update : 2015-04-24
'''
if curves:
curves = pm.select(curves)
curves = pm.selected()
if not curves:
raise
surface, loft = pm.loft(
curves,
ch = True,
uniform = True,
close = False,
autoReverse = True,
degree = 3,
sectionSpans = 1,
range = False,
polygon=0, # 0: nurbs surface
# 1: polygon (use nurbsToPolygonsPref to set the parameters for the conversion)
# 2: subdivision surface (use nurbsToSubdivPref to set the parameters for the conversion)
# 3: Bezier surface
# 4: subdivision surface solid (use nurbsToSubdivPref to set the parameters for the conversion)
reverseSurfaceNormals = True )
dupCrv, crvFromSurf = pm.duplicateCurve( surface.getShape().v[ parameter ], ch=True, range=False, local=False )
pm.delete( surface, loft, crvFromSurf )
dupCrv = pm.PyNode( dupCrv )
dupCrv.rename('middleCrv#')
return dupCrv
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:33,代码来源:curve.py
注:本文中的pymel.core.selected函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论