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>2009-01-17 02:53:11 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-17 02:53:11 +0300
commitc1cf33c8aa1d9fd5f8d36231f4a28da63ce0e5e0 (patch)
treeeab94699866be5af61bc8c847f5aa222d21e50d1 /source/blender/editors/space_node/node_state.c
parentef93f8a36e39a67f5d25b0332a6d40e261a6d793 (diff)
RNA
* Added more compact property definitions, with a single function. Only used by operators at the moment, would need to tweak regular expressions a bit more to use it also for other RNA definitions. * The operator properties defined now were completed a bit more but still have many issues that need to be adressed, specifically; * Some properties that should be booleans or enums are defined as ints, note that ints are only for numeric values, not bitflags or multiple choice. * Soft/hard limits and default values of many properties are not well defined still, * Inconsistent naming, especially for example mouse locations or bounds are named differently in different places. Also mouse locations and other vector like properties should become a single vector property instead of multiple X/Y properties. * Almost no properties have descriptions, these would be good to have for docs and tooltips. So, please verify that the properties of the operators you wrote are well defined.
Diffstat (limited to 'source/blender/editors/space_node/node_state.c')
-rw-r--r--source/blender/editors/space_node/node_state.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 3472cc77dcd..ea1d3e74305 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -158,8 +158,8 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
short mval[2];
- mval[0] = RNA_int_get(op->ptr, "mx");
- mval[1] = RNA_int_get(op->ptr, "my");
+ mval[0] = RNA_int_get(op->ptr, "mouse_x");
+ mval[1] = RNA_int_get(op->ptr, "mouse_y");
node_toggle_visibility(snode, ar, mval);
return OPERATOR_FINISHED;
@@ -173,16 +173,14 @@ static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *e
mval[0]= event->x - ar->winrct.xmin;
mval[1]= event->y - ar->winrct.ymin;
- RNA_int_set(op->ptr, "mx", mval[0]);
- RNA_int_set(op->ptr, "my", mval[1]);
+ RNA_int_set(op->ptr, "mouse_x", mval[0]);
+ RNA_int_set(op->ptr, "mouse_y", mval[1]);
return node_toggle_visibility_exec(C,op);
}
void NODE_OT_toggle_visibility(wmOperatorType *ot)
{
- PropertyRNA *prop;
-
/* identifiers */
ot->name= "Toggle Visibility";
ot->idname= "NODE_OT_toggle_visibility";
@@ -191,8 +189,8 @@ void NODE_OT_toggle_visibility(wmOperatorType *ot)
ot->invoke= node_toggle_visibility_invoke;
ot->poll= ED_operator_node_active;
- prop = RNA_def_property(ot->srna, "mx", PROP_INT, PROP_NONE);
- prop = RNA_def_property(ot->srna, "my", PROP_INT, PROP_NONE);
+ RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "mouse_y", 0, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX);
}
static int node_fit_all_exec(bContext *C, wmOperator *op)
@@ -214,4 +212,4 @@ void NODE_OT_fit_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= node_fit_all_exec;
ot->poll= ED_operator_node_active;
-} \ No newline at end of file
+}