Fall back to blank material after applying it

This commit is contained in:
SiboVG 2023-08-23 23:05:15 +02:00
parent ed883fafa3
commit 20c0cacc7a
3 changed files with 11 additions and 2 deletions

View File

@ -141,6 +141,8 @@ public final class DefaultObj implements Obj {
private final FloatTupleBounds vertexBounds;
private static final String BLANK_MATERIAL = "___blank___";
/**
* Creates a new, empty DefaultObj.
*/
@ -415,6 +417,10 @@ public final class DefaultObj implements Obj {
nextActiveMaterialGroupName = materialGroupName;
}
public void resetToBlankMaterial() {
setActiveMaterialGroupName(BLANK_MATERIAL);
}
@Override
public void addFace(ObjFace face) {
if (face == null) {

View File

@ -67,8 +67,6 @@ public class AppearanceExporter {
applyTexture(appearance, material);
materials.add(material);
// TODO: default back to default material?
}
private void applyTexture(Appearance appearance, DefaultMtl material) {

View File

@ -206,6 +206,11 @@ public class OBJExporterFactory {
// Write the OBJ file
writeObj(obj, filePath);
// Reset the material
if (options.isExportAppearance()) {
obj.resetToBlankMaterial();
}
}
}