Page MenuHome

Fix T72622: Transform object origin support for mesh, lattice & curve shape-keys
ClosedPublic

Authored by Paul De Temmerman (paul2t) on Jul 23 2020, 3:08 AM.

Details

Summary

Added transformation of shape-keys when transforming object origin.

It should be able to handle changing the origin in edit mode, but it is currently disabled.

Diff Detail

Repository
rB Blender

Event Timeline

Campbell Barton (campbellbarton) requested changes to this revision.Jul 23 2020, 6:33 AM

Good start, comments inline.

source/blender/blenkernel/intern/key.c
1590

Follow naming conventions of similar functions, use _with_mat4 suffix.

1590

This only works for elemsize 3 shape-keys, so it wont work for curves.

Remaining TODO's should be noted in comments.

1592

Use const for source data.

1596

Use an BLI_assert(0) here if it should be unreachable.

1607

Use const for source data.

source/blender/editors/object/object_data_transform.c
291–293

Avoid unrelated/opinionated changes.

331

This assigns a XFormObjectData_Mesh to a XFormObjectData_Lattice pointer.

463

Use NULL instead of zero for pointers.

This revision now requires changes to proceed.Jul 23 2020, 6:33 AM
Paul De Temmerman (paul2t) marked 7 inline comments as done.

Updated according to the comments, and also made it work for nurbs and beziers.

Paul De Temmerman (paul2t) marked an inline comment as done.

Thanks, committed rB2308668bac049dbf0e7056f9849e67f52ddb3f9d with edits.

  • Always pass shapenr as -1 for now, as the edit-mode check is only when another window happens to be in edit-mode, all data should still be transformed.
  • There is an off-by-one error in the shapenr index (fixed, although the code is currently disabled).
  • Use size_t return value for size in bytes.
  • Move shape key data into their own arrays instead of adding to the end of object data array, as these arrays could get quite large, merging them has less benefit and the data-layout doesn't match.
  • Use doxygen grouping for data access functions.

Renamed functions:

# Naming: from -> to.
replace_all = (
    ("BKE_key_count_keyblocks_elements_from_shape",         "BKE_keyblock_element_count_from_shape"),
    ("BKE_key_count_keyblocks_elements",                    "BKE_keyblock_element_count"),
    ("BKE_key_count_keyblocks_size_from_shape",             "BKE_keyblock_element_calc_size_from_shape"),
    ("BKE_key_count_keyblocks_size",                        "BKE_keyblock_element_calc_size"),
    ("BKE_key_get_keyblocks_data_from_shape",               "BKE_keyblock_data_get_from_shape"),
    ("BKE_key_get_keyblocks_data",                          "BKE_keyblock_data_get"),
    ("BKE_key_set_keyblocks_data_with_mat4",                "BKE_keyblock_data_set_with_mat4"),
    ("BKE_key_set_curve_keyblocks_data_with_mat4",          "BKE_keyblock_curve_data_set_with_mat4"),
    ("BKE_key_set_keyblocks_data",                          "BKE_keyblock_data_set"),
)
This revision is now accepted and ready to land.Jul 25 2020, 9:27 AM