Tool System: store operator properties in the tool

This replaces last-used property use which wasn't reliable since
properties were not considered 'set' - causing them to be ignored.
This commit is contained in:
2018-05-22 14:00:44 +02:00
parent 298f8042ef
commit 96a7ed8a15
11 changed files with 140 additions and 31 deletions

View File

@@ -293,9 +293,9 @@ class _defs_edit_mesh:
@ToolDef.from_fn
def rip_region():
def draw_settings(context, layout):
def draw_settings(context, layout, tool):
wm = context.window_manager
props = wm.operator_properties_last("mesh.rip_move")
props = tool.operator_properties("mesh.rip_move")
props_macro = props.MESH_OT_rip
layout.prop(props_macro, "use_fill")
@@ -393,9 +393,9 @@ class _defs_edit_mesh:
@ToolDef.from_fn
def inset():
def draw_settings(context, layout):
def draw_settings(context, layout, tool):
wm = context.window_manager
props = wm.operator_properties_last("mesh.inset")
props = tool.operator_properties("mesh.inset")
layout.prop(props, "use_outset")
layout.prop(props, "use_individual")
layout.prop(props, "use_even_offset")
@@ -507,9 +507,9 @@ class _defs_edit_mesh:
@ToolDef.from_fn
def shrink_fatten():
def draw_settings(context, layout):
def draw_settings(context, layout, tool):
wm = context.window_manager
props = wm.operator_properties_last("transform.shrink_fatten")
props = tool.operator_properties("transform.shrink_fatten")
layout.prop(props, "use_even_offset")
return dict(
@@ -537,9 +537,9 @@ class _defs_edit_mesh:
@ToolDef.from_fn
def knife():
def draw_settings(context, layout):
def draw_settings(context, layout, tool):
wm = context.window_manager
props = wm.operator_properties_last("mesh.knife_tool")
props = tool.operator_properties("mesh.knife_tool")
layout.prop(props, "use_occlude_geometry")
layout.prop(props, "only_selected")
@@ -573,7 +573,7 @@ class _defs_edit_curve:
@ToolDef.from_fn
def draw():
def draw_settings(context, layout):
def draw_settings(context, layout, tool):
# Tool settings initialize operator options.
tool_settings = context.tool_settings
cps = tool_settings.curve_paint_settings
@@ -765,9 +765,9 @@ class _defs_weight_paint:
@ToolDef.from_fn
def gradient():
def draw_settings(context, layout):
def draw_settings(context, layout, tool):
wm = context.window_manager
props = wm.operator_properties_last("paint.weight_gradient")
props = tool.operator_properties("paint.weight_gradient")
layout.prop(props, "type")
return dict(