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:
@@ -61,7 +61,7 @@ def add_object_align_init(context, operator):
|
||||
if operator and properties.is_property_set("location"):
|
||||
location = Matrix.Translation(Vector(properties.location))
|
||||
else:
|
||||
location = Matrix.Translation(context.scene.cursor_location)
|
||||
location = Matrix.Translation(context.scene.cursor.location)
|
||||
|
||||
if operator:
|
||||
properties.location = location.to_translation()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -55,7 +55,7 @@ class SelectSideOfPlane(Operator):
|
||||
def invoke(self, context, event):
|
||||
|
||||
if not self.properties.is_property_set("plane_co"):
|
||||
self.plane_co = context.scene.cursor_location
|
||||
self.plane_co = context.scene.cursor.location
|
||||
|
||||
if not self.properties.is_property_set("plane_no"):
|
||||
if context.space_data.type == 'VIEW_3D':
|
||||
|
||||
@@ -58,7 +58,7 @@ def main(context, event):
|
||||
hit, normal, face_index = obj_ray_cast(obj, matrix)
|
||||
if hit is not None:
|
||||
hit_world = matrix @ hit
|
||||
scene.cursor_location = hit_world
|
||||
scene.cursor.location = hit_world
|
||||
length_squared = (hit_world - ray_origin).length_squared
|
||||
if best_obj is None or length_squared < best_length_squared:
|
||||
best_length_squared = length_squared
|
||||
|
||||
Reference in New Issue
Block a user