Merge branch 'blender2.8' of git.blender.org:blender into blender2.8

This commit is contained in:
Jeroen Bakker 2018-04-20 16:42:33 +02:00
commit 4bfb6d21df
18 changed files with 135 additions and 159 deletions

View File

@ -53,11 +53,11 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
# for reuse
_tools_transform = (
("Translate", None,
("Translate", "TRANSFORM_WGT_manipulator",
(("transform.translate", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),)),
("Rotate", None,
("Rotate", "TRANSFORM_WGT_manipulator",
(("transform.rotate", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),)),
("Scale", None,
("Scale", "TRANSFORM_WGT_manipulator",
(("transform.resize", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),)),
("Scale Cage", "VIEW3D_WGT_xform_cage", None),
None,

View File

@ -7347,8 +7347,6 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
}
/* this was not initialized correct always */
if (v3d->twtype == 0)
v3d->twtype = V3D_MANIP_TRANSLATE;
if (v3d->gridsubdiv == 0)
v3d->gridsubdiv = 10;
}

View File

@ -1300,7 +1300,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
if (main->versionfile <= 236) {
Object *ob;
Camera *cam = main->camera.first;
bScreen *sc;
while (cam) {
if (cam->ortho_scale == 0.0f) {
@ -1310,22 +1309,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
}
cam = cam->id.next;
}
/* set manipulator type */
/* force oops draw if depgraph was set*/
/* set time line var */
for (sc = main->screen.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *) sl;
if (v3d->twtype == 0)
v3d->twtype = V3D_MANIP_TRANSLATE;
}
}
}
}
/* softbody init new vars */
for (ob = main->object.first; ob; ob = ob->id.next) {

View File

@ -87,7 +87,7 @@ typedef struct {
float mcenter[2];
BMBackup mesh_backup;
void *draw_handle_pixel;
short twtype;
short twflag;
short value_mode; /* Which value does mouse movement and numeric input affect? */
float segments; /* Segments as float so smooth mouse pan works in small increments */
} BevelData;
@ -180,8 +180,8 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
G.moving = G_TRANSFORM_EDIT;
if (v3d) {
opdata->twtype = v3d->twtype;
v3d->twtype = 0;
opdata->twflag = v3d->twflag;
v3d->twflag = 0;
}
}
@ -254,7 +254,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
EDBM_redo_state_free(&opdata->mesh_backup, NULL, false);
ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel);
if (v3d) {
v3d->twtype = opdata->twtype;
v3d->twflag = opdata->twflag;
}
G.moving = 0;
}

View File

@ -70,7 +70,7 @@ typedef struct {
/* modal only */
BMBackup mesh_backup;
bool is_first;
short twtype;
short twflag;
} BisectData;
static bool mesh_bisect_interactive_calc(
@ -156,8 +156,8 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* misc other vars */
G.moving = G_TRANSFORM_EDIT;
opdata->twtype = v3d->twtype;
v3d->twtype = 0;
opdata->twflag = v3d->twflag;
v3d->twflag = 0;
/* initialize modal callout */
ED_area_headerprint(CTX_wm_area(C), IFACE_("LMB: Click and drag to draw cut line"));
@ -169,7 +169,7 @@ static void edbm_bisect_exit(bContext *C, BisectData *opdata)
{
View3D *v3d = CTX_wm_view3d(C);
EDBM_redo_state_free(&opdata->mesh_backup, NULL, false);
v3d->twtype = opdata->twtype;
v3d->twflag = opdata->twflag;
G.moving = 0;
}
@ -199,7 +199,7 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Setup manipulators */
{
View3D *v3d = CTX_wm_view3d(C);
if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) {
if (v3d && (v3d->twflag & V3D_MANIPULATOR_DRAW)) {
WM_manipulator_group_type_ensure("MESH_WGT_bisect");
}
}

View File

@ -839,7 +839,7 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
#ifdef USE_MANIPULATOR
if (ret & OPERATOR_FINISHED) {
/* Setup manipulators */
if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) {
if (v3d && (v3d->twflag & V3D_MANIPULATOR_DRAW)) {
WM_manipulator_group_type_ensure("MESH_WGT_spin");
}
}

View File

@ -72,7 +72,7 @@ typedef struct {
float mcenter[2];
BMBackup mesh_backup;
void *draw_handle_pixel;
short twtype;
short twflag;
} InsetData;
@ -152,8 +152,8 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
G.moving = G_TRANSFORM_EDIT;
if (v3d) {
opdata->twtype = v3d->twtype;
v3d->twtype = 0;
opdata->twflag = v3d->twflag;
v3d->twflag = 0;
}
}
@ -173,7 +173,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
EDBM_redo_state_free(&opdata->mesh_backup, NULL, false);
ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel);
if (v3d) {
v3d->twtype = opdata->twtype;
v3d->twflag = opdata->twflag;
}
G.moving = 0;
}

View File

@ -343,7 +343,6 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->far = 1000.0f;
v3d->twflag |= U.manipulator_flag & V3D_MANIPULATOR_DRAW;
v3d->twtype = V3D_MANIP_TRANSLATE;
v3d->around = V3D_AROUND_CENTER_MEAN;
scene->orientation_index_custom = -1;
@ -707,7 +706,6 @@ static void view3d_widgets(void)
wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(
&(const struct wmManipulatorMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW});
WM_manipulatorgrouptype_append_and_link(mmap_type, TRANSFORM_WGT_manipulator);
WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_spot);
WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_area);
WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_target);
@ -717,6 +715,7 @@ static void view3d_widgets(void)
WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_empty_image);
WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_armature_spline);
WM_manipulatorgrouptype_append(TRANSFORM_WGT_manipulator);
WM_manipulatorgrouptype_append(VIEW3D_WGT_xform_cage);
WM_manipulatorgrouptype_append(VIEW3D_WGT_ruler);

View File

@ -4632,52 +4632,6 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Enable Transform Manipulator Operator
* \{ */
static int enable_manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
View3D *v3d = CTX_wm_view3d(C);
v3d->twtype = 0;
if (RNA_boolean_get(op->ptr, "translate"))
v3d->twtype |= V3D_MANIP_TRANSLATE;
if (RNA_boolean_get(op->ptr, "rotate"))
v3d->twtype |= V3D_MANIP_ROTATE;
if (RNA_boolean_get(op->ptr, "scale"))
v3d->twtype |= V3D_MANIP_SCALE;
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
}
void VIEW3D_OT_enable_manipulator(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name = "Enable 3D Manipulator";
ot->description = "Enable the transform manipulator for use";
ot->idname = "VIEW3D_OT_enable_manipulator";
/* api callbacks */
ot->invoke = enable_manipulator_invoke;
ot->poll = ED_operator_view3d_active;
/* properties */
prop = RNA_def_boolean(ot->srna, "translate", 0, "Translate", "Enable the translate manipulator");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "rotate", 0, "Rotate", "Enable the rotate manipulator");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "scale", 0, "Scale", "Enable the scale manipulator");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Toggle Render Shading Operator
* \{ */

View File

@ -336,9 +336,6 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* Transform widget / manipulators */
row = uiLayoutRow(layout, true);
uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (v3d->twflag & V3D_MANIPULATOR_DRAW) {
uiItemR(row, &v3dptr, "transform_manipulators", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
uiItemR(row, &sceneptr, "transform_orientation", 0, "", ICON_NONE);
}

View File

@ -99,7 +99,6 @@ void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
void VIEW3D_OT_view_roll(struct wmOperatorType *ot);
void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
void VIEW3D_OT_cursor3d(struct wmOperatorType *ot);
void VIEW3D_OT_enable_manipulator(struct wmOperatorType *ot);
void VIEW3D_OT_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_clear_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);

View File

@ -196,7 +196,6 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_render_border);
WM_operatortype_append(VIEW3D_OT_clear_render_border);
WM_operatortype_append(VIEW3D_OT_zoom_border);
WM_operatortype_append(VIEW3D_OT_enable_manipulator);
WM_operatortype_append(VIEW3D_OT_cursor3d);
WM_operatortype_append(VIEW3D_OT_select_lasso);
WM_operatortype_append(VIEW3D_OT_select_menu);

View File

@ -497,7 +497,7 @@ typedef struct TransInfo {
short current_orientation;
TransformOrientation *custom_orientation; /* this gets used when current_orientation is V3D_MANIP_CUSTOM */
short twtype; /* backup from view3d, to restore on end */
short twflag; /* backup from view3d, to restore on end */
short prop_mode;

View File

@ -1315,8 +1315,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* turn manipulator off during transform */
if (t->flag & T_MODAL) {
t->twtype = v3d->twtype;
v3d->twtype = 0;
t->twflag = v3d->twflag;
v3d->twflag = 0;
}
if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
@ -1627,7 +1627,7 @@ void postTrans(bContext *C, TransInfo *t)
View3D *v3d = t->sa->spacedata.first;
/* restore manipulator */
if (t->flag & T_MODAL) {
v3d->twtype = t->twtype;
v3d->twflag = t->twflag;
}
}

View File

@ -155,8 +155,17 @@ enum {
MAN_AXES_SCALE,
};
/* naming from old blender we may combine. */
enum {
V3D_MANIP_TRANSLATE = 1,
V3D_MANIP_ROTATE = 2,
V3D_MANIP_SCALE = 4,
};
typedef struct ManipulatorGroup {
bool all_hidden;
int twtype;
struct wmManipulator *manipulators[MAN_AXIS_LAST];
} ManipulatorGroup;
@ -249,7 +258,7 @@ static uint manipulator_orientation_axis(const int axis_idx, bool *r_is_plane)
}
static bool manipulator_is_axis_visible(
const View3D *v3d, const RegionView3D *rv3d,
const RegionView3D *rv3d, const int twtype,
const float idot[3], const int axis_type, const int axis_idx)
{
bool is_plane = false;
@ -265,9 +274,9 @@ static bool manipulator_is_axis_visible(
}
}
if ((axis_type == MAN_AXES_TRANSLATE && !(v3d->twtype & V3D_MANIP_TRANSLATE)) ||
(axis_type == MAN_AXES_ROTATE && !(v3d->twtype & V3D_MANIP_ROTATE)) ||
(axis_type == MAN_AXES_SCALE && !(v3d->twtype & V3D_MANIP_SCALE)))
if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & V3D_MANIP_TRANSLATE)) ||
(axis_type == MAN_AXES_ROTATE && !(twtype & V3D_MANIP_ROTATE)) ||
(axis_type == MAN_AXES_SCALE && !(twtype & V3D_MANIP_SCALE)))
{
return false;
}
@ -297,34 +306,34 @@ static bool manipulator_is_axis_visible(
case MAN_AXIS_SCALE_Z:
return (rv3d->twdrawflag & MAN_SCALE_Z);
case MAN_AXIS_SCALE_C:
return (rv3d->twdrawflag & MAN_SCALE_C && (v3d->twtype & V3D_MANIP_TRANSLATE) == 0);
return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & V3D_MANIP_TRANSLATE) == 0);
case MAN_AXIS_TRANS_XY:
return (rv3d->twdrawflag & MAN_TRANS_X &&
rv3d->twdrawflag & MAN_TRANS_Y &&
(v3d->twtype & V3D_MANIP_ROTATE) == 0);
(twtype & V3D_MANIP_ROTATE) == 0);
case MAN_AXIS_TRANS_YZ:
return (rv3d->twdrawflag & MAN_TRANS_Y &&
rv3d->twdrawflag & MAN_TRANS_Z &&
(v3d->twtype & V3D_MANIP_ROTATE) == 0);
(twtype & V3D_MANIP_ROTATE) == 0);
case MAN_AXIS_TRANS_ZX:
return (rv3d->twdrawflag & MAN_TRANS_Z &&
rv3d->twdrawflag & MAN_TRANS_X &&
(v3d->twtype & V3D_MANIP_ROTATE) == 0);
(twtype & V3D_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_XY:
return (rv3d->twdrawflag & MAN_SCALE_X &&
rv3d->twdrawflag & MAN_SCALE_Y &&
(v3d->twtype & V3D_MANIP_TRANSLATE) == 0 &&
(v3d->twtype & V3D_MANIP_ROTATE) == 0);
(twtype & V3D_MANIP_TRANSLATE) == 0 &&
(twtype & V3D_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_YZ:
return (rv3d->twdrawflag & MAN_SCALE_Y &&
rv3d->twdrawflag & MAN_SCALE_Z &&
(v3d->twtype & V3D_MANIP_TRANSLATE) == 0 &&
(v3d->twtype & V3D_MANIP_ROTATE) == 0);
(twtype & V3D_MANIP_TRANSLATE) == 0 &&
(twtype & V3D_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_ZX:
return (rv3d->twdrawflag & MAN_SCALE_Z &&
rv3d->twdrawflag & MAN_SCALE_X &&
(v3d->twtype & V3D_MANIP_TRANSLATE) == 0 &&
(v3d->twtype & V3D_MANIP_ROTATE) == 0);
(twtype & V3D_MANIP_TRANSLATE) == 0 &&
(twtype & V3D_MANIP_ROTATE) == 0);
}
return false;
}
@ -1093,7 +1102,7 @@ static void manipulator_prepare_mat(
* Sets up \a r_start and \a r_len to define arrow line range.
* Needed to adjust line drawing for combined manipulator axis types.
*/
static void manipulator_line_range(const View3D *v3d, const short axis_type, float *r_start, float *r_len)
static void manipulator_line_range(const int twtype, const short axis_type, float *r_start, float *r_len)
{
const float ofs = 0.2f;
@ -1102,15 +1111,15 @@ static void manipulator_line_range(const View3D *v3d, const short axis_type, flo
switch (axis_type) {
case MAN_AXES_TRANSLATE:
if (v3d->twtype & V3D_MANIP_SCALE) {
if (twtype & V3D_MANIP_SCALE) {
*r_start = *r_len - ofs + 0.075f;
}
if (v3d->twtype & V3D_MANIP_ROTATE) {
if (twtype & V3D_MANIP_ROTATE) {
*r_len += ofs;
}
break;
case MAN_AXES_SCALE:
if (v3d->twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE)) {
if (twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE)) {
*r_len -= ofs + 0.025f;
}
break;
@ -1252,7 +1261,7 @@ static int manipulator_modal(
return OPERATOR_RUNNING_MODAL;
}
static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup)
static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup)
{
ManipulatorGroup *man = manipulatorgroup_init(mgroup);
struct {
@ -1261,6 +1270,27 @@ static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulat
mgroup->customdata = man;
{
/* TODO: support mixing modes again? - it's supported but tool system makes it unobvious. */
man->twtype = 0;
WorkSpace *workspace = CTX_wm_workspace(C);
ScrArea *sa = CTX_wm_area(C);
wmKeyMap *km = WM_keymap_find_all(C, workspace->tool.keymap, sa->spacetype, RGN_TYPE_WINDOW);
/* Weak, check first event */
wmKeyMapItem *kmi = km->items.first;
if (STREQ(kmi->idname, "TRANSFORM_OT_translate")) {
man->twtype |= V3D_MANIP_TRANSLATE;
}
else if (STREQ(kmi->idname, "TRANSFORM_OT_rotate")) {
man->twtype |= V3D_MANIP_ROTATE;
}
else if (STREQ(kmi->idname, "TRANSFORM_OT_resize")) {
man->twtype |= V3D_MANIP_SCALE;
}
BLI_assert(man->twtype != 0);
}
/* *** set properties for axes *** */
MAN_ITER_AXES_BEGIN(axis, axis_idx)
@ -1403,7 +1433,7 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
float start_co[3] = {0.0f, 0.0f, 0.0f};
float len;
manipulator_line_range(v3d, axis_type, &start_co[2], &len);
manipulator_line_range(man->twtype, axis_type, &start_co[2], &len);
WM_manipulator_set_matrix_rotation_from_z_axis(axis, rv3d->twmat[aidx_norm]);
RNA_float_set(axis->ptr, "length", len);
@ -1445,9 +1475,9 @@ static void WIDGETGROUP_manipulator_message_subscribe(
static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup)
{
ManipulatorGroup *man = mgroup->customdata;
ScrArea *sa = CTX_wm_area(C);
// ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
View3D *v3d = sa->spacedata.first;
// View3D *v3d = sa->spacedata.first;
RegionView3D *rv3d = ar->regiondata;
float idot[3];
@ -1469,7 +1499,7 @@ static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulato
{
const short axis_type = manipulator_get_axis_type(axis_idx);
/* XXX maybe unset _HIDDEN flag on redraw? */
if (manipulator_is_axis_visible(v3d, rv3d, idot, axis_type, axis_idx)) {
if (manipulator_is_axis_visible(rv3d, man->twtype, idot, axis_type, axis_idx)) {
WM_manipulator_set_flag(axis, WM_MANIPULATOR_HIDDEN, false);
}
else {
@ -1494,22 +1524,21 @@ static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulato
MAN_ITER_AXES_END;
}
static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmManipulatorGroupType *UNUSED(wgt))
static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt)
{
/* it's a given we only use this in 3D view */
const ScrArea *sa = CTX_wm_area(C);
const View3D *v3d = sa->spacedata.first;
if (((v3d->twflag & V3D_MANIPULATOR_DRAW) != 0) &&
((v3d->twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | V3D_MANIP_SCALE)) != 0))
{
/* Don't show when tools have a manipulator. */
WorkSpace *workspace = CTX_wm_workspace(C);
if (workspace->tool.manipulator_group[0] == '\0') {
return true;
}
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) {
return false;
}
return false;
WorkSpace *workspace = CTX_wm_workspace(C);
if (!STREQ(workspace->tool.manipulator_group, "TRANSFORM_WGT_manipulator")) {
WM_manipulator_group_type_unlink_delayed_ptr(wgt);
return false;
}
return true;
}
void TRANSFORM_WGT_manipulator(wmManipulatorGroupType *wgt)
@ -1517,8 +1546,10 @@ void TRANSFORM_WGT_manipulator(wmManipulatorGroupType *wgt)
wgt->name = "Transform Manipulator";
wgt->idname = "TRANSFORM_WGT_manipulator";
wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT |
WM_MANIPULATORGROUPTYPE_3D);
wgt->flag |= WM_MANIPULATORGROUPTYPE_3D;
wgt->mmap_params.spaceid = SPACE_VIEW3D;
wgt->mmap_params.regionid = RGN_TYPE_WINDOW;
wgt->poll = WIDGETGROUP_manipulator_poll;
wgt->setup = WIDGETGROUP_manipulator_setup;
@ -1540,6 +1571,12 @@ struct XFormCageWidgetGroup {
static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmManipulatorGroupType *wgt)
{
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) {
return false;
}
WorkSpace *workspace = CTX_wm_workspace(C);
if (!STREQ(wgt->idname, workspace->tool.manipulator_group)) {
WM_manipulator_group_type_unlink_delayed_ptr(wgt);

View File

@ -371,11 +371,6 @@ enum {
#define V3D_SHOW_Y 4
#define V3D_SHOW_Z 8
/* View3d->twtype (bits, we can combine them) */
#define V3D_MANIP_TRANSLATE 1
#define V3D_MANIP_ROTATE 2
#define V3D_MANIP_SCALE 4
/* Scene.orientation_type */
#define V3D_MANIP_GLOBAL 0
#define V3D_MANIP_LOCAL 1

View File

@ -7470,12 +7470,21 @@ bool RNA_struct_override_matches(
const bool do_create = (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0;
const bool do_restore = (flags & RNA_OVERRIDE_COMPARE_RESTORE) != 0;
//#define DEBUG_OVERRIDE_TIMEIT
#ifdef DEBUG_OVERRIDE_TIMEIT
static float _sum_time = 0.0f;
static float _num_time = 0.0f;
double _timeit_time;
static float _sum_time_global = 0.0f;
static float _num_time_global = 0.0f;
double _timeit_time_global;
static float _sum_time_diffing = 0.0f;
static float _delta_time_diffing = 0.0f;
static int _num_delta_time_diffing = 0.0f;
static float _num_time_diffing = 0.0f;
double _timeit_time_diffing;
if (!root_path) {
_timeit_time = PIL_check_seconds_timer();
_delta_time_diffing = 0.0f;
_num_delta_time_diffing = 0;
_timeit_time_global = PIL_check_seconds_timer();
}
#endif
@ -7525,6 +7534,7 @@ bool RNA_struct_override_matches(
}
}
else {
/* This is rather slow, but is not much called, so not really worth optimizing. */
rna_path = RNA_path_from_ID_to_property(ptr_local, prop_local);
}
if (rna_path == NULL) {
@ -7538,11 +7548,25 @@ bool RNA_struct_override_matches(
continue;
}
#ifdef DEBUG_OVERRIDE_TIMEIT
if (!root_path) {
_timeit_time_diffing = PIL_check_seconds_timer();
}
#endif
eRNAOverrideMatchResult report_flags = 0;
const int diff = rna_property_override_diff(
ptr_local, ptr_reference, NULL, prop_local, prop_reference, rna_path,
RNA_EQ_STRICT, override, flags, &report_flags);
#ifdef DEBUG_OVERRIDE_TIMEIT
if (!root_path) {
const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time_diffing);
_delta_time_diffing += _delta_time;
_num_delta_time_diffing++;
}
#endif
matching = matching && diff == 0;
if (r_report_flags) {
*r_report_flags |= report_flags;
@ -7597,12 +7621,18 @@ bool RNA_struct_override_matches(
#ifdef DEBUG_OVERRIDE_TIMEIT
if (!root_path) {
const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time);
_sum_time += _delta_time;
_num_time++;
const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time_global);
_sum_time_global += _delta_time;
_num_time_global++;
_sum_time_diffing += _delta_time_diffing;
_num_time_diffing++;
printf("ID: %s\n", ((ID *)ptr_local->id.data)->name);
printf("time end (%s): %.6f\n", __func__, _delta_time);
printf("time averaged (%s): %.6f (total: %.6f, in %d runs)\n", __func__, (_sum_time / _num_time), _sum_time, (int)_num_time);
printf("time averaged (%s): %.6f (total: %.6f, in %d runs)\n", __func__,
(_sum_time_global / _num_time_global), _sum_time_global, (int)_num_time_global);
printf("diffing time end (%s): %.6f (in %d runs)\n", __func__, _delta_time_diffing, _num_delta_time_diffing);
printf("diffing time averaged (%s): %.6f (total: %.6f, in %d runs)\n", __func__,
(_sum_time_diffing / _num_time_diffing), _sum_time_diffing, (int)_num_time_diffing);
}
#endif

View File

@ -2146,16 +2146,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem manipulators_items[] = {
{V3D_MANIP_TRANSLATE, "TRANSLATE", ICON_MAN_TRANS, "Translate",
"Use the manipulator for movement transformations"},
{V3D_MANIP_ROTATE, "ROTATE", ICON_MAN_ROT, "Rotate",
"Use the manipulator for rotation transformations"},
{V3D_MANIP_SCALE, "SCALE", ICON_MAN_SCALE, "Scale",
"Use the manipulator for scale transformations"},
{0, NULL, 0, NULL, NULL}
};
static const EnumPropertyItem rv3d_persp_items[] = {
{RV3D_PERSP, "PERSP", 0, "Perspective", ""},
{RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
@ -2452,13 +2442,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "transform_manipulators", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "twtype");
RNA_def_property_enum_items(prop, manipulators_items);
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Transform Manipulators", "Transformation manipulators");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set");