Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_view3d.py
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 6,802 Lines • ▼ Show 20 Lines | class VIEW3D_PT_snapping(Panel): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'HEADER' | bl_region_type = 'HEADER' | ||||
| bl_label = "Snapping" | bl_label = "Snapping" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| snap_elements = tool_settings.snap_elements | snap_elements = tool_settings.snap_elements | ||||
| obj = context.active_object | obj = context.active_object | ||||
| object_mode = 'OBJECT' if obj is None else obj.mode | object_mode = obj.mode if obj else 'OBJECT' | ||||
| show_target_options = object_mode == 'EDIT' and obj.type not in {'LATTICE', 'META', 'FONT'} | |||||
| layout = self.layout | layout = self.layout | ||||
| col = layout.column() | col = layout.column() | ||||
| if snap_elements != {'INCREMENT'} and show_target_options: | |||||
| col.prop( | |||||
| tool_settings, | |||||
| "use_snap_retopology_mode", | |||||
| text="Use Retopology Mode", | |||||
| ) | |||||
| col.label(text="Snap To") | col.label(text="Snap To") | ||||
| col.prop(tool_settings, "snap_elements", expand=True) | col.prop(tool_settings, "snap_elements", expand=True) | ||||
| col.separator() | col.separator() | ||||
| if 'INCREMENT' in snap_elements: | if 'INCREMENT' in snap_elements: | ||||
| col.prop(tool_settings, "use_snap_grid_absolute") | col.prop(tool_settings, "use_snap_grid_absolute") | ||||
| if snap_elements != {'INCREMENT'}: | if snap_elements != {'INCREMENT'}: | ||||
| if snap_elements != {'FACE_NEAREST'}: | if snap_elements != {'FACE_NEAREST'}: | ||||
| col.label(text="Snap With") | col.label(text="Snap With") | ||||
| row = col.row(align=True) | row = col.row(align=True) | ||||
| row.prop(tool_settings, "snap_target", expand=True) | row.prop(tool_settings, "snap_target", expand=True) | ||||
| if obj: | if obj: | ||||
| col.label(text="Target Selection") | col.label(text="Target Selection") | ||||
| col_targetsel = col.column(align=True) | col_targetsel = col.column(align=True) | ||||
| if object_mode == 'EDIT' and obj.type not in {'LATTICE', 'META', 'FONT'}: | if show_target_options: | ||||
| col_targetsel.prop( | col_targetsel.prop( | ||||
| tool_settings, | tool_settings, | ||||
| "use_snap_self", | "use_snap_self", | ||||
| text="Include Active", | text="Include Active", | ||||
| icon='EDITMODE_HLT', | icon='EDITMODE_HLT', | ||||
| ) | ) | ||||
| col_targetsel.prop( | col_targetsel.prop( | ||||
| tool_settings, | tool_settings, | ||||
| ▲ Show 20 Lines • Show All 1,177 Lines • Show Last 20 Lines | |||||