Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Fri, 11 May 2018 18:13:07 +0000 (20:13 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 11 May 2018 18:13:07 +0000 (20:13 +0200)
release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/mesh/mesh_ops.c
source/blender/windowmanager/intern/wm_event_system.c

index f69fba9f60385ccf93f7a4909f2634dc75169f5d..7fc7f787b3f24384419e52b6e7000724a34b2e88 100644 (file)
@@ -2654,8 +2654,10 @@ class VIEW3D_MT_edit_mesh_vertices(Menu):
 
         layout.operator("mesh.merge")
         layout.operator("mesh.remove_doubles")
-        layout.operator("mesh.rip_move")
-        layout.operator("mesh.rip_move_fill")
+        props = layout.operator("mesh.rip_move")
+        props.MESH_OT_rip.use_fill = False
+        props = layout.operator("mesh.rip_move", text="Rip Fill")
+        props.MESH_OT_rip.use_fill = True
         layout.operator("mesh.rip_edge_move")
         layout.operator("mesh.split")
         layout.operator_menu_enum("mesh.separate", "type")
index dc9cd29a0af0f0bdc1b99679777f2bd69277711b..9f3ef6f958da739103d83db55af1e70057b831b4 100644 (file)
@@ -244,16 +244,6 @@ void ED_operatormacros_mesh(void)
        ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", "Rip polygons and move the result",
                                          OPTYPE_UNDO | OPTYPE_REGISTER);
        otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
-       RNA_boolean_set(otmacro->ptr, "use_fill", false);
-       otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
-       RNA_enum_set(otmacro->ptr, "proportional", 0);
-       RNA_boolean_set(otmacro->ptr, "mirror", false);
-
-       /* annoying we can't pass 'use_fill' through the macro */
-       ot = WM_operatortype_append_macro("MESH_OT_rip_move_fill", "Rip Fill", "Rip-fill polygons and move the result",
-                                         OPTYPE_UNDO | OPTYPE_REGISTER);
-       otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
-       RNA_boolean_set(otmacro->ptr, "use_fill", true);
        otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
        RNA_boolean_set(otmacro->ptr, "mirror", false);
@@ -428,8 +418,16 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 
        WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
 
-       WM_keymap_add_item(keymap, "MESH_OT_rip_move", VKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_rip_move_fill", VKEY, KM_PRESS, KM_ALT, 0);
+       kmi = WM_keymap_add_item(keymap, "MESH_OT_rip_move", VKEY, KM_PRESS, 0, 0);
+       {
+               PointerRNA macro_ptr = RNA_pointer_get(kmi->ptr, "MESH_OT_rip");
+               RNA_boolean_set(&macro_ptr, "use_fill", false);
+       }
+       kmi = WM_keymap_add_item(keymap, "MESH_OT_rip_move", VKEY, KM_PRESS, KM_ALT, 0);
+       {
+               PointerRNA macro_ptr = RNA_pointer_get(kmi->ptr, "MESH_OT_rip");
+               RNA_boolean_set(&macro_ptr, "use_fill", true);
+       }
 
        WM_keymap_add_item(keymap, "MESH_OT_rip_edge_move", DKEY, KM_PRESS, KM_ALT, 0);
 
index f0bd033f0336c59284e22814a31f12ef5828edb4..b141433a58f01fc961489d3455b05374b03919d5 100644 (file)
@@ -1130,48 +1130,60 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
 }
 
 #if 1 /* may want to disable operator remembering previous state for testing */
-bool WM_operator_last_properties_init(wmOperator *op)
+
+static bool operator_last_properties_init_impl(wmOperator *op, IDProperty *last_properties)
 {
        bool changed = false;
+       IDPropertyTemplate val = {0};
+       IDProperty *replaceprops = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
+       PropertyRNA *iterprop;
 
-       if (op->type->last_properties) {
-               IDPropertyTemplate val = {0};
-               IDProperty *replaceprops = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
-               PropertyRNA *iterprop;
-
-               CLOG_INFO(WM_LOG_OPERATORS, 1, "loading previous properties for '%s'", op->type->idname);
+       CLOG_INFO(WM_LOG_OPERATORS, 1, "loading previous properties for '%s'", op->type->idname);
 
-               iterprop = RNA_struct_iterator_property(op->type->srna);
+       iterprop = RNA_struct_iterator_property(op->type->srna);
 
-               RNA_PROP_BEGIN (op->ptr, itemptr, iterprop)
-               {
-                       PropertyRNA *prop = itemptr.data;
-                       if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
-                               if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
-                                       const char *identifier = RNA_property_identifier(prop);
-                                       IDProperty *idp_src = IDP_GetPropertyFromGroup(op->type->last_properties, identifier);
-                                       if (idp_src) {
-                                               IDProperty *idp_dst = IDP_CopyProperty(idp_src);
-
-                                               /* note - in the future this may need to be done recursively,
-                                                * but for now RNA doesn't access nested operators */
-                                               idp_dst->flag |= IDP_FLAG_GHOST;
-
-                                               /* add to temporary group instead of immediate replace,
-                                                * because we are iterating over this group */
-                                               IDP_AddToGroup(replaceprops, idp_dst);
-                                               changed = true;
-                                       }
+       RNA_PROP_BEGIN (op->ptr, itemptr, iterprop)
+       {
+               PropertyRNA *prop = itemptr.data;
+               if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
+                       if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
+                               const char *identifier = RNA_property_identifier(prop);
+                               IDProperty *idp_src = IDP_GetPropertyFromGroup(last_properties, identifier);
+                               if (idp_src) {
+                                       IDProperty *idp_dst = IDP_CopyProperty(idp_src);
+
+                                       /* note - in the future this may need to be done recursively,
+                                        * but for now RNA doesn't access nested operators */
+                                       idp_dst->flag |= IDP_FLAG_GHOST;
+
+                                       /* add to temporary group instead of immediate replace,
+                                        * because we are iterating over this group */
+                                       IDP_AddToGroup(replaceprops, idp_dst);
+                                       changed = true;
                                }
                        }
                }
-               RNA_PROP_END;
-
-               IDP_MergeGroup(op->properties, replaceprops, true);
-               IDP_FreeProperty(replaceprops);
-               MEM_freeN(replaceprops);
        }
+       RNA_PROP_END;
+
+       IDP_MergeGroup(op->properties, replaceprops, true);
+       IDP_FreeProperty(replaceprops);
+       MEM_freeN(replaceprops);
+       return changed;
+}
 
+bool WM_operator_last_properties_init(wmOperator *op)
+{
+       bool changed = false;
+       if (op->type->last_properties) {
+               changed |= operator_last_properties_init_impl(op, op->type->last_properties);
+               for (wmOperator *opm = op->macro.first; opm; opm = opm->next) {
+                       IDProperty *idp_src = IDP_GetPropertyFromGroup(op->type->last_properties, opm->idname);
+                       if (idp_src) {
+                               changed |= operator_last_properties_init_impl(opm, idp_src);
+                       }
+               }
+       }
        return changed;
 }