Extract common modifier parameters into ModifierEvalContext struct
The contents of the ModifierEvalContext struct are constant while iterating over the modifier stack. The struct thus should be only created once, outside any loop over the modifiers.
This commit is contained in:
@@ -127,13 +127,21 @@ typedef enum ModifierApplyFlag {
|
|||||||
*/
|
*/
|
||||||
} ModifierApplyFlag;
|
} ModifierApplyFlag;
|
||||||
|
|
||||||
|
|
||||||
typedef struct ModifierUpdateDepsgraphContext {
|
typedef struct ModifierUpdateDepsgraphContext {
|
||||||
struct Scene *scene;
|
struct Scene *scene;
|
||||||
struct Object *object;
|
struct Object *object;
|
||||||
struct DepsNodeHandle *node;
|
struct DepsNodeHandle *node;
|
||||||
} ModifierUpdateDepsgraphContext;
|
} ModifierUpdateDepsgraphContext;
|
||||||
|
|
||||||
|
/* Contains the information for deformXXX and applyXXX functions below that
|
||||||
|
* doesn't change between consecutive modifiers. */
|
||||||
|
typedef struct ModifierEvalContext {
|
||||||
|
struct Depsgraph *depsgraph;
|
||||||
|
struct Object *object;
|
||||||
|
ModifierApplyFlag flag;
|
||||||
|
} ModifierEvalContext;
|
||||||
|
|
||||||
|
|
||||||
typedef struct ModifierTypeInfo {
|
typedef struct ModifierTypeInfo {
|
||||||
/* The user visible name for this modifier */
|
/* The user visible name for this modifier */
|
||||||
char name[32];
|
char name[32];
|
||||||
@@ -165,26 +173,25 @@ typedef struct ModifierTypeInfo {
|
|||||||
* the object it can obtain it from the derivedData argument if non-NULL,
|
* the object it can obtain it from the derivedData argument if non-NULL,
|
||||||
* and otherwise the ob argument.
|
* and otherwise the ob argument.
|
||||||
*/
|
*/
|
||||||
void (*deformVerts_DM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformVerts_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *derivedData,
|
struct DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts,
|
float (*vertexCos)[3], int numVerts);
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
||||||
void (*deformMatrices_DM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformMatrices_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *derivedData,
|
struct DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
|
|
||||||
/* Like deformVerts but called during editmode (for supporting modifiers)
|
/* Like deformVerts but called during editmode (for supporting modifiers)
|
||||||
*/
|
*/
|
||||||
void (*deformVertsEM_DM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformVertsEM_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct DerivedMesh *derivedData,
|
struct DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts);
|
float (*vertexCos)[3], int numVerts);
|
||||||
|
|
||||||
/* Set deform matrix per vertex for crazyspace correction */
|
/* Set deform matrix per vertex for crazyspace correction */
|
||||||
void (*deformMatricesEM_DM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformMatricesEM_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct DerivedMesh *derivedData,
|
struct DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
|
|
||||||
@@ -197,21 +204,11 @@ typedef struct ModifierTypeInfo {
|
|||||||
* should read the object data from the derived object instead of the
|
* should read the object data from the derived object instead of the
|
||||||
* actual object data.
|
* actual object data.
|
||||||
*
|
*
|
||||||
* The useRenderParams argument indicates if the modifier is being
|
|
||||||
* applied in the service of the renderer which may alter quality
|
|
||||||
* settings.
|
|
||||||
*
|
|
||||||
* The isFinalCalc parameter indicates if the modifier is being
|
|
||||||
* calculated for a final result or for something temporary
|
|
||||||
* (like orcos). This is a hack at the moment, it is meant so subsurf
|
|
||||||
* can know if it is safe to reuse its internal cache.
|
|
||||||
*
|
|
||||||
* The modifier may reuse the derivedData argument (i.e. return it in
|
* The modifier may reuse the derivedData argument (i.e. return it in
|
||||||
* modified form), but must not release it.
|
* modified form), but must not release it.
|
||||||
*/
|
*/
|
||||||
struct DerivedMesh *(*applyModifier_DM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct DerivedMesh *(*applyModifier_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *derivedData,
|
struct DerivedMesh *derivedData);
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
/* Like applyModifier but called during editmode (for supporting
|
/* Like applyModifier but called during editmode (for supporting
|
||||||
* modifiers).
|
* modifiers).
|
||||||
@@ -220,9 +217,9 @@ typedef struct ModifierTypeInfo {
|
|||||||
* are expected from editmode objects. The same qualifications regarding
|
* are expected from editmode objects. The same qualifications regarding
|
||||||
* derivedData apply as for applyModifier.
|
* derivedData apply as for applyModifier.
|
||||||
*/
|
*/
|
||||||
struct DerivedMesh *(*applyModifierEM_DM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct DerivedMesh *(*applyModifierEM_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct DerivedMesh *derivedData, ModifierApplyFlag flag);
|
struct DerivedMesh *derivedData);
|
||||||
|
|
||||||
|
|
||||||
/********************* Deform modifier functions *********************/
|
/********************* Deform modifier functions *********************/
|
||||||
@@ -232,28 +229,23 @@ typedef struct ModifierTypeInfo {
|
|||||||
* the object it can obtain it from the mesh argument if non-NULL,
|
* the object it can obtain it from the mesh argument if non-NULL,
|
||||||
* and otherwise the ob argument.
|
* and otherwise the ob argument.
|
||||||
*/
|
*/
|
||||||
void (*deformVerts)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformVerts)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||||
float (*vertexCos)[3], int numVerts,
|
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
||||||
void (*deformMatrices)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformMatrices)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
|
||||||
|
|
||||||
/* Like deformVerts but called during editmode (for supporting modifiers)
|
/* Like deformVerts but called during editmode (for supporting modifiers)
|
||||||
*/
|
*/
|
||||||
void (*deformVertsEM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformVertsEM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct Mesh *mesh,
|
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||||
float (*vertexCos)[3], int numVerts);
|
|
||||||
|
|
||||||
/* Set deform matrix per vertex for crazyspace correction */
|
/* Set deform matrix per vertex for crazyspace correction */
|
||||||
void (*deformMatricesEM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void (*deformMatricesEM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct Mesh *mesh,
|
struct Mesh *mesh, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
|
||||||
|
|
||||||
/********************* Non-deform modifier functions *********************/
|
/********************* Non-deform modifier functions *********************/
|
||||||
|
|
||||||
@@ -263,21 +255,11 @@ typedef struct ModifierTypeInfo {
|
|||||||
* should read the object data from the mesh object instead of the
|
* should read the object data from the mesh object instead of the
|
||||||
* actual object data.
|
* actual object data.
|
||||||
*
|
*
|
||||||
* The useRenderParams argument indicates if the modifier is being
|
|
||||||
* applied in the service of the renderer which may alter quality
|
|
||||||
* settings.
|
|
||||||
*
|
|
||||||
* The isFinalCalc parameter indicates if the modifier is being
|
|
||||||
* calculated for a final result or for something temporary
|
|
||||||
* (like orcos). This is a hack at the moment, it is meant so subsurf
|
|
||||||
* can know if it is safe to reuse its internal cache.
|
|
||||||
*
|
|
||||||
* The modifier may reuse the mesh argument (i.e. return it in
|
* The modifier may reuse the mesh argument (i.e. return it in
|
||||||
* modified form), but must not release it.
|
* modified form), but must not release it.
|
||||||
*/
|
*/
|
||||||
struct Mesh *(*applyModifier)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct Mesh *(*applyModifier)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh);
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
/* Like applyModifier but called during editmode (for supporting
|
/* Like applyModifier but called during editmode (for supporting
|
||||||
* modifiers).
|
* modifiers).
|
||||||
@@ -286,9 +268,9 @@ typedef struct ModifierTypeInfo {
|
|||||||
* are expected from editmode objects. The same qualifications regarding
|
* are expected from editmode objects. The same qualifications regarding
|
||||||
* mesh apply as for applyModifier.
|
* mesh apply as for applyModifier.
|
||||||
*/
|
*/
|
||||||
struct Mesh *(*applyModifierEM)(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct Mesh *(*applyModifierEM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct Mesh *mesh, ModifierApplyFlag flag);
|
struct Mesh *mesh);
|
||||||
|
|
||||||
|
|
||||||
/********************* Optional functions *********************/
|
/********************* Optional functions *********************/
|
||||||
@@ -490,24 +472,20 @@ const char *modifier_path_relbase(struct Object *ob);
|
|||||||
/* wrappers for modifier callbacks that ensure valid normals */
|
/* wrappers for modifier callbacks that ensure valid normals */
|
||||||
|
|
||||||
struct DerivedMesh *modwrap_applyModifier(
|
struct DerivedMesh *modwrap_applyModifier(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm);
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
struct DerivedMesh *modwrap_applyModifierEM(
|
struct DerivedMesh *modwrap_applyModifierEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *em,
|
struct BMEditMesh *em, struct DerivedMesh *dm);
|
||||||
struct DerivedMesh *dm,
|
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
void modwrap_deformVerts(
|
void modwrap_deformVerts(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], int numVerts,
|
float (*vertexCos)[3], int numVerts);
|
||||||
ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
void modwrap_deformVertsEM(
|
void modwrap_deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob,
|
ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct BMEditMesh *em, struct DerivedMesh *dm,
|
struct BMEditMesh *em, struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], int numVerts);
|
float (*vertexCos)[3], int numVerts);
|
||||||
|
|
||||||
@@ -516,64 +494,59 @@ void modwrap_deformVertsEM(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void modifier_deformVerts(
|
void modifier_deformVerts(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
void modifier_deformMatrices(
|
void modifier_deformMatrices(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
|
||||||
|
|
||||||
void modifier_deformVertsEM(
|
void modifier_deformVertsEM(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct Mesh *mesh,
|
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||||
float (*vertexCos)[3], int numVerts);
|
float (*vertexCos)[3], int numVerts);
|
||||||
|
|
||||||
void modifier_deformMatricesEM(
|
void modifier_deformMatricesEM(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct Mesh *mesh,
|
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
|
|
||||||
struct Mesh *modifier_applyModifier(
|
struct Mesh *modifier_applyModifier(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh, ModifierApplyFlag flag);
|
struct Mesh *mesh);
|
||||||
|
|
||||||
struct Mesh *modifier_applyModifierEM(
|
struct Mesh *modifier_applyModifierEM(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData, struct Mesh *mesh);
|
||||||
struct Mesh *mesh, ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
/* depricated variants of above that accept DerivedMesh */
|
/* depricated variants of above that accept DerivedMesh */
|
||||||
|
|
||||||
void modifier_deformVerts_DM_deprecated(
|
void modifier_deformVerts_DM_deprecated(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts);
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
void modifier_deformMatrices_DM_deprecated(
|
void modifier_deformMatrices_DM_deprecated(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
|
|
||||||
void modifier_deformVertsEM_DM_deprecated(
|
void modifier_deformVertsEM_DM_deprecated(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *dm,
|
struct BMEditMesh *editData, struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], int numVerts);
|
float (*vertexCos)[3], int numVerts);
|
||||||
|
|
||||||
void modifier_deformMatricesEM_DM_deprecated(
|
void modifier_deformMatricesEM_DM_deprecated(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *dm,
|
struct BMEditMesh *editData, struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||||
|
|
||||||
struct DerivedMesh *modifier_applyModifier_DM_deprecated(
|
struct DerivedMesh *modifier_applyModifier_DM_deprecated(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm, ModifierApplyFlag flag);
|
struct DerivedMesh *dm);
|
||||||
|
|
||||||
struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(
|
struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(
|
||||||
struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData, struct DerivedMesh *dm);
|
||||||
struct DerivedMesh *dm, ModifierApplyFlag flag);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1145,6 +1145,7 @@ DerivedMesh *mesh_create_derived_for_modifier(
|
|||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
DerivedMesh *dm;
|
DerivedMesh *dm;
|
||||||
KeyBlock *kb;
|
KeyBlock *kb;
|
||||||
|
ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
|
||||||
md->scene = scene;
|
md->scene = scene;
|
||||||
|
|
||||||
@@ -1167,7 +1168,7 @@ DerivedMesh *mesh_create_derived_for_modifier(
|
|||||||
Mesh *mesh_orig_id = (Mesh *)DEG_get_original_id(&me->id);
|
Mesh *mesh_orig_id = (Mesh *)DEG_get_original_id(&me->id);
|
||||||
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(mesh_orig_id, &numVerts);
|
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(mesh_orig_id, &numVerts);
|
||||||
|
|
||||||
modwrap_deformVerts(md, depsgraph, ob, NULL, deformedVerts, numVerts, 0);
|
modwrap_deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
|
||||||
dm = mesh_create_derived(me, deformedVerts);
|
dm = mesh_create_derived(me, deformedVerts);
|
||||||
|
|
||||||
if (build_shapekey_layers)
|
if (build_shapekey_layers)
|
||||||
@@ -1181,7 +1182,7 @@ DerivedMesh *mesh_create_derived_for_modifier(
|
|||||||
if (build_shapekey_layers)
|
if (build_shapekey_layers)
|
||||||
add_shapekey_layers(tdm, me, ob);
|
add_shapekey_layers(tdm, me, ob);
|
||||||
|
|
||||||
dm = modwrap_applyModifier(md, depsgraph, ob, tdm, 0);
|
dm = modwrap_applyModifier(md, &mectx, tdm);
|
||||||
ASSERT_IS_VALID_DM(dm);
|
ASSERT_IS_VALID_DM(dm);
|
||||||
|
|
||||||
if (tdm != dm) tdm->release(tdm);
|
if (tdm != dm) tdm->release(tdm);
|
||||||
@@ -1796,6 +1797,12 @@ static void mesh_calc_modifiers(
|
|||||||
if (useDeform)
|
if (useDeform)
|
||||||
deform_app_flags |= MOD_APPLY_USECACHE;
|
deform_app_flags |= MOD_APPLY_USECACHE;
|
||||||
|
|
||||||
|
/* TODO(sybren): do we really need three context objects? Or do we modify
|
||||||
|
* them on the fly to change the flags where needed? */
|
||||||
|
const ModifierEvalContext mectx_deform = {depsgraph, ob, deform_app_flags};
|
||||||
|
const ModifierEvalContext mectx_apply = {depsgraph, ob, app_flags};
|
||||||
|
const ModifierEvalContext mectx_orco = {depsgraph, ob, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO};
|
||||||
|
|
||||||
md = firstmd = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
md = firstmd = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
||||||
|
|
||||||
modifiers_clearErrors(ob);
|
modifiers_clearErrors(ob);
|
||||||
@@ -1845,7 +1852,7 @@ static void mesh_calc_modifiers(
|
|||||||
if (!deformedVerts)
|
if (!deformedVerts)
|
||||||
deformedVerts = BKE_mesh_vertexCos_get(mesh_orig_id, &numVerts);
|
deformedVerts = BKE_mesh_vertexCos_get(mesh_orig_id, &numVerts);
|
||||||
|
|
||||||
modwrap_deformVerts(md, depsgraph, ob, NULL, deformedVerts, numVerts, deform_app_flags);
|
modwrap_deformVerts(md, &mectx_deform, NULL, deformedVerts, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
@@ -1986,7 +1993,7 @@ static void mesh_calc_modifiers(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modwrap_deformVerts(md, depsgraph, ob, dm, deformedVerts, numVerts, deform_app_flags);
|
modwrap_deformVerts(md, &mectx_deform, dm, deformedVerts, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *ndm;
|
DerivedMesh *ndm;
|
||||||
@@ -2061,7 +2068,7 @@ static void mesh_calc_modifiers(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, dm, app_flags);
|
ndm = modwrap_applyModifier(md, &mectx_apply, dm);
|
||||||
ASSERT_IS_VALID_DM(ndm);
|
ASSERT_IS_VALID_DM(ndm);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
@@ -2088,7 +2095,7 @@ static void mesh_calc_modifiers(
|
|||||||
(mti->requiredDataMask ?
|
(mti->requiredDataMask ?
|
||||||
mti->requiredDataMask(ob, md) : 0));
|
mti->requiredDataMask(ob, md) : 0));
|
||||||
|
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, orcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO);
|
ndm = modwrap_applyModifier(md, &mectx_orco, orcodm);
|
||||||
ASSERT_IS_VALID_DM(ndm);
|
ASSERT_IS_VALID_DM(ndm);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
@@ -2106,7 +2113,7 @@ static void mesh_calc_modifiers(
|
|||||||
nextmask &= ~CD_MASK_CLOTH_ORCO;
|
nextmask &= ~CD_MASK_CLOTH_ORCO;
|
||||||
DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
|
DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
|
||||||
|
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, clothorcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO);
|
ndm = modwrap_applyModifier(md, &mectx_orco, clothorcodm);
|
||||||
ASSERT_IS_VALID_DM(ndm);
|
ASSERT_IS_VALID_DM(ndm);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
@@ -2300,6 +2307,11 @@ static void editbmesh_calc_modifiers(
|
|||||||
const bool do_mod_wmcol = do_init_wmcol;
|
const bool do_mod_wmcol = do_init_wmcol;
|
||||||
VirtualModifierData virtualModifierData;
|
VirtualModifierData virtualModifierData;
|
||||||
|
|
||||||
|
/* TODO(sybren): do we really need multiple objects, or shall we change the flags where needed? */
|
||||||
|
const ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
const ModifierEvalContext mectx_orco = {depsgraph, ob, MOD_APPLY_ORCO};
|
||||||
|
const ModifierEvalContext mectx_cache_gpu = {depsgraph, ob, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU};
|
||||||
|
|
||||||
const bool do_loop_normals = (((Mesh *)(ob->data))->flag & ME_AUTOSMOOTH) != 0;
|
const bool do_loop_normals = (((Mesh *)(ob->data))->flag & ME_AUTOSMOOTH) != 0;
|
||||||
const float loop_normals_split_angle = ((Mesh *)(ob->data))->smoothresh;
|
const float loop_normals_split_angle = ((Mesh *)(ob->data))->smoothresh;
|
||||||
|
|
||||||
@@ -2363,9 +2375,9 @@ static void editbmesh_calc_modifiers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mti->deformVertsEM || mti->deformVertsEM_DM)
|
if (mti->deformVertsEM || mti->deformVertsEM_DM)
|
||||||
modwrap_deformVertsEM(md, depsgraph, ob, em, dm, deformedVerts, numVerts);
|
modwrap_deformVertsEM(md, &mectx, em, dm, deformedVerts, numVerts);
|
||||||
else
|
else
|
||||||
modwrap_deformVerts(md, depsgraph, ob, dm, deformedVerts, numVerts, 0);
|
modwrap_deformVerts(md, &mectx, dm, deformedVerts, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *ndm;
|
DerivedMesh *ndm;
|
||||||
@@ -2410,10 +2422,10 @@ static void editbmesh_calc_modifiers(
|
|||||||
DM_set_only_copy(orcodm, mask | CD_MASK_ORIGINDEX);
|
DM_set_only_copy(orcodm, mask | CD_MASK_ORIGINDEX);
|
||||||
|
|
||||||
if (mti->applyModifierEM || mti->applyModifierEM_DM) {
|
if (mti->applyModifierEM || mti->applyModifierEM_DM) {
|
||||||
ndm = modwrap_applyModifierEM(md, depsgraph, ob, em, orcodm, MOD_APPLY_ORCO);
|
ndm = modwrap_applyModifierEM(md, &mectx_orco, em, orcodm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, orcodm, MOD_APPLY_ORCO);
|
ndm = modwrap_applyModifier(md, &mectx_orco, orcodm);
|
||||||
}
|
}
|
||||||
ASSERT_IS_VALID_DM(ndm);
|
ASSERT_IS_VALID_DM(ndm);
|
||||||
|
|
||||||
@@ -2438,9 +2450,9 @@ static void editbmesh_calc_modifiers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mti->applyModifierEM || mti->applyModifierEM_DM)
|
if (mti->applyModifierEM || mti->applyModifierEM_DM)
|
||||||
ndm = modwrap_applyModifierEM(md, depsgraph, ob, em, dm, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU);
|
ndm = modwrap_applyModifierEM(md, &mectx_cache_gpu, em, dm);
|
||||||
else
|
else
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, dm, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU);
|
ndm = modwrap_applyModifier(md, &mectx_cache_gpu, dm);
|
||||||
ASSERT_IS_VALID_DM(ndm);
|
ASSERT_IS_VALID_DM(ndm);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh(
|
|||||||
int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1);
|
int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1);
|
||||||
float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
|
float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
|
||||||
VirtualModifierData virtualModifierData;
|
VirtualModifierData virtualModifierData;
|
||||||
|
ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
|
||||||
modifiers_clearErrors(ob);
|
modifiers_clearErrors(ob);
|
||||||
|
|
||||||
@@ -292,7 +293,7 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh(
|
|||||||
unit_m3(defmats[a]);
|
unit_m3(defmats[a]);
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier_deformMatricesEM_DM_deprecated(md, depsgraph, ob, em, dm, deformedVerts, defmats, numVerts);
|
modifier_deformMatricesEM_DM_deprecated(md, &mectx, em, dm, deformedVerts, defmats, numVerts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@@ -323,6 +324,7 @@ int BKE_sculpt_get_first_deform_matrices(
|
|||||||
const bool has_multires = mmd != NULL && mmd->sculptlvl > 0;
|
const bool has_multires = mmd != NULL && mmd->sculptlvl > 0;
|
||||||
int numleft = 0;
|
int numleft = 0;
|
||||||
VirtualModifierData virtualModifierData;
|
VirtualModifierData virtualModifierData;
|
||||||
|
ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
|
||||||
if (has_multires) {
|
if (has_multires) {
|
||||||
*deformmats = NULL;
|
*deformmats = NULL;
|
||||||
@@ -350,7 +352,7 @@ int BKE_sculpt_get_first_deform_matrices(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mti->deformMatrices || mti->deformMatrices_DM) {
|
if (mti->deformMatrices || mti->deformMatrices_DM) {
|
||||||
modifier_deformMatrices_DM_deprecated(md, depsgraph, ob, dm, deformedVerts, defmats, numVerts);
|
modifier_deformMatrices_DM_deprecated(md, &mectx, dm, deformedVerts, defmats, numVerts);
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
@@ -388,6 +390,7 @@ void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, Scene *scene, Obje
|
|||||||
int i, deformed = 0;
|
int i, deformed = 0;
|
||||||
VirtualModifierData virtualModifierData;
|
VirtualModifierData virtualModifierData;
|
||||||
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
||||||
|
ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
Mesh *me = (Mesh *)ob->data;
|
Mesh *me = (Mesh *)ob->data;
|
||||||
|
|
||||||
for (; md; md = md->next) {
|
for (; md; md = md->next) {
|
||||||
@@ -401,7 +404,7 @@ void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, Scene *scene, Obje
|
|||||||
if ((mti->deformMatrices || mti->deformMatrices_DM) && !deformed)
|
if ((mti->deformMatrices || mti->deformMatrices_DM) && !deformed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, NULL, deformedVerts, me->totvert, 0);
|
modifier_deformVerts_DM_deprecated(md, &mectx, NULL, deformedVerts, me->totvert);
|
||||||
deformed = 1;
|
deformed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -827,6 +827,8 @@ static void curve_calc_modifiers_pre(
|
|||||||
else
|
else
|
||||||
required_mode = eModifierMode_Realtime;
|
required_mode = eModifierMode_Realtime;
|
||||||
|
|
||||||
|
const ModifierEvalContext mectx = {depsgraph, ob, app_flag};
|
||||||
|
|
||||||
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
||||||
|
|
||||||
if (editmode)
|
if (editmode)
|
||||||
@@ -860,7 +862,7 @@ static void curve_calc_modifiers_pre(
|
|||||||
deformedVerts = BKE_curve_nurbs_vertexCos_get(nurb, &numVerts);
|
deformedVerts = BKE_curve_nurbs_vertexCos_get(nurb, &numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, NULL, deformedVerts, numVerts, app_flag);
|
modifier_deformVerts_DM_deprecated(md, &mectx, NULL, deformedVerts, numVerts);
|
||||||
|
|
||||||
if (md == pretessellatePoint)
|
if (md == pretessellatePoint)
|
||||||
break;
|
break;
|
||||||
@@ -935,6 +937,11 @@ static void curve_calc_modifiers_post(
|
|||||||
else
|
else
|
||||||
required_mode = eModifierMode_Realtime;
|
required_mode = eModifierMode_Realtime;
|
||||||
|
|
||||||
|
const ModifierEvalContext mectx_deform = {depsgraph, ob,
|
||||||
|
editmode ? app_flag | MOD_APPLY_USECACHE : app_flag};
|
||||||
|
const ModifierEvalContext mectx_apply = {depsgraph, ob,
|
||||||
|
useCache ? app_flag | MOD_APPLY_USECACHE : app_flag};
|
||||||
|
|
||||||
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
||||||
|
|
||||||
if (editmode)
|
if (editmode)
|
||||||
@@ -950,8 +957,6 @@ static void curve_calc_modifiers_post(
|
|||||||
|
|
||||||
for (; md; md = md->next) {
|
for (; md; md = md->next) {
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
ModifierApplyFlag appf = app_flag;
|
|
||||||
|
|
||||||
md->scene = scene;
|
md->scene = scene;
|
||||||
|
|
||||||
if (!modifier_isEnabled(scene, md, required_mode))
|
if (!modifier_isEnabled(scene, md, required_mode))
|
||||||
@@ -960,8 +965,6 @@ static void curve_calc_modifiers_post(
|
|||||||
if (mti->type == eModifierTypeType_OnlyDeform ||
|
if (mti->type == eModifierTypeType_OnlyDeform ||
|
||||||
(mti->type == eModifierTypeType_DeformOrConstruct && !dm))
|
(mti->type == eModifierTypeType_DeformOrConstruct && !dm))
|
||||||
{
|
{
|
||||||
if (editmode)
|
|
||||||
appf |= MOD_APPLY_USECACHE;
|
|
||||||
if (dm) {
|
if (dm) {
|
||||||
if (!vertCos) {
|
if (!vertCos) {
|
||||||
totvert = dm->getNumVerts(dm);
|
totvert = dm->getNumVerts(dm);
|
||||||
@@ -969,14 +972,14 @@ static void curve_calc_modifiers_post(
|
|||||||
dm->getVertCos(dm, vertCos);
|
dm->getVertCos(dm, vertCos);
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, dm, vertCos, totvert, appf);
|
modifier_deformVerts_DM_deprecated(md, &mectx_deform, dm, vertCos, totvert);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!vertCos) {
|
if (!vertCos) {
|
||||||
vertCos = displist_get_allverts(dispbase, &totvert);
|
vertCos = displist_get_allverts(dispbase, &totvert);
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, NULL, vertCos, totvert, appf);
|
modifier_deformVerts_DM_deprecated(md, &mectx_deform, NULL, vertCos, totvert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1015,10 +1018,7 @@ static void curve_calc_modifiers_post(
|
|||||||
vertCos = NULL;
|
vertCos = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useCache)
|
ndm = modwrap_applyModifier(md, &mectx_apply, dm);
|
||||||
appf |= MOD_APPLY_USECACHE;
|
|
||||||
|
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, dm, appf);
|
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
/* Modifier returned a new derived mesh */
|
/* Modifier returned a new derived mesh */
|
||||||
@@ -1162,6 +1162,8 @@ static void curve_calc_orcodm(
|
|||||||
else
|
else
|
||||||
required_mode = eModifierMode_Realtime;
|
required_mode = eModifierMode_Realtime;
|
||||||
|
|
||||||
|
const ModifierEvalContext mectx = {depsgraph, ob, app_flag};
|
||||||
|
|
||||||
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
||||||
|
|
||||||
if (editmode)
|
if (editmode)
|
||||||
@@ -1190,7 +1192,7 @@ static void curve_calc_orcodm(
|
|||||||
if (mti->type != eModifierTypeType_Constructive)
|
if (mti->type != eModifierTypeType_Constructive)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ndm = modwrap_applyModifier(md, depsgraph, ob, orcodm, app_flag);
|
ndm = modwrap_applyModifier(md, &mectx, orcodm);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
/* if the modifier returned a new dm, release the old one */
|
/* if the modifier returned a new dm, release the old one */
|
||||||
|
|||||||
@@ -1033,6 +1033,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
|
|||||||
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
||||||
float (*vertexCos)[3] = NULL;
|
float (*vertexCos)[3] = NULL;
|
||||||
int numVerts, editmode = (lt->editlatt != NULL);
|
int numVerts, editmode = (lt->editlatt != NULL);
|
||||||
|
const ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
|
||||||
if (ob->curve_cache) {
|
if (ob->curve_cache) {
|
||||||
BKE_displist_free(&ob->curve_cache->disp);
|
BKE_displist_free(&ob->curve_cache->disp);
|
||||||
@@ -1053,7 +1054,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
|
|||||||
if (mti->type != eModifierTypeType_OnlyDeform) continue;
|
if (mti->type != eModifierTypeType_OnlyDeform) continue;
|
||||||
|
|
||||||
if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts);
|
if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts);
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, NULL, vertexCos, numVerts, 0);
|
modifier_deformVerts_DM_deprecated(md, &mectx, NULL, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always displist to make this work like derivedmesh */
|
/* always displist to make this work like derivedmesh */
|
||||||
|
|||||||
@@ -789,9 +789,8 @@ void modifier_path_init(char *path, int path_maxlen, const char *name)
|
|||||||
/* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */
|
/* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */
|
||||||
|
|
||||||
struct DerivedMesh *modwrap_applyModifier(
|
struct DerivedMesh *modwrap_applyModifier(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
|
BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
|
||||||
@@ -799,14 +798,12 @@ struct DerivedMesh *modwrap_applyModifier(
|
|||||||
if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
DM_ensure_normals(dm);
|
DM_ensure_normals(dm);
|
||||||
}
|
}
|
||||||
return modifier_applyModifier_DM_deprecated(md, depsgraph, ob, dm, flag);
|
return modifier_applyModifier_DM_deprecated(md, ctx, dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DerivedMesh *modwrap_applyModifierEM(
|
struct DerivedMesh *modwrap_applyModifierEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct BMEditMesh *em,
|
struct BMEditMesh *em, DerivedMesh *dm)
|
||||||
DerivedMesh *dm,
|
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
|
BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
|
||||||
@@ -814,14 +811,12 @@ struct DerivedMesh *modwrap_applyModifierEM(
|
|||||||
if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
DM_ensure_normals(dm);
|
DM_ensure_normals(dm);
|
||||||
}
|
}
|
||||||
return modifier_applyModifierEM_DM_deprecated(md, depsgraph, ob, em, dm, flag);
|
return modifier_applyModifierEM_DM_deprecated(md, ctx, em, dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void modwrap_deformVerts(
|
void modwrap_deformVerts(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
|
||||||
float (*vertexCos)[3], int numVerts,
|
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
BLI_assert(!dm || CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
|
BLI_assert(!dm || CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
|
||||||
@@ -829,11 +824,11 @@ void modwrap_deformVerts(
|
|||||||
if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
DM_ensure_normals(dm);
|
DM_ensure_normals(dm);
|
||||||
}
|
}
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, dm, vertexCos, numVerts, flag);
|
modifier_deformVerts_DM_deprecated(md, ctx, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void modwrap_deformVertsEM(
|
void modwrap_deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph, Object *ob,
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct BMEditMesh *em, DerivedMesh *dm,
|
struct BMEditMesh *em, DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], int numVerts)
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
@@ -843,7 +838,7 @@ void modwrap_deformVertsEM(
|
|||||||
if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
DM_ensure_normals(dm);
|
DM_ensure_normals(dm);
|
||||||
}
|
}
|
||||||
modifier_deformVertsEM_DM_deprecated(md, depsgraph, ob, em, dm, vertexCos, numVerts);
|
modifier_deformVertsEM_DM_deprecated(md, ctx, em, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
/* end modifier callback wrappers */
|
/* end modifier callback wrappers */
|
||||||
|
|
||||||
@@ -852,15 +847,14 @@ void modwrap_deformVertsEM(
|
|||||||
* depending on if the modifier has been ported to Mesh or is still using DerivedMesh
|
* depending on if the modifier has been ported to Mesh or is still using DerivedMesh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void modifier_deformVerts(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformVerts(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh,
|
||||||
float (*vertexCos)[3], int numVerts,
|
float (*vertexCos)[3], int numVerts)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformVerts) {
|
if (mti->deformVerts) {
|
||||||
mti->deformVerts(md, depsgraph, ob, mesh, vertexCos, numVerts, flag);
|
mti->deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
@@ -868,7 +862,7 @@ void modifier_deformVerts(struct ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
dm = CDDM_from_mesh(mesh);
|
dm = CDDM_from_mesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformVerts_DM(md, depsgraph, ob, dm, vertexCos, numVerts, flag);
|
mti->deformVerts_DM(md, ctx, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm) {
|
if (dm) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
@@ -876,14 +870,14 @@ void modifier_deformVerts(struct ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void modifier_deformMatrices(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformMatrices(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformMatrices) {
|
if (mti->deformMatrices) {
|
||||||
mti->deformMatrices(md, depsgraph, ob, mesh, vertexCos, defMats, numVerts);
|
mti->deformMatrices(md, ctx, mesh, vertexCos, defMats, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
@@ -891,7 +885,7 @@ void modifier_deformMatrices(struct ModifierData *md, struct Depsgraph *depsgrap
|
|||||||
dm = CDDM_from_mesh(mesh);
|
dm = CDDM_from_mesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformMatrices_DM(md, depsgraph, ob, dm, vertexCos, defMats, numVerts);
|
mti->deformMatrices_DM(md, ctx, dm, vertexCos, defMats, numVerts);
|
||||||
|
|
||||||
if (dm) {
|
if (dm) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
@@ -899,14 +893,14 @@ void modifier_deformMatrices(struct ModifierData *md, struct Depsgraph *depsgrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void modifier_deformVertsEM(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformVertsEM(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct Mesh *mesh,
|
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||||
float (*vertexCos)[3], int numVerts)
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformVertsEM) {
|
if (mti->deformVertsEM) {
|
||||||
mti->deformVertsEM(md, depsgraph, ob, editData, mesh, vertexCos, numVerts);
|
mti->deformVertsEM(md, ctx, editData, mesh, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
@@ -914,7 +908,7 @@ void modifier_deformVertsEM(struct ModifierData *md, struct Depsgraph *depsgraph
|
|||||||
dm = CDDM_from_mesh(mesh);
|
dm = CDDM_from_mesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformVertsEM_DM(md, depsgraph, ob, editData, dm, vertexCos, numVerts);
|
mti->deformVertsEM_DM(md, ctx, editData, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm) {
|
if (dm) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
@@ -922,14 +916,14 @@ void modifier_deformVertsEM(struct ModifierData *md, struct Depsgraph *depsgraph
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void modifier_deformMatricesEM(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformMatricesEM(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct Mesh *mesh,
|
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformMatricesEM) {
|
if (mti->deformMatricesEM) {
|
||||||
mti->deformMatricesEM(md, depsgraph, ob, editData, mesh, vertexCos, defMats, numVerts);
|
mti->deformMatricesEM(md, ctx, editData, mesh, vertexCos, defMats, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
@@ -937,7 +931,7 @@ void modifier_deformMatricesEM(struct ModifierData *md, struct Depsgraph *depsgr
|
|||||||
dm = CDDM_from_mesh(mesh);
|
dm = CDDM_from_mesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformMatricesEM_DM(md, depsgraph, ob, editData, dm, vertexCos, defMats, numVerts);
|
mti->deformMatricesEM_DM(md, ctx, editData, dm, vertexCos, defMats, numVerts);
|
||||||
|
|
||||||
if (dm) {
|
if (dm) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
@@ -945,48 +939,48 @@ void modifier_deformMatricesEM(struct ModifierData *md, struct Depsgraph *depsgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mesh *modifier_applyModifier(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct Mesh *modifier_applyModifier(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct Mesh *mesh, ModifierApplyFlag flag)
|
struct Mesh *mesh)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->applyModifier) {
|
if (mti->applyModifier) {
|
||||||
return mti->applyModifier(md, depsgraph, ob, mesh, flag);
|
return mti->applyModifier(md, ctx, mesh);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *dm = CDDM_from_mesh(mesh);
|
DerivedMesh *dm = CDDM_from_mesh(mesh);
|
||||||
|
|
||||||
DerivedMesh *ndm = mti->applyModifier_DM(md, depsgraph, ob, dm, flag);
|
DerivedMesh *ndm = mti->applyModifier_DM(md, ctx, dm);
|
||||||
|
|
||||||
if(ndm != dm) {
|
if(ndm != dm) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
DM_to_mesh(ndm, mesh, ob, CD_MASK_EVERYTHING, true);
|
DM_to_mesh(ndm, mesh, ctx->object, CD_MASK_EVERYTHING, true);
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mesh *modifier_applyModifierEM(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct Mesh *modifier_applyModifierEM(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct Mesh *mesh, ModifierApplyFlag flag)
|
struct Mesh *mesh)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->applyModifierEM) {
|
if (mti->applyModifierEM) {
|
||||||
return mti->applyModifierEM(md, depsgraph, ob, editData, mesh, flag);
|
return mti->applyModifierEM(md, ctx, editData, mesh);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *dm = CDDM_from_mesh(mesh);
|
DerivedMesh *dm = CDDM_from_mesh(mesh);
|
||||||
|
|
||||||
DerivedMesh *ndm = mti->applyModifierEM_DM(md, depsgraph, ob, editData, dm, flag);
|
DerivedMesh *ndm = mti->applyModifierEM_DM(md, ctx, editData, dm);
|
||||||
|
|
||||||
if(ndm != dm) {
|
if(ndm != dm) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
DM_to_mesh(ndm, mesh, ob, CD_MASK_EVERYTHING, true);
|
DM_to_mesh(ndm, mesh, ctx->object, CD_MASK_EVERYTHING, true);
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
@@ -994,15 +988,14 @@ struct Mesh *modifier_applyModifierEM(struct ModifierData *md, struct Depsgraph
|
|||||||
|
|
||||||
/* depricated variants of above that accept DerivedMesh */
|
/* depricated variants of above that accept DerivedMesh */
|
||||||
|
|
||||||
void modifier_deformVerts_DM_deprecated(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformVerts_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], int numVerts,
|
float (*vertexCos)[3], int numVerts)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformVerts_DM) {
|
if (mti->deformVerts_DM) {
|
||||||
mti->deformVerts_DM(md, depsgraph, ob, dm, vertexCos, numVerts, flag);
|
mti->deformVerts_DM(md, ctx, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||||
@@ -1010,10 +1003,10 @@ void modifier_deformVerts_DM_deprecated(struct ModifierData *md, struct Depsgrap
|
|||||||
if (dm != NULL) {
|
if (dm != NULL) {
|
||||||
mesh = BKE_libblock_alloc_notest(ID_ME);
|
mesh = BKE_libblock_alloc_notest(ID_ME);
|
||||||
BKE_mesh_init(mesh);
|
BKE_mesh_init(mesh);
|
||||||
DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
|
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformVerts(md, depsgraph, ob, mesh, vertexCos, numVerts, flag);
|
mti->deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||||
|
|
||||||
if (mesh != NULL) {
|
if (mesh != NULL) {
|
||||||
BKE_mesh_free(mesh);
|
BKE_mesh_free(mesh);
|
||||||
@@ -1022,15 +1015,15 @@ void modifier_deformVerts_DM_deprecated(struct ModifierData *md, struct Depsgrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm,
|
struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
|
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformMatrices_DM) {
|
if (mti->deformMatrices_DM) {
|
||||||
mti->deformMatrices_DM(md, depsgraph, ob, dm, vertexCos, defMats, numVerts);
|
mti->deformMatrices_DM(md, ctx, dm, vertexCos, defMats, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||||
@@ -1038,10 +1031,10 @@ void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, struct Depsg
|
|||||||
if (dm != NULL) {
|
if (dm != NULL) {
|
||||||
mesh = BKE_libblock_alloc_notest(ID_ME);
|
mesh = BKE_libblock_alloc_notest(ID_ME);
|
||||||
BKE_mesh_init(mesh);
|
BKE_mesh_init(mesh);
|
||||||
DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
|
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformMatrices(md, depsgraph, ob, mesh, vertexCos, defMats, numVerts);
|
mti->deformMatrices(md, ctx, mesh, vertexCos, defMats, numVerts);
|
||||||
|
|
||||||
if (mesh != NULL) {
|
if (mesh != NULL) {
|
||||||
BKE_mesh_free(mesh);
|
BKE_mesh_free(mesh);
|
||||||
@@ -1050,14 +1043,14 @@ void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, struct Depsg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *dm,
|
struct BMEditMesh *editData, struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], int numVerts)
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformVertsEM_DM) {
|
if (mti->deformVertsEM_DM) {
|
||||||
mti->deformVertsEM_DM(md, depsgraph, ob, editData, dm, vertexCos, numVerts);
|
mti->deformVertsEM_DM(md, ctx, editData, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||||
@@ -1065,10 +1058,10 @@ void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, struct Depsgr
|
|||||||
if (dm != NULL) {
|
if (dm != NULL) {
|
||||||
mesh = BKE_libblock_alloc_notest(ID_ME);
|
mesh = BKE_libblock_alloc_notest(ID_ME);
|
||||||
BKE_mesh_init(mesh);
|
BKE_mesh_init(mesh);
|
||||||
DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
|
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformVertsEM(md, depsgraph, ob, editData, mesh, vertexCos, numVerts);
|
mti->deformVertsEM(md, ctx, editData, mesh, vertexCos, numVerts);
|
||||||
|
|
||||||
if (mesh != NULL) {
|
if (mesh != NULL) {
|
||||||
BKE_mesh_free(mesh);
|
BKE_mesh_free(mesh);
|
||||||
@@ -1077,14 +1070,14 @@ void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, struct Depsgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, struct Depsgraph *depsgraph,
|
void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *dm,
|
struct BMEditMesh *editData, struct DerivedMesh *dm,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->deformMatricesEM_DM) {
|
if (mti->deformMatricesEM_DM) {
|
||||||
mti->deformMatricesEM_DM(md, depsgraph, ob, editData, dm, vertexCos, defMats, numVerts);
|
mti->deformMatricesEM_DM(md, ctx, editData, dm, vertexCos, defMats, numVerts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||||
@@ -1092,10 +1085,10 @@ void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, struct Dep
|
|||||||
if (dm != NULL) {
|
if (dm != NULL) {
|
||||||
mesh = BKE_libblock_alloc_notest(ID_ME);
|
mesh = BKE_libblock_alloc_notest(ID_ME);
|
||||||
BKE_mesh_init(mesh);
|
BKE_mesh_init(mesh);
|
||||||
DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
|
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformMatricesEM(md, depsgraph, ob, editData, mesh, vertexCos, defMats, numVerts);
|
mti->deformMatricesEM(md, ctx, editData, mesh, vertexCos, defMats, numVerts);
|
||||||
|
|
||||||
if (mesh != NULL) {
|
if (mesh != NULL) {
|
||||||
BKE_mesh_free(mesh);
|
BKE_mesh_free(mesh);
|
||||||
@@ -1104,13 +1097,13 @@ void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, struct Dep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DerivedMesh *modifier_applyModifier_DM_deprecated(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct DerivedMesh *modifier_applyModifier_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct DerivedMesh *dm, ModifierApplyFlag flag)
|
struct DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->applyModifier_DM) {
|
if (mti->applyModifier_DM) {
|
||||||
return mti->applyModifier_DM(md, depsgraph, ob, dm, flag);
|
return mti->applyModifier_DM(md, ctx, dm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||||
@@ -1118,10 +1111,10 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(struct ModifierData *md
|
|||||||
if (dm != NULL) {
|
if (dm != NULL) {
|
||||||
mesh = BKE_libblock_alloc_notest(ID_ME);
|
mesh = BKE_libblock_alloc_notest(ID_ME);
|
||||||
BKE_mesh_init(mesh);
|
BKE_mesh_init(mesh);
|
||||||
DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
|
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mesh *new_mesh = mti->applyModifier(md, depsgraph, ob, mesh, flag);
|
struct Mesh *new_mesh = mti->applyModifier(md, ctx, mesh);
|
||||||
|
|
||||||
/* Make a DM that doesn't reference new_mesh so we can free the latter. */
|
/* Make a DM that doesn't reference new_mesh so we can free the latter. */
|
||||||
DerivedMesh *ndm = CDDM_from_mesh_ex(new_mesh, CD_DUPLICATE);
|
DerivedMesh *ndm = CDDM_from_mesh_ex(new_mesh, CD_DUPLICATE);
|
||||||
@@ -1139,14 +1132,14 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(struct ModifierData *md
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(struct ModifierData *md, struct Depsgraph *depsgraph,
|
struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
struct DerivedMesh *dm, ModifierApplyFlag flag)
|
struct DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
|
||||||
if (mti->applyModifierEM) {
|
if (mti->applyModifierEM) {
|
||||||
return mti->applyModifierEM_DM(md, depsgraph, ob, editData, dm, flag);
|
return mti->applyModifierEM_DM(md, ctx, editData, dm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||||
@@ -1154,10 +1147,10 @@ struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(struct ModifierData *
|
|||||||
if (dm != NULL) {
|
if (dm != NULL) {
|
||||||
mesh = BKE_libblock_alloc_notest(ID_ME);
|
mesh = BKE_libblock_alloc_notest(ID_ME);
|
||||||
BKE_mesh_init(mesh);
|
BKE_mesh_init(mesh);
|
||||||
DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
|
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mesh *new_mesh = mti->applyModifierEM(md, depsgraph, ob, editData, mesh, flag);
|
struct Mesh *new_mesh = mti->applyModifierEM(md, ctx, editData, mesh);
|
||||||
|
|
||||||
/* Make a DM that doesn't reference new_mesh so we can free the latter. */
|
/* Make a DM that doesn't reference new_mesh so we can free the latter. */
|
||||||
DerivedMesh *ndm = CDDM_from_mesh_ex(new_mesh, CD_DUPLICATE);
|
DerivedMesh *ndm = CDDM_from_mesh_ex(new_mesh, CD_DUPLICATE);
|
||||||
|
|||||||
@@ -282,8 +282,9 @@ DerivedMesh *get_multires_dm(struct Depsgraph *depsgraph, Scene *scene, Multires
|
|||||||
ModifierData *md = (ModifierData *)mmd;
|
ModifierData *md = (ModifierData *)mmd;
|
||||||
DerivedMesh *tdm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
|
DerivedMesh *tdm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
|
||||||
DerivedMesh *dm;
|
DerivedMesh *dm;
|
||||||
|
ModifierEvalContext mectx = {depsgraph, ob, MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY};
|
||||||
|
|
||||||
dm = modifier_applyModifier_DM_deprecated(md, depsgraph, ob, tdm, MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY);
|
dm = modifier_applyModifier_DM_deprecated(md, &mectx, tdm);
|
||||||
if (dm == tdm) {
|
if (dm == tdm) {
|
||||||
dm = CDDM_copy(tdm);
|
dm = CDDM_copy(tdm);
|
||||||
}
|
}
|
||||||
@@ -431,6 +432,7 @@ int multiresModifier_reshapeFromDeformMod(struct Depsgraph *depsgraph, Scene *sc
|
|||||||
DerivedMesh *dm, *ndm;
|
DerivedMesh *dm, *ndm;
|
||||||
int numVerts, result;
|
int numVerts, result;
|
||||||
float (*deformedVerts)[3];
|
float (*deformedVerts)[3];
|
||||||
|
const ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
|
||||||
if (multires_get_level(ob, mmd, false, true) == 0)
|
if (multires_get_level(ob, mmd, false, true) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -441,7 +443,7 @@ int multiresModifier_reshapeFromDeformMod(struct Depsgraph *depsgraph, Scene *sc
|
|||||||
deformedVerts = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "multiresReshape_deformVerts");
|
deformedVerts = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "multiresReshape_deformVerts");
|
||||||
|
|
||||||
dm->getVertCos(dm, deformedVerts);
|
dm->getVertCos(dm, deformedVerts);
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, dm, deformedVerts, numVerts, 0);
|
modifier_deformVerts_DM_deprecated(md, &mectx, dm, deformedVerts, numVerts);
|
||||||
|
|
||||||
ndm = CDDM_copy(dm);
|
ndm = CDDM_copy(dm);
|
||||||
CDDM_apply_vert_coords(ndm, deformedVerts);
|
CDDM_apply_vert_coords(ndm, deformedVerts);
|
||||||
|
|||||||
@@ -631,6 +631,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
|
|||||||
Curve *cu;
|
Curve *cu;
|
||||||
int numVerts;
|
int numVerts;
|
||||||
float (*vertexCos)[3];
|
float (*vertexCos)[3];
|
||||||
|
ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||||
|
|
||||||
if (ELEM(mti->type, eModifierTypeType_Constructive, eModifierTypeType_Nonconstructive)) {
|
if (ELEM(mti->type, eModifierTypeType_Constructive, eModifierTypeType_Nonconstructive)) {
|
||||||
BKE_report(reports, RPT_ERROR, "Cannot apply constructive modifiers on curve");
|
BKE_report(reports, RPT_ERROR, "Cannot apply constructive modifiers on curve");
|
||||||
@@ -641,7 +642,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
|
|||||||
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
|
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
|
||||||
|
|
||||||
vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts);
|
vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts);
|
||||||
modifier_deformVerts_DM_deprecated(md, depsgraph, ob, NULL, vertexCos, numVerts, 0);
|
modifier_deformVerts_DM_deprecated(md, &mectx, NULL, vertexCos, numVerts);
|
||||||
BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos);
|
BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos);
|
||||||
|
|
||||||
MEM_freeN(vertexCos);
|
MEM_freeN(vertexCos);
|
||||||
|
|||||||
@@ -110,17 +110,16 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, Mesh *mesh,
|
Mesh *mesh,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
||||||
|
|
||||||
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
||||||
|
|
||||||
armature_deform_verts(amd->object, ob, mesh, vertexCos, NULL,
|
armature_deform_verts(amd->object, ctx->object, mesh, vertexCos, NULL,
|
||||||
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
|
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
|
||||||
|
|
||||||
/* free cache */
|
/* free cache */
|
||||||
@@ -131,7 +130,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *em,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
|
||||||
Mesh *mesh, float (*vertexCos)[3], int numVerts)
|
Mesh *mesh, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
||||||
@@ -147,7 +146,7 @@ static void deformVertsEM(
|
|||||||
|
|
||||||
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
||||||
|
|
||||||
armature_deform_verts(amd->object, ob, mesh_src, vertexCos, NULL,
|
armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, NULL,
|
||||||
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
|
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
|
||||||
|
|
||||||
/* free cache */
|
/* free cache */
|
||||||
@@ -163,7 +162,7 @@ static void deformVertsEM(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformMatricesEM(
|
static void deformMatricesEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *em,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
|
||||||
Mesh *mesh, float (*vertexCos)[3],
|
Mesh *mesh, float (*vertexCos)[3],
|
||||||
float (*defMats)[3][3], int numVerts)
|
float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
@@ -178,7 +177,7 @@ static void deformMatricesEM(
|
|||||||
BM_mesh_bm_to_me(em->bm, mesh_src, ¶ms);
|
BM_mesh_bm_to_me(em->bm, mesh_src, ¶ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
armature_deform_verts(amd->object, ob, mesh_src, vertexCos, defMats, numVerts,
|
armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, defMats, numVerts,
|
||||||
amd->deformflag, NULL, amd->defgrp_name);
|
amd->deformflag, NULL, amd->defgrp_name);
|
||||||
|
|
||||||
if (!mesh) {
|
if (!mesh) {
|
||||||
@@ -187,13 +186,13 @@ static void deformMatricesEM(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformMatrices(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, Mesh *mesh,
|
static void deformMatrices(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
||||||
Mesh *mesh_src = mesh ? mesh : ob->data;
|
Mesh *mesh_src = mesh ? mesh : ctx->object->data;
|
||||||
|
|
||||||
armature_deform_verts(amd->object, ob, mesh_src, vertexCos, defMats, numVerts,
|
armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, defMats, numVerts,
|
||||||
amd->deformflag, NULL, amd->defgrp_name);
|
amd->deformflag, NULL, amd->defgrp_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -351,8 +351,7 @@ static void mesh_merge_transform(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Mesh *arrayModifier_doArray(
|
static Mesh *arrayModifier_doArray(
|
||||||
ArrayModifierData *amd, Object *ob, Mesh *mesh,
|
ArrayModifierData *amd, const ModifierEvalContext *ctx, Mesh *mesh)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
const float eps = 1e-6f;
|
const float eps = 1e-6f;
|
||||||
const MVert *src_mvert;
|
const MVert *src_mvert;
|
||||||
@@ -396,10 +395,11 @@ static Mesh *arrayModifier_doArray(
|
|||||||
|
|
||||||
count = amd->count;
|
count = amd->count;
|
||||||
|
|
||||||
if (amd->start_cap && amd->start_cap != ob && amd->start_cap->type == OB_MESH) {
|
if (amd->start_cap && amd->start_cap != ctx->object && amd->start_cap->type == OB_MESH) {
|
||||||
vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(amd->start_cap, ob, &vgroup_start_cap_remap_len);
|
vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(
|
||||||
|
amd->start_cap, ctx->object, &vgroup_start_cap_remap_len);
|
||||||
|
|
||||||
start_cap_mesh = get_mesh_eval_for_modifier(amd->start_cap, flag);
|
start_cap_mesh = get_mesh_eval_for_modifier(amd->start_cap, ctx->flag);
|
||||||
if (start_cap_mesh) {
|
if (start_cap_mesh) {
|
||||||
start_cap_nverts = start_cap_mesh->totvert;
|
start_cap_nverts = start_cap_mesh->totvert;
|
||||||
start_cap_nedges = start_cap_mesh->totedge;
|
start_cap_nedges = start_cap_mesh->totedge;
|
||||||
@@ -407,10 +407,11 @@ static Mesh *arrayModifier_doArray(
|
|||||||
start_cap_npolys = start_cap_mesh->totpoly;
|
start_cap_npolys = start_cap_mesh->totpoly;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (amd->end_cap && amd->end_cap != ob && amd->end_cap->type == OB_MESH) {
|
if (amd->end_cap && amd->end_cap != ctx->object && amd->end_cap->type == OB_MESH) {
|
||||||
vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(amd->end_cap, ob, &vgroup_end_cap_remap_len);
|
vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(
|
||||||
|
amd->end_cap, ctx->object, &vgroup_end_cap_remap_len);
|
||||||
|
|
||||||
end_cap_mesh = get_mesh_eval_for_modifier(amd->end_cap, flag);
|
end_cap_mesh = get_mesh_eval_for_modifier(amd->end_cap, ctx->flag);
|
||||||
if (end_cap_mesh) {
|
if (end_cap_mesh) {
|
||||||
end_cap_nverts = end_cap_mesh->totvert;
|
end_cap_nverts = end_cap_mesh->totvert;
|
||||||
end_cap_nedges = end_cap_mesh->totedge;
|
end_cap_nedges = end_cap_mesh->totedge;
|
||||||
@@ -446,8 +447,8 @@ static Mesh *arrayModifier_doArray(
|
|||||||
float obinv[4][4];
|
float obinv[4][4];
|
||||||
float result_mat[4][4];
|
float result_mat[4][4];
|
||||||
|
|
||||||
if (ob)
|
if (ctx->object)
|
||||||
invert_m4_m4(obinv, ob->obmat);
|
invert_m4_m4(obinv, ctx->object->obmat);
|
||||||
else
|
else
|
||||||
unit_m4(obinv);
|
unit_m4(obinv);
|
||||||
|
|
||||||
@@ -747,12 +748,11 @@ static Mesh *arrayModifier_doArray(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Mesh *applyModifier(ModifierData *md, Depsgraph *UNUSED(depsgraph),
|
static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, Mesh *mesh,
|
Mesh *mesh)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
ArrayModifierData *amd = (ArrayModifierData *) md;
|
ArrayModifierData *amd = (ArrayModifierData *) md;
|
||||||
return arrayModifier_doArray(amd, ob, mesh, flag);
|
return arrayModifier_doArray(amd, ctx, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -86,9 +86,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
/*
|
/*
|
||||||
* This calls the new bevel code (added since 2.64)
|
* This calls the new bevel code (added since 2.64)
|
||||||
*/
|
*/
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
BMesh *bm;
|
BMesh *bm;
|
||||||
@@ -103,12 +102,12 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0;
|
const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0;
|
||||||
const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK);
|
const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK);
|
||||||
const int offset_type = bmd->val_flags;
|
const int offset_type = bmd->val_flags;
|
||||||
const int mat = CLAMPIS(bmd->mat, -1, ob->totcol - 1);
|
const int mat = CLAMPIS(bmd->mat, -1, ctx->object->totcol - 1);
|
||||||
const bool loop_slide = (bmd->flags & MOD_BEVEL_EVEN_WIDTHS) == 0;
|
const bool loop_slide = (bmd->flags & MOD_BEVEL_EVEN_WIDTHS) == 0;
|
||||||
|
|
||||||
bm = DM_to_bmesh(dm, true);
|
bm = DM_to_bmesh(dm, true);
|
||||||
if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0])
|
if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0])
|
||||||
modifier_get_vgroup(ob, dm, bmd->defgrp_name, &dvert, &vgroup);
|
modifier_get_vgroup(ctx->object, dm, bmd->defgrp_name, &dvert, &vgroup);
|
||||||
|
|
||||||
if (vertex_only) {
|
if (vertex_only) {
|
||||||
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
||||||
|
|||||||
@@ -166,9 +166,8 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(
|
static DerivedMesh *applyModifier(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
BooleanModifierData *bmd = (BooleanModifierData *) md;
|
BooleanModifierData *bmd = (BooleanModifierData *) md;
|
||||||
DerivedMesh *dm_other;
|
DerivedMesh *dm_other;
|
||||||
@@ -176,7 +175,7 @@ static DerivedMesh *applyModifier(
|
|||||||
if (!bmd->object)
|
if (!bmd->object)
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
dm_other = get_dm_for_modifier(bmd->object, flag);
|
dm_other = get_dm_for_modifier(bmd->object, ctx->flag);
|
||||||
|
|
||||||
if (dm_other) {
|
if (dm_other) {
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
@@ -184,10 +183,10 @@ static DerivedMesh *applyModifier(
|
|||||||
/* when one of objects is empty (has got no faces) we could speed up
|
/* when one of objects is empty (has got no faces) we could speed up
|
||||||
* calculation a bit returning one of objects' derived meshes (or empty one)
|
* calculation a bit returning one of objects' derived meshes (or empty one)
|
||||||
* Returning mesh is depended on modifiers operation (sergey) */
|
* Returning mesh is depended on modifiers operation (sergey) */
|
||||||
result = get_quick_derivedMesh(ob, dm, bmd->object, dm_other, bmd->operation);
|
result = get_quick_derivedMesh(ctx->object, dm, bmd->object, dm_other, bmd->operation);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
const bool is_flip = (is_negative_m4(ob->obmat) != is_negative_m4(bmd->object->obmat));
|
const bool is_flip = (is_negative_m4(ctx->object->obmat) != is_negative_m4(bmd->object->obmat));
|
||||||
|
|
||||||
BMesh *bm;
|
BMesh *bm;
|
||||||
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_DM(dm, dm_other);
|
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_DM(dm, dm_other);
|
||||||
@@ -234,7 +233,7 @@ static DerivedMesh *applyModifier(
|
|||||||
float imat[4][4];
|
float imat[4][4];
|
||||||
float omat[4][4];
|
float omat[4][4];
|
||||||
|
|
||||||
invert_m4_m4(imat, ob->obmat);
|
invert_m4_m4(imat, ctx->object->obmat);
|
||||||
mul_m4_m4m4(omat, imat, bmd->object->obmat);
|
mul_m4_m4m4(omat, imat, bmd->object->obmat);
|
||||||
|
|
||||||
BMVert *eve;
|
BMVert *eve;
|
||||||
@@ -260,7 +259,7 @@ static DerivedMesh *applyModifier(
|
|||||||
const short ob_src_totcol = bmd->object->totcol;
|
const short ob_src_totcol = bmd->object->totcol;
|
||||||
short *material_remap = BLI_array_alloca(material_remap, ob_src_totcol ? ob_src_totcol : 1);
|
short *material_remap = BLI_array_alloca(material_remap, ob_src_totcol ? ob_src_totcol : 1);
|
||||||
|
|
||||||
BKE_material_remap_object_calc(ob, bmd->object, material_remap);
|
BKE_material_remap_object_calc(ctx->object, bmd->object, material_remap);
|
||||||
|
|
||||||
BMFace *efa;
|
BMFace *efa;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|||||||
@@ -80,9 +80,8 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *UNUSED(ob), struct Mesh *mesh,
|
struct Mesh *mesh)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
Mesh *result;
|
Mesh *result;
|
||||||
BuildModifierData *bmd = (BuildModifierData *) md;
|
BuildModifierData *bmd = (BuildModifierData *) md;
|
||||||
@@ -116,7 +115,7 @@ static Mesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
range_vn_i(edgeMap, numEdge_src, 0);
|
range_vn_i(edgeMap, numEdge_src, 0);
|
||||||
range_vn_i(faceMap, numPoly_src, 0);
|
range_vn_i(faceMap, numPoly_src, 0);
|
||||||
|
|
||||||
struct Scene *scene = DEG_get_input_scene(depsgraph);
|
struct Scene *scene = DEG_get_input_scene(ctx->depsgraph);
|
||||||
frac = (BKE_scene_frame_get(scene) - bmd->start) / bmd->length;
|
frac = (BKE_scene_frame_get(scene) - bmd->start) / bmd->length;
|
||||||
CLAMP(frac, 0.0f, 1.0f);
|
CLAMP(frac, 0.0f, 1.0f);
|
||||||
if (bmd->flag & MOD_BUILD_FLAG_REVERSE) {
|
if (bmd->flag & MOD_BUILD_FLAG_REVERSE) {
|
||||||
|
|||||||
@@ -429,22 +429,21 @@ static void cuboid_do(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
CastModifierData *cmd = (CastModifierData *)md;
|
CastModifierData *cmd = (CastModifierData *)md;
|
||||||
|
|
||||||
dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
|
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
|
||||||
cuboid_do(cmd, ob, dm, vertexCos, numVerts);
|
cuboid_do(cmd, ctx->object, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
|
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
|
||||||
sphere_do(cmd, ob, dm, vertexCos, numVerts);
|
sphere_do(cmd, ctx->object, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
@@ -452,18 +451,18 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, editData, derivedData, NULL, false, false);
|
||||||
CastModifierData *cmd = (CastModifierData *)md;
|
CastModifierData *cmd = (CastModifierData *)md;
|
||||||
|
|
||||||
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
|
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
|
||||||
cuboid_do(cmd, ob, dm, vertexCos, numVerts);
|
cuboid_do(cmd, ctx->object, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
|
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
|
||||||
sphere_do(cmd, ob, dm, vertexCos, numVerts);
|
sphere_do(cmd, ctx->object, dm, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
|
|||||||
@@ -69,8 +69,9 @@ static void initData(ModifierData *md)
|
|||||||
cloth_init(clmd);
|
cloth_init(clmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3],
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
int numVerts, ModifierApplyFlag UNUSED(flag))
|
DerivedMesh *derivedData, float (*vertexCos)[3],
|
||||||
|
int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm;
|
DerivedMesh *dm;
|
||||||
ClothModifierData *clmd = (ClothModifierData *) md;
|
ClothModifierData *clmd = (ClothModifierData *) md;
|
||||||
@@ -83,7 +84,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *o
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
if (dm == derivedData)
|
if (dm == derivedData)
|
||||||
dm = CDDM_copy(dm);
|
dm = CDDM_copy(dm);
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *o
|
|||||||
* Also hopefully new cloth system will arrive soon..
|
* Also hopefully new cloth system will arrive soon..
|
||||||
*/
|
*/
|
||||||
if (derivedData == NULL && clmd->sim_parms->shapekey_rest) {
|
if (derivedData == NULL && clmd->sim_parms->shapekey_rest) {
|
||||||
KeyBlock *kb = BKE_keyblock_from_key(BKE_key_from_object(ob),
|
KeyBlock *kb = BKE_keyblock_from_key(BKE_key_from_object(ctx->object),
|
||||||
clmd->sim_parms->shapekey_rest);
|
clmd->sim_parms->shapekey_rest);
|
||||||
if (kb && kb->data != NULL) {
|
if (kb && kb->data != NULL) {
|
||||||
float (*layerorco)[3];
|
float (*layerorco)[3];
|
||||||
@@ -109,7 +110,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *o
|
|||||||
|
|
||||||
CDDM_apply_vert_coords(dm, vertexCos);
|
CDDM_apply_vert_coords(dm, vertexCos);
|
||||||
|
|
||||||
clothModifier_do(clmd, depsgraph, md->scene, ob, dm, vertexCos);
|
clothModifier_do(clmd, ctx->depsgraph, md->scene, ctx->object, dm, vertexCos);
|
||||||
|
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,15 +98,15 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int UNUSED(numVerts),
|
int UNUSED(numVerts))
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
CollisionModifierData *collmd = (CollisionModifierData *) md;
|
CollisionModifierData *collmd = (CollisionModifierData *) md;
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
MVert *tempVert = NULL;
|
MVert *tempVert = NULL;
|
||||||
|
Object *ob = ctx->object;
|
||||||
|
|
||||||
/* if possible use/create DerivedMesh */
|
/* if possible use/create DerivedMesh */
|
||||||
if (derivedData) dm = CDDM_copy(derivedData);
|
if (derivedData) dm = CDDM_copy(derivedData);
|
||||||
|
|||||||
@@ -713,12 +713,12 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
static void deformVerts(
|
static void deformVerts(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData,
|
ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
correctivesmooth_modifier_do(md, ob, dm, vertexCos, (unsigned int)numVerts, NULL);
|
correctivesmooth_modifier_do(md, ctx->object, dm, vertexCos, (unsigned int)numVerts, NULL);
|
||||||
|
|
||||||
if (dm != derivedData) {
|
if (dm != derivedData) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
@@ -727,12 +727,12 @@ static void deformVerts(
|
|||||||
|
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, editData, derivedData, NULL, false, false);
|
||||||
|
|
||||||
correctivesmooth_modifier_do(md, ob, dm, vertexCos, (unsigned int)numVerts, editData);
|
correctivesmooth_modifier_do(md, ctx->object, dm, vertexCos, (unsigned int)numVerts, editData);
|
||||||
|
|
||||||
if (dm != derivedData) {
|
if (dm != derivedData) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|||||||
@@ -111,29 +111,28 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||||||
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Curve Modifier");
|
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Curve Modifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
CurveModifierData *cmd = (CurveModifierData *) md;
|
CurveModifierData *cmd = (CurveModifierData *) md;
|
||||||
|
|
||||||
/* silly that defaxis and curve_deform_verts are off by 1
|
/* silly that defaxis and curve_deform_verts are off by 1
|
||||||
* but leave for now to save having to call do_versions */
|
* but leave for now to save having to call do_versions */
|
||||||
curve_deform_verts(cmd->object, ob, derivedData, vertexCos, numVerts,
|
curve_deform_verts(cmd->object, ctx->object, derivedData, vertexCos, numVerts,
|
||||||
cmd->name, cmd->defaxis - 1);
|
cmd->name, cmd->defaxis - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
|
|
||||||
if (!derivedData) dm = CDDM_from_editbmesh(em, false, false);
|
if (!derivedData) dm = CDDM_from_editbmesh(em, false, false);
|
||||||
|
|
||||||
deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0);
|
deformVerts(md, ctx, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (!derivedData) dm->release(dm);
|
if (!derivedData) dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,15 +148,14 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
|||||||
DT_TYPE_SHARP_FACE \
|
DT_TYPE_SHARP_FACE \
|
||||||
)
|
)
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
|
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
ReportList reports;
|
ReportList reports;
|
||||||
|
|
||||||
/* Only used to check wehther we are operating on org data or not... */
|
/* Only used to check wehther we are operating on org data or not... */
|
||||||
Mesh *me = ob->data;
|
Mesh *me = ctx->object->data;
|
||||||
|
|
||||||
const bool invert_vgroup = (dtmd->flags & MOD_DATATRANSFER_INVERT_VGROUP) != 0;
|
const bool invert_vgroup = (dtmd->flags & MOD_DATATRANSFER_INVERT_VGROUP) != 0;
|
||||||
|
|
||||||
@@ -166,7 +165,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
SpaceTransform *space_transform = (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) ? &space_transform_data : NULL;
|
SpaceTransform *space_transform = (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) ? &space_transform_data : NULL;
|
||||||
|
|
||||||
if (space_transform) {
|
if (space_transform) {
|
||||||
BLI_SPACE_TRANSFORM_SETUP(space_transform, ob, dtmd->ob_source);
|
BLI_SPACE_TRANSFORM_SETUP(space_transform, ctx->object, dtmd->ob_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
MVert *mvert = dm->getVertArray(dm);
|
MVert *mvert = dm->getVertArray(dm);
|
||||||
@@ -180,7 +179,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
BKE_reports_init(&reports, RPT_STORE);
|
BKE_reports_init(&reports, RPT_STORE);
|
||||||
|
|
||||||
/* Note: no islands precision for now here. */
|
/* Note: no islands precision for now here. */
|
||||||
BKE_object_data_transfer_dm(depsgraph, md->scene, dtmd->ob_source, ob, dm, dtmd->data_types, false,
|
BKE_object_data_transfer_dm(ctx->depsgraph, md->scene, dtmd->ob_source, ctx->object, dm, dtmd->data_types, false,
|
||||||
dtmd->vmap_mode, dtmd->emap_mode, dtmd->lmap_mode, dtmd->pmap_mode,
|
dtmd->vmap_mode, dtmd->emap_mode, dtmd->lmap_mode, dtmd->pmap_mode,
|
||||||
space_transform, false, max_dist, dtmd->map_ray_radius, 0.0f,
|
space_transform, false, max_dist, dtmd->map_ray_radius, 0.0f,
|
||||||
dtmd->layers_select_src, dtmd->layers_select_dst,
|
dtmd->layers_select_src, dtmd->layers_select_dst,
|
||||||
|
|||||||
@@ -86,9 +86,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
return dataMask;
|
return dataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DecimateModifierData *dmd = (DecimateModifierData *) md;
|
DecimateModifierData *dmd = (DecimateModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData, *result = NULL;
|
DerivedMesh *dm = derivedData, *result = NULL;
|
||||||
@@ -136,7 +135,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
MDeformVert *dvert;
|
MDeformVert *dvert;
|
||||||
int defgrp_index;
|
int defgrp_index;
|
||||||
|
|
||||||
modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
|
modifier_get_vgroup(ctx->object, dm, dmd->defgrp_name, &dvert, &defgrp_index);
|
||||||
|
|
||||||
if (dvert) {
|
if (dvert) {
|
||||||
const unsigned int vert_tot = dm->getNumVerts(dm);
|
const unsigned int vert_tot = dm->getNumVerts(dm);
|
||||||
|
|||||||
@@ -368,15 +368,14 @@ static void displaceModifier_do(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos, dependsOnNormals(md));
|
DerivedMesh *dm = get_cddm(ctx->object, NULL, derivedData, vertexCos, dependsOnNormals(md));
|
||||||
|
|
||||||
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
|
displaceModifier_do((DisplaceModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
@@ -384,12 +383,12 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos, dependsOnNormals(md));
|
DerivedMesh *dm = get_cddm(ctx->object, editData, derivedData, vertexCos, dependsOnNormals(md));
|
||||||
|
|
||||||
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
|
displaceModifier_do((DisplaceModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
|
|||||||
@@ -105,15 +105,14 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
return dataMask;
|
return dataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
||||||
|
|
||||||
/* dont apply dynamic paint on orco dm stack */
|
/* dont apply dynamic paint on orco dm stack */
|
||||||
if (!(flag & MOD_APPLY_ORCO)) {
|
if (!(ctx->flag & MOD_APPLY_ORCO)) {
|
||||||
return dynamicPaint_Modifier_do(pmd, depsgraph, md->scene, ob, dm);
|
return dynamicPaint_Modifier_do(pmd, ctx->depsgraph, md->scene, ctx->object, dm);
|
||||||
}
|
}
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,9 +121,8 @@ static void copyData(ModifierData *md, ModifierData *target)
|
|||||||
modifier_copyData_generic(md, target);
|
modifier_copyData_generic(md, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *UNUSED(ctx),
|
||||||
Object *UNUSED(ob), DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
EdgeSplitModifierData *emd = (EdgeSplitModifierData *) md;
|
EdgeSplitModifierData *emd = (EdgeSplitModifierData *) md;
|
||||||
|
|||||||
@@ -787,8 +787,8 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
|
|||||||
}
|
}
|
||||||
static DerivedMesh *explodeMesh(
|
static DerivedMesh *explodeMesh(
|
||||||
ExplodeModifierData *emd,
|
ExplodeModifierData *emd,
|
||||||
ParticleSystemModifierData *psmd, struct Depsgraph *depsgraph, Scene *scene,
|
ParticleSystemModifierData *psmd, const ModifierEvalContext *ctx, Scene *scene,
|
||||||
Object *ob, DerivedMesh *to_explode)
|
DerivedMesh *to_explode)
|
||||||
{
|
{
|
||||||
DerivedMesh *explode, *dm = to_explode;
|
DerivedMesh *explode, *dm = to_explode;
|
||||||
MFace *mf = NULL, *mface;
|
MFace *mf = NULL, *mface;
|
||||||
@@ -813,9 +813,9 @@ static DerivedMesh *explodeMesh(
|
|||||||
mface = dm->getTessFaceArray(dm);
|
mface = dm->getTessFaceArray(dm);
|
||||||
totpart = psmd->psys->totpart;
|
totpart = psmd->psys->totpart;
|
||||||
|
|
||||||
sim.depsgraph = depsgraph;
|
sim.depsgraph = ctx->depsgraph;
|
||||||
sim.scene = scene;
|
sim.scene = scene;
|
||||||
sim.ob = ob;
|
sim.ob = ctx->object;
|
||||||
sim.psys = psmd->psys;
|
sim.psys = psmd->psys;
|
||||||
sim.psmd = psmd;
|
sim.psmd = psmd;
|
||||||
|
|
||||||
@@ -870,7 +870,7 @@ static DerivedMesh *explodeMesh(
|
|||||||
/*dupvert = CDDM_get_verts(explode);*/
|
/*dupvert = CDDM_get_verts(explode);*/
|
||||||
|
|
||||||
/* getting back to object space */
|
/* getting back to object space */
|
||||||
invert_m4_m4(imat, ob->obmat);
|
invert_m4_m4(imat, ctx->object->obmat);
|
||||||
|
|
||||||
psmd->psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
|
psmd->psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
|
||||||
|
|
||||||
@@ -901,7 +901,7 @@ static DerivedMesh *explodeMesh(
|
|||||||
psys_get_particle_state(&sim, ed_v2, &state, 1);
|
psys_get_particle_state(&sim, ed_v2, &state, 1);
|
||||||
|
|
||||||
vertco = CDDM_get_vert(explode, v)->co;
|
vertco = CDDM_get_vert(explode, v)->co;
|
||||||
mul_m4_v3(ob->obmat, vertco);
|
mul_m4_v3(ctx->object->obmat, vertco);
|
||||||
|
|
||||||
sub_v3_v3(vertco, birth.co);
|
sub_v3_v3(vertco, birth.co);
|
||||||
|
|
||||||
@@ -995,13 +995,12 @@ static ParticleSystemModifierData *findPrecedingParticlesystem(Object *ob, Modif
|
|||||||
}
|
}
|
||||||
return psmd;
|
return psmd;
|
||||||
}
|
}
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
ExplodeModifierData *emd = (ExplodeModifierData *) md;
|
ExplodeModifierData *emd = (ExplodeModifierData *) md;
|
||||||
ParticleSystemModifierData *psmd = findPrecedingParticlesystem(ob, md);
|
ParticleSystemModifierData *psmd = findPrecedingParticlesystem(ctx->object, md);
|
||||||
|
|
||||||
if (psmd) {
|
if (psmd) {
|
||||||
ParticleSystem *psys = psmd->psys;
|
ParticleSystem *psys = psmd->psys;
|
||||||
@@ -1030,7 +1029,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
if (emd->flag & eExplodeFlag_EdgeCut) {
|
if (emd->flag & eExplodeFlag_EdgeCut) {
|
||||||
int *facepa = emd->facepa;
|
int *facepa = emd->facepa;
|
||||||
DerivedMesh *splitdm = cutEdges(emd, dm);
|
DerivedMesh *splitdm = cutEdges(emd, dm);
|
||||||
DerivedMesh *explode = explodeMesh(emd, psmd, depsgraph, md->scene, ob, splitdm);
|
DerivedMesh *explode = explodeMesh(emd, psmd, ctx, md->scene, splitdm);
|
||||||
|
|
||||||
MEM_freeN(emd->facepa);
|
MEM_freeN(emd->facepa);
|
||||||
emd->facepa = facepa;
|
emd->facepa = facepa;
|
||||||
@@ -1038,7 +1037,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
return explode;
|
return explode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return explodeMesh(emd, psmd, depsgraph, md->scene, ob, derivedData);
|
return explodeMesh(emd, psmd, ctx, md->scene, derivedData);
|
||||||
}
|
}
|
||||||
return derivedData;
|
return derivedData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,9 +82,8 @@ static void copyData(ModifierData *md, ModifierData *target)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
|
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
|
||||||
DerivedMesh *result = NULL;
|
DerivedMesh *result = NULL;
|
||||||
@@ -98,7 +97,8 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = fluidsimModifier_do(fluidmd, md->scene, ob, dm, flag & MOD_APPLY_RENDER, flag & MOD_APPLY_USECACHE);
|
result = fluidsimModifier_do(fluidmd, md->scene, ctx->object, dm,
|
||||||
|
ctx->flag & MOD_APPLY_RENDER, ctx->flag & MOD_APPLY_USECACHE);
|
||||||
|
|
||||||
return result ? result : dm;
|
return result ? result : dm;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,32 +352,31 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts,
|
float (*vertexCos)[3], int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
HookModifierData *hmd = (HookModifierData *) md;
|
HookModifierData *hmd = (HookModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
/* We need a valid dm for meshes when a vgroup is set... */
|
/* We need a valid dm for meshes when a vgroup is set... */
|
||||||
if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
|
if (!dm && ctx->object->type == OB_MESH && hmd->name[0] != '\0')
|
||||||
dm = get_dm(ob, NULL, dm, NULL, false, false);
|
dm = get_dm(ctx->object, NULL, dm, NULL, false, false);
|
||||||
|
|
||||||
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
|
deformVerts_do(hmd, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (derivedData != dm)
|
if (derivedData != dm)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData,
|
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
HookModifierData *hmd = (HookModifierData *) md;
|
HookModifierData *hmd = (HookModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
/* We need a valid dm for meshes when a vgroup is set... */
|
/* We need a valid dm for meshes when a vgroup is set... */
|
||||||
if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
|
if (!dm && ctx->object->type == OB_MESH && hmd->name[0] != '\0')
|
||||||
dm = get_dm(ob, editData, dm, NULL, false, false);
|
dm = get_dm(ctx->object, editData, dm, NULL, false, false);
|
||||||
|
|
||||||
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
|
deformVerts_do(hmd, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (derivedData != dm)
|
if (derivedData != dm)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|||||||
@@ -724,23 +724,23 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
return dataMask;
|
return dataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ob, dm, vertexCos, numVerts);
|
LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ctx->object, dm, vertexCos, numVerts);
|
||||||
if (dm != derivedData) {
|
if (dm != derivedData) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, editData, derivedData, NULL, false, false);
|
||||||
LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ob, dm,
|
LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
if (dm != derivedData) {
|
if (dm != derivedData) {
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|||||||
@@ -506,17 +506,17 @@ static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
return dataMask;
|
return dataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm;
|
DerivedMesh *dm;
|
||||||
|
|
||||||
if (numVerts == 0)
|
if (numVerts == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
|
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
@@ -524,7 +524,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), O
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm;
|
DerivedMesh *dm;
|
||||||
@@ -532,9 +532,9 @@ static void deformVertsEM(
|
|||||||
if (numVerts == 0)
|
if (numVerts == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dm = get_dm(ob, editData, derivedData, NULL, false, false);
|
dm = get_dm(ctx->object, editData, derivedData, NULL, false, false);
|
||||||
|
|
||||||
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
|
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
|
|||||||
@@ -99,30 +99,29 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||||||
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
|
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
LatticeModifierData *lmd = (LatticeModifierData *) md;
|
LatticeModifierData *lmd = (LatticeModifierData *) md;
|
||||||
|
|
||||||
|
|
||||||
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
||||||
|
|
||||||
lattice_deform_verts(lmd->object, ob, derivedData,
|
lattice_deform_verts(lmd->object, ctx->object, derivedData,
|
||||||
vertexCos, numVerts, lmd->name, lmd->strength);
|
vertexCos, numVerts, lmd->name, lmd->strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
|
|
||||||
if (!derivedData) dm = CDDM_from_editbmesh(em, false, false);
|
if (!derivedData) dm = CDDM_from_editbmesh(em, false, false);
|
||||||
|
|
||||||
deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0);
|
deformVerts(md, ctx, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (!derivedData) dm->release(dm);
|
if (!derivedData) dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
MaskModifierData *mmd = (MaskModifierData *)md;
|
MaskModifierData *mmd = (MaskModifierData *)md;
|
||||||
|
Object *ob = ctx->object;
|
||||||
const bool found_test = (mmd->flag & MOD_MASK_INV) == 0;
|
const bool found_test = (mmd->flag & MOD_MASK_INV) == 0;
|
||||||
DerivedMesh *result = NULL;
|
DerivedMesh *result = NULL;
|
||||||
GHash *vertHash = NULL, *edgeHash, *polyHash;
|
GHash *vertHash = NULL, *edgeHash, *polyHash;
|
||||||
|
|||||||
@@ -272,24 +272,23 @@ static void meshcache_do(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
|
MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
|
||||||
|
|
||||||
meshcache_do(mcmd, ob, derivedData, vertexCos, numVerts);
|
meshcache_do(mcmd, ctx->object, derivedData, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *UNUSED(editData),
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *UNUSED(editData),
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
|
MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
|
||||||
|
|
||||||
meshcache_do(mcmd, ob, derivedData, vertexCos, numVerts);
|
meshcache_do(mcmd, ctx->object, derivedData, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -409,31 +409,30 @@ static void meshdeformModifier_do(
|
|||||||
cagedm->release(cagedm);
|
cagedm->release(cagedm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
||||||
|
|
||||||
meshdeformModifier_do(md, depsgraph, ob, dm, vertexCos, numVerts);
|
meshdeformModifier_do(md, ctx->depsgraph, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm && dm != derivedData)
|
if (dm && dm != derivedData)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object *ob,
|
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct BMEditMesh *UNUSED(editData),
|
struct BMEditMesh *UNUSED(editData),
|
||||||
DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts)
|
int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
meshdeformModifier_do(md, depsgraph, ob, dm, vertexCos, numVerts);
|
meshdeformModifier_do(md, ctx->depsgraph, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm && dm != derivedData)
|
if (dm && dm != derivedData)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|||||||
@@ -90,15 +90,14 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
|||||||
return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0');
|
return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
#ifdef WITH_ALEMBIC
|
#ifdef WITH_ALEMBIC
|
||||||
MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
|
MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
|
||||||
|
|
||||||
/* Only used to check whether we are operating on org data or not... */
|
/* Only used to check whether we are operating on org data or not... */
|
||||||
Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
|
Mesh *me = (ctx->object->type == OB_MESH) ? ctx->object->data : NULL;
|
||||||
DerivedMesh *org_dm = dm;
|
DerivedMesh *org_dm = dm;
|
||||||
|
|
||||||
Scene *scene = md->scene;
|
Scene *scene = md->scene;
|
||||||
@@ -113,7 +112,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
if (!mcmd->reader) {
|
if (!mcmd->reader) {
|
||||||
mcmd->reader = CacheReader_open_alembic_object(cache_file->handle,
|
mcmd->reader = CacheReader_open_alembic_object(cache_file->handle,
|
||||||
NULL,
|
NULL,
|
||||||
ob,
|
ctx->object,
|
||||||
mcmd->object_path);
|
mcmd->object_path);
|
||||||
if (!mcmd->reader) {
|
if (!mcmd->reader) {
|
||||||
modifier_setError(md, "Could not create Alembic reader for file %s", cache_file->filepath);
|
modifier_setError(md, "Could not create Alembic reader for file %s", cache_file->filepath);
|
||||||
@@ -132,7 +131,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
}
|
}
|
||||||
|
|
||||||
DerivedMesh *result = ABC_read_mesh(mcmd->reader,
|
DerivedMesh *result = ABC_read_mesh(mcmd->reader,
|
||||||
ob,
|
ctx->object,
|
||||||
dm,
|
dm,
|
||||||
time,
|
time,
|
||||||
&err_str,
|
&err_str,
|
||||||
@@ -150,7 +149,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
return result ? result : dm;
|
return result ? result : dm;
|
||||||
#else
|
#else
|
||||||
return dm;
|
return dm;
|
||||||
UNUSED_VARS(md, ob);
|
UNUSED_VARS(ctx, md);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -330,14 +330,13 @@ static Mesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, Mesh *mesh,
|
Mesh *mesh)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
Mesh *result;
|
Mesh *result;
|
||||||
MirrorModifierData *mmd = (MirrorModifierData *) md;
|
MirrorModifierData *mmd = (MirrorModifierData *) md;
|
||||||
|
|
||||||
result = mirrorModifier__doMirror(mmd, ob, mesh);
|
result = mirrorModifier__doMirror(mmd, ctx->object, mesh);
|
||||||
BKE_mesh_calc_normals(result);
|
BKE_mesh_calc_normals(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -67,14 +67,14 @@ static void copyData(ModifierData *md, ModifierData *target)
|
|||||||
modifier_copyData_generic(md, target);
|
modifier_copyData_generic(md, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *dm, ModifierApplyFlag flag)
|
DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
MultiresModifierData *mmd = (MultiresModifierData *)md;
|
MultiresModifierData *mmd = (MultiresModifierData *)md;
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
Mesh *me = (Mesh *)ob->data;
|
Mesh *me = (Mesh *)ctx->object->data;
|
||||||
const bool useRenderParams = (flag & MOD_APPLY_RENDER) != 0;
|
const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
|
||||||
const bool ignore_simplify = (flag & MOD_APPLY_IGNORE_SIMPLIFY) != 0;
|
const bool ignore_simplify = (ctx->flag & MOD_APPLY_IGNORE_SIMPLIFY) != 0;
|
||||||
MultiresFlags flags = 0;
|
MultiresFlags flags = 0;
|
||||||
const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
|
const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
|
||||||
|
|
||||||
@@ -94,12 +94,12 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
if (ignore_simplify)
|
if (ignore_simplify)
|
||||||
flags |= MULTIRES_IGNORE_SIMPLIFY;
|
flags |= MULTIRES_IGNORE_SIMPLIFY;
|
||||||
|
|
||||||
result = multires_make_derived_from_derived(dm, mmd, ob, flags);
|
result = multires_make_derived_from_derived(dm, mmd, ctx->object, flags);
|
||||||
|
|
||||||
if (result == dm)
|
if (result == dm)
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
if (useRenderParams || !(flag & MOD_APPLY_USECACHE)) {
|
if (useRenderParams || !(ctx->flag & MOD_APPLY_USECACHE)) {
|
||||||
DerivedMesh *cddm;
|
DerivedMesh *cddm;
|
||||||
|
|
||||||
cddm = CDDM_copy(result);
|
cddm = CDDM_copy(result);
|
||||||
|
|||||||
@@ -517,10 +517,10 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *dm, ModifierApplyFlag UNUSED(flag))
|
DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
return normalEditModifier_do((NormalEditModifierData *)md, ob, dm);
|
return normalEditModifier_do((NormalEditModifierData *)md, ctx->object, dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModifierTypeInfo modifierType_NormalEdit = {
|
ModifierTypeInfo modifierType_NormalEdit = {
|
||||||
|
|||||||
@@ -555,13 +555,12 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
|
|||||||
}
|
}
|
||||||
#endif /* WITH_OCEANSIM */
|
#endif /* WITH_OCEANSIM */
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
|
|
||||||
result = doOcean(md, ob, derivedData, 0);
|
result = doOcean(md, ctx->object, derivedData, 0);
|
||||||
|
|
||||||
if (result != derivedData)
|
if (result != derivedData)
|
||||||
result->dirty |= DM_DIRTY_NORMALS;
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|||||||
@@ -202,9 +202,8 @@ static void store_float_in_vcol(MLoopCol *vcol, float float_value)
|
|||||||
vcol->a = 1.0f;
|
vcol->a = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData, *result;
|
DerivedMesh *dm = derivedData, *result;
|
||||||
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
|
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
|
||||||
@@ -217,7 +216,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
int totvert, totpoly, totloop /* , totedge */;
|
int totvert, totpoly, totloop /* , totedge */;
|
||||||
int maxvert, maxpoly, maxloop, part_end = 0, part_start;
|
int maxvert, maxpoly, maxloop, part_end = 0, part_start;
|
||||||
int k, p, p_skip;
|
int k, p, p_skip;
|
||||||
short track = ob->trackflag % 3, trackneg, axis = pimd->axis;
|
short track = ctx->object->trackflag % 3, trackneg, axis = pimd->axis;
|
||||||
float max_co = 0.0, min_co = 0.0, temp_co[3];
|
float max_co = 0.0, min_co = 0.0, temp_co[3];
|
||||||
float *size = NULL;
|
float *size = NULL;
|
||||||
float spacemat[4][4];
|
float spacemat[4][4];
|
||||||
@@ -225,9 +224,9 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
const bool use_children = pimd->flag & eParticleInstanceFlag_Children;
|
const bool use_children = pimd->flag & eParticleInstanceFlag_Children;
|
||||||
bool between;
|
bool between;
|
||||||
|
|
||||||
trackneg = ((ob->trackflag > 2) ? 1 : 0);
|
trackneg = ((ctx->object->trackflag > 2) ? 1 : 0);
|
||||||
|
|
||||||
if (pimd->ob == ob) {
|
if (pimd->ob == ctx->object) {
|
||||||
pimd->ob = NULL;
|
pimd->ob = NULL;
|
||||||
return derivedData;
|
return derivedData;
|
||||||
}
|
}
|
||||||
@@ -252,7 +251,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
if (part_end == 0)
|
if (part_end == 0)
|
||||||
return derivedData;
|
return derivedData;
|
||||||
|
|
||||||
sim.depsgraph = depsgraph;
|
sim.depsgraph = ctx->depsgraph;
|
||||||
sim.scene = md->scene;
|
sim.scene = md->scene;
|
||||||
sim.ob = pimd->ob;
|
sim.ob = pimd->ob;
|
||||||
sim.psys = psys;
|
sim.psys = psys;
|
||||||
|
|||||||
@@ -97,11 +97,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* saves the current emitter state for a particle system and calculates particles */
|
/* saves the current emitter state for a particle system and calculates particles */
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int UNUSED(numVerts),
|
int UNUSED(numVerts))
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md;
|
ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md;
|
||||||
@@ -109,16 +108,16 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
bool needsFree = false;
|
bool needsFree = false;
|
||||||
/* float cfra = BKE_scene_frame_get(md->scene); */ /* UNUSED */
|
/* float cfra = BKE_scene_frame_get(md->scene); */ /* UNUSED */
|
||||||
|
|
||||||
if (ob->particlesystem.first)
|
if (ctx->object->particlesystem.first)
|
||||||
psys = psmd->psys;
|
psys = psmd->psys;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!psys_check_enabled(ob, psys, (flag & MOD_APPLY_RENDER) != 0))
|
if (!psys_check_enabled(ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dm == NULL) {
|
if (dm == NULL) {
|
||||||
dm = get_dm(ob, NULL, NULL, vertexCos, false, true);
|
dm = get_dm(ctx->object, NULL, NULL, vertexCos, false, true);
|
||||||
|
|
||||||
if (!dm)
|
if (!dm)
|
||||||
return;
|
return;
|
||||||
@@ -163,11 +162,11 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
if (!psmd->dm_final->deformedOnly) {
|
if (!psmd->dm_final->deformedOnly) {
|
||||||
/* XXX Think we can assume here that if current DM is not only-deformed, ob->deformedOnly has been set.
|
/* XXX Think we can assume here that if current DM is not only-deformed, ob->deformedOnly has been set.
|
||||||
* This is awfully weak though. :| */
|
* This is awfully weak though. :| */
|
||||||
if (ob->derivedDeform) {
|
if (ctx->object->derivedDeform) {
|
||||||
psmd->dm_deformed = CDDM_copy(ob->derivedDeform);
|
psmd->dm_deformed = CDDM_copy(ctx->object->derivedDeform);
|
||||||
}
|
}
|
||||||
else { /* Can happen in some cases, e.g. when rendering from Edit mode... */
|
else { /* Can happen in some cases, e.g. when rendering from Edit mode... */
|
||||||
psmd->dm_deformed = CDDM_from_mesh((Mesh *)ob->data);
|
psmd->dm_deformed = CDDM_from_mesh((Mesh *)ctx->object->data);
|
||||||
}
|
}
|
||||||
DM_ensure_tessface(psmd->dm_deformed);
|
DM_ensure_tessface(psmd->dm_deformed);
|
||||||
}
|
}
|
||||||
@@ -184,9 +183,9 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph,
|
|||||||
psmd->totdmface = psmd->dm_final->getNumTessFaces(psmd->dm_final);
|
psmd->totdmface = psmd->dm_final->getNumTessFaces(psmd->dm_final);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ob->transflag & OB_NO_PSYS_UPDATE)) {
|
if (!(ctx->object->transflag & OB_NO_PSYS_UPDATE)) {
|
||||||
psmd->flag &= ~eParticleSystemFlag_psys_updated;
|
psmd->flag &= ~eParticleSystemFlag_psys_updated;
|
||||||
particle_system_update(depsgraph, md->scene, ob, psys, (flag & MOD_APPLY_RENDER) != 0);
|
particle_system_update(ctx->depsgraph, md->scene, ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0);
|
||||||
psmd->flag |= eParticleSystemFlag_psys_updated;
|
psmd->flag |= eParticleSystemFlag_psys_updated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,10 +143,8 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md,
|
static DerivedMesh *applyModifier(ModifierData *md,
|
||||||
struct Depsgraph *UNUSED(depsgraph),
|
const ModifierEvalContext *UNUSED(ctx),
|
||||||
Object *UNUSED(ob),
|
DerivedMesh *dm)
|
||||||
DerivedMesh *dm,
|
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
RemeshModifierData *rmd;
|
RemeshModifierData *rmd;
|
||||||
DualConOutput *output;
|
DualConOutput *output;
|
||||||
@@ -205,10 +203,8 @@ static DerivedMesh *applyModifier(ModifierData *md,
|
|||||||
#else /* !WITH_MOD_REMESH */
|
#else /* !WITH_MOD_REMESH */
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *UNUSED(md),
|
static DerivedMesh *applyModifier(ModifierData *UNUSED(md),
|
||||||
struct Depsgraph *UNUSED(depsgraph),
|
const ModifierEvalContext *UNUSED(ctx),
|
||||||
Object *UNUSED(ob),
|
DerivedMesh *derivedData)
|
||||||
DerivedMesh *derivedData,
|
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
return derivedData;
|
return derivedData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,14 +184,13 @@ static void copyData(ModifierData *md, ModifierData *target)
|
|||||||
modifier_copyData_generic(md, target);
|
modifier_copyData_generic(md, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
ScrewModifierData *ltmd = (ScrewModifierData *) md;
|
ScrewModifierData *ltmd = (ScrewModifierData *) md;
|
||||||
const bool use_render_params = (flag & MOD_APPLY_RENDER) != 0;
|
const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER) != 0;
|
||||||
|
|
||||||
int *origindex;
|
int *origindex;
|
||||||
int mpoly_index = 0;
|
int mpoly_index = 0;
|
||||||
@@ -279,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
|
|
||||||
if (ltmd->ob_axis) {
|
if (ltmd->ob_axis) {
|
||||||
/* calc the matrix relative to the axis object */
|
/* calc the matrix relative to the axis object */
|
||||||
invert_m4_m4(mtx_tmp_a, ob->obmat);
|
invert_m4_m4(mtx_tmp_a, ctx->object->obmat);
|
||||||
copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat);
|
copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat);
|
||||||
mul_m4_m4m4(mtx_tx, mtx_tmp_a, mtx_tx_inv);
|
mul_m4_m4m4(mtx_tx, mtx_tmp_a, mtx_tx_inv);
|
||||||
|
|
||||||
|
|||||||
@@ -44,28 +44,27 @@
|
|||||||
|
|
||||||
#include "MOD_modifiertypes.h"
|
#include "MOD_modifiertypes.h"
|
||||||
|
|
||||||
static void deformVerts(ModifierData *UNUSED(md), struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *UNUSED(derivedData),
|
DerivedMesh *UNUSED(derivedData),
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
Key *key = BKE_key_from_object(ob);
|
Key *key = BKE_key_from_object(ctx->object);
|
||||||
|
|
||||||
if (key && key->block.first) {
|
if (key && key->block.first) {
|
||||||
int deformedVerts_tot;
|
int deformedVerts_tot;
|
||||||
BKE_key_evaluate_object_ex(
|
BKE_key_evaluate_object_ex(
|
||||||
ob, &deformedVerts_tot,
|
ctx->object, &deformedVerts_tot,
|
||||||
(float *)vertexCos, sizeof(*vertexCos) * numVerts);
|
(float *)vertexCos, sizeof(*vertexCos) * numVerts);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformMatrices(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData,
|
static void deformMatrices(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||||
{
|
{
|
||||||
Key *key = BKE_key_from_object(ob);
|
Key *key = BKE_key_from_object(ctx->object);
|
||||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
KeyBlock *kb = BKE_keyblock_from_object(ctx->object);
|
||||||
float scale[3][3];
|
float scale[3][3];
|
||||||
|
|
||||||
(void)vertexCos; /* unused */
|
(void)vertexCos; /* unused */
|
||||||
@@ -73,37 +72,37 @@ static void deformMatrices(ModifierData *md, struct Depsgraph *depsgraph, Object
|
|||||||
if (kb && kb->totelem == numVerts && kb != key->refkey) {
|
if (kb && kb->totelem == numVerts && kb != key->refkey) {
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
if (ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1);
|
if (ctx->object->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1);
|
||||||
else scale_m3_fl(scale, kb->curval);
|
else scale_m3_fl(scale, kb->curval);
|
||||||
|
|
||||||
for (a = 0; a < numVerts; a++)
|
for (a = 0; a < numVerts; a++)
|
||||||
copy_m3_m3(defMats[a], scale);
|
copy_m3_m3(defMats[a], scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
deformVerts(md, depsgraph, ob, derivedData, vertexCos, numVerts, 0);
|
deformVerts(md, ctx, derivedData, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object *ob,
|
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct BMEditMesh *UNUSED(editData),
|
struct BMEditMesh *UNUSED(editData),
|
||||||
DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts)
|
int numVerts)
|
||||||
{
|
{
|
||||||
Key *key = BKE_key_from_object(ob);
|
Key *key = BKE_key_from_object(ctx->object);
|
||||||
|
|
||||||
if (key && key->type == KEY_RELATIVE)
|
if (key && key->type == KEY_RELATIVE)
|
||||||
deformVerts(md, depsgraph, ob, derivedData, vertexCos, numVerts, 0);
|
deformVerts(md, ctx, derivedData, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformMatricesEM(ModifierData *UNUSED(md), struct Depsgraph *UNUSED(depsgraph),
|
static void deformMatricesEM(ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct BMEditMesh *UNUSED(editData),
|
struct BMEditMesh *UNUSED(editData),
|
||||||
DerivedMesh *UNUSED(derivedData),
|
DerivedMesh *UNUSED(derivedData),
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
float (*defMats)[3][3],
|
float (*defMats)[3][3],
|
||||||
int numVerts)
|
int numVerts)
|
||||||
{
|
{
|
||||||
Key *key = BKE_key_from_object(ob);
|
Key *key = BKE_key_from_object(ctx->object);
|
||||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
KeyBlock *kb = BKE_keyblock_from_object(ctx->object);
|
||||||
float scale[3][3];
|
float scale[3][3];
|
||||||
|
|
||||||
(void)vertexCos; /* unused */
|
(void)vertexCos; /* unused */
|
||||||
|
|||||||
@@ -103,40 +103,39 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
|
|||||||
walk(userData, ob, &smd->auxTarget, IDWALK_CB_NOP);
|
walk(userData, ob, &smd->auxTarget, IDWALK_CB_NOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
CustomDataMask dataMask = requiredDataMask(ob, md);
|
CustomDataMask dataMask = requiredDataMask(ctx->object, md);
|
||||||
bool forRender = (flag & MOD_APPLY_RENDER) != 0;
|
bool forRender = (ctx->flag & MOD_APPLY_RENDER) != 0;
|
||||||
|
|
||||||
/* ensure we get a CDDM with applied vertex coords */
|
/* ensure we get a CDDM with applied vertex coords */
|
||||||
if (dataMask) {
|
if (dataMask) {
|
||||||
dm = get_cddm(ob, NULL, dm, vertexCos, dependsOnNormals(md));
|
dm = get_cddm(ctx->object, NULL, dm, vertexCos, dependsOnNormals(md));
|
||||||
}
|
}
|
||||||
|
|
||||||
shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts, forRender);
|
shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ctx->object, dm, vertexCos, numVerts, forRender);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
struct BMEditMesh *editData, DerivedMesh *derivedData,
|
struct BMEditMesh *editData, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts)
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
CustomDataMask dataMask = requiredDataMask(ob, md);
|
CustomDataMask dataMask = requiredDataMask(ctx->object, md);
|
||||||
|
|
||||||
/* ensure we get a CDDM with applied vertex coords */
|
/* ensure we get a CDDM with applied vertex coords */
|
||||||
if (dataMask) {
|
if (dataMask) {
|
||||||
dm = get_cddm(ob, editData, dm, vertexCos, dependsOnNormals(md));
|
dm = get_cddm(ctx->object, editData, dm, vertexCos, dependsOnNormals(md));
|
||||||
}
|
}
|
||||||
|
|
||||||
shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts, false);
|
shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ctx->object, dm, vertexCos, numVerts, false);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|||||||
@@ -384,22 +384,21 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct Mesh *mesh,
|
struct Mesh *mesh,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
SimpleDeformModifier_do((SimpleDeformModifierData *)md, ob, mesh, vertexCos, numVerts);
|
SimpleDeformModifier_do((SimpleDeformModifierData *)md, ctx->object, mesh, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct BMEditMesh *UNUSED(editData),
|
struct BMEditMesh *UNUSED(editData),
|
||||||
struct Mesh *mesh,
|
struct Mesh *mesh,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts)
|
int numVerts)
|
||||||
{
|
{
|
||||||
SimpleDeformModifier_do((SimpleDeformModifierData *)md, ob, mesh, vertexCos, numVerts);
|
SimpleDeformModifier_do((SimpleDeformModifierData *)md, ctx->object, mesh, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1917,10 +1917,8 @@ static void copyData(ModifierData *md, ModifierData *target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md,
|
static DerivedMesh *applyModifier(ModifierData *md,
|
||||||
struct Depsgraph *UNUSED(depsgraph),
|
const ModifierEvalContext *UNUSED(ctx),
|
||||||
Object *UNUSED(ob),
|
DerivedMesh *dm)
|
||||||
DerivedMesh *dm,
|
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
|
|
||||||
|
|||||||
@@ -102,16 +102,15 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|||||||
return dataMask;
|
return dataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
SmokeModifierData *smd = (SmokeModifierData *) md;
|
SmokeModifierData *smd = (SmokeModifierData *) md;
|
||||||
|
|
||||||
if (flag & MOD_APPLY_ORCO)
|
if (ctx->flag & MOD_APPLY_ORCO)
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
return smokeModifier_do(smd, depsgraph, md->scene, ob, dm);
|
return smokeModifier_do(smd, ctx->depsgraph, md->scene, ctx->object, dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dependsOnTime(ModifierData *UNUSED(md))
|
static bool dependsOnTime(ModifierData *UNUSED(md))
|
||||||
|
|||||||
@@ -215,12 +215,12 @@ static void smoothModifier_do(
|
|||||||
MEM_freeN(uctmp);
|
MEM_freeN(uctmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
|
||||||
|
|
||||||
smoothModifier_do((SmoothModifierData *)md, ob, dm,
|
smoothModifier_do((SmoothModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
@@ -228,12 +228,12 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), O
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData,
|
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
|
DerivedMesh *dm = get_dm(ctx->object, editData, derivedData, NULL, false, false);
|
||||||
|
|
||||||
smoothModifier_do((SmoothModifierData *)md, ob, dm,
|
smoothModifier_do((SmoothModifierData *)md, ctx->object, dm,
|
||||||
vertexCos, numVerts);
|
vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
|
|||||||
@@ -49,13 +49,12 @@
|
|||||||
|
|
||||||
#include "MOD_modifiertypes.h"
|
#include "MOD_modifiertypes.h"
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, Depsgraph *depsgraph, Object *ob,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *UNUSED(derivedData),
|
DerivedMesh *UNUSED(derivedData),
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
sbObjectStep(depsgraph, md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts);
|
sbObjectStep(ctx->depsgraph, md->scene, ctx->object, (float)md->scene->r.cfra, vertexCos, numVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dependsOnTime(ModifierData *UNUSED(md))
|
static bool dependsOnTime(ModifierData *UNUSED(md))
|
||||||
|
|||||||
@@ -205,9 +205,8 @@ BLI_INLINE void madd_v3v3short_fl(float r[3], const short a[3], const float f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(
|
static DerivedMesh *applyModifier(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
const SolidifyModifierData *smd = (SolidifyModifierData *) md;
|
const SolidifyModifierData *smd = (SolidifyModifierData *) md;
|
||||||
@@ -223,7 +222,7 @@ static DerivedMesh *applyModifier(
|
|||||||
unsigned int newLoops = 0, newFaces = 0, newEdges = 0, newVerts = 0, rimVerts = 0;
|
unsigned int newLoops = 0, newFaces = 0, newEdges = 0, newVerts = 0, rimVerts = 0;
|
||||||
|
|
||||||
/* only use material offsets if we have 2 or more materials */
|
/* only use material offsets if we have 2 or more materials */
|
||||||
const short mat_nr_max = ob->totcol > 1 ? ob->totcol - 1 : 0;
|
const short mat_nr_max = ctx->object->totcol > 1 ? ctx->object->totcol - 1 : 0;
|
||||||
const short mat_ofs = mat_nr_max ? smd->mat_ofs : 0;
|
const short mat_ofs = mat_nr_max ? smd->mat_ofs : 0;
|
||||||
const short mat_ofs_rim = mat_nr_max ? smd->mat_ofs_rim : 0;
|
const short mat_ofs_rim = mat_nr_max ? smd->mat_ofs_rim : 0;
|
||||||
|
|
||||||
@@ -261,7 +260,7 @@ static DerivedMesh *applyModifier(
|
|||||||
/* array size is doubled in case of using a shell */
|
/* array size is doubled in case of using a shell */
|
||||||
const unsigned int stride = do_shell ? 2 : 1;
|
const unsigned int stride = do_shell ? 2 : 1;
|
||||||
|
|
||||||
modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
|
modifier_get_vgroup(ctx->object, dm, smd->defgrp_name, &dvert, &defgrp_index);
|
||||||
|
|
||||||
orig_mvert = dm->getVertArray(dm);
|
orig_mvert = dm->getVertArray(dm);
|
||||||
orig_medge = dm->getEdgeArray(dm);
|
orig_medge = dm->getEdgeArray(dm);
|
||||||
|
|||||||
@@ -98,18 +98,17 @@ static bool isDisabled(ModifierData *md, int useRenderParams)
|
|||||||
return get_render_subsurf_level(&md->scene->r, levels, useRenderParams != 0) == 0;
|
return get_render_subsurf_level(&md->scene->r, levels, useRenderParams != 0) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
SubsurfModifierData *smd = (SubsurfModifierData *) md;
|
SubsurfModifierData *smd = (SubsurfModifierData *) md;
|
||||||
SubsurfFlags subsurf_flags = 0;
|
SubsurfFlags subsurf_flags = 0;
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
const bool useRenderParams = (flag & MOD_APPLY_RENDER) != 0;
|
const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
|
||||||
const bool isFinalCalc = (flag & MOD_APPLY_USECACHE) != 0;
|
const bool isFinalCalc = (ctx->flag & MOD_APPLY_USECACHE) != 0;
|
||||||
|
|
||||||
#ifdef WITH_OPENSUBDIV
|
#ifdef WITH_OPENSUBDIV
|
||||||
const bool allow_gpu = (flag & MOD_APPLY_ALLOW_GPU) != 0;
|
const bool allow_gpu = (ctx->flag & MOD_APPLY_ALLOW_GPU) != 0;
|
||||||
#endif
|
#endif
|
||||||
bool do_cddm_convert = useRenderParams || !isFinalCalc;
|
bool do_cddm_convert = useRenderParams || !isFinalCalc;
|
||||||
|
|
||||||
@@ -117,7 +116,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph,
|
|||||||
subsurf_flags |= SUBSURF_USE_RENDER_PARAMS;
|
subsurf_flags |= SUBSURF_USE_RENDER_PARAMS;
|
||||||
if (isFinalCalc)
|
if (isFinalCalc)
|
||||||
subsurf_flags |= SUBSURF_IS_FINAL_CALC;
|
subsurf_flags |= SUBSURF_IS_FINAL_CALC;
|
||||||
if (ob->mode & OB_MODE_EDIT)
|
if (ctx->object->mode & OB_MODE_EDIT)
|
||||||
subsurf_flags |= SUBSURF_IN_EDIT_MODE;
|
subsurf_flags |= SUBSURF_IN_EDIT_MODE;
|
||||||
|
|
||||||
#ifdef WITH_OPENSUBDIV
|
#ifdef WITH_OPENSUBDIV
|
||||||
@@ -132,10 +131,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph,
|
|||||||
if (U.opensubdiv_compute_type == USER_OPENSUBDIV_COMPUTE_NONE) {
|
if (U.opensubdiv_compute_type == USER_OPENSUBDIV_COMPUTE_NONE) {
|
||||||
modifier_setError(md, "OpenSubdiv is disabled in User Preferences");
|
modifier_setError(md, "OpenSubdiv is disabled in User Preferences");
|
||||||
}
|
}
|
||||||
else if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) {
|
else if ((ctx->object->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) {
|
||||||
modifier_setError(md, "OpenSubdiv is not supported in paint modes");
|
modifier_setError(md, "OpenSubdiv is not supported in paint modes");
|
||||||
}
|
}
|
||||||
else if ((DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) == 0) {
|
else if ((DEG_get_eval_flags_for_id(ctx->depsgraph, &ctx->object->id) & DAG_EVAL_NEED_CPU) == 0) {
|
||||||
subsurf_flags |= SUBSURF_USE_GPU_BACKEND;
|
subsurf_flags |= SUBSURF_USE_GPU_BACKEND;
|
||||||
do_cddm_convert = false;
|
do_cddm_convert = false;
|
||||||
}
|
}
|
||||||
@@ -156,24 +155,22 @@ static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph,
|
|||||||
|
|
||||||
#ifndef WITH_OPESUBDIV
|
#ifndef WITH_OPESUBDIV
|
||||||
(void) do_cddm_convert;
|
(void) do_cddm_convert;
|
||||||
UNUSED_VARS(depsgraph);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifierEM(
|
static DerivedMesh *applyModifierEM(
|
||||||
ModifierData *md, Depsgraph *UNUSED(depsgraph),
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *UNUSED(ob), struct BMEditMesh *UNUSED(editData),
|
struct BMEditMesh *UNUSED(editData),
|
||||||
DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag flag)
|
|
||||||
{
|
{
|
||||||
SubsurfModifierData *smd = (SubsurfModifierData *) md;
|
SubsurfModifierData *smd = (SubsurfModifierData *) md;
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
/* 'orco' using editmode flags would cause cache to be used twice in editbmesh_calc_modifiers */
|
/* 'orco' using editmode flags would cause cache to be used twice in editbmesh_calc_modifiers */
|
||||||
SubsurfFlags ss_flags = (flag & MOD_APPLY_ORCO) ? 0 : (SUBSURF_FOR_EDIT_MODE | SUBSURF_IN_EDIT_MODE);
|
SubsurfFlags ss_flags = (ctx->flag & MOD_APPLY_ORCO) ? 0 : (SUBSURF_FOR_EDIT_MODE | SUBSURF_IN_EDIT_MODE);
|
||||||
#ifdef WITH_OPENSUBDIV
|
#ifdef WITH_OPENSUBDIV
|
||||||
const bool allow_gpu = (flag & MOD_APPLY_ALLOW_GPU) != 0;
|
const bool allow_gpu = (ctx->flag & MOD_APPLY_ALLOW_GPU) != 0;
|
||||||
if (md->next == NULL && allow_gpu && smd->use_opensubdiv) {
|
if (md->next == NULL && allow_gpu && smd->use_opensubdiv) {
|
||||||
modifier_setError(md, "OpenSubdiv is not supported in edit mode");
|
modifier_setError(md, "OpenSubdiv is not supported in edit mode");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,11 +85,10 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int UNUSED(numVerts),
|
int UNUSED(numVerts))
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
|
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
|
||||||
|
|
||||||
@@ -98,9 +97,9 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
|||||||
|
|
||||||
/* if possible use/create DerivedMesh */
|
/* if possible use/create DerivedMesh */
|
||||||
if (derivedData) surmd->dm = CDDM_copy(derivedData);
|
if (derivedData) surmd->dm = CDDM_copy(derivedData);
|
||||||
else surmd->dm = get_dm(ob, NULL, NULL, NULL, false, false);
|
else surmd->dm = get_dm(ctx->object, NULL, NULL, NULL, false, false);
|
||||||
|
|
||||||
if (!ob->pd) {
|
if (!ctx->object->pd) {
|
||||||
printf("SurfaceModifier deformVerts: Should not happen!\n");
|
printf("SurfaceModifier deformVerts: Should not happen!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -141,7 +140,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
|||||||
/* convert to global coordinates and calculate velocity */
|
/* convert to global coordinates and calculate velocity */
|
||||||
for (i = 0, x = surmd->x, v = surmd->v; i < numverts; i++, x++, v++) {
|
for (i = 0, x = surmd->x, v = surmd->v; i < numverts; i++, x++, v++) {
|
||||||
vec = CDDM_get_vert(surmd->dm, i)->co;
|
vec = CDDM_get_vert(surmd->dm, i)->co;
|
||||||
mul_m4_v3(ob->obmat, vec);
|
mul_m4_v3(ctx->object->obmat, vec);
|
||||||
|
|
||||||
if (init)
|
if (init)
|
||||||
v->co[0] = v->co[1] = v->co[2] = 0.0f;
|
v->co[0] = v->co[1] = v->co[2] = 0.0f;
|
||||||
|
|||||||
@@ -1181,21 +1181,20 @@ static void surfacedeformModifier_do(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(
|
static void deformVerts(
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *UNUSED(derivedData),
|
|
||||||
float (*vertexCos)[3], int numVerts,
|
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
|
||||||
surfacedeformModifier_do(md, vertexCos, numVerts, ob);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void deformVertsEM(
|
|
||||||
ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
|
||||||
Object *ob, struct BMEditMesh *UNUSED(editData),
|
|
||||||
DerivedMesh *UNUSED(derivedData),
|
DerivedMesh *UNUSED(derivedData),
|
||||||
float (*vertexCos)[3], int numVerts)
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
surfacedeformModifier_do(md, vertexCos, numVerts, ob);
|
surfacedeformModifier_do(md, vertexCos, numVerts, ctx->object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deformVertsEM(
|
||||||
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
|
struct BMEditMesh *UNUSED(editData),
|
||||||
|
DerivedMesh *UNUSED(derivedData),
|
||||||
|
float (*vertexCos)[3], int numVerts)
|
||||||
|
{
|
||||||
|
surfacedeformModifier_do(md, vertexCos, numVerts, ctx->object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
||||||
|
|||||||
@@ -85,10 +85,8 @@ static void copyData(ModifierData *md, ModifierData *target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md,
|
static DerivedMesh *applyModifier(ModifierData *md,
|
||||||
struct Depsgraph *UNUSED(depsgraph),
|
const ModifierEvalContext *UNUSED(ctx),
|
||||||
Object *UNUSED(ob),
|
DerivedMesh *dm)
|
||||||
DerivedMesh *dm,
|
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
TriangulateModifierData *tmd = (TriangulateModifierData *)md;
|
TriangulateModifierData *tmd = (TriangulateModifierData *)md;
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
|
|||||||
@@ -316,14 +316,13 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
|||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *result;
|
DerivedMesh *result;
|
||||||
UVProjectModifierData *umd = (UVProjectModifierData *) md;
|
UVProjectModifierData *umd = (UVProjectModifierData *) md;
|
||||||
|
|
||||||
result = uvprojectModifier_do(umd, ob, derivedData);
|
result = uvprojectModifier_do(umd, ctx->object, derivedData);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,9 +146,8 @@ static void uv_warp_compute(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *dm,
|
DerivedMesh *dm)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
UVWarpModifierData *umd = (UVWarpModifierData *) md;
|
UVWarpModifierData *umd = (UVWarpModifierData *) md;
|
||||||
int numPolys, numLoops;
|
int numPolys, numLoops;
|
||||||
@@ -206,7 +205,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
mloop = dm->getLoopArray(dm);
|
mloop = dm->getLoopArray(dm);
|
||||||
/* make sure we are not modifying the original UV map */
|
/* make sure we are not modifying the original UV map */
|
||||||
mloopuv = CustomData_duplicate_referenced_layer_named(&dm->loopData, CD_MLOOPUV, uvname, numLoops);
|
mloopuv = CustomData_duplicate_referenced_layer_named(&dm->loopData, CD_MLOOPUV, uvname, numLoops);
|
||||||
modifier_get_vgroup(ob, dm, umd->vgroup_name, &dvert, &defgrp_index);
|
modifier_get_vgroup(ctx->object, dm, umd->vgroup_name, &dvert, &defgrp_index);
|
||||||
|
|
||||||
UVWarpData data = {.mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv,
|
UVWarpData data = {.mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv,
|
||||||
.dvert = dvert, .defgrp_index = defgrp_index,
|
.dvert = dvert, .defgrp_index = defgrp_index,
|
||||||
|
|||||||
@@ -309,24 +309,24 @@ static int warp_needs_dm(WarpModifierData *wmd)
|
|||||||
return wmd->texture || wmd->defgrp_name[0];
|
return wmd->texture || wmd->defgrp_name[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
|
float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = NULL;
|
DerivedMesh *dm = NULL;
|
||||||
int use_dm = warp_needs_dm((WarpModifierData *)md);
|
int use_dm = warp_needs_dm((WarpModifierData *)md);
|
||||||
|
|
||||||
if (use_dm) {
|
if (use_dm) {
|
||||||
dm = get_cddm(ob, NULL, derivedData, vertexCos, false);
|
dm = get_cddm(ctx->object, NULL, derivedData, vertexCos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts);
|
warpModifier_do((WarpModifierData *)md, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (use_dm) {
|
if (use_dm) {
|
||||||
if (dm != derivedData) dm->release(dm);
|
if (dm != derivedData) dm->release(dm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em,
|
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
@@ -337,7 +337,7 @@ static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object
|
|||||||
dm = CDDM_from_editbmesh(em, false, false);
|
dm = CDDM_from_editbmesh(em, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0);
|
deformVerts(md, ctx, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (use_dm) {
|
if (use_dm) {
|
||||||
if (!derivedData) dm->release(dm);
|
if (!derivedData) dm->release(dm);
|
||||||
|
|||||||
@@ -302,40 +302,39 @@ static void waveModifier_do(WaveModifierData *md,
|
|||||||
if (wmd->texture) MEM_freeN(tex_co);
|
if (wmd->texture) MEM_freeN(tex_co);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph,
|
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, DerivedMesh *derivedData,
|
DerivedMesh *derivedData,
|
||||||
float (*vertexCos)[3],
|
float (*vertexCos)[3],
|
||||||
int numVerts,
|
int numVerts)
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
WaveModifierData *wmd = (WaveModifierData *)md;
|
WaveModifierData *wmd = (WaveModifierData *)md;
|
||||||
|
|
||||||
if (wmd->flag & MOD_WAVE_NORM)
|
if (wmd->flag & MOD_WAVE_NORM)
|
||||||
dm = get_cddm(ob, NULL, dm, vertexCos, false);
|
dm = get_cddm(ctx->object, NULL, dm, vertexCos, false);
|
||||||
else if (wmd->texture || wmd->defgrp_name[0])
|
else if (wmd->texture || wmd->defgrp_name[0])
|
||||||
dm = get_dm(ob, NULL, dm, NULL, false, false);
|
dm = get_dm(ctx->object, NULL, dm, NULL, false, false);
|
||||||
|
|
||||||
waveModifier_do(wmd, depsgraph, ob, dm, vertexCos, numVerts);
|
waveModifier_do(wmd, ctx->depsgraph, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deformVertsEM(
|
static void deformVertsEM(
|
||||||
ModifierData *md, struct Depsgraph *depsgraph,
|
ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
Object *ob, struct BMEditMesh *editData,
|
struct BMEditMesh *editData,
|
||||||
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
||||||
{
|
{
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
WaveModifierData *wmd = (WaveModifierData *)md;
|
WaveModifierData *wmd = (WaveModifierData *)md;
|
||||||
|
|
||||||
if (wmd->flag & MOD_WAVE_NORM)
|
if (wmd->flag & MOD_WAVE_NORM)
|
||||||
dm = get_cddm(ob, editData, dm, vertexCos, false);
|
dm = get_cddm(ctx->object, editData, dm, vertexCos, false);
|
||||||
else if (wmd->texture || wmd->defgrp_name[0])
|
else if (wmd->texture || wmd->defgrp_name[0])
|
||||||
dm = get_dm(ob, editData, dm, NULL, false, false);
|
dm = get_dm(ctx->object, editData, dm, NULL, false, false);
|
||||||
|
|
||||||
waveModifier_do(wmd, depsgraph, ob, dm, vertexCos, numVerts);
|
waveModifier_do(wmd, ctx->depsgraph, ctx->object, dm, vertexCos, numVerts);
|
||||||
|
|
||||||
if (dm != derivedData)
|
if (dm != derivedData)
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|||||||
@@ -155,10 +155,8 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md,
|
static DerivedMesh *applyModifier(ModifierData *md,
|
||||||
struct Depsgraph *UNUSED(depsgraph),
|
const ModifierEvalContext *ctx,
|
||||||
Object *ob,
|
DerivedMesh *derivedData)
|
||||||
DerivedMesh *derivedData,
|
|
||||||
ModifierApplyFlag UNUSED(flag))
|
|
||||||
{
|
{
|
||||||
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md;
|
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
@@ -183,11 +181,11 @@ static DerivedMesh *applyModifier(ModifierData *md,
|
|||||||
/* Check if we can just return the original mesh.
|
/* Check if we can just return the original mesh.
|
||||||
* Must have verts and therefore verts assigned to vgroups to do anything useful!
|
* Must have verts and therefore verts assigned to vgroups to do anything useful!
|
||||||
*/
|
*/
|
||||||
if ((numVerts == 0) || BLI_listbase_is_empty(&ob->defbase))
|
if ((numVerts == 0) || BLI_listbase_is_empty(&ctx->object->defbase))
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
/* Get vgroup idx from its name. */
|
/* Get vgroup idx from its name. */
|
||||||
defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
|
defgrp_index = defgroup_name_index(ctx->object, wmd->defgrp_name);
|
||||||
if (defgrp_index == -1)
|
if (defgrp_index == -1)
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
@@ -223,7 +221,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
|
|||||||
RNG *rng = NULL;
|
RNG *rng = NULL;
|
||||||
|
|
||||||
if (wmd->falloff_type == MOD_WVG_MAPPING_RANDOM)
|
if (wmd->falloff_type == MOD_WVG_MAPPING_RANDOM)
|
||||||
rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ob->id.name + 2));
|
rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ctx->object->id.name + 2));
|
||||||
|
|
||||||
weightvg_do_map(numVerts, new_w, wmd->falloff_type, wmd->cmap_curve, rng);
|
weightvg_do_map(numVerts, new_w, wmd->falloff_type, wmd->cmap_curve, rng);
|
||||||
|
|
||||||
@@ -232,7 +230,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do masking. */
|
/* Do masking. */
|
||||||
weightvg_do_mask(numVerts, NULL, org_w, new_w, ob, dm, wmd->mask_constant,
|
weightvg_do_mask(numVerts, NULL, org_w, new_w, ctx->object, dm, wmd->mask_constant,
|
||||||
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
|
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
|
||||||
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
|
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
|
||||||
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
|
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
|
||||||
|
|||||||
@@ -201,8 +201,8 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
|||||||
return (wmd->defgrp_name_a[0] == '\0');
|
return (wmd->defgrp_name_a[0] == '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag))
|
DerivedMesh *derivedData)
|
||||||
{
|
{
|
||||||
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md;
|
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
@@ -226,16 +226,16 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
/* Check if we can just return the original mesh.
|
/* Check if we can just return the original mesh.
|
||||||
* Must have verts and therefore verts assigned to vgroups to do anything useful!
|
* Must have verts and therefore verts assigned to vgroups to do anything useful!
|
||||||
*/
|
*/
|
||||||
if ((numVerts == 0) || BLI_listbase_is_empty(&ob->defbase))
|
if ((numVerts == 0) || BLI_listbase_is_empty(&ctx->object->defbase))
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
/* Get vgroup idx from its name. */
|
/* Get vgroup idx from its name. */
|
||||||
defgrp_index = defgroup_name_index(ob, wmd->defgrp_name_a);
|
defgrp_index = defgroup_name_index(ctx->object, wmd->defgrp_name_a);
|
||||||
if (defgrp_index == -1)
|
if (defgrp_index == -1)
|
||||||
return dm;
|
return dm;
|
||||||
/* Get second vgroup idx from its name, if given. */
|
/* Get second vgroup idx from its name, if given. */
|
||||||
if (wmd->defgrp_name_b[0] != (char)0) {
|
if (wmd->defgrp_name_b[0] != (char)0) {
|
||||||
defgrp_index_other = defgroup_name_index(ob, wmd->defgrp_name_b);
|
defgrp_index_other = defgroup_name_index(ctx->object, wmd->defgrp_name_b);
|
||||||
if (defgrp_index_other == -1)
|
if (defgrp_index_other == -1)
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
@@ -352,7 +352,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do masking. */
|
/* Do masking. */
|
||||||
weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
|
weightvg_do_mask(numIdx, indices, org_w, new_w, ctx->object, dm, wmd->mask_constant,
|
||||||
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
|
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
|
||||||
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
|
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
|
||||||
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
|
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
|
||||||
|
|||||||
@@ -368,8 +368,8 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
|||||||
return (wmd->proximity_ob_target == NULL);
|
return (wmd->proximity_ob_target == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag))
|
DerivedMesh *derivedData)
|
||||||
{
|
{
|
||||||
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md;
|
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md;
|
||||||
DerivedMesh *dm = derivedData;
|
DerivedMesh *dm = derivedData;
|
||||||
@@ -377,6 +377,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
MDeformWeight **dw, **tdw;
|
MDeformWeight **dw, **tdw;
|
||||||
int numVerts;
|
int numVerts;
|
||||||
float (*v_cos)[3] = NULL; /* The vertices coordinates. */
|
float (*v_cos)[3] = NULL; /* The vertices coordinates. */
|
||||||
|
Object *ob = ctx->object;
|
||||||
Object *obr = NULL; /* Our target object. */
|
Object *obr = NULL; /* Our target object. */
|
||||||
int defgrp_index;
|
int defgrp_index;
|
||||||
float *tw = NULL;
|
float *tw = NULL;
|
||||||
@@ -400,7 +401,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep
|
|||||||
/* Check if we can just return the original mesh.
|
/* Check if we can just return the original mesh.
|
||||||
* Must have verts and therefore verts assigned to vgroups to do anything useful!
|
* Must have verts and therefore verts assigned to vgroups to do anything useful!
|
||||||
*/
|
*/
|
||||||
if ((numVerts == 0) || BLI_listbase_is_empty(&ob->defbase))
|
if ((numVerts == 0) || BLI_listbase_is_empty(&ctx->object->defbase))
|
||||||
return dm;
|
return dm;
|
||||||
|
|
||||||
/* Get our target object. */
|
/* Get our target object. */
|
||||||
|
|||||||
@@ -102,10 +102,10 @@ static DerivedMesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob,
|
static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
|
||||||
DerivedMesh *dm, ModifierApplyFlag UNUSED(flag))
|
DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
return WireframeModifier_do((WireframeModifierData *)md, ob, dm);
|
return WireframeModifier_do((WireframeModifierData *)md, ctx->object, dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user