Changeset View
Standalone View
release/scripts/startup/bl_ui/space_view3d.py
| Context not available. | |||||
| ''' | ''' | ||||
| # If something is selected | # If something is selected | ||||
| if obj is not None and obj.type in {'MESH', 'CURVE', 'SURFACE'}: | |||||
| layout.operator("object.shade_smooth", text="Shade Smooth") | |||||
| layout.operator("object.shade_flat", text="Shade Flat") | |||||
| layout.separator() | |||||
| # Individual object types | |||||
| if obj is None: | if obj is None: | ||||
| pass | pass | ||||
| elif obj.type == 'MESH': | |||||
| layout.operator_context = 'INVOKE_REGION_WIN' | |||||
| layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type") | |||||
| layout.operator_context = 'INVOKE_DEFAULT' | |||||
| # If more than one object is selected | |||||
| if selected_objects_len > 1: | |||||
| layout.operator("object.join") | |||||
| layout.separator() | |||||
| elif obj.type == 'CAMERA': | if obj.type == 'CAMERA': | ||||
| layout.operator_context = 'INVOKE_REGION_WIN' | layout.operator_context = 'INVOKE_REGION_WIN' | ||||
| layout.operator("view3d.object_as_camera", text="Set Active Camera") | |||||
| if obj.data.type == 'PERSP': | if obj.data.type == 'PERSP': | ||||
| props = layout.operator("wm.context_modal_mouse", text="Adjust Focal Length") | props = layout.operator("wm.context_modal_mouse", text="Adjust Focal Length") | ||||
| props.data_path_iter = "selected_editable_objects" | props.data_path_iter = "selected_editable_objects" | ||||
campbellbarton: This fails if `obj` is None (checked below). | |||||
| Context not available. | |||||
| props.data_path_iter = "selected_editable_objects" | props.data_path_iter = "selected_editable_objects" | ||||
| props.data_path_item = "data.offset" | props.data_path_item = "data.offset" | ||||
| props.input_scale = 0.01 | props.input_scale = 0.01 | ||||
| props.header_text = "Width Size: %.3f" | props.header_text = "Offset: %.3f" | ||||
| layout.separator() | |||||
| layout.operator("object.convert", text="Convert to Mesh").target = 'MESH' | |||||
| layout.operator("object.convert", text="Convert to Grease Pencil").target = 'GPENCIL' | |||||
| layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type") | |||||
| layout.separator() | |||||
| elif obj.type == 'GPENCIL': | |||||
| layout.operator("gpencil.convert", text="Convert to Path").type = 'PATH' | |||||
| layout.operator("gpencil.convert", text="Convert to Bezier Curve").type = 'CURVE' | |||||
| layout.operator("gpencil.convert", text="Convert to Polygon Curve").type = 'POLY' | |||||
| layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type") | |||||
| layout.separator() | layout.separator() | ||||
Done Inline ActionsThis can be removed if it's going to remain empty. campbellbarton: This can be removed if it's going to remain empty. | |||||
| Context not available. | |||||
| layout.separator() | layout.separator() | ||||
| if (obj.empty_display_type == 'IMAGE'): | |||||
| layout.operator("gpencil.trace_image") | |||||
| layout.separator() | |||||
| elif obj.type == 'LIGHT': | elif obj.type == 'LIGHT': | ||||
| light = obj.data | light = obj.data | ||||
Done Inline ActionsThis should probably have a check for whether the object is actually an image empty: HooglyBoogly: This should probably have a check for whether the object is actually an image empty:
`if (obj. | |||||
| Context not available. | |||||
| layout.separator() | layout.separator() | ||||
| # Shared among some object types | |||||
| if obj.type in {'MESH', 'CURVE', 'SURFACE'}: | |||||
Done Inline Actionsamong, also below. campbellbarton: `among`, also below. | |||||
| layout.operator("object.shade_smooth", text="Shade Smooth") | |||||
| layout.operator("object.shade_flat", text="Shade Flat") | |||||
| layout.separator() | |||||
| if obj.type in {'MESH', 'CURVE', 'SURFACE', 'ARMATURE', 'GPENCIL'}: | |||||
| if selected_objects_len > 1: | |||||
| layout.operator("object.join") | |||||
| if obj.type in {'MESH', 'CURVE', 'SURFACE', 'POINTCLOUD', 'META', 'FONT'}: | |||||
| layout.operator_menu_enum("object.convert", "target") | |||||
| elif obj.type == 'GPENCIL': | |||||
Done Inline ActionsThis shouldn't be needed. Multiple separators are now de-duplicated. campbellbarton: This shouldn't be needed. Multiple separators are now de-duplicated. | |||||
Done Inline ActionsClarification: the if selected_objects_len == 1: shouldn't be needed. campbellbarton: Clarification: the `if selected_objects_len == 1:` shouldn't be needed. | |||||
Done Inline ActionsI added that here to make sure there is always a separator after this group, even when the Join operator doesn't appear. Not sure how else to do that. billreynish: I added that here to make sure there is always a separator after this group, even when the Join… | |||||
| layout.operator_menu_enum("gpencil.convert", "type", text="Convert To") | |||||
| if (obj.type in {'MESH', 'CURVE', 'SURFACE', 'GPENCIL', 'LATTICE', 'ARMATURE', 'META'} or (obj.type == 'EMPTY' and obj.instance_collection is not None)): | |||||
Done Inline ActionsThis works for empty objects too - which instance collections. campbellbarton: This works for empty objects too - which instance collections. | |||||
| layout.operator_context = 'INVOKE_REGION_WIN' | |||||
| layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type") | |||||
| layout.operator_context = 'INVOKE_DEFAULT' | |||||
| layout.separator() | |||||
| # Shared among all object types | |||||
Done Inline Actionsamong campbellbarton: `among` | |||||
| layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN') | layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN') | ||||
| layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN') | layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN') | ||||
| Context not available. | |||||
Done Inline ActionsI don't think this is a good change, batch rename is quite a spesific operation, it's always available in the "Edit" menu, and swapping this out means you can't easily rename the active item - based on the selection. Further, this change could be made for other context menus too (but has not been), so this seems more like a design decision that's outside the scope of this patch. campbellbarton: I don't think this is a good change, batch rename is quite a spesific operation, it's always… | |||||
This fails if obj is None (checked below).