Fix T82242: creating particle influence textures does not set up DEG

relation immediately

Texture and ParticleSettings have a DEG relation, but
`DEG_relations_tag_update` was not called when the texture changed.
This lead to no updates when e.g. texture size changes, relation only
went into full effect after save/reload or adding/removing keyframes.

Two places were additional relation tagging is needed:
- ParticleSettings `active_texture` changes
- ParticleSettingsTextureSlot (basically any TextureSlots') texture
changes

Maniphest Tasks: T82242

Differential Revision: https://developer.blender.org/D9393
This commit is contained in:
Philipp Oeser 2020-10-30 12:12:25 +01:00
parent ac7694aee0
commit 3b57927651
Notes: blender-bot 2023-02-14 06:32:27 +01:00
Referenced by issue #82242, Particle System Influence procedural textures [e.g. on hair length] dont update in realtime immediately [depsgraph relation will work only after certain updates]
2 changed files with 9 additions and 2 deletions

View File

@ -2484,7 +2484,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
NULL,
"ParticleSettingsTextureSlot",
"ParticleSettingsTextureSlots",
"rna_Particle_reset",
"rna_Particle_reset_dependency",
NULL);
/* Fluid particle type can't be checked from the type value in RNA

View File

@ -148,6 +148,7 @@ static const EnumPropertyItem blend_type_items[] = {
# include "BKE_texture.h"
# include "DEG_depsgraph.h"
# include "DEG_depsgraph_build.h"
# include "ED_node.h"
# include "ED_render.h"
@ -233,6 +234,12 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value)
BKE_texture_type_set(tex, value);
}
void rna_TextureSlotTexture_update(bContext *C, PointerRNA *ptr)
{
DEG_relations_tag_update(CTX_data_main(C));
rna_TextureSlot_update(C, ptr);
}
void rna_TextureSlot_update(bContext *C, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
@ -623,7 +630,7 @@ static void rna_def_mtex(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "Texture", "Texture data-block used by this texture slot");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlot_update");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlotTexture_update");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(