U3D 复制曲线
发布日期:2021-06-30 14:56:45
浏览次数:3
分类:技术文章
本文共 1431 字,大约阅读时间需要 4 分钟。
using UnityEngine;using UnityEditor;[CustomPropertyDrawer(typeof(AnimationCurve))]public class CurvePropertyDrawer: PropertyDrawer { private const int _buttonWidth = 12; private static Keyframe[] _buffer; private static WrapMode _preWrapMode; private static WrapMode _postWrapMode; public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { prop.animationCurveValue = EditorGUI.CurveField( new Rect(pos.x, pos.y, pos.width - _buttonWidth * 2, pos.height), label, prop.animationCurveValue ); // Copy if ( GUI.Button( new Rect(pos.x + pos.width - _buttonWidth * 2, pos.y, _buttonWidth, pos.height), "" ) ) { _buffer = prop.animationCurveValue.keys; _preWrapMode = prop.animationCurveValue.preWrapMode; _postWrapMode = prop.animationCurveValue.postWrapMode; } GUI.Label( new Rect(pos.x + pos.width - _buttonWidth * 2, pos.y, _buttonWidth, pos.height), "C" ); // Paste if (_buffer == null) return; if ( GUI.Button( new Rect(pos.x + pos.width - _buttonWidth, pos.y, _buttonWidth, pos.height), "" ) ) { AnimationCurve newAnimationCurve = new AnimationCurve(_buffer); newAnimationCurve.preWrapMode = _preWrapMode; newAnimationCurve.postWrapMode = _postWrapMode; prop.animationCurveValue = newAnimationCurve; } GUI.Label( new Rect(pos.x + pos.width - _buttonWidth, pos.y, _buttonWidth, pos.height), "P" ); } // OnGUI() } // class CurvePropertyDrawer
转载地址:https://jerryjin.blog.csdn.net/article/details/83341907 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
表示我来过!
[***.240.166.169]2024年04月24日 10时17分10秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
ACM 2013 长沙区域赛 Collision (几何)
2019-04-30
ACM 2014 鞍山区域赛 E - Hatsune Miku (dp)
2019-04-30
反向传播&梯度下降 的直观理解程序(numpy)
2019-04-30
CodeForces - 931B World Cup (思维 模拟)
2019-04-30
ACM 2017 北京区域赛 J-Pangu and Stones(区间dp)
2019-04-30
java常用类 String面试题
2019-04-30
Windows10下的powershell美化教程
2019-04-30
利用ffmpeg合并音频和视频
2019-04-30
solr修改schema文件(solr修改配置文件)
2019-04-30
select下拉框分组展示插件的使用--(select-mania插件的使用)
2019-04-30
Java Lambda表达式的应用--Stream API操作集合框架
2019-04-30
Myslq连接(JDBC)url属性的参数的设置
2019-04-30
关于Spring MVC与前端的交互
2019-04-30
大厂经典面试题:Redis为什么这么快?
2019-04-30
Android之Retrofit基本用法篇
2019-04-30
Netty与网络协议资料整理
2019-04-30