Object Mode: use eval_ctx for modifiers_isCorrectableDeformed
Some other minor changes from D3037 as well
This commit is contained in:
parent
f9da89a38d
commit
ce0cb4de8d
|
@ -236,7 +236,9 @@ void bvhtree_update_from_cloth(struct ClothModifierData *clmd, bool moving);
|
|||
void bvhselftree_update_from_cloth(struct ClothModifierData *clmd, bool moving);
|
||||
|
||||
// needed for button_object.c
|
||||
void cloth_clear_cache (struct Object *ob, struct ClothModifierData *clmd, float framenr );
|
||||
void cloth_clear_cache(
|
||||
const struct EvaluationContext *eval_ctx,
|
||||
struct Object *ob, struct ClothModifierData *clmd, float framenr );
|
||||
|
||||
void cloth_parallel_transport_hair_frame(float mat[3][3], const float dir_old[3], const float dir_new[3]);
|
||||
|
||||
|
|
|
@ -374,7 +374,8 @@ struct Object *modifiers_isDeformedByArmature(struct Object *ob);
|
|||
struct Object *modifiers_isDeformedByLattice(struct Object *ob);
|
||||
struct Object *modifiers_isDeformedByCurve(struct Object *ob);
|
||||
bool modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
|
||||
bool modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob);
|
||||
bool modifiers_isCorrectableDeformed(
|
||||
const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob);
|
||||
void modifier_freeTemporaryData(struct ModifierData *md);
|
||||
bool modifiers_isPreview(struct Object *ob);
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "BLI_edgehash.h"
|
||||
#include "BLI_linklist.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_cloth.h"
|
||||
#include "BKE_effect.h"
|
||||
|
@ -304,14 +306,14 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving)
|
|||
}
|
||||
}
|
||||
|
||||
void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr)
|
||||
void cloth_clear_cache(const EvaluationContext *eval_ctx, Object *ob, ClothModifierData *clmd, float framenr)
|
||||
{
|
||||
PTCacheID pid;
|
||||
|
||||
BKE_ptcache_id_from_cloth(&pid, ob, clmd);
|
||||
|
||||
// don't do anything as long as we're in editmode!
|
||||
if (pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT)
|
||||
if (pid.cache->edit && eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)
|
||||
return;
|
||||
|
||||
BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr);
|
||||
|
|
|
@ -69,6 +69,8 @@
|
|||
#include "BKE_main.h"
|
||||
/* end */
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
|
||||
static ModifierTypeInfo *modifier_types[NUM_MODIFIER_TYPES] = {NULL};
|
||||
|
@ -660,15 +662,15 @@ bool modifier_isCorrectableDeformed(ModifierData *md)
|
|||
return (mti->deformMatricesEM != NULL);
|
||||
}
|
||||
|
||||
bool modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob)
|
||||
bool modifiers_isCorrectableDeformed(const EvaluationContext *eval_ctx, struct Scene *scene, Object *ob)
|
||||
{
|
||||
VirtualModifierData virtualModifierData;
|
||||
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
||||
int required_mode = eModifierMode_Realtime;
|
||||
|
||||
if (ob->mode == OB_MODE_EDIT)
|
||||
if (eval_ctx->object_mode == OB_MODE_EDIT) {
|
||||
required_mode |= eModifierMode_Editmode;
|
||||
|
||||
}
|
||||
for (; md; md = md->next) {
|
||||
if (!modifier_isEnabled(scene, md, required_mode)) {
|
||||
/* pass */
|
||||
|
|
|
@ -472,9 +472,13 @@ static int editmode_toggle_poll(bContext *C)
|
|||
if (ELEM(NULL, ob, ob->data) || ID_IS_LINKED(ob->data))
|
||||
return 0;
|
||||
|
||||
EvaluationContext eval_ctx;
|
||||
CTX_data_eval_ctx(C, &eval_ctx);
|
||||
|
||||
/* if hidden but in edit mode, we still display */
|
||||
if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT))
|
||||
if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(eval_ctx.object_mode & OB_MODE_EDIT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return OB_TYPE_SUPPORT_EDITMODE(ob->type);
|
||||
}
|
||||
|
|
|
@ -334,9 +334,6 @@ static void sculpt_undo_bmesh_restore_generic(bContext *C,
|
|||
Object *ob,
|
||||
SculptSession *ss)
|
||||
{
|
||||
EvaluationContext eval_ctx;
|
||||
CTX_data_eval_ctx(C, &eval_ctx);
|
||||
|
||||
if (unode->applied) {
|
||||
BM_log_undo(ss->bm, ss->bm_log);
|
||||
unode->applied = false;
|
||||
|
|
|
@ -2562,7 +2562,7 @@ static void createTransEditVerts(TransInfo *t)
|
|||
/* detect CrazySpace [tm] */
|
||||
if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1) != -1) {
|
||||
int totleft = -1;
|
||||
if (modifiers_isCorrectableDeformed(t->scene, t->obedit)) {
|
||||
if (modifiers_isCorrectableDeformed(&t->eval_ctx, t->scene, t->obedit)) {
|
||||
/* check if we can use deform matrices for modifier from the
|
||||
* start up to stack, they are more accurate than quats */
|
||||
totleft = BKE_crazyspace_get_first_deform_matrices_editbmesh(&t->eval_ctx, t->scene, t->obedit, em, &defmats, &defcos);
|
||||
|
|
Loading…
Reference in New Issue