[Bf-blender-cvs] [1a81ac7d9ac] blender2.8: Fix update for manipulator w/ 3D cursor change
Campbell Barton
noreply at git.blender.org
Sun May 6 16:42:13 CEST 2018
Commit: 1a81ac7d9ac7dce0657e57fb291bf3559e3a5178
Author: Campbell Barton
Date: Sun May 6 16:41:32 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB1a81ac7d9ac7dce0657e57fb291bf3559e3a5178
Fix update for manipulator w/ 3D cursor change
===================================================================
M source/blender/editors/space_view3d/view3d_edit.c
M source/blender/editors/transform/transform_manipulator_3d.c
===================================================================
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 8130442ea33..7e05a80781c 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -66,6 +66,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -4606,6 +4607,12 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
else
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
+ {
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
+ WM_msg_publish_rna_prop(
+ mbus, &scene->id, scene, Scene, cursor_location);
+ }
+
DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
}
diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index 4f87fabce05..afe40b94d9a 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -1118,7 +1118,7 @@ static void manipulator_line_range(const int twtype, const short axis_type, floa
static void manipulator_xform_message_subscribe(
wmManipulatorGroup *mgroup, struct wmMsgBus *mbus,
- bScreen *screen, ScrArea *sa, ARegion *ar, const void *type_fn)
+ Scene *scene, bScreen *screen, ScrArea *sa, ARegion *ar, const void *type_fn)
{
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_mpr_tag_refresh = {
@@ -1127,19 +1127,27 @@ static void manipulator_xform_message_subscribe(
.notify = WM_manipulator_do_msg_notify_tag_refresh,
};
- PointerRNA space_ptr;
- RNA_pointer_create(&screen->id, &RNA_SpaceView3D, sa->spacedata.first, &space_ptr);
+ PointerRNA scene_ptr;
+ RNA_id_pointer_create(&scene->id, &scene_ptr);
{
+ const View3D *v3d = sa->spacedata.first;
extern PropertyRNA rna_Scene_transform_orientation;
+ extern PropertyRNA rna_Scene_cursor_location;
const PropertyRNA *props[] = {
&rna_Scene_transform_orientation,
+ (v3d->around == V3D_AROUND_CURSOR) ? &rna_Scene_cursor_location : NULL,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
- WM_msg_subscribe_rna(mbus, &space_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__);
+ if (props[i]) {
+ WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__);
+ }
}
}
+ PointerRNA space_ptr;
+ RNA_pointer_create(&screen->id, &RNA_SpaceView3D, sa->spacedata.first, &space_ptr);
+
if (type_fn == TRANSFORM_WGT_manipulator) {
extern PropertyRNA rna_SpaceView3D_pivot_point;
const PropertyRNA *props[] = {
@@ -1454,10 +1462,11 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
static void WIDGETGROUP_manipulator_message_subscribe(
const bContext *C, wmManipulatorGroup *mgroup, struct wmMsgBus *mbus)
{
+ Scene *scene = CTX_data_scene(C);
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
- manipulator_xform_message_subscribe(mgroup, mbus, screen, sa, ar, TRANSFORM_WGT_manipulator);
+ manipulator_xform_message_subscribe(mgroup, mbus, scene, screen, sa, ar, TRANSFORM_WGT_manipulator);
}
static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup)
@@ -1674,10 +1683,11 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup
static void WIDGETGROUP_xform_cage_message_subscribe(
const bContext *C, wmManipulatorGroup *mgroup, struct wmMsgBus *mbus)
{
+ Scene *scene = CTX_data_scene(C);
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
- manipulator_xform_message_subscribe(mgroup, mbus, screen, sa, ar, VIEW3D_WGT_xform_cage);
+ manipulator_xform_message_subscribe(mgroup, mbus, scene, screen, sa, ar, VIEW3D_WGT_xform_cage);
}
static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup)
More information about the Bf-blender-cvs
mailing list