Asset from Smart Folder
Asset from Smart Folder 可用于引用 Smart Folder 中包含的资源(图片、视频、音频等)。参见 Image Smart Folder 或 Audio Smart Folder。
Mode - 选择引用资源的方式:
- Path - 通过文件名/文件路径引用资源。
- Auto Index - 通过
index引用资源。这在 Duplicator 中使用 Smart Folder 时很有用。Smart Folder 按字母顺序排列,因此将模式设为 Auto Index 将按相同顺序输出资源。 - Specific Index - 设置要输出的 Smart Folder 中的特定索引。可以设置值或连接 Behaviour 以向每个 context 传递不同的索引。
Smart Folder Asset - 将来自 Assets Window 的 Image Smart Folder 或 Audio Smart Folder 连接到此属性。
Path - 输入文件名,或连接一个包含 Smart Folder 中资源文件名的 Spreadsheet 或 Array。
Index - 设置特定索引或连接一个 Behaviour。
Count - 一个只读属性,返回在 Image Smart Folder 或 Audio Smart Folder 中找到的资源数量。注意,Smart Folder 限制为最大深度 5 个目录。
Out Path - 一个只读属性,可用于输出资源的 Path。当 Mode 设为 Specific Index 时,可用于连接到 Render Queue Item 的 File Name。
可以通过将 Out Path 连接到 String,然后使用 Replace String 来编辑文件路径。例如:
要移除 .png 文件扩展名:
- 将 Replace 设为
.png。 - 将 With 留空。
要将 / 替换为 -:
- 将 Replace 设为
/。 - 将 With 设为
-。
然后可以将 String 连接到 Text Shape 作为”标签”,或连接到 Render Queue Item 的 File Name 以在任何渲染中引用图片名称。
右键点击 Assets Window 中的 Smart Folder,选择 View File Paths… 以预览资源的索引。
- 导入一个包含文件
apple.png、orange.png和banana.png的 Smart Folder。 - 将该 Smart Folder 从 Assets Window 拖入 Attribute Editor 或 Viewport。
- 创建一个 String Array。
- 使用
Add 按钮添加另外两个索引,并分别输入
apple.png、orange.png和banana.png。 - 将 String Array 连接到 Asset from Smart Folder 的 Path 属性。
- 取消勾选 String Array 的 Auto Index,并在 Index 中输入
1。
图片应从苹果变为橙子。
尝试将 String Array 替换为 Spreadsheet,并将 Render Manager 的 Dynamic Index 连接到其 Index。