使用蓝图创建编辑器内工具-学习笔记

Viewed 14

更多:

https://mp.weixin.qq.com/s?__biz=MzUxMDM3MTYwNQ==&mid=2247498380&idx=1&sn=c99f8ee12f43d63e8bffa52399e04c39&chksm=f90148f6ce76c1e0fa8792c1957011493cf741c6ac5eeca4c2feb76e31bf7e261aca3f208126&token=1809708771&lang=zh_CN#rd

官方视频教程(B站中文)

  • [教育直播]使用蓝图创建编辑器内工具 | Building In-Editor Tools with Blueprint(官方字幕)

[教育直播]使用蓝图创建编辑器内工具 | Building In-Editor Tools with Blueprint(官方字幕)_哔哩哔哩_bilibili

  • 以下笔记前的括号内标注的为笔记对应的本视频的时间。

前面的话

  • (42:53)推荐的蓝图结点学习网站
  • (47:45)Construction Script 的短板
  • 不能对 Content Browser 中的资源做任何操作。

创建步骤精简版

Editor Utility Blueprints

  1. 功能作用:可用于创建右键弹出型菜单
  2. 开启插件:Edit -> Plugins -> Scripting -> Editor Scripting Utilities
  3. 命名规范:BPU
  4. 工具创建:Content Browser -> 右键 -> Editor Utilities -> Editor Utility Blueprints。
  5. 工具注册:右键创建的 BPU ,执行 Run Editor Unity Blueprint。
  6. 方法重载:GetSupportedClass ,可设置仅对应类型的资源显示该菜单。

Editor Utility Widgets

  1. 功能作用:可用于创建界面型菜单
  2. 开启插件:Edit -> Plugins -> Scripting -> Editor Scripting Utilities
  3. 命名规范:BPU
  4. 工具注册:右键创建的 BPU ,执行 Run Editor Unity Blueprint。
  5. 命名规范:UPU。
  6. 工具创建:Content Browser 右键 -> Editor Utilities -> Editor Utility Widgets。
  7. 回滚撤销:Begin Transactions、Transact Object、End Transactions。
  8. 共享使用:Class Defaults -> Settings -> Always Register With Windows。
  9. 窗口位置:Window -> EditorUnityWidget。

LOD示例详细版

(48:36)Editor Utility Blueprints

  1. (50:02)首先要开启插件:Edit -> Plugins -> Scripting -> Editor Scripting Utilities
  2. (59:38)Asset Action Utility 资源的命名规范:前缀 BPU
  3. (60:30)BPU 创建后,要右键对应的 BPU 资源 ,选择 Run Editor Unity Blueprint 一次,注册到项目,才可用。
  4. (01:02:02) 可通过 GetSelectedAssets 获得 Content Browser 中的所有选中的 Assets(注意有别于 Level World Outline 上的 Actor)
  5. (01:03:12)通过 Cast 可以把获取到的 Asset 转换为目标的具体类型,如 StaticMesh。
  6. (01:10:15)“Shift + 单击”刚才添加的菜单,可以快速跳转到菜单对应的蓝图代码处。
  7. (01:11:18)在 BP 的方法体中,把参数拖拽到方法名下,可快速添加 Input 参数。同时对于此处的 BPU 方法,添加 Input 后,在菜单处执行指定方法时,会弹出参数选择界面。
  8. (01:15:35)对于BPU,处于 Function 体内时,Functions 右侧 Override 下拉菜单中有 GetSupportedClass 选项,可以设置该 Function 只对某类型的资源有效(非该类资源不显示菜单)。
  9. (01:17:37)(QA)Migrate 可以让这些工具方便地在项目之间共享迁移。
  10. (01:19:29)任意 BPU 的 Palette 面板的 Library 下的 EditorScripting 中显示了 BPU 可用的所有蓝图API。
  11. (01:19:55)(QA)通过计时器可以让 Function 连续运行(危险慎重)。
  12. (01:21:05)BPU 可用来自动批量处理资源的命名规范等问题。

(01:21:36)Editor Utility Widgets

  1. (01:22:21)UMG支持多平台
  2. (01:24:38)创建 UMG 编辑器工具的入口:Content Browser 右键 -> Editor Utilities -> Editor Utility Widgets。命名规范也是UPU。
  3. (01:26:49)可以通过拖拽的方式,从 Palette 面板拖拽组件放到 Viewpoint 来设计界面。
  4. (01:27:60)给按钮命名后,可在 Graph 面板的 Variables 下看到这个变量,选中后可以在 Details 中的 Events 里,点击各种事件(如 OnClicked)来添加事件处理方法。
  5. (01:30:28)可通过 GetSelectedLevelActors 操作 Level WorldOutline 中的 Actor。
  6. (01:30:59)注意 GetSelectedAssets 和 GetSelectedActors 之间的区别:Asset 存在于 Content Browser 中,Actor 存在于 Level WorldOutline 下。也可用GetSelectedLevelActors 来获取 Actors。
  7. (01:32:47)Editor Utility Widgets 生效前也要 run 一下。
  8. (01:32:57)Editor Utility Widgets 作为UMG界面,可以任意停靠。
  9. (01:35:02)Transactions 下的 Functions 可以提供撤销功能。简单的做法就是:在打算修改资源前使用 Begin Transactions,真正修改前用 Transact Object,修改完毕后使用 End Transactions。
  10. (01:38:09)如果想要团队其他成员无需注册就能使用这个 BPU ,可在 BPU 的 Class Defaults 下的 Settings 下选择 Always Register With Windows。
  11. (01:38:29)Editor Utility Widgets 会显示在 Window -> EditorUnityWidget 下。

后面的话

**声明:**本文来自公众号:GameDevLearning,转载请附上原文链接及本声明。

0 Answers