Automatically set the object transflag for nparticle duplis, like

current particles (but actual code is in nparticle to stay out of object
code as much as possible).
This commit is contained in:
2014-01-03 12:22:42 +01:00
parent 5235a9ea75
commit 0211fc88f9
3 changed files with 25 additions and 1 deletions

View File

@@ -32,6 +32,7 @@
#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
struct Object;
struct NParticleSystem;
struct NParticleAttribute;
struct NParticleState;
@@ -119,4 +120,7 @@ struct NParticleDisplay *BKE_nparticle_display_add_dupli(struct NParticleSystem
struct NParticleDisplay *BKE_nparticle_display_copy(struct NParticleSystem *psys, struct NParticleDisplay *display);
void BKE_nparticle_display_free(struct NParticleSystem *psys, struct NParticleDisplay *display);
/* update object transflag for nparticle duplis */
void BKE_nparticle_update_object_dupli_flags(struct Object *ob, struct NParticleSystem *psys);
#endif /* BKE_NPARTICLE_H */

View File

@@ -644,3 +644,13 @@ void BKE_nparticle_display_free(NParticleSystem *psys, NParticleDisplay *display
MEM_freeN(display);
}
void BKE_nparticle_update_object_dupli_flags(Object *ob, NParticleSystem *psys)
{
NParticleDisplay *display;
ob->transflag &= ~OB_DUPLI_NPARTICLE;
for (display = psys->display.first; display; display = display->next) {
if (display->type == PAR_DISPLAY_DUPLI)
ob->transflag |= OB_DUPLI_NPARTICLE;
}
}

View File

@@ -99,6 +99,7 @@
#include "BKE_mball.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_nparticle.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
@@ -2893,6 +2894,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
AnimData *adt = BKE_animdata_from_id(data_id);
Key *key;
float ctime = BKE_scene_frame_get(scene);
ModifierData *md;
if (G.debug & G_DEBUG_DEPSGRAPH)
printf("recalcdata %s\n", ob->id.name + 2);
@@ -3022,7 +3024,15 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
}
}
/* nparticles */
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_NParticleSystem) {
NParticleSystemModifierData *pmd = (NParticleSystemModifierData*)md;
BKE_nparticle_update_object_dupli_flags(ob, pmd->psys);
}
}
/* quick cache removed */
}