From 4123c1fd7b5721b29ba785b926755a633f724553 Mon Sep 17 00:00:00 2001 From: William Reynish Date: Thu, 12 Nov 2009 21:44:35 +0000 Subject: [PATCH] Made a few more property areas work with a single column. Also fixed a few minor layout issues. --- .../scripts/ui/properties_data_armature.py | 89 ++++++++++++----- release/scripts/ui/properties_data_bone.py | 98 ++++++++++++------- release/scripts/ui/properties_data_camera.py | 57 +++++++---- release/scripts/ui/properties_data_lamp.py | 97 ++++++++++++------ release/scripts/ui/properties_object.py | 7 +- release/scripts/ui/properties_world.py | 17 ++-- 6 files changed, 247 insertions(+), 118 deletions(-) diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index f45f7ab6f60..a433ca5ccb3 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -19,6 +19,7 @@ # import bpy +narrowui = 180 class DataButtonsPanel(bpy.types.Panel): bl_space_type = 'PROPERTIES' @@ -39,15 +40,18 @@ class DATA_PT_context_arm(DataButtonsPanel): ob = context.object arm = context.armature space = context.space_data - - split = layout.split(percentage=0.65) - - if ob: - split.template_ID(ob, "data") - split.itemS() - elif arm: - split.template_ID(space, "pin_id") - split.itemS() + col2 = context.region.width > narrowui + + if col2: + split = layout.split(percentage=0.65) + if ob: + split.template_ID(ob, "data") + split.itemS() + elif arm: + split.template_ID(space, "pin_id") + split.itemS() + else: + layout.template_ID(ob, "data") class DATA_PT_skeleton(DataButtonsPanel): @@ -59,6 +63,7 @@ class DATA_PT_skeleton(DataButtonsPanel): ob = context.object arm = context.armature space = context.space_data + col2 = context.region.width > narrowui layout.itemR(arm, "pose_position", expand=True) @@ -70,7 +75,8 @@ class DATA_PT_skeleton(DataButtonsPanel): col.itemL(text="Protected Layers:") col.itemR(arm, "layer_protection", text="") - col = split.column() + if col2: + col = split.column() col.itemL(text="Deform:") col.itemR(arm, "deform_vertexgroups", text="Vertex Groups") col.itemR(arm, "deform_envelope", text="Envelopes") @@ -85,15 +91,24 @@ class DATA_PT_display(DataButtonsPanel): layout = self.layout arm = context.armature + col2 = context.region.width > narrowui - layout.row().itemR(arm, "drawtype", expand=True) + if col2: + layout.row().itemR(arm, "drawtype", expand=True) + else: + layout.row().itemR(arm, "drawtype", text="") - flow = layout.column_flow() - flow.itemR(arm, "draw_names", text="Names") - flow.itemR(arm, "draw_axes", text="Axes") - flow.itemR(arm, "draw_custom_bone_shapes", text="Shapes") - flow.itemR(arm, "draw_group_colors", text="Colors") - flow.itemR(arm, "delay_deform", text="Delay Refresh") + split = layout.split() + + col = split.column() + col.itemR(arm, "draw_names", text="Names") + col.itemR(arm, "draw_axes", text="Axes") + col.itemR(arm, "draw_custom_bone_shapes", text="Shapes") + + if col2: + col = split.column() + col.itemR(arm, "draw_group_colors", text="Colors") + col.itemR(arm, "delay_deform", text="Delay Refresh") class DATA_PT_bone_groups(DataButtonsPanel): @@ -107,6 +122,7 @@ class DATA_PT_bone_groups(DataButtonsPanel): ob = context.object pose = ob.pose + col2 = context.region.width > narrowui row = layout.row() row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2) @@ -122,11 +138,15 @@ class DATA_PT_bone_groups(DataButtonsPanel): col.active = (ob.proxy == None) col.itemR(group, "name") - split = layout.split(0.5) + split = layout.split() split.active = (ob.proxy == None) - split.itemR(group, "color_set") + + col = split.column() + col.itemR(group, "color_set") if group.color_set: - split.template_triColorSet(group, "colors") + if col2: + col = split.column() + col.template_triColorSet(group, "colors") row = layout.row(align=True) row.active = (ob.proxy == None) @@ -144,8 +164,12 @@ class DATA_PT_paths(DataButtonsPanel): layout = self.layout arm = context.armature + col2 = context.region.width > narrowui - layout.itemR(arm, "paths_type", expand=True) + if col2: + layout.itemR(arm, "paths_type", expand=True) + else: + layout.itemR(arm, "paths_type", text="") split = layout.split() @@ -161,7 +185,8 @@ class DATA_PT_paths(DataButtonsPanel): sub.itemR(arm, "path_size", text="Step") col.row().itemR(arm, "paths_location", expand=True) - col = split.column() + if col2: + col = split.column() col.itemL(text="Display:") col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers") col.itemR(arm, "paths_highlight_keyframes", text="Keyframes") @@ -169,9 +194,14 @@ class DATA_PT_paths(DataButtonsPanel): layout.itemS() - row = layout.row() - row.itemO("pose.paths_calculate", text="Calculate Paths") - row.itemO("pose.paths_clear", text="Clear Paths") + split = layout.split() + + col = split.column() + col.itemO("pose.paths_calculate", text="Calculate Paths") + + if col2: + col = split.column() + col.itemO("pose.paths_clear", text="Clear Paths") class DATA_PT_ghost(DataButtonsPanel): @@ -181,8 +211,12 @@ class DATA_PT_ghost(DataButtonsPanel): layout = self.layout arm = context.armature + col2 = context.region.width > narrowui - layout.itemR(arm, "ghost_type", expand=True) + if col2: + layout.itemR(arm, "ghost_type", expand=True) + else: + layout.itemR(arm, "ghost_type", text="") split = layout.split() @@ -197,7 +231,8 @@ class DATA_PT_ghost(DataButtonsPanel): sub.itemR(arm, "ghost_step", text="Range") sub.itemR(arm, "ghost_size", text="Step") - col = split.column() + if col2: + col = split.column() col.itemL(text="Display:") col.itemR(arm, "ghost_only_selected", text="Selected Only") diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py index d1dd1163899..042a2e40a15 100644 --- a/release/scripts/ui/properties_data_bone.py +++ b/release/scripts/ui/properties_data_bone.py @@ -19,6 +19,7 @@ # import bpy +narrowui = 180 class BoneButtonsPanel(bpy.types.Panel): bl_space_type = 'PROPERTIES' @@ -53,42 +54,65 @@ class BONE_PT_transform(BoneButtonsPanel): ob = context.object bone = context.bone + col2 = context.region.width > narrowui + if not bone: bone = context.edit_bone - - row = layout.row() - row.column().itemR(bone, "head") - row.column().itemR(bone, "tail") - - col = row.column() - sub = col.column(align=True) - sub.itemL(text="Roll:") - sub.itemR(bone, "roll", text="") - sub.itemL() - sub.itemR(bone, "locked") + if col2: + row = layout.row() + row.column().itemR(bone, "head") + row.column().itemR(bone, "tail") + + col = row.column() + sub = col.column(align=True) + sub.itemL(text="Roll:") + sub.itemR(bone, "roll", text="") + sub.itemL() + sub.itemR(bone, "locked") + else: + col = layout.column() + col.itemR(bone, "head") + col.itemR(bone, "tail") + col.itemR(bone, "roll") + col.itemR(bone, "locked") else: pchan = ob.pose.pose_channels[context.bone.name] - - row = layout.row() - col = row.column() - col.itemR(pchan, "location") - col.active = not (bone.parent and bone.connected) - - col = row.column() - if pchan.rotation_mode == 'QUATERNION': - col.itemR(pchan, "rotation_quaternion", text="Rotation") - elif pchan.rotation_mode == 'AXIS_ANGLE': - #col.itemL(text="Rotation") - #col.itemR(pchan, "rotation_angle", text="Angle") - #col.itemR(pchan, "rotation_axis", text="Axis") - col.itemR(pchan, "rotation_axis_angle", text="Rotation") + + if col2: + row = layout.row() + col = row.column() + col.itemR(pchan, "location") + col.active = not (bone.parent and bone.connected) + + col = row.column() + if pchan.rotation_mode == 'QUATERNION': + col.itemR(pchan, "rotation_quaternion", text="Rotation") + elif pchan.rotation_mode == 'AXIS_ANGLE': + #col.itemL(text="Rotation") + #col.itemR(pchan, "rotation_angle", text="Angle") + #col.itemR(pchan, "rotation_axis", text="Axis") + col.itemR(pchan, "rotation_axis_angle", text="Rotation") + else: + col.itemR(pchan, "rotation_euler", text="Rotation") + + row.column().itemR(pchan, "scale") + + layout.itemR(pchan, "rotation_mode") else: - col.itemR(pchan, "rotation_euler", text="Rotation") - - row.column().itemR(pchan, "scale") - - layout.itemR(pchan, "rotation_mode") + col = layout.column() + sub = col.column() + sub.active = not (bone.parent and bone.connected) + sub.itemR(pchan, "location") + col.itemL(text="Rotation:") + col.itemR(pchan, "rotation_mode", text="") + if pchan.rotation_mode == 'QUATERNION': + col.itemR(pchan, "rotation_quaternion", text="") + elif pchan.rotation_mode == 'AXIS_ANGLE': + col.itemR(pchan, "rotation_axis_angle", text="") + else: + col.itemR(pchan, "rotation_euler", text="") + col.itemR(pchan, "scale") class BONE_PT_transform_locks(BoneButtonsPanel): @@ -131,6 +155,7 @@ class BONE_PT_relations(BoneButtonsPanel): ob = context.object bone = context.bone arm = context.armature + col2 = context.region.width > narrowui if not bone: bone = context.edit_bone @@ -150,7 +175,8 @@ class BONE_PT_relations(BoneButtonsPanel): col.itemL(text="Bone Group:") col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="") - col = split.column() + if col2: + col = split.column() col.itemL(text="Parent:") if context.bone: col.itemR(bone, "parent", text="") @@ -176,6 +202,7 @@ class BONE_PT_display(BoneButtonsPanel): ob = context.object bone = context.bone arm = context.armature + col2 = context.region.width > narrowui if not bone: bone = context.edit_bone @@ -188,12 +215,11 @@ class BONE_PT_display(BoneButtonsPanel): split = layout.split() col = split.column() - col.itemR(bone, "draw_wire", text="Wireframe") col.itemR(bone, "hidden", text="Hide") - col = split.column() - + if col2: + col = split.column() col.itemL(text="Custom Shape:") col.itemR(pchan, "custom_shape", text="") @@ -214,6 +240,7 @@ class BONE_PT_deform(BoneButtonsPanel): layout = self.layout bone = context.bone + col2 = context.region.width > narrowui if not bone: bone = context.edit_bone @@ -235,7 +262,8 @@ class BONE_PT_deform(BoneButtonsPanel): sub.itemR(bone, "head_radius", text="Head") sub.itemR(bone, "tail_radius", text="Tail") - col = split.column() + if col2: + col = split.column() col.itemL(text="Curved Bones:") sub = col.column(align=True) diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py index eefd2432186..50bc3ab49a3 100644 --- a/release/scripts/ui/properties_data_camera.py +++ b/release/scripts/ui/properties_data_camera.py @@ -19,6 +19,7 @@ # import bpy +narrowui = 180 class DataButtonsPanel(bpy.types.Panel): bl_space_type = 'PROPERTIES' @@ -39,15 +40,19 @@ class DATA_PT_context_camera(DataButtonsPanel): ob = context.object cam = context.camera space = context.space_data + col2 = context.region.width > narrowui - split = layout.split(percentage=0.65) - - if ob: - split.template_ID(ob, "data") - split.itemS() - elif cam: - split.template_ID(space, "pin_id") - split.itemS() + if col2: + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif cam: + split.template_ID(space, "pin_id") + split.itemS() + else: + layout.template_ID(ob, "data") class DATA_PT_camera(DataButtonsPanel): @@ -57,16 +62,24 @@ class DATA_PT_camera(DataButtonsPanel): layout = self.layout cam = context.camera + col2 = context.region.width > narrowui - layout.itemR(cam, "type", expand=True) + if col2: + layout.itemR(cam, "type", expand=True) + else: + layout.itemR(cam, "type", text="") - row = layout.row() + split = layout.split() + + col = split.column() if cam.type == 'PERSP': if cam.lens_unit == 'MILLIMETERS': - row.itemR(cam, "lens", text="Angle") + col.itemR(cam, "lens", text="Angle") elif cam.lens_unit == 'DEGREES': - row.itemR(cam, "angle") - row.itemR(cam, "lens_unit", text="") + col.itemR(cam, "angle") + if col2: + col = split.column() + col.itemR(cam, "lens_unit", text="") elif cam.type == 'ORTHO': row.itemR(cam, "ortho_scale") @@ -80,16 +93,22 @@ class DATA_PT_camera(DataButtonsPanel): col.itemR(cam, "shift_x", text="X") col.itemR(cam, "shift_y", text="Y") - col = split.column(align=True) + if col2: + col = split.column(align=True) col.itemL(text="Clipping:") col.itemR(cam, "clip_start", text="Start") col.itemR(cam, "clip_end", text="End") layout.itemL(text="Depth of Field:") - row = layout.row() - row.itemR(cam, "dof_object", text="") - row.itemR(cam, "dof_distance", text="Distance") + split = layout.split() + + col = split.column() + col.itemR(cam, "dof_object", text="") + + if col2: + col = split.column() + col.itemR(cam, "dof_distance", text="Distance") class DATA_PT_camera_display(DataButtonsPanel): @@ -99,6 +118,7 @@ class DATA_PT_camera_display(DataButtonsPanel): layout = self.layout cam = context.camera + col2 = context.region.width > narrowui split = layout.split() @@ -108,7 +128,8 @@ class DATA_PT_camera_display(DataButtonsPanel): col.itemR(cam, "show_title_safe", text="Title Safe") col.itemR(cam, "show_name", text="Name") - col = split.column() + if col2: + col = split.column() col.itemR(cam, "draw_size", text="Size") col.itemS() col.itemR(cam, "show_passepartout", text="Passepartout") diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py index c7ad5b1c895..d13d75da746 100644 --- a/release/scripts/ui/properties_data_lamp.py +++ b/release/scripts/ui/properties_data_lamp.py @@ -19,6 +19,7 @@ # import bpy +narrowui = 180 class DataButtonsPanel(bpy.types.Panel): bl_space_type = 'PROPERTIES' @@ -46,15 +47,19 @@ class DATA_PT_context_lamp(DataButtonsPanel): ob = context.object lamp = context.lamp space = context.space_data + col2 = context.region.width > narrowui - split = layout.split(percentage=0.65) - if ob: - split.template_ID(ob, "data") - split.itemS() - elif lamp: - split.template_ID(space, "pin_id") - split.itemS() + if col2: + split = layout.split(percentage=0.65) + if ob: + split.template_ID(ob, "data") + split.itemS() + elif lamp: + split.template_ID(space, "pin_id") + split.itemS() + else: + layout.template_ID(ob, "data") class DATA_PT_lamp(DataButtonsPanel): @@ -64,8 +69,12 @@ class DATA_PT_lamp(DataButtonsPanel): layout = self.layout lamp = context.lamp + col2 = context.region.width > narrowui - layout.itemR(lamp, "type", expand=True) + if col2: + layout.itemR(lamp, "type", expand=True) + else: + layout.itemR(lamp, "type", text="") split = layout.split() @@ -91,7 +100,8 @@ class DATA_PT_lamp(DataButtonsPanel): col.itemR(lamp, "distance") col.itemR(lamp, "gamma") - col = split.column() + if col2: + col = split.column() col.itemR(lamp, "negative") col.itemR(lamp, "layer", text="This Layer Only") col.itemR(lamp, "specular") @@ -109,6 +119,7 @@ class DATA_PT_sunsky(DataButtonsPanel): layout = self.layout lamp = context.lamp.sky + col2 = context.region.width > narrowui layout.itemR(lamp, "sky") @@ -130,7 +141,8 @@ class DATA_PT_sunsky(DataButtonsPanel): sub.row().itemR(lamp, "sky_color_space", expand=True) sub.itemR(lamp, "sky_exposure", text="Exposure") - col = split.column() + if col2: + col = split.column() col.active = lamp.sky col.itemL(text="Horizon:") sub = col.column() @@ -155,7 +167,8 @@ class DATA_PT_sunsky(DataButtonsPanel): col.itemR(lamp, "sun_intensity", text="Sun") col.itemR(lamp, "atmosphere_distance_factor", text="Distance") - col = split.column() + if col2: + col = split.column() col.active = lamp.atmosphere col.itemL(text="Scattering:") sub = col.column(align=True) @@ -174,8 +187,12 @@ class DATA_PT_shadow(DataButtonsPanel): layout = self.layout lamp = context.lamp + col2 = context.region.width > narrowui - layout.itemR(lamp, "shadow_method", expand=True) + if col2: + layout.itemR(lamp, "shadow_method", expand=True) + else: + layout.itemR(lamp, "shadow_method", text="") if lamp.shadow_method != 'NOSHADOW': split = layout.split() @@ -183,14 +200,18 @@ class DATA_PT_shadow(DataButtonsPanel): col = split.column() col.itemR(lamp, "shadow_color", text="") - col = split.column() + if col2: + col = split.column() col.itemR(lamp, "shadow_layer", text="This Layer Only") col.itemR(lamp, "only_shadow") if lamp.shadow_method == 'RAY_SHADOW': col = layout.column() col.itemL(text="Sampling:") - col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True) + if col2: + col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True) + else: + col.itemR(lamp, "shadow_ray_sampling_method", text="") if lamp.type in ('POINT', 'SUN', 'SPOT'): split = layout.split() @@ -201,13 +222,14 @@ class DATA_PT_shadow(DataButtonsPanel): col.itemR(lamp, "shadow_ray_samples", text="Samples") if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC': col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold") - col = split.column() + if col2: + col = split.column() elif lamp.type == 'AREA': split = layout.split() col = split.column() - sub = split.column(align=True) + if lamp.shape == 'SQUARE': col.itemR(lamp, "shadow_ray_samples_x", text="Samples") elif lamp.shape == 'RECTANGLE': @@ -216,16 +238,27 @@ class DATA_PT_shadow(DataButtonsPanel): if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC': col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold") + if col2: + col = split.column() elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED': - sub.itemR(lamp, "umbra") - sub.itemR(lamp, "dither") - sub.itemR(lamp, "jitter") + if col2: + col = split.column() + col.itemR(lamp, "umbra") + col.itemR(lamp, "dither") + col.itemR(lamp, "jitter") + else: + if col2: + col = split.column() + elif lamp.shadow_method == 'BUFFER_SHADOW': col = layout.column() col.itemL(text="Buffer Type:") - col.row().itemR(lamp, "shadow_buffer_type", expand=True) + if col2: + col.row().itemR(lamp, "shadow_buffer_type", expand=True) + else: + col.row().itemR(lamp, "shadow_buffer_type", text="") if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'): split = layout.split() @@ -237,7 +270,8 @@ class DATA_PT_shadow(DataButtonsPanel): sub.itemR(lamp, "shadow_buffer_soft", text="Soft") sub.itemR(lamp, "shadow_buffer_bias", text="Bias") - col = split.column() + if col2: + col = split.column() col.itemL(text="Sample Buffers:") col.itemR(lamp, "shadow_sample_buffers", text="") sub = col.column(align=True) @@ -249,15 +283,18 @@ class DATA_PT_shadow(DataButtonsPanel): elif lamp.shadow_buffer_type == 'IRREGULAR': layout.itemR(lamp, "shadow_buffer_bias", text="Bias") - row = layout.row() - row.itemR(lamp, "auto_clip_start", text="Autoclip Start") - sub = row.row() + split = layout.split() + + col = split.column() + col.itemR(lamp, "auto_clip_start", text="Autoclip Start") + sub = col.column() sub.active = not lamp.auto_clip_start sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start") - row = layout.row() - row.itemR(lamp, "auto_clip_end", text="Autoclip End") - sub = row.row() + if col2: + col = split.column() + col.itemR(lamp, "auto_clip_end", text="Autoclip End") + sub = col.column() sub.active = not lamp.auto_clip_end sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End") @@ -298,6 +335,7 @@ class DATA_PT_spot(DataButtonsPanel): layout = self.layout lamp = context.lamp + col2 = context.region.width > narrowui split = layout.split() @@ -307,7 +345,10 @@ class DATA_PT_spot(DataButtonsPanel): sub.itemR(lamp, "spot_blend", text="Blend", slider=True) col.itemR(lamp, "square") - col = split.column() + if col2: + col = split.column() + else: + col.itemS() col.itemR(lamp, "halo") sub = col.column(align=True) sub.active = lamp.halo diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 68bf57e9238..bb2e2f43599 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -70,13 +70,14 @@ class OBJECT_PT_transform(ObjectButtonsPanel): else: col = layout.column() col.itemR(ob, "location") + col.itemL(text="Rotation:") col.itemR(ob, "rotation_mode", text="") if ob.rotation_mode == 'QUATERNION': - col.itemR(ob, "rotation_quaternion") + col.itemR(ob, "rotation_quaternion", text="") elif ob.rotation_mode == 'AXIS_ANGLE': - col.itemR(ob, "rotation_axis_angle", text="Rotation") + col.itemR(ob, "rotation_axis_angle", text="") else: - col.itemR(ob, "rotation_euler", text="Rotation") + col.itemR(ob, "rotation_euler", text="") col.itemR(ob, "scale") diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py index f08cff38dfc..d1b8c3b36ba 100644 --- a/release/scripts/ui/properties_world.py +++ b/release/scripts/ui/properties_world.py @@ -55,14 +55,17 @@ class WORLD_PT_context_world(WorldButtonsPanel): scene = context.scene world = context.world space = context.space_data + col2 = context.region.width > narrowui - split = layout.split(percentage=0.65) - - if scene: - split.template_ID(scene, "world", new="world.new") - elif world: - split.template_ID(space, "pin_id") - + + if col2: + split = layout.split(percentage=0.65) + if scene: + split.template_ID(scene, "world", new="world.new") + elif world: + split.template_ID(space, "pin_id") + else: + layout.template_ID(scene, "world", new="world.new") class WORLD_PT_world(WorldButtonsPanel): bl_label = "World"