From 87e698f1f98c66d3d1a4f0d70a90780fe38a0bab Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Mon, 25 Apr 2011 05:11:32 +0000
Subject: [PATCH] fix [#27149] OBJ import does not import OBJ vertex/poly
 groups, produces error messages disable polygroup by default too.

---
 io_scene_obj/__init__.py   | 2 +-
 io_scene_obj/import_obj.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index d374bd647..1a857e447 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -66,7 +66,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
     # KEEP_VERT_ORDER = BoolProperty(name="Keep Vert Order", description="Keep vert and face order, disables split options, enable for morph targets", default= True)
     ROTATE_X90 = BoolProperty(name="-X90", description="Rotate X 90.", default=True)
     CLAMP_SIZE = FloatProperty(name="Clamp Scale", description="Clamp the size to this maximum (Zero to Disable)", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=0.0)
-    POLYGROUPS = BoolProperty(name="Poly Groups", description="Import OBJ groups as vertex groups.", default=True)
+    POLYGROUPS = BoolProperty(name="Poly Groups", description="Import OBJ groups as vertex groups.", default=False)
     IMAGE_SEARCH = BoolProperty(name="Image Search", description="Search subdirs for any assosiated images (Warning, may be slow)", default=True)
 
     def execute(self, context):
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index ee77c35d4..e30762e9f 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -857,7 +857,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
     # content of the vertex_groups. If the user selects to NOT have vertex groups saved then
     # the following test will never run
     for group_name, group_indices in vertex_groups.items():
-        group = ob.vertex_groups.new(group_name)
+        group = ob.vertex_groups.new(group_name.decode('utf-8', "replace"))
         group.add(group_indices, 1.0, 'REPLACE')
 
 
@@ -1209,7 +1209,7 @@ def load(operator, context, filepath,
 
             if context_parm.lower() == b'u':
                 context_nurbs.setdefault(b'parm_u', []).extend([float_func(f) for f in line_split])
-            elif context_parm.lower() == b'v':  # surfaces not suported yet
+            elif context_parm.lower() == b'v':  # surfaces not supported yet
                 context_nurbs.setdefault(b'parm_v', []).extend([float_func(f) for f in line_split])
             # else: # may want to support other parm's ?
 
-- 
GitLab