blob: 66f625b0b14278d1061ca67e1107cf5eeedb1ad5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# -*- coding: utf-8 -*-
"""
:author:
Jeremy Ernst
:description:
This module contains functions for raising errors or warnings, depending on if the tools are being run in batch mode
or in testing mode, or neither (normal mode.
There are also classes for displaying widgets showing the error or warning message.
"""
import maya.cmds as cmds
import artv2.utilities.interface_utilities as interface_utils
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def raise_error(message):
"""
Shows a widget (QMessageBox) with the error message if the tools are not being run in batch or test mode. Otherwise,
it will just raise a normal RuntimeError with the message.
:param message: Detailed message describing the error.
"""
if not cmds.about(batch=True):
if cmds.optionVar(exists="ARTv2_RUNNING_TESTS") == 0:
inst = interface_utils.ErrorWidget(message)
inst.exec_()
else:
raise RuntimeError(message)
else:
raise RuntimeError(message)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def inform_user(message, details):
"""
Shows a widget (QMessageBox) with the given message if the tools are not being run in batch or test mode.
:param message: Generalized message describing the information to relay to the user.
:param details: Detailed information related to the message
"""
if not cmds.about(batch=True):
if cmds.optionVar(exists="ARTv2_RUNNING_TESTS") == 0:
inst = interface_utils.InfoWidget(message, details=details)
inst.exec_()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def report_issues(issues):
"""
Reports the given dependency issues to the user.
:param issues: List of strings of components who have been affected by an operation.
"""
message = "Some components have had their parent set to the root joint due to dependencies.\n"
details = ""
for each in issues:
details += each
inform_user(message, details)
|