Fix [#21114] Graphical cursor displayed in wrong position when switching to local ortho.
This commit is contained in:
parent
b3e48fed5d
commit
724418f33a
@ -1854,7 +1854,7 @@ class VIEW3D_PT_3dview_properties(bpy.types.Panel):
|
||||
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):
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user