Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-05-25 15:07:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-05-25 15:07:32 +0300
commitf22c2ff5e63fc0383b803c57c20eca045993914e (patch)
treeb2611479dd7bcfb2feb8db8ee3ded8f731f8b257 /render_povray
parentd019aad1a5b745cc9e6f14b55c68ab12891e6d5d (diff)
Use 2D curve for lathe
Also avoid editmode switch
Diffstat (limited to 'render_povray')
-rw-r--r--render_povray/primitives.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/render_povray/primitives.py b/render_povray/primitives.py
index f76a41ee..7259425e 100644
--- a/render_povray/primitives.py
+++ b/render_povray/primitives.py
@@ -39,8 +39,9 @@ from bpy.props import (
)
from mathutils import (
- Vector,
- )
+ Vector,
+ Matrix,
+)
#import collections
@@ -67,20 +68,23 @@ class POVRAY_OT_lathe_add(bpy.types.Operator):
def execute(self, context):
layers=[False]*20
layers[0]=True
- bpy.ops.curve.primitive_bezier_curve_add(location=(0, 0, 0),
- rotation=(0, 0, 0), layers=layers)
- ob=context.scene.objects.active
- ob.name = ob.data.name = "PovLathe"
+ bpy.ops.curve.primitive_bezier_curve_add(
+ location=context.scene.cursor_location,
+ rotation=(0, 0, 0),
+ layers=layers,
+ )
+ ob = context.scene.objects.active
+ ob_data = ob.data
+ ob.name = ob_data.name = "PovLathe"
+ ob_data.dimensions = '2D'
+ ob_data.transform(Matrix.Rotation(-pi / 2.0, 4, 'Z'))
ob.pov.object_as='LATHE'
- bpy.ops.object.mode_set(mode='EDIT')
- self.report({'INFO'}, "This native POV-Ray primitive "
- "won't have any vertex to show in edit mode")
- bpy.ops.transform.rotate(value=-pi/2, axis=(0, 0, 1))
- bpy.ops.object.mode_set(mode='OBJECT')
+ self.report({'INFO'}, "This native POV-Ray primitive")
ob.pov.curveshape = "lathe"
bpy.ops.object.modifier_add(type='SCREW')
- bpy.context.object.modifiers["Screw"].axis = 'Y'
- bpy.context.object.modifiers["Screw"].show_render = False
+ mod = ob.modifiers[-1]
+ mod.axis = 'Y'
+ mod.show_render = False
return {'FINISHED'}