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:
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_ops.c18
-rw-r--r--source/blender/editors/transform/transform_orientations.c38
2 files changed, 39 insertions, 17 deletions
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index d77f38967b0..ee4f1b90451 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)
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 1e065de94e1..f3b373f0e48 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -59,6 +59,8 @@
#include "UI_interface.h"
+#include "RNA_define.h"
+
#include "transform.h"
/* *********************** TransSpace ************************** */
@@ -354,19 +356,37 @@ void BIF_selectTransformOrientationValue(bContext *C, int orientation) {
v3d->twmode = orientation;
}
-void BIF_menuTransformOrientation(bContext *C, uiLayout *layout, void *arg)
+EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
- TransformOrientation *ts;
- int i= V3D_MANIP_CUSTOM;
+ TransformOrientation *ts = transform_spaces->first;
+ EnumPropertyItem global = {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""};
+ EnumPropertyItem normal = {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""};
+ EnumPropertyItem local = {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""};
+ EnumPropertyItem view = {V3D_MANIP_VIEW, "VIEW", 0, "View", ""};
+ EnumPropertyItem sepr = {0, "", 0, NULL, NULL};
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ EnumPropertyItem *item= NULL;
+ int i = V3D_MANIP_CUSTOM, totitem= 0;
+
+ RNA_enum_item_add(&item, &totitem, &global);
+ RNA_enum_item_add(&item, &totitem, &normal);
+ RNA_enum_item_add(&item, &totitem, &local);
+ RNA_enum_item_add(&item, &totitem, &view);
+
+ if(ts)
+ RNA_enum_item_add(&item, &totitem, &sepr);
+
+ for(; ts; ts = ts->next) {
+ tmp.identifier = "CUSTOM";
+ tmp.name= ts->name;
+ tmp.value = i++;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_GLOBAL);
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_LOCAL);
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_NORMAL);
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_VIEW);
+ RNA_enum_item_end(&item, &totitem);
- for(ts = transform_spaces->first; ts; ts = ts->next)
- uiItemIntO(layout, ts->name, 0, "TFM_OT_select_orientation", "custom_index", i++);
+ return item;
}
char * BIF_menustringTransformOrientation(const bContext *C, char *title) {