Page MenuHome

Obj exporter does not respect "Apply Modifiers" settings
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 10
Graphics card: GTX 1070

Blender Version
version: 2.80 (sub 53), branch: blender2.7, commit date: 2019-04-02 19:53, hash: a813e259d630, type: Release
build date: 02/04/2019, 18:01

Short description of error

The obj exporter does not seem to respect "use_mesh_modifiers=False" It always export as if it is set to "use_mesh_modifiers=True"

Exact steps for others to reproduce the error

  • Add Suzanne
  • Add Decimate modifier to Suzanne, set the value to 0.5
  • Open obj exporter
  • Make sure apply modifiers is unchecked, Selection only is checked
  • Export and imported it or check it out in a 3d viewer

As you see the mesh is exported with modifiers

Event Timeline

Robert Guetzkow (rjg) triaged this task as Confirmed, Low priority.

Looks like EXPORT_APPLY_MODIFIERS is set to False when the option is unchecked but to_mesh() or another function applies the modifiers regardless.

Robert Guetzkow (rjg) raised the priority of this task from Confirmed, Low to Normal.

The functions rna_Object_to_mesh(), rna_Main_meshes_new_from_object() and BKE_mesh_new_from_object() all get apply_modifiers set to false as it should be. Could it be that this is an error introduced in 46eb5a0b8a4f3a7826b5e5a1a11e114e09037dba @Sergey Sharybin (sergey) ?

Robert Guetzkow (rjg) added a comment.EditedApr 8 2019, 8:51 PM

@Sergey Sharybin (sergey) It seems to me that object_for_eval is set to the result of DEG_get_evaluated_object which has the modifiers applied, is used incorrectly in:

case OB_MESH:
			/* copies object and modifiers (but not the data) */
			if (cage) {
				/* copies the data (but *not* the shapekeys). */
				Mesh *mesh = object_for_eval.data;
				BKE_id_copy_ex(bmain, &mesh->id, (ID **)&tmpmesh, 0);
				/* XXX BKE_mesh_copy() already handles materials usercount. */
				do_mat_id_data_us = false;
			}

cage is true, if apply_modifiers isn't. Therefore mesh shouldn't be object_for_eval but the original mesh right?

Actually, re-opening as a stand-alone bug. It's somewhat related, but is not quite. Sorry for the noise.

@Robert Guetzkow (rjg), yes, but the responsible code is some lines above. Committing the fix now..

I think this modifier bug was affecting other exporters as well.