本文整理汇总了Python中pymel.core.confirmDialog方法的典型用法代码示例。如果您正苦于以下问题:Python core.confirmDialog方法的具体用法?Python core.confirmDialog怎么用?Python core.confirmDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymel.core
的用法示例。
在下文中一共展示了core.confirmDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ask_playblast_resolution
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def ask_playblast_resolution():
"""Asks the user the playblast resolution
"""
# ask resolution
response = pm.confirmDialog(
title='Resolution?',
message='Resolution?',
button=['Default', 'Full', 'Half', 'Quarter', 'Cancel'],
defaultButton='Default',
cancelButton='Default',
dismissString='Default'
)
if response == 'Default':
return 50
elif response == 'Full':
return 100
elif response == 'Half':
return 50
elif response == 'Quarter':
return 25
elif response == 'Cancel':
return None
return 50
示例2: ask_playblast_format
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def ask_playblast_format():
"""asks the user the playblast format
"""
# ask resolution
response = pm.confirmDialog(
title='Format?',
message='Format?',
button=['QuickTime', 'PNG'],
defaultButton='QuickTime',
cancelButton='QuickTime',
dismissString='QuickTime'
)
if response == 'QuickTime':
return 'qt'
elif response == 'PNG':
return 'image'
示例3: check_camera_assignment
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_camera_assignment(self):
"""all shots must have cameras assigned to them
"""
shots = self.shot_list
shots_without_camera = []
for shot in shots:
try:
shot.get_camera()
if str(shot.get_camera()) in ['persp', 'top', 'side', 'front']:
shots_without_camera.append(shot)
except:
shots_without_camera.append(shot)
if shots_without_camera:
message = 'No Cameras assigned to shots:\r\n'
message += '\r'
for shot in shots_without_camera:
message += 'shot %s\n' % (shot.getShotName())
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('No Cameras assigned to some shots.')
示例4: check_wrong_shot_names
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_wrong_shot_names(self):
"""check if all shots have correct shot names
"""
shots = self.shot_list
shots_with_bad_names = []
for shot in shots:
if len(shot.getShotName()) != 4 or shot.getShotName().isnumeric() is not True:
shots_with_bad_names.append(shot)
if shots_with_bad_names:
message = 'Wrong Shot Names:\r\n'
message += '\r'
for shot in shots_with_bad_names:
message += '%s - %s\n' % (shot.getName(), shot.getShotName())
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError(message)
示例5: check_unique_shot_names
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_unique_shot_names(self):
"""check if all shots have unique shot names
"""
shots = self.shot_list
shot_names = []
shots_without_unique_names = []
for shot in shots:
if shot.getShotName() not in shot_names:
shot_names.append(shot.getShotName())
else:
shots_without_unique_names.append(shot.getShotName())
if shots_without_unique_names:
message = 'More than 1 shot Numbered as:\r\n'
message += '\r'
for shot_name in shots_without_unique_names:
message += 'shot [ %s ]\n' % shot_name
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('Non-Unique Shot Names.')
示例6: check_shot_overlapping
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_shot_overlapping(self):
"""check if any shots are overlapping
"""
shots_sorted = self.shots_descending
if len(shots_sorted) > 1:
overlapping_shots = []
ind = 0
for shot in shots_sorted:
ind += 1
start = shots_sorted[ind].getSequenceStartTime()
end = shot.getSequenceEndTime()
if end >= start:
overlapping_shots.append('%s & %s' % (shot, shots_sorted[ind]))
if ind == (len(shots_sorted)-1):
break
if overlapping_shots:
message = 'Overlapped Shots:\r\n'
message += '\r'
for shots_info in overlapping_shots:
message += '[ %s ] are overlapping\n' % shots_info
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('There Are overlapping shots in Sequencer.')
示例7: check_shot_gaps
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_shot_gaps(self):
"""check if there are any gaps between shots
"""
min_frame = self.sequencer.getAttr('minFrame')
max_frame = self.sequencer.getAttr('maxFrame')
seq_length = (max_frame - min_frame) + 1
shot_length = 0
shots = self.shot_list
for shot in shots:
start_frame = shot.getAttr('startFrame')
end_frame = shot.getAttr('endFrame')
shot_length += (end_frame - start_frame) + 1
if seq_length != shot_length:
message = 'There are Gaps between shots:\r\n'
message += '\r'
message += 'Please fix gaps from Camera Sequencer.\r\n'
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('There are gaps between Shot Nodes.')
示例8: check_shot_attributes
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_shot_attributes(self):
"""check some of mandatory attributes
"""
shots_with_bad_attrs = []
attrs = {
'scale': 1.0,
'preHold': 0.0,
'postHold': 0.0
}
shots = self.shot_list
for shot in shots:
for item in attrs.iteritems():
value = shot.getAttr(item[0])
if value != item[1]:
shots_with_bad_attrs.append([shot, item[0], value, item[1]])
if shots_with_bad_attrs:
message = 'Shots below have restricted values for shot attrs:\r\n'
message += '\r'
for info in shots_with_bad_attrs:
message += '[ %s ] - %s | su an %s -> %s olmali\n' % (info[0], info[1], info[2], info[3])
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('There Are restricted values in Shot Nodes.')
示例9: check_stalker_tasks
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_stalker_tasks(self):
"""check if all shots have proper stalker tasks
"""
shot_tasks = self.scene_shot_tasks
shots = self.shot_list
shots_without_task = []
for shot in shots:
check = 0
for t in shot_tasks:
if shot.getShotName() == t.nice_name.split('_')[-1]:
check = 1
else:
pass
if check == 0:
shots_without_task.append(shot)
if shots_without_task:
message = 'Shots do not have a Task to save:\r\n'
message += '\r'
for shot in shots_without_task:
message += 'shot [ %s ]\n' % (shot.getShotName())
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('Some Shots do not have Stalker Tasks.')
示例10: onResetManipAngles
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def onResetManipAngles(self, nodeName):
# First, show manips to update manip count
self.onEditManipulators(nodeName)
res = pm.confirmDialog( title='Confirm reset angles', message='Are you sure you want to reset the manipulators angles?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
if res == "Yes":
pm.select( clear=True )
node = pm.PyNode(nodeName)
handles = node.curveAxisHandle
count = min(node.curveAxisHandleCount.get(), handles.numElements())
index = 0
for h in handles:
if index < count:
h.children()[1].set(0.0)
index = index + 1
pm.select(nodeName)
pm.runtime.ShowManipulators()
示例11: tagMain
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def tagMain(self):
obj = selected()[0]
main = ls('*.' + core.findNode.MAIN_CONTROL_TAG)
if main:
# Already tagged as main
if main[0].node() == obj:
return
if confirmDialog( m='{} is already tagged, are you sure want to make {} the main?'.format(main[0].node(), obj),
b=['Yes', 'No'] ) == 'Yes':
main[0].node().deleteAttr(core.findNode.MAIN_CONTROL_TAG)
else:
return
core.findNode.tagAsMain(obj)
self.update()
示例12: set_joint_orient
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def set_joint_orient(reset=True):
from . import sisidebar_sub
joints = cmds.ls(sl=True, type='joint')
if len(joints) == 0:
confirm_mes = lang.Lang(
en='Joint is not selected\nDo you want to process all the joints in the scene? ',
ja=u'ジョイントが選択されていません\nシーン内のすべてのジョイントを処理しますか?'
)
rtn = pm.cmds.confirmDialog(title='Confirm', message=confirm_mes.output(), button=['Yes', 'No'], defaultButton='Yes',
cancelButton='No', dismissString='No')
if rtn != 'Yes':
return False
joints = cmds.ls('*', type='joint')
if len(joints) == 0:
pm.confirmDialog(title='Warning', message='Joint Object Nothing.', button='OK', icon='Warning')
return False
for j in joints:
# マトリックス取得
mat = cmds.xform(j, q=True, m=True)
# 回転とジョイントの方向をいったん0に
cmds.rotate(0, 0, 0, j, objectSpace=True)
cmds.joint(j, e=True, orientation=[0, 0, 0])
# マトリックス再設定、回転のみに数値が入る。
cmds.xform(j, m=mat)
if reset:
# 回転取得
rot = cmds.xform(j, q=True, ro=True)
# 回転を0にしてジョイントの方向に同じ値を移す
cmds.rotate(0, 0, 0, j, objectSpace=True)
cmds.joint(j, e=True, orientation=rot)
sisidebar_sub.get_matrix()
示例13: aboutMgear
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def aboutMgear(*args):
"""About mgear"""
version = mgear.getVersion()
note = """
mGear version: {}
MGEAR is under the terms of the MIT License
Copyright (c) 2011-2018 Jeremie Passerin, Miquel Campos
Copyright (c) 2018-2019 The mGear-Dev Organization
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
""".format(version)
pm.confirmDialog(title='About mGear', message=note, button=["OK"],
defaultButton='OK', cancelButton='OK', dismissString='OK')
示例14: check_shot_seq_ranges
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def check_shot_seq_ranges(self):
shots_with_bad_frame_range = []
shots = self.shots_descending
for shot in shots:
shot_s_fr = shot.getStartTime()
shot_e_fr = shot.getEndTime()
seq_s_fr = shot.getSequenceStartTime()
seq_e_fr = shot.getSequenceEndTime()
if shot_s_fr != seq_s_fr or shot_e_fr != seq_e_fr:
shots_with_bad_frame_range.append(shot)
if shots_with_bad_frame_range:
message = 'Shots below does NOT have equal shot/seq frame ranges :\r\n'
message += '\r'
for shot in shots_with_bad_frame_range:
message += '[ %s ]\n' % shot
message += '\r\n'
message += 'Generally we do Not prefer this in our Projects.\r'
message += '\r\n'
message += 'Is this on Purpose for Edit?\r'
dialog = pm.confirmDialog(title='Important Warning',
message=message,
button=['On Purpose', 'No, I will Fix it'])
if dialog == 'On Purpose':
pass
else:
raise RuntimeError('Editorial Error in Sequencer')
示例15: pre_publish_previs
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import confirmDialog [as 别名]
def pre_publish_previs(self):
"""checks if all necessities are met for exporting previs to animation shots
"""
if not pm.ls(type='shot'):
message = 'No Shots exist in this scene.\r\n'
message += '\r'
pm.confirmDialog(title='Error', message=message, button='OK')
raise RuntimeError('Non-Existing Shots.')
self.set_sequencer_name()
self.set_range_from_seq()
self.check_camera_assignment()
self.check_shot_attributes()
self.check_wrong_shot_names()
self.check_unique_shot_names()
self.check_shot_seq_ranges()
self.check_shot_overlapping()
self.check_shot_order()
self.check_shot_gaps()
self.check_stalker_tasks()
# from anima.publish import run_publishers
# run_publishers('previs') # DetachedInstanceError: attribute refresh operation cannot proceed
import anima.env.mayaEnv.publish as oy_publish
oy_publish.check_sequencer()
oy_publish.check_shot_nodes()
oy_publish.check_sequence_name()
oy_publish.check_sequence_name_format()
oy_publish.check_shot_name_format()
oy_publish.check_unique_shot_names()
oy_publish.check_frame_range_selection()
message = 'Publish Check SUCCESSFUL.\r\n'
message += '\r'
ok = pm.confirmDialog(title='Info', message=message, button='OK, Continue')
if ok == 'OK, Continue':
pass