Fix overly noisy surface deform warning message
An increased number of vertices is not a stopper for the surface deform modifier anymore. It might still be useful to expose the message in the UI, but printing error message to the console on every modifier evaluation makes real errors to become almost invisible. Differential Revision: https://developer.blender.org/D15468
This commit is contained in:
parent
82f65d8971
commit
5e1229f253
|
@ -446,10 +446,22 @@ bool BKE_modifier_is_enabled(const struct Scene *scene,
|
|||
*/
|
||||
bool BKE_modifier_is_nonlocal_in_liboverride(const struct Object *ob,
|
||||
const struct ModifierData *md);
|
||||
|
||||
/* Set modifier execution error.
|
||||
* The message will be shown in the interface and will be logged as an error to the console. */
|
||||
void BKE_modifier_set_error(const struct Object *ob,
|
||||
struct ModifierData *md,
|
||||
const char *format,
|
||||
...) ATTR_PRINTF_FORMAT(3, 4);
|
||||
|
||||
/* Set modifier execution warning, which does not prevent the modifier from being applied but which
|
||||
* might need an attention. The message will only be shown in the interface, but will not appear in
|
||||
* the logs. */
|
||||
void BKE_modifier_set_warning(const struct Object *ob,
|
||||
struct ModifierData *md,
|
||||
const char *format,
|
||||
...) ATTR_PRINTF_FORMAT(3, 4);
|
||||
|
||||
bool BKE_modifier_is_preview(struct ModifierData *md);
|
||||
|
||||
void BKE_modifiers_foreach_ID_link(struct Object *ob, IDWalkFunc walk, void *userData);
|
||||
|
|
|
@ -456,6 +456,40 @@ void BKE_modifier_set_error(const Object *ob, ModifierData *md, const char *_for
|
|||
CLOG_ERROR(&LOG, "Object: \"%s\", Modifier: \"%s\", %s", ob->id.name + 2, md->name, md->error);
|
||||
}
|
||||
|
||||
void BKE_modifier_set_warning(const struct Object *ob,
|
||||
struct ModifierData *md,
|
||||
const char *_format,
|
||||
...)
|
||||
{
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
const char *format = TIP_(_format);
|
||||
|
||||
va_start(ap, _format);
|
||||
vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
va_end(ap);
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
|
||||
/* Store the warning in the same field as the error.
|
||||
* It is not expected to have both error and warning and having a single place to store the
|
||||
* message simplifies interface code. */
|
||||
|
||||
if (md->error) {
|
||||
MEM_freeN(md->error);
|
||||
}
|
||||
|
||||
md->error = BLI_strdup(buffer);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if ((md->mode & eModifierMode_Virtual) == 0) {
|
||||
/* Ensure correct object is passed in. */
|
||||
BLI_assert(BKE_modifier_get_original(ob, md) != NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED_VARS_NDEBUG(ob);
|
||||
}
|
||||
|
||||
int BKE_modifiers_get_cage_index(const Scene *scene,
|
||||
Object *ob,
|
||||
int *r_lastPossibleCageIndex,
|
||||
|
|
|
@ -1521,11 +1521,11 @@ static void surfacedeformModifier_do(ModifierData *md,
|
|||
* added after the original ones. This covers typical case when target was at the subdivision
|
||||
* level 0 and then subdivision was increased (i.e. for the render purposes). */
|
||||
|
||||
BKE_modifier_set_error(ob,
|
||||
md,
|
||||
"Target vertices changed from %u to %u, continuing anyway",
|
||||
smd->target_verts_num,
|
||||
target_verts_num);
|
||||
BKE_modifier_set_warning(ob,
|
||||
md,
|
||||
"Target vertices changed from %u to %u, continuing anyway",
|
||||
smd->target_verts_num,
|
||||
target_verts_num);
|
||||
|
||||
/* In theory we only need the `smd->verts_num` vertices in the `targetCos` for evaluation, but
|
||||
* it is not currently possible to request a subset of coordinates: the API expects that the
|
||||
|
|
Loading…
Reference in New Issue