Fix gizmo orientation w/ shear tool
This commit is contained in:
parent
f9d14ceb40
commit
1e00f91760
@ -665,6 +665,7 @@ class _defs_edit_mesh:
|
|||||||
props = tool.operator_properties("transform.shear")
|
props = tool.operator_properties("transform.shear")
|
||||||
layout.label(text="View Axis:")
|
layout.label(text="View Axis:")
|
||||||
layout.prop(props, "shear_axis", expand=True)
|
layout.prop(props, "shear_axis", expand=True)
|
||||||
|
_template_widget.TRANSFORM_GGT_gizmo.draw_settings_with_index(context, layout, 2)
|
||||||
return dict(
|
return dict(
|
||||||
text="Shear",
|
text="Shear",
|
||||||
icon="ops.transform.shear",
|
icon="ops.transform.shear",
|
||||||
|
@ -1211,8 +1211,6 @@ static void gizmo_xform_message_subscribe(
|
|||||||
wmGizmoGroup *gzgroup, struct wmMsgBus *mbus,
|
wmGizmoGroup *gzgroup, struct wmMsgBus *mbus,
|
||||||
Scene *scene, bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar, const void *type_fn)
|
Scene *scene, bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar, const void *type_fn)
|
||||||
{
|
{
|
||||||
GizmoGroup *ggd = gzgroup->customdata;
|
|
||||||
|
|
||||||
/* Subscribe to view properties */
|
/* Subscribe to view properties */
|
||||||
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
|
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
|
||||||
.owner = ar,
|
.owner = ar,
|
||||||
@ -1237,7 +1235,20 @@ static void gizmo_xform_message_subscribe(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
|
int orient_flag = 0;
|
||||||
|
if (type_fn == TRANSFORM_GGT_gizmo) {
|
||||||
|
GizmoGroup *ggd = gzgroup->customdata;
|
||||||
|
orient_flag = ggd->twtype_init;
|
||||||
|
}
|
||||||
|
else if (type_fn == VIEW3D_GGT_xform_cage) {
|
||||||
|
orient_flag = SCE_GIZMO_SHOW_SCALE;
|
||||||
|
/* pass */
|
||||||
|
}
|
||||||
|
else if (type_fn == VIEW3D_GGT_xform_shear) {
|
||||||
|
orient_flag = SCE_GIZMO_SHOW_ROTATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, orient_flag);
|
||||||
PointerRNA orient_ref_ptr;
|
PointerRNA orient_ref_ptr;
|
||||||
RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
|
RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
|
||||||
{
|
{
|
||||||
@ -1258,6 +1269,7 @@ static void gizmo_xform_message_subscribe(
|
|||||||
RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr);
|
RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr);
|
||||||
|
|
||||||
if (type_fn == TRANSFORM_GGT_gizmo) {
|
if (type_fn == TRANSFORM_GGT_gizmo) {
|
||||||
|
GizmoGroup *ggd = gzgroup->customdata;
|
||||||
extern PropertyRNA rna_ToolSettings_transform_pivot_point;
|
extern PropertyRNA rna_ToolSettings_transform_pivot_point;
|
||||||
extern PropertyRNA rna_ToolSettings_use_gizmo_mode;
|
extern PropertyRNA rna_ToolSettings_use_gizmo_mode;
|
||||||
const PropertyRNA *props[] = {
|
const PropertyRNA *props[] = {
|
||||||
@ -2159,15 +2171,20 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou
|
|||||||
|
|
||||||
static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup)
|
static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup)
|
||||||
{
|
{
|
||||||
|
Scene *scene = CTX_data_scene(C);
|
||||||
ARegion *ar = CTX_wm_region(C);
|
ARegion *ar = CTX_wm_region(C);
|
||||||
RegionView3D *rv3d = ar->regiondata;
|
RegionView3D *rv3d = ar->regiondata;
|
||||||
|
|
||||||
struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
|
struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
|
||||||
struct TransformBounds tbounds;
|
struct TransformBounds tbounds;
|
||||||
|
|
||||||
|
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
|
||||||
|
|
||||||
if (ED_transform_calc_gizmo_stats(
|
if (ED_transform_calc_gizmo_stats(
|
||||||
C, &(struct TransformCalcParams) {
|
C, &(struct TransformCalcParams) {
|
||||||
.use_local_axis = false,
|
.use_local_axis = false,
|
||||||
|
.orientation_type = orient_slot->type + 1,
|
||||||
|
.orientation_index_custom = orient_slot->index_custom,
|
||||||
}, &tbounds) == 0)
|
}, &tbounds) == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user