WIP: Snapping Redesign: Defaults | Navigation | Drawing | Removals #109062
|
@ -252,15 +252,6 @@ class Prefs(bpy.types.KeyConfigPreferences):
|
|||
update=update_fn,
|
||||
)
|
||||
|
||||
use_transform_navigation: BoolProperty(
|
||||
name="Navigate during Transform",
|
||||
description=(
|
||||
"Enable view navigation while using transform operators. "
|
||||
"Proportional Influence, Automatic Constraints and Auto IK Chain Length shortcuts will require holding Alt key"),
|
||||
default=False,
|
||||
update=update_fn,
|
||||
)
|
||||
|
||||
def draw(self, layout):
|
||||
from bpy import context
|
||||
|
||||
|
@ -324,7 +315,6 @@ class Prefs(bpy.types.KeyConfigPreferences):
|
|||
sub.prop(self, "use_v3d_tab_menu")
|
||||
sub.prop(self, "use_pie_click_drag")
|
||||
sub.prop(self, "use_v3d_shade_ex_pie")
|
||||
sub.prop(self, "use_transform_navigation")
|
||||
|
||||
# File Browser settings.
|
||||
col = layout.column()
|
||||
|
@ -385,7 +375,6 @@ def load():
|
|||
use_pie_click_drag=kc_prefs.use_pie_click_drag,
|
||||
use_file_single_click=kc_prefs.use_file_single_click,
|
||||
experimental=prefs.experimental,
|
||||
use_transform_navigation=kc_prefs.use_transform_navigation,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
@ -99,8 +99,6 @@ class Params:
|
|||
"tool_maybe_tweak_event",
|
||||
# Access to bpy.context.preferences.experimental
|
||||
"experimental",
|
||||
# Changes some transformers modal key-map items to avoid conflicts with navigation operations
|
||||
"use_transform_navigation",
|
||||
)
|
||||
|
||||
def __init__(
|
||||
|
@ -129,7 +127,6 @@ class Params:
|
|||
v3d_tilde_action='VIEW',
|
||||
v3d_alt_mmb_drag_action='RELATIVE',
|
||||
experimental=None,
|
||||
use_transform_navigation=False,
|
||||
):
|
||||
from sys import platform
|
||||
self.apple = (platform == 'darwin')
|
||||
|
@ -228,7 +225,6 @@ class Params:
|
|||
self.pie_value = 'CLICK_DRAG' if use_pie_click_drag else 'PRESS'
|
||||
self.tool_tweak_event = {"type": self.tool_mouse, "value": 'CLICK_DRAG'}
|
||||
self.tool_maybe_tweak_event = {"type": self.tool_mouse, "value": self.tool_maybe_tweak_value}
|
||||
self.use_transform_navigation = use_transform_navigation
|
||||
|
||||
self.experimental = experimental
|
||||
|
||||
|
@ -1608,16 +1604,13 @@ def km_view3d(params):
|
|||
# Transform.
|
||||
("transform.translate", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, None),
|
||||
op_tool_optional(
|
||||
("transform.translate", {"type": 'G', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.move"), params),
|
||||
op_tool_optional(
|
||||
("transform.rotate", {"type": 'R', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.rotate"), params),
|
||||
op_tool_optional(
|
||||
("transform.resize", {"type": 'S', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.scale"), params),
|
||||
op_tool_optional(
|
||||
("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None),
|
||||
|
@ -3675,8 +3668,7 @@ def km_grease_pencil_stroke_edit_mode(params):
|
|||
("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
# Extrude and move selected points
|
||||
op_tool_optional(
|
||||
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.extrude"), params),
|
||||
# Delete
|
||||
op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'X', "value": 'PRESS'}),
|
||||
|
@ -4685,10 +4677,8 @@ def km_object_mode(params):
|
|||
op_menu("VIEW3D_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}),
|
||||
op_menu("VIEW3D_MT_object_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}),
|
||||
op_menu("VIEW3D_MT_make_links", {"type": 'L', "value": 'PRESS', "ctrl": True}),
|
||||
("object.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("object.duplicate_move_linked", {"type": 'D', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("object.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
("object.duplicate_move_linked", {"type": 'D', "value": 'PRESS', "alt": True}, None),
|
||||
("object.join", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
|
||||
("wm.context_toggle", {"type": 'PERIOD', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("data_path", 'tool_settings.use_transform_data_origin')]}),
|
||||
|
@ -4754,13 +4744,10 @@ def km_paint_curve(params):
|
|||
("paintcurve.delete_point", {"type": 'DEL', "value": 'PRESS'}, None),
|
||||
("paintcurve.draw", {"type": 'RET', "value": 'PRESS'}, None),
|
||||
("paintcurve.draw", {"type": 'NUMPAD_ENTER', "value": 'PRESS'}, None),
|
||||
("transform.translate", {"type": 'G', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
|
||||
("transform.translate", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, None),
|
||||
("transform.rotate", {"type": 'R', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("transform.resize", {"type": 'S', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
|
||||
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
@ -4793,8 +4780,7 @@ def km_curve(params):
|
|||
("curve.separate", {"type": 'P', "value": 'PRESS'}, None),
|
||||
("curve.split", {"type": 'Y', "value": 'PRESS'}, None),
|
||||
op_tool_optional(
|
||||
("curve.extrude_move", {"type": 'E', "value": 'PRESS'},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.extrude"), params),
|
||||
("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
("curve.make_segment", {"type": 'F', "value": 'PRESS'}, None),
|
||||
|
@ -5403,8 +5389,7 @@ def km_mesh(params):
|
|||
("mesh.normals_make_consistent", {"type": 'N', "value": 'PRESS', "shift": True, "ctrl": True},
|
||||
{"properties": [("inside", True)]}),
|
||||
op_tool_optional(
|
||||
("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'},
|
||||
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
|
||||
("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.extrude_region"), params),
|
||||
op_menu("VIEW3D_MT_edit_mesh_extrude", {"type": 'E', "value": 'PRESS', "alt": True}),
|
||||
("transform.edge_crease", {"type": 'E', "value": 'PRESS', "shift": True}, None),
|
||||
|
@ -5421,13 +5406,11 @@ def km_mesh(params):
|
|||
# No tool is available for this.
|
||||
("mesh.rip_move", {"type": 'V', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("MESH_OT_rip", [("use_fill", True)],)]}),
|
||||
("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True}, None),
|
||||
op_menu("VIEW3D_MT_edit_mesh_merge", {"type": 'M', "value": 'PRESS'}),
|
||||
op_menu("VIEW3D_MT_edit_mesh_split", {"type": 'M', "value": 'PRESS', "alt": True}),
|
||||
("mesh.edge_face_add", {"type": 'F', "value": 'PRESS', "repeat": True}, None),
|
||||
("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
op_menu("VIEW3D_MT_mesh_add", {"type": 'A', "value": 'PRESS', "shift": True}),
|
||||
("mesh.separate", {"type": 'P', "value": 'PRESS'}, None),
|
||||
("mesh.split", {"type": 'Y', "value": 'PRESS'}, None),
|
||||
|
@ -5545,8 +5528,7 @@ def km_armature(params):
|
|||
("armature.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None),
|
||||
("armature.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None),
|
||||
op_tool_optional(
|
||||
("armature.extrude_move", {"type": 'E', "value": 'PRESS'},
|
||||
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
|
||||
("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
|
||||
(op_tool_cycle, "builtin.extrude"), params),
|
||||
("armature.extrude_forked", {"type": 'E', "value": 'PRESS', "shift": True}, None),
|
||||
("armature.click_extrude", {"type": params.action_mouse, "value": 'CLICK', "ctrl": True}, None),
|
||||
|
@ -5965,24 +5947,24 @@ def km_transform_modal_map(params):
|
|||
("PROPORTIONAL_SIZE_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True}, None),
|
||||
("PROPORTIONAL_SIZE_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True, "repeat": True}, None),
|
||||
("PROPORTIONAL_SIZE_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True, "repeat": True}, None),
|
||||
("PROPORTIONAL_SIZE_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
|
||||
("PROPORTIONAL_SIZE_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
|
||||
("PROPORTIONAL_SIZE_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("PROPORTIONAL_SIZE_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("PROPORTIONAL_SIZE_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
|
||||
("PROPORTIONAL_SIZE_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
|
||||
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY', "alt": params.use_transform_navigation}, None),
|
||||
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY', "alt": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "repeat": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True, "repeat": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True, "repeat": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
|
||||
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
|
||||
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
|
||||
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
|
||||
("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None),
|
||||
("NODE_ATTACH_ON", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None),
|
||||
("NODE_ATTACH_OFF", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None),
|
||||
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY', "alt": params.use_transform_navigation}, None),
|
||||
("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', "shift": True, "alt": params.use_transform_navigation}, None),
|
||||
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY', "alt": True}, None),
|
||||
("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', "shift": True, "alt": True}, None),
|
||||
("PRECISION", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, None),
|
||||
("PRECISION", {"type": 'RIGHT_SHIFT', "value": 'ANY', "any": True}, None),
|
||||
])
|
||||
|
|
|
@ -15,12 +15,6 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
|
|||
bl_label = "Extrude Individual and Move"
|
||||
bl_idname = "view3d.edit_mesh_extrude_individual_move"
|
||||
|
||||
allow_navigation: BoolProperty(
|
||||
name="allow_navigation",
|
||||
default=False,
|
||||
description="Allow navigation",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
|
@ -40,27 +34,27 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
|
|||
TRANSFORM_OT_translate={
|
||||
"orient_type": 'NORMAL',
|
||||
"constraint_axis": (False, False, True),
|
||||
"allow_navigation": self.allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
elif select_mode[2] and totface > 1:
|
||||
bpy.ops.mesh.extrude_faces_move(
|
||||
'INVOKE_REGION_WIN',
|
||||
TRANSFORM_OT_shrink_fatten={
|
||||
"allow_navigation": self.allow_navigation,
|
||||
"release_confirm": False,
|
||||
})
|
||||
elif select_mode[1] and totedge >= 1:
|
||||
bpy.ops.mesh.extrude_edges_move(
|
||||
'INVOKE_REGION_WIN',
|
||||
TRANSFORM_OT_translate={
|
||||
"allow_navigation": self.allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
else:
|
||||
bpy.ops.mesh.extrude_vertices_move(
|
||||
'INVOKE_REGION_WIN',
|
||||
TRANSFORM_OT_translate={
|
||||
"allow_navigation": self.allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -83,19 +77,13 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
|||
description="Dissolves adjacent faces and intersects new geometry",
|
||||
)
|
||||
|
||||
allow_navigation: BoolProperty(
|
||||
name="allow_navigation",
|
||||
default=False,
|
||||
description="Allow navigation",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj is not None and obj.mode == 'EDIT')
|
||||
|
||||
@staticmethod
|
||||
def extrude_region(context, use_vert_normals, dissolve_and_intersect, allow_navigation):
|
||||
def extrude_region(context, use_vert_normals, dissolve_and_intersect):
|
||||
mesh = context.object.data
|
||||
|
||||
totface = mesh.total_face_sel
|
||||
|
@ -107,7 +95,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
|||
bpy.ops.mesh.extrude_region_shrink_fatten(
|
||||
'INVOKE_REGION_WIN',
|
||||
TRANSFORM_OT_shrink_fatten={
|
||||
"allow_navigation": allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
elif dissolve_and_intersect:
|
||||
|
@ -119,7 +107,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
|||
TRANSFORM_OT_translate={
|
||||
"orient_type": 'NORMAL',
|
||||
"constraint_axis": (False, False, True),
|
||||
"allow_navigation": allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
else:
|
||||
|
@ -128,7 +116,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
|||
TRANSFORM_OT_translate={
|
||||
"orient_type": 'NORMAL',
|
||||
"constraint_axis": (False, False, True),
|
||||
"allow_navigation": allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -142,13 +130,13 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
|||
# Not a popular choice, too restrictive for retopo.
|
||||
# "constraint_axis": (True, True, False)})
|
||||
"constraint_axis": (False, False, False),
|
||||
"allow_navigation": allow_navigation,
|
||||
"release_confirm": False,
|
||||
})
|
||||
else:
|
||||
bpy.ops.mesh.extrude_region_move(
|
||||
'INVOKE_REGION_WIN',
|
||||
TRANSFORM_OT_translate={
|
||||
"allow_navigation": allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -157,8 +145,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
|||
return {'FINISHED'}
|
||||
|
||||
def execute(self, context):
|
||||
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(
|
||||
context, False, self.dissolve_and_intersect, self.allow_navigation)
|
||||
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, False, self.dissolve_and_intersect)
|
||||
|
||||
def invoke(self, context, _event):
|
||||
return self.execute(context)
|
||||
|
@ -169,19 +156,13 @@ class VIEW3D_OT_edit_mesh_extrude_shrink_fatten(Operator):
|
|||
bl_label = "Extrude and Move on Individual Normals"
|
||||
bl_idname = "view3d.edit_mesh_extrude_move_shrink_fatten"
|
||||
|
||||
allow_navigation: BoolProperty(
|
||||
name="allow_navigation",
|
||||
default=False,
|
||||
description="Allow navigation",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj is not None and obj.mode == 'EDIT')
|
||||
|
||||
def execute(self, context):
|
||||
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True, False, self.allow_navigation)
|
||||
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True, False)
|
||||
|
||||
def invoke(self, context, _event):
|
||||
return self.execute(context)
|
||||
|
@ -192,12 +173,6 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
|
|||
bl_label = "Extrude Manifold Along Normals"
|
||||
bl_idname = "view3d.edit_mesh_extrude_manifold_normal"
|
||||
|
||||
allow_navigation: BoolProperty(
|
||||
name="allow_navigation",
|
||||
default=False,
|
||||
description="Allow navigation",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
|
@ -212,7 +187,7 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
|
|||
TRANSFORM_OT_translate={
|
||||
"orient_type": 'NORMAL',
|
||||
"constraint_axis": (False, False, True),
|
||||
"allow_navigation": self.allow_navigation,
|
||||
"release_confirm": False,
|
||||
},
|
||||
)
|
||||
return {'FINISHED'}
|
||||
|
|
|
@ -513,8 +513,6 @@ class _defs_view3d_add:
|
|||
row.label(text="Orientation:")
|
||||
row = layout.row()
|
||||
row.prop(tool_settings, "plane_orientation", text="")
|
||||
row = layout.row()
|
||||
row.prop(tool_settings, "snap_elements_tool")
|
||||
|
||||
region_is_header = bpy.context.region.type == 'TOOL_HEADER'
|
||||
if region_is_header:
|
||||
|
|
|
@ -1041,14 +1041,10 @@ class VIEW3D_MT_transform_base:
|
|||
# TODO: get rid of the custom text strings?
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
allow_navigation = getattr(
|
||||
context.window_manager.keyconfigs.active.preferences,
|
||||
"use_transform_navigation",
|
||||
False)
|
||||
|
||||
layout.operator("transform.translate").allow_navigation = allow_navigation
|
||||
layout.operator("transform.rotate").allow_navigation = allow_navigation
|
||||
layout.operator("transform.resize", text="Scale").allow_navigation = allow_navigation
|
||||
layout.operator("transform.translate").release_confirm = False
|
||||
layout.operator("transform.rotate").release_confirm = False
|
||||
layout.operator("transform.resize", text="Scale").release_confirm = False
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@ -1068,18 +1064,13 @@ class VIEW3D_MT_transform_base:
|
|||
# Generic transform menu - geometry types
|
||||
class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
|
||||
def draw(self, context):
|
||||
allow_navigation = getattr(
|
||||
context.window_manager.keyconfigs.active.preferences,
|
||||
"use_transform_navigation",
|
||||
False)
|
||||
|
||||
# base menu
|
||||
VIEW3D_MT_transform_base.draw(self, context)
|
||||
|
||||
# generic...
|
||||
layout = self.layout
|
||||
if context.mode == 'EDIT_MESH':
|
||||
layout.operator("transform.shrink_fatten", text="Shrink/Fatten").allow_navigation = allow_navigation
|
||||
layout.operator("transform.shrink_fatten", text="Shrink/Fatten").release_confirm = False
|
||||
layout.operator("transform.skin_resize")
|
||||
elif context.mode == 'EDIT_CURVE':
|
||||
layout.operator("transform.transform", text="Radius").mode = 'CURVE_SHRINKFATTEN'
|
||||
|
@ -1088,10 +1079,11 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
|
|||
layout.separator()
|
||||
props = layout.operator("transform.translate", text="Move Texture Space")
|
||||
props.texture_space = True
|
||||
props.allow_navigation = allow_navigation
|
||||
props.release_confirm = False
|
||||
|
||||
props = layout.operator("transform.resize", text="Scale Texture Space")
|
||||
props.texture_space = True
|
||||
props.allow_navigation = allow_navigation
|
||||
props.release_confirm = False
|
||||
|
||||
|
||||
# Object-specific extensions to Transform menu
|
||||
|
@ -4201,11 +4193,6 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
|
|||
col.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
|
||||
|
||||
if is_face_mode:
|
||||
allow_navigation = getattr(
|
||||
context.window_manager.keyconfigs.active.preferences,
|
||||
"use_transform_navigation",
|
||||
False)
|
||||
|
||||
col = row.column(align=True)
|
||||
|
||||
col.label(text="Face Context Menu", icon='FACESEL')
|
||||
|
@ -4217,11 +4204,11 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
|
|||
col.separator()
|
||||
|
||||
col.operator("view3d.edit_mesh_extrude_move_normal",
|
||||
text="Extrude Faces").allow_navigation = allow_navigation
|
||||
text="Extrude Faces").release_confirm = False
|
||||
col.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
|
||||
text="Extrude Faces Along Normals").allow_navigation = allow_navigation
|
||||
text="Extrude Faces Along Normals").release_confirm = False
|
||||
col.operator("mesh.extrude_faces_move",
|
||||
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.allow_navigation = allow_navigation
|
||||
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.release_confirm = False
|
||||
|
||||
col.operator("mesh.inset")
|
||||
col.operator("mesh.poke")
|
||||
|
@ -4273,11 +4260,6 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
|
|||
def draw(self, context):
|
||||
from math import pi
|
||||
|
||||
allow_navigation = getattr(
|
||||
context.window_manager.keyconfigs.active.preferences,
|
||||
"use_transform_navigation",
|
||||
False)
|
||||
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
|
@ -4287,22 +4269,22 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
|
|||
|
||||
if mesh.total_face_sel:
|
||||
layout.operator("view3d.edit_mesh_extrude_move_normal",
|
||||
text="Extrude Faces").allow_navigation = allow_navigation
|
||||
text="Extrude Faces").release_confirm = False
|
||||
layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
|
||||
text="Extrude Faces Along Normals").allow_navigation = allow_navigation
|
||||
text="Extrude Faces Along Normals").release_confirm = False
|
||||
layout.operator(
|
||||
"mesh.extrude_faces_move",
|
||||
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.allow_navigation = allow_navigation
|
||||
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.release_confirm = False
|
||||
layout.operator("view3d.edit_mesh_extrude_manifold_normal",
|
||||
text="Extrude Manifold").allow_navigation = allow_navigation
|
||||
text="Extrude Manifold").release_confirm = False
|
||||
|
||||
if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
|
||||
layout.operator("mesh.extrude_edges_move",
|
||||
text="Extrude Edges").TRANSFORM_OT_translate.allow_navigation = allow_navigation
|
||||
text="Extrude Edges").TRANSFORM_OT_translate.release_confirm = False
|
||||
|
||||
if mesh.total_vert_sel and select_mode[0]:
|
||||
layout.operator("mesh.extrude_vertices_move",
|
||||
text="Extrude Vertices").TRANSFORM_OT_translate.allow_navigation = allow_navigation
|
||||
text="Extrude Vertices").TRANSFORM_OT_translate.release_confirm = False
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@ -4455,22 +4437,17 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
|
|||
bl_idname = "VIEW3D_MT_edit_mesh_faces"
|
||||
|
||||
def draw(self, context):
|
||||
allow_navigation = getattr(
|
||||
context.window_manager.keyconfigs.active.preferences,
|
||||
"use_transform_navigation",
|
||||
False)
|
||||
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.operator("view3d.edit_mesh_extrude_move_normal",
|
||||
text="Extrude Faces").allow_navigation = allow_navigation
|
||||
text="Extrude Faces").release_confirm = False
|
||||
layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
|
||||
text="Extrude Faces Along Normals").allow_navigation = allow_navigation
|
||||
text="Extrude Faces Along Normals").release_confirm = False
|
||||
layout.operator(
|
||||
"mesh.extrude_faces_move",
|
||||
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.allow_navigation = allow_navigation
|
||||
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.release_confirm = False
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 7
|
||||
#define BLENDER_FILE_SUBVERSION 8
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and show a warning if the file
|
||||
|
|
|
@ -4416,7 +4416,6 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
if (!MAIN_VERSION_ATLEAST(bmain, 306, 10)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* Set default values for new members. */
|
||||
scene->toolsettings->snap_mode_tools = SCE_SNAP_MODE_GEOM;
|
||||
scene->toolsettings->plane_axis = 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "DNA_defaults.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
|
||||
|
@ -228,12 +229,9 @@ void blo_do_versions_400(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
|
|||
if (!MAIN_VERSION_ATLEAST(bmain, 400, 5)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if (ts->snap_mode_tools != SCE_SNAP_MODE_NONE) {
|
||||
ts->snap_mode_tools = SCE_SNAP_MODE_GEOM;
|
||||
}
|
||||
|
||||
#define SCE_SNAP_PROJECT (1 << 3)
|
||||
if (ts->snap_flag & SCE_SNAP_PROJECT) {
|
||||
ts->snap_flag &= ~SCE_SNAP_PROJECT;
|
||||
ts->snap_mode |= SCE_SNAP_MODE_FACE_RAYCAST;
|
||||
}
|
||||
#undef SCE_SNAP_PROJECT
|
||||
|
@ -257,6 +255,19 @@ void blo_do_versions_400(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 400, 7)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
const ToolSettings *ts_default = DNA_struct_default_get(ToolSettings);
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if (ts->snap_target != 0) {
|
||||
ts->snap_target -= 1;
|
||||
}
|
||||
|
||||
ts->snap_mode = ts_default->snap_mode;
|
||||
ts->snap_transform_mode_flag = ts_default->snap_transform_mode_flag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
|
|
@ -126,7 +126,6 @@ int BIF_countTransformOrientation(const struct bContext *C);
|
|||
#define P_CURSOR_EDIT (1 << 16)
|
||||
#define P_CLNOR_INVALIDATE (1 << 17)
|
||||
#define P_VIEW2D_EDGE_PAN (1 << 18)
|
||||
#define P_VIEW3D_NAVIGATION (1 << 19)
|
||||
/* For properties performed when confirming the transformation. */
|
||||
#define P_POST_TRANSFORM (1 << 20)
|
||||
|
||||
|
|
|
@ -402,36 +402,41 @@ void ED_view3d_cursor_snap_draw_util(RegionView3D *rv3d,
|
|||
}
|
||||
|
||||
if (loc_prev) {
|
||||
/* Draw an "X" indicating where the previous snap point is.
|
||||
* This is useful for indicating perpendicular snap. */
|
||||
float view_inv[4][4];
|
||||
copy_m4_m4(view_inv, rv3d->viewinv);
|
||||
|
||||
/* v1, v2, v3 and v4 indicate the coordinates of the ends of the "X". */
|
||||
float vx[3], vy[3], v1[3], v2[3], v3[3], v4[4];
|
||||
float vx[3], vy[3], v[3];
|
||||
float size_tmp = ED_view3d_pixel_size(rv3d, loc_prev) * radius;
|
||||
float size_fac = 0.5f;
|
||||
|
||||
/* Multiply by 0.75f so that the final size of the "X" is close to that of
|
||||
* the circle.
|
||||
* (A closer value is 0.7071f, but we don't need to be exact here). */
|
||||
float x_size = 0.75f * radius * ED_view3d_pixel_size(rv3d, loc_prev);
|
||||
|
||||
mul_v3_v3fl(vx, view_inv[0], x_size);
|
||||
mul_v3_v3fl(vy, view_inv[1], x_size);
|
||||
|
||||
add_v3_v3v3(v1, vx, vy);
|
||||
sub_v3_v3v3(v2, vx, vy);
|
||||
negate_v3_v3(v3, v1);
|
||||
negate_v3_v3(v4, v2);
|
||||
|
||||
add_v3_v3(v1, loc_prev);
|
||||
add_v3_v3(v2, loc_prev);
|
||||
add_v3_v3(v3, loc_prev);
|
||||
add_v3_v3(v4, loc_prev);
|
||||
mul_v3_v3fl(vx, view_inv[0], size_tmp);
|
||||
mul_v3_v3fl(vy, view_inv[1], size_tmp);
|
||||
|
||||
immUniformColor4ubv(color_line);
|
||||
immBegin(GPU_PRIM_LINES, 4);
|
||||
immVertex3fv(pos, v3);
|
||||
immVertex3fv(pos, v1);
|
||||
immVertex3fv(pos, v4);
|
||||
immVertex3fv(pos, v2);
|
||||
|
||||
imm_drawcircball(loc_prev, size_tmp, view_inv, pos);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 8);
|
||||
add_v3_v3v3(v, loc_prev, vx);
|
||||
immVertex3fv(pos, v);
|
||||
madd_v3_v3fl(v, vx, size_fac);
|
||||
immVertex3fv(pos, v);
|
||||
|
||||
sub_v3_v3v3(v, loc_prev, vx);
|
||||
immVertex3fv(pos, v);
|
||||
madd_v3_v3fl(v, vx, -size_fac);
|
||||
immVertex3fv(pos, v);
|
||||
|
||||
add_v3_v3v3(v, loc_prev, vy);
|
||||
immVertex3fv(pos, v);
|
||||
madd_v3_v3fl(v, vy, size_fac);
|
||||
immVertex3fv(pos, v);
|
||||
|
||||
sub_v3_v3v3(v, loc_prev, vy);
|
||||
immVertex3fv(pos, v);
|
||||
madd_v3_v3fl(v, vy, -size_fac);
|
||||
immVertex3fv(pos, v);
|
||||
|
||||
immEnd();
|
||||
|
||||
if (loc_curr && (snap_elem_type & SCE_SNAP_MODE_EDGE_PERPENDICULAR)) {
|
||||
|
@ -550,8 +555,11 @@ static bool v3d_cursor_is_snap_invert(SnapCursorDataIntern *data_intern, const w
|
|||
|
||||
static eSnapMode v3d_cursor_snap_elements(ToolSettings *tool_settings)
|
||||
{
|
||||
return tool_settings->snap_mode_tools == SCE_SNAP_MODE_NONE ? tool_settings->snap_mode :
|
||||
tool_settings->snap_mode_tools;
|
||||
eSnapMode snap_mode = tool_settings->snap_mode & SCE_SNAP_MODE_GEOM;
|
||||
if (snap_mode == SCE_SNAP_MODE_NONE) {
|
||||
snap_mode = SCE_SNAP_MODE_GEOM;
|
||||
}
|
||||
return snap_mode;
|
||||
}
|
||||
|
||||
static void v3d_cursor_snap_context_ensure(Scene *scene)
|
||||
|
|
|
@ -761,9 +761,9 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv
|
|||
|
||||
ipd->step_index = STEP_BASE;
|
||||
|
||||
ipd->snap_to = tool_settings->snap_mode_tools;
|
||||
ipd->snap_to = tool_settings->snap_mode & SCE_SNAP_MODE_GEOM;
|
||||
if (ipd->snap_to == SCE_SNAP_MODE_NONE) {
|
||||
ipd->snap_to = tool_settings->snap_mode;
|
||||
ipd->snap_to = SCE_SNAP_MODE_GEOM;
|
||||
}
|
||||
|
||||
plane_from_point_normal_v3(ipd->step[0].plane, ipd->co_src, ipd->matrix_orient[plane_axis]);
|
||||
|
|
|
@ -658,9 +658,14 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
|||
t->flag |= T_NO_CURSOR_WRAP;
|
||||
}
|
||||
|
||||
if (op && (t->flag & T_MODAL) &&
|
||||
(prop = RNA_struct_find_property(op->ptr, "allow_navigation")) &&
|
||||
RNA_property_boolean_get(op->ptr, prop))
|
||||
if (op && (t->flag & T_MODAL) && !(t->flag & T_RELEASE_CONFIRM) &&
|
||||
ELEM(t->mode,
|
||||
TFM_TRANSLATION,
|
||||
TFM_RESIZE,
|
||||
TFM_ROTATION,
|
||||
TFM_SHRINKFATTEN,
|
||||
TFM_EDGE_SLIDE,
|
||||
TFM_VERT_SLIDE))
|
||||
{
|
||||
t->vod = ED_view3d_navigation_init(C);
|
||||
}
|
||||
|
|
|
@ -793,15 +793,6 @@ void Transform_Properties(wmOperatorType *ot, int flags)
|
|||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
if (flags & P_VIEW3D_NAVIGATION) {
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"allow_navigation",
|
||||
0,
|
||||
"Allow Navigation",
|
||||
"Allow navigation while transforming");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
if (flags & P_POST_TRANSFORM) {
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"use_automerge_and_split",
|
||||
|
@ -836,7 +827,7 @@ static void TRANSFORM_OT_translate(wmOperatorType *ot)
|
|||
Transform_Properties(ot,
|
||||
P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP |
|
||||
P_OPTIONS | P_GPENCIL_EDIT | P_CURSOR_EDIT | P_VIEW2D_EDGE_PAN |
|
||||
P_VIEW3D_NAVIGATION | P_POST_TRANSFORM);
|
||||
P_POST_TRANSFORM);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_resize(wmOperatorType *ot)
|
||||
|
@ -875,7 +866,7 @@ static void TRANSFORM_OT_resize(wmOperatorType *ot)
|
|||
|
||||
Transform_Properties(ot,
|
||||
P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP |
|
||||
P_OPTIONS | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_NAVIGATION);
|
||||
P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_skin_resize(wmOperatorType *ot)
|
||||
|
@ -952,7 +943,7 @@ static void TRANSFORM_OT_rotate(wmOperatorType *ot)
|
|||
|
||||
Transform_Properties(ot,
|
||||
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
|
||||
P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_NAVIGATION);
|
||||
P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_tilt(wmOperatorType *ot)
|
||||
|
@ -1091,7 +1082,7 @@ static void TRANSFORM_OT_shrink_fatten(wmOperatorType *ot)
|
|||
|
||||
WM_operatortype_props_advanced_begin(ot);
|
||||
|
||||
Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_VIEW3D_NAVIGATION);
|
||||
Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_tosphere(wmOperatorType *ot)
|
||||
|
@ -1197,7 +1188,7 @@ static void TRANSFORM_OT_edge_slide(wmOperatorType *ot)
|
|||
"When Even mode is active, flips between the two adjacent edge loops");
|
||||
RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
|
||||
|
||||
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV | P_VIEW3D_NAVIGATION);
|
||||
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_vert_slide(wmOperatorType *ot)
|
||||
|
@ -1232,7 +1223,7 @@ static void TRANSFORM_OT_vert_slide(wmOperatorType *ot)
|
|||
"When Even mode is active, flips between the two adjacent edge loops");
|
||||
RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
|
||||
|
||||
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV | P_VIEW3D_NAVIGATION);
|
||||
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_edge_crease(wmOperatorType *ot)
|
||||
|
@ -1380,8 +1371,7 @@ static void TRANSFORM_OT_transform(wmOperatorType *ot)
|
|||
|
||||
Transform_Properties(ot,
|
||||
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
|
||||
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_NAVIGATION |
|
||||
P_POST_TRANSFORM);
|
||||
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_POST_TRANSFORM);
|
||||
}
|
||||
|
||||
static int transform_from_gizmo_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
||||
|
|
|
@ -546,7 +546,7 @@ void resetSnapping(TransInfo *t)
|
|||
t->tsnap.snapElem = SCE_SNAP_MODE_NONE;
|
||||
t->tsnap.mode = SCE_SNAP_MODE_NONE;
|
||||
t->tsnap.target_operation = SCE_SNAP_TARGET_ALL;
|
||||
t->tsnap.source_operation = SCE_SNAP_SOURCE_CLOSEST;
|
||||
t->tsnap.source_operation = SCE_SNAP_SOURCE_MEDIAN;
|
||||
t->tsnap.last = 0;
|
||||
|
||||
t->tsnap.snapNormal[0] = 0;
|
||||
|
@ -948,9 +948,6 @@ static void setSnappingCallback(TransInfo *t)
|
|||
}
|
||||
|
||||
switch (t->tsnap.source_operation) {
|
||||
case SCE_SNAP_SOURCE_CLOSEST:
|
||||
t->tsnap.snap_source_fn = snap_source_closest_fn;
|
||||
break;
|
||||
case SCE_SNAP_SOURCE_CENTER:
|
||||
if (!ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
|
||||
t->tsnap.snap_source_fn = snap_source_center_fn;
|
||||
|
@ -1285,96 +1282,6 @@ static void snap_source_median_fn(TransInfo *t)
|
|||
}
|
||||
}
|
||||
|
||||
static void snap_source_closest_fn(TransInfo *t)
|
||||
{
|
||||
/* Only valid if a snap point has been selected. */
|
||||
if (t->tsnap.status & SNAP_TARGET_FOUND) {
|
||||
float dist_closest = 0.0f;
|
||||
TransData *closest = nullptr;
|
||||
|
||||
/* Object mode */
|
||||
if (t->options & CTX_OBJECT) {
|
||||
int i;
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
TransData *td;
|
||||
for (td = tc->data, i = 0; i < tc->data_len && td->flag & TD_SELECTED; i++, td++) {
|
||||
const BoundBox *bb = nullptr;
|
||||
|
||||
if ((t->options & CTX_OBMODE_XFORM_OBDATA) == 0) {
|
||||
bb = BKE_object_boundbox_get(td->ob);
|
||||
}
|
||||
|
||||
/* use boundbox if possible */
|
||||
if (bb) {
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
float loc[3];
|
||||
float dist;
|
||||
|
||||
copy_v3_v3(loc, bb->vec[j]);
|
||||
mul_m4_v3(td->ext->obmat, loc);
|
||||
|
||||
dist = t->mode_info->snap_distance_fn(t, loc, t->tsnap.snap_target);
|
||||
|
||||
if ((dist != TRANSFORM_DIST_INVALID) &&
|
||||
(closest == nullptr || fabsf(dist) < fabsf(dist_closest))) {
|
||||
copy_v3_v3(t->tsnap.snap_source, loc);
|
||||
closest = td;
|
||||
dist_closest = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* use element center otherwise */
|
||||
else {
|
||||
float loc[3];
|
||||
float dist;
|
||||
|
||||
copy_v3_v3(loc, td->center);
|
||||
|
||||
dist = t->mode_info->snap_distance_fn(t, loc, t->tsnap.snap_target);
|
||||
|
||||
if ((dist != TRANSFORM_DIST_INVALID) &&
|
||||
(closest == nullptr || fabsf(dist) < fabsf(dist_closest))) {
|
||||
copy_v3_v3(t->tsnap.snap_source, loc);
|
||||
closest = td;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
TransData *td = tc->data;
|
||||
int i;
|
||||
for (i = 0; i < tc->data_len && td->flag & TD_SELECTED; i++, td++) {
|
||||
float loc[3];
|
||||
float dist;
|
||||
|
||||
copy_v3_v3(loc, td->center);
|
||||
|
||||
if (tc->use_local_mat) {
|
||||
mul_m4_v3(tc->mat, loc);
|
||||
}
|
||||
|
||||
dist = t->mode_info->snap_distance_fn(t, loc, t->tsnap.snap_target);
|
||||
|
||||
if ((dist != TRANSFORM_DIST_INVALID) &&
|
||||
(closest == nullptr || fabsf(dist) < fabsf(dist_closest))) {
|
||||
copy_v3_v3(t->tsnap.snap_source, loc);
|
||||
closest = td;
|
||||
dist_closest = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TargetSnapOffset(t, closest);
|
||||
|
||||
t->tsnap.status |= SNAP_SOURCE_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -336,11 +336,11 @@
|
|||
.autokey_mode = AUTOKEY_MODE_NORMAL, \
|
||||
\
|
||||
.transform_pivot_point = V3D_AROUND_CENTER_MEDIAN, \
|
||||
.snap_mode = SCE_SNAP_MODE_INCREMENT, \
|
||||
.snap_mode = SCE_SNAP_MODE_GEOM, \
|
||||
.snap_node_mode = SCE_SNAP_MODE_GRID, \
|
||||
.snap_uv_mode = SCE_SNAP_MODE_INCREMENT, \
|
||||
.snap_flag = SCE_SNAP_TO_INCLUDE_EDITED | SCE_SNAP_TO_INCLUDE_NONEDITED, \
|
||||
.snap_transform_mode_flag = SCE_SNAP_TRANSFORM_MODE_TRANSLATE, \
|
||||
.snap_transform_mode_flag = (SCE_SNAP_TRANSFORM_MODE_TRANSLATE | SCE_SNAP_TRANSFORM_MODE_ROTATE |SCE_SNAP_TRANSFORM_MODE_SCALE), \
|
||||
.snap_face_nearest_steps = 1, \
|
||||
\
|
||||
.curve_paint_settings = _DNA_DEFAULTS_CurvePaintSettings, \
|
||||
|
@ -370,7 +370,6 @@
|
|||
.uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN, \
|
||||
\
|
||||
/* Placement */ \
|
||||
.snap_mode_tools = SCE_SNAP_MODE_GEOM,\
|
||||
.plane_axis = 2,\
|
||||
}
|
||||
|
||||
|
|
|
@ -1697,12 +1697,11 @@ typedef struct ToolSettings {
|
|||
|
||||
struct SequencerToolSettings *sequencer_tool_settings;
|
||||
|
||||
short snap_mode_tools; /* If SCE_SNAP_MODE_NONE, use #ToolSettings::snap_mode. #eSnapMode. */
|
||||
char plane_axis; /* X, Y or Z. */
|
||||
char plane_depth; /* #eV3DPlaceDepth. */
|
||||
char plane_orient; /* #eV3DPlaceOrient. */
|
||||
char plane_axis; /* X, Y or Z. */
|
||||
char plane_depth; /* #eV3DPlaceDepth. */
|
||||
char plane_orient; /* #eV3DPlaceOrient. */
|
||||
char use_plane_axis_auto;
|
||||
char _pad7[2];
|
||||
char _pad7[4];
|
||||
|
||||
} ToolSettings;
|
||||
|
||||
|
@ -2273,10 +2272,9 @@ ENUM_OPERATORS(eSnapFlag, SCE_SNAP_BACKFACE_CULLING)
|
|||
|
||||
/** See #ToolSettings.snap_target (to be renamed `snap_source`) and #TransSnap.source_operation */
|
||||
typedef enum eSnapSourceOP {
|
||||
SCE_SNAP_SOURCE_CLOSEST = 0,
|
||||
SCE_SNAP_SOURCE_MEDIAN = 0,
|
||||
SCE_SNAP_SOURCE_CENTER = 1,
|
||||
SCE_SNAP_SOURCE_MEDIAN = 2,
|
||||
SCE_SNAP_SOURCE_ACTIVE = 3,
|
||||
SCE_SNAP_SOURCE_ACTIVE = 2,
|
||||
} eSnapSourceOP;
|
||||
|
||||
ENUM_OPERATORS(eSnapSourceOP, SCE_SNAP_SOURCE_ACTIVE)
|
||||
|
|
|
@ -100,7 +100,6 @@ static const EnumPropertyItem uv_sculpt_relaxation_items[] = {
|
|||
#endif
|
||||
|
||||
const EnumPropertyItem rna_enum_snap_source_items[] = {
|
||||
{SCE_SNAP_SOURCE_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
|
||||
{SCE_SNAP_SOURCE_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
|
||||
{SCE_SNAP_SOURCE_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
|
||||
{SCE_SNAP_SOURCE_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
|
||||
|
@ -156,10 +155,10 @@ const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[] = {
|
|||
{SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments"}, \
|
||||
{SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, \
|
||||
{SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"}, \
|
||||
{SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap by projecting onto faces"}, \
|
||||
{SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"}, \
|
||||
{SCE_SNAP_MODE_EDGE_MIDPOINT, "EDGE_MIDPOINT", ICON_SNAP_MIDPOINT, "Edge Center", "Snap to the middle of edges"}, \
|
||||
{SCE_SNAP_MODE_EDGE_PERPENDICULAR, "EDGE_PERPENDICULAR", ICON_SNAP_PERPENDICULAR, "Edge Perpendicular", "Snap to the nearest point on an edge"}
|
||||
{SCE_SNAP_MODE_EDGE_PERPENDICULAR, "EDGE_PERPENDICULAR", ICON_SNAP_PERPENDICULAR, "Edge Perpendicular", "Snap to the nearest point on an edge"}, \
|
||||
{SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap by projecting onto faces"}, \
|
||||
{SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"}
|
||||
/* clang-format on */
|
||||
|
||||
const EnumPropertyItem rna_enum_snap_element_items[] = {
|
||||
|
@ -678,12 +677,6 @@ static const EnumPropertyItem plane_orientation_items[] = {
|
|||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem snap_to_items[] = {
|
||||
{SCE_SNAP_MODE_GEOM, "GEOMETRY", 0, "Geometry", "Snap to all geometry"},
|
||||
{SCE_SNAP_MODE_NONE, "DEFAULT", 0, "Default", "Use the current snap settings"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
# include "BLI_string_utils.h"
|
||||
|
@ -3413,6 +3406,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
RNA_def_property_enum_funcs(
|
||||
prop, "rna_ToolSettings_snap_mode_get", "rna_ToolSettings_snap_mode_set", NULL);
|
||||
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
|
||||
RNA_def_property_enum_default(prop, SCE_SNAP_MODE_GEOM);
|
||||
RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
|
||||
|
||||
|
@ -3528,7 +3522,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE);
|
||||
RNA_def_property_boolean_default(prop, false);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Snap for Rotation", "Rotate is affected by the snapping settings");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
|
||||
|
@ -3536,7 +3529,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE);
|
||||
RNA_def_property_boolean_default(prop, false);
|
||||
RNA_def_property_ui_text(prop, "Use Snap for Scale", "Scale is affected by snapping settings");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
|
||||
|
||||
|
@ -3566,12 +3558,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
RNA_def_property_enum_default(prop, V3D_PLACE_ORIENT_SURFACE);
|
||||
RNA_def_property_ui_text(prop, "Orientation", "The initial depth used when placing the cursor");
|
||||
|
||||
prop = RNA_def_property(srna, "snap_elements_tool", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "snap_mode_tools");
|
||||
RNA_def_property_enum_items(prop, snap_to_items);
|
||||
RNA_def_property_enum_default(prop, SCE_SNAP_MODE_GEOM);
|
||||
RNA_def_property_ui_text(prop, "Snap to", "The target to use while snapping");
|
||||
|
||||
/* Grease Pencil */
|
||||
prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
|
||||
|
|
Loading…
Reference in New Issue