diff options
Diffstat (limited to 'release/scripts/ui/space_view3d.py')
-rw-r--r-- | release/scripts/ui/space_view3d.py | 179 |
1 files changed, 78 insertions, 101 deletions
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 02f29c7632c..162322a8720 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -152,6 +152,13 @@ class VIEW3D_MT_transform(bpy.types.Menu): layout.operator("transform.warp", text="Warp") layout.operator("transform.push_pull", text="Push/Pull") + layout.separator() + + layout.operator("transform.translate", text="Move Texture Space").texture_space = True + layout.operator("transform.resize", text="Scale Texture Space").texture_space = True + + layout.separator() + obj = context.object if obj.type == 'ARMATURE' and obj.mode in ('EDIT', 'POSE') and obj.data.draw_type in ('BBONE', 'ENVELOPE'): layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE' @@ -584,7 +591,7 @@ class VIEW3D_MT_select_edit_metaball(bpy.types.Menu): layout.separator() - layout.operator("mball.select_deselect_all_metaelems") + layout.operator("mball.select_all").action = 'TOGGLE' layout.operator("mball.select_inverse_metaelems") layout.separator() @@ -647,6 +654,7 @@ class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum # ********** Object menu ********** + class VIEW3D_MT_object(bpy.types.Menu): bl_context = "objectmode" bl_label = "Object" @@ -676,7 +684,7 @@ class VIEW3D_MT_object(bpy.types.Menu): layout.operator("object.delete", text="Delete...") layout.operator("object.proxy_make", text="Make Proxy...") layout.menu("VIEW3D_MT_make_links", text="Make Links...") - layout.operator("object.make_dupli_face", text="Make Dupliface...") + layout.operator("object.make_dupli_face") layout.operator_menu_enum("object.make_local", "type", text="Make Local...") layout.menu("VIEW3D_MT_make_single_user") @@ -755,7 +763,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu): props.data_path_item = "data.dof_distance" props.input_scale = 0.02 - if obj.type in ('CURVE', 'TEXT'): + if obj.type in ('CURVE', 'FONT'): layout.operator_context = 'INVOKE_REGION_WIN' props = layout.operator("wm.context_modal_mouse", text="Extrude Size") @@ -897,16 +905,16 @@ class VIEW3D_MT_make_single_user(bpy.types.Menu): props = layout.operator("object.make_single_user", text="Object") props.object = True - props = layout.operator("object.make_single_user", text="Object & ObData") + props = layout.operator("object.make_single_user", text="Object & Data") props.object = props.obdata = True - props = layout.operator("object.make_single_user", text="Object & ObData & Materials+Tex") + props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex") props.object = props.obdata = props.material = props.texture = True props = layout.operator("object.make_single_user", text="Materials+Tex") props.material = props.texture = True - props = layout.operator("object.make_single_user", text="Animation") + props = layout.operator("object.make_single_user", text="Object Animation") props.animation = True @@ -916,8 +924,14 @@ class VIEW3D_MT_make_links(bpy.types.Menu): def draw(self, context): layout = self.layout - layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...") - layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...") + if(len(bpy.data.scenes) > 10): + layout.operator_context = 'INVOKE_DEFAULT' + layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY') + layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY') + else: + layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...") + layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...") + layout.operator_enums("object.make_links_data", "type") # inline @@ -1213,7 +1227,7 @@ class VIEW3D_MT_pose_transform(bpy.types.Menu): def draw(self, context): layout = self.layout - layout.label(text="User Transform") + layout.operator("pose.transforms_clear", text="All") layout.operator("pose.loc_clear", text="Location") layout.operator("pose.rot_clear", text="Rotation") @@ -1370,7 +1384,7 @@ class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu): layout.operator("mesh.select_vertex_path") -class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): bl_label = "Mesh Select Mode" def draw(self, context): @@ -1394,82 +1408,35 @@ class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu): class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): bl_label = "Extrude" + _extrude_funcs = { \ + "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"), + "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"), + "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"), + "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"), + } + @staticmethod def extrude_options(context): mesh = context.object.data - selection_mode = context.tool_settings.mesh_select_mode - - totface = mesh.total_face_sel - totedge = mesh.total_edge_sel - totvert = mesh.total_vert_sel + select_mode = context.tool_settings.mesh_select_mode - # the following is dependent on selection modes - # we don't really want that -# if selection_mode[0]: # vert -# if totvert == 0: -# return () -# elif totvert == 1: -# return (3,) -# elif totedge == 0: -# return (3,) -# elif totface == 0: -# return (2, 3) -# elif totface == 1: -# return (0, 2, 3) -# else: -# return (0, 1, 2, 3) -# elif selection_mode[1]: # edge -# if totedge == 0: -# return () -# elif totedge == 1: -# return (2,) -# elif totface == 0: -# return (2,) -# elif totface == 1: -# return (0, 2) -# else: -# return (0, 1, 2) -# elif selection_mode[2]: # face -# if totface == 0: -# return () -# elif totface == 1: -# return (0,) -# else: -# return (0, 1) - - if totvert == 0: - return () - elif totedge == 0: - return (0, 3) - elif totface == 0: - return (0, 2, 3) - else: - return (0, 1, 2, 3) + menu = [] + if mesh.total_face_sel: + menu += ["REGION", "FACE"] + if mesh.total_edge_sel and (select_mode[0] or select_mode[1]): + menu += ["EDGE"] + if mesh.total_vert_sel and select_mode[0]: + menu += ["VERT"] # should never get here - return () + return menu def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - def region_menu(): - layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region") - - def face_menu(): - layout.operator("mesh.extrude_faces_move", text="Individual Faces") - - def edge_menu(): - layout.operator("mesh.extrude_edges_move", text="Edges Only") - - def vert_menu(): - layout.operator("mesh.extrude_vertices_move", text="Vertices Only") - - menu_funcs = region_menu, face_menu, edge_menu, vert_menu - - for i in self.extrude_options(context): - func = menu_funcs[i] - func() + for menu_id in self.extrude_options(context): + self._extrude_funcs[menu_id](layout) class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): @@ -1479,20 +1446,23 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): def execute(self, context): mesh = context.object.data - selection_mode = context.tool_settings.mesh_select_mode + select_mode = context.tool_settings.mesh_select_mode totface = mesh.total_face_sel totedge = mesh.total_edge_sel totvert = mesh.total_vert_sel - if selection_mode[2] and totface == 1: - return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]}) - elif selection_mode[2] and totface > 1: - return bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN') - elif selection_mode[1] and totedge >= 1: - return bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN') + if select_mode[2] and totface == 1: + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) + elif select_mode[2] and totface > 1: + bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN') + elif select_mode[1] and totedge >= 1: + bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN') else: - return bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN') + bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN') + + # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] + return {'FINISHED'} def invoke(self, context, event): return self.execute(context) @@ -1511,11 +1481,14 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator): totvert = mesh.total_vert_sel if totface >= 1: - return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]}) + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) elif totedge == 1: - return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [True, True, False]}) + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)}) else: - return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN') + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN') + + # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] + return {'FINISHED'} def invoke(self, context, event): return self.execute(context) @@ -1708,7 +1681,7 @@ class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu): edit_object = context.edit_object if edit_object.type == 'CURVE': - layout.operator("transform.transform").mode = 'TILT' + layout.operator("transform.transform", text="Tilt").mode = 'TILT' layout.operator("curve.tilt_clear") layout.operator("curve.separate") @@ -1755,7 +1728,7 @@ class VIEW3D_MT_edit_surface(bpy.types.Menu): draw = draw_curve -class VIEW3D_MT_edit_text(bpy.types.Menu): +class VIEW3D_MT_edit_font(bpy.types.Menu): bl_label = "Text" def draw(self, context): @@ -1903,7 +1876,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu): layout.separator() - layout.operator("armature.subdivide_multi", text="Subdivide") + layout.operator("armature.subdivide", text="Subdivide") layout.operator("armature.switch_direction", text="Switch Direction") layout.separator() @@ -1937,7 +1910,7 @@ class VIEW3D_MT_armature_specials(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("armature.subdivide_multi", text="Subdivide") + layout.operator("armature.subdivide", text="Subdivide") layout.operator("armature.switch_direction", text="Switch Direction") layout.separator() @@ -1998,6 +1971,8 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel): col.prop(view, "lock_object", text="") if view.lock_object and view.lock_object.type == 'ARMATURE': col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="") + elif not view.lock_object: + col.prop(view, "lock_cursor", text="Lock to Cursor") col = layout.column(align=True) col.label(text="Clip:") @@ -2052,7 +2027,8 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel): layout = self.layout view = context.space_data - gs = context.scene.game_settings + scene = context.scene + gs = scene.game_settings ob = context.object col = layout.column() @@ -2081,8 +2057,10 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel): sub = col.column(align=True) sub.active = (display_all and view.show_floor) sub.prop(view, "grid_lines", text="Lines") - sub.prop(view, "grid_spacing", text="Spacing") - sub.prop(view, "grid_subdivisions", text="Subdivisions") + sub.prop(view, "grid_scale", text="Scale") + subsub = sub.column(align=True) + subsub.active = scene.unit_settings.system == 'NONE' + subsub.prop(view, "grid_subdivisions", text="Subdivisions") col = layout.column() col.label(text="Shading:") @@ -2139,7 +2117,7 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel): col.separator() col.label(text="Numerics:") col.prop(mesh, "show_extra_edge_length") - col.prop(mesh, "show_extra_edge_angle") + col.prop(mesh, "show_extra_face_angle") col.prop(mesh, "show_extra_face_area") @@ -2189,7 +2167,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel): view = context.space_data col = layout.column() - col.operator("view3d.add_background_image", text="Add Image") + col.operator("view3d.background_image_add", text="Add Image") for i, bg in enumerate(view.background_images): layout.active = view.show_background_images @@ -2200,7 +2178,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel): row.prop(bg.image, "name", text="", emboss=False) else: row.label(text="Not Set") - row.operator("view3d.remove_background_image", text="", emboss=False, icon='X').index = i + row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i box.prop(bg, "view_axis", text="Axis") @@ -2210,7 +2188,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel): if (bg.image): box.template_image(bg, "image", bg.image_user, compact=True) - box.prop(bg, "transparency", slider=True) + box.prop(bg, "opacity", slider=True) if bg.view_axis != 'CAMERA': box.prop(bg, "size") row = box.row(align=True) @@ -2320,20 +2298,19 @@ class VIEW3D_PT_context_properties(bpy.types.Panel): def draw(self, context): import rna_prop_ui - # reload(rna_prop_ui) member = __class__._active_context_member(context) if member: # Draw with no edit button - rna_prop_ui.draw(self.layout, context, member, False) + rna_prop_ui.draw(self.layout, context, member, object, False) def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() |