Update for changes in Blender's API
[blender-addons.git] / object_fracture_crack / __init__.py
blobd3cd095d51961b80658ded44ac05878ad22a8153
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
19 bl_info = {
20 "name": "Cell Fracture Crack It",
21 "author": "Nobuyuki Hirakata",
22 "version": (0, 1, 2),
23 "blender": (2, 78, 5),
24 "location": "View3D > Toolshelf > Create Tab",
25 "description": "Displaced Cell Fracture Addon",
26 "warning": "Make sure to enable 'Object: Cell Fracture' Addon",
27 "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/"
28 "Py/Scripts/Object/CrackIt",
29 "category": "Object"
32 if 'bpy' in locals():
33 import importlib
34 importlib.reload(operator)
36 else:
37 from . import operator
39 import bpy
40 from bpy.types import PropertyGroup
41 from bpy.props import (
42 BoolProperty,
43 EnumProperty,
44 FloatProperty,
45 IntProperty,
46 PointerProperty,
48 import os
51 class CrackItProperties(PropertyGroup):
52 # Input on toolshelf before execution
53 # In Panel subclass, In bpy.types.Operator subclass,
54 # reference them by context.scene.crackit
56 fracture_childverts = BoolProperty(
57 name="From Child Verts",
58 description="Use child object's vertices and position for origin of crack",
59 default=False
61 fracture_scalex = FloatProperty(
62 name="Scale X",
63 description="Scale X",
64 default=1.00,
65 min=0.00,
66 max=1.00
68 fracture_scaley = FloatProperty(
69 name="Scale Y",
70 description="Scale Y",
71 default=1.00,
72 min=0.00,
73 max=1.00
75 fracture_scalez = FloatProperty(
76 name="Scale Z",
77 description="Scale Z",
78 default=1.00,
79 min=0.00,
80 max=1.00
82 fracture_div = IntProperty(
83 name="Max Crack",
84 description="Max Crack",
85 default=100,
86 min=0,
87 max=10000
89 fracture_margin = FloatProperty(
90 name="Margin Size",
91 description="Margin Size",
92 default=0.001,
93 min=0.000,
94 max=1.000
96 extrude_offset = FloatProperty(
97 name="Offset",
98 description="Extrude Offset",
99 default=0.10,
100 min=0.00,
101 max=2.00
103 extrude_random = FloatProperty(
104 name="Random",
105 description="Extrude Random",
106 default=0.30,
107 min=-1.00,
108 max=1.00
110 # Path of the addon
111 material_addonpath = os.path.dirname(__file__)
112 # Selection of material preset
113 # Note: you can choose the original name in the library blend
114 # or the prop name
115 material_preset = EnumProperty(
116 name="Preset",
117 description="Material Preset",
118 items=[
119 ('crackit_organic_mud', "Organic Mud", "Mud material"),
120 ('crackit_mud1', "Mud", "Mud material"),
121 ('crackit_tree1_moss1', "Tree Moss", "Tree Material"),
122 ('crackit_tree2_dry1', "Tree Dry", "Tree Material"),
123 ('crackit_tree3_red1', "Tree Red", "Tree Material"),
124 ('crackit_rock1', "Rock", "Rock Material")
127 material_lib_name = BoolProperty(
128 name="Library Name",
129 description="Use the original Material name from the .blend library\n"
130 "instead of the one defined in the Preset",
131 default=True
135 def register():
136 bpy.utils.register_module(__name__)
137 bpy.types.Scene.crackit = PointerProperty(
138 type=CrackItProperties
142 def unregister():
143 del bpy.types.Scene.crackit
144 bpy.utils.unregister_module(__name__)
147 if __name__ == "__main__":
148 register()