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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-09 19:54:25 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-09 19:54:25 +0400
commit369f5b79eada9b119d191a730301e977612048c0 (patch)
tree7eac4d69a31da879ae13401da66863a617138742 /source/blender/editors/interface/interface_ops.c
parent686fe23c9dfa11e978f21419fb0ea255b8b9054f (diff)
Fix #31371: copy data path should be disabled in places where it doesn't work,
like the user preferences. Also renamed "View Docs" menu entry to "Python Documentation".
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r--source/blender/editors/interface/interface_ops.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index aaca5181531..6d2ac388374 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -234,12 +234,32 @@ static void UI_OT_reset_default_theme(wmOperatorType *ot)
/* Copy Data Path Operator ------------------------ */
+static int copy_data_path_button_poll(bContext *C)
+{
+ PointerRNA ptr;
+ PropertyRNA *prop;
+ char *path;
+ int index;
+
+ uiContextActiveProperty(C, &ptr, &prop, &index);
+
+ if (ptr.id.data && ptr.data && prop) {
+ path = RNA_path_from_ID_to_property(&ptr, prop);
+
+ if (path) {
+ MEM_freeN(path);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop;
char *path;
- int success = 0;
int index;
/* try to create driver using property retrieved from UI */
@@ -251,11 +271,11 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
if (path) {
WM_clipboard_text_set(path, FALSE);
MEM_freeN(path);
+ return OPERATOR_FINISHED;
}
}
- /* since we're just copying, we don't really need to do anything else...*/
- return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ return OPERATOR_CANCELLED;
}
static void UI_OT_copy_data_path_button(wmOperatorType *ot)
@@ -267,7 +287,7 @@ static void UI_OT_copy_data_path_button(wmOperatorType *ot)
/* callbacks */
ot->exec = copy_data_path_button_exec;
- //op->poll= ??? // TODO: need to have some valid property before this can be done
+ ot->poll = copy_data_path_button_poll;
/* flags */
ot->flag = OPTYPE_REGISTER;