虚幻引擎(UE4)UMG Clipping 裁剪系统

举报
Dummy 发表于 2021/11/19 00:27:21 2021/11/19
【摘要】 警告:在UE 4.17版本,裁剪系统经过大改,某些情况下可能会向后不兼容。更多裁剪修改信息请查看裁剪系统文档。 UMG裁剪系统采用了Slate的裁剪系统,用来控制文本、图片或者其他内容如何在Widget中显示。剪裁的工作原理是使用边界框将渲染对象(图形和文本)限制到某个区域,以便不显示该区域以外的任何对象。裁剪系统是坐标轴对齐的。 ...

警告:在UE 4.17版本,裁剪系统经过大改,某些情况下可能会向后不兼容。更多裁剪修改信息请查看裁剪系统文档

UMG裁剪系统采用了Slate的裁剪系统,用来控制文本、图片或者其他内容如何在Widget中显示。剪裁的工作原理是使用边界框将渲染对象(图形和文本)限制到某个区域,以便不显示该区域以外的任何对象。裁剪系统是坐标轴对齐的。

ClippingExamples.png

在这个例子中,每一个按钮是文本的父级,这些例子清楚地说明了文本是如何被按钮边界裁剪的。

  • 左边的按钮,文本没有被裁剪。
  • 中间的按钮,文本被自己的边界框裁剪。
  • 右边的按钮,文本被父节点(按钮)的边界裁剪。

    在下面的图示中,蓝色的边界线代表你的游戏屏幕将裁剪线外的任何东西。
    UMGDesigner.png
    蓝色线代表你的游戏屏幕边界线。

在引擎的4.16版本以前,控件裁剪是使用布Layout来防止画布外面的区域被渲染。所以如果一个控件的边界如果在画布外面,即使经过旋转也不会被渲染,即使在画布内的部分也不会被渲染。

例如,这些示例显示了更改前后的比较变化:

Clipping1.png

裁剪模式

你可以在Detail面板中修改控件的裁剪方式。

ClippingProperties.png

Property

Description

Inherit

使用父节点的裁剪方式

Clip to Bounds

以边界框为裁剪框,如果与其他裁剪框相交了,也会被裁剪。

Clip to Bounds - Without Intersecting

This widget clips to its bounds. It does not intersect with any existing clipping geometry, it pushes a new clipping state. Effectively allowing it to render outside the bounds of hierarchy that does clip.

This will not allow you to ignore the clipping zone that is set to Clip to Bounds - Always

 

Clip to Bounds - Always

This widget clips to its bounds. It intersects those bounds with any previous clipping area.

This clipping area cannot be ignored, it will always clip children. This is useful for hard barriers in the UI where you never want animations or other effects to break this region.

 

On Demand

This widget clips to its bound when it's Desired Size is larger than the allocated geometry the widget is given. If that occurs, it will work like Clip to Bounds.

This mode was primarily added for Text, which is often placed into containers that eventually are resized to not be able to support the length of the text. So rather than needing to tag every container that could contain text with [YES], which would result in almost no batching, this mode was added to dynamically adjust the clipping if needed. The reason not every is not set to On Demand is because not every panel returns a Desired Size that matches what it plans to render at.

其他注意事项:

  • 在绝大多数情况下,你不需要调整裁剪模式,除非你确实需要这样做(例如你确实无法确定文本的长度,而需要将文本控制在裁剪区内)。一个常见的例子就是滚动界面和可编辑的文本控件,它们需要设置裁剪方式为 Clip to Bounds,而不是Inherit(继承)

 

 

文章来源: blog.csdn.net,作者:呦呦鹿鸣.,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/zhang1461376499/article/details/113663300

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。