Particles

=========

- Bugfix: synchronize modifier enable with particle enable flag to
  prevent crash.
This commit is contained in:
Brecht Van Lommel 2007-11-27 12:34:59 +00:00
parent 2a743951fc
commit da3c35db47
3 changed files with 23 additions and 9 deletions

@ -6759,9 +6759,10 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
mti = INIT_TYPE(ParticleSystem); mti = INIT_TYPE(ParticleSystem);
mti->type = eModifierTypeType_OnlyDeform; mti->type = eModifierTypeType_OnlyDeform;
mti->flags = eModifierTypeFlag_AcceptsMesh; mti->flags = eModifierTypeFlag_AcceptsMesh
| eModifierTypeFlag_SupportsMapping;
#if 0 #if 0
|eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_SupportsEditmode;
|eModifierTypeFlag_EnableInEditmode; |eModifierTypeFlag_EnableInEditmode;
#endif #endif
mti->initData = particleSystemModifier_initData; mti->initData = particleSystemModifier_initData;
@ -6850,9 +6851,8 @@ int modifier_supportsMapping(ModifierData *md)
{ {
ModifierTypeInfo *mti = modifierType_getInfo(md->type); ModifierTypeInfo *mti = modifierType_getInfo(md->type);
return ( (mti->flags & eModifierTypeFlag_SupportsEditmode) && return (mti->type==eModifierTypeType_OnlyDeform ||
( (mti->type==eModifierTypeType_OnlyDeform || (mti->flags & eModifierTypeFlag_SupportsMapping));
(mti->flags & eModifierTypeFlag_SupportsMapping))) );
} }
ModifierData *modifiers_findByType(Object *ob, ModifierType type) ModifierData *modifiers_findByType(Object *ob, ModifierType type)

@ -1755,12 +1755,14 @@ static int render_new_particle_system(Render *re, Object *ob, ParticleSystem *ps
return 1; return 1;
} }
psmd= psys_get_modifier(ob,psys);
if(!(psmd->modifier.mode & eModifierMode_Render))
return 0;
psys->flag|=PSYS_DRAWING; psys->flag|=PSYS_DRAWING;
BLI_srandom(psys->seed); BLI_srandom(psys->seed);
psmd= psys_get_modifier(ob,psys);
ma= give_render_material(re, ob, part->omat); ma= give_render_material(re, ob, part->omat);
if(part->bb_ob) if(part->bb_ob)

@ -1609,6 +1609,16 @@ void modifiers_explodeFacepa(void *arg1, void *arg2)
emd->flag |= eExplodeFlag_CalcFaces; emd->flag |= eExplodeFlag_CalcFaces;
} }
static void modifiers_psysEnable(void *ob_v, void *md_v)
{
ParticleSystemModifierData *psmd = (ParticleSystemModifierData*) md_v;
if(psmd->modifier.mode & eModifierMode_Realtime)
psmd->psys->flag |= PSYS_ENABLED;
else
psmd->psys->flag &= ~PSYS_ENABLED;
}
static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco, int *yco, int index, int cageIndex, int lastCageIndex) static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco, int *yco, int index, int cageIndex, int lastCageIndex)
{ {
ModifierTypeInfo *mti = modifierType_getInfo(md->type); ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@ -1647,7 +1657,9 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
/* Softbody not allowed in this situation, enforce! */ /* Softbody not allowed in this situation, enforce! */
if (md->type!=eModifierType_Softbody || !(ob->pd && ob->pd->deflect)) { if (md->type!=eModifierType_Softbody || !(ob->pd && ob->pd->deflect)) {
uiDefIconButBitI(block, TOG, eModifierMode_Render, B_MODIFIER_RECALC, ICON_SCENE, x+10+buttonWidth-60, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering"); uiDefIconButBitI(block, TOG, eModifierMode_Render, B_MODIFIER_RECALC, ICON_SCENE, x+10+buttonWidth-60, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, VICON_VIEW3D, x+10+buttonWidth-40, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display"); but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, VICON_VIEW3D, x+10+buttonWidth-40, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
if (md->type==eModifierType_ParticleSystem)
uiButSetFunc(but, modifiers_psysEnable, ob, md);
if (mti->flags&eModifierTypeFlag_SupportsEditmode) { if (mti->flags&eModifierTypeFlag_SupportsEditmode) {
uiDefIconButBitI(block, TOG, eModifierMode_Editmode, B_MODIFIER_RECALC, VICON_EDIT, x+10+buttonWidth-20, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)"); uiDefIconButBitI(block, TOG, eModifierMode_Editmode, B_MODIFIER_RECALC, VICON_EDIT, x+10+buttonWidth-20, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
} }