Skip to content

Commit 46af940

Browse files
authored
#42764 added support for more error messages in tooltips (#48)
Added support for more error messages in tooltips for 3dsMax, Houdini, Nuke and Photoshop.
1 parent bec920d commit 46af940

11 files changed

+52
-38
lines changed

hooks/tk-multi-publish2/3dsmax.basic/publish_max_session.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,14 @@ def validate(self, settings, item):
196196
if not path:
197197
# the session still requires saving. provide a save button.
198198
# validation fails.
199+
session_error_message = "The Max session has not been saved."
199200
self.logger.error(
200-
"The Max session has not been saved.",
201+
session_error_message,
201202
extra=_get_save_as_action()
202203
)
203-
return False
204+
205+
# this exception should be cought by plugin.py run_validate() and propagate to tree_node_task.py validate()
206+
raise Exception(session_error_message)
204207

205208
# get the path in a normalized state. no trailing separator,
206209
# separators are appropriate for current os, no double separators,
@@ -254,8 +257,10 @@ def validate(self, settings, item):
254257
# to the user
255258
version = publisher.util.get_version_number(next_version_path)
256259

260+
version_error_message = "The next version of this file already exists on disk."
261+
257262
self.logger.error(
258-
"The next version of this file already exists on disk.",
263+
version_error_message,
259264
extra={
260265
"action_button": {
261266
"label": "Save to v%s" % (version,),
@@ -265,7 +270,7 @@ def validate(self, settings, item):
265270
}
266271
}
267272
)
268-
return False
273+
raise Exception(version_error_message)
269274

270275
self.logger.info("A Publish will be created in Shotgun and linked to:")
271276
self.logger.info(" %s" % (path,))

hooks/tk-multi-publish2/3dsmax.basic/start_version_control.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,14 @@ def validate(self, settings, item):
176176
path = _session_path()
177177

178178
if not path:
179+
save_error_message = "The Max session has not been saved."
179180
# the session still requires saving. provide a save button.
180181
# validation fails
181182
self.logger.error(
182-
"The Max session has not been saved.",
183+
save_error_message,
183184
extra=_get_save_as_action()
184185
)
185-
return False
186+
raise Exception(save_error_message)
186187

187188
# get the path to a versioned copy of the file.
188189
version_path = publisher.util.get_version_path(path, "v001")
@@ -192,7 +193,7 @@ def validate(self, settings, item):
192193
"another name.",
193194
extra=_get_save_as_action()
194195
)
195-
return False
196+
raise Exception("A file already exists with a version number. Please choose another name.")
196197

197198
return True
198199

hooks/tk-multi-publish2/houdini.basic/publish_houdini_session.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,14 @@ def validate(self, settings, item):
194194
path = _session_path()
195195

196196
if not path:
197+
session_error_message = "The Houdini session has not been saved."
197198
# the session still requires saving. provide a save button.
198199
# validation fails.
199200
self.logger.error(
200-
"The Houdini session has not been saved.",
201+
session_error_message,
201202
extra=self._get_save_as_action()
202203
)
203-
return False
204+
raise Exception(session_error_message)
204205

205206
# get the path in a normalized state. no trailing separator,
206207
# separators are appropriate for current os, no double separators,
@@ -254,8 +255,9 @@ def validate(self, settings, item):
254255
# to the user
255256
version = publisher.util.get_version_number(next_version_path)
256257

258+
version_error_message = "The next version of this file already exists on disk."
257259
self.logger.error(
258-
"The next version of this file already exists on disk.",
260+
version_error_message,
259261
extra={
260262
"action_button": {
261263
"label": "Save to v%s" % (version,),
@@ -265,7 +267,7 @@ def validate(self, settings, item):
265267
}
266268
}
267269
)
268-
return False
270+
raise Exception(version_error_message)
269271

270272
self.logger.info("A Publish will be created in Shotgun and linked to:")
271273
self.logger.info(" %s" % (path,))

hooks/tk-multi-publish2/houdini.basic/start_version_control.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,14 @@ def validate(self, settings, item):
176176
path = _session_path()
177177

178178
if not path:
179+
save_error_message = "The Houdini session has not been saved."
179180
# the session still requires saving. provide a save button.
180181
# validation fails
181182
self.logger.error(
182-
"The Houdini session has not been saved.",
183+
save_error_message,
183184
extra=self._get_save_as_action()
184185
)
185-
return False
186+
raise Exception(save_error_message)
186187

187188
# get the path to a versioned copy of the file.
188189
version_path = publisher.util.get_version_path(path, "v001")
@@ -192,7 +193,7 @@ def validate(self, settings, item):
192193
"another name.",
193194
extra=self._get_save_as_action()
194195
)
195-
return False
196+
raise Exception("A file already exists with a version number. Please choose another name")
196197

197198
return True
198199

hooks/tk-multi-publish2/maya.basic/publish_maya_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def validate(self, settings, item):
202202
session_error_message,
203203
extra=_get_save_as_action()
204204
)
205-
# this exception should be cought by plugin.py run_validate() and propagate to tree_node_task.py validate()
205+
# this exception should be caught by plugin.py run_validate() and propagate to tree_node_task.py validate()
206206
raise Exception(session_error_message)
207207

208208
# ensure we have an updated project root

hooks/tk-multi-publish2/nuke.basic/nuke_publish_script.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,14 @@ def validate(self, settings, item):
194194
path = _session_path()
195195

196196
if not path:
197+
save_error_message = "The Nuke script has not been saved."
197198
# the session still requires saving. provide a save button.
198199
# validation fails.
199200
self.logger.error(
200-
"The Nuke script has not been saved.",
201+
save_error_message,
201202
extra=_get_save_as_action()
202203
)
203-
return False
204+
raise Exception(save_error_message)
204205

205206
# get the path in a normalized state. no trailing separator,
206207
# separators are appropriate for current os, no double separators,
@@ -254,8 +255,9 @@ def validate(self, settings, item):
254255
# to the user
255256
version = publisher.util.get_version_number(next_version_path)
256257

258+
version_error_message = "The next version of this file already exists on disk."
257259
self.logger.error(
258-
"The next version of this file already exists on disk.",
260+
version_error_message,
259261
extra={
260262
"action_button": {
261263
"label": "Save to v%s" % (version,),
@@ -265,7 +267,7 @@ def validate(self, settings, item):
265267
}
266268
}
267269
)
268-
return False
270+
raise Exception(version_error_message)
269271

270272
self.logger.info("A Publish will be created in Shotgun and linked to:")
271273
self.logger.info(" %s" % (path,))

hooks/tk-multi-publish2/nuke.basic/nuke_start_version_control.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,14 @@ def validate(self, settings, item):
175175
path = _session_path()
176176

177177
if not path:
178+
save_error_message = "The Nuke script has not been saved."
178179
# the session still requires saving. provide a save button.
179180
# validation fails
180181
self.logger.error(
181-
"The Nuke script has not been saved.",
182+
save_error_message,
182183
extra=_get_save_as_action()
183184
)
184-
return False
185+
raise Exception(save_error_message)
185186

186187
# get the path to a versioned copy of the file.
187188
version_path = publisher.util.get_version_path(path, "v001")
@@ -191,7 +192,7 @@ def validate(self, settings, item):
191192
"another name.",
192193
extra=_get_save_as_action()
193194
)
194-
return False
195+
raise Exception("A file already exists with a version number. Please choose another name.")
195196

196197
return True
197198

hooks/tk-multi-publish2/nuke.basic/nukestudio_start_version_control.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ def validate(self, settings, item):
183183
path = project.path()
184184

185185
if not path:
186+
save_error_message = "The Nuke Studio project '%s' has not been saved." % (project.name(),)
186187
# the session still requires saving. provide a save button.
187188
# validation fails
188189
self.logger.error(
189-
"The Nuke Studio project '%s' has not been saved." %
190-
(project.name(),),
190+
save_error_message,
191191
extra=_get_save_as_action(project)
192192
)
193-
return False
193+
raise Exception(save_error_message)
194194

195195
# get the path to a versioned copy of the file.
196196
version_path = publisher.util.get_version_path(path, "v001")
@@ -200,7 +200,7 @@ def validate(self, settings, item):
200200
"another name.",
201201
extra=_get_save_as_action(project)
202202
)
203-
return False
203+
raise Exception("A file already exists with a version number. Please choose another name")
204204

205205
return True
206206

hooks/tk-multi-publish2/photoshopcc.basic/publish_photoshop_document.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ def validate(self, settings, item):
206206
path = _document_path(document)
207207

208208
if not path:
209+
save_error_message = "The Photoshop document '%s' has not been saved." % (document.name,)
209210
# the document still requires saving. provide a save button.
210211
# validation fails.
211212
self.logger.error(
212-
"The Photoshop document '%s' has not been saved." %
213-
(document.name,),
213+
save_error_message,
214214
extra=self._get_save_as_action(document)
215215
)
216-
return False
216+
raise Exception(save_error_message)
217217

218218
# get the path in a normalized state. no trailing separator,
219219
# separators are appropriate for current os, no double separators,
@@ -269,8 +269,10 @@ def validate(self, settings, item):
269269

270270
engine = publisher.engine
271271

272+
version_error_message = "The next version of this file already exists on disk."
273+
272274
self.logger.error(
273-
"The next version of this file already exists on disk.",
275+
version_error_message,
274276
extra={
275277
"action_button": {
276278
"label": "Save to v%s" % (version,),
@@ -281,7 +283,7 @@ def validate(self, settings, item):
281283
}
282284
}
283285
)
284-
return False
286+
raise Exception(version_error_message)
285287

286288
self.logger.info("A Publish will be created in Shotgun and linked to:")
287289
self.logger.info(" %s" % (path,))

hooks/tk-multi-publish2/photoshopcc.basic/start_version_control.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ def validate(self, settings, item):
182182
path = _document_path(document)
183183

184184
if not path:
185+
save_error_message = "The Photoshop document '%s' has not been saved." % (document.name,)
185186
# the session still requires saving. provide a save button.
186187
# validation fails
187188
self.logger.error(
188-
"The Photoshop document '%s' has not been saved." %
189-
(document.name,),
189+
save_error_message,
190190
extra=self._get_save_as_action(document)
191191
)
192-
return False
192+
raise Exception(save_error_message)
193193

194194
# get the path to a versioned copy of the file.
195195
version_path = publisher.util.get_version_path(path, "v001")
@@ -199,7 +199,7 @@ def validate(self, settings, item):
199199
"another name.",
200200
extra=self._get_save_as_action(document)
201201
)
202-
return False
202+
raise Exception("A file already exists with a version number. Please choose another name.")
203203

204204
return True
205205

0 commit comments

Comments
 (0)