Manipulator: add optional properties argument

Needed for RNA/Py API
This commit is contained in:
Campbell Barton
2017-06-26 08:19:55 +10:00
parent 3c7355b3a2
commit 70b5cec5fa
4 changed files with 13 additions and 6 deletions

View File

@@ -1228,7 +1228,7 @@ static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulat
if (ot_store.translate == NULL) {
ot_store.translate = WM_operatortype_find("TRANSFORM_OT_translate", true);
}
ptr = WM_manipulator_set_operator(axis, ot_store.translate);
ptr = WM_manipulator_set_operator(axis, ot_store.translate, NULL);
break;
case MAN_AXES_ROTATE:
{
@@ -1245,7 +1245,7 @@ static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulat
}
ot_rotate = ot_store.rotate;
}
ptr = WM_manipulator_set_operator(axis, ot_rotate);
ptr = WM_manipulator_set_operator(axis, ot_rotate, NULL);
break;
}
case MAN_AXES_SCALE:
@@ -1253,7 +1253,7 @@ static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulat
if (ot_store.resize == NULL) {
ot_store.resize = WM_operatortype_find("TRANSFORM_OT_resize", true);
}
ptr = WM_manipulator_set_operator(axis, ot_store.resize);
ptr = WM_manipulator_set_operator(axis, ot_store.resize, NULL);
break;
}
}

View File

@@ -205,7 +205,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator
WM_manipulator_set_color_highlight(axis, col_hi);
/* assign operator */
PointerRNA *ptr = WM_manipulator_set_operator(axis, ot_translate);
PointerRNA *ptr = WM_manipulator_set_operator(axis, ot_translate, NULL);
int constraint[3] = {0.0f};
constraint[(axis_idx + 1) % 2] = 1;
if (RNA_struct_find_property(ptr, "constraint_axis"))

View File

@@ -38,6 +38,7 @@
struct ARegion;
struct GHashIterator;
struct IDProperty;
struct Main;
struct PropertyRNA;
struct wmKeyConfig;
@@ -66,7 +67,8 @@ void WM_manipulator_free(
ListBase *manipulatorlist, struct wmManipulatorMap *mmap, struct wmManipulator *mpr,
struct bContext *C);
struct PointerRNA *WM_manipulator_set_operator(struct wmManipulator *, struct wmOperatorType *ot);
struct PointerRNA *WM_manipulator_set_operator(
struct wmManipulator *, struct wmOperatorType *ot, struct IDProperty *properties);
/* callbacks */
void WM_manipulator_set_fn_custom_modal(struct wmManipulator *mpr, wmManipulatorFnModal fn);

View File

@@ -232,7 +232,8 @@ void WM_manipulator_free(ListBase *manipulatorlist, wmManipulatorMap *mmap, wmMa
* \{ */
PointerRNA *WM_manipulator_set_operator(wmManipulator *mpr, wmOperatorType *ot)
PointerRNA *WM_manipulator_set_operator(
wmManipulator *mpr, wmOperatorType *ot, IDProperty *properties)
{
mpr->op_data.type = ot;
@@ -241,6 +242,10 @@ PointerRNA *WM_manipulator_set_operator(wmManipulator *mpr, wmOperatorType *ot)
}
WM_operator_properties_create_ptr(&mpr->op_data.ptr, ot);
if (properties) {
mpr->op_data.ptr.data = properties;
}
return &mpr->op_data.ptr;
}