diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-15 18:55:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-15 19:05:28 +0300 |
commit | 8c37a7fe4a81e89c2400d4264b7fea8e89b56638 (patch) | |
tree | 6a21e76f5821b1f1f734f294c6a875211c48a159 /add_mesh_extra_objects | |
parent | 467303ba70d6f406a1942321f1962d2ce2491928 (diff) |
Update for object add align property changes
Diffstat (limited to 'add_mesh_extra_objects')
-rw-r--r-- | add_mesh_extra_objects/add_mesh_honeycomb.py | 22 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_menger_sponge.py | 24 |
2 files changed, 14 insertions, 32 deletions
diff --git a/add_mesh_extra_objects/add_mesh_honeycomb.py b/add_mesh_extra_objects/add_mesh_honeycomb.py index 94c6f63f..d382b587 100644 --- a/add_mesh_extra_objects/add_mesh_honeycomb.py +++ b/add_mesh_extra_objects/add_mesh_honeycomb.py @@ -1,7 +1,10 @@ # GPL # "author": "Kayo Phoenix" import bpy -from bpy_extras import object_utils +from bpy_extras.object_utils import ( + AddObjectHelper, + object_data_add, + ) from math import ( pi, sin, cos, @@ -207,7 +210,7 @@ def edge_max(diam): return diam * sin(pi / 3) -class add_mesh_honeycomb(bpy.types.Operator): +class add_mesh_honeycomb(bpy.types.Operator, AddObjectHelper): bl_idname = "mesh.honeycomb_add" bl_label = "Add HoneyComb" bl_description = "Simple honeycomb mesh generator" @@ -248,19 +251,6 @@ class add_mesh_honeycomb(bpy.types.Operator): min=0.0, update=fix_edge, description='Width of the edge' ) - # generic transform props - view_align: BoolProperty( - name="Align to View", - default=False - ) - location: FloatVectorProperty( - name="Location", - subtype='TRANSLATION' - ) - rotation: FloatVectorProperty( - name="Rotation", - subtype='EULER' - ) @classmethod def poll(cls, context): @@ -275,6 +265,6 @@ class add_mesh_honeycomb(bpy.types.Operator): mesh.from_pydata(vertices=verts, edges=[], faces=faces) mesh.update() - object_utils.object_data_add(context, mesh, operator=self) + object_data_add(context, mesh, operator=self) return {'FINISHED'} diff --git a/add_mesh_extra_objects/add_mesh_menger_sponge.py b/add_mesh_extra_objects/add_mesh_menger_sponge.py index 20b0d102..1e932e20 100644 --- a/add_mesh_extra_objects/add_mesh_menger_sponge.py +++ b/add_mesh_extra_objects/add_mesh_menger_sponge.py @@ -3,6 +3,12 @@ # This file is distributed under the MIT License. See the LICENSE.md for more details. import bpy + +from bpy_extras.object_utils import ( + AddObjectHelper, + object_data_add, + ) + from bpy.props import ( IntProperty, BoolProperty, @@ -138,7 +144,7 @@ class MengerSponge(object): depth - 1) -class AddMengerSponge(bpy.types.Operator): +class AddMengerSponge(bpy.types.Operator, AddObjectHelper): bl_idname = "mesh.menger_sponge_add" bl_label = "Menger Sponge" bl_description = "Construct a menger sponge mesh" @@ -156,19 +162,6 @@ class AddMengerSponge(bpy.types.Operator): min=0.01, max=100.0, default=1.0, ) - # generic transform props - view_align: BoolProperty( - name="Align to View", - default=False, - ) - location: FloatVectorProperty( - name="Location", - subtype='TRANSLATION', - ) - rotation: FloatVectorProperty( - name="Rotation", - subtype='EULER', - ) layers: BoolVectorProperty( name="Layers", size=20, @@ -188,7 +181,6 @@ class AddMengerSponge(bpy.types.Operator): for i, uvloop in enumerate(mesh.uv_layers.active.data): uvloop.uv = uvs[i % 4] - from bpy_extras import object_utils - object_utils.object_data_add(context, mesh, operator=self) + object_data_add(context, mesh, operator=self) return {'FINISHED'} |