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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-12-11 15:03:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-12-11 15:04:29 +0400
commit2a55d68e1927aa2a6b85607a98617fd8a7f71ca9 (patch)
tree74768b6db6ac302caa98d05ab9ac88a69d2bf98f /release/scripts/startup/bl_ui/properties_data_curve.py
parent3a370ec6ecb7c481ff7a9f0d5108367c903a29c1 (diff)
Fix for curve pinning raising an exception
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_data_curve.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_data_curve.py66
1 files changed, 28 insertions, 38 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index 1d90535b46f..ea0b3d80bd1 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -21,6 +21,8 @@ import bpy
from bpy.types import Panel
from rna_prop_ui import PropertyPanel
+from bpy.types import Curve, SurfaceCurve, TextCurve
+
class CurveButtonsPanel():
bl_space_type = 'PROPERTIES'
@@ -29,15 +31,25 @@ class CurveButtonsPanel():
@classmethod
def poll(cls, context):
- return (context.object and context.object.type in {'CURVE', 'SURFACE', 'FONT'} and context.curve)
+ return (context.curve is not None)
class CurveButtonsPanelCurve(CurveButtonsPanel):
- """Same as above but for curves only"""
+ @classmethod
+ def poll(cls, context):
+ return (type(context.curve) is Curve)
+
+
+class CurveButtonsPanelSurface(CurveButtonsPanel):
+ @classmethod
+ def poll(cls, context):
+ return (type(context.curve) is SurfaceCurve)
+
+class CurveButtonsPanelText(CurveButtonsPanel):
@classmethod
def poll(cls, context):
- return (context.object and context.object.type == 'CURVE' and context.curve)
+ return (type(context.curve) is TextCurve)
class CurveButtonsPanelActive(CurveButtonsPanel):
@@ -46,7 +58,7 @@ class CurveButtonsPanelActive(CurveButtonsPanel):
@classmethod
def poll(cls, context):
curve = context.curve
- return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
+ return (curve and type(curve) is not TextCurve and curve.splines.active)
class DATA_PT_context_curve(CurveButtonsPanel, Panel):
@@ -56,14 +68,14 @@ class DATA_PT_context_curve(CurveButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
- ob = context.object
+ obj = context.object
curve = context.curve
space = context.space_data
- if ob:
- layout.template_ID(ob, "data")
+ if obj:
+ layout.template_ID(obj, "data")
elif curve:
- layout.template_ID(space, "pin_id") # XXX: broken
+ layout.template_ID(space, "pin_id")
class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
@@ -72,11 +84,10 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
- ob = context.object
curve = context.curve
- is_surf = (ob.type == 'SURFACE')
- is_curve = (ob.type == 'CURVE')
- is_text = (ob.type == 'FONT')
+ is_surf = type(curve) is SurfaceCurve
+ is_curve = type(curve) is Curve
+ is_text = type(curve) is TextCurve
if is_curve:
row = layout.row()
@@ -143,17 +154,9 @@ class DATA_PT_curve_texture_space(CurveButtonsPanel, Panel):
layout.operator("curve.match_texture_space")
-class DATA_PT_geometry_curve(CurveButtonsPanel, Panel):
+class DATA_PT_geometry_curve(CurveButtonsPanelSurface, Panel):
bl_label = "Geometry"
- @classmethod
- def poll(cls, context):
- obj = context.object
- if obj and obj.type == 'SURFACE':
- return False
-
- return context.curve
-
def draw(self, context):
layout = self.layout
@@ -216,10 +219,9 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
def draw(self, context):
layout = self.layout
- ob = context.object
curve = context.curve
act_spline = curve.splines.active
- is_surf = (ob.type == 'SURFACE')
+ is_surf = type(curve) is SurfaceCurve
is_poly = (act_spline.type == 'POLY')
split = layout.split()
@@ -281,13 +283,9 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
layout.prop(act_spline, "use_smooth")
-class DATA_PT_font(CurveButtonsPanel, Panel):
+class DATA_PT_font(CurveButtonsPanelText, Panel):
bl_label = "Font"
- @classmethod
- def poll(cls, context):
- return (context.object and context.object.type == 'FONT' and context.curve)
-
def draw(self, context):
layout = self.layout
@@ -345,13 +343,9 @@ class DATA_PT_font(CurveButtonsPanel, Panel):
row.prop(char, "use_small_caps")
-class DATA_PT_paragraph(CurveButtonsPanel, Panel):
+class DATA_PT_paragraph(CurveButtonsPanelText, Panel):
bl_label = "Paragraph"
- @classmethod
- def poll(cls, context):
- return (context.object and context.object.type == 'FONT' and context.curve)
-
def draw(self, context):
layout = self.layout
@@ -374,13 +368,9 @@ class DATA_PT_paragraph(CurveButtonsPanel, Panel):
col.prop(text, "offset_y", text="Y")
-class DATA_PT_text_boxes(CurveButtonsPanel, Panel):
+class DATA_PT_text_boxes(CurveButtonsPanelText, Panel):
bl_label = "Text Boxes"
- @classmethod
- def poll(cls, context):
- return (context.object and context.object.type == 'FONT' and context.curve)
-
def draw(self, context):
layout = self.layout