コード例 #1
0
        private bool CreateTexture()
        {
            textures = null;

            if (materialName == null || materialName == "")
            {
                Debug.LogError("materialName must be specified.");
                return(false);
            }

            if (textureOverride != null)
            {
                textures = textureOverride.asset.textureList;
                return(true);
            }

            if (overlayFolder == null)
            {
                Debug.LogError("Texture folder not supplied");
                return(false);
            }
            if (diffuse == null)
            {
                Debug.LogError("Not all textures present");
                return(false);
            }
            if (normal == null)
            {
                SaveTexture(ref normal, new Color32(128, 128, 255, 255), AssetDatabase.GetAssetPath(overlayFolder) + "/" + "Base_Normal.png", diffuse.width, diffuse.height);
                Debug.LogWarning("No NormalMap was provided, creating a neutral one");
            }

            if (specular == null)
            {
                SaveTexture(ref specular, new Color32(64, 64, 64, 32), AssetDatabase.GetAssetPath(overlayFolder) + "/" + "Base_specular.png", diffuse.width, diffuse.height);
                Debug.LogWarning("No Specular was provided, creating a neutral one");
            }

            bool res = UMATextureImporterUtil.ConvertDefaultAssets_DiffuseAlpha_Normal_Specular(
                AssetDatabase.GetAssetPath(diffuse),
                AssetDatabase.GetAssetPath(normal),
                AssetDatabase.GetAssetPath(specular),
                GetAssetName(),
                AssetDatabase.GetAssetPath(overlayFolder),
                Shader.Find("UMA/Regular"));

            if (res)
            {
                textures = new Texture[2]
                {
                    AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(overlayFolder) + "/" + GetAssetFolder() + GetAssetName() + "_diffuse.png", typeof(Texture)) as Texture,
                    AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(overlayFolder) + "/" + GetAssetFolder() + GetAssetName() + "_normal.png", typeof(Texture)) as Texture
                };
            }
            return(res);
        }
コード例 #2
0
        private OverlayData CreateOverlay_Internal()
        {
            if (materialName == null || materialName == "")
            {
                Debug.LogError("materialName must be specified.");
                return(null);
            }

            if (overlayFolder == null)
            {
                Debug.LogError("Overlay folder not supplied");
                return(null);
            }
            var overlay = UMATextureImporterUtil.CreateOverlayData(textures, GetAssetFolder(), GetAssetName(), AssetDatabase.GetAssetPath(overlayFolder));

            return(overlay);
        }
コード例 #3
0
        private SlotData CreateSlot_Internal()
        {
//	        var material = slotMaterial ?? AssetDatabase.LoadAssetAtPath("Assets/UMA_Assets/MaterialSamples/UMABaseShaderSample.mat", typeof(Material)) as Material;
            var material = slotMaterial;

            if (material == null)
            {
                material = AssetDatabase.LoadAssetAtPath("Assets/UMA_Assets/MaterialSamples/UMABaseShaderSample.mat", typeof(Material)) as Material;
            }
            if (materialName == null || materialName == "")
            {
                Debug.LogError("materialName must be specified.");
                return(null);
            }

            if (material == null)
            {
                Debug.LogError("Couldn't locate default material at Assets/UMA_Assets/MaterialSamples/UMABaseShaderSample.mat and no material specified.");
                return(null);
            }

            if (slotFolder == null)
            {
                Debug.LogError("Slot folder not supplied");
                return(null);
            }

            if (slotMesh == null)
            {
                Debug.LogError("Slot Mesh not supplied.");
                return(null);
            }
            Debug.Log("Slot Mesh: " + slotMesh.name, slotMesh.gameObject);
            SlotData slot = UMATextureImporterUtil.CreateSlotData(AssetDatabase.GetAssetPath(slotFolder), GetAssetFolder(), GetAssetName(), slotMesh, material, racePrefab);

            return(slot);
        }