blender/release/ui/buttons_data_curve.py
Brecht Van Lommel d091856486 2.5: Buttons Window
* Fix poll() callback changes in recent commit, note that these have
  to work with pinned context too.
* Hide header for context panels in py layout.
* Don't jump back when collapsing a panel, allow the view to be
  over some empty space until you scroll back.
* Fix follow context icon, order had to be reversed in icon file.
* ID template now has icon as part of browse button instead of
  outside the buttons.
2009-07-09 19:45:27 +00:00

158 lines
4.1 KiB
Python

import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "data"
def poll(self, context):
return (context.object and context.object.type == 'CURVE' and context.curve)
class DATA_PT_context_curve(DataButtonsPanel):
__idname__ = "DATA_PT_context_curve"
__no_header__ = True
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif curve:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_shape_curve(DataButtonsPanel):
__idname__ = "DATA_PT_shape_curve"
__label__ = "Shape"
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
if curve:
layout.itemR(curve, "curve_2d")
split = layout.split()
col = split.column()
colsub = col.column()
colsub.active = curve.curve_2d
colsub.itemL(text="Caps:")
colsub.itemR(curve, "front")
colsub.itemR(curve, "back")
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")
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")
# sub.itemL(text="Display:")
# sub.itemL(text="HANDLES")
# sub.itemL(text="NORMALS")
# sub.itemR(curve, "vertex_normal_flip")
class DATA_PT_geometry_curve(DataButtonsPanel):
__idname__ = "DATA_PT_geometry_curve"
__label__ = "Geometry "
def draw(self, context):
layout = self.layout
curve = context.curve
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")
class DATA_PT_pathanim(DataButtonsPanel):
__idname__ = "DATA_PT_pathanim"
__label__ = "Path Animation"
def draw_header(self, context):
layout = self.layout
curve = context.curve
layout.itemR(curve, "path", text="")
def draw(self, context):
curve = context.curve
layout = self.layout
layout.active = curve.path
split = layout.split()
sub = split.column()
sub.itemR(curve, "path_length", text="Frames")
sub.itemR(curve, "follow")
sub = split.column()
sub.itemR(curve, "stretch")
sub.itemR(curve, "offset_path_distance", text="Offset Children")
class DATA_PT_current_curve(DataButtonsPanel):
__idname__ = "DATA_PT_current_curve"
__label__ = "Current Curve"
def draw(self, context):
layout = self.layout
currentcurve = context.curve.curves[0] # XXX
split = layout.split()
sub = split.column()
sub.itemL(text="Cyclic:")
sub.itemR(currentcurve, "cyclic_u", text="U")
sub.itemR(currentcurve, "cyclic_v", text="V")
sub.itemL(text="Order:")
sub.itemR(currentcurve, "order_u", text="U")
sub.itemR(currentcurve, "order_v", text="V")
sub.itemL(text="Endpoints:")
sub.itemR(currentcurve, "endpoint_u", text="U")
sub.itemR(currentcurve, "endpoint_v", text="V")
sub = split.column()
sub.itemL(text="Bezier:")
sub.itemR(currentcurve, "bezier_u", text="U")
sub.itemR(currentcurve, "bezier_v", text="V")
sub.itemL(text="Resolution:")
sub.itemR(currentcurve, "resolution_u", text="U")
sub.itemR(currentcurve, "resolution_v", text="V")
sub.itemL(text="Interpolation:")
sub.itemR(currentcurve, "tilt_interpolation", text="Tilt")
sub.itemR(currentcurve, "radius_interpolation", text="Tilt")
sub.itemR(currentcurve, "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)