WIP: Luke's Custom Selection Build 402 #117059
|
@ -327,12 +327,17 @@ typedef enum {
|
|||
GHOST_kStandardCursorCrosshairA,
|
||||
GHOST_kStandardCursorCrosshairB,
|
||||
GHOST_kStandardCursorCrosshairC,
|
||||
GHOST_kStandardCursorCrosshairD,
|
||||
GHOST_kStandardCursorBox,
|
||||
GHOST_kStandardCursorBoxDot,
|
||||
GHOST_kStandardCursorBoxPointer,
|
||||
GHOST_kStandardCursorPencil,
|
||||
GHOST_kStandardCursorUpArrow,
|
||||
GHOST_kStandardCursorDownArrow,
|
||||
GHOST_kStandardCursorVerticalSplit,
|
||||
GHOST_kStandardCursorHorizontalSplit,
|
||||
GHOST_kStandardCursorEraser,
|
||||
GHOST_kStandardCursorPointer,
|
||||
GHOST_kStandardCursorKnife,
|
||||
GHOST_kStandardCursorEyedropper,
|
||||
GHOST_kStandardCursorZoomIn,
|
||||
|
|
|
@ -727,6 +727,9 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const
|
|||
case GHOST_kStandardCursorHorizontalSplit:
|
||||
cursor = ::LoadImage(module, "splith_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break;
|
||||
case GHOST_kStandardCursorPointer:
|
||||
cursor = ::LoadImage(module, "pointer_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break;
|
||||
case GHOST_kStandardCursorKnife:
|
||||
cursor = ::LoadImage(module, "knife_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break;
|
||||
|
@ -772,6 +775,18 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const
|
|||
case GHOST_kStandardCursorCrosshairC:
|
||||
cursor = ::LoadImage(module, "crossC_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break; /* Minimal Crosshair C */
|
||||
case GHOST_kStandardCursorCrosshairD:
|
||||
cursor = ::LoadImage(module, "crossD_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break; /* Open Crosshair D */
|
||||
case GHOST_kStandardCursorBox:
|
||||
cursor = ::LoadImage(module, "box_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break; /* Box */
|
||||
case GHOST_kStandardCursorBoxDot:
|
||||
cursor = ::LoadImage(module, "boxdot_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break; /* Box Dot */
|
||||
case GHOST_kStandardCursorBoxPointer:
|
||||
cursor = ::LoadImage(module, "boxpointer_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
break; /* Box Pointer */
|
||||
case GHOST_kStandardCursorBottomSide:
|
||||
case GHOST_kStandardCursorUpDown:
|
||||
cursor = ::LoadImage(module, "movens_cursor", IMAGE_CURSOR, cx, cy, flags);
|
||||
|
|
|
@ -41,19 +41,20 @@
|
|||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2036"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1028"
|
||||
id="namedview34335"
|
||||
showgrid="false"
|
||||
inkscape:zoom="2"
|
||||
inkscape:cx="180.75"
|
||||
inkscape:cy="338.5"
|
||||
inkscape:window-x="-12"
|
||||
inkscape:window-y="-12"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="426.3412"
|
||||
inkscape:cy="341.84193"
|
||||
inkscape:window-x="-6"
|
||||
inkscape:window-y="-6"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer8"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#808080" />
|
||||
inkscape:deskcolor="#808080"
|
||||
showguides="true" />
|
||||
<defs
|
||||
id="defs4" />
|
||||
<g
|
||||
|
@ -19131,6 +19132,108 @@
|
|||
id="path4817-4"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<path
|
||||
d="m 406.84375,326.0625 h -2 v 2 h 1 v -1 h 1 z"
|
||||
fill="#ffffff"
|
||||
id="path2"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 408.84375,327.0625 h 2 v -1 h -2 z"
|
||||
fill="#ffffff"
|
||||
id="path4"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 414.84375,327.0625 h -2 v -1 h 2 z"
|
||||
fill="#ffffff"
|
||||
id="path6"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 417.53445,327.0625 h -0.6907 v -1 h 2 v 2 h -1 v 0.0287 l -5.0787,3.99043 c 0.051,0.15094 0.0787,0.31266 0.0787,0.48084 0,0.0204 -4e-4,0.0408 -10e-4,0.061 l 5.0012,2.0005 v -0.5615 h 1 v 2 h -1 v -0.3615 l -5.3726,-2.149 c -0.1677,0.1908 -0.383,0.3388 -0.6274,0.4251 v 5.0854 h -1 v -5.0854 c -0.5826,-0.2059 -1,-0.7615 -1,-1.4146 0,-0.82843 0.67157,-1.5 1.5,-1.5 0.2955,0 0.571,0.0855 0.8033,0.23298 z"
|
||||
fill="#ffffff"
|
||||
id="path8"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 410.84375,339.0625 v 1 h -2 v -1 z"
|
||||
fill="#ffffff"
|
||||
id="path10"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 417.84375,330.0625 h 1 v 2 h -1 z"
|
||||
fill="#ffffff"
|
||||
id="path12"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 417.84375,339.0625 v -1 h 1 v 2 h -2 v -1 z"
|
||||
fill="#ffffff"
|
||||
id="path14"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 404.84375,334.0625 v 2 h 1 v -2 z"
|
||||
fill="#ffffff"
|
||||
id="path16"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 404.84375,338.0625 h 1 v 1 h 1 v 1 h -2 z"
|
||||
fill="#ffffff"
|
||||
id="path18"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 404.84375,332.0625 h 1 v -2 h -1 z"
|
||||
fill="#ffffff"
|
||||
id="path20"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 414.84375,340.0625 h -2 v -1 h 2 z"
|
||||
fill="#ffffff"
|
||||
id="path22"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 427.8437,326.0625 h -1.99995 v 2 h 1 v -1 h 0.99995 z"
|
||||
fill="#ffffff"
|
||||
id="path2-2"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 429.8437,327.0625 h 2 v -1 h -2 z"
|
||||
fill="#ffffff"
|
||||
id="path4-7"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 434.84375,327.0625 h -1.0001 v -1 h 2.0001 v 2 h -1 z"
|
||||
fill="#ffffff"
|
||||
id="path6-2"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="m 439.34375,337.0625 c 0.2761,0 0.5,-0.2239 0.5,-0.5 v -7 c 0,-0.27614 -0.2239,-0.5 -0.5,-0.5 h -6.58535 c -0.20592,-0.5826 -0.76154,-1 -1.41465,-1 -0.82843,0 -1.5,0.67157 -1.5,1.5 0,0.65312 0.4174,1.20873 1,1.41465 v 4.17075 c -0.5826,0.2059 -1,0.76151 -1,1.4146 0,0.8284 0.67157,1.5 1.5,1.5 0.65311,0 1.20873,-0.41739 1.41465,-1 z m -6.58535,-1 h 2.08535 v -2 h 1 v 2 h 3 v -6 h -3 v 2 h -1 v -2 h -2.08535 c -0.15065,0.42622 -0.48844,0.76401 -0.91465,0.91465 v 4.17075 c 0.42621,0.1506 0.764,0.48841 0.91465,0.9146 z"
|
||||
fill="#ffffff"
|
||||
id="path8-7"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 434.84375,339.0625 v -1 h 1 v 2 h -2.0001 v -1 z"
|
||||
fill="#ffffff"
|
||||
id="path10-5"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 429.8437,339.0625 h 2 v 1 h -2 z"
|
||||
fill="#ffffff"
|
||||
id="path12-3"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 426.84375,339.0625 h 0.99995 v 1 h -1.99995 v -2 h 1 z"
|
||||
fill="#ffffff"
|
||||
id="path14-9"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 426.84375,334.0625 v 2 h -1 v -2 z"
|
||||
fill="#ffffff"
|
||||
id="path16-0"
|
||||
style="display:inline;enable-background:new" />
|
||||
<path
|
||||
d="m 426.84375,330.0625 v 2 h -1 v -2 z"
|
||||
fill="#ffffff"
|
||||
id="path18-9"
|
||||
style="display:inline;enable-background:new" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
|
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 30 KiB |
|
@ -12,7 +12,6 @@
|
|||
APPICON ICON DISCARDABLE "winblender.ico"
|
||||
BLENDERFILE ICON DISCARDABLE "winblenderfile.ico"
|
||||
|
||||
pointer_cursor CURSOR "cursors/pointer.cur"
|
||||
moveew_cursor CURSOR "cursors/moveew.cur"
|
||||
movens_cursor CURSOR "cursors/movens.cur"
|
||||
arrowdown_cursor CURSOR "cursors/arrowdown.cur"
|
||||
|
@ -23,6 +22,11 @@ cross_cursor CURSOR "cursors/cross.cur"
|
|||
crossA_cursor CURSOR "cursors/crossa.cur"
|
||||
crossB_cursor CURSOR "cursors/crossb.cur"
|
||||
crossC_cursor CURSOR "cursors/crossc.cur"
|
||||
crossD_cursor CURSOR "cursors/crossd.cur"
|
||||
box_cursor CURSOR "cursors/box.cur"
|
||||
boxdot_cursor CURSOR "cursors/boxdot.cur"
|
||||
boxpointer_cursor CURSOR "cursors/boxpointer.cur"
|
||||
pointer_cursor CURSOR "cursors/pointera.cur"
|
||||
eraser_cursor CURSOR "cursors/eraser.cur"
|
||||
eyedropper_cursor CURSOR "cursors/eyedropper.cur"
|
||||
handopen_cursor CURSOR "cursors/handopen.cur"
|
||||
|
|
|
@ -184,7 +184,24 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level):
|
|||
|
||||
if map_type in {'KEYBOARD', 'MOUSE'} and kmi.value == 'CLICK_DRAG':
|
||||
subrow = sub.row()
|
||||
subrow.prop(kmi, "direction")
|
||||
if bpy.context.preferences.inputs.click_drag_direction == 'LEFT_RIGHT':
|
||||
if kmi.direction == 'ANY' or kmi.direction == 'EAST' or kmi.direction == 'WEST':
|
||||
subrow.label(text="Direction:")
|
||||
else:
|
||||
subrow.label(text="WARNING - No Direction:")
|
||||
subrow.operator("preferences.set_direction_any", text="Any", depress= kmi.direction == 'ANY').item_id = kmi.id
|
||||
subrow.operator("preferences.set_direction_left", text="Left", depress= kmi.direction == 'WEST').item_id = kmi.id
|
||||
subrow.operator("preferences.set_direction_right", text="Right", depress= kmi.direction == 'EAST').item_id = kmi.id
|
||||
elif bpy.context.preferences.inputs.click_drag_direction == 'UP_DOWN':
|
||||
if kmi.direction == 'ANY' or kmi.direction == 'NORTH' or kmi.direction == 'SOUTH':
|
||||
subrow.label(text="Direction:")
|
||||
else:
|
||||
subrow.label(text="WARNING - No Direction:")
|
||||
subrow.operator("preferences.set_direction_any", text="Any", depress= kmi.direction == 'ANY').item_id = kmi.id
|
||||
subrow.operator("preferences.set_direction_up", text="Up", depress= kmi.direction == 'NORTH').item_id = kmi.id
|
||||
subrow.operator("preferences.set_direction_down", text="Down", depress= kmi.direction == 'SOUTH').item_id = kmi.id
|
||||
else:
|
||||
subrow.prop(kmi, "direction")
|
||||
|
||||
subrow = sub.row()
|
||||
subrow.scale_x = 0.75
|
||||
|
|
|
@ -403,6 +403,111 @@ class PREFERENCES_OT_keyitem_remove(Operator):
|
|||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PREFERENCES_OT_set_direction_any(Operator):
|
||||
"""Drag in any direction"""
|
||||
bl_idname = "preferences.set_direction_any"
|
||||
bl_label = "Set Direction Any"
|
||||
|
||||
item_id: IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to set direction for",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return hasattr(context, "keymap")
|
||||
|
||||
def execute(self, context):
|
||||
km = context.keymap
|
||||
kmi = km.keymap_items.from_id(self.item_id)
|
||||
km.keymap_items.set_direction_any(kmi)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PREFERENCES_OT_set_direction_left(Operator):
|
||||
"""Drag to the left"""
|
||||
bl_idname = "preferences.set_direction_left"
|
||||
bl_label = "Set Direction Left"
|
||||
|
||||
item_id: IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to set direction for",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return hasattr(context, "keymap")
|
||||
|
||||
def execute(self, context):
|
||||
km = context.keymap
|
||||
kmi = km.keymap_items.from_id(self.item_id)
|
||||
km.keymap_items.set_direction_left(kmi)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PREFERENCES_OT_set_direction_right(Operator):
|
||||
"""Drag to the right"""
|
||||
bl_idname = "preferences.set_direction_right"
|
||||
bl_label = "Set Direction Right"
|
||||
|
||||
item_id: IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to set direction for",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return hasattr(context, "keymap")
|
||||
|
||||
def execute(self, context):
|
||||
km = context.keymap
|
||||
kmi = km.keymap_items.from_id(self.item_id)
|
||||
km.keymap_items.set_direction_right(kmi)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PREFERENCES_OT_set_direction_up(Operator):
|
||||
"""Drag upwards"""
|
||||
bl_idname = "preferences.set_direction_up"
|
||||
bl_label = "Set Direction Up"
|
||||
|
||||
item_id: IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to set direction for",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return hasattr(context, "keymap")
|
||||
|
||||
def execute(self, context):
|
||||
km = context.keymap
|
||||
kmi = km.keymap_items.from_id(self.item_id)
|
||||
km.keymap_items.set_direction_up(kmi)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PREFERENCES_OT_set_direction_down(Operator):
|
||||
"""Drag downwards"""
|
||||
bl_idname = "preferences.set_direction_down"
|
||||
bl_label = "Set Direction Down"
|
||||
|
||||
item_id: IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to set direction for",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return hasattr(context, "keymap")
|
||||
|
||||
def execute(self, context):
|
||||
km = context.keymap
|
||||
kmi = km.keymap_items.from_id(self.item_id)
|
||||
km.keymap_items.set_direction_down(kmi)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PREFERENCES_OT_keyconfig_remove(Operator):
|
||||
"""Remove key config"""
|
||||
bl_idname = "preferences.keyconfig_remove"
|
||||
|
@ -1221,6 +1326,11 @@ classes = (
|
|||
PREFERENCES_OT_keyconfig_test,
|
||||
PREFERENCES_OT_keyitem_add,
|
||||
PREFERENCES_OT_keyitem_remove,
|
||||
PREFERENCES_OT_set_direction_any,
|
||||
PREFERENCES_OT_set_direction_left,
|
||||
PREFERENCES_OT_set_direction_right,
|
||||
PREFERENCES_OT_set_direction_up,
|
||||
PREFERENCES_OT_set_direction_down,
|
||||
PREFERENCES_OT_keyitem_restore,
|
||||
PREFERENCES_OT_keymap_restore,
|
||||
PREFERENCES_OT_theme_install,
|
||||
|
|
|
@ -277,6 +277,7 @@ class USERPREF_PT_interface_editors(InterfacePanel, CenterAlignMixIn, Panel):
|
|||
col.prop(view, "color_picker_type")
|
||||
col.row().prop(view, "header_align")
|
||||
col.prop(view, "factor_display_type")
|
||||
col.prop(prefs.inputs, "header_highlight")
|
||||
|
||||
|
||||
class USERPREF_PT_interface_temporary_windows(InterfacePanel, CenterAlignMixIn, Panel):
|
||||
|
@ -538,6 +539,22 @@ class USERPREF_PT_edit_misc(EditingPanel, CenterAlignMixIn, Panel):
|
|||
|
||||
col = layout.column()
|
||||
col.prop(edit, "sculpt_paint_overlay_color", text="Sculpt Overlay Color")
|
||||
col.separator(factor=1.5)
|
||||
col = layout.column(heading="Adjustable Click Select")
|
||||
col.prop(edit, "adjustable_click_select")
|
||||
colsub = col.column(align=True)
|
||||
colsub.active = edit.adjustable_click_select
|
||||
colsub.prop(edit, "select_unbiased")
|
||||
colsub.prop(edit, "selection_radius")
|
||||
col.separator(factor=1.5)
|
||||
col.prop(edit, "system_cursor")
|
||||
col.prop(edit, "edit_cursor")
|
||||
col.prop(edit, "paint_cursor")
|
||||
col.prop(edit, "dot_cursor")
|
||||
col.prop(edit, "knife_cursor")
|
||||
col.prop(edit, "pencil_cursor")
|
||||
col.prop(edit, "eraser_cursor")
|
||||
col.prop(edit, "eyedropper_cursor")
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -1731,6 +1748,7 @@ class USERPREF_PT_input_mouse(InputPanel, CenterAlignMixIn, Panel):
|
|||
|
||||
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
|
||||
flow.prop(inputs, "click_drag_direction")
|
||||
if sys.platform[:3] == "win":
|
||||
flow.prop(inputs, "use_mouse_emulate_3_button")
|
||||
else:
|
||||
|
|
|
@ -988,9 +988,46 @@ class VIEW3D_HT_header(Header):
|
|||
):
|
||||
sub.popover(panel="VIEW3D_PT_overlay_bones", text="", icon='POSE_HLT')
|
||||
|
||||
row = layout.row()
|
||||
row = layout.row(align=True)
|
||||
row.active = (object_mode == 'EDIT') or (shading.type in {'WIREFRAME', 'SOLID'})
|
||||
|
||||
if object_mode in 'EDIT' or object_mode in 'OBJECT':
|
||||
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
||||
_cls = ToolSelectPanelHelper._tool_class_from_space_type('VIEW_3D')
|
||||
|
||||
if tool_settings.workspace_tool_type == 'FALLBACK':
|
||||
tool = _cls._tool_get_by_id_active(context, _cls.tool_fallback_id)[0].idname
|
||||
else:
|
||||
tool = ToolSelectPanelHelper.tool_active_from_context(context).idname
|
||||
|
||||
if object_mode in 'EDIT':
|
||||
mode_match_auto_xray = tool_settings.auto_xray_edit and tool_settings.auto_xray
|
||||
mode_match_select_through = tool_settings.select_through_edit and tool_settings.select_through
|
||||
elif object_mode in 'OBJECT':
|
||||
mode_match_auto_xray = tool_settings.auto_xray_object and tool_settings.auto_xray
|
||||
mode_match_select_through = tool_settings.select_through_object and tool_settings.select_through
|
||||
else:
|
||||
mode_match_auto_xray = False
|
||||
mode_match_select_through = False
|
||||
|
||||
if tool == "builtin.select_box":
|
||||
depress_auto_xray = mode_match_auto_xray and tool_settings.auto_xray_box
|
||||
depress_select_through = mode_match_select_through and tool_settings.select_through_box
|
||||
elif tool == "builtin.select_lasso":
|
||||
depress_auto_xray = mode_match_auto_xray and tool_settings.auto_xray_lasso
|
||||
depress_select_through = mode_match_select_through and tool_settings.select_through_lasso
|
||||
elif tool == "builtin.select_circle":
|
||||
depress_auto_xray = mode_match_auto_xray and tool_settings.auto_xray_circle
|
||||
depress_select_through = mode_match_select_through and tool_settings.select_through_circle
|
||||
else:
|
||||
depress_auto_xray = False
|
||||
depress_select_through = False
|
||||
|
||||
if tool_settings.auto_xray_button:
|
||||
row.operator("view3d.toggle_auto_xray", text="", icon='AUTO_XRAY', depress=depress_auto_xray)
|
||||
if tool_settings.select_through_button:
|
||||
row.operator("view3d.toggle_select_through", text="", icon='SELECT_THROUGH', depress=depress_select_through)
|
||||
|
||||
# While exposing `shading.show_xray(_wireframe)` is correct.
|
||||
# this hides the key shortcut from users: #70433.
|
||||
if has_pose_mode:
|
||||
|
@ -999,15 +1036,24 @@ class VIEW3D_HT_header(Header):
|
|||
draw_depressed = shading.show_xray_wireframe
|
||||
else:
|
||||
draw_depressed = shading.show_xray
|
||||
row.operator(
|
||||
"view3d.toggle_xray",
|
||||
text="",
|
||||
icon='XRAY',
|
||||
depress=draw_depressed,
|
||||
)
|
||||
|
||||
if tool_settings.xray_button or not tool_settings.auto_xray_button and not tool_settings.select_through_button:
|
||||
row.operator("view3d.toggle_xray", text="", icon='XRAY', depress=draw_depressed)
|
||||
row.popover(panel="VIEW3D_PT_xray", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(shading, "type", text="", expand=True)
|
||||
if tool_settings.shrink_shading_header:
|
||||
if shading.type == 'SOLID':
|
||||
shadicon = 'SHADING_SOLID'
|
||||
elif shading.type == 'MATERIAL':
|
||||
shadicon = 'SHADING_TEXTURE'
|
||||
elif shading.type == 'RENDERED':
|
||||
shadicon = 'SHADING_RENDERED'
|
||||
else:
|
||||
shadicon = 'SHADING_WIRE'
|
||||
row.operator("view3d.toggle_xray", text="", icon=shadicon, depress=draw_depressed)
|
||||
else:
|
||||
row.prop(shading, "type", text="", expand=True)
|
||||
sub = row.row(align=True)
|
||||
# TODO, currently render shading type ignores mesh two-side, until it's supported
|
||||
# show the shading popover which shows double-sided option.
|
||||
|
@ -1132,6 +1178,21 @@ class ShowHideMenu:
|
|||
layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
|
||||
|
||||
|
||||
# Custom Operators
|
||||
class VIEW3D_box_lasso(bpy.types.Operator):
|
||||
bl_idname = "view3d.box_lasso"
|
||||
bl_label = "box lasso"
|
||||
|
||||
def invoke(self, context, event):
|
||||
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
||||
tool = ToolSelectPanelHelper.tool_active_from_context(context)
|
||||
if tool.idname == "builtin.select_box":
|
||||
bpy.ops.wm.tool_set_by_id(name="builtin.select_lasso")
|
||||
else:
|
||||
bpy.ops.wm.tool_set_by_id(name="builtin.select_box")
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Standard transforms which apply to all cases (mix-in class, not used directly).
|
||||
class VIEW3D_MT_transform_base:
|
||||
bl_label = "Transform"
|
||||
|
@ -6340,6 +6401,12 @@ class VIEW3D_PT_shading(Panel):
|
|||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
layout.label(text="Viewport Shading")
|
||||
tool_settings = _context.tool_settings
|
||||
shading = VIEW3D_PT_shading.get_shading(_context)
|
||||
|
||||
layout.prop(tool_settings, "shrink_shading_header")
|
||||
if tool_settings.shrink_shading_header:
|
||||
layout.prop(shading, "type", text="", expand=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_shading_lighting(Panel):
|
||||
|
@ -6526,17 +6593,7 @@ class VIEW3D_PT_shading_options(Panel):
|
|||
|
||||
row = col.row(align=True)
|
||||
|
||||
if shading.type == 'WIREFRAME':
|
||||
row.prop(shading, "show_xray_wireframe", text="")
|
||||
sub = row.row()
|
||||
sub.active = shading.show_xray_wireframe
|
||||
sub.prop(shading, "xray_alpha_wireframe", text="X-Ray")
|
||||
elif shading.type == 'SOLID':
|
||||
row.prop(shading, "show_xray", text="")
|
||||
sub = row.row()
|
||||
sub.active = shading.show_xray
|
||||
sub.prop(shading, "xray_alpha", text="X-Ray")
|
||||
# X-ray mode is off when alpha is 1.0
|
||||
if shading.type == 'SOLID':
|
||||
xray_active = shading.show_xray and shading.xray_alpha != 1
|
||||
|
||||
row = col.row(align=True)
|
||||
|
@ -6721,6 +6778,95 @@ class VIEW3D_PT_gizmo_display(Panel):
|
|||
col.prop(view, "show_gizmo_camera_dof_distance", text="Focus Distance")
|
||||
|
||||
|
||||
class VIEW3D_PT_xray(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "X-Ray Settings"
|
||||
bl_ui_units_x = 14
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.label(text="X-Ray Settings")
|
||||
shading = VIEW3D_PT_shading.get_shading(context)
|
||||
|
||||
col = layout.column()
|
||||
row = col.row(align=True)
|
||||
if shading.type == 'WIREFRAME':
|
||||
row.prop(shading, "show_xray_wireframe", text="")
|
||||
sub = row.row()
|
||||
sub.active = shading.show_xray_wireframe
|
||||
sub.prop(shading, "xray_alpha_wireframe", text="X-Ray Wireframe")
|
||||
elif shading.type == 'SOLID':
|
||||
row.prop(shading, "show_xray", text="")
|
||||
sub = row.row()
|
||||
sub.active = shading.show_xray
|
||||
sub.prop(shading, "xray_alpha", text="X-Ray Solid")
|
||||
|
||||
|
||||
class VIEW3D_PT_auto_xray(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Automatic X-Ray"
|
||||
bl_parent_id = 'VIEW3D_PT_xray'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "auto_xray")
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.auto_xray
|
||||
sub.prop(tool_settings, "auto_xray_object")
|
||||
sub.prop(tool_settings, "auto_xray_edit")
|
||||
row = layout.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.auto_xray
|
||||
sub.prop(tool_settings, "auto_xray_box", toggle=True)
|
||||
sub.prop(tool_settings, "auto_xray_lasso", toggle=True)
|
||||
sub.prop(tool_settings, "auto_xray_circle", toggle=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_select_through(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Select Through"
|
||||
bl_parent_id = 'VIEW3D_PT_xray'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "select_through")
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.select_through
|
||||
sub.prop(tool_settings, "select_through_object")
|
||||
sub.prop(tool_settings, "select_through_edit")
|
||||
row = layout.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.select_through
|
||||
sub.prop(tool_settings, "select_through_box", toggle=True)
|
||||
sub.prop(tool_settings, "select_through_lasso", toggle=True)
|
||||
sub.prop(tool_settings, "select_through_circle", toggle=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_xray_buttons(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Header Buttons"
|
||||
bl_parent_id = 'VIEW3D_PT_xray'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "auto_xray_button", toggle=True)
|
||||
row.prop(tool_settings, "select_through_button", toggle=True)
|
||||
row.prop(tool_settings, "xray_button", toggle=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_overlay(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
|
@ -6953,6 +7099,21 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
|
|||
|
||||
is_any_solid_shading = not (shading.show_xray or (shading.type == 'WIREFRAME'))
|
||||
|
||||
if shading.type == 'WIREFRAME':
|
||||
xray = shading.show_xray_wireframe and shading.xray_alpha_wireframe < 1.0
|
||||
elif shading.type == 'SOLID':
|
||||
xray = shading.show_xray and shading.xray_alpha < 1.0
|
||||
else:
|
||||
xray = False
|
||||
|
||||
if xray:
|
||||
fdot_draw_depressed = overlay.show_face_center_xray
|
||||
else:
|
||||
fdot_draw_depressed = overlay.show_face_center
|
||||
|
||||
col = layout.column()
|
||||
col.active = display_all
|
||||
|
||||
col = layout.column()
|
||||
col.active = display_all
|
||||
|
||||
|
@ -6964,8 +7125,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
|
|||
sub = split.column()
|
||||
sub.prop(overlay, "show_faces", text="Faces")
|
||||
sub = split.column()
|
||||
sub.active = is_any_solid_shading
|
||||
sub.prop(overlay, "show_face_center", text="Center")
|
||||
sub.operator("view3d.toggle_facedots", text="Facedots", depress = fdot_draw_depressed)
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(overlay, "show_edge_crease", text="Creases", toggle=True)
|
||||
|
@ -8685,6 +8845,7 @@ classes = (
|
|||
VIEW3D_MT_sculpt_gpencil_automasking_pie,
|
||||
VIEW3D_MT_wpaint_vgroup_lock_pie,
|
||||
VIEW3D_MT_sculpt_face_sets_edit_pie,
|
||||
VIEW3D_box_lasso,
|
||||
VIEW3D_MT_sculpt_curves,
|
||||
VIEW3D_PT_active_tool,
|
||||
VIEW3D_PT_active_tool_duplicate,
|
||||
|
@ -8709,6 +8870,10 @@ classes = (
|
|||
VIEW3D_PT_shading_render_pass,
|
||||
VIEW3D_PT_shading_compositor,
|
||||
VIEW3D_PT_gizmo_display,
|
||||
VIEW3D_PT_xray,
|
||||
VIEW3D_PT_auto_xray,
|
||||
VIEW3D_PT_select_through,
|
||||
VIEW3D_PT_xray_buttons,
|
||||
VIEW3D_PT_overlay,
|
||||
VIEW3D_PT_overlay_guides,
|
||||
VIEW3D_PT_overlay_object,
|
||||
|
|
|
@ -161,7 +161,7 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
|
|||
bl_context = ".mesh_edit" # dot on purpose (access from topbar)
|
||||
bl_label = "Options"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_ui_units_x = 12
|
||||
bl_ui_units_x = 13
|
||||
|
||||
def draw(self, _context):
|
||||
# layout = self.layout
|
||||
|
@ -231,6 +231,39 @@ class VIEW3D_PT_tools_meshedit_options_uvs(View3DPanel, Panel):
|
|||
layout.prop(tool_settings, "use_edge_path_live_unwrap")
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_meshedit_options_viewport_facing_select(View3DPanel, Panel):
|
||||
bl_category = "Tool"
|
||||
bl_context = ".mesh_edit" # dot on purpose (access from topbar)
|
||||
bl_label = "Viewport Facing Select"
|
||||
bl_parent_id = "VIEW3D_PT_tools_meshedit_options"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object
|
||||
|
||||
def draw_header(self, context):
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
self.layout.prop(tool_settings, "viewport_facing_select", text="", toggle=False)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
col = layout.column()
|
||||
col.active = tool_settings.viewport_facing_select
|
||||
col.prop(tool_settings, "viewport_facing_select_mode")
|
||||
col.prop(tool_settings, "viewport_facing_select_threshold", text="Threshold")
|
||||
col.prop(tool_settings, "viewport_facing_select_vert")
|
||||
col.prop(tool_settings, "viewport_facing_select_edge")
|
||||
col.prop(tool_settings, "viewport_facing_select_face")
|
||||
|
||||
|
||||
# ********** default tools for editmode_armature ****************
|
||||
|
||||
|
||||
|
@ -2499,6 +2532,7 @@ classes = (
|
|||
VIEW3D_PT_tools_meshedit_options,
|
||||
VIEW3D_PT_tools_meshedit_options_transform,
|
||||
VIEW3D_PT_tools_meshedit_options_uvs,
|
||||
VIEW3D_PT_tools_meshedit_options_viewport_facing_select,
|
||||
VIEW3D_PT_tools_armatureedit_options,
|
||||
VIEW3D_PT_tools_posemode_options,
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2],
|
|||
int y0,
|
||||
int x1,
|
||||
int y1,
|
||||
int error_value);
|
||||
int error_value,
|
||||
bool fully_inside);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2],
|
|||
int y0,
|
||||
int x1,
|
||||
int y1,
|
||||
const int error_value)
|
||||
const int error_value,
|
||||
bool fully_inside)
|
||||
{
|
||||
|
||||
if (x0 == error_value || x1 == error_value || mcoords_len == 0) {
|
||||
|
@ -66,23 +67,32 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2],
|
|||
|
||||
const int v1[2] = {x0, y0}, v2[2] = {x1, y1};
|
||||
|
||||
/* check points in lasso */
|
||||
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value)) {
|
||||
return true;
|
||||
}
|
||||
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value)) {
|
||||
/* enclosed faces only checks for both points inside selection area */
|
||||
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value) &&
|
||||
BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* no points in lasso, so we have to intersect with lasso edge */
|
||||
|
||||
if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) {
|
||||
return true;
|
||||
}
|
||||
for (uint a = 0; a < mcoords_len - 1; a++) {
|
||||
if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) {
|
||||
if (!fully_inside) {
|
||||
/* check points in lasso */
|
||||
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value)) {
|
||||
return true;
|
||||
}
|
||||
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* no points in lasso, so we have to intersect with lasso edge */
|
||||
|
||||
if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) {
|
||||
return true;
|
||||
}
|
||||
for (unsigned int a = 0; a < mcoords_len - 1; a++) {
|
||||
if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -188,6 +188,8 @@ static void blo_update_defaults_screen(bScreen *screen,
|
|||
v3d->overlay.vertex_paint_mode_opacity = 1.0f;
|
||||
/* Use dimmed selected edges. */
|
||||
v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_EDGES;
|
||||
/* Show xray facedots */
|
||||
v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_FACE_DOT_XRAY;
|
||||
/* grease pencil settings */
|
||||
v3d->vertex_opacity = 1.0f;
|
||||
v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
|
||||
|
@ -378,6 +380,25 @@ static void blo_update_defaults_scene(Main *bmain, Scene *scene)
|
|||
if (idprop) {
|
||||
IDP_ClearProperty(idprop);
|
||||
}
|
||||
|
||||
/* X-Ray. */
|
||||
ts->xray_button = true;
|
||||
ts->auto_xray_object = true;
|
||||
ts->auto_xray_edit = true;
|
||||
ts->auto_xray_box = true;
|
||||
ts->auto_xray_lasso = true;
|
||||
ts->auto_xray_circle = true;
|
||||
ts->select_through = true;
|
||||
ts->select_through_object = true;
|
||||
ts->select_through_box = true;
|
||||
ts->select_through_lasso = true;
|
||||
ts->select_through_circle = true;
|
||||
|
||||
/* Viewport-Facing Select */
|
||||
ts->viewport_facing_select_mode = 1;
|
||||
ts->viewport_facing_select_vert = 1;
|
||||
ts->viewport_facing_select_edge = 1;
|
||||
ts->viewport_facing_select_face = 1;
|
||||
}
|
||||
|
||||
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
|
||||
|
|
|
@ -477,9 +477,8 @@ void blo_do_versions_userdef(UserDef *userdef)
|
|||
|
||||
if (!USER_VERSION_ATLEAST(278, 6)) {
|
||||
/* Clear preference flags for re-use. */
|
||||
userdef->flag &= ~(USER_FLAG_NUMINPUT_ADVANCED | (1 << 2) | USER_FLAG_UNUSED_3 |
|
||||
USER_FLAG_UNUSED_6 | USER_FLAG_UNUSED_7 | USER_FLAG_UNUSED_9 |
|
||||
USER_DEVELOPER_UI);
|
||||
userdef->flag &= ~(USER_FLAG_NUMINPUT_ADVANCED | (1 << 2) | USER_FLAG_UNUSED_6 |
|
||||
USER_FLAG_UNUSED_7 | USER_FLAG_UNUSED_9 | USER_DEVELOPER_UI);
|
||||
userdef->uiflag &= ~(USER_HEADER_BOTTOM);
|
||||
userdef->transopts &= ~(USER_TR_UNUSED_2 | USER_TR_UNUSED_3 | USER_TR_UNUSED_4 |
|
||||
USER_TR_UNUSED_6 | USER_TR_UNUSED_7);
|
||||
|
@ -568,8 +567,6 @@ void blo_do_versions_userdef(UserDef *userdef)
|
|||
|
||||
copy_v3_fl3(userdef->light_ambient, 0.025000, 0.025000, 0.025000);
|
||||
|
||||
userdef->flag &= ~(USER_FLAG_UNUSED_4);
|
||||
|
||||
userdef->uiflag &= ~(USER_HEADER_FROM_PREF | USER_REGISTER_ALL_USERS);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,10 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
|||
bool select_face = pd->edit_mesh.select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0;
|
||||
bool select_edge = pd->edit_mesh.select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0;
|
||||
|
||||
bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0 ||
|
||||
pd->edit_mesh.do_zbufclip;
|
||||
bool show_face_dots = !XRAY_FLAG_ENABLED(draw_ctx->v3d) &&
|
||||
v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT ||
|
||||
XRAY_FLAG_ENABLED(draw_ctx->v3d) &&
|
||||
v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT_XRAY;
|
||||
|
||||
bool show_retopology = RETOPOLOGY_ENABLED(v3d);
|
||||
float retopology_offset = RETOPOLOGY_OFFSET(v3d);
|
||||
|
|
|
@ -73,7 +73,9 @@ static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, eDrawTyp
|
|||
{
|
||||
if (select_mode & SCE_SELECT_FACE) {
|
||||
if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) {
|
||||
return true;
|
||||
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT_XRAY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) {
|
||||
return true;
|
||||
|
|
|
@ -751,7 +751,8 @@ bool select_lasso(const ViewContext &vc,
|
|||
int(pos1_proj.y),
|
||||
int(pos2_proj.x),
|
||||
int(pos2_proj.y),
|
||||
IS_CLIPPED))
|
||||
IS_CLIPPED,
|
||||
false))
|
||||
{
|
||||
apply_selection_operation_at_index(selection.span, curve_i, sel_op);
|
||||
changed = true;
|
||||
|
|
|
@ -385,11 +385,20 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc,
|
|||
void *user_data,
|
||||
eV3DProjTest clip_flag);
|
||||
|
||||
void mesh_foreachScreenFace(
|
||||
void mesh_foreachScreenFaceCenter(
|
||||
ViewContext *vc,
|
||||
void (*func)(void *user_data, BMFace *efa, const float screen_co[2], int index),
|
||||
void *user_data,
|
||||
eV3DProjTest clip_flag);
|
||||
void mesh_foreachScreenFaceVerts(struct ViewContext *vc,
|
||||
void (*func)(void *userData,
|
||||
struct BMFace *efa,
|
||||
const float screen_co[][2],
|
||||
int total_count,
|
||||
struct rctf *poly_rect,
|
||||
bool *face_hit),
|
||||
void *userData,
|
||||
const eV3DProjTest clip_flag);
|
||||
void nurbs_foreachScreenVert(ViewContext *vc,
|
||||
void (*func)(void *user_data,
|
||||
Nurb *nu,
|
||||
|
|
|
@ -448,8 +448,8 @@ DEF_ICON_BLANK(705)
|
|||
DEF_ICON_BLANK(706)
|
||||
DEF_ICON_BLANK(707)
|
||||
DEF_ICON_BLANK(708)
|
||||
DEF_ICON_BLANK(709)
|
||||
DEF_ICON_BLANK(710)
|
||||
DEF_ICON(AUTO_XRAY)
|
||||
DEF_ICON(SELECT_THROUGH)
|
||||
DEF_ICON(SELECT_SET)
|
||||
DEF_ICON(SELECT_EXTEND)
|
||||
DEF_ICON(SELECT_SUBTRACT)
|
||||
|
|
|
@ -248,7 +248,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
|||
|
||||
case TH_HEADER_ACTIVE: {
|
||||
cp = ts->header;
|
||||
const int factor = 5;
|
||||
const int factor = U.header_highlight;
|
||||
/* Lighten the header color when editor is active. */
|
||||
header_active[0] = cp[0] > 245 ? cp[0] - factor : cp[0] + factor;
|
||||
header_active[1] = cp[1] > 245 ? cp[1] - factor : cp[1] + factor;
|
||||
|
|
|
@ -239,7 +239,9 @@ static void findnearestvert__doClosest(void *user_data,
|
|||
|
||||
dist_test = dist_test_bias = len_manhattan_v2v2(data->mval_fl, screen_co);
|
||||
|
||||
if (data->use_select_bias && BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||
if (!(U.flag & USER_ADJUSTABLE_CLICK_SELECT && U.flag & USER_SELECT_UNBIASED) &&
|
||||
data->use_select_bias && BM_elem_flag_test(eve, BM_ELEM_SELECT))
|
||||
{
|
||||
dist_test_bias += FIND_NEAR_SELECT_BIAS;
|
||||
}
|
||||
|
||||
|
@ -449,7 +451,9 @@ static void find_nearest_edge__doClosest(void *user_data,
|
|||
|
||||
dist_test = dist_test_bias = len_manhattan_v2v2(data->mval_fl, screen_co);
|
||||
|
||||
if (data->use_select_bias && BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
|
||||
if (!(U.flag & USER_ADJUSTABLE_CLICK_SELECT && U.flag & USER_SELECT_UNBIASED) &&
|
||||
data->use_select_bias && BM_elem_flag_test(eed, BM_ELEM_SELECT))
|
||||
{
|
||||
dist_test_bias += FIND_NEAR_SELECT_BIAS;
|
||||
}
|
||||
|
||||
|
@ -683,7 +687,9 @@ static void findnearestface__doClosest(void *user_data,
|
|||
|
||||
dist_test = dist_test_bias = len_manhattan_v2v2(data->mval_fl, screen_co);
|
||||
|
||||
if (data->use_select_bias && BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
|
||||
if (!(U.flag & USER_ADJUSTABLE_CLICK_SELECT && U.flag & USER_SELECT_UNBIASED) &&
|
||||
data->use_select_bias && BM_elem_flag_test(efa, BM_ELEM_SELECT))
|
||||
{
|
||||
dist_test_bias += FIND_NEAR_SELECT_BIAS;
|
||||
}
|
||||
|
||||
|
@ -720,27 +726,27 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
|
|||
uint base_index = 0;
|
||||
|
||||
if (!XRAY_FLAG_ENABLED(vc->v3d)) {
|
||||
float dist_test;
|
||||
float dist_test = 0.0f;
|
||||
uint index;
|
||||
BMFace *efa;
|
||||
uint dist_px_manhattan_test = 0;
|
||||
|
||||
{
|
||||
uint dist_px_manhattan_test = 0;
|
||||
if (*dist_px_manhattan_p != 0.0f && (use_zbuf_single_px == false)) {
|
||||
dist_px_manhattan_test = uint(
|
||||
ED_view3d_backbuf_sample_size_clamp(vc->region, *dist_px_manhattan_p));
|
||||
if (U.flag & USER_ADJUSTABLE_CLICK_SELECT ||
|
||||
*dist_px_manhattan_p != 0.0f && (use_zbuf_single_px == false))
|
||||
{
|
||||
dist_px_manhattan_test = (uint)ED_view3d_backbuf_sample_size_clamp(vc->region,
|
||||
*dist_px_manhattan_p);
|
||||
}
|
||||
|
||||
DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_FACE);
|
||||
|
||||
if (dist_px_manhattan_test == 0) {
|
||||
if (!(U.flag & USER_ADJUSTABLE_CLICK_SELECT) && dist_px_manhattan_test == 0) {
|
||||
index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, vc->mval);
|
||||
dist_test = 0.0f;
|
||||
}
|
||||
else {
|
||||
index = DRW_select_buffer_find_nearest_to_point(
|
||||
vc->depsgraph, vc->region, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px_manhattan_test);
|
||||
dist_test = dist_px_manhattan_test;
|
||||
}
|
||||
|
||||
if (index) {
|
||||
|
@ -766,7 +772,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
|
|||
|
||||
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
|
||||
|
||||
mesh_foreachScreenFace(
|
||||
mesh_foreachScreenFaceCenter(
|
||||
vc, find_nearest_face_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
|
||||
*r_dist_center = data.dist_px_manhattan;
|
||||
|
@ -774,7 +780,14 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
|
|||
/* end exception */
|
||||
|
||||
if (efa) {
|
||||
if (dist_test < *dist_px_manhattan_p) {
|
||||
if (U.flag & USER_ADJUSTABLE_CLICK_SELECT && dist_px_manhattan_test < *dist_px_manhattan_p) {
|
||||
if (r_base_index) {
|
||||
*r_base_index = base_index;
|
||||
}
|
||||
*dist_px_manhattan_p = dist_px_manhattan_test;
|
||||
return efa;
|
||||
}
|
||||
else if (!(U.flag & USER_ADJUSTABLE_CLICK_SELECT) && dist_test < *dist_px_manhattan_p) {
|
||||
if (r_base_index) {
|
||||
*r_base_index = base_index;
|
||||
}
|
||||
|
@ -819,7 +832,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
|
|||
*dist_px_manhattan_p;
|
||||
|
||||
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
|
||||
mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, clip_flag);
|
||||
mesh_foreachScreenFaceCenter(vc, findnearestface__doClosest, &data, clip_flag);
|
||||
|
||||
hit = (data.use_cycle && data.hit_cycle.face) ? &data.hit_cycle : &data.hit;
|
||||
|
||||
|
|
|
@ -3990,6 +3990,62 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot)
|
|||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Invoke Last Operator
|
||||
* \{ */
|
||||
|
||||
static int invoke_last_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmOperator *lastop = static_cast<wmOperator *>(wm->operators.last);
|
||||
|
||||
/* Seek last registered operator */
|
||||
while (lastop) {
|
||||
if (lastop->type->flag & OPTYPE_REGISTER) {
|
||||
if (STREQ(lastop->idname, "MESH_OT_delete") || STREQ(lastop->idname, "MESH_OT_select_all") ||
|
||||
STREQ(lastop->idname, "MESH_OT_select_mode") ||
|
||||
STREQ(lastop->idname, "OBJECT_OT_editmode_toggle") ||
|
||||
STREQ(lastop->idname, "OBJECT_OT_select_all") ||
|
||||
STREQ(lastop->idname, "TRANSFORM_OT_resize") ||
|
||||
STREQ(lastop->idname, "TRANSFORM_OT_rotate") ||
|
||||
STREQ(lastop->idname, "TRANSFORM_OT_trackball") ||
|
||||
STREQ(lastop->idname, "TRANSFORM_OT_translate"))
|
||||
{
|
||||
lastop = lastop->prev;
|
||||
}
|
||||
else {
|
||||
// printf(lastop->idname, "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastop = lastop->prev;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastop) {
|
||||
WM_operator_free_all_after(wm, lastop);
|
||||
WM_operator_invoke_last(C, lastop);
|
||||
}
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void SCREEN_OT_invoke_last(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Invoke Last";
|
||||
ot->description = "Invoke last operation";
|
||||
ot->idname = "SCREEN_OT_invoke_last";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = invoke_last_exec;
|
||||
|
||||
ot->poll = ED_operator_screenactive;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Redo Operator
|
||||
* \{ */
|
||||
|
@ -5871,6 +5927,7 @@ void ED_operatortypes_screen()
|
|||
WM_operatortype_append(SCREEN_OT_actionzone);
|
||||
WM_operatortype_append(SCREEN_OT_repeat_last);
|
||||
WM_operatortype_append(SCREEN_OT_repeat_history);
|
||||
WM_operatortype_append(SCREEN_OT_invoke_last);
|
||||
WM_operatortype_append(SCREEN_OT_redo_last);
|
||||
|
||||
/* Screen tools. */
|
||||
|
|
|
@ -1242,3 +1242,248 @@ void VIEW3D_OT_toggle_xray(wmOperatorType *ot)
|
|||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Toggle Automatic XRay
|
||||
* \{ */
|
||||
|
||||
static int toggle_auto_xray_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
bToolRef *tref = area->runtime.tool;
|
||||
const bool mode_match = obedit ? ts->auto_xray_edit : ts->auto_xray_object;
|
||||
|
||||
if (STREQ(tref->idname, "builtin.select_box") ||
|
||||
STREQ(tref->idname_fallback, "builtin.select_box"))
|
||||
{
|
||||
if (mode_match && ts->auto_xray && ts->auto_xray_box) {
|
||||
ts->auto_xray ^= true;
|
||||
}
|
||||
else {
|
||||
if (!mode_match) {
|
||||
if (obedit) {
|
||||
ts->auto_xray_edit ^= true;
|
||||
}
|
||||
else {
|
||||
ts->auto_xray_object ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ts->auto_xray) {
|
||||
ts->auto_xray ^= true;
|
||||
}
|
||||
|
||||
if (!ts->auto_xray_box) {
|
||||
ts->auto_xray_box ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (STREQ(tref->idname, "builtin.select_lasso") ||
|
||||
STREQ(tref->idname_fallback, "builtin.select_lasso"))
|
||||
{
|
||||
if (mode_match && ts->auto_xray && ts->auto_xray_lasso) {
|
||||
ts->auto_xray ^= true;
|
||||
}
|
||||
else {
|
||||
if (!mode_match) {
|
||||
if (obedit) {
|
||||
ts->auto_xray_edit ^= true;
|
||||
}
|
||||
else {
|
||||
ts->auto_xray_object ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ts->auto_xray) {
|
||||
ts->auto_xray ^= true;
|
||||
}
|
||||
|
||||
if (!ts->auto_xray_lasso) {
|
||||
ts->auto_xray_lasso ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (STREQ(tref->idname, "builtin.select_circle") ||
|
||||
STREQ(tref->idname_fallback, "builtin.select_circle"))
|
||||
{
|
||||
if (mode_match && ts->auto_xray && ts->auto_xray_circle) {
|
||||
ts->auto_xray ^= true;
|
||||
}
|
||||
else {
|
||||
if (!mode_match) {
|
||||
if (obedit) {
|
||||
ts->auto_xray_edit ^= true;
|
||||
}
|
||||
else {
|
||||
ts->auto_xray_object ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ts->auto_xray) {
|
||||
ts->auto_xray ^= true;
|
||||
}
|
||||
|
||||
if (!ts->auto_xray_circle) {
|
||||
ts->auto_xray_circle ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ED_area_tag_redraw(area);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void VIEW3D_OT_toggle_auto_xray(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Automatic X-Ray";
|
||||
ot->idname = "VIEW3D_OT_toggle_auto_xray";
|
||||
ot->description = "Transparent scene display during box, lasso, and circle select";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = toggle_auto_xray_exec;
|
||||
ot->poll = ED_operator_view3d_active;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Toggle Select Through
|
||||
* \{ */
|
||||
|
||||
static int toggle_select_through_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
bToolRef *tref = area->runtime.tool;
|
||||
const bool mode_match = obedit ? ts->select_through_edit : ts->select_through_object;
|
||||
|
||||
if (STREQ(tref->idname, "builtin.select_box") ||
|
||||
STREQ(tref->idname_fallback, "builtin.select_box"))
|
||||
{
|
||||
if (mode_match && ts->select_through && ts->select_through_box) {
|
||||
ts->select_through ^= true;
|
||||
}
|
||||
else {
|
||||
if (!mode_match) {
|
||||
if (obedit) {
|
||||
ts->select_through_edit ^= true;
|
||||
}
|
||||
else {
|
||||
ts->select_through_object ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ts->select_through) {
|
||||
ts->select_through ^= true;
|
||||
}
|
||||
|
||||
if (!ts->select_through_box) {
|
||||
ts->select_through_box ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (STREQ(tref->idname, "builtin.select_lasso") ||
|
||||
STREQ(tref->idname_fallback, "builtin.select_lasso"))
|
||||
{
|
||||
if (mode_match && ts->select_through && ts->select_through_lasso) {
|
||||
ts->select_through ^= true;
|
||||
}
|
||||
else {
|
||||
if (!mode_match) {
|
||||
if (obedit) {
|
||||
ts->select_through_edit ^= true;
|
||||
}
|
||||
else {
|
||||
ts->select_through_object ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ts->select_through) {
|
||||
ts->select_through ^= true;
|
||||
}
|
||||
|
||||
if (!ts->select_through_lasso) {
|
||||
ts->select_through_lasso ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (STREQ(tref->idname, "builtin.select_circle") ||
|
||||
STREQ(tref->idname_fallback, "builtin.select_circle"))
|
||||
{
|
||||
if (mode_match && ts->select_through && ts->select_through_circle) {
|
||||
ts->select_through ^= true;
|
||||
}
|
||||
else {
|
||||
if (!mode_match) {
|
||||
if (obedit) {
|
||||
ts->select_through_edit ^= true;
|
||||
}
|
||||
else {
|
||||
ts->select_through_object ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ts->select_through) {
|
||||
ts->select_through ^= true;
|
||||
}
|
||||
|
||||
if (!ts->select_through_circle) {
|
||||
ts->select_through_circle ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ED_area_tag_redraw(area);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void VIEW3D_OT_toggle_select_through(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Select Through";
|
||||
ot->idname = "VIEW3D_OT_toggle_select_through";
|
||||
ot->description = "Select occluded objects and mesh elements with box, lasso, and circle select";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = toggle_select_through_exec;
|
||||
ot->poll = ED_operator_view3d_active;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Toggle Facedots
|
||||
* \{ */
|
||||
|
||||
static int toggle_facedots_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
if (!XRAY_FLAG_ENABLED(v3d)) {
|
||||
v3d->overlay.edit_flag ^= V3D_OVERLAY_EDIT_FACE_DOT;
|
||||
}
|
||||
else {
|
||||
v3d->overlay.edit_flag ^= V3D_OVERLAY_EDIT_FACE_DOT_XRAY;
|
||||
}
|
||||
ED_area_tag_redraw(area);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void VIEW3D_OT_toggle_facedots(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Facedots";
|
||||
ot->idname = "VIEW3D_OT_toggle_facedots";
|
||||
ot->description = "Show face center dots in the current shading mode";
|
||||
/* api callbacks */
|
||||
ot->exec = toggle_facedots_exec;
|
||||
ot->poll = ED_operator_view3d_active;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -56,6 +56,9 @@ void VIEW3D_OT_render_border(struct wmOperatorType *ot);
|
|||
void VIEW3D_OT_clear_render_border(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_toggle_shading(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_toggle_xray(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_toggle_auto_xray(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_toggle_select_through(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_toggle_facedots(struct wmOperatorType *ot);
|
||||
|
||||
/* `view3d_draw.cc` */
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BLI_bitmap.h"
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
@ -43,6 +44,8 @@
|
|||
#include "ED_screen.hh"
|
||||
#include "ED_view3d.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Internal Clipping Utilities
|
||||
* \{ */
|
||||
|
@ -244,7 +247,7 @@ struct foreachScreenEdge_userData {
|
|||
int content_planes_len;
|
||||
};
|
||||
|
||||
struct foreachScreenFace_userData {
|
||||
struct foreachScreenFaceCenter_userData {
|
||||
void (*func)(void *user_data, BMFace *efa, const float screen_co_b[2], int index);
|
||||
void *user_data;
|
||||
ViewContext vc;
|
||||
|
@ -543,12 +546,13 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc,
|
|||
/** \name Edit-Mesh: For Each Screen Face Center
|
||||
* \{ */
|
||||
|
||||
static void mesh_foreachScreenFace__mapFunc(void *user_data,
|
||||
int index,
|
||||
const float cent[3],
|
||||
const float /*no*/[3])
|
||||
static void mesh_foreachScreenFaceCenter__mapFunc(void *user_data,
|
||||
int index,
|
||||
const float cent[3],
|
||||
const float /*no*/[3])
|
||||
{
|
||||
foreachScreenFace_userData *data = static_cast<foreachScreenFace_userData *>(user_data);
|
||||
foreachScreenFaceCenter_userData *data = static_cast<foreachScreenFaceCenter_userData *>(
|
||||
user_data);
|
||||
BMFace *efa = BM_face_at_index(data->vc.em->bm, index);
|
||||
if (UNLIKELY(BM_elem_flag_test(efa, BM_ELEM_HIDDEN))) {
|
||||
return;
|
||||
|
@ -564,14 +568,14 @@ static void mesh_foreachScreenFace__mapFunc(void *user_data,
|
|||
data->func(data->user_data, efa, screen_co, index);
|
||||
}
|
||||
|
||||
void mesh_foreachScreenFace(
|
||||
void mesh_foreachScreenFaceCenter(
|
||||
ViewContext *vc,
|
||||
void (*func)(void *user_data, BMFace *efa, const float screen_co_b[2], int index),
|
||||
void *user_data,
|
||||
const eV3DProjTest clip_flag)
|
||||
{
|
||||
BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0);
|
||||
foreachScreenFace_userData data;
|
||||
foreachScreenFaceCenter_userData data;
|
||||
|
||||
Mesh *me = editbmesh_get_eval_cage_from_orig(
|
||||
vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
|
||||
|
@ -588,16 +592,151 @@ void mesh_foreachScreenFace(
|
|||
const int face_dot_tags_num = me->runtime->subsurf_face_dot_tags.size();
|
||||
if (face_dot_tags_num && (face_dot_tags_num != me->totvert)) {
|
||||
BKE_mesh_foreach_mapped_subdiv_face_center(
|
||||
me, mesh_foreachScreenFace__mapFunc, &data, MESH_FOREACH_NOP);
|
||||
me, mesh_foreachScreenFaceCenter__mapFunc, &data, MESH_FOREACH_NOP);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_foreach_mapped_face_center(
|
||||
me, mesh_foreachScreenFace__mapFunc, &data, MESH_FOREACH_NOP);
|
||||
me, mesh_foreachScreenFaceCenter__mapFunc, &data, MESH_FOREACH_NOP);
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Edit-Mesh: For Each Screen Face Verts
|
||||
* \{ */
|
||||
|
||||
void mesh_foreachScreenFaceVerts(ViewContext *vc,
|
||||
void (*func)(void *userData,
|
||||
struct BMFace *efa,
|
||||
const float screen_co[][2],
|
||||
int total_count,
|
||||
rctf *screen_rect,
|
||||
bool *face_hit),
|
||||
void *userData,
|
||||
const eV3DProjTest clip_flag)
|
||||
{
|
||||
ED_view3d_check_mats_rv3d(vc->rv3d);
|
||||
BM_mesh_elem_table_ensure(vc->em->bm, BM_FACE);
|
||||
|
||||
BMFace *efa;
|
||||
const BMesh *bm = vc->em->bm;
|
||||
|
||||
float temp_screen_co[2];
|
||||
int total_length = 0;
|
||||
|
||||
float(*screen_coords)[2] = static_cast<float(*)[2]>(
|
||||
MEM_mallocN(sizeof(float) * 2 * bm->totvert, __func__));
|
||||
int face_screen_verts_size = 4;
|
||||
float(*face_screen_verts)[2] = static_cast<float(*)[2]>(
|
||||
MEM_mallocN(sizeof(int) * 2 * face_screen_verts_size, __func__));
|
||||
|
||||
/* This makes only sense on subdivided meshes.*/
|
||||
BLI_bitmap *faces_visited;
|
||||
int cage_index = BKE_modifiers_get_cage_index(vc->scene, vc->obedit, nullptr, 1);
|
||||
const bool cage_display = cage_index != -1;
|
||||
if (cage_display) {
|
||||
faces_visited = BLI_BITMAP_NEW((size_t)bm->totface, __func__);
|
||||
}
|
||||
|
||||
/* Transform and store all visible verts into screen coords. */
|
||||
for (int i = 0; i < bm->totvert; i++) {
|
||||
BMVert *bmvert = BM_vert_at_index(vc->em->bm, i);
|
||||
|
||||
if (BM_elem_flag_test_bool(bmvert, BM_ELEM_HIDDEN)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ED_view3d_project_float_object(vc->region, bmvert->co, temp_screen_co, clip_flag) ==
|
||||
V3D_PROJ_RET_OK)
|
||||
{
|
||||
screen_coords[i][0] = temp_screen_co[0];
|
||||
screen_coords[i][1] = temp_screen_co[1];
|
||||
}
|
||||
else {
|
||||
screen_coords[i][0] = 0.0f;
|
||||
screen_coords[i][1] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
const int *poly_index = static_cast<const int *>(CustomData_get_layer(&bm->pdata, CD_ORIGINDEX));
|
||||
const bool use_original_index = poly_index != 0;
|
||||
|
||||
rctf poly_rect_data;
|
||||
rctf *poly_rect = &poly_rect_data;
|
||||
bool face_hit = false;
|
||||
|
||||
/* Collect polygon verts and send off per poly callback. */
|
||||
for (int i = 0; i < bm->totface; i++) {
|
||||
int original_index = i;
|
||||
if (use_original_index) {
|
||||
original_index = *poly_index++;
|
||||
if (original_index == ORIGINDEX_NONE) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (cage_display && BLI_BITMAP_TEST(faces_visited, original_index)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
efa = BM_face_at_index(vc->em->bm, original_index);
|
||||
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
|
||||
|
||||
if (bm->totvert > face_screen_verts_size) {
|
||||
face_screen_verts_size = bm->totvert;
|
||||
MEM_freeN(face_screen_verts);
|
||||
face_screen_verts = static_cast<float(*)[2]>(
|
||||
MEM_mallocN(sizeof(float) * 2 * face_screen_verts_size, __func__));
|
||||
}
|
||||
|
||||
total_length = 0;
|
||||
BLI_rctf_init_minmax(poly_rect);
|
||||
|
||||
bool skip = false;
|
||||
|
||||
BMLoop *l_first, *l_iter;
|
||||
int j = 0;
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(efa);
|
||||
do {
|
||||
const int k = BM_elem_index_get(l_iter->v);
|
||||
face_screen_verts[j][0] = screen_coords[k][0];
|
||||
face_screen_verts[j][1] = screen_coords[k][1];
|
||||
|
||||
/* Ignore polygons with invalid screen coords.*/
|
||||
if (face_screen_verts[j][0] == 0.0f && face_screen_verts[j][1] == 0.0f) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
|
||||
total_length++, j++;
|
||||
BLI_rctf_do_minmax_v(poly_rect, screen_coords[k]);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
|
||||
if (skip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
face_hit = false;
|
||||
|
||||
func(
|
||||
userData, efa, (const float(*)[2])face_screen_verts, total_length, poly_rect, &face_hit);
|
||||
|
||||
if (cage_display && face_hit) {
|
||||
BLI_BITMAP_ENABLE(faces_visited, original_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cage_display) {
|
||||
MEM_freeN(faces_visited);
|
||||
}
|
||||
MEM_freeN(screen_coords);
|
||||
MEM_freeN(face_screen_verts);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Edit-Nurbs: For Each Screen Vertex
|
||||
* \{ */
|
||||
|
|
|
@ -640,6 +640,25 @@ void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3D_OpPro
|
|||
if (flag & V3D_OP_PROP_USE_MOUSE_INIT) {
|
||||
WM_operator_properties_use_cursor_init(ot);
|
||||
}
|
||||
|
||||
if (flag & V3D_OP_PROP_FRAME_SELECTED_DISTANCE) {
|
||||
PropertyRNA *prop;
|
||||
prop = RNA_def_int(ot->srna,
|
||||
"frame_selected_distance",
|
||||
0,
|
||||
0,
|
||||
1000,
|
||||
"Camera Offset",
|
||||
"Distance to put camera from selected",
|
||||
0,
|
||||
1000);
|
||||
}
|
||||
|
||||
if (flag & V3D_OP_PROP_ZOOM_SPEED) {
|
||||
PropertyRNA *prop;
|
||||
prop = RNA_def_float(
|
||||
ot->srna, "zoom_speed", 1.2f, 1.001, 10, "Zoom Speed", "Speed to zoom camera", 1.001f, 10);
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -41,6 +41,8 @@ enum eV3D_OpPropFlag {
|
|||
V3D_OP_PROP_DELTA = (1 << 1),
|
||||
V3D_OP_PROP_USE_ALL_REGIONS = (1 << 2),
|
||||
V3D_OP_PROP_USE_MOUSE_INIT = (1 << 3),
|
||||
V3D_OP_PROP_FRAME_SELECTED_DISTANCE = (1 << 4),
|
||||
V3D_OP_PROP_ZOOM_SPEED = (1 << 5),
|
||||
};
|
||||
ENUM_OPERATORS(eV3D_OpPropFlag, V3D_OP_PROP_USE_MOUSE_INIT);
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ static void view3d_from_minmax(bContext *C,
|
|||
const float min[3],
|
||||
const float max[3],
|
||||
bool ok_dist,
|
||||
const int smooth_viewtx)
|
||||
const int smooth_viewtx,
|
||||
const int view_dist)
|
||||
{
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
float afm[3];
|
||||
|
@ -130,7 +131,7 @@ static void view3d_from_minmax(bContext *C,
|
|||
v3d, region, depsgraph, persp, true, (size / 2) * VIEW3D_MARGIN);
|
||||
if (rv3d->is_persp) {
|
||||
/* don't zoom closer than the near clipping plane */
|
||||
new_dist = max_ff(new_dist, v3d->clip_start * 1.5f);
|
||||
new_dist = max_ff(new_dist, v3d->clip_start * 1.5f + view_dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +163,8 @@ static void view3d_from_minmax_multi(bContext *C,
|
|||
const float min[3],
|
||||
const float max[3],
|
||||
const bool ok_dist,
|
||||
const int smooth_viewtx)
|
||||
const int smooth_viewtx,
|
||||
const int view_dist)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
||||
|
@ -171,7 +173,7 @@ static void view3d_from_minmax_multi(bContext *C,
|
|||
/* when using all regions, don't jump out of camera view,
|
||||
* but _do_ allow locked cameras to be moved */
|
||||
if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
|
||||
view3d_from_minmax(C, v3d, region, min, max, ok_dist, smooth_viewtx);
|
||||
view3d_from_minmax(C, v3d, region, min, max, ok_dist, smooth_viewtx, view_dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -259,10 +261,10 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
|
|||
ED_view3d_smooth_view_undo_begin(C, area);
|
||||
|
||||
if (use_all_regions) {
|
||||
view3d_from_minmax_multi(C, v3d, min, max, true, smooth_viewtx);
|
||||
view3d_from_minmax_multi(C, v3d, min, max, true, smooth_viewtx, 0);
|
||||
}
|
||||
else {
|
||||
view3d_from_minmax(C, v3d, region, min, max, true, smooth_viewtx);
|
||||
view3d_from_minmax(C, v3d, region, min, max, true, smooth_viewtx, 0);
|
||||
}
|
||||
|
||||
ED_view3d_smooth_view_undo_end(C, area, op->type->name, false);
|
||||
|
@ -323,6 +325,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
|
|||
/* any one of the regions may be locked */
|
||||
(use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
|
||||
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
|
||||
const int view_dist = RNA_int_get(op->ptr, "frame_selected_distance");
|
||||
|
||||
INIT_MINMAX(min, max);
|
||||
if (is_face_map) {
|
||||
|
@ -441,10 +444,10 @@ static int viewselected_exec(bContext *C, wmOperator *op)
|
|||
ED_view3d_smooth_view_undo_begin(C, area);
|
||||
|
||||
if (use_all_regions) {
|
||||
view3d_from_minmax_multi(C, v3d, min, max, ok_dist, smooth_viewtx);
|
||||
view3d_from_minmax_multi(C, v3d, min, max, ok_dist, smooth_viewtx, view_dist);
|
||||
}
|
||||
else {
|
||||
view3d_from_minmax(C, v3d, region, min, max, ok_dist, smooth_viewtx);
|
||||
view3d_from_minmax(C, v3d, region, min, max, ok_dist, smooth_viewtx, view_dist);
|
||||
}
|
||||
|
||||
ED_view3d_smooth_view_undo_end(C, area, op->type->name, false);
|
||||
|
@ -468,6 +471,7 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot)
|
|||
|
||||
/* properties */
|
||||
view3d_operator_properties_common(ot, V3D_OP_PROP_USE_ALL_REGIONS);
|
||||
view3d_operator_properties_common(ot, V3D_OP_PROP_FRAME_SELECTED_DISTANCE);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -390,7 +390,8 @@ static void view_zoom_apply_step(bContext *C,
|
|||
ScrArea *area,
|
||||
ARegion *region,
|
||||
const int delta,
|
||||
const int zoom_xy[2])
|
||||
const int zoom_xy[2],
|
||||
const float zoom_speed)
|
||||
{
|
||||
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
|
@ -403,7 +404,8 @@ static void view_zoom_apply_step(bContext *C,
|
|||
ED_view3d_dist_range_get(v3d, dist_range);
|
||||
|
||||
if (delta < 0) {
|
||||
const float step = 1.2f;
|
||||
const float step = zoom_speed;
|
||||
|
||||
if (use_cam_zoom) {
|
||||
view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
|
||||
}
|
||||
|
@ -414,7 +416,7 @@ static void view_zoom_apply_step(bContext *C,
|
|||
}
|
||||
}
|
||||
else {
|
||||
const float step = 1.0f / 1.2f;
|
||||
const float step = 1.0f / zoom_speed;
|
||||
if (use_cam_zoom) {
|
||||
view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
|
||||
}
|
||||
|
@ -447,6 +449,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
|
|||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
|
||||
const int delta = RNA_int_get(op->ptr, "delta");
|
||||
const float zoom_speed = RNA_float_get(op->ptr, "zoom_speed");
|
||||
const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
|
||||
|
||||
int zoom_xy_buf[2];
|
||||
|
@ -460,7 +463,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
|
|||
zoom_xy = zoom_xy_buf;
|
||||
}
|
||||
|
||||
view_zoom_apply_step(C, depsgraph, scene, area, region, delta, zoom_xy);
|
||||
view_zoom_apply_step(C, depsgraph, scene, area, region, delta, zoom_xy, zoom_speed);
|
||||
ED_view3d_camera_lock_undo_grouped_push(op->type->name, v3d, rv3d, C);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -482,6 +485,7 @@ static int viewzoom_invoke_impl(bContext *C,
|
|||
|
||||
prop = RNA_struct_find_property(ptr, "delta");
|
||||
const int delta = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : 0;
|
||||
const float zoom_speed = RNA_float_get(ptr, "zoom_speed");
|
||||
|
||||
if (delta) {
|
||||
const bool do_zoom_to_mouse_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0;
|
||||
|
@ -491,7 +495,8 @@ static int viewzoom_invoke_impl(bContext *C,
|
|||
vod->area,
|
||||
vod->region,
|
||||
delta,
|
||||
do_zoom_to_mouse_pos ? xy : nullptr);
|
||||
do_zoom_to_mouse_pos ? xy : nullptr,
|
||||
zoom_speed);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -546,8 +551,9 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
|
|||
ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY;
|
||||
|
||||
/* properties */
|
||||
view3d_operator_properties_common(
|
||||
ot, V3D_OP_PROP_DELTA | V3D_OP_PROP_MOUSE_CO | V3D_OP_PROP_USE_MOUSE_INIT);
|
||||
view3d_operator_properties_common(ot,
|
||||
V3D_OP_PROP_DELTA | V3D_OP_PROP_MOUSE_CO |
|
||||
V3D_OP_PROP_USE_MOUSE_INIT | V3D_OP_PROP_ZOOM_SPEED);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -223,6 +223,9 @@ void view3d_operatortypes()
|
|||
WM_operatortype_append(VIEW3D_OT_toggle_shading);
|
||||
WM_operatortype_append(VIEW3D_OT_toggle_xray);
|
||||
WM_operatortype_append(VIEW3D_OT_toggle_matcap_flip);
|
||||
WM_operatortype_append(VIEW3D_OT_toggle_auto_xray);
|
||||
WM_operatortype_append(VIEW3D_OT_toggle_select_through);
|
||||
WM_operatortype_append(VIEW3D_OT_toggle_facedots);
|
||||
|
||||
WM_operatortype_append(VIEW3D_OT_ruler_add);
|
||||
WM_operatortype_append(VIEW3D_OT_ruler_remove);
|
||||
|
|
|
@ -3963,7 +3963,7 @@ static bool do_lasso_select_mesh_uv_is_edge_inside(const ARegion *region,
|
|||
®ion->v2d, co_test_a, co_test_b, co_screen_a, co_screen_b) &&
|
||||
BLI_rcti_isect_segment(clip_rect, co_screen_a, co_screen_b) &&
|
||||
BLI_lasso_is_edge_inside(
|
||||
mcoords, mcoords_len, UNPACK2(co_screen_a), UNPACK2(co_screen_b), V2D_IS_CLIPPED))
|
||||
mcoords, mcoords_len, UNPACK2(co_screen_a), UNPACK2(co_screen_b), V2D_IS_CLIPPED, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -406,6 +406,25 @@
|
|||
/* Placement */ \
|
||||
.snap_mode_tools = SCE_SNAP_TO_GEOM,\
|
||||
.plane_axis = 2,\
|
||||
\
|
||||
/* X-Ray */ \
|
||||
.xray_button = true, \
|
||||
.auto_xray_object = true, \
|
||||
.auto_xray_edit = true, \
|
||||
.auto_xray_box = true, \
|
||||
.auto_xray_lasso = true, \
|
||||
.auto_xray_circle = true, \
|
||||
.select_through = true, \
|
||||
.select_through_object = true, \
|
||||
.select_through_box = true, \
|
||||
.select_through_lasso = true, \
|
||||
.select_through_circle = true, \
|
||||
\
|
||||
/* Viewport-Facing Select */ \
|
||||
.viewport_facing_select_mode = 1, \
|
||||
.viewport_facing_select_vert = 1, \
|
||||
.viewport_facing_select_edge = 1, \
|
||||
.viewport_facing_select_face = 1, \
|
||||
}
|
||||
|
||||
#define _DNA_DEFAULT_Sculpt \
|
||||
|
|
|
@ -1581,7 +1581,35 @@ typedef struct ToolSettings {
|
|||
char gpencil_v3d_align;
|
||||
/** General 2D Editor. */
|
||||
char gpencil_v2d_align;
|
||||
char _pad0[2];
|
||||
|
||||
/* Mesh Normal Direction Select */
|
||||
char viewport_facing_select;
|
||||
char viewport_facing_select_mode;
|
||||
char viewport_facing_select_vert;
|
||||
float viewport_facing_select_threshold;
|
||||
char viewport_facing_select_edge;
|
||||
char viewport_facing_select_face;
|
||||
|
||||
/* X-Ray Options */
|
||||
char xray_button;
|
||||
char auto_xray;
|
||||
char auto_xray_button;
|
||||
char auto_xray_reset;
|
||||
char auto_xray_object;
|
||||
char auto_xray_edit;
|
||||
char auto_xray_box;
|
||||
char auto_xray_lasso;
|
||||
char auto_xray_circle;
|
||||
char select_through;
|
||||
char select_through_button;
|
||||
char select_through_object;
|
||||
char select_through_edit;
|
||||
char select_through_box;
|
||||
char select_through_lasso;
|
||||
char select_through_circle;
|
||||
|
||||
/* Combine shading and xray header buttons */
|
||||
char shrink_shading_header;
|
||||
|
||||
/* Annotations. */
|
||||
/** Stroke placement settings - 3D View. */
|
||||
|
@ -2436,6 +2464,78 @@ typedef enum eSnapTransformMode {
|
|||
SCE_SNAP_TRANSFORM_MODE_SCALE = (1 << 2),
|
||||
} eSnapTransformMode;
|
||||
|
||||
/** #Viewport-facing select mode */
|
||||
enum {
|
||||
VIEWPORT_FACING_SELECT_BOTH = (1 << 0),
|
||||
VIEWPORT_FACING_SELECT_NEAR = (1 << 1),
|
||||
VIEWPORT_FACING_SELECT_XRAY = (1 << 2),
|
||||
};
|
||||
|
||||
/** #Viewport-facing select vert */
|
||||
enum {
|
||||
VIEWPORT_FACING_SELECT_FRONT_VERTS = (1 << 0),
|
||||
VIEWPORT_FACING_SELECT_FRONT_VERTS_FACE = (1 << 1),
|
||||
VIEWPORT_FACING_SELECT_REAR_VERTS = (1 << 2),
|
||||
VIEWPORT_FACING_SELECT_REAR_VERTS_FACE = (1 << 3),
|
||||
VIEWPORT_FACING_SELECT_ALL_VERTS = (1 << 4),
|
||||
};
|
||||
|
||||
/** #Viewport-facing select edge */
|
||||
enum {
|
||||
VIEWPORT_FACING_SELECT_FRONT_EDGES = (1 << 0),
|
||||
VIEWPORT_FACING_SELECT_FRONT_EDGES_FACE = (1 << 1),
|
||||
VIEWPORT_FACING_SELECT_REAR_EDGES = (1 << 2),
|
||||
VIEWPORT_FACING_SELECT_REAR_EDGES_FACE = (1 << 3),
|
||||
VIEWPORT_FACING_SELECT_ALL_EDGES = (1 << 4),
|
||||
};
|
||||
|
||||
/** #Viewport-facing select face */
|
||||
enum {
|
||||
VIEWPORT_FACING_SELECT_FRONT_FACES = (1 << 0),
|
||||
VIEWPORT_FACING_SELECT_FRONT_FACES_VERT = (1 << 1),
|
||||
VIEWPORT_FACING_SELECT_REAR_FACES = (1 << 2),
|
||||
VIEWPORT_FACING_SELECT_REAR_FACES_VERT = (1 << 3),
|
||||
VIEWPORT_FACING_SELECT_ALL_FACES = (1 << 4),
|
||||
};
|
||||
|
||||
/** #Object select style */
|
||||
enum {
|
||||
OBJECT_TOUCH = (1 << 0),
|
||||
OBJECT_ENCLOSE = (1 << 1),
|
||||
OBJECT_ORIGIN = (1 << 2),
|
||||
};
|
||||
|
||||
/** #Face select style */
|
||||
enum {
|
||||
FACE_DEFAULT = (1 << 0),
|
||||
FACE_TOUCH = (1 << 1),
|
||||
FACE_ENCLOSE = (1 << 2),
|
||||
FACE_CENTER = (1 << 3),
|
||||
};
|
||||
|
||||
/** #Edge select style */
|
||||
enum {
|
||||
EDGE_DEFAULT = (1 << 0),
|
||||
EDGE_TOUCH = (1 << 1),
|
||||
EDGE_ENCLOSE = (1 << 2),
|
||||
};
|
||||
|
||||
/** #Auto X-Ray mode */
|
||||
enum {
|
||||
AUTO_XRAY_DISABLE = (1 << 0),
|
||||
AUTO_XRAY_OBJECT = (1 << 1),
|
||||
AUTO_XRAY_EDIT = (1 << 2),
|
||||
AUTO_XRAY_BOTH = (1 << 3),
|
||||
};
|
||||
|
||||
/** #Select through mode */
|
||||
enum {
|
||||
SELECT_THROUGH_DISABLE = (1 << 0),
|
||||
SELECT_THROUGH_OBJECT = (1 << 1),
|
||||
SELECT_THROUGH_EDIT = (1 << 2),
|
||||
SELECT_THROUGH_BOTH = (1 << 3),
|
||||
};
|
||||
|
||||
/** #ToolSettings::selectmode */
|
||||
enum {
|
||||
SCE_SELECT_VERTEX = 1 << 0, /* for mesh */
|
||||
|
|
|
@ -877,7 +877,9 @@ typedef struct UserDef {
|
|||
char gizmo_size;
|
||||
/** Navigate gizmo size. */
|
||||
char gizmo_size_navigate_v3d;
|
||||
char _pad3[5];
|
||||
/** Header highlight */
|
||||
char header_highlight;
|
||||
char _pad3[4];
|
||||
short edit_studio_light;
|
||||
short lookdev_sphere_size;
|
||||
short vbotimeout, vbocollectrate;
|
||||
|
@ -920,7 +922,10 @@ typedef struct UserDef {
|
|||
/** Number of samples for FPS display calculations. */
|
||||
short playback_fps_samples;
|
||||
|
||||
char _pad7[2];
|
||||
/** Keymap click-drag direction style. */
|
||||
char click_drag_direction;
|
||||
|
||||
char _pad7[1];
|
||||
|
||||
/** Private, defaults to 20 for 72 DPI setting. */
|
||||
short widget_unit;
|
||||
|
@ -980,6 +985,22 @@ typedef struct UserDef {
|
|||
char drag_threshold;
|
||||
char move_threshold;
|
||||
|
||||
/** Adjustable selection radius. */
|
||||
float selection_radius;
|
||||
char adjustable_click_select;
|
||||
char select_unbiased;
|
||||
|
||||
/** Mouse cursor styles. **/
|
||||
char system_cursor;
|
||||
char edit_cursor;
|
||||
char paint_cursor;
|
||||
char dot_cursor;
|
||||
char knife_cursor;
|
||||
char pencil_cursor;
|
||||
char eraser_cursor;
|
||||
char eyedropper_cursor;
|
||||
char _pad9[2];
|
||||
|
||||
char font_path_ui[1024];
|
||||
char font_path_ui_mono[1024];
|
||||
|
||||
|
@ -1084,8 +1105,8 @@ typedef enum eUserPref_Flag {
|
|||
USER_AUTOSAVE = (1 << 0),
|
||||
USER_FLAG_NUMINPUT_ADVANCED = (1 << 1),
|
||||
USER_FLAG_RECENT_SEARCHES_DISABLE = (1 << 2),
|
||||
USER_FLAG_UNUSED_3 = (1 << 3), /* cleared */
|
||||
USER_FLAG_UNUSED_4 = (1 << 4), /* cleared */
|
||||
USER_ADJUSTABLE_CLICK_SELECT = (1 << 3),
|
||||
USER_SELECT_UNBIASED = (1 << 4),
|
||||
USER_TRACKBALL = (1 << 5),
|
||||
USER_FLAG_UNUSED_6 = (1 << 6), /* cleared */
|
||||
USER_FLAG_UNUSED_7 = (1 << 7), /* cleared */
|
||||
|
@ -1235,6 +1256,129 @@ typedef enum eUserpref_TableAPI {
|
|||
USER_TABLET_WINTAB = 2,
|
||||
} eUserpref_TabletAPI;
|
||||
|
||||
/** #UserDef.click_drag_direction_types */
|
||||
typedef enum eUserpref_Click_Drag_Direction {
|
||||
USER_CLICK_DRAG_DIRECTION_EIGHT_WAY = 0,
|
||||
USER_CLICK_DRAG_DIRECTION_LEFT_RIGHT = 1,
|
||||
USER_CLICK_DRAG_DIRECTION_UP_DOWN = 2,
|
||||
} eUserpref_Click_Drag_Direction;
|
||||
|
||||
/** #UserDef.system_cursor_types */
|
||||
typedef enum eUserpref_System_Cursor_Types {
|
||||
USER_SYSTEM_CURSOR_SYSTEM = 0,
|
||||
USER_SYSTEM_CURSOR_CROSS = 1,
|
||||
USER_SYSTEM_CURSOR_POINTER = 2,
|
||||
USER_SYSTEM_CURSOR_CROSS_OPEN = 3,
|
||||
USER_SYSTEM_CURSOR_CROSS_DOT = 4,
|
||||
USER_SYSTEM_CURSOR_CROSS_MIN = 5,
|
||||
USER_SYSTEM_CURSOR_BOX = 6,
|
||||
USER_SYSTEM_CURSOR_BOX_DOT = 7,
|
||||
USER_SYSTEM_CURSOR_BOX_POINTER = 8,
|
||||
USER_SYSTEM_CURSOR_DOT = 9,
|
||||
} eUserpref_System_Cursor_Types;
|
||||
|
||||
/** #UserDef.edit_cursor_types */
|
||||
typedef enum eUserpref_Edit_Cursor_Types {
|
||||
USER_EDIT_CURSOR_CROSS = 0,
|
||||
USER_EDIT_CURSOR_SYSTEM = 1,
|
||||
USER_EDIT_CURSOR_POINTER = 2,
|
||||
USER_EDIT_CURSOR_CROSS_OPEN = 3,
|
||||
USER_EDIT_CURSOR_CROSS_DOT = 4,
|
||||
USER_EDIT_CURSOR_CROSS_MIN = 5,
|
||||
USER_EDIT_CURSOR_BOX = 6,
|
||||
USER_EDIT_CURSOR_BOX_DOT = 7,
|
||||
USER_EDIT_CURSOR_BOX_POINTER = 8,
|
||||
USER_EDIT_CURSOR_DOT = 9,
|
||||
} eUserpref_Edit_Cursor_Types;
|
||||
|
||||
/** #UserDef.paint_cursor_types */
|
||||
typedef enum eUserpref_Paint_Cursor_Types {
|
||||
USER_PAINT_CURSOR_CROSS_DOT = 0,
|
||||
USER_PAINT_CURSOR_CROSS = 1,
|
||||
USER_PAINT_CURSOR_SYSTEM = 2,
|
||||
USER_PAINT_CURSOR_POINTER = 3,
|
||||
USER_PAINT_CURSOR_CROSS_OPEN = 4,
|
||||
USER_PAINT_CURSOR_CROSS_MIN = 5,
|
||||
USER_PAINT_CURSOR_BOX = 6,
|
||||
USER_PAINT_CURSOR_BOX_DOT = 7,
|
||||
USER_PAINT_CURSOR_BOX_POINTER = 8,
|
||||
USER_PAINT_CURSOR_DOT = 9,
|
||||
} eUserpref_Paint_Cursor_Types;
|
||||
|
||||
/** #UserDef.dot_cursor_types */
|
||||
typedef enum eUserpref_Dot_Cursor_Types {
|
||||
USER_DOT_CURSOR_DOT = 0,
|
||||
USER_DOT_CURSOR_CROSS = 1,
|
||||
USER_DOT_CURSOR_SYSTEM = 2,
|
||||
USER_DOT_CURSOR_POINTER = 3,
|
||||
USER_DOT_CURSOR_CROSS_OPEN = 4,
|
||||
USER_DOT_CURSOR_CROSS_DOT = 5,
|
||||
USER_DOT_CURSOR_CROSS_MIN = 6,
|
||||
USER_DOT_CURSOR_BOX = 7,
|
||||
USER_DOT_CURSOR_BOX_DOT = 8,
|
||||
USER_DOT_CURSOR_BOX_POINTER = 9,
|
||||
} eUserpref_Dot_Cursor_Types;
|
||||
|
||||
/** #UserDef.knife_cursor_types */
|
||||
typedef enum eUserpref_Knife_Cursor_Types {
|
||||
USER_KNIFE_CURSOR_KNIFE = 0,
|
||||
USER_KNIFE_CURSOR_CROSS = 1,
|
||||
USER_KNIFE_CURSOR_SYSTEM = 2,
|
||||
USER_KNIFE_CURSOR_POINTER = 3,
|
||||
USER_KNIFE_CURSOR_CROSS_OPEN = 4,
|
||||
USER_KNIFE_CURSOR_CROSS_DOT = 5,
|
||||
USER_KNIFE_CURSOR_CROSS_MIN = 6,
|
||||
USER_KNIFE_CURSOR_BOX = 7,
|
||||
USER_KNIFE_CURSOR_BOX_DOT = 8,
|
||||
USER_KNIFE_CURSOR_BOX_POINTER = 9,
|
||||
USER_KNIFE_CURSOR_DOT = 10,
|
||||
} eUserpref_Knife_Cursor_Types;
|
||||
|
||||
/** #UserDef.pencil_cursor_types */
|
||||
typedef enum eUserpref_Pencil_Cursor_Types {
|
||||
USER_PENCIL_CURSOR_PENCIL = 0,
|
||||
USER_PENCIL_CURSOR_CROSS = 1,
|
||||
USER_PENCIL_CURSOR_SYSTEM = 2,
|
||||
USER_PENCIL_CURSOR_POINTER = 3,
|
||||
USER_PENCIL_CURSOR_CROSS_OPEN = 4,
|
||||
USER_PENCIL_CURSOR_CROSS_DOT = 5,
|
||||
USER_PENCIL_CURSOR_CROSS_MIN = 6,
|
||||
USER_PENCIL_CURSOR_BOX = 7,
|
||||
USER_PENCIL_CURSOR_BOX_DOT = 8,
|
||||
USER_PENCIL_CURSOR_BOX_POINTER = 9,
|
||||
USER_PENCIL_CURSOR_DOT = 10,
|
||||
} eUserpref_Pencil_Cursor_Types;
|
||||
|
||||
/** #UserDef.eraser_cursor_types */
|
||||
typedef enum eUserpref_Eraser_Cursor_Types {
|
||||
USER_ERASER_CURSOR_ERASER = 0,
|
||||
USER_ERASER_CURSOR_CROSS = 1,
|
||||
USER_ERASER_CURSOR_SYSTEM = 2,
|
||||
USER_ERASER_CURSOR_POINTER = 3,
|
||||
USER_ERASER_CURSOR_CROSS_OPEN = 4,
|
||||
USER_ERASER_CURSOR_CROSS_DOT = 5,
|
||||
USER_ERASER_CURSOR_CROSS_MIN = 6,
|
||||
USER_ERASER_CURSOR_BOX = 7,
|
||||
USER_ERASER_CURSOR_BOX_DOT = 8,
|
||||
USER_ERASER_CURSOR_BOX_POINTER = 9,
|
||||
USER_ERASER_CURSOR_DOT = 10,
|
||||
} eUserpref_Eraser_Cursor_Types;
|
||||
|
||||
/** #UserDef.eyedropper_cursor_types */
|
||||
typedef enum eUserpref_Eyedropper_Cursor_Types {
|
||||
USER_EYEDROPPER_CURSOR_EYEDROPPER = 0,
|
||||
USER_EYEDROPPER_CURSOR_CROSS = 1,
|
||||
USER_EYEDROPPER_CURSOR_SYSTEM = 2,
|
||||
USER_EYEDROPPER_CURSOR_POINTER = 3,
|
||||
USER_EYEDROPPER_CURSOR_CROSS_OPEN = 4,
|
||||
USER_EYEDROPPER_CURSOR_CROSS_DOT = 5,
|
||||
USER_EYEDROPPER_CURSOR_CROSS_MIN = 6,
|
||||
USER_EYEDROPPER_CURSOR_BOX = 7,
|
||||
USER_EYEDROPPER_CURSOR_BOX_DOT = 8,
|
||||
USER_EYEDROPPER_CURSOR_BOX_POINTER = 9,
|
||||
USER_EYEDROPPER_CURSOR_DOT = 10,
|
||||
} eUserpref_Eyedropper_Cursor_Types;
|
||||
|
||||
/** #UserDef.app_flag */
|
||||
typedef enum eUserpref_APP_Flag {
|
||||
USER_APP_LOCK_CORNER_SPLIT = (1 << 0),
|
||||
|
|
|
@ -611,6 +611,7 @@ enum {
|
|||
|
||||
V3D_OVERLAY_EDIT_CU_NORMALS = (1 << 21),
|
||||
V3D_OVERLAY_EDIT_CONSTANT_SCREEN_SIZE_NORMALS = (1 << 22),
|
||||
V3D_OVERLAY_EDIT_FACE_DOT_XRAY = (1 << 23),
|
||||
};
|
||||
|
||||
/** #View3DOverlay.paint_flag */
|
||||
|
|
|
@ -3107,10 +3107,149 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem viewport_facing_select_mode_items[] = {
|
||||
{VIEWPORT_FACING_SELECT_BOTH,
|
||||
"BOTH",
|
||||
0,
|
||||
"Near and X-Ray",
|
||||
"Use viewport-facing selection in near select and X-Ray"},
|
||||
{VIEWPORT_FACING_SELECT_NEAR,
|
||||
"NEAR",
|
||||
0,
|
||||
"Near",
|
||||
"Use viewport-facing selection in near select"},
|
||||
{VIEWPORT_FACING_SELECT_XRAY, "XRAY", 0, "X-Ray", "Use viewport-facing selection in X-Ray"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem viewport_facing_select_vert_items[] = {
|
||||
{VIEWPORT_FACING_SELECT_FRONT_VERTS,
|
||||
"FRONT_VERTS",
|
||||
0,
|
||||
"Front Verts",
|
||||
"Select vertices with viewport-facing normals"},
|
||||
{VIEWPORT_FACING_SELECT_FRONT_VERTS_FACE,
|
||||
"FRONT_VERTS_FACE",
|
||||
0,
|
||||
"Verts of Front Face",
|
||||
"Select vertices if they are part of a face that has a viewport-facing normal"},
|
||||
{VIEWPORT_FACING_SELECT_REAR_VERTS,
|
||||
"REAR_VERTS",
|
||||
0,
|
||||
"Rear Verts",
|
||||
"Select vertices without viewport-facing normals"},
|
||||
{VIEWPORT_FACING_SELECT_REAR_VERTS_FACE,
|
||||
"REAR_VERTS_FACE",
|
||||
0,
|
||||
"Verts of Rear Face",
|
||||
"Select vertices if they are part of a face that does not have a viewport-facing normal"},
|
||||
{VIEWPORT_FACING_SELECT_ALL_VERTS,
|
||||
"ALL_VERTS",
|
||||
0,
|
||||
"All Verts",
|
||||
"Select vertices regarless of their normal direction"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem viewport_facing_select_edge_items[] = {
|
||||
{VIEWPORT_FACING_SELECT_FRONT_EDGES,
|
||||
"FRONT_EDGES",
|
||||
0,
|
||||
"Front Edges",
|
||||
"Select edges with viewport-facing normals"},
|
||||
{VIEWPORT_FACING_SELECT_FRONT_EDGES_FACE,
|
||||
"FRONT_EDGES_FACE",
|
||||
0,
|
||||
"Edges of Front Face",
|
||||
"Select edges if they are part of a face that has a viewport-facing normal"},
|
||||
{VIEWPORT_FACING_SELECT_REAR_EDGES,
|
||||
"REAR_EDGES",
|
||||
0,
|
||||
"Rear Edges",
|
||||
"Select edges without viewport-facing normals"},
|
||||
{VIEWPORT_FACING_SELECT_REAR_EDGES_FACE,
|
||||
"REAR_EDGES_FACE",
|
||||
0,
|
||||
"Edges of Rear Face",
|
||||
"Select edges if they are part of a face that does not have a viewport-facing normal"},
|
||||
{VIEWPORT_FACING_SELECT_ALL_EDGES,
|
||||
"ALL_EDGES",
|
||||
0,
|
||||
"All Edges",
|
||||
"Select edges regarless of their normal direction"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem viewport_facing_select_face_items[] = {
|
||||
{VIEWPORT_FACING_SELECT_FRONT_FACES,
|
||||
"FRONT_FACES",
|
||||
0,
|
||||
"Front Faces",
|
||||
"Select faces with viewport-facing normals"},
|
||||
{VIEWPORT_FACING_SELECT_FRONT_FACES_VERT,
|
||||
"FRONT_FACES_VERT",
|
||||
0,
|
||||
"Faces of Front Vert",
|
||||
"Select faces if they have a vertex with a viewport-facing normal"},
|
||||
{VIEWPORT_FACING_SELECT_REAR_FACES,
|
||||
"REAR_FACES",
|
||||
0,
|
||||
"Rear Faces",
|
||||
"Select faces without viewport-facing normals"},
|
||||
{VIEWPORT_FACING_SELECT_REAR_FACES_VERT,
|
||||
"REAR_FACES_VERT",
|
||||
0,
|
||||
"Faces of Rear Vert",
|
||||
"Select faces if they have a vertex without a viewport-facing normal"},
|
||||
{VIEWPORT_FACING_SELECT_ALL_FACES,
|
||||
"ALL_FACES",
|
||||
0,
|
||||
"All Faces",
|
||||
"Select faces regarless of their normal direction"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
srna = RNA_def_struct(brna, "ToolSettings", nullptr);
|
||||
RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
|
||||
RNA_def_struct_ui_text(srna, "Tool Settings", "");
|
||||
|
||||
/* Viewport-Facing Select */
|
||||
prop = RNA_def_property(srna, "viewport_facing_select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "viewport_facing_select", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Viewport Facing Select",
|
||||
"Filter box, lasso, and circle selection of mesh elements based on the direction of their "
|
||||
"normals compared to the viewport");
|
||||
|
||||
prop = RNA_def_property(srna, "viewport_facing_select_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "viewport_facing_select_mode");
|
||||
RNA_def_property_enum_items(prop, viewport_facing_select_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", "Which selection modes to use viewport-facing selection");
|
||||
|
||||
prop = RNA_def_property(srna, "viewport_facing_select_vert", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "viewport_facing_select_vert");
|
||||
RNA_def_property_enum_items(prop, viewport_facing_select_vert_items);
|
||||
RNA_def_property_ui_text(prop, "Vert", "Direction and mode for vertices");
|
||||
|
||||
prop = RNA_def_property(srna, "viewport_facing_select_edge", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "viewport_facing_select_edge");
|
||||
RNA_def_property_enum_items(prop, viewport_facing_select_edge_items);
|
||||
RNA_def_property_ui_text(prop, "Edge", "Direction and mode for edges");
|
||||
|
||||
prop = RNA_def_property(srna, "viewport_facing_select_face", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "viewport_facing_select_face");
|
||||
RNA_def_property_enum_items(prop, viewport_facing_select_face_items);
|
||||
RNA_def_property_ui_text(prop, "Face", "Direction and mode for faces");
|
||||
|
||||
prop = RNA_def_property(srna, "viewport_facing_select_threshold", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, -0.999999, 0.999999);
|
||||
RNA_def_property_ui_range(prop, -0.999999, 0.999999, 1.0, 6);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Threshold",
|
||||
"How close the angles of the viewport and mesh element need to be for selection to occur");
|
||||
|
||||
prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Sculpt");
|
||||
RNA_def_property_ui_text(prop, "Sculpt", "");
|
||||
|
@ -3853,6 +3992,103 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
|
||||
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, 3);
|
||||
|
||||
/* Shrink Shading Header */
|
||||
prop = RNA_def_property(srna, "shrink_shading_header", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "shrink_shading_header", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Shrink Header",
|
||||
"Combine the four Shading Header buttons into one button that also toggles X-Ray");
|
||||
|
||||
/* X-Ray header button */
|
||||
prop = RNA_def_property(srna, "xray_button", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "xray_button", 0);
|
||||
RNA_def_property_ui_text(prop, "X-Ray", "Show button for X-Ray in viewport header");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
/* Auto X-Ray */
|
||||
prop = RNA_def_property(srna, "auto_xray", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray", 0);
|
||||
RNA_def_property_ui_text(prop, "Enable", "Transparent scene display during drag select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_button", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_button", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Auto X-Ray", "Show button for automatic X-Ray in viewport header");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_reset", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_reset", 0);
|
||||
RNA_def_property_ui_text(prop, "Auto X-Ray Reset", "Helper that turns xray off for autoxray");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_object", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_object", 0);
|
||||
RNA_def_property_ui_text(prop, "Object", "Automatic X-Ray in object mode");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_edit", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_edit", 0);
|
||||
RNA_def_property_ui_text(prop, "Edit", "Automatic X-Ray in edit mode");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_box", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_box", 0);
|
||||
RNA_def_property_ui_text(prop, "Box", "Transparent scene display during box select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_lasso", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_lasso", 0);
|
||||
RNA_def_property_ui_text(prop, "Lasso", "Transparent scene display during lasso select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "auto_xray_circle", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "auto_xray_circle", 0);
|
||||
RNA_def_property_ui_text(prop, "Circle", "Transparent scene display during circle select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
/* Select Through */
|
||||
prop = RNA_def_property(srna, "select_through", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Enable", "Select occluded objects and mesh elements with drag select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "select_through_button", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through_button", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Select Through", "Show button for select through in viewport header");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "select_through_object", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through_object", 0);
|
||||
RNA_def_property_ui_text(prop, "Object", "Select through in object mode");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "select_through_edit", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through_edit", 0);
|
||||
RNA_def_property_ui_text(prop, "Edit", "Select through in edit mode");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "select_through_box", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through_box", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Box", "Select occluded objects and mesh elements with box select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "select_through_lasso", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through_lasso", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Lasso", "Select occluded objects and mesh elements with lasso select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "select_through_circle", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "select_through_circle", 0);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Circle", "Select occluded objects and mesh elements with circle select");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
/* Unified Paint Settings */
|
||||
prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
|
|
|
@ -4620,6 +4620,16 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
|
|||
"Display face center when face selection is enabled in solid shading modes");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "show_face_center_xray", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_DOT_XRAY);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Display Face Center X-Ray",
|
||||
"Display face center when face selection is enabled in X-Ray shading modes");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "overlay.edit_flag", V3D_OVERLAY_EDIT_CREASES);
|
||||
RNA_def_property_ui_text(
|
||||
|
|
|
@ -5311,6 +5311,122 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
|
|||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem system_cursor_items[] = {
|
||||
{USER_SYSTEM_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_SYSTEM_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_SYSTEM_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_SYSTEM_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_SYSTEM_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_SYSTEM_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_SYSTEM_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_SYSTEM_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_SYSTEM_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_SYSTEM_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem edit_cursor_items[] = {
|
||||
{USER_EDIT_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_EDIT_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_EDIT_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_EDIT_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_EDIT_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_EDIT_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_EDIT_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_EDIT_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_EDIT_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_EDIT_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem paint_cursor_items[] = {
|
||||
{USER_PAINT_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_PAINT_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_PAINT_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_PAINT_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_PAINT_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_PAINT_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_PAINT_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_PAINT_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_PAINT_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_PAINT_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem dot_cursor_items[] = {
|
||||
{USER_DOT_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{USER_DOT_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_DOT_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_DOT_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_DOT_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_DOT_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_DOT_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_DOT_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_DOT_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_DOT_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem knife_cursor_items[] = {
|
||||
{USER_KNIFE_CURSOR_KNIFE, "KNIFE", 0, "Knife", ""},
|
||||
{USER_KNIFE_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_KNIFE_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_KNIFE_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_KNIFE_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_KNIFE_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_KNIFE_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_KNIFE_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_KNIFE_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_KNIFE_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_KNIFE_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem eyedropper_cursor_items[] = {
|
||||
{USER_EYEDROPPER_CURSOR_EYEDROPPER, "EYEDROPPER", 0, "Eyedropper", ""},
|
||||
{USER_EYEDROPPER_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_EYEDROPPER_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_EYEDROPPER_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_EYEDROPPER_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_EYEDROPPER_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_EYEDROPPER_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_EYEDROPPER_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_EYEDROPPER_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_EYEDROPPER_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_EYEDROPPER_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem eraser_cursor_items[] = {
|
||||
{USER_ERASER_CURSOR_ERASER, "ERASER", 0, "Eraser", ""},
|
||||
{USER_ERASER_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_ERASER_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_ERASER_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_ERASER_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_ERASER_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_ERASER_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_ERASER_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_ERASER_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_ERASER_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_ERASER_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem pencil_cursor_items[] = {
|
||||
{USER_PENCIL_CURSOR_PENCIL, "PENCIL", 0, "Pencil", ""},
|
||||
{USER_PENCIL_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
|
||||
{USER_PENCIL_CURSOR_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_PENCIL_CURSOR_POINTER, "POINTER", 0, "Pointer", ""},
|
||||
{USER_PENCIL_CURSOR_CROSS_OPEN, "CROSS_OPEN", 0, "Cross Open", ""},
|
||||
{USER_PENCIL_CURSOR_CROSS_DOT, "CROSS_DOT", 0, "Cross Dot", ""},
|
||||
{USER_PENCIL_CURSOR_CROSS_MIN, "CROSS_MIN", 0, "Cross Minimal", ""},
|
||||
{USER_PENCIL_CURSOR_BOX, "BOX", 0, "Box", ""},
|
||||
{USER_PENCIL_CURSOR_BOX_DOT, "BOX_DOT", 0, "Box Dot", ""},
|
||||
{USER_PENCIL_CURSOR_BOX_POINTER, "BOX_POINTER", 0, "Box Pointer", ""},
|
||||
{USER_PENCIL_CURSOR_DOT, "DOT", 0, "Dot", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
srna = RNA_def_struct(brna, "PreferencesEdit", nullptr);
|
||||
RNA_def_struct_sdna(srna, "UserDef");
|
||||
RNA_def_struct_nested(brna, srna, "Preferences");
|
||||
|
@ -5669,6 +5785,60 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
|
|||
RNA_def_property_boolean_sdna(prop, nullptr, "uiflag", USER_DEPTH_CURSOR);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Cursor Surface Project", "Use the surface depth for cursor placement");
|
||||
|
||||
prop = RNA_def_property(srna, "adjustable_click_select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", USER_ADJUSTABLE_CLICK_SELECT);
|
||||
RNA_def_property_ui_text(prop, "Enable", "Use additional options for single-click select");
|
||||
|
||||
prop = RNA_def_property(srna, "select_unbiased", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", USER_SELECT_UNBIASED);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Select Unbiased", "Click-select will not favor unselected mesh elements");
|
||||
|
||||
prop = RNA_def_property(srna, "selection_radius", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_range(prop, 0.1f, 150.0f);
|
||||
RNA_def_property_ui_range(prop, 0.1f, 150.0f, 0.01f, 2);
|
||||
RNA_def_property_ui_text(prop, "Radius", "Size of single-click selection radius");
|
||||
|
||||
prop = RNA_def_property(srna, "system_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, system_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "system_cursor");
|
||||
RNA_def_property_ui_text(prop, "System Cursor", "System mode cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "edit_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, edit_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "edit_cursor");
|
||||
RNA_def_property_ui_text(prop, "Edit Cursor", "Edit mode cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "paint_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, paint_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "paint_cursor");
|
||||
RNA_def_property_ui_text(prop, "Paint Cursor", "Paint mode cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "dot_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, dot_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "dot_cursor");
|
||||
RNA_def_property_ui_text(prop, "2D Cursor", "2D mode cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "knife_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, knife_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "knife_cursor");
|
||||
RNA_def_property_ui_text(prop, "Knife Cursor", "Knife cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "eyedropper_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, eyedropper_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "eyedropper_cursor");
|
||||
RNA_def_property_ui_text(prop, "Eyedropper Cursor", "Eyedropper cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "eraser_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, eraser_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "eraser_cursor");
|
||||
RNA_def_property_ui_text(prop, "Eraser Cursor", "Eraser cursor style");
|
||||
|
||||
prop = RNA_def_property(srna, "pencil_cursor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, pencil_cursor_items);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "pencil_cursor");
|
||||
RNA_def_property_ui_text(prop, "Pencil Cursor", "Pencil cursor style");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_system(BlenderRNA *brna)
|
||||
|
@ -6139,6 +6309,17 @@ static void rna_def_userdef_input(BlenderRNA *brna)
|
|||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem click_drag_direction_types[] = {
|
||||
{USER_CLICK_DRAG_DIRECTION_EIGHT_WAY,
|
||||
"EIGHT_WAY",
|
||||
0,
|
||||
"Eight",
|
||||
"Eight directions (N, NE, E, SE, S, SW, W, NW)"},
|
||||
{USER_CLICK_DRAG_DIRECTION_LEFT_RIGHT, "LEFT_RIGHT", 0, "Left Right", "Left and right"},
|
||||
{USER_CLICK_DRAG_DIRECTION_UP_DOWN, "UP_DOWN", 0, "Up Down", "Up and down"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem view_zoom_styles[] = {
|
||||
{USER_ZOOM_CONTINUE,
|
||||
"CONTINUE",
|
||||
|
@ -6245,6 +6426,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
|
|||
"Release Confirms",
|
||||
"Moving things with a mouse drag confirms when releasing the button");
|
||||
|
||||
prop = RNA_def_property(srna, "click_drag_direction", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, click_drag_direction_types);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Keymap Drag Directions", "Style of click-drag direction the keymap will use");
|
||||
|
||||
prop = RNA_def_property(srna, "use_numeric_input_advanced", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", USER_FLAG_NUMINPUT_ADVANCED);
|
||||
RNA_def_property_ui_text(prop,
|
||||
|
@ -6309,6 +6495,12 @@ static void rna_def_userdef_input(BlenderRNA *brna)
|
|||
"Number of pixels to before the cursor is considered to have moved "
|
||||
"(used for cycling selected items on successive clicks)");
|
||||
|
||||
prop = RNA_def_property(srna, "header_highlight", PROP_INT, PROP_FACTOR);
|
||||
RNA_def_property_range(prop, 0, 10);
|
||||
RNA_def_property_ui_range(prop, 0, 10, 1, -1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Header Highlight", "How much brighter the header of the active window is");
|
||||
|
||||
/* tablet pressure curve */
|
||||
prop = RNA_def_property(srna, "pressure_threshold_max", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
|
|
|
@ -396,6 +396,41 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA
|
|||
RNA_POINTER_INVALIDATE(kmi_ptr);
|
||||
}
|
||||
|
||||
static void rna_keymap_set_direction_any(wmKeyMap *km, PointerRNA *kmi_ptr)
|
||||
{
|
||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
|
||||
kmi->direction = -1;
|
||||
WM_keyconfig_update_tag(km, kmi);
|
||||
}
|
||||
|
||||
static void rna_keymap_set_direction_left(wmKeyMap *km, PointerRNA *kmi_ptr)
|
||||
{
|
||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
|
||||
kmi->direction = 7;
|
||||
WM_keyconfig_update_tag(km, kmi);
|
||||
}
|
||||
|
||||
static void rna_keymap_set_direction_right(wmKeyMap *km, PointerRNA *kmi_ptr)
|
||||
{
|
||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
|
||||
kmi->direction = 3;
|
||||
WM_keyconfig_update_tag(km, kmi);
|
||||
}
|
||||
|
||||
static void rna_keymap_set_direction_up(wmKeyMap *km, PointerRNA *kmi_ptr)
|
||||
{
|
||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
|
||||
kmi->direction = 1;
|
||||
WM_keyconfig_update_tag(km, kmi);
|
||||
}
|
||||
|
||||
static void rna_keymap_set_direction_down(wmKeyMap *km, PointerRNA *kmi_ptr)
|
||||
{
|
||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
|
||||
kmi->direction = 5;
|
||||
WM_keyconfig_update_tag(km, kmi);
|
||||
}
|
||||
|
||||
static PointerRNA rna_KeyMap_item_find_from_operator(ID *id,
|
||||
wmKeyMap *km,
|
||||
const char *idname,
|
||||
|
@ -1217,6 +1252,31 @@ void RNA_api_keymapitems(StructRNA *srna)
|
|||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||
|
||||
func = RNA_def_function(srna, "set_direction_any", "rna_keymap_set_direction_any");
|
||||
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||
|
||||
func = RNA_def_function(srna, "set_direction_left", "rna_keymap_set_direction_left");
|
||||
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||
|
||||
func = RNA_def_function(srna, "set_direction_right", "rna_keymap_set_direction_right");
|
||||
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||
|
||||
func = RNA_def_function(srna, "set_direction_up", "rna_keymap_set_direction_up");
|
||||
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||
|
||||
func = RNA_def_function(srna, "set_direction_down", "rna_keymap_set_direction_down");
|
||||
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||
|
||||
func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
|
||||
parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
|
||||
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||
|
|
|
@ -744,6 +744,7 @@ int WM_operator_call_notest(bContext *C, wmOperator *op);
|
|||
* Execute this operator again, put here so it can share above code
|
||||
*/
|
||||
int WM_operator_repeat(bContext *C, wmOperator *op);
|
||||
int WM_operator_invoke_last(bContext *C, wmOperator *op);
|
||||
int WM_operator_repeat_last(bContext *C, wmOperator *op);
|
||||
/**
|
||||
* \return true if #WM_operator_repeat can run.
|
||||
|
|
|
@ -44,14 +44,80 @@ static BCursor *BlenderCursor[WM_CURSOR_NUM] = {nullptr};
|
|||
/* Blender cursor to GHOST standard cursor conversion. */
|
||||
static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
|
||||
{
|
||||
const int system_style = U.system_cursor;
|
||||
const int edit_style = U.edit_cursor;
|
||||
const int paint_style = U.paint_cursor;
|
||||
const int dot_style = U.dot_cursor;
|
||||
const int knife_style = U.knife_cursor;
|
||||
const int pencil_style = U.pencil_cursor;
|
||||
const int eraser_style = U.eraser_cursor;
|
||||
const int eyedropper_style = U.eyedropper_cursor;
|
||||
switch (curs) {
|
||||
case WM_CURSOR_DEFAULT:
|
||||
return GHOST_kStandardCursorDefault;
|
||||
if (system_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (system_style == 2) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (system_style == 3) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (system_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (system_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (system_style == 6) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (system_style == 7) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (system_style == 8) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (system_style == 9) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
case WM_CURSOR_WAIT:
|
||||
return GHOST_kStandardCursorWait;
|
||||
case WM_CURSOR_EDIT:
|
||||
case WM_CURSOR_CROSS:
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
if (edit_style == 1) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (edit_style == 2) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (edit_style == 3) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (edit_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (edit_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (edit_style == 6) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (edit_style == 7) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (edit_style == 8) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (edit_style == 9) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
case WM_CURSOR_X_MOVE:
|
||||
return GHOST_kStandardCursorLeftRight;
|
||||
case WM_CURSOR_Y_MOVE:
|
||||
|
@ -67,7 +133,39 @@ static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
|
|||
case WM_CURSOR_STOP:
|
||||
return GHOST_kStandardCursorStop;
|
||||
case WM_CURSOR_KNIFE:
|
||||
return GHOST_kStandardCursorKnife;
|
||||
if (knife_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (knife_style == 2) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (knife_style == 3) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (knife_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (knife_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (knife_style == 6) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (knife_style == 7) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (knife_style == 8) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (knife_style == 9) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (knife_style == 10) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorKnife;
|
||||
}
|
||||
case WM_CURSOR_NSEW_SCROLL:
|
||||
return GHOST_kStandardCursorNSEWScroll;
|
||||
case WM_CURSOR_NS_SCROLL:
|
||||
|
@ -75,19 +173,141 @@ static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
|
|||
case WM_CURSOR_EW_SCROLL:
|
||||
return GHOST_kStandardCursorEWScroll;
|
||||
case WM_CURSOR_EYEDROPPER:
|
||||
return GHOST_kStandardCursorEyedropper;
|
||||
if (eyedropper_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (eyedropper_style == 2) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (eyedropper_style == 3) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (eyedropper_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (eyedropper_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (eyedropper_style == 6) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (eyedropper_style == 7) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (eyedropper_style == 8) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (eyedropper_style == 9) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (eyedropper_style == 10) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorEyedropper;
|
||||
}
|
||||
case WM_CURSOR_N_ARROW:
|
||||
return GHOST_kStandardCursorUpArrow;
|
||||
case WM_CURSOR_S_ARROW:
|
||||
return GHOST_kStandardCursorDownArrow;
|
||||
case WM_CURSOR_PAINT:
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
if (paint_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (paint_style == 2) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (paint_style == 3) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (paint_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (paint_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (paint_style == 6) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (paint_style == 7) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (paint_style == 8) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (paint_style == 9) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
case WM_CURSOR_DOT:
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
if (dot_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (dot_style == 2) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (dot_style == 3) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (dot_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (dot_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (dot_style == 6) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (dot_style == 7) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (dot_style == 8) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (dot_style == 9) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
case WM_CURSOR_CROSSC:
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
case WM_CURSOR_ERASER:
|
||||
return GHOST_kStandardCursorEraser;
|
||||
if (eraser_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (eraser_style == 2) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (eraser_style == 3) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (eraser_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (eraser_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (eraser_style == 6) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (eraser_style == 7) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (eraser_style == 8) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (eraser_style == 9) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (eraser_style == 10) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorEraser;
|
||||
}
|
||||
case WM_CURSOR_ZOOM_IN:
|
||||
return GHOST_kStandardCursorZoomIn;
|
||||
case WM_CURSOR_ZOOM_OUT:
|
||||
|
@ -95,7 +315,39 @@ static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
|
|||
case WM_CURSOR_TEXT_EDIT:
|
||||
return GHOST_kStandardCursorText;
|
||||
case WM_CURSOR_PAINT_BRUSH:
|
||||
return GHOST_kStandardCursorPencil;
|
||||
if (pencil_style == 1) {
|
||||
return GHOST_kStandardCursorCrosshair;
|
||||
}
|
||||
else if (pencil_style == 2) {
|
||||
return GHOST_kStandardCursorDefault;
|
||||
}
|
||||
else if (pencil_style == 3) {
|
||||
return GHOST_kStandardCursorPointer;
|
||||
}
|
||||
else if (pencil_style == 4) {
|
||||
return GHOST_kStandardCursorCrosshairD;
|
||||
}
|
||||
else if (pencil_style == 5) {
|
||||
return GHOST_kStandardCursorCrosshairA;
|
||||
}
|
||||
else if (pencil_style == 6) {
|
||||
return GHOST_kStandardCursorCrosshairC;
|
||||
}
|
||||
else if (pencil_style == 7) {
|
||||
return GHOST_kStandardCursorBox;
|
||||
}
|
||||
else if (pencil_style == 8) {
|
||||
return GHOST_kStandardCursorBoxDot;
|
||||
}
|
||||
else if (pencil_style == 9) {
|
||||
return GHOST_kStandardCursorBoxPointer;
|
||||
}
|
||||
else if (pencil_style == 10) {
|
||||
return GHOST_kStandardCursorCrosshairB;
|
||||
}
|
||||
else {
|
||||
return GHOST_kStandardCursorPencil;
|
||||
}
|
||||
case WM_CURSOR_E_ARROW:
|
||||
return GHOST_kStandardCursorRightArrow;
|
||||
case WM_CURSOR_W_ARROW:
|
||||
|
|
|
@ -274,29 +274,42 @@ int WM_event_drag_direction(const wmEvent *event)
|
|||
event->xy[1] - event->prev_press_xy[1],
|
||||
};
|
||||
|
||||
int theta = round_fl_to_int(4.0f * atan2f(float(delta[1]), float(delta[0])) / float(M_PI));
|
||||
int val = KM_DIRECTION_W;
|
||||
const bool left_right = U.click_drag_direction & USER_CLICK_DRAG_DIRECTION_LEFT_RIGHT;
|
||||
const bool up_down = U.click_drag_direction & USER_CLICK_DRAG_DIRECTION_UP_DOWN;
|
||||
int val = up_down ? KM_DIRECTION_S : KM_DIRECTION_W;
|
||||
|
||||
if (theta == 0) {
|
||||
val = KM_DIRECTION_E;
|
||||
if (left_right || up_down) {
|
||||
float thetaf = 4.0f * atan2f((float)delta[1], (float)delta[0]) / (float)M_PI;
|
||||
if (left_right && thetaf > -2.0f && thetaf < 2.0f) {
|
||||
val = KM_DIRECTION_E;
|
||||
}
|
||||
else if (up_down && thetaf > 0.0f) {
|
||||
val = KM_DIRECTION_N;
|
||||
}
|
||||
}
|
||||
else if (theta == 1) {
|
||||
val = KM_DIRECTION_NE;
|
||||
}
|
||||
else if (theta == 2) {
|
||||
val = KM_DIRECTION_N;
|
||||
}
|
||||
else if (theta == 3) {
|
||||
val = KM_DIRECTION_NW;
|
||||
}
|
||||
else if (theta == -1) {
|
||||
val = KM_DIRECTION_SE;
|
||||
}
|
||||
else if (theta == -2) {
|
||||
val = KM_DIRECTION_S;
|
||||
}
|
||||
else if (theta == -3) {
|
||||
val = KM_DIRECTION_SW;
|
||||
else {
|
||||
int theta = round_fl_to_int(4.0f * atan2f((float)delta[1], (float)delta[0]) / (float)M_PI);
|
||||
if (theta == 0) {
|
||||
val = KM_DIRECTION_E;
|
||||
}
|
||||
else if (theta == 1) {
|
||||
val = KM_DIRECTION_NE;
|
||||
}
|
||||
else if (theta == 2) {
|
||||
val = KM_DIRECTION_N;
|
||||
}
|
||||
else if (theta == 3) {
|
||||
val = KM_DIRECTION_NW;
|
||||
}
|
||||
else if (theta == -1) {
|
||||
val = KM_DIRECTION_SE;
|
||||
}
|
||||
else if (theta == -2) {
|
||||
val = KM_DIRECTION_S;
|
||||
}
|
||||
else if (theta == -3) {
|
||||
val = KM_DIRECTION_SW;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -1306,6 +1306,11 @@ int WM_operator_repeat(bContext *C, wmOperator *op)
|
|||
op->flag &= ~op_flag;
|
||||
return ret;
|
||||
}
|
||||
int WM_operator_invoke_last(bContext *C, wmOperator *op)
|
||||
{
|
||||
const int ret = WM_operator_name_call_ptr(C, op->type, WM_OP_INVOKE_DEFAULT, nullptr, nullptr);
|
||||
return ret;
|
||||
}
|
||||
int WM_operator_repeat_last(bContext *C, wmOperator *op)
|
||||
{
|
||||
const int op_flag = OP_IS_REPEAT_LAST;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "ED_screen.hh"
|
||||
#include "ED_select_utils.hh"
|
||||
#include "ED_view3d.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
|
||||
|
@ -87,6 +88,18 @@ static void gesture_modal_state_to_operator(wmOperator *op, int modal_state)
|
|||
}
|
||||
}
|
||||
|
||||
static void gesture_toggle_xray(bContext *C)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find("VIEW3D_OT_toggle_xray", true);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
BLI_assert(ot);
|
||||
PointerRNA ptr;
|
||||
WM_operator_properties_create_ptr(&ptr, ot);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, nullptr);
|
||||
WM_operator_properties_free(&ptr);
|
||||
ts->auto_xray_reset ^= true;
|
||||
}
|
||||
|
||||
static int UNUSED_FUNCTION(gesture_modal_state_from_operator)(wmOperator *op)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
@ -165,10 +178,27 @@ static bool gesture_box_apply(bContext *C, wmOperator *op)
|
|||
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
const bool wait_for_input = !WM_event_is_mouse_drag_or_press(event) &&
|
||||
RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
||||
const bool auto_xray = ts->auto_xray && ts->auto_xray_box ?
|
||||
obedit ? ts->auto_xray_edit : ts->auto_xray_object :
|
||||
false;
|
||||
|
||||
if (ts->auto_xray_reset) {
|
||||
ts->auto_xray_reset ^= true;
|
||||
}
|
||||
|
||||
if (v3d && auto_xray) {
|
||||
if (!XRAY_FLAG_ENABLED(v3d)) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
}
|
||||
|
||||
if (wait_for_input) {
|
||||
op->customdata = WM_gesture_new(win, region, event, WM_GESTURE_CROSS_RECT);
|
||||
}
|
||||
|
@ -192,8 +222,11 @@ int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
rcti *rect = static_cast<rcti *>(gesture->customdata);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
|
||||
if (event->type == EVT_MODAL_MAP) {
|
||||
switch (event->val) {
|
||||
|
@ -216,13 +249,22 @@ int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
gesture->modal_state = event->val;
|
||||
}
|
||||
if (gesture_box_apply(C, op)) {
|
||||
if (ts->auto_xray_reset) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
gesture_modal_end(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
if (ts->auto_xray_reset) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
gesture_modal_end(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
case GESTURE_MODAL_CANCEL: {
|
||||
if (ts->auto_xray_reset) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
gesture_modal_end(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -288,9 +330,26 @@ static void gesture_circle_apply(bContext *C, wmOperator *op);
|
|||
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
const bool wait_for_input = !WM_event_is_mouse_drag_or_press(event) &&
|
||||
RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
ToolSettings *ts = static_cast<ToolSettings *>(win->scene->toolsettings);
|
||||
const bool auto_xray = ts->auto_xray && ts->auto_xray_circle ?
|
||||
obedit ? ts->auto_xray_edit : ts->auto_xray_object :
|
||||
false;
|
||||
|
||||
if (ts->auto_xray_reset) {
|
||||
ts->auto_xray_reset ^= true;
|
||||
}
|
||||
|
||||
if (v3d && auto_xray) {
|
||||
if (!XRAY_FLAG_ENABLED(v3d)) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
}
|
||||
|
||||
op->customdata = WM_gesture_new(win, CTX_wm_region(C), event, WM_GESTURE_CIRCLE);
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
rcti *rect = static_cast<rcti *>(gesture->customdata);
|
||||
|
@ -347,8 +406,11 @@ static void gesture_circle_apply(bContext *C, wmOperator *op)
|
|||
int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
rcti *rect = static_cast<rcti *>(gesture->customdata);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
ToolSettings *ts = static_cast<ToolSettings *>(win->scene->toolsettings);
|
||||
|
||||
if (event->type == MOUSEMOVE) {
|
||||
|
||||
|
@ -417,6 +479,9 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
}
|
||||
|
||||
if (is_finished) {
|
||||
if (ts->auto_xray_reset) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
gesture_modal_end(C, op);
|
||||
return OPERATOR_FINISHED; /* use finish or we don't get an undo */
|
||||
}
|
||||
|
@ -479,7 +544,24 @@ void WM_OT_circle_gesture(wmOperatorType *ot)
|
|||
int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
PropertyRNA *prop;
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
ToolSettings *ts = static_cast<ToolSettings *>(win->scene->toolsettings);
|
||||
|
||||
const bool auto_xray = ts->auto_xray && ts->auto_xray_lasso ?
|
||||
obedit ? ts->auto_xray_edit : ts->auto_xray_object :
|
||||
false;
|
||||
|
||||
if (ts->auto_xray_reset) {
|
||||
ts->auto_xray_reset ^= true;
|
||||
}
|
||||
|
||||
if (v3d && auto_xray) {
|
||||
if (!XRAY_FLAG_ENABLED(v3d)) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
}
|
||||
|
||||
op->customdata = WM_gesture_new(win, CTX_wm_region(C), event, WM_GESTURE_LASSO);
|
||||
|
||||
|
@ -519,6 +601,10 @@ static int gesture_lasso_apply(bContext *C, wmOperator *op)
|
|||
int retval = OPERATOR_FINISHED;
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
PointerRNA itemptr;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ToolSettings *ts = static_cast<ToolSettings *>(win->scene->toolsettings);
|
||||
float loc[2];
|
||||
int i;
|
||||
const short *lasso = static_cast<const short int *>(gesture->customdata);
|
||||
|
@ -540,12 +626,20 @@ static int gesture_lasso_apply(bContext *C, wmOperator *op)
|
|||
OPERATOR_RETVAL_CHECK(retval);
|
||||
}
|
||||
|
||||
if (ts->auto_xray_reset) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ToolSettings *ts = static_cast<ToolSettings *>(win->scene->toolsettings);
|
||||
|
||||
if (event->type == EVT_MODAL_MAP) {
|
||||
switch (event->val) {
|
||||
|
@ -599,6 +693,9 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
break;
|
||||
}
|
||||
case EVT_ESCKEY: {
|
||||
if (ts->auto_xray_reset) {
|
||||
gesture_toggle_xray(C);
|
||||
}
|
||||
gesture_modal_end(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
|
|
@ -413,8 +413,59 @@ void WM_operator_properties_gesture_box_ex(wmOperatorType *ot, bool deselect, bo
|
|||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem object_select_items[] = {
|
||||
{OBJECT_TOUCH, "OBJECT_TOUCH", 0, "Touch", "Select objects that are touched by the box"},
|
||||
{OBJECT_ENCLOSE,
|
||||
"OBJECT_ENCLOSE",
|
||||
0,
|
||||
"Enclose",
|
||||
"Select objects that are fully inside the box"},
|
||||
{OBJECT_ORIGIN,
|
||||
"OBJECT_ORIGIN",
|
||||
0,
|
||||
"Origin",
|
||||
"Select objects if their origin is touched by the box"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem face_select_items[] = {
|
||||
{FACE_DEFAULT,
|
||||
"FACE_DEFAULT",
|
||||
0,
|
||||
"Default",
|
||||
"Select faces that are touched by the box in near select. Select faces if their center is "
|
||||
"touched by the box in X-Ray select"},
|
||||
{FACE_TOUCH, "FACE_TOUCH", 0, "Touch", "Select faces that are touched by the box"},
|
||||
{FACE_ENCLOSE, "FACE_ENCLOSE", 0, "Enclose", "Select faces that are fully inside the box"},
|
||||
{FACE_CENTER,
|
||||
"FACE_CENTER",
|
||||
0,
|
||||
"Center",
|
||||
"Select faces if their center is touched by the box"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem edge_select_items[] = {
|
||||
{EDGE_DEFAULT,
|
||||
"EDGE_DEFAULT",
|
||||
0,
|
||||
"Default",
|
||||
"Select edges that are fully inside the box. If no edges are fully inside the box, select "
|
||||
"edges that are touched by the box"},
|
||||
{EDGE_TOUCH, "EDGE_TOUCH", 0, "Touch", "Select edges that are touched by the box"},
|
||||
{EDGE_ENCLOSE, "EDGE_ENCLOSE", 0, "Enclose", "Select edges that are fully inside the box"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
WM_operator_properties_border(ot);
|
||||
|
||||
prop = RNA_def_enum(ot->srna, "object_type", object_select_items, 0, "Object", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_enum(ot->srna, "face_type", face_select_items, 0, "Face", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_enum(ot->srna, "edge_type", edge_select_items, 0, "Edge", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
|
||||
if (deselect) {
|
||||
prop = RNA_def_boolean(
|
||||
ot->srna, "deselect", false, "Deselect", "Deselect rather than select items");
|
||||
|
@ -521,6 +572,41 @@ void WM_operator_properties_gesture_box_zoom(wmOperatorType *ot)
|
|||
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
static const EnumPropertyItem face_select_items[] = {
|
||||
{FACE_DEFAULT,
|
||||
"FACE_DEFAULT",
|
||||
0,
|
||||
"Default",
|
||||
"Select faces that are touched by the lasso in near select. Select faces if their center "
|
||||
"is touched by the lasso in X-Ray select"},
|
||||
{FACE_TOUCH, "FACE_TOUCH", 0, "Touch", "Select faces that are touched by the lasso"},
|
||||
{FACE_ENCLOSE, "FACE_ENCLOSE", 0, "Enclose", "Select faces that are fully inside the lasso"},
|
||||
{FACE_CENTER,
|
||||
"FACE_CENTER",
|
||||
0,
|
||||
"Center",
|
||||
"Select faces if their center is touched by the lasso"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem edge_select_items[] = {
|
||||
{EDGE_DEFAULT,
|
||||
"EDGE_DEFAULT",
|
||||
0,
|
||||
"Default",
|
||||
"Select edges that are fully inside the lasso. If no edges are fully inside the lasso, "
|
||||
"select edges that are touched by the lasso"},
|
||||
{EDGE_TOUCH, "EDGE_TOUCH", 0, "Touch", "Select edges that are touched by the lasso"},
|
||||
{EDGE_ENCLOSE, "EDGE_ENCLOSE", 0, "Enclose", "Select edges that are fully inside the lasso"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
WM_operator_properties_border(ot);
|
||||
|
||||
prop = RNA_def_enum(ot->srna, "face_type", face_select_items, 0, "Face", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_enum(ot->srna, "edge_type", edge_select_items, 0, "Edge", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
}
|
||||
|
@ -559,6 +645,47 @@ void WM_operator_properties_gesture_circle(wmOperatorType *ot)
|
|||
PropertyRNA *prop;
|
||||
const int radius_default = 25;
|
||||
|
||||
static const EnumPropertyItem object_select_items[] = {
|
||||
{OBJECT_ORIGIN,
|
||||
"OBJECT_ORIGIN",
|
||||
0,
|
||||
"Origin",
|
||||
"Select objects if their origin is touched by the circle"},
|
||||
{OBJECT_TOUCH, "OBJECT_TOUCH", 0, "Touch", "Select objects that are touched by the circle"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem face_select_items[] = {
|
||||
{FACE_DEFAULT,
|
||||
"FACE_DEFAULT",
|
||||
0,
|
||||
"Default",
|
||||
"Select faces that are touched by the circle in near select. Select faces if their center "
|
||||
"is touched by the circle in X-Ray select"},
|
||||
{FACE_TOUCH, "FACE_TOUCH", 0, "Touch", "Select faces that are touched by the circle"},
|
||||
{FACE_ENCLOSE,
|
||||
"FACE_ENCLOSE",
|
||||
0,
|
||||
"Enclose",
|
||||
"Select faces that are fully inside the circle"},
|
||||
{FACE_CENTER,
|
||||
"FACE_CENTER",
|
||||
0,
|
||||
"Center",
|
||||
"Select faces if their center is touched by the circle"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem edge_select_items[] = {
|
||||
{EDGE_TOUCH, "EDGE_TOUCH", 0, "Touch", "Select edges that are touched by the circle"},
|
||||
{EDGE_ENCLOSE,
|
||||
"EDGE_ENCLOSE",
|
||||
0,
|
||||
"Enclose",
|
||||
"Select edges that are fully inside the circle"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
|
||||
|
@ -567,6 +694,13 @@ void WM_operator_properties_gesture_circle(wmOperatorType *ot)
|
|||
|
||||
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
|
||||
prop = RNA_def_enum(ot->srna, "object_type", object_select_items, 0, "Object", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_enum(ot->srna, "face_type", face_select_items, 0, "Face", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
prop = RNA_def_enum(ot->srna, "edge_type", edge_select_items, 0, "Edge", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
void WM_operator_properties_mouse_select(wmOperatorType *ot)
|
||||
|
|