From 156c5ea6a45d0549d8422e3ea295972dec7766c3 Mon Sep 17 00:00:00 2001 From: "Spivak Vladimir (cwolf3d)" Date: Wed, 19 Dec 2018 02:35:52 +0200 Subject: Update addon to Blender 2.8 --- add_curve_extra_objects/add_surface_plane_cone.py | 51 ++++++++++++----------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'add_curve_extra_objects/add_surface_plane_cone.py') diff --git a/add_curve_extra_objects/add_surface_plane_cone.py b/add_curve_extra_objects/add_surface_plane_cone.py index ad5e1eb9..4f34f654 100644 --- a/add_curve_extra_objects/add_surface_plane_cone.py +++ b/add_curve_extra_objects/add_surface_plane_cone.py @@ -4,8 +4,8 @@ bl_info = { "name": "Surface: Plane / Cone/ Star / Wedge", "description": "Create a NURBS surface plane", "author": "Folkert de Vries", - "version": (1, 0, 1), - "blender": (2, 5, 9), + "version": (1, 0, 2), + "blender": (2, 80, 0), "location": "View3D > Add > Surface", "warning": "", "wiki_url": "", @@ -31,7 +31,7 @@ from bpy.types import Operator # generic class for inheritance class MakeSurfaceHelpers: # get input for size and resolution - size = FloatProperty( + size : FloatProperty( name="Size", description="Size of the object", default=1.0, @@ -39,14 +39,14 @@ class MakeSurfaceHelpers: max=100.0, unit="LENGTH", ) - res_u = IntProperty( + res_u : IntProperty( name="Resolution U", description="Surface resolution in u direction", default=1, min=1, max=500, ) - res_v = IntProperty( + res_v : IntProperty( name="Resolution V", description="Surface resolution in v direction", default=1, @@ -71,7 +71,7 @@ class MakeSurfaceWedge(Operator, MakeSurfaceHelpers): bl_idname = "object.add_surface_wedge" bl_label = "Add Surface Wedge" bl_description = "Construct a Surface Wedge" - bl_options = {'REGISTER', 'UNDO'} + bl_options = {'REGISTER', 'UNDO', 'PRESET'} def execute(self, context): # variables @@ -137,7 +137,7 @@ class MakeSurfaceCone(Operator, MakeSurfaceHelpers): bl_idname = "object.add_surface_cone" bl_label = "Add Surface Cone" bl_description = "Construct a Surface Cone" - bl_options = {'REGISTER', 'UNDO'} + bl_options = {'REGISTER', 'UNDO', 'PRESET'} def execute(self, context): size = self.size @@ -283,7 +283,7 @@ class MakeSurfacePlane(Operator, MakeSurfaceHelpers): bl_idname = "object.add_surface_plane" bl_label = "Add Surface Plane" bl_description = "Construct a Surface Plane" - bl_options = {'REGISTER', 'UNDO'} + bl_options = {'REGISTER', 'UNDO', 'PRESET'} def execute(self, context): size = self.size @@ -347,15 +347,15 @@ class MakeSurfacePlane(Operator, MakeSurfaceHelpers): class SmoothXtimes(Operator): bl_idname = "curve.smooth_x_times" bl_label = "Smooth X Times" - bl_space_type = "VIEW_3D" - bl_options = {'REGISTER', 'UNDO'} + #bl_space_type = "VIEW_3D" + bl_options = {'REGISTER', 'UNDO', 'PRESET'} # use of this class: # lets you smooth till a thousand times. this is normally difficult, because # you have to press w, click, press w, click etc. # get values - times = IntProperty( + times : IntProperty( name="Smooth x Times", min=1, max=1000, @@ -375,24 +375,25 @@ class SmoothXtimes(Operator): return{'FINISHED'} +# Register +classes = [ + #MakeSurfaceHelpers, + MakeSurfacePlane, + MakeSurfaceCone, + MakeSurfaceStar, + MakeSurfaceWedge, + SmoothXtimes +] def register(): - bpy.utils.register_class(MakeSurfaceHelpers) - bpy.utils.register_class(MakeSurfacePlane) - bpy.utils.register_class(MakeSurfaceCone) - bpy.utils.register_class(MakeSurfaceStar) - bpy.utils.register_class(MakeSurfaceWedge) - bpy.utils.register_class(SmoothXtimes) - + from bpy.utils import register_class + for cls in classes: + register_class(cls) def unregister(): - bpy.utils.unregister_class(MakeSurfaceHelpers) - bpy.utils.unregister_class(MakeSurfacePlane) - bpy.utils.unregister_class(MakeSurfaceCone) - bpy.utils.unregister_class(MakeSurfaceStar) - bpy.utils.unregister_class(MakeSurfaceWedge) - bpy.utils.unregister_class(SmoothXtimes) - + from bpy.utils import unregister_class + for cls in reversed(classes): + unregister_class(cls) if __name__ == "__main__": register() -- cgit v1.2.3