RNA: move cursor into own struct

Without this it's impractical to subscribe to any change to the cursor.

Fixes T61969 by having gizmos update on any change to the cursor.
This commit is contained in:
Campbell Barton
2019-03-01 12:35:48 +11:00
parent 795effcbc8
commit 69665bc7f0
11 changed files with 96 additions and 84 deletions

View File

@@ -873,7 +873,7 @@ class DupliOffsetFromCursor(Operator):
scene = context.scene
collection = context.collection
collection.instance_offset = scene.cursor_location
collection.instance_offset = scene.cursor.location
return {'FINISHED'}
@@ -904,7 +904,7 @@ class LoadImageAsEmpty:
def execute(self, context):
scene = context.scene
space = context.space_data
cursor = scene.cursor_location
cursor = scene.cursor.location
try:
image = bpy.data.images.load(self.filepath, check_existing=True)

View File

@@ -130,7 +130,7 @@ def align_objects(context,
depsgraph = context.depsgraph
scene = context.scene
cursor = 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

View File

@@ -4359,17 +4359,17 @@ class VIEW3D_PT_view3d_cursor(Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
cursor = context.scene.cursor
layout.column().prop(scene, "cursor_location", text="Location")
rotation_mode = scene.cursor_rotation_mode
layout.column().prop(cursor, "location", text="Location")
rotation_mode = cursor.rotation_mode
if rotation_mode == 'QUATERNION':
layout.column().prop(scene, "cursor_rotation_quaternion", text="Rotation")
layout.column().prop(cursor, "rotation_quaternion", text="Rotation")
elif rotation_mode == 'AXIS_ANGLE':
layout.column().prop(scene, "cursor_rotation_axis_angle", text="Rotation")
layout.column().prop(cursor, "rotation_axis_angle", text="Rotation")
else:
layout.column().prop(scene, "cursor_rotation_euler", text="Rotation")
layout.prop(scene, "cursor_rotation_mode", text="")
layout.column().prop(cursor, "rotation_euler", text="Rotation")
layout.prop(cursor, "rotation_mode", text="")
class VIEW3D_PT_collections(Panel):