Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2010-03-17 03:05:40 +0300
committerMatt Ebb <matt@mke3.net>2010-03-17 03:05:40 +0300
commit724418f33afc62006c31f6ed8c175849b0400dba (patch)
treef7b0d0edef3a6ff2600e096de7193377bcc58345 /source/blender
parentb3e48fed5d02176b7b393ed47b0483696b5db389 (diff)
Fix [#21114] Graphical cursor displayed in wrong position when switching to local ortho.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/object/object_add.c10
-rw-r--r--source/blender/makesrna/intern/rna_space.c31
2 files changed, 32 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 4f6a188304a..d852d66fb6d 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -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 @@ void ED_object_location_from_view(bContext *C, float *loc)
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)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index fb59cc77611..37496f08dce 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -104,6 +104,8 @@ EnumPropertyItem viewport_shading_items[] = {
#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_Space3DView_lock_camera_and_layers_set(PointerRNA *ptr, int valu
}
}
+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 @@ static void rna_def_space_3dview(BlenderRNA *brna)
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");