Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.cc
| Show First 20 Lines • Show All 5,287 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Object Modifier Utilities | /** \name Object Modifier Utilities | ||||
| * \{ */ | * \{ */ | ||||
| bool BKE_object_modifier_use_time(Scene *scene, Object *ob, ModifierData *md) | |||||
| { | |||||
| if (BKE_modifier_depends_ontime(scene, md)) { | |||||
| return true; | |||||
| } | |||||
| /* Check whether modifier is animated. */ | |||||
| /* TODO: this should be handled as part of build_animdata() -- Aligorith */ | |||||
| if (ob->adt) { | |||||
| AnimData *adt = ob->adt; | |||||
| FCurve *fcu; | |||||
| char md_name_esc[sizeof(md->name) * 2]; | |||||
| BLI_str_escape(md_name_esc, md->name, sizeof(md_name_esc)); | |||||
| char pattern[sizeof(md_name_esc) + 16]; | |||||
| BLI_snprintf(pattern, sizeof(pattern), "modifiers[\"%s\"]", md_name_esc); | |||||
| /* action - check for F-Curves with paths containing 'modifiers[' */ | |||||
| if (adt->action) { | |||||
| for (fcu = (FCurve *)adt->action->curves.first; fcu != nullptr; fcu = (FCurve *)fcu->next) { | |||||
| if (fcu->rna_path && strstr(fcu->rna_path, pattern)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* This here allows modifier properties to get driven and still update properly | |||||
| * | |||||
| * Workaround to get T26764 (e.g. subsurf levels not updating when animated/driven) | |||||
| * working, without the updating problems (T28525 T28690 T28774 T28777) caused | |||||
| * by the RNA updates cache introduced in r.38649 | |||||
| */ | |||||
| for (fcu = (FCurve *)adt->drivers.first; fcu != nullptr; fcu = (FCurve *)fcu->next) { | |||||
| if (fcu->rna_path && strstr(fcu->rna_path, pattern)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| /* XXX: also, should check NLA strips, though for now assume that nobody uses | |||||
| * that and we can omit that for performance reasons... */ | |||||
| } | |||||
| return false; | |||||
| } | |||||
| bool BKE_object_modifier_gpencil_use_time(Object *ob, GpencilModifierData *md) | |||||
| { | |||||
| if (BKE_gpencil_modifier_depends_ontime(md)) { | |||||
| return true; | |||||
| } | |||||
| /* Check whether modifier is animated. */ | |||||
| /* TODO(Aligorith): this should be handled as part of build_animdata() */ | |||||
| if (ob->adt) { | |||||
| AnimData *adt = ob->adt; | |||||
| char md_name_esc[sizeof(md->name) * 2]; | |||||
| BLI_str_escape(md_name_esc, md->name, sizeof(md_name_esc)); | |||||
| char pattern[sizeof(md_name_esc) + 32]; | |||||
| BLI_snprintf(pattern, sizeof(pattern), "grease_pencil_modifiers[\"%s\"]", md_name_esc); | |||||
| /* action - check for F-Curves with paths containing 'grease_pencil_modifiers[' */ | |||||
| if (adt->action) { | |||||
| LISTBASE_FOREACH (FCurve *, fcu, &adt->action->curves) { | |||||
| if (fcu->rna_path && strstr(fcu->rna_path, pattern)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* This here allows modifier properties to get driven and still update properly */ | |||||
| LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) { | |||||
| if (fcu->rna_path && strstr(fcu->rna_path, pattern)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| bool BKE_object_shaderfx_use_time(Object *ob, ShaderFxData *fx) | |||||
| { | |||||
| if (BKE_shaderfx_depends_ontime(fx)) { | |||||
| return true; | |||||
| } | |||||
| /* Check whether effect is animated. */ | |||||
| /* TODO(Aligorith): this should be handled as part of build_animdata() */ | |||||
| if (ob->adt) { | |||||
| AnimData *adt = ob->adt; | |||||
| char fx_name_esc[sizeof(fx->name) * 2]; | |||||
| BLI_str_escape(fx_name_esc, fx->name, sizeof(fx_name_esc)); | |||||
| char pattern[sizeof(fx_name_esc) + 32]; | |||||
| BLI_snprintf(pattern, sizeof(pattern), "shader_effects[\"%s\"]", fx_name_esc); | |||||
| /* action - check for F-Curves with paths containing string[' */ | |||||
| if (adt->action) { | |||||
| LISTBASE_FOREACH (FCurve *, fcu, &adt->action->curves) { | |||||
| if (fcu->rna_path && strstr(fcu->rna_path, pattern)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* This here allows properties to get driven and still update properly */ | |||||
| LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) { | |||||
| if (fcu->rna_path && strstr(fcu->rna_path, pattern)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /** | /** | ||||
| * Set "ignore cache" flag for all caches on this object. | * Set "ignore cache" flag for all caches on this object. | ||||
| */ | */ | ||||
| static void object_cacheIgnoreClear(Object *ob, int state) | static void object_cacheIgnoreClear(Object *ob, int state) | ||||
| { | { | ||||
| ListBase pidlist; | ListBase pidlist; | ||||
| BKE_ptcache_ids_from_object(&pidlist, ob, nullptr, 0); | BKE_ptcache_ids_from_object(&pidlist, ob, nullptr, 0); | ||||
| ▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines | |||||