How to export .OBJ from Editor with rescaled mesh?

I know there are scripts that can handle exporting .obj from editor here: http://wiki.unity3d.com/index.php?title=ObjExporter

EditorObjExporter.cs

Script content extracted from this 120MB wikiunity3dcom-20200211-history.xml file

/*
Based on ObjExporter.cs, this "wrapper" lets you export to .OBJ directly from the editor menu.
 
This should be put in your "Editor"-folder. Use by selecting the objects you want to export, and select
the appropriate menu item from "Custom->Export". Exported models are put in a folder called
"ExportedObj" in the root of your Unity-project. Textures should also be copied and placed in the
same folder.
N.B. there may be a bug so if the custom option doesn't come up refer to this thread http://answers.unity3d.com/questions/317951/how-to-use-editorobjexporter-obj-saving-script-fro.html 

Updated for Unity 5.3
*/

using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System;

struct ObjMaterial
{
	public string name;
	public string textureName;
}

public class EditorObjExporter : ScriptableObject
{
	private static int vertexOffset = 0;
	private static int normalOffset = 0;
	private static int uvOffset = 0;


	//User should probably be able to change this. It is currently left as an exercise for
	//the reader.
	private static string targetFolder = "ExportedObj";


	private static string MeshToString(MeshFilter mf, Dictionary<string, ObjMaterial> materialList) 
	{
		Mesh m = mf.sharedMesh;
		Material[] mats = mf.GetComponent<Renderer>().sharedMaterials;

		StringBuilder sb = new StringBuilder();

		sb.Append("g ").Append(mf.name).Append("\n");
		foreach(Vector3 lv in m.vertices) 
		{
			Vector3 wv = mf.transform.TransformPoint(lv);

			//This is sort of ugly - inverting x-component since we're in
			//a different coordinate system than "everyone" is "used to".
			sb.Append(string.Format("v {0} {1} {2}\n",-wv.x,wv.y,wv.z));
		}
		sb.Append("\n");

		foreach(Vector3 lv in m.normals) 
		{
			Vector3 wv = mf.transform.TransformDirection(lv);

			sb.Append(string.Format("vn {0} {1} {2}\n",-wv.x,wv.y,wv.z));
		}
		sb.Append("\n");

		foreach(Vector3 v in m.uv) 
		{
			sb.Append(string.Format("vt {0} {1}\n",v.x,v.y));
		}

		for (int material=0; material < m.subMeshCount; material ++) {
			sb.Append("\n");
			sb.Append("usemtl ").Append(mats[material].name).Append("\n");
			sb.Append("usemap ").Append(mats[material].name).Append("\n");

			//See if this material is already in the materiallist.
			try
			{
				ObjMaterial objMaterial = new ObjMaterial();

				objMaterial.name = mats[material].name;

				if (mats[material].mainTexture)
					objMaterial.textureName = AssetDatabase.GetAssetPath(mats[material].mainTexture);
				else 
					objMaterial.textureName = null;

				materialList.Add(objMaterial.name, objMaterial);
			}
			catch (ArgumentException)
			{
				//Already in the dictionary
			}


			int[] triangles = m.GetTriangles(material);
			for (int i=0;i<triangles.Length;i+=3) 
			{
				//Because we inverted the x-component, we also needed to alter the triangle winding.
				sb.Append(string.Format("f {1}/{1}/{1} {0}/{0}/{0} {2}/{2}/{2}\n", 
					triangles[i]+1 + vertexOffset, triangles[i+1]+1 + normalOffset, triangles[i+2]+1 + uvOffset));
			}
		}

		vertexOffset += m.vertices.Length;
		normalOffset += m.normals.Length;
		uvOffset += m.uv.Length;

		return sb.ToString();
	}

	private static void Clear()
	{
		vertexOffset = 0;
		normalOffset = 0;
		uvOffset = 0;
	}

	private static Dictionary<string, ObjMaterial> PrepareFileWrite()
	{
		Clear();

		return new Dictionary<string, ObjMaterial>();
	}

	private static void MaterialsToFile(Dictionary<string, ObjMaterial> materialList, string folder, string filename)
	{
		using (StreamWriter sw = new StreamWriter(folder + Path.PathSeparator + filename + ".mtl")) 
		{
			foreach( KeyValuePair<string, ObjMaterial> kvp in materialList )
			{
				sw.Write("\n");
				sw.Write("newmtl {0}\n", kvp.Key);
				sw.Write("Ka  0.6 0.6 0.6\n");
				sw.Write("Kd  0.6 0.6 0.6\n");
				sw.Write("Ks  0.9 0.9 0.9\n");
				sw.Write("d  1.0\n");
				sw.Write("Ns  0.0\n");
				sw.Write("illum 2\n");

				if (kvp.Value.textureName != null)
				{
					string destinationFile = kvp.Value.textureName;


					int stripIndex = destinationFile.LastIndexOf(Path.PathSeparator);

					if (stripIndex >= 0)
						destinationFile = destinationFile.Substring(stripIndex + 1).Trim();


					string relativeFile = destinationFile;

					destinationFile = folder + Path.PathSeparator + destinationFile;

					Debug.Log("Copying texture from " + kvp.Value.textureName + " to " + destinationFile);

					try
					{
						//Copy the source file
						File.Copy(kvp.Value.textureName, destinationFile);
					}
					catch
					{

					}	


					sw.Write("map_Kd {0}", relativeFile);
				}

				sw.Write("\n\n\n");
			}
		}
	}

	private static void MeshToFile(MeshFilter mf, string folder, string filename) 
	{
		Dictionary<string, ObjMaterial> materialList = PrepareFileWrite();

		using (StreamWriter sw = new StreamWriter(folder +Path.PathSeparator + filename + ".obj")) 
		{
			sw.Write("mtllib ./" + filename + ".mtl\n");

			sw.Write(MeshToString(mf, materialList));
		}

		MaterialsToFile(materialList, folder, filename);
	}

	private static void MeshesToFile(MeshFilter[] mf, string folder, string filename) 
	{
		Dictionary<string, ObjMaterial> materialList = PrepareFileWrite();

		using (StreamWriter sw = new StreamWriter(folder +Path.PathSeparator + filename + ".obj")) 
		{
			sw.Write("mtllib ./" + filename + ".mtl\n");

			for (int i = 0; i < mf.Length; i++)
			{
				sw.Write(MeshToString(mf[i], materialList));
			}
		}

		MaterialsToFile(materialList, folder, filename);
	}

	private static bool CreateTargetFolder()
	{
		try
		{
			System.IO.Directory.CreateDirectory(targetFolder);
		}
		catch
		{
			EditorUtility.DisplayDialog("Error!", "Failed to create target folder!", "");
			return false;
		}

		return true;
	}

	[MenuItem ("Custom/Export/Export all MeshFilters in selection to separate OBJs")]
	static void ExportSelectionToSeparate()
	{
		if (!CreateTargetFolder())
			return;

		Transform[] selection = Selection.GetTransforms(SelectionMode.Editable | SelectionMode.ExcludePrefab);

		if (selection.Length == 0)
		{
			EditorUtility.DisplayDialog("No source object selected!", "Please select one or more target objects", "");
			return;
		}

		int exportedObjects = 0;

		for (int i = 0; i < selection.Length; i++)
		{
			Component[] meshfilter = selection[i].GetComponentsInChildren(typeof(MeshFilter));

			for (int m = 0; m < meshfilter.Length; m++)
			{
				exportedObjects++;
				MeshToFile((MeshFilter)meshfilter[m], targetFolder, selection[i].name + "_" + i + "_" + m);
			}
		}

		if (exportedObjects > 0)
			EditorUtility.DisplayDialog("Objects exported", "Exported " + exportedObjects + " objects", "");
		else
			EditorUtility.DisplayDialog("Objects not exported", "Make sure at least some of your selected objects have mesh filters!", "");
	}

	[MenuItem ("Custom/Export/Export whole selection to single OBJ")]
	static void ExportWholeSelectionToSingle()
	{
		if (!CreateTargetFolder())
			return;


		Transform[] selection = Selection.GetTransforms(SelectionMode.Editable | SelectionMode.ExcludePrefab);

		if (selection.Length == 0)
		{
			EditorUtility.DisplayDialog("No source object selected!", "Please select one or more target objects", "");
			return;
		}

		int exportedObjects = 0;

		ArrayList mfList = new ArrayList();

		for (int i = 0; i < selection.Length; i++)
		{
			Component[] meshfilter = selection[i].GetComponentsInChildren(typeof(MeshFilter));

			for (int m = 0; m < meshfilter.Length; m++)
			{
				exportedObjects++;
				mfList.Add(meshfilter[m]);
			}
		}

		if (exportedObjects > 0)
		{
			MeshFilter[] mf = new MeshFilter[mfList.Count];

			for (int i = 0; i < mfList.Count; i++)
			{
				mf[i] = (MeshFilter)mfList[i];
			}

			string filename = EditorSceneManager.GetActiveScene().name + "_" + exportedObjects;

			int stripIndex = filename.LastIndexOf(Path.PathSeparator);

			if (stripIndex >= 0)
				filename = filename.Substring(stripIndex + 1).Trim();

			MeshesToFile(mf, targetFolder, filename);


			EditorUtility.DisplayDialog("Objects exported", "Exported " + exportedObjects + " objects to " + filename, "");
		}
		else
			EditorUtility.DisplayDialog("Objects not exported", "Make sure at least some of your selected objects have mesh filters!", "");
	}



	[MenuItem ("Custom/Export/Export each selected to single OBJ")]
	static void ExportEachSelectionToSingle()
	{
		if (!CreateTargetFolder())
			return;

		Transform[] selection = Selection.GetTransforms(SelectionMode.Editable | SelectionMode.ExcludePrefab);

		if (selection.Length == 0)
		{
			EditorUtility.DisplayDialog("No source object selected!", "Please select one or more target objects", "");
			return;
		}

		int exportedObjects = 0;


		for (int i = 0; i < selection.Length; i++)
		{
			Component[] meshfilter = selection[i].GetComponentsInChildren(typeof(MeshFilter));

			MeshFilter[] mf = new MeshFilter[meshfilter.Length];

			for (int m = 0; m < meshfilter.Length; m++)
			{
				exportedObjects++;
				mf[m] = (MeshFilter)meshfilter[m];
			}

			MeshesToFile(mf, targetFolder, selection[i].name + "_" + i);
		}

		if (exportedObjects > 0)
		{
			EditorUtility.DisplayDialog("Objects exported", "Exported " + exportedObjects + " objects", "");
		}
		else
			EditorUtility.DisplayDialog("Objects not exported", "Make sure at least some of your selected objects have mesh filters!", "");
	}

}

The problem is that it takes static mesh attached to this model and it doesn’t include my changes in Transform Component. Is there a way to export it with resized meshes (via transform)? Did you hear about some scripts that handle that?

Here is an editor script that should do the job for you. It takes an object and makes a clone that has local scale of (1,1,1) and rotation (0,0,0). Place the script in the Assets/Editor folder. It must be named RotateMesh. To use select the object in the hierarchy, and select RotateMesh from the Window menu. It is only lightly tested at this point.

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class RotateMesh : EditorWindow
{	
	string error = "";
	
	[MenuItem( "Window/Rotate Mesh %#r" )]
	public static void ShowWindow ()
	{
		EditorWindow.GetWindow( typeof(RotateMesh) );
	}

	void OnGUI ()
	{
		Transform curr = Selection.activeTransform;
		GUILayout.Label("Creates a clone of the game object with a rotated mesh " +  "so that the rotation will be (0,0,0) and the scale will be (1,1,1).");
		GUILayout.Space(20);

		if( GUILayout.Button("Rotate Mesh") )
		{
			error = "";
			RotateTheMesh();
		}
		
		GUILayout.Space(20);
		GUILayout.Label(error);
	}
	
	void RotateTheMesh ()
	{
		List<Transform> children = new List<Transform>();
		Transform curr = Selection.activeTransform;

		MeshFilter mf;
		if (curr == null)
		{
			error = "No appropriate object selected.";
			Debug.Log (error);	
			return;
		}
		
		if (curr.localScale.x < 0.0 || curr.localScale.y < 0.0f || curr.localScale.z < 0.0f)
		{
			error = "Cannot process game objecrt with negative scale values.";
			Debug.Log (error);
			return;
		}
		
		mf = curr.GetComponent<MeshFilter>();
		if (mf == null || mf.sharedMesh == null)
		{
			error = "No mesh on the selected object";
			Debug.Log (error);
			return;
		}
		
		// Create the duplicate game object
		GameObject go = Instantiate(curr.gameObject) as GameObject;
		mf = go.GetComponent<MeshFilter>();
		mf.sharedMesh = Instantiate(mf.sharedMesh) as Mesh;
		curr = go.transform;
		
		// Disconnect any child objects and same them for later
		foreach( Transform child in curr )
		{
			if( child!=curr )
			{
				children.Add(child);
				child.parent = null;
			}
		}
		
		// Rotate and scale the mesh
		Vector3[] vertices = mf.sharedMesh.vertices;
		for (int i = 0; i < vertices.Length; i++) {
			vertices _= curr.TransformPoint(vertices*) - curr.position;
		}
		mf.sharedMesh.vertices = vertices;


		// Fix the normals
		Vector3[] normals = mf.sharedMesh.normals;
		if (normals != null)
		{
			for (int i = 0; i < normals.Length; i++)
				normals _= curr.rotation * normals*;
		}
		mf.sharedMesh.normals = normals;
		mf.sharedMesh.RecalculateBounds();

		curr.transform.rotation = Quaternion.identity;
		curr.localScale = new Vector3(1,1,1);

		// Restore the children
		foreach (Transform child in children)
		{
			child.parent = curr;
		}

		// Set selection to new game object
		Selection.activeObject = curr.gameObject;

		//--- Do a rudamentary fixup of mesh, box, and sphere colliders----
		MeshCollider mc = curr.GetComponent<MeshCollider>();
		if (mc != null)
		{
			mc.sharedMesh = mf.sharedMesh;
		}

		BoxCollider bc = curr.GetComponent<BoxCollider>();
		if (bc != null)
		{
			DestroyImmediate(bc);
			curr.gameObject.AddComponent<BoxCollider>();
		}
		SphereCollider sc = curr.GetComponent<SphereCollider>();
		if (sc != null)
		{
			DestroyImmediate(sc);
			curr.gameObject.AddComponent<SphereCollider>();
		}

		if (curr.GetComponent<Collider>())
		{
			error = "Be sure to verify size of collider.";
		}

		// Save a copy to disk
		string name = "Assets/Editor/"+go.name+Random.Range (0, int.MaxValue).ToString()+".asset";
		AssetDatabase.CreateAsset(mf.sharedMesh, name);
		AssetDatabase.SaveAssets();
	}
}