[Bf-extensions-cvs] [8c37a7fe] master: Update for object add align property changes

Brecht Van Lommel noreply at git.blender.org
Wed May 15 18:13:42 CEST 2019


Commit: 8c37a7fe4a81e89c2400d4264b7fea8e89b56638
Author: Brecht Van Lommel
Date:   Wed May 15 17:55:28 2019 +0200
Branches: master
https://developer.blender.org/rBA8c37a7fe4a81e89c2400d4264b7fea8e89b56638

Update for object add align property changes

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

M	add_curve_extra_objects/add_curve_curly.py
M	add_curve_extra_objects/beveltaper_curve.py
M	add_mesh_BoltFactory/Boltfactory.py
M	add_mesh_extra_objects/add_mesh_honeycomb.py
M	add_mesh_extra_objects/add_mesh_menger_sponge.py
M	archipack/archipack_thumbs.py
M	camera_dolly_crane_rigs.py
M	io_import_gimp_image_to_scene.py
M	io_mesh_atomic/pdb_import.py
M	io_mesh_atomic/utility_panel.py
M	io_mesh_atomic/xyz_import.py
M	light_field_tools/light_field_tools.py
M	mesh_bsurfaces.py
M	mesh_tissue/lattice.py
M	presets/operator/curve.torus_knot_plus/13x8_wicker_globe.py
M	presets/operator/curve.torus_knot_plus/7x6.py
M	presets/operator/curve.torus_knot_plus/9x9_color.py
M	presets/operator/curve.torus_knot_plus/braided_coil.py
M	presets/operator/curve.torus_knot_plus/flower_mesh_(2d).py
M	presets/operator/curve.torus_knot_plus/slinky_knot.py
M	presets/operator/curve.torus_knot_plus/snowflake_(2d).py
M	presets/operator/curve.torus_knot_plus/sun_cross_(2d).py
M	presets/operator/curve.torus_knot_plus/tripple_dna.py
M	presets/operator/curve.torus_knot_plus/wicker_basket.py

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

diff --git a/add_curve_extra_objects/add_curve_curly.py b/add_curve_extra_objects/add_curve_curly.py
index 3a8153b5..813509c1 100644
--- a/add_curve_extra_objects/add_curve_curly.py
+++ b/add_curve_extra_objects/add_curve_curly.py
@@ -456,7 +456,7 @@ class add_curlycurve(Operator, AddObjectHelper):
 
         col = layout.column(align=True)
         # AddObjectHelper props
-        col.prop(self, "view_align")
+        col.prop(self, "align")
         col.prop(self, "location")
         col.prop(self, "rotation")
 
diff --git a/add_curve_extra_objects/beveltaper_curve.py b/add_curve_extra_objects/beveltaper_curve.py
index d85b985c..608b5bf5 100644
--- a/add_curve_extra_objects/beveltaper_curve.py
+++ b/add_curve_extra_objects/beveltaper_curve.py
@@ -195,7 +195,7 @@ def add_type1(self, context):
 def make_path(self, context, verts):
     target = bpy.context.view_layer.objects.active
     bpy.ops.curve.primitive_nurbs_path_add(
-            view_align=False, enter_editmode=False, location=(0, 0, 0)
+            align='WORLD', enter_editmode=False, location=(0, 0, 0)
             )
     target.data.taper_object = bpy.context.view_layer.objects.active
     taper = bpy.context.view_layer.objects.active
@@ -359,7 +359,7 @@ class add_bevelcurve(Operator, AddObjectHelper):
 
         col = layout.column(align=True)
         # AddObjectHelper props
-        col.prop(self, "view_align")
+        col.prop(self, "align")
         col.prop(self, "location")
         col.prop(self, "rotation")
 
diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py
index c021f111..2f1f6bfc 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -237,23 +237,6 @@ class add_mesh_bolt(Operator, AddObjectHelper):
             description='Flat distance of the Hex Nut'
             )
 
-        # generic transform props
-    view_align: BoolProperty(
-            name="Align to View",
-            default=False,
-            update=AddObjectHelper.view_align_update_callback,
-            )
-
-    location: FloatVectorProperty(
-            name="Location",
-            subtype='TRANSLATION',
-            )
-
-    rotation: FloatVectorProperty(
-            name="Rotation",
-            subtype='EULER',
-            )
-
     def draw(self, context):
         layout = self.layout
         col = layout.column()
@@ -314,7 +297,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
 
         # generic transform props
         col.separator()
-        col.prop(self, 'view_align')
+        col.prop(self, 'align')
         col.prop(self, 'location')
         col.prop(self, 'rotation')
 
@@ -355,4 +338,4 @@ def unregister():
     from bpy.utils import unregister_class
     for cls in reversed(classes):
         unregister_class(cls)
-    bpy.types.VIEW3D_MT_mesh_add.remove(menu_func_bolt)
\ No newline at end of file
+    bpy.types.VIEW3D_MT_mesh_add.remove(menu_func_bolt)
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'}
diff --git a/archipack/archipack_thumbs.py b/archipack/archipack_thumbs.py
index 46d01543..3cdbee64 100644
--- a/archipack/archipack_thumbs.py
+++ b/archipack/archipack_thumbs.py
@@ -37,7 +37,7 @@ def create_lamp(context, loc):
     bpy.ops.object.light_add(
         type='POINT',
         radius=1,
-        view_align=False,
+        align='WORLD',
         location=loc)
     lamp = context.active_object
     lamp.data.use_nodes = True
@@ -47,7 +47,7 @@ def create_lamp(context, loc):
 
 def create_camera(context, loc, rot):
     bpy.ops.object.camera_add(
-        view_align=True,
+        align='VIEW',
         enter_editmode=False,
         location=loc,
         rotation=rot)
@@ -159,7 +159,7 @@ def generateThumb(context, cls, preset, engine):
     # add plane
     bpy.ops.mesh.primitive_plane_add(
         size=1000,
-        view_align=False,
+        align='WORLD',
         enter_editmode=False,
         location=(0, 0, 0)
     )
diff --git a/camera_dolly_crane_rigs.py b/camera_dolly_crane_rigs.py
index 13025675..4a430813 100644
--- a/camera_dolly_crane_rigs.py
+++ b/camera_dolly_crane_rigs.py
@@ -525,7 +525,7 @@ def build_dolly_rig(context):
     bpy.ops.object.mode_set(mode='OBJECT')
 
     bpy.ops.object.camera_add(
-        view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))
+        align='WORLD', enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))
     cam = bpy.context.active_object
 
     # this will name the Camera Object
@@ -711,7 +711,7 @@ def build_crane_rig(context):
     bpy.ops.object.mode_set(mode='OBJECT')
 
     bpy.ops.object.camera_add(
-        view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))
+        align='WORLD', enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))
     cam = bpy.context.active_object
 
     # this will name the Camera Object
diff --git a/io_import_gimp_image_to_scene.py b/io_import_gimp_image_to_scene.py
index f7b8233c..d4ed8f3b 100644
--- a/io_import_gimp_image_to_scene.py
+++ b/io_import_gimp_image_to_scene.py
@@ -292,7 +292,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
                 LayerNum += 1
 
         # Object
-        bpy.ops.mesh.primitive_plane_add(view_align=False,
+        bpy.ops.mesh.primitive_plane_add(align='WORLD',
                                          enter_editmode=False,
                                          rotation=(0, 0, 0))
 
diff --git a/io_mesh_atomic/pdb_import.py b/io_mesh_atomic/pdb_import.py
index 7d719cd8..815c9bc2 100644
--- a/io_mesh_atomic/pdb_import.py
+++ b/io_mesh_atomic/pdb_import.py
@@ -694,24 +694,24 @@ def draw_atoms_one_type(draw_all_atoms_type,
     # Now, build a representative sphere (atom).
     if atom[0] == "Vacancy":
         bpy.ops.mesh.primitive_cube_add(
-                        view_align=False, enter_editmode=False,
+                        align='WORLD', enter_editmode=False,
                         location=(0.0, 0.0, 0.0),
                         rotation=(0.0, 0.0, 0.0))
     else:
         # NURBS balls
         if Ball_type == "0":
             bpy.ops.surface.primitive_nurbs_surface_sphere_add(
-                        view_align=False, enter_editmode=False,
+                        align='WORLD', enter_editmode=False,
                         location=(0,0,0), rotation=(0.0, 0.0, 0.0))
         # UV balls
         elif Ball_type == "1":
             bpy.ops.mesh.primitive_uv_sphere_add(
                         segments=Ball_azimuth, ring_count=Ball_zenith,
-                        view_align=False, enter_editmode=False,
+                        align='WORLD', enter_editmode=False,
                         location=(0,0,0), rotation=(0, 0, 0))
         # Meta balls
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list