Python pymel.core.confirmDialog() Examples
The following are 20
code examples of pymel.core.confirmDialog().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pymel.core
, or try the search function
.
Example #1
Source File: previs.py From anima with MIT License | 6 votes |
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.')
Example #2
Source File: _visGroup.py From fossil with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #3
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 6 votes |
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()
Example #4
Source File: previs.py From anima with MIT License | 6 votes |
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.')
Example #5
Source File: previs.py From anima with MIT License | 6 votes |
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.')
Example #6
Source File: previs.py From anima with MIT License | 6 votes |
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.')
Example #7
Source File: previs.py From anima with MIT License | 6 votes |
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.')
Example #8
Source File: previs.py From anima with MIT License | 6 votes |
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)
Example #9
Source File: previs.py From anima with MIT License | 6 votes |
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.')
Example #10
Source File: auxiliary.py From anima with MIT License | 6 votes |
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'
Example #11
Source File: auxiliary.py From anima with MIT License | 6 votes |
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
Example #12
Source File: transform.py From SISideBar with MIT License | 5 votes |
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()
Example #13
Source File: previs.py From anima with MIT License | 5 votes |
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')
Example #14
Source File: previs.py From anima with MIT License | 5 votes |
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
Example #15
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 5 votes |
def onResetManipPositions(self, nodeName): # First, show manips to update manip count self.onEditManipulators(nodeName) res = pm.confirmDialog( title='Confirm reset positions', message='Are you sure you want to reset the manipulators positions?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' ) if res == "Yes": pm.select( clear=True ) node = pm.PyNode(nodeName) curve = node.inputCurve handles = node.curveAxisHandle if len(curve.connections()) == 1: curveNode = curve.connections()[0] maxParam = curveNode.findParamFromLength(curveNode.length()) count = min(node.curveAxisHandleCount.get(), handles.numElements()) index = 0 for h in handles: if index < count: h.children()[0].set(index * maxParam / float(count)) index = index + 1 pm.select(nodeName) pm.runtime.ShowManipulators()
Example #16
Source File: __init__.py From mgear_core with MIT License | 5 votes |
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')
Example #17
Source File: render.py From anima with MIT License | 4 votes |
def export_shader_assignments_to_houdini(cls): """Exports shader assignments to Houdini via a JSON file. Use the Houdini counterpart to import the assignment data """ # get the shaders from viewport selection shaders = [] for node in pm.selected(): shape = node.getShape() shading_engines = shape.outputs(type=pm.nt.ShadingEngine) for shading_engine in shading_engines: inputs = shading_engine.surfaceShader.inputs() for shader in inputs: shaders.append(shader) # get the shapes for each shader shader_assignments = {} for shader in shaders: shader_name = shader.name() shading_engines = shader.outputs(type=pm.nt.ShadingEngine) if not shading_engines: continue shading_engine = shading_engines[0] shader_assignments[shader_name] = [] assigned_nodes = pm.sets(shading_engine, q=1) for assigned_node in assigned_nodes: shape = assigned_node.node() # get the full path of the shape shape_full_path = shape.fullPath().replace('|', '/') shader_assignments[shader_name].append(shape_full_path) # write data try: import json with open(cls.shader_data_temp_file_path, 'w') as f: json.dump(shader_assignments, f, indent=4) except BaseException as e: pm.confirmDialog( title='Error', message="%s" % e, button='OK' ) else: pm.confirmDialog( title='Successful', message="Shader Data exported successfully!", button='OK' )
Example #18
Source File: auxiliary.py From anima with MIT License | 4 votes |
def perform_playblast_shot(shot_name): """Performs shot playblast, this is written to replace the menu action in Camera Sequencer. :param shot_name: Shot name :return: """ response = pm.confirmDialog( title='Perform Playblast?', message='Perform Playblast?', button=['Yes', 'No'], defaultButton='No', cancelButton='No', dismissString='No' ) if response == 'No': return # ask resolution resolution = ask_playblast_resolution() if resolution is None: return extra_playblast_options = { 'viewer': 1, 'percent': resolution } shot = pm.PyNode(shot_name) pb = Playblaster() video_file_output = pb.playblast_shot( shot, extra_playblast_options=extra_playblast_options ) response = pm.confirmDialog( title='Upload To Server?', message='Upload To Server?', button=['Yes', 'No'], defaultButton='No', cancelButton='No', dismissString='No' ) if response == 'Yes': pb.upload_output(pb.version, video_file_output)
Example #19
Source File: auxiliary.py From anima with MIT License | 4 votes |
def perform_playblast(action): """the patched version of the original perform playblast """ # check if the current scene is a Stalker related version print('called anima.env.mayaEnv.auxiliary.perform_playblast(%s)' % action) # if not call the default playblast # if it is call out ShotPlayblaster from anima.env.mayaEnv import Maya m = Maya() v = m.get_current_version() if v: # do playblaster pb = Playblaster() extra_playblast_options = { 'viewer': 1 } # ask playblast format playblast_format = ask_playblast_format() if playblast_format == 'image': extra_playblast_options['fmt'] = 'image' extra_playblast_options['compression'] = 'png' # ask resolution resolution = ask_playblast_resolution() if resolution is None: return extra_playblast_options['percent'] = resolution outputs = pb.playblast( extra_playblast_options=extra_playblast_options ) response = pm.confirmDialog( title='Upload To Server?', message='Upload To Server?', button=['Yes', 'No'], defaultButton='No', cancelButton='No', dismissString='No' ) if response == 'Yes': for output in outputs: pb.upload_output(pb.version, output) else: # call the original playblast return pm.mel.eval('performPlayblast_orig(%s);' % action)
Example #20
Source File: auxiliary.py From anima with MIT License | 4 votes |
def run_pre_publishers(): """runs pre publishers if the current scene is a published version This is written to prevent users to save on top of a Published version and create a back door to skip un publishable scene to publish """ from anima.env import mayaEnv m_env = mayaEnv.Maya() version = m_env.get_current_version() # check if we have a proper version if not version: return # check if it is a Representation from anima.representation import Representation if Representation.repr_separator in version.take_name: return if version.is_published: from anima.publish import (run_publishers, staging, PRE_PUBLISHER_TYPE, POST_PUBLISHER_TYPE) # before doing anything run all publishers type_name = '' if version.task.type: type_name = version.task.type.name # before running use the staging area to store the current version staging['version'] = version run_publishers(type_name) # do not forget to clean up the staging area staging.clear() else: # run some of the publishers from anima.env.mayaEnv.publish import PublishError from anima.env.mayaEnv import publish as publish_scripts try: publish_scripts.check_node_names_with_bad_characters() except PublishError as e: # pop up a message box with the error pm.confirmDialog( title='SaveError', message=str(''.join([i for i in unicode(e) if ord(i) < 128])), button=['Ok'] ) raise e # update updated_by field of the current version from stalker import LocalSession ls = LocalSession() logged_in_user = ls.logged_in_user if logged_in_user: version.updated_by = logged_in_user from stalker.db.session import DBSession DBSession.commit()