[Bf-extensions-cvs] [64d89567] master: object_fracture_cell: fix for bool method, tidy ui, clean white space: T61901

meta-androcto noreply at git.blender.org
Sat Jul 6 11:36:45 CEST 2019


Commit: 64d89567923df223f50eeeaa2f79f93f23da74f6
Author: meta-androcto
Date:   Sat Jul 6 19:36:15 2019 +1000
Branches: master
https://developer.blender.org/rBA64d89567923df223f50eeeaa2f79f93f23da74f6

object_fracture_cell: fix for bool method, tidy ui, clean white space: T61901

===================================================================

M	object_fracture_cell/__init__.py
M	object_fracture_cell/operator.py
M	object_fracture_cell/process/cell_calc.py
M	object_fracture_cell/process/cell_functions.py
M	object_fracture_cell/process/cell_main.py
M	object_fracture_cell/process/crack_functions.py
M	object_fracture_cell/process/material_functions.py
M	object_fracture_cell/utilities.py

===================================================================

diff --git a/object_fracture_cell/__init__.py b/object_fracture_cell/__init__.py
index d7adc80f..794c2fe1 100644
--- a/object_fracture_cell/__init__.py
+++ b/object_fracture_cell/__init__.py
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "Cell Fracture",
     "author": "ideasman42, phymec, Sergey Sharybin, Nobuyuki Hirakata",
-    "version": (1, 0, 1),
+    "version": (1, 0, 2),
     "blender": (2, 80, 0),
     "location": "View3D > Sidebar > Transform tab",
     "description": "Fractured Object, or Cracked Surface",
@@ -51,7 +51,7 @@ from bpy.props import (
 from bpy.types import (
         Panel,
         PropertyGroup,
-        )        
+        )
 
 
 class FRACTURE_PT_Menu(Panel):
@@ -59,19 +59,19 @@ class FRACTURE_PT_Menu(Panel):
     bl_label = "Fracture Cell"
     bl_space_type = "VIEW_3D"
     bl_region_type = "UI"
-    bl_category = "Transform"
+    bl_category = "Create"
     bl_context = 'objectmode'
     bl_options = {"DEFAULT_CLOSED"}
-    
+
     def draw(self, context):
         # Show pop-upped menu when the button is hit.
         layout = self.layout
         #layout.label(text="Cell Fracture:")
         layout.operator(operator.FRACTURE_OT_Cell.bl_idname,
-                    text="1. Cell Fracture")       
+                    text="1. Cell Fracture")
         layout.operator(operator.FRACTURE_OT_Crack.bl_idname,
                     text="2. Cell to Crack")
-        
+
         material_props = context.window_manager.fracture_material_props
         layout.separator()
         box = layout.box()
@@ -88,10 +88,10 @@ class FRACTURE_PT_Menu(Panel):
 
         row = box.row()
         row.operator(operator.FRACTURE_OT_Material.bl_idname, icon="MATERIAL_DATA",
-                    text="Append Material")       
+                    text="Append Material")
 
 
-class FractureCellProperties(PropertyGroup):              
+class FractureCellProperties(PropertyGroup):
     # -------------------------------------------------------------------------
     # Source Options
     source_vert_own: IntProperty(
@@ -130,16 +130,16 @@ class FractureCellProperties(PropertyGroup):
             min=0, max=2000,
             default=0,
             )
-    '''        
+    '''
     source_limit: IntProperty(
             name="Source Limit",
             description="Limit the number of input points, 0 for unlimited",
             min=0, max=5000,
             default=100,
             )
-    '''    
+    '''
     # -------------------------------------------------------------------------
-    # Transform 
+    # Transform
     source_noise: FloatProperty(
             name="Noise",
             description="Randomize point distribution",
@@ -187,7 +187,7 @@ class FractureCellProperties(PropertyGroup):
     recursion_source_limit: IntProperty(
             name="Fracture Each",
             description="Limit the number of input points, 0 for unlimited (applies to recursion only)",
-            min=2, max=2000, # Oviously, dividing in more than two objects is needed, to avoid no fracture object. 
+            min=2, max=2000, # Oviously, dividing in more than two objects is needed, to avoid no fracture object.
             default=8,
             )
     recursion_clamp: IntProperty(
@@ -197,7 +197,7 @@ class FractureCellProperties(PropertyGroup):
             default=250,
             )
     recursion_chance: FloatProperty(
-            name="Recursion Chance",
+            name="Rec Chance",
             description="Likelihood of recursion",
             min=0.0, max=1.0,
             default=1.00,
@@ -245,17 +245,17 @@ class FractureCellProperties(PropertyGroup):
             default=False,
             )
     # -------------------------------------------------------------------------
-    # Scene Options    
+    # Scene Options
     use_collection: BoolProperty(
             name="Use Collection",
             description="Use collection to organize fracture objects",
             default=True,
-            )    
+            )
     new_collection: BoolProperty(
-            name="New Collection",
+            name="Use New",
             description="Make new collection for fracture objects",
             default=True,
-            )  
+            )
     collection_name: StringProperty(
             name="Name",
             description="Collection name.",
@@ -272,12 +272,12 @@ class FractureCellProperties(PropertyGroup):
             default=False,
             )
     # -------------------------------------------------------------------------
-    # Custom Property Options    
+    # Custom Property Options
     use_mass: BoolProperty(
         name="Mass",
         description="Append mass data on custom properties of cell objects.",
         default=False,
-        )   
+        )
     mass_name: StringProperty(
         name="Property Name",
         description="Name for custome properties.",
@@ -316,7 +316,7 @@ class FractureCellProperties(PropertyGroup):
             default=False,
             )
 
-            
+
 class FractureCrackProperties(PropertyGroup):
     modifier_decimate : FloatProperty(
         name="Reduce Faces",
@@ -357,10 +357,10 @@ class FractureCrackProperties(PropertyGroup):
             name="Wireframe Modifier",
             description="Wireframe Modifier",
             default=False
-            )  
+            )
 
 
-class FractureMaterialProperties(PropertyGroup):  
+class FractureMaterialProperties(PropertyGroup):
     # Note: you can choose the original name in the library blend
     # or the prop name
     material_preset : EnumProperty(
@@ -384,7 +384,7 @@ class FractureMaterialProperties(PropertyGroup):
                         "instead of the one defined in the Preset",
             default=True
             )
-    
+
 classes = (
     FractureCellProperties,
     FractureCrackProperties,
@@ -408,13 +408,17 @@ def register():
     )
     bpy.types.WindowManager.fracture_material_props = PointerProperty(
         type=FractureMaterialProperties
-    )    
-    
+    )
+
 def unregister():
     del bpy.types.WindowManager.fracture_material_props
     del bpy.types.WindowManager.fracture_crack_props
     del bpy.types.WindowManager.fracture_cell_props
-    
+
     from bpy.utils import unregister_class
     for cls in reversed(classes):
-        unregister_class(cls)
\ No newline at end of file
+        unregister_class(cls)
+
+if __name__ == "__main__":
+	register()
+
diff --git a/object_fracture_cell/operator.py b/object_fracture_cell/operator.py
index cd8dca00..7bc35a46 100644
--- a/object_fracture_cell/operator.py
+++ b/object_fracture_cell/operator.py
@@ -24,27 +24,32 @@ class FRACTURE_OT_Cell(Operator):
     bl_description = "Make fractured cells from selected object."
     bl_options = {'REGISTER', 'UNDO'}
 
-    def execute(self, context):     
+    @classmethod
+    def poll(cls, context):
+        obj = context.active_object
+        return obj and obj.type == "MESH"
+
+    def execute(self, context):
         #keywords = self.as_keywords()  # ignore=("blah",)
-      
+
         fracture_cell_props = context.window_manager.fracture_cell_props
         cell_keywords = utilities._cell_props_to_dict(fracture_cell_props)
-        
-        originals = context.selected_editable_objects       
+
+        originals = context.selected_editable_objects
         for original in originals:
             cell_main.main(context, original, **cell_keywords)
-        
+
         return {'FINISHED'}
 
     def invoke(self, context, event):
         wm = context.window_manager
-        return wm.invoke_props_dialog(self, width=600)
-        
-    def draw(self, context):       
+        return wm.invoke_props_dialog(self, width=350)
+
+    def draw(self, context):
         cell_props = context.window_manager.fracture_cell_props
-        
+
         layout = self.layout
-        
+
         box = layout.box()
         col = box.column()
         col.label(text="Fracture From")
@@ -52,23 +57,24 @@ class FRACTURE_OT_Cell(Operator):
         #row.prop(cell_props, "source")
         row.prop(cell_props, "source_vert_own")
         row.prop(cell_props, "source_particle_own")
-        row.prop(cell_props, "source_random")
         row = col.row()
+        row.prop(cell_props, "source_random")
         row.prop(cell_props, "source_vert_child")
+        row = col.row()
         row.prop(cell_props, "source_particle_child")
         row.prop(cell_props, "source_pencil")
-        
+
         box = layout.box()
         col = box.column()
         col.label(text="Transform")
         row = col.row()
         row.prop(cell_props, "pre_simplify")
         row.prop(cell_props, "source_noise")
+        row = col.row(align=True)
         row.prop(cell_props, "margin")
+        row.prop(cell_props, "use_recenter")
         row = col.row(align=True)
-        
         row.prop(cell_props, "cell_scale")
-        row.prop(cell_props, "use_recenter")
         # could be own section, control how we subdiv
         #row.prop(cell_props, "use_island_split")
 
@@ -76,38 +82,37 @@ class FRACTURE_OT_Cell(Operator):
         col = box.column()
         col.label(text="Recursive Shatter")
         row = col.row(align=True)
-        row.alignment = 'LEFT'
         row.prop(cell_props, "recursion")
+        row.prop(cell_props, "recursion_chance")
         row = col.row(align=True)
-        row.alignment = 'LEFT'
         if cell_props.recursion > 0:
             row.enabled = True
         else:
             row.enabled = False
         row.prop(cell_props, "recursion_source_limit")
         row.prop(cell_props, "recursion_clamp")
-        row.prop(cell_props, "recursion_chance")      
+        row = col.row()
         row.prop(cell_props, "recursion_chance_select")#, expand=True)
 
         box = layout.box()
         col = box.column()
         col.label(text="Interior Meshes")
         row = col.row(align=True)
-        row.alignment = 'LEFT'
-        row.prop(cell_props, "use_data_match") 
+        row.prop(cell_props, "use_data_match")
         row.prop(cell_props, "use_interior_vgroup")
-        row.prop(cell_props, "use_smooth_faces")        
+        row = col.row(align=True)
+        row.prop(cell_props, "use_smooth_faces")
         ro

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list