[Bf-blender-cvs] [74938480083] blender2.8: 3D View: remove 3D cursor

Campbell Barton noreply at git.blender.org
Mon Nov 26 04:02:36 CET 2018


Commit: 74938480083a908a5d1fad448f1214b214727bf3
Author: Campbell Barton
Date:   Mon Nov 26 13:49:17 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB74938480083a908a5d1fad448f1214b214727bf3

3D View: remove 3D cursor

Use 3D cursor from the scene (was previously used for local-view).

===================================================================

M	release/scripts/modules/bpy_extras/object_utils.py
M	release/scripts/startup/bl_operators/object.py
M	release/scripts/startup/bl_operators/object_align.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/intern/draw_view.c
M	source/blender/editors/armature/armature_add.c
M	source/blender/editors/armature/armature_edit.c
M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/curve/editcurve_paint.c
M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/gpencil/gpencil_convert.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/include/ED_gpencil.h
M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/mesh/editmesh_add_gizmo.c
M	source/blender/editors/mesh/editmesh_bisect.c
M	source/blender/editors/mesh/editmesh_extrude.c
M	source/blender/editors/mesh/editmesh_extrude_screw.c
M	source/blender/editors/mesh/editmesh_extrude_spin.c
M	source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
M	source/blender/editors/mesh/editmesh_polybuild.c
M	source/blender/editors/mesh/editmesh_select.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_transform.c
M	source/blender/editors/object/object_warp.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_snap.c
M	source/blender/editors/space_view3d/view3d_utils.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_gizmo_3d.c
M	source/blender/editors/transform/transform_orientations.c
M	source/blender/editors/uvedit/uvedit_unwrap_ops.c
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 4fa090b7336..ea7a4a5cd57 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -61,10 +61,7 @@ def add_object_align_init(context, operator):
     if operator and properties.is_property_set("location"):
         location = Matrix.Translation(Vector(properties.location))
     else:
-        if space_data:  # local view cursor is detected below
-            location = Matrix.Translation(space_data.cursor_location)
-        else:
-            location = Matrix.Translation(context.scene.cursor_location)
+        location = Matrix.Translation(context.scene.cursor_location)
 
         if operator:
             properties.location = location.to_translation()
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index aefa723b672..b59c6da7368 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -891,7 +891,7 @@ class LoadImageAsEmpty:
     def execute(self, context):
         scene = context.scene
         space = context.space_data
-        cursor = (space if space and space.type == 'VIEW_3D' else scene).cursor_location
+        cursor = scene.cursor_location
 
         try:
             image = bpy.data.images.load(self.filepath, check_existing=True)
diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py
index d4f8af1310d..cf6d796798b 100644
--- a/release/scripts/startup/bl_operators/object_align.py
+++ b/release/scripts/startup/bl_operators/object_align.py
@@ -129,9 +129,8 @@ def align_objects(context,
 
     depsgraph = context.depsgraph
     scene = context.scene
-    space = context.space_data
 
-    cursor = (space if space and space.type == 'VIEW_3D' else scene).cursor_location
+    cursor = scene.cursor_location
 
     # We are accessing runtime data such as evaluated bounding box, so we need to
     # be sure it is properly updated and valid (bounding box might be lost on operator
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index d58f1155ea0..d8dcd94902b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4028,9 +4028,9 @@ class VIEW3D_PT_view3d_cursor(Panel):
         layout = self.layout
         layout.use_property_split = True
 
-        view = context.space_data
+        scene = context.scene
 
-        layout.column().prop(view, "cursor_location", text="Location")
+        layout.column().prop(scene, "cursor_location", text="Location")
 
 
 class VIEW3D_PT_collections(Panel):
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index a844a2dc91b..8870b346efc 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1374,16 +1374,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
 			for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
 				unit_qt(scene->cursor.rotation);
 			}
-			for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
-				for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-					for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-						if (sl->spacetype == SPACE_VIEW3D) {
-							View3D *v3d = (View3D *)sl;
-							unit_qt(v3d->cursor.rotation);
-						}
-					}
-				}
-			}
 		}
 	}
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 6289e76664d..1afb5daa912 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -245,7 +245,6 @@ GPUBatch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
 {
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	Scene *scene = draw_ctx->scene;
-	View3D *v3d = draw_ctx->v3d;
 	ARegion *ar = draw_ctx->ar;
 	RegionView3D *rv3d = draw_ctx->rv3d;
 	ToolSettings *ts = scene->toolsettings;
@@ -274,7 +273,7 @@ GPUBatch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
 	/* get origin to reproject point */
 	float origin[3];
 	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
-	ED_gp_get_drawing_reference(v3d, scene, ob, gpl, ts->gpencil_v3d_align, origin);
+	ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
 
 	for (int i = 0; i < totpoints; i++, tpt++) {
 		ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
@@ -323,7 +322,6 @@ GPUBatch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
 {
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	Scene *scene = draw_ctx->scene;
-	View3D *v3d = draw_ctx->v3d;
 	ARegion *ar = draw_ctx->ar;
 	RegionView3D *rv3d = draw_ctx->rv3d;
 	ToolSettings *ts = scene->toolsettings;
@@ -352,7 +350,7 @@ GPUBatch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
 	/* get origin to reproject point */
 	float origin[3];
 	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
-	ED_gp_get_drawing_reference(v3d, scene, ob, gpl, ts->gpencil_v3d_align, origin);
+	ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
 
 	for (int i = 0; i < totpoints; i++, tpt++) {
 		ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
@@ -384,7 +382,6 @@ GPUBatch *DRW_gpencil_get_buffer_fill_geom(bGPdata *gpd)
 
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	Scene *scene = draw_ctx->scene;
-	View3D *v3d = draw_ctx->v3d;
 	ARegion *ar = draw_ctx->ar;
 	ToolSettings *ts = scene->toolsettings;
 	Object *ob = draw_ctx->obact;
@@ -392,7 +389,7 @@ GPUBatch *DRW_gpencil_get_buffer_fill_geom(bGPdata *gpd)
 	/* get origin to reproject point */
 	float origin[3];
 	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
-	ED_gp_get_drawing_reference(v3d, scene, ob, gpl, ts->gpencil_v3d_align, origin);
+	ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
 
 	int tot_triangles = totpoints - 2;
 	/* allocate memory for temporary areas */
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index 70049a5c345..8867c85ac2f 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -165,7 +165,6 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie
 void DRW_draw_cursor(void)
 {
 	const DRWContextState *draw_ctx = DRW_context_state_get();
-	View3D *v3d = draw_ctx->v3d;
 	ARegion *ar = draw_ctx->ar;
 	Scene *scene = draw_ctx->scene;
 	ViewLayer *view_layer = draw_ctx->view_layer;
@@ -176,7 +175,7 @@ void DRW_draw_cursor(void)
 
 	if (is_cursor_visible(draw_ctx, scene, view_layer)) {
 		int co[2];
-		const View3DCursor *cursor = ED_view3d_cursor3d_get(scene, v3d);
+		const View3DCursor *cursor = &scene->cursor;
 		if (ED_view3d_project_int_global(
 		            ar, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
 		{
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index 3a76409eda0..0b39fe22e47 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -131,7 +131,6 @@ EditBone *ED_armature_ebone_add_primitive(Object *obedit_arm, float length, bool
  */
 static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	View3D *v3d;
 	bArmature *arm;
 	EditBone *ebone, *newbone, *flipbone;
 	float mat[3][3], imat[3][3];
@@ -140,7 +139,6 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
 	Scene *scene;
 
 	scene = CTX_data_scene(C);
-	v3d = CTX_wm_view3d(C);
 	obedit = CTX_data_edit_object(C);
 	arm = obedit->data;
 
@@ -196,7 +194,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
 			newbone->flag |= BONE_CONNECTED;
 		}
 
-		const View3DCursor *curs = ED_view3d_cursor3d_get(scene, v3d);
+		const View3DCursor *curs = &scene->cursor;
 		copy_v3_v3(newbone->tail, curs->location);
 		sub_v3_v3v3(newbone->tail, newbone->tail, obedit->obmat[3]);
 
@@ -236,7 +234,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
 	ar = CTX_wm_region(C);
 	v3d = CTX_wm_view3d(C);
 
-	View3DCursor *cursor = ED_view3d_cursor3d_get(scene, v3d);
+	View3DCursor *cursor = &scene->cursor;
 
 	copy_v3_v3(oldcurs, cursor->location);
 
@@ -1063,7 +1061,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
 
 	RNA_string_get(op->ptr, "name", name);
 
-	copy_v3_v3(curs, ED_view3d_cursor3d_get(CTX_data_scene(C), CTX_wm_view3d(C))->location);
+	copy_v3_v3(curs, CTX_data_scene(C)->cursor.location);
 
 	/* Get inverse point for head and orientation for tail */
 	invert_m4_m4(obedit->imat, obedit->obmat);
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index ba7a6822f73..f19fea32698 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -325,9 +325,8 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 
 		if (type == CALC_ROLL_CURSOR) { /* Cursor */
 			Scene *scene = CTX_data_scene(C);
-			View3D *v3d = CTX_wm_view3d(C); /* can be NULL */
 			float cursor_local[3];
-			const View3DCursor *cursor = ED_view3d_cursor3d_get(scene, v3d);
+			const View3DCursor *cursor = &scene->cursor;
 
 			invert_m4_m4(ob->imat, ob->obmat);
 			copy_v3_v3(cursor_local, cursor->location);
@@ -728,7 +727,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
 
 		/* Get points - cursor (tail) */
 		invert_m4_m4(obedit->imat, obedit->obmat);
-		mul_v3_m4v3(curs, obedit->imat, ED_view3d_cursor3d_get(scene, v3d)->location);
+		mul_v3_m4v3(curs, obedit->imat, scene->cursor.location);
 
 		/* Create a bone */
 		newbone = add_points_bone(obedit, ebp->vec, curs);
@@ -766,7

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list