Przeglądaj źródła

Fix issue with exporteds material having props not equal to getDefaultProps.

clementlandrin 2 lat temu
rodzic
commit
8ec57f2aff
2 zmienionych plików z 4 dodań i 4 usunięć
  1. 2 2
      h3d/mat/MaterialDatabase.hx
  2. 2 2
      h3d/mat/MaterialSetup.hx

+ 2 - 2
h3d/mat/MaterialDatabase.hx

@@ -48,7 +48,7 @@ class MaterialDatabase {
 		return Reflect.field(p, material.name);
 		return Reflect.field(p, material.name);
 	}
 	}
 
 
-	public function saveMatProps( material : Material, setup : MaterialSetup ) {
+	public function saveMatProps( material : Material, setup : MaterialSetup, ?defaultProps : Any ) {
 		var path = ["materials", setup.name, material.name];
 		var path = ["materials", setup.name, material.name];
 		var root : Dynamic = getModelData(material.model);
 		var root : Dynamic = getModelData(material.model);
 		if( root == null )
 		if( root == null )
@@ -68,7 +68,7 @@ class MaterialDatabase {
 		Reflect.deleteField(root, name);
 		Reflect.deleteField(root, name);
 
 
 		var currentProps = material.props;
 		var currentProps = material.props;
-		var defaultProps = material.getDefaultProps();
+		if ( defaultProps == null ) defaultProps = material.getDefaultProps();
 		if( currentProps == null || Std.string(defaultProps) == Std.string(currentProps) ) {
 		if( currentProps == null || Std.string(defaultProps) == Std.string(currentProps) ) {
 			// cleanup
 			// cleanup
 			while( path.length > 0 ) {
 			while( path.length > 0 ) {

+ 2 - 2
h3d/mat/MaterialSetup.hx

@@ -34,8 +34,8 @@ class MaterialSetup {
 		return database.loadMatProps(material, this);
 		return database.loadMatProps(material, this);
 	}
 	}
 
 
-	public function saveMaterialProps( material : Material ) {
-		database.saveMatProps(material, this);
+	public function saveMaterialProps( material : Material, ?defaultProps : Any ) {
+		database.saveMatProps(material, this, defaultProps);
 	}
 	}
 
 
 	/*
 	/*