diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-08 04:33:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-08 04:33:52 +0300 |
commit | 27a32b3ed5f8ae2ae332ff403d2fb68d876840fe (patch) | |
tree | 20c63499f5b64b02681ab57f2a1167f5a4bdb13f /add_curve_extra_objects/add_curve_aceous_galore.py | |
parent | 226b00844624cdc222bfcf0aac6c226b96de3550 (diff) |
Don't access bpy.context when context is passed
also quiet 'description' warnings.
Diffstat (limited to 'add_curve_extra_objects/add_curve_aceous_galore.py')
-rw-r--r-- | add_curve_extra_objects/add_curve_aceous_galore.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py index dbe45bb1..fc6ff058 100644 --- a/add_curve_extra_objects/add_curve_aceous_galore.py +++ b/add_curve_extra_objects/add_curve_aceous_galore.py @@ -34,9 +34,17 @@ bl_info = { ##------------------------------------------------------------ #### import modules import bpy -from bpy.props import * -from mathutils import * -from math import * +from bpy.props import ( + BoolProperty, + EnumProperty, + FloatProperty, + IntProperty, + ) +from mathutils import ( + Matrix, + Vector, + ) +from math import sin, cos, pi import mathutils.noise as Noise ###------------------------------------------------------------ #### Some functions to use with others: @@ -641,13 +649,13 @@ def vertsToPoints(Verts, splineType): return vertArray # create new CurveObject from vertarray and splineType -def createCurve(vertArray, self, align_matrix): +def createCurve(context, vertArray, self, align_matrix): # options to vars splineType = self.outputType # output splineType 'POLY' 'NURBS' 'BEZIER' name = self.GalloreType # GalloreType as name # create curve - scene = bpy.context.scene + scene = context.scene newCurve = bpy.data.curves.new(name, type = 'CURVE') # curvedatablock newSpline = newCurve.splines.new(type = splineType) # spline @@ -757,7 +765,7 @@ def main(context, self, align_matrix): vertArray = vertsToPoints(verts, splineType) # create object - createCurve(vertArray, self, align_matrix) + createCurve(context, vertArray, self, align_matrix) return @@ -1090,8 +1098,8 @@ class Curveaceous_galore(bpy.types.Operator): ##### EXECUTE ##### def execute(self, context): # turn off undo - undo = bpy.context.user_preferences.edit.use_global_undo - bpy.context.user_preferences.edit.use_global_undo = False + undo = context.user_preferences.edit.use_global_undo + context.user_preferences.edit.use_global_undo = False # deal with 2D - 3D curve differences if self.GalloreType in ['Helix', 'Cycloid']: @@ -1109,7 +1117,7 @@ class Curveaceous_galore(bpy.types.Operator): main(context, self, self.align_matrix or Matrix()) # restore pre operator undo state - bpy.context.user_preferences.edit.use_global_undo = undo + context.user_preferences.edit.use_global_undo = undo return {'FINISHED'} |