diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-01 04:35:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-01 04:41:40 +0300 |
commit | 69665bc7f06d727499596c87f1c08c1fc064efba (patch) | |
tree | 7c22f9d74760275552e0b3d8610469c9a4c9db31 /release | |
parent | 795effcbc815ae8c54bf59d31f3315a46e576c86 (diff) |
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.
Diffstat (limited to 'release')
6 files changed, 13 insertions, 13 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index df6feff4591..5f3d6fbc50f 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -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() diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 42db2ca337d..bef3fef952a 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -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) diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index cf6d796798b..b18f49e614c 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -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 diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 65e4ea03fad..178a91ba7e3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -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): diff --git a/release/scripts/templates_py/gizmo_operator.py b/release/scripts/templates_py/gizmo_operator.py index 96f4f4de940..7ab694c1619 100644 --- a/release/scripts/templates_py/gizmo_operator.py +++ b/release/scripts/templates_py/gizmo_operator.py @@ -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': diff --git a/release/scripts/templates_py/operator_modal_view3d_raycast.py b/release/scripts/templates_py/operator_modal_view3d_raycast.py index e5467228dfa..2c596b3b356 100644 --- a/release/scripts/templates_py/operator_modal_view3d_raycast.py +++ b/release/scripts/templates_py/operator_modal_view3d_raycast.py @@ -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 |