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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-03-11 20:02:43 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-03-24 12:52:38 +0300
commit28827b62f7777a51bb4899021b5248486d2a4687 (patch)
tree84062d3e3643a71fc7a78df8e0026adf76a60fa4 /source/blender/makesrna/intern/rna_object_force.c
parent02f7a6b2bdea4b338b977770c951f8b38d88e4b0 (diff)
Fix T64573: RNA_path_from_ID_to_property fails for pointcaches
Give pointcaches a proper path function which e.g. also resolves ALT+click (assign to all selected) not working for anything relating to pointcaches. This also cleans up the usage of the 'eModifierTypeFlag_UsesPointCache' flag (removed from the boolean modifier, added to the softbody modifier). Maniphest Tasks: T64573 Differential Revision: https://developer.blender.org/D7115
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_force.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index cd0c28457cf..4a34d1465dd 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -138,6 +138,70 @@ static bool rna_Cache_get_valid_owner_ID(PointerRNA *ptr, Object **ob, Scene **s
return (*ob != NULL || *scene != NULL);
}
+static char *rna_PointCache_path(PointerRNA *ptr)
+{
+ ModifierData *md;
+ Object *ob = (Object *)ptr->owner_id;
+ PointCache *cache = ptr->data;
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+
+ if (!(mti->flags & eModifierTypeFlag_UsesPointCache)) {
+ continue;
+ }
+
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+
+ switch (md->type) {
+ case eModifierType_ParticleSystem: {
+ ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+ if (psmd->psys->pointcache == cache) {
+ return BLI_sprintfN("modifiers[\"%s\"].particle_system.point_cache", name_esc);
+ }
+ break;
+ }
+ case eModifierType_DynamicPaint: {
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
+ if (pmd->canvas) {
+ DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
+ for (; surface; surface = surface->next) {
+ if (surface->pointcache == cache) {
+ char name_surface_esc[sizeof(surface->name) * 2];
+ BLI_strescape(name_surface_esc, surface->name, sizeof(name_surface_esc));
+ return BLI_sprintfN(
+ "modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"].point_cache",
+ name_esc,
+ name_surface_esc);
+ }
+ }
+ }
+ break;
+ }
+ case eModifierType_Cloth: {
+ ClothModifierData *clmd = (ClothModifierData *)md;
+ if (clmd->point_cache == cache) {
+ return BLI_sprintfN("modifiers[\"%s\"].point_cache", name_esc);
+ }
+ break;
+ }
+ case eModifierType_Softbody: {
+ SoftBody *sb = ob->soft;
+ if (sb && sb->shared->pointcache == cache) {
+ return BLI_sprintfN("modifiers[\"%s\"].point_cache", name_esc);
+ }
+ break;
+ }
+ default: {
+ return BLI_sprintfN("modifiers[\"%s\"].point_cache", name_esc);
+ break;
+ }
+ }
+ }
+ return NULL;
+}
+
static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = NULL;
@@ -865,6 +929,8 @@ static void rna_def_pointcache_common(StructRNA *srna)
{0, NULL, 0, NULL, NULL},
};
+ RNA_def_struct_path_func(srna, "rna_PointCache_path");
+
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "startframe");
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);