[Bf-blender-cvs] [28827b62f77] master: Fix T64573: RNA_path_from_ID_to_property fails for pointcaches
Philipp Oeser
noreply at git.blender.org
Tue Mar 24 10:57:37 CET 2020
Commit: 28827b62f7777a51bb4899021b5248486d2a4687
Author: Philipp Oeser
Date: Wed Mar 11 18:02:43 2020 +0100
Branches: master
https://developer.blender.org/rB28827b62f7777a51bb4899021b5248486d2a4687
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
===================================================================
M source/blender/makesrna/intern/rna_object_force.c
M source/blender/modifiers/intern/MOD_boolean.c
M source/blender/modifiers/intern/MOD_softbody.c
===================================================================
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);
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 668fcef5dd2..67610e8cd29 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -351,7 +351,7 @@ ModifierTypeInfo modifierType_Boolean = {
/* structName */ "BooleanModifierData",
/* structSize */ sizeof(BooleanModifierData),
/* type */ eModifierTypeType_Nonconstructive,
- /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_UsesPointCache,
+ /* flags */ eModifierTypeFlag_AcceptsMesh,
/* copyData */ modifier_copyData_generic,
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index 679fdb634f4..efe6b188fa0 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -79,7 +79,8 @@ ModifierTypeInfo modifierType_Softbody = {
/* structSize */ sizeof(SoftbodyModifierData),
/* type */ eModifierTypeType_OnlyDeform,
/* flags */ eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_AcceptsLattice |
- eModifierTypeFlag_RequiresOriginalData | eModifierTypeFlag_Single,
+ eModifierTypeFlag_RequiresOriginalData | eModifierTypeFlag_Single |
+ eModifierTypeFlag_UsesPointCache,
/* copyData */ NULL,
More information about the Bf-blender-cvs
mailing list