[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27566] trunk/blender: Fix [#21114] Graphical cursor displayed in wrong position when switching to local ortho .

Matt Ebb matt at mke3.net
Wed Mar 17 01:05:40 CET 2010


Revision: 27566
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27566
Author:   broken
Date:     2010-03-17 01:05:40 +0100 (Wed, 17 Mar 2010)

Log Message:
-----------
Fix [#21114] Graphical cursor displayed in wrong position when switching to local ortho.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/editors/object/object_add.c
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2010-03-16 22:19:43 UTC (rev 27565)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2010-03-17 00:05:40 UTC (rev 27566)
@@ -1854,7 +1854,7 @@
         col.prop(view, "clip_start", text="Start")
         col.prop(view, "clip_end", text="End")
 
-        layout.column().prop(scene, "cursor_location", text="3D Cursor:")
+        layout.column().prop(view, "cursor_location")
 
 
 class VIEW3D_PT_3dview_name(bpy.types.Panel):

Modified: trunk/blender/source/blender/editors/object/object_add.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_add.c	2010-03-16 22:19:43 UTC (rev 27565)
+++ trunk/blender/source/blender/editors/object/object_add.c	2010-03-17 00:05:40 UTC (rev 27566)
@@ -92,6 +92,7 @@
 #include "ED_render.h"
 #include "ED_screen.h"
 #include "ED_transform.h"
+#include "ED_view3d.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
@@ -105,14 +106,7 @@
 	View3D *v3d= CTX_wm_view3d(C);
 	Scene *scene= CTX_data_scene(C);
 	
-	if (v3d) {
-		if (v3d->localvd)
-			copy_v3_v3(loc, v3d->cursor);
-		else
-			copy_v3_v3(loc, scene->cursor);
-	} else {
-		copy_v3_v3(loc, scene->cursor);
-	}
+	loc = give_cursor(scene, v3d);
 }
 
 void ED_object_rotation_from_view(bContext *C, float *rot)

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2010-03-16 22:19:43 UTC (rev 27565)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2010-03-17 00:05:40 UTC (rev 27566)
@@ -104,6 +104,8 @@
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 
+#include "BLI_math.h"
+
 #include "BKE_animsys.h"
 #include "BKE_brush.h"
 #include "BKE_colortools.h"
@@ -278,6 +280,26 @@
 	}
 }
 
+static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values)
+{
+	View3D *v3d= (View3D*)(ptr->data);
+	bScreen *sc= (bScreen*)ptr->id.data;
+	Scene *scene= (Scene *)sc->scene;
+	float *loc = give_cursor(scene, v3d);
+	
+	copy_v3_v3(values, loc);
+}
+
+static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
+{
+	View3D *v3d= (View3D*)(ptr->data);
+	bScreen *sc= (bScreen*)ptr->id.data;
+	Scene *scene= (Scene *)sc->scene;
+	float *cursor = give_cursor(scene, v3d);
+	
+	copy_v3_v3(cursor, values);
+}
+
 static void rna_Space3DView_layer_set(PointerRNA *ptr, const int *values)
 {
 	View3D *v3d= (View3D*)(ptr->data);
@@ -861,7 +883,14 @@
 	prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "localvd");
 	RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility");
-
+	
+	prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ|PROP_UNIT_LENGTH);
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL);
+	RNA_def_property_ui_text(prop, "3D Cursor Location", "3D cursor location for this view (dependent on local view setting)");
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+	
 	prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lens");
 	RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view");





More information about the Bf-blender-cvs mailing list