Skip to content

Commit d1a0c43

Browse files
SG-39698 Remove try/except sgutil blocks and ensure_ methods (shotgunsoftware#52)
* Removed python 2 try/except sgutils block
1 parent 9d1ffd6 commit d1a0c43

3 files changed

Lines changed: 4 additions & 23 deletions

File tree

hooks/tk-multi-loader2/basic/scene_actions.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616

1717
import pymxs
1818

19-
try:
20-
from tank_vendor import sgutils
21-
except ImportError:
22-
from tank_vendor import six as sgutils
23-
2419
HookBaseClass = sgtk.get_hook_baseclass()
2520

2621

@@ -153,10 +148,7 @@ def execute_action(self, name, params, sg_publish_data):
153148
"Parameters: %s. Publish Data: %s" % (name, params, sg_publish_data)
154149
)
155150

156-
# resolve path
157-
# toolkit uses utf-8 encoded strings internally and the 3dsmax API expects unicode
158-
# so convert the path to ensure filenames containing complex characters are supported
159-
path = sgutils.ensure_text(self.get_publish_path(sg_publish_data))
151+
path = self.get_publish_path(sg_publish_data)
160152

161153
# If this is an Alembic cache, then we can import that.
162154
if path.lower().endswith(".abc"):

plugins/basic/python/tk_3dsmaxplus_basic/plugin_bootstrap.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,9 @@ def _add_to_menu(menu, title, callback):
296296
:param str title: Name of the action item
297297
:param callable callback: Method to call when the menu item is selected.
298298
"""
299-
try:
300-
from tank_vendor import sgutils
301-
except ImportError:
302-
from tank_vendor import six as sgutils
303-
304299
# Hash the macro name just like we do in the engine for consistency.
305-
macro_name = (
306-
"sg_" + hashlib.md5(sgutils.ensure_binary(callback.__name__)).hexdigest()
307-
)
300+
macro_name = "sg_" + hashlib.md5(callback.__name__.encode("utf-8")).hexdigest()
301+
308302
category = "PTR Bootstrap Menu Actions"
309303
# The createActionItem expects a macro and not some MaxScript, so create a
310304
# macro first...

python/tk_3dsmax/maxscript.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616

1717
import pymxs
1818

19-
try:
20-
from tank_vendor import sgutils
21-
except ImportError:
22-
from tank_vendor import six as sgutils
23-
2419

2520
class MaxScript:
2621
"""
@@ -163,7 +158,7 @@ def add_action_to_menu(callback, action_name, menu_var, engine):
163158
with new macro for the same action every time shotgun is reloaded.
164159
eg: 'Publish...' action will always re-use the same MacroScript.
165160
"""
166-
macro_name = "sg_" + hashlib.md5(sgutils.ensure_binary(action_name)).hexdigest()
161+
macro_name = "sg_" + hashlib.md5(action_name.encode("utf-8")).hexdigest()
167162

168163
# Creating python code separately as it needs to have no indentation in the macroscript
169164
python_code = (

0 commit comments

Comments
 (0)