Exemplo n.º 1
0
    void testCombine()
    {
        MB3_MeshCombinerSingle mb = new MB3_MeshCombinerSingle();

        Debug.Log("About to bake 1");
        mb.AddDeleteGameObjects(listOfObjsToCombineGood, null);
        mb.Apply();
        mb.UpdateGameObjects(listOfObjsToCombineGood);
        mb.Apply();
        mb.AddDeleteGameObjects(null, listOfObjsToCombineGood);
        mb.Apply();
        Debug.Log("Did bake 1");
        Debug.Log("About to bake 2 should get error that one material doesn't match");
        mb.AddDeleteGameObjects(listOfObjsToCombineBad, null);
        mb.Apply();
        Debug.Log("Did bake 2");

        Debug.Log("Doing same with multi mesh combiner");
        MB3_MultiMeshCombiner mmb = new MB3_MultiMeshCombiner();

        Debug.Log("About to bake 3");
        mmb.AddDeleteGameObjects(listOfObjsToCombineGood, null);
        mmb.Apply();
        mmb.UpdateGameObjects(listOfObjsToCombineGood);
        mmb.Apply();
        mmb.AddDeleteGameObjects(null, listOfObjsToCombineGood);
        mmb.Apply();
        Debug.Log("Did bake 3");
        Debug.Log("About to bake 4  should get error that one material doesn't match");
        mmb.AddDeleteGameObjects(listOfObjsToCombineBad, null);
        mmb.Apply();
        Debug.Log("Did bake 4");
    }
Exemplo n.º 2
0
    private void testCombine()
    {
        MB3_MeshCombinerSingle mb3_MeshCombinerSingle = new MB3_MeshCombinerSingle();

        Debug.Log("About to bake 1");
        mb3_MeshCombinerSingle.AddDeleteGameObjects(this.listOfObjsToCombineGood, null, true);
        mb3_MeshCombinerSingle.Apply();
        mb3_MeshCombinerSingle.UpdateGameObjects(this.listOfObjsToCombineGood, true, true, true, true, false, false, false, false, false, false);
        mb3_MeshCombinerSingle.Apply();
        mb3_MeshCombinerSingle.AddDeleteGameObjects(null, this.listOfObjsToCombineGood, true);
        mb3_MeshCombinerSingle.Apply();
        Debug.Log("Did bake 1");
        Debug.Log("About to bake 2");
        mb3_MeshCombinerSingle.AddDeleteGameObjects(this.listOfObjsToCombineBad, null, true);
        mb3_MeshCombinerSingle.Apply();
        Debug.Log("Did bake 2");
        Debug.Log("Doing same with multi mesh combiner");
        MB3_MultiMeshCombiner mb3_MultiMeshCombiner = new MB3_MultiMeshCombiner();

        Debug.Log("About to bake 3");
        mb3_MultiMeshCombiner.AddDeleteGameObjects(this.listOfObjsToCombineGood, null, true);
        mb3_MultiMeshCombiner.Apply();
        mb3_MultiMeshCombiner.UpdateGameObjects(this.listOfObjsToCombineGood, true, true, true, true, false, false, false, false, false, false);
        mb3_MultiMeshCombiner.Apply();
        mb3_MultiMeshCombiner.AddDeleteGameObjects(null, this.listOfObjsToCombineGood, true);
        mb3_MultiMeshCombiner.Apply();
        Debug.Log("Did bake 3");
        Debug.Log("About to bake 4");
        mb3_MultiMeshCombiner.AddDeleteGameObjects(this.listOfObjsToCombineBad, null, true);
        mb3_MultiMeshCombiner.Apply();
        Debug.Log("Did bake 4");
    }
	void testCombine(){
		MB3_MeshCombinerSingle mb = new MB3_MeshCombinerSingle();
		Debug.Log ("About to bake 1");
		mb.AddDeleteGameObjects(listOfObjsToCombineGood,null);
		mb.Apply();
		mb.UpdateGameObjects(listOfObjsToCombineGood);
		mb.Apply ();
		mb.AddDeleteGameObjects(null,listOfObjsToCombineGood);
		mb.Apply ();
		Debug.Log ("Did bake 1");
		Debug.Log ("About to bake 2");
		mb.AddDeleteGameObjects(listOfObjsToCombineBad,null);
		mb.Apply();
		Debug.Log ("Did bake 2");

		Debug.Log("Doing same with multi mesh combiner");
		MB3_MultiMeshCombiner mmb = new MB3_MultiMeshCombiner();
		Debug.Log ("About to bake 3");
		mmb.AddDeleteGameObjects(listOfObjsToCombineGood,null);
		mmb.Apply();
		mmb.UpdateGameObjects(listOfObjsToCombineGood);
		mmb.Apply ();
		mmb.AddDeleteGameObjects(null,listOfObjsToCombineGood);
		mmb.Apply ();
		Debug.Log ("Did bake 3");
		Debug.Log ("About to bake 4");
		mmb.AddDeleteGameObjects(listOfObjsToCombineBad,null);
		mmb.Apply();
		Debug.Log ("Did bake 4");
	}
Exemplo n.º 4
0
		static public Mesh BakeOneMesh(MB3_MeshCombinerSingle mom, string newMeshFilePath, GameObject objToBake){
			Mesh outMesh = null;
			if (objToBake == null){
				Debug.LogError("An object on the list of objects to combine is 'None'. Use Command-Delete on Mac OS X; Delete or Shift-Delete on Windows to remove this one element.");
				return null;					
			}
			
			MB3_EditorMethods editorMethods = new MB3_EditorMethods();
			GameObject[] objs = new GameObject[] {objToBake};
			Renderer r = MB_Utility.GetRenderer(objToBake);
			if (r is SkinnedMeshRenderer){
				mom.renderType = MB_RenderType.skinnedMeshRenderer;	
			} else if (r is MeshRenderer) {
				mom.renderType = MB_RenderType.meshRenderer;
			} else {
				Debug.LogError("Unsupported Renderer type on object. Must be SkinnedMesh or MeshFilter.");
				return null;	
			}
			if (newMeshFilePath == null && newMeshFilePath.Length != 0){ //todo check directory exists
				Debug.LogError("File path was not in assets folder.");
				return null;				
			}
			if (mom.AddDeleteGameObjects(objs,null,false)){
				mom.Apply();
				Mesh mf = MB_Utility.GetMesh(objToBake);
				if (mf != null){
					Debug.Log("Creating mesh for " + objToBake.name + " with adjusted UVs at: " + newMeshFilePath);
					AssetDatabase.CreateAsset(mom.GetMesh(),  newMeshFilePath);
					outMesh = (Mesh) AssetDatabase.LoadAssetAtPath(newMeshFilePath, typeof(Mesh));
				}
			}
			mom.DestroyMeshEditor(editorMethods);
			return outMesh;
		}
Exemplo n.º 5
0
    public override bool AddDeleteGameObjects(GameObject[] gos, GameObject[] deleteGOs, bool disableRendererInSource)
    {
//		if ((_meshCombiner.outputOption == MB2_OutputOptions.bakeIntoSceneObject || (_meshCombiner.outputOption == MB2_OutputOptions.bakeIntoPrefab && _meshCombiner.renderType == MB_RenderType.skinnedMeshRenderer) )) BuildSceneMeshObject();
        _meshCombiner.name = name + "-mesh";
        return(_meshCombiner.AddDeleteGameObjects(gos, deleteGOs, disableRendererInSource));
    }