计算几何

作者:追风剑情 发布于:2018-1-7 14:16 分类:Algorithms

示例代码 using System; using System.Collections.Generic; namespace Geometry { /// <summary> /// 计算几何类 /// 封装了计算几何的基本算法: /// 点与矩形的关系、点与圆的关系、点与直线的关系、直线与直线的关系、点与多边形的关系 ...

阅读全文>>

标签: Algorithms

评论(0) 浏览(4309)

自定义Hierarchy中的对象排序——BaseHierarchySort

作者:追风剑情 发布于:2017-12-29 13:58 分类:Unity3d

开启Hierarchy排序(Edit->preferences->General) 勾上Enable Alpha Numeric Sorting 示例(必须放在Editor文件夹下) using UnityEngine; using UnityEditor; using System.Collections; /// <sum...

阅读全文>>

标签: Unity3d

评论(0) 浏览(52793)

ListView

作者:追风剑情 发布于:2017-12-28 17:35 分类:C#

示例 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks;...

阅读全文>>

标签: C#

评论(0) 浏览(2981)

获取对象的预览图——AssetPreview.GetAssetPreview()

作者:追风剑情 发布于:2017-12-27 17:49 分类:Unity3d

获取对象的预览图 示例代码 using UnityEngine; using UnityEditor; using System.Collections; public class AssetPreviewWindow : EditorWindow { [MenuItem("Example/AssetPreviewWindow")] ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(7513)

EditorGUIUtility.Load()

作者:追风剑情 发布于:2017-12-27 11:47 分类:Unity3d

先来看看这个方法的实现(可通过ILSpy反编译UnityEngine.dll查看源码) // UnityEditor.EditorGUIUtility [TypeInferenceRule(TypeInferenceRules.TypeReferencedBySecondArgument)] private static UnityEngine.Object Load(string ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3630)

提取Unity内置资源图标

作者:追风剑情 发布于:2017-12-27 11:37 分类:Unity3d

参考 http://blog.csdn.net/warrenmondeville/article/details/53247181 示例代码 using UnityEngine; using UnityEditor; using System; using System.Collections; using System.Reflection; ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(5480)

PopupWindowContent

作者:追风剑情 发布于:2017-12-26 16:44 分类:Unity3d

自定义弹出菜单 PopupExample.cs using UnityEngine; using UnityEditor; using System.Collections; public class PopupExample : PopupWindowContent { bool toggle1 = true; bool toggl...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4023)

选择对象——EditorGUIUtility.ShowObjectPicker()

作者:追风剑情 发布于:2017-12-25 21:45 分类:Unity3d

TestInspector.cs using UnityEngine; using UnityEditor; using System.Collections; [CustomEditor(typeof(Test))] public class TestInspector : Editor { Test test; bool toggleGr...

阅读全文>>

标签: Unity3d

评论(0) 浏览(10185)

DecoratorDrawer

作者:追风剑情 发布于:2017-12-25 17:39 分类:Unity3d

工程截图 示例代码 Range1DecoratorDrawer.cs using UnityEngine; using UnityEditor; using System.Collections; //自定义特性的装饰属性样式 [CustomPropertyDrawer(typeof(Range1Attribute))] public ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3328)

PropertyDrawer

作者:追风剑情 发布于:2017-12-25 17:32 分类:Unity3d

工程截图 示例代码 Range1PropertyDrawer.cs using UnityEngine; using UnityEditor; using System.Collections; //自定义特性属性样式 [CustomPropertyDrawer(typeof(Range1Attribute))] publi...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3205)

获取深度和法线纹理的原理

作者:追风剑情 发布于:2017-12-23 12:07 分类:Shader

原理       深度纹理实际就是一张渲染纹理,只不过它里面存储的像素值不是颜色值,而是一个高精度的深度值。由于被存储在一张纹理中,深度纹理的深度值范围是[0, 1],而且通常是非线性分布的。这些值来自于顶点变换后得到的归一化的设备坐标(Normalized Device Coordinates, NDC)。在得到NDC后,深度纹理中的像素值就可以很方便地...

阅读全文>>

标签: Shader

评论(0) 浏览(3947)

获取对象依赖关系

作者:追风剑情 发布于:2017-12-21 21:14 分类:Unity3d

手动查看对象依赖关系 代码获取对象依赖关系 using UnityEngine; using UnityEditor; using System; using System.IO; using System.Collections; public class MenuEditor { [MenuItem("Tool/Ed...

阅读全文>>

标签: Unity3d

评论(0) 浏览(5816)

分离Alpha通道

作者:追风剑情 发布于:2017-12-21 11:01 分类:Unity3d

工程 示例代码 using UnityEngine; using UnityEditor; using System; using System.IO; using System.Collections; public class MenuEditor { [MenuItem("Tool/Texture S...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3515)

魔法方法、属性和迭代器

作者:追风剑情 发布于:2017-12-19 15:24 分类:Python

示例 # -*- coding: cp936 -*- #魔法方法、属性和迭代器 class NewStyle(object):#继承object的类作为新式类 pass #这句声明之后定义的类都为新式类 __metaclass__ = type #使用新式类 #在Python3.0中都是新式类,不需要显示声明. class FooBar: de...

阅读全文>>

标签: Python

评论(0) 浏览(3250)

异常

作者:追风剑情 发布于:2017-12-15 21:37 分类:Python

示例 # -*- coding: cp936 -*- #异常 #使用raise函数引发异常 #raise Exception #raise Exception('hyperdrive overload') #自定义错误信息 import exceptions #dir函数可列出模块内容 #exceptions模块中的异常类都可用在raise语句中 #Exce...

阅读全文>>

标签: Python

评论(0) 浏览(2460)

作者:追风剑情 发布于:2017-12-15 15:59 分类:Python

示例 # -*- coding: cp936 -*- #类型检查 x = (1,2,3) print isinstance(x, tuple) #是否为元组类型 print isinstance(x, list) #是否为列表类型 print isinstance(x, str) #是否为字符串类型 print isinstance(x, dict) #是不为字典类型 pr...

阅读全文>>

标签: Python

评论(0) 浏览(2477)

函数

作者:追风剑情 发布于:2017-12-13 15:21 分类:Python

示例 # -*- coding: cp936 -*- #函数 #内建的callable函数可以用来判断函数是否可调用 #callable在Python3.0中不再可用,需要使用表达式hasattr(func, __call__)代替。 print '判断函数是否可调用' import math x = 1 y = math.sqrt print callable(x) ...

阅读全文>>

标签: Python

评论(0) 浏览(2892)

循环语句

作者:追风剑情 发布于:2017-12-12 21:42 分类:Python

示例 # -*- coding: cp936 -*- #while循环 x = 1 while x <= 5: print x x += 1 #Python中的语句块是用缩排来识别的 #让用户必须输入名字,不能输入空字符 name = '' while not name or name.isspace(): #while not name.s...

阅读全文>>

标签: Python

评论(0) 浏览(2804)

if条件语句

作者:追风剑情 发布于:2017-12-12 16:40 分类:Python

示例 # -*- coding: cp936 -*- print '条件和条件语句' #下面的值会被解释器看作假(false) #False、None、0、""、()、[]、{} #显示转换布尔值 print bool('I think, therefore I am') #if语句 #短路逻辑(惰性求值),类似三元运算. #如果raw_input()返回假(即,空字符串),则执行or后面...

阅读全文>>

标签: Python

评论(0) 浏览(3106)

赋值操作

作者:追风剑情 发布于:2017-12-12 15:15 分类:Python

示例 # -*- coding: cp936 -*- #print打印多条语句,用逗号隔开 print 'Age:', 42 print 1,2,3 name = 'Gumby' salutation = 'Mr.' greeting = 'Hello,' #多条语句会自动以空格分开 print greeting, salutation, name #以逗号结尾...

阅读全文>>

标签: Python

评论(0) 浏览(2941)

字典

作者:追风剑情 发布于:2017-12-11 15:49 分类:Python

示例 # -*- coding: cp936 -*- names = ['Alice', 'Beth', 'Cecil', 'Dee-Dee', 'Earl'] numbers = ['2341', '9102', '3158', '0142', '5551'] print numbers[names.index('Cecil')] #字典 #键: 可以是任意的不可变类型,...

阅读全文>>

标签: Python

评论(0) 浏览(2897)

字符串方法

作者:追风剑情 发布于:2017-12-9 18:36 分类:Python

示例 # -*- coding: cp936 -*- import string from string import digits,letters,lowercase,printable,punctuation,uppercase print '字符串常量' print digits #包含数字0~9的字符串 print letters #包含所有字母(大写或小写)的字符串 ...

阅读全文>>

标签: Python

评论(0) 浏览(2951)

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号