Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-28 22:45:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-28 22:45:17 +0400
commit2ad45b5c4f54765ad8804d26dd28b1eca2c235e5 (patch)
tree908bbba4c048936c779d8b143895636ac79b1a29 /source/blender/editors/interface/interface_ops.c
parent4ea3f1cc29b86f0464553c9da05d9f483b7da134 (diff)
fix 2 bugs with reset-default failing on operators redo panel.
- The operator its self was registered so resetting the defaults would unhelpfully replace the toolbar with the reset to defaults operator panel. - The callback for the operator wasnt being used so the settings were changed but the operator didnt re-run.
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r--source/blender/editors/interface/interface_ops.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index fd9386dc5ab..ea7e8fb81bc 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -295,10 +295,31 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
if(RNA_property_reset(&ptr, prop, (all)? -1: index)) {
/* perform updates required for this property */
RNA_property_update(C, &ptr, prop);
+
+ /* as if we pressed the button */
+ uiContextActivePropertyHandle(C);
+
success= 1;
}
}
-
+
+ /* Since we dont want to undo _all_ edits to settings, eg window
+ * edits on the screen or on operator settings.
+ * it might be better to move undo's inline - campbell */
+ /* Note that buttons already account for this, it might be better to
+ * have a way to edit the buttons rather than set the rna since block
+ * callbacks also fail to run. */
+ if(success) {
+ ID *id= ptr.id.data;
+ if(id && ID_CHECK_UNDO(id)) {
+ /* do nothing, go ahead with undo */
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
+ }
+ /* end hack */
+
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
@@ -314,7 +335,7 @@ static void UI_OT_reset_default_button(wmOperatorType *ot)
ot->exec= reset_default_button_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag= OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");