diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 32 |
3 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 80fdf10919e..33c9583db8b 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -129,6 +129,7 @@ bool BKE_boundbox_ray_hit_check(struct BoundBox *bb, const float ray_start[3], c struct BoundBox *BKE_object_boundbox_get(struct Object *ob); void BKE_object_dimensions_get(struct Object *ob, float vec[3]); void BKE_object_dimensions_set(struct Object *ob, const float *value); +void BKE_object_empty_draw_type_set(struct Object *ob, const int value); void BKE_object_boundbox_flag(struct Object *ob, int flag, int set); void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); bool BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index ea76ff291e5..b9cbd6d2019 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -65,6 +65,7 @@ #include "BKE_fcurve.h" #include "BKE_global.h" #include "BKE_group.h" +#include "BKE_image.h" #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" @@ -1952,6 +1953,12 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob) case OB_MBALL: if (ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA; break; + case OB_EMPTY: + /* update animated images */ + if (ob->empty_drawtype == OB_EMPTY_IMAGE && ob->data) + if (BKE_image_is_animated(ob->data)) + ob->recalc |= OB_RECALC_DATA; + break; } if (animdata_use_time(adt)) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index d0d4c6f8833..149ef6b0d56 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -112,6 +112,7 @@ #include "BKE_softbody.h" #include "BKE_material.h" #include "BKE_camera.h" +#include "BKE_image.h" #ifdef WITH_MOD_FLUID #include "LBM_fluidsim.h" @@ -369,6 +370,8 @@ void BKE_object_free_ex(Object *ob, bool do_id_user) if (ob->matbits) MEM_freeN(ob->matbits); ob->mat = NULL; ob->matbits = NULL; + if (ob->iuser) MEM_freeN(ob->iuser); + ob->iuser = NULL; if (ob->bb) MEM_freeN(ob->bb); ob->bb = NULL; if (ob->adt) BKE_free_animdata((ID *)ob); @@ -1449,6 +1452,8 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, int copy_caches) obn->matbits = MEM_dupallocN(ob->matbits); obn->totcol = ob->totcol; } + + if (ob->iuser) obn->iuser = MEM_dupallocN(ob->iuser); if (ob->bb) obn->bb = MEM_dupallocN(ob->bb); obn->flag &= ~OB_FROMGROUP; @@ -2651,6 +2656,27 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us } } +void BKE_object_empty_draw_type_set(Object *ob, const int value) +{ + ob->empty_drawtype = value; + + if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) { + if (!ob->iuser) { + ob->iuser = MEM_callocN(sizeof(ImageUser), "image user"); + ob->iuser->ok = 1; + ob->iuser->frames = 100; + ob->iuser->sfra = 1; + ob->iuser->fie_ima = 2; + } + } + else { + if (ob->iuser) { + MEM_freeN(ob->iuser); + ob->iuser = NULL; + } + } +} + bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden) { bool ok = false; @@ -2931,6 +2957,12 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, case OB_LATTICE: BKE_lattice_modifiers_calc(scene, ob); break; + + case OB_EMPTY: + if (ob->empty_drawtype == OB_EMPTY_IMAGE && ob->data) + if (BKE_image_is_animated(ob->data)) + BKE_image_user_check_frame_calc(ob->iuser, (int)ctime, 0); + break; } /* related materials */ |