[Bf-extensions-cvs] [8a3b944a] master: Mesh Cache Tools: Fix registration issues with duplicates
lijenstina
noreply at git.blender.org
Sun Sep 3 15:02:11 CEST 2017
Commit: 8a3b944a30a0d181c8db8b830cb01ab81c1223ee
Author: lijenstina
Date: Sun Sep 3 15:01:29 2017 +0200
Branches: master
https://developer.blender.org/rBAC8a3b944a30a0d181c8db8b830cb01ab81c1223ee
Mesh Cache Tools: Fix registration issues with duplicates
Bumped version to 1.0.1
Pep8 Cleanup
Remove unused imports
Consistent prop definitions
Fix a few crashes related to the path chosen
handle errors more gracefully in that case
Fix crash with missing linked groups
Refactor the panel registration code
Part of the task T52564:
fix duplicate AddonPreferences names shared with
Oscurart tools add-on
Use register_class instead of import_module
Note: the naming scheme is not definitive this
just fixes the errors with master registration
===================================================================
M oscurart_mesh_cache_tools.py
===================================================================
diff --git a/oscurart_mesh_cache_tools.py b/oscurart_mesh_cache_tools.py
index 4c71a76d..98c54683 100644
--- a/oscurart_mesh_cache_tools.py
+++ b/oscurart_mesh_cache_tools.py
@@ -1,7 +1,7 @@
bl_info = {
"name": "Mesh Cache Tools",
"author": "Oscurart",
- "version": (1, 0),
+ "version": (1, 0, 1),
"blender": (2, 70, 0),
"location": "Tools > Mesh Cache Tools",
"description": "Tools for Management Mesh Cache Process",
@@ -12,160 +12,172 @@ bl_info = {
import bpy
-import sys
import os
import struct
-from bpy.types import Operator
from bpy_extras.io_utils import ImportHelper
-from bpy.props import StringProperty, BoolProperty, EnumProperty
+from bpy.types import (
+ Operator,
+ Panel,
+ PropertyGroup,
+ AddonPreferences,
+ )
+from bpy.props import (
+ BoolProperty,
+ IntProperty,
+ StringProperty,
+ PointerProperty,
+ CollectionProperty,
+ )
from bpy.app.handlers import persistent
-class ModifiersSettings(bpy.types.PropertyGroup):
- array = bpy.props.BoolProperty(default=True)
- bevel = bpy.props.BoolProperty(default=True)
- boolean = bpy.props.BoolProperty(default=True)
- build = bpy.props.BoolProperty(default=True)
- decimate = bpy.props.BoolProperty(default=True)
- edge_split = bpy.props.BoolProperty(default=True)
- mask = bpy.props.BoolProperty(default=True)
- mirror = bpy.props.BoolProperty(default=True)
- multires = bpy.props.BoolProperty(default=True)
- remesh = bpy.props.BoolProperty(default=True)
- screw = bpy.props.BoolProperty(default=True)
- skin = bpy.props.BoolProperty(default=True)
- solidify = bpy.props.BoolProperty(default=True)
- subsurf = bpy.props.BoolProperty(default=True)
- triangulate = bpy.props.BoolProperty(default=True)
- wireframe = bpy.props.BoolProperty(default=True)
- cloth = bpy.props.BoolProperty(default=True)
-
-
-bpy.utils.register_class(ModifiersSettings) #registro PropertyGroup
-bpy.types.Scene.mesh_cache_tools_settings = bpy.props.PointerProperty(type=ModifiersSettings)
+
+class OscurartMeshCacheModifiersSettings(PropertyGroup):
+ array = BoolProperty(default=True)
+ bevel = BoolProperty(default=True)
+ boolean = BoolProperty(default=True)
+ build = BoolProperty(default=True)
+ decimate = BoolProperty(default=True)
+ edge_split = BoolProperty(default=True)
+ mask = BoolProperty(default=True)
+ mirror = BoolProperty(default=True)
+ multires = BoolProperty(default=True)
+ remesh = BoolProperty(default=True)
+ screw = BoolProperty(default=True)
+ skin = BoolProperty(default=True)
+ solidify = BoolProperty(default=True)
+ subsurf = BoolProperty(default=True)
+ triangulate = BoolProperty(default=True)
+ wireframe = BoolProperty(default=True)
+ cloth = BoolProperty(default=True)
+
# ----------------- AUTO LOAD PROXY
-##bpy.context.scene.pc_auto_load_proxy.remove(0)
-class CreaPropiedades(bpy.types.Operator):
+# bpy.context.scene.pc_auto_load_proxy.remove(0)
+class CreaPropiedades(Operator):
bl_idname = "scene.pc_auto_load_proxy_create"
bl_label = "Create Auto Load PC Proxy List"
def execute(self, context):
- for gr in bpy.data.groups:
- if gr.library != None:
- i = bpy.context.scene.pc_auto_load_proxy.add()
- i.name = gr.name
+ for gr in bpy.data.groups:
+ if gr.library is not None:
+ i = bpy.context.scene.pc_auto_load_proxy.add()
+ i.name = gr.name
i.use_auto_load = False
return {'FINISHED'}
-class RemuevePropiedades(bpy.types.Operator):
+
+class RemuevePropiedades(Operator):
bl_idname = "scene.pc_auto_load_proxy_remove"
bl_label = "Remove Auto Load PC Proxy List"
def execute(self, context):
- for i in bpy.context.scene.pc_auto_load_proxy:
+ for i in bpy.context.scene.pc_auto_load_proxy:
bpy.context.scene.pc_auto_load_proxy.remove(0)
- return {'FINISHED'}
-
-class SceneAutoLoad(bpy.types.PropertyGroup):
- name = bpy.props.StringProperty(name="GroupName", default="")
- use_auto_load = bpy.props.BoolProperty(name="Bool", default=False)
-
-bpy.utils.register_class(SceneAutoLoad)
-bpy.types.Scene.pc_auto_load_proxy = \
- bpy.props.CollectionProperty(type=SceneAutoLoad)
-
- at persistent
+ return {'FINISHED'}
+
+
+class OscurartMeshCacheSceneAutoLoad(PropertyGroup):
+ name = StringProperty(
+ name="GroupName",
+ default=""
+ )
+ use_auto_load = BoolProperty(
+ name="Bool",
+ default=False
+ )
+
+
+ at persistent
def CargaAutoLoadPC(dummy):
for gr in bpy.context.scene.pc_auto_load_proxy:
if gr.use_auto_load:
for ob in bpy.data.groups[gr.name].objects:
for MOD in ob.modifiers:
- if MOD.type == "MESH_CACHE":
+ if MOD.type == "MESH_CACHE":
MOD.cache_format = "PC2"
MOD.forward_axis = "POS_Y"
MOD.up_axis = "POS_Z"
MOD.flip_axis = set(())
- MOD.frame_start = bpy.context.scene.pc_pc2_start
- abspath = os.path.abspath(bpy.path.abspath("//"+bpy.context.scene.pc_pc2_folder))
- MOD.filepath = "%s/%s.pc2" % (abspath,ob.name)
-
-
-
-bpy.app.handlers.load_post.append(CargaAutoLoadPC)
+ MOD.frame_start = bpy.context.scene.pc_pc2_start
+ abspath = os.path.abspath(bpy.path.abspath("//" + bpy.context.scene.pc_pc2_folder))
+ MOD.filepath = "%s/%s.pc2" % (abspath, ob.name)
-# ----------------- PANELES
+bpy.app.handlers.load_post.append(CargaAutoLoadPC)
-class View3DMCPanel():
- bl_space_type = 'VIEW_3D'
- bl_region_type = 'TOOLS'
+# - PANELS -
-class OscEPc2ExporterPanel(View3DMCPanel, bpy.types.Panel):
- """
- bl_label = "Mesh Cache Tools"
- bl_idname = "Mesh Cache Tools"
+class View3DMCPanel():
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
- """
+
+
+class OscEPc2ExporterPanel(View3DMCPanel, Panel):
bl_category = "Tools"
bl_label = "Mesh Cache Tools"
bl_options = {'DEFAULT_CLOSED'}
-
def draw(self, context):
layout = self.layout
+ scene = context.scene
- obj = context.object
row = layout.column(align=1)
- row.prop(bpy.context.scene, "pc_pc2_folder", text="Folder")
+ row.prop(scene, "pc_pc2_folder", text="Folder")
row.operator("buttons.set_meshcache_folder", icon='FILESEL', text="Select Folder Path")
row = layout.box().column(align=1)
row.label("EXPORTER:")
row.operator("group.linked_group_to_local", text="Linked To Local", icon="LINKED")
row.operator("object.remove_subsurf_modifier", text="Remove Gen Modifiers", icon="MOD_SUBSURF")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "array", text="Array")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "bevel", text="Bevel")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "boolean", text="Boolean")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "build", text="Build")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "decimate", text="Decimate")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "edge_split", text="Edge Split")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "mask", text="Mask")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "mirror", text="Mirror")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "multires", text="Multires")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "remesh", text="Remesh")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "screw", text="Screw")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "skin", text="Skin")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "solidify", text="Solidify")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "subsurf", text="Subsurf")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "triangulate", text="Triangulate")
- row.prop(bpy.context.scene.mesh_cache_tools_settings, "wireframe", text="Wireframe")
- #row = layout.column(align=1)
- row.prop(bpy.context.scene, "pc_pc2_start", text="Frame Start")
- row.prop(bpy.context.scene, "pc_pc2_end", text="Frame End")
- row.prop(bpy.context.scene, "pc_pc2_exclude", text="Exclude Token:")
- row.prop_search(bpy.context.scene, "pc_pc2_group", bpy.data, "groups", text="")
+ row.prop(scene.mesh_cache_tools_settings, "array", text="Array")
+ row.prop(scene.mesh_cache_tools_settings, "bevel", text="Bevel")
+ row.prop(scene.mesh_cache_tools_settings, "boolean", text="Boolean")
+ row.prop(scene.mesh_cache_tools_settings, "build", text="Build")
+ row.prop(scene.mesh_cache_tools_settings, "decimate", text="Decimate")
+ row.prop(scene.mesh_cache_tools_settings, "edge_split", text="Edge Split")
+ row.prop(scene.mesh_cache_tools_settings, "mask", text="Mask")
+ row.prop(scene.mesh_cache_tools_settings, "mirror", text="Mirror")
+ row.prop(scene.mesh_cache_tools_settings, "multires", text="Multires")
+ row.prop(scene.mesh_cache_tools_settings, "remesh", text="Remesh")
+ row.prop(scene.mesh_cache_tools_settings, "screw", text="Screw")
+ row.prop(scene.mesh_cache_tools_settings, "skin", text="Skin")
+ row.prop(scene.mesh_cache_tools_settings, "solidify", text="Solidify")
+ row.prop(scene.mesh_cache_tools_settings, "subsurf", text="Subsurf")
+ row.prop(scene.mesh_cache_tools_settings, "triangulate", text="Triangulate")
+ row.prop(scene.mesh_cache_tools_settings, "wireframe", text="Wireframe")
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list