disable applying constructive modifiers when in sculpt mode with multi-res data, since this would crash.
also rename modifier_sameTopology -> modifier_isSameTopology(), modifier_nonGeometrical -> modifier_isNonGeometrical()
This commit is contained in:
@@ -319,8 +319,8 @@ int modifier_dependsOnTime(struct ModifierData *md);
|
||||
int modifier_supportsMapping(struct ModifierData *md);
|
||||
int modifier_couldBeCage(struct Scene *scene, struct ModifierData *md);
|
||||
int modifier_isCorrectableDeformed(struct ModifierData *md);
|
||||
int modifier_sameTopology(ModifierData *md);
|
||||
int modifier_nonGeometrical(ModifierData *md);
|
||||
int modifier_isSameTopology(ModifierData *md);
|
||||
int modifier_isNonGeometrical(ModifierData *md);
|
||||
int modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
|
||||
void modifier_setError(struct ModifierData *md, const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
|
||||
@@ -1149,7 +1149,8 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
|
||||
savedlines += 1;
|
||||
}
|
||||
|
||||
/* test for nicer distribution even - non standard, leave it out for a while
|
||||
/* test for nicer distribution even - non standard, leave it out for a while */
|
||||
#if 0
|
||||
for (x = 0; x < 256; x++) {
|
||||
bin_lum[x] = sqrt (bin_lum[x]);
|
||||
bin_r[x] = sqrt(bin_r[x]);
|
||||
@@ -1157,7 +1158,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
|
||||
bin_b[x] = sqrt(bin_b[x]);
|
||||
bin_a[x] = sqrt(bin_a[x]);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* convert hist data to float (proportional to max count) */
|
||||
nl = na = nr = nb = ng = 0;
|
||||
|
||||
@@ -249,13 +249,13 @@ int modifier_couldBeCage(struct Scene *scene, ModifierData *md)
|
||||
modifier_supportsMapping(md));
|
||||
}
|
||||
|
||||
int modifier_sameTopology(ModifierData *md)
|
||||
int modifier_isSameTopology(ModifierData *md)
|
||||
{
|
||||
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
return ELEM(mti->type, eModifierTypeType_OnlyDeform, eModifierTypeType_NonGeometrical);
|
||||
}
|
||||
|
||||
int modifier_nonGeometrical(ModifierData *md)
|
||||
int modifier_isNonGeometrical(ModifierData *md)
|
||||
{
|
||||
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
return (mti->type == eModifierTypeType_NonGeometrical);
|
||||
|
||||
@@ -866,7 +866,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
|
||||
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
|
||||
uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA);
|
||||
|
||||
if (modifier_sameTopology(md) && !modifier_nonGeometrical(md))
|
||||
if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md))
|
||||
uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0, "apply_as", MODIFIER_APPLY_SHAPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
|
||||
Key *key = me->key;
|
||||
KeyBlock *kb;
|
||||
|
||||
if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
|
||||
if (!modifier_isSameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
|
||||
BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to shapes");
|
||||
return 0;
|
||||
}
|
||||
@@ -688,6 +688,13 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
|
||||
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
|
||||
return 0;
|
||||
}
|
||||
else if ((ob->mode & OB_MODE_SCULPT) &&
|
||||
(find_multires_modifier_before(scene, md)) &&
|
||||
(modifier_isSameTopology(md) == FALSE))
|
||||
{
|
||||
BKE_report(reports, RPT_ERROR, "Constructive modifier cannot be applied to multi-res data in sculpt mode");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (md != ob->modifiers.first)
|
||||
BKE_report(reports, RPT_INFO, "Applied modifier was not first, result may not be as expected");
|
||||
@@ -1000,7 +1007,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
|
||||
Object *ob = ED_object_active_context(C);
|
||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int apply_as = RNA_enum_get(op->ptr, "apply_as");
|
||||
|
||||
|
||||
if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -845,15 +845,14 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
|
||||
static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
|
||||
{
|
||||
MDeformVert *dv = NULL;
|
||||
BMVert *eve;
|
||||
Mesh *me;
|
||||
|
||||
/* get the deform vertices corresponding to the vertnum */
|
||||
if (ob->type == OB_MESH) {
|
||||
me = ob->data;
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
eve = BM_vert_at_index(me->edit_btmesh->bm, vertnum);
|
||||
/* warning, this lookup is _not_ fast */
|
||||
BMVert *eve = BM_vert_at_index(me->edit_btmesh->bm, vertnum);
|
||||
if (!eve) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user