判断资源贴图是否有alpha
/*
modfly selected textures`s maxSize and ImportFormat
bool hasAlpha = true;
if(hasAlpha)then(texture.size/2 and trueColor)else(16bit) 2014.05.27
*/ using UnityEngine;
using System.Collections;
using UnityEditor;
public class modflyTextures : ScriptableObject{ [MenuItem ("Custom/modflyTextures")]
static void processTexture_Auto() {
processTexture();
} static void processTexture() { Object[] textures = GetSelectedTextures();
Selection.objects = new Object[];
foreach (Texture2D tex in textures) {
string path = AssetDatabase.GetAssetPath(tex);
TextureImporter importerTexture = AssetImporter.GetAtPath(path) as TextureImporter; if(importerTexture.DoesSourceTextureHaveAlpha() == true){
if(tex.width >= tex.height )
importerTexture.maxTextureSize = tex.width/;
else importerTexture.maxTextureSize = tex.height/; importerTexture.textureFormat = TextureImporterFormat.AutomaticTruecolor;
}else{
if(tex.width >= tex.height )
importerTexture.maxTextureSize = tex.width;
else importerTexture.maxTextureSize = tex.height; importerTexture.textureFormat = TextureImporterFormat.AutomaticCompressed;
}
AssetDatabase.ImportAsset(path);
}
} static Object[] GetSelectedTextures()
{
return Selection.GetFiltered(typeof(Texture2D), SelectionMode.DeepAssets);
}
}
判断资源贴图是否有alpha的更多相关文章
- RESTful API URI 设计: 判断资源是否存在?
相关的一篇文章:RESTful API URI 设计的一些总结. 问题场景:判断一个资源(Resources)是否存在,URI 该如何设计? 应用示例:判断 id 为 1 用户下,名称为 window ...
- Havel-Hakimi定理---通过度数列判断是否可图化
0.可图:一个非负整数组成的序列如果是某个无向图的度序列,则该序列是可图的. 1.度序列:Sequence Degree,若把图G所有顶点的度数排成一个序列,责成该序列为图G的一个序列.该序列可以是非 ...
- Wince/VC高效PNG贴图,自定义Alpha算法
工作中,做一些炫点的界面都需要用到PNG图片,Wince里面微软也提供了PNG图片的支持,不过Alpha的混合速度比较慢,所以自己实现了一个Alpha的混合运算接口,经过测试,要比微软AlphaBle ...
- 判断强联通图中每条边是否只在一个环上(hdu3594)
hdu3594 Cactus Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- HDU 2444 The Accomodation of Students(判断是否可图 + 二分图)
题目大意:有一群人他们有一些关系,比如A认识B, B认识C, 但是这并不意味值A和C认识.现在给你所有互相认识的学生,你的任务是把所有的学生分成两个一组, 住在一个双人房里.相互认识的同学可以住在一个 ...
- hdu3926(判断两个图是否相似,模版)
题意:给你2个图,最大度为2.问两个图是否相似. 思路:图中有环.有链,判断环的个数以及每个环组成的人数,还有链的个数以及每个链组成的人数 是否相等即可. 如果形成了环,那么每形成一个环,结点数就会多 ...
- OpenCV——直方图计算、寻早最值位置和对比匹配(判断两幅图的相似程度)
- ZOJ 1015 Fishing Net(判断弦图)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=15 题意:给定一个图.判断是不是弦图? 思路:(1)神马是弦图?对于一 ...
- poj 1659 Frogs' Neighborhood (贪心 + 判断度数序列是否可图)
Frogs' Neighborhood Time Limit: 5000MS Memory Limit: 10000K Total Submissions: 6076 Accepted: 26 ...
随机推荐
- Zookeeper 快速理解
转自:http://blog.csdn.net/colorant/article/details/8444283 == 是什么 == 目标Scope(解决什么问题) 为分布式系统提供高可靠性的协同工作 ...
- Apache Storm内部原理分析
转自:http://shiyanjun.cn/archives/1472.html 本文算是个人对Storm应用和学习的一个总结,由于不太懂Clojure语言,所以无法更多地从源码分析,但是参考了官网 ...
- FPGA中的时序分析(一)
谈及此部分,多多少少有一定的难度,笔者写下这篇文章,差不多是在学习FPGA一年之后的成果,尽管当时也是看过类似的文章,但是都没有引起笔者注意,笔者现在再对此知识进行梳理,也发现了有很多不少的收获.笔者 ...
- (笔记)Mysql命令delete from:删除记录
delete from命令用于删除表中的数据. delete from命令格式:delete from 表名 where 表达式 例如,删除表 MyClass中编号为1 的记录: mysql&g ...
- Android WiFi 日志记录(四次握手)
记录一下四次握手的log. PMK: PMK(Pairwise Master Key,成对主密钥 STA和AP得到PMK后,将进行密匙派生以得到PTK.最后,PTK被设置到硬件中, 用于数据的加解密. ...
- SpringMVC系列(三):REST风格
一.什么叫REST REST:即 Representational State Transfer.(资源)表现层状态转化.是目前最流行的一种互联网软件架构.它结构清晰.符合标准.易于理解.扩展方便,所 ...
- e828. 创建JTabbedPane
A tabbed pane is a container that displays only one child component at a time. Typically, the childr ...
- Autofac应用总结
准备: public interface IDAL { void Insert(string commandText); } public class SqlDAL : IDAL { public v ...
- Python 3.x标准模块库目录
出处:http://blog.csdn.net/sadfishsc/article/details/10390065 文本 1. string:通用字符串操作 2. re:正则表达式操作 3. dif ...
- Mac terminal Javac
Mac terminal Javac Open the Terminal's vim , then write them: public class test{ public static void ...