diff options
Diffstat (limited to 'release/ui/buttons_data_curve.py')
-rw-r--r-- | release/ui/buttons_data_curve.py | 209 |
1 files changed, 141 insertions, 68 deletions
diff --git a/release/ui/buttons_data_curve.py b/release/ui/buttons_data_curve.py index 92e414ba2f3..70904239d86 100644 --- a/release/ui/buttons_data_curve.py +++ b/release/ui/buttons_data_curve.py @@ -7,8 +7,23 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): + return (context.object and context.object.type in ('CURVE', 'SURFACE') and context.curve) + +class DataButtonsPanelCurve(DataButtonsPanel): + ''' + Same as above but for curves only + ''' + def poll(self, context): return (context.object and context.object.type == 'CURVE' and context.curve) +class DataButtonsPanelActive(DataButtonsPanel): + ''' + Same as above but for curves only + ''' + def poll(self, context): + curve = context.curve + return (curve and curve.active_spline) + class DATA_PT_context_curve(DataButtonsPanel): __show_header__ = False @@ -37,37 +52,52 @@ class DATA_PT_shape_curve(DataButtonsPanel): ob = context.object curve = context.curve space = context.space_data + is_surf = (ob.type == 'SURFACE') - if curve: - layout.itemR(curve, "curve_2d") - - split = layout.split() + if not is_surf: + row = layout.row() + row.itemR(curve, "dimensions", expand=True) - col = split.column() - colsub = col.column() - colsub.active = curve.curve_2d - colsub.itemL(text="Caps:") - colsub.itemR(curve, "front") - colsub.itemR(curve, "back") + split = layout.split() + + col = split.column() + + if not is_surf: + sub = col.column() + sub.active = (curve.dimensions=='2D') + sub.itemL(text="Caps:") + row = sub.row() + row.itemR(curve, "front") + row.itemR(curve, "back") - col.itemL(text="Textures:") -# col.itemR(curve, "uv_orco") - col.itemR(curve, "auto_texspace") + col.itemL(text="Textures:") +# col.itemR(curve, "uv_orco") + col.itemR(curve, "auto_texspace") - sub = split.column() - sub.itemL(text="Resolution:") - sub.itemR(curve, "resolution_u", text="Preview U") + col = split.column() + col.itemL(text="Resolution:") + sub = col.column(align=True) + sub.itemR(curve, "resolution_u", text="Preview U") + sub.itemR(curve, "render_resolution_u", text="Render U") + + if is_surf: + sub = col.column(align=True) sub.itemR(curve, "resolution_v", text="Preview V") - sub.itemR(curve, "render_resolution_u", text="Render U") sub.itemR(curve, "render_resolution_v", text="Render V") + + # XXX - put somewhere nicer. + row= layout.row() + row.itemR(curve, "twist_mode") + row.itemR(curve, "twist_smooth") # XXX - may not be kept -# sub.itemL(text="Display:") -# sub.itemL(text="HANDLES") -# sub.itemL(text="NORMALS") -# sub.itemR(curve, "vertex_normal_flip") + +# col.itemL(text="Display:") +# col.itemL(text="HANDLES") +# col.itemL(text="NORMALS") +# col.itemR(curve, "vertex_normal_flip") class DATA_PT_geometry_curve(DataButtonsPanel): - __label__ = "Geometry " + __label__ = "Geometry" def draw(self, context): layout = self.layout @@ -76,80 +106,123 @@ class DATA_PT_geometry_curve(DataButtonsPanel): split = layout.split() - sub = split.column() - sub.itemL(text="Modification:") - sub.itemR(curve, "width") - sub.itemR(curve, "extrude") - sub.itemR(curve, "taper_object", icon='ICON_OUTLINER_OB_CURVE') - - sub = split.column() - sub.itemL(text="Bevel:") - sub.itemR(curve, "bevel_depth", text="Depth") - sub.itemR(curve, "bevel_resolution", text="Resolution") - sub.itemR(curve, "bevel_object", icon='ICON_OUTLINER_OB_CURVE') + col = split.column() + col.itemL(text="Modification:") + col.itemR(curve, "width") + col.itemR(curve, "extrude") + col.itemL(text="Taper Object:") + col.itemR(curve, "taper_object", text="") + + col = split.column() + col.itemL(text="Bevel:") + col.itemR(curve, "bevel_depth", text="Depth") + col.itemR(curve, "bevel_resolution", text="Resolution") + col.itemL(text="Bevel Object:") + col.itemR(curve, "bevel_object", text="") + -class DATA_PT_pathanim(DataButtonsPanel): +class DATA_PT_pathanim(DataButtonsPanelCurve): __label__ = "Path Animation" def draw_header(self, context): - layout = self.layout - curve = context.curve - layout.itemR(curve, "path", text="") + self.layout.itemR(curve, "use_path", text="") def draw(self, context): layout = self.layout curve = context.curve - layout.active = curve.path + layout.active = curve.use_path split = layout.split() col = split.column() col.itemR(curve, "path_length", text="Frames") - col.itemR(curve, "follow") + col.itemR(curve, "use_path_follow") col = split.column() - col.itemR(curve, "stretch") - col.itemR(curve, "offset_path_distance", text="Offset Children") + col.itemR(curve, "use_stretch") + col.itemR(curve, "use_radius") + col.itemR(curve, "use_time_offset", text="Offset Children") -class DATA_PT_current_curve(DataButtonsPanel): - __label__ = "Current Curve" +class DATA_PT_active_spline(DataButtonsPanelActive): + __label__ = "Active Spline" def draw(self, context): layout = self.layout - currentcurve = context.curve.curves[0] # XXX - + ob = context.object + curve = context.curve + act_spline = curve.active_spline + is_surf = (ob.type == 'SURFACE') + is_poly = (act_spline.type == 'POLY') + split = layout.split() - - col = split.column() - col.itemL(text="Cyclic:") - col.itemR(currentcurve, "cyclic_u", text="U") - col.itemR(currentcurve, "cyclic_v", text="V") - col.itemL(text="Order:") - col.itemR(currentcurve, "order_u", text="U") - col.itemR(currentcurve, "order_v", text="V") - col.itemL(text="Endpoints:") - col.itemR(currentcurve, "endpoint_u", text="U") - col.itemR(currentcurve, "endpoint_v", text="V") - col = split.column() - col.itemL(text="Bezier:") - col.itemR(currentcurve, "bezier_u", text="U") - col.itemR(currentcurve, "bezier_v", text="V") - col.itemL(text="Resolution:") - col.itemR(currentcurve, "resolution_u", text="U") - col.itemR(currentcurve, "resolution_v", text="V") - col.itemL(text="Interpolation:") - col.itemR(currentcurve, "tilt_interpolation", text="Tilt") - col.itemR(currentcurve, "radius_interpolation", text="Tilt") - col.itemR(currentcurve, "smooth") + if is_poly: + # These settings are below but its easier to have + # poly's set aside since they use so few settings + col = split.column() + col.itemL(text="Cyclic:") + col.itemR(act_spline, "smooth") + col = split.column() + col.itemR(act_spline, "cyclic_u", text="U") + else: + col = split.column() + col.itemL(text="Cyclic:") + if act_spline.type == 'NURBS': + col.itemL(text="Bezier:") + col.itemL(text="Endpoint:") + col.itemL(text="Order:") + + col.itemL(text="Resolution:") + + col = split.column() + col.itemR(act_spline, "cyclic_u", text="U") + + if act_spline.type == 'NURBS': + sub = col.column() + # sub.active = (not act_spline.cyclic_u) + sub.itemR(act_spline, "bezier_u", text="U") + sub.itemR(act_spline, "endpoint_u", text="U") + + sub = col.column() + sub.itemR(act_spline, "order_u", text="U") + col.itemR(act_spline, "resolution_u", text="U") + + if is_surf: + col = split.column() + col.itemR(act_spline, "cyclic_v", text="V") + + # its a surface, assume its a nurb. + sub = col.column() + sub.active = (not act_spline.cyclic_v) + sub.itemR(act_spline, "bezier_v", text="V") + sub.itemR(act_spline, "endpoint_v", text="V") + sub = col.column() + sub.itemR(act_spline, "order_v", text="V") + sub.itemR(act_spline, "resolution_v", text="V") + + + if not is_surf: + split = layout.split() + col = split.column() + col.active = (curve.dimensions=='3D') + + col.itemL(text="Interpolation:") + col.itemR(act_spline, "tilt_interpolation", text="Tilt") + col.itemR(act_spline, "radius_interpolation", text="Radius") + + split = layout.split() + col = split.column() + col.itemR(act_spline, "smooth") + + bpy.types.register(DATA_PT_context_curve) bpy.types.register(DATA_PT_shape_curve) bpy.types.register(DATA_PT_geometry_curve) bpy.types.register(DATA_PT_pathanim) -bpy.types.register(DATA_PT_current_curve) +bpy.types.register(DATA_PT_active_spline) |