Manipulator: add show_drag option for 2d buttons
Needed so 3d navigation buttons can show show drag cursor only for buttons with modal operators.
This commit is contained in:
@@ -206,9 +206,12 @@ static int manipulator_button2d_test_select(
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int manipulator_button2d_cursor_get(wmManipulator *UNUSED(mpr))
|
||||
static int manipulator_button2d_cursor_get(wmManipulator *mpr)
|
||||
{
|
||||
return BC_HANDCURSOR;
|
||||
if (RNA_boolean_get(mpr->ptr, "show_drag")) {
|
||||
return BC_NSEW_SCROLLCURSOR;
|
||||
}
|
||||
return CURSOR_STD;
|
||||
}
|
||||
|
||||
static void manipulator_button2d_free(wmManipulator *mpr)
|
||||
@@ -248,6 +251,9 @@ static void MANIPULATOR_WT_button_2d(wmManipulatorType *wt)
|
||||
|
||||
/* Passed to 'GPU_batch_from_poly_2d_encoded' */
|
||||
RNA_def_property(wt->srna, "shape", PROP_STRING, PROP_BYTESTRING);
|
||||
|
||||
/* Currently only used for cursor display. */
|
||||
RNA_def_boolean(wt->srna, "show_drag", true, "Show Drag", "");
|
||||
}
|
||||
|
||||
void ED_manipulatortypes_button_2d(void)
|
||||
|
||||
@@ -224,6 +224,15 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG
|
||||
RNA_enum_set(ptr, "type", RV3D_VIEW_CAMERA);
|
||||
}
|
||||
|
||||
/* Click only buttons (not modal). */
|
||||
{
|
||||
int mpr_ids[] = {MPR_PERSP, MPR_ORTHO, MPR_CAMERA};
|
||||
for (int i = 0; i < ARRAY_SIZE(mpr_ids); i++) {
|
||||
wmManipulator *mpr = navgroup->mpr_array[mpr_ids[i]];
|
||||
RNA_boolean_set(mpr->ptr, "show_drag", false);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
wmManipulator *mpr = navgroup->mpr_array[MPR_ROTATE];
|
||||
mpr->scale_basis = MANIPULATOR_SIZE / 2;
|
||||
|
||||
Reference in New Issue
Block a user