From 10dd06be5ab5fdbc20198129e3eae42281ace511 Mon Sep 17 00:00:00 2001 From: Eugenio Pignataro <info@oscurart.com.ar> Date: Fri, 6 Jan 2017 18:04:54 -0300 Subject: [PATCH] remove obsolete tools --- oscurart_tools/__init__.py | 7 +-- oscurart_tools/oscurart_meshes.py | 100 ------------------------------ 2 files changed, 1 insertion(+), 106 deletions(-) diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py index 98a0c57ba..d3f3d8f24 100644 --- a/oscurart_tools/__init__.py +++ b/oscurart_tools/__init__.py @@ -186,12 +186,7 @@ class OscPanelMesh(Panel): colrow.operator("mesh.overlap_uv_faces", icon="UV_FACESEL") colrow = col.row(align=1) colrow.operator("view3d.modal_operator", icon="STICKY_UVS_DISABLE") - colrow = col.row(align=1) - colrow.operator("file.export_groups_osc", icon='GROUP_VCOL') - colrow.operator("file.import_groups_osc", icon='GROUP_VCOL') - colrow = col.row(align=1) - colrow.operator("mesh.export_vertex_colors", icon='COLOR') - colrow.operator("mesh.import_vertex_colors", icon='COLOR') + class OscPanelShapes(Panel): diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py index 568cb9d8e..07088df28 100644 --- a/oscurart_tools/oscurart_meshes.py +++ b/oscurart_tools/oscurart_meshes.py @@ -176,60 +176,6 @@ class resymVertexGroups (Operator): return {'FINISHED'} -# ------------------------IMPORT EXPORT GROUPS-------------------- - -class OscExportVG (Operator): - bl_idname = "file.export_groups_osc" - bl_label = "Export Groups" - bl_options = {"REGISTER", "UNDO"} - - @classmethod - def poll(cls, context): - return context.active_object is not None - - def execute(self, context): - - ob = bpy.context.object - with open(os.path.join(os.path.dirname(bpy.data.filepath), ob.name + ".txt"), mode="w") as file: - vgindex = {vg.index: vg.name for vg in ob.vertex_groups[:]} - vgdict = {} - for vert in ob.data.vertices: - for vg in vert.groups: - vgdict.setdefault(vg.group, []).append( - (vert.index, vg.weight)) - file.write(str(vgdict) + "\n") - file.write(str(vgindex)) - - return {'FINISHED'} - - -class OscImportVG (Operator): - bl_idname = "file.import_groups_osc" - bl_label = "Import Groups" - bl_options = {"REGISTER", "UNDO"} - - @classmethod - def poll(cls, context): - return context.active_object is not None - - def execute(self, context): - - ob = bpy.context.object - with open(os.path.join(os.path.dirname(bpy.data.filepath), ob.name + ".txt"), mode="r") as file: - vgdict = eval(file.readlines(1)[0].replace("\n", "")) - vgindex = eval(file.readlines(2)[0].replace("\n", "")) - - for index, name in vgindex.items(): - ob.vertex_groups.new(name=name) - - for group, vdata in vgdict.items(): - for index, weight in vdata: - ob.vertex_groups[group].add( - index=[index], - weight=weight, - type="REPLACE") - - return {'FINISHED'} # ------------------------------------ RESYM MESH------------------------- @@ -460,54 +406,8 @@ class OscOverlapUv(Operator): DefOscOverlapUv(self.presicion) return {'FINISHED'} -# ------------------------------- IO VERTEX COLORS -------------------- -def DefOscExportVC(): - with open(os.path.join(os.path.dirname(bpy.data.filepath), bpy.context.object.name) + ".vc", mode="w") as file: - ob = bpy.context.object - di = {loopind: ob.data.vertex_colors.active.data[loopind].color[:] - for face in ob.data.polygons for loopind in face.loop_indices[:]} - file.write(str(di)) - - -def DefOscImportVC(): - with open(os.path.join(os.path.dirname(bpy.data.filepath), bpy.context.object.name) + ".vc", mode="r") as file: - di = eval(file.read()) - for loopind in di: - bpy.context.object.data.vertex_colors.active.data[ - loopind].color = di[loopind] - - -class OscExportVC (Operator): - bl_idname = "mesh.export_vertex_colors" - bl_label = "Export Vertex Colors" - bl_options = {"REGISTER", "UNDO"} - - @classmethod - def poll(cls, context): - return (context.active_object is not None and - context.active_object.type == 'MESH') - - def execute(self, context): - DefOscExportVC() - return {'FINISHED'} - - -class OscImportVC (Operator): - bl_idname = "mesh.import_vertex_colors" - bl_label = "Import Vertex Colors" - bl_options = {"REGISTER", "UNDO"} - - @classmethod - def poll(cls, context): - return (context.active_object is not None and - context.active_object.type == 'MESH') - - def execute(self, context): - DefOscImportVC() - return {'FINISHED'} - # ------------------ PRINT VERTICES ---------------------- -- GitLab