Changeset View
Standalone View
release/scripts/startup/bl_ui/space_view3d.py
| Context not available. | |||||
| return | return | ||||
| ''' | ''' | ||||
| # If something is selected | # Individual object types | ||||
| 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() | |||||
| 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': | elif obj.type == 'CAMERA': | ||||
| layout.operator_context = 'INVOKE_REGION_WIN' | layout.operator_context = 'INVOKE_REGION_WIN' | ||||
campbellbarton: This fails if `obj` is None (checked below). | |||||
| Context not available. | |||||
| layout.separator() | 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': | elif obj.type == 'GPENCIL': | ||||
| layout.operator("gpencil.convert", text="Convert to Path").type = 'PATH' | pass | ||||
campbellbartonUnsubmitted 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. | |||||
| 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() | |||||
| elif obj.type == 'EMPTY': | elif obj.type == 'EMPTY': | ||||
| layout.operator_context = 'INVOKE_REGION_WIN' | layout.operator_context = 'INVOKE_REGION_WIN' | ||||
| Context not available. | |||||
| layout.separator() | layout.separator() | ||||
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. | |||||
| layout.operator("gpencil.trace_image") | |||||
| layout.separator() | |||||
| elif obj.type == 'LIGHT': | elif obj.type == 'LIGHT': | ||||
| light = obj.data | light = obj.data | ||||
| Context not available. | |||||
| props.header_text = "Spot Blend: %.2f" | props.header_text = "Spot Blend: %.2f" | ||||
| layout.separator() | layout.separator() | ||||
| # Shared omong some object types | |||||
campbellbartonUnsubmitted Done Inline Actionsamong, also below. campbellbarton: `among`, also below. | |||||
| if obj is not None: | |||||
| if obj.type in {'MESH', 'CURVE', 'SURFACE'}: | |||||
| 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', 'GPENCIL', 'LATTICE', 'ARMATURE', 'META'}: | |||||
| layout.operator_context = 'INVOKE_REGION_WIN' | |||||
| layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type") | |||||
| layout.operator_context = 'INVOKE_DEFAULT' | |||||
| if selected_objects_len == 1: | |||||
campbellbartonUnsubmitted 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. | |||||
campbellbartonUnsubmitted 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. | |||||
billreynishAuthorUnsubmitted 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.separator() | |||||
| # If more than one object is selected. | |||||
Done Inline ActionsThis works for empty objects too - which instance collections. campbellbarton: This works for empty objects too - which instance collections. | |||||
| if obj.type in {'MESH', 'CURVE', 'SURFACE', 'ARMATURE', 'GPENCIL'}: | |||||
| if selected_objects_len > 1: | |||||
| layout.operator("object.join") | |||||
| layout.separator() | |||||
| # Shared omong all object types | |||||
campbellbartonUnsubmitted 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).