예제 #1
0
		public void SetupMeshAndMaterials(HEU_HoudiniAsset asset, HAPI_PartType partType, GameObject outputGameObject)
		{
			_outputMesh = null;
			_outputGameObject = null;

			if (HEU_HAPIUtility.IsSupportedPolygonType(partType))
			{
				// Get the generated mesh. If mesh is missing, nothing we can do.
				MeshFilter meshFilter = outputGameObject.GetComponent<MeshFilter>();
				if (meshFilter != null && meshFilter.sharedMesh != null)
				{
					_outputMesh = meshFilter.sharedMesh;
				}
				else
				{
					// Without a valid mesh, we won't be able to paint so nothing else to do
					return;
				}

				_outputGameObject = outputGameObject;

				if (_localMaterial == null)
				{
					MeshRenderer meshRenderer = _outputGameObject.GetComponent<MeshRenderer>();
					if(meshRenderer != null)
					{
						_localMaterial = HEU_MaterialFactory.GetNewMaterialWithShader(null, HEU_MaterialFactory.GetHoudiniShaderPath(HEU_Defines.DEFAULT_VERTEXCOLOR_SHADER), HEU_Defines.EDITABLE_MATERIAL, false);
					}
				}
			}
		}