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-07-10 23:56:13 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-10 23:56:13 +0400
commit2e3e044d27e90dc87bdce6af9cef77d9543e4d89 (patch)
tree4d87ed9c283fd99baf9d23d4b8ace0868972f156 /source/blender/editors/transform/transform_ops.c
parenta95c68a3eaa692f742e7f2e626b65daa71727c17 (diff)
RNA
* Enums can now be dynamically created in the _itemf callback, using RNA_enum_item(s)_add, RNA_enum_item_end. All places asking for enum items now need to potentially free the items. * This callback now also gets context, this was added specifically for operators. This doesn't fit design well at all, needed to do some ugly hacks, but can't find a good solution at the moment. * All enums must have a default list of items too, even with an _itemf callback, for docs and fallback in case there is no context. * Used by MESH_OT_merge, MESH_OT_select_similar, TFM_OT_select_orientation. * Also changes some operator properties that were enums to booleas (unselected, deselect), to make them consistent with other ops.
Diffstat (limited to 'source/blender/editors/transform/transform_ops.c')
-rw-r--r--source/blender/editors/transform/transform_ops.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 97fb3531718..dcd34011eef 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -109,10 +109,6 @@ TransformModeItem transform_modes[] =
static int select_orientation_exec(bContext *C, wmOperator *op)
{
int orientation = RNA_enum_get(op->ptr, "orientation");
- int custom_index= RNA_int_get(op->ptr, "custom_index");;
-
- if(orientation == V3D_MANIP_CUSTOM)
- orientation += custom_index;
BIF_selectTransformOrientationValue(C, orientation);
@@ -126,20 +122,26 @@ static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event
pup= uiPupMenuBegin(C, "Orientation", 0);
layout= uiPupMenuLayout(pup);
- BIF_menuTransformOrientation(C, layout, NULL);
+ uiItemsEnumO(layout, "TFM_OT_select_orientation", "orientation");
uiPupMenuEnd(C, pup);
return OPERATOR_CANCELLED;
}
+static EnumPropertyItem *select_orientation_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ *free= 1;
+ return BIF_enumTransformOrientation(C);
+}
+
void TFM_OT_select_orientation(struct wmOperatorType *ot)
{
+ PropertyRNA *prop;
static EnumPropertyItem orientation_items[]= {
{V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""},
{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""},
{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""},
{V3D_MANIP_VIEW, "VIEW", 0, "View", ""},
- {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
@@ -151,8 +153,8 @@ void TFM_OT_select_orientation(struct wmOperatorType *ot)
ot->exec = select_orientation_exec;
ot->poll = ED_operator_areaactive;
- RNA_def_enum(ot->srna, "orientation", orientation_items, V3D_MANIP_CUSTOM, "Orientation", "DOC_BROKEN");
- RNA_def_int(ot->srna, "custom_index", 0, 0, INT_MAX, "Custom Index", "", 0, INT_MAX);
+ prop= RNA_def_enum(ot->srna, "orientation", orientation_items, V3D_MANIP_GLOBAL, "Orientation", "DOC_BROKEN");
+ RNA_def_enum_funcs(prop, select_orientation_itemf);
}
static void transformops_exit(bContext *C, wmOperator *op)