Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-02-01 05:34:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-01 05:34:27 +0300
commit3ba5461af0c8b1273d3daf87d050c24a690273be (patch)
treef444c816d456e8adcfa9c9736decaa6e0507958f /source/blender/editors/object/object_data_transform.c
parent253dbdbb39147d4a74ae450964315a4cfd78a837 (diff)
Object: support 'Affect Parents' for snap/clear transform
Resolves T69450
Diffstat (limited to 'source/blender/editors/object/object_data_transform.c')
-rw-r--r--source/blender/editors/object/object_data_transform.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/source/blender/editors/object/object_data_transform.c b/source/blender/editors/object/object_data_transform.c
index b6f125c6f71..6d03ec2774c 100644
--- a/source/blender/editors/object/object_data_transform.c
+++ b/source/blender/editors/object/object_data_transform.c
@@ -580,100 +580,3 @@ void ED_object_data_xform_tag_update(struct XFormObjectData *xod_base)
}
/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Object Data Transform Container
- *
- * Use to implement 'Affect Only Origins' feature.
- *
- * \{ */
-
-struct XFormObjectData_Container {
- GHash *obdata_in_obmode_map;
-};
-
-struct XFormObjectData_Extra {
- Object *ob;
- float obmat_orig[4][4];
- struct XFormObjectData *xod;
-};
-
-void ED_object_data_xform_container_item_ensure(struct XFormObjectData_Container *xds, Object *ob)
-{
- if (xds->obdata_in_obmode_map == NULL) {
- xds->obdata_in_obmode_map = BLI_ghash_ptr_new(__func__);
- }
-
- void **xf_p;
- if (!BLI_ghash_ensure_p(xds->obdata_in_obmode_map, ob->data, &xf_p)) {
- struct XFormObjectData_Extra *xf = MEM_mallocN(sizeof(*xf), __func__);
- copy_m4_m4(xf->obmat_orig, ob->obmat);
- xf->ob = ob;
- /* Result may be NULL, that's OK. */
- xf->xod = ED_object_data_xform_create(ob->data);
- *xf_p = xf;
- }
-}
-
-/**
- * This may be called multiple times with the same data.
- * Each time, the original transformations are re-applied, instead of accumulating the changes.
- */
-void ED_object_data_xform_container_update_all(struct XFormObjectData_Container *xds,
- struct Main *bmain,
- Depsgraph *depsgraph)
-{
- if (xds->obdata_in_obmode_map == NULL) {
- return;
- }
- BKE_scene_graph_evaluated_ensure(depsgraph, bmain);
-
- GHashIterator gh_iter;
- GHASH_ITER (gh_iter, xds->obdata_in_obmode_map) {
- ID *id = BLI_ghashIterator_getKey(&gh_iter);
- struct XFormObjectData_Extra *xf = BLI_ghashIterator_getValue(&gh_iter);
- if (xf->xod == NULL) {
- continue;
- }
-
- Object *ob_eval = DEG_get_evaluated_object(depsgraph, xf->ob);
- float imat[4][4], dmat[4][4];
- invert_m4_m4(imat, xf->obmat_orig);
- mul_m4_m4m4(dmat, imat, ob_eval->obmat);
- invert_m4(dmat);
-
- ED_object_data_xform_by_mat4(xf->xod, dmat);
- if (xf->ob->type == OB_ARMATURE) {
- /* TODO: none of the current flags properly update armatures, needs investigation. */
- DEG_id_tag_update(id, 0);
- }
- else {
- DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
- }
- }
-}
-
-/** Callback for #GHash free. */
-static void trans_obdata_in_obmode_free_elem(void *xf_p)
-{
- struct XFormObjectData_Extra *xf = xf_p;
- if (xf->xod) {
- ED_object_data_xform_destroy(xf->xod);
- }
- MEM_freeN(xf);
-}
-
-struct XFormObjectData_Container *ED_object_data_xform_container_create(void)
-{
- struct XFormObjectData_Container *xds = MEM_callocN(sizeof(*xds), __func__);
- xds->obdata_in_obmode_map = BLI_ghash_ptr_new(__func__);
- return xds;
-}
-
-void ED_object_data_xform_container_destroy(struct XFormObjectData_Container *xds)
-{
- BLI_ghash_free(xds->obdata_in_obmode_map, NULL, trans_obdata_in_obmode_free_elem);
- MEM_freeN(xds);
-}
-
-/** \} */