跳转到内容

Asset from Smart Folder

Asset from Smart Folder 可用于引用 Smart Folder 中包含的资源(图片、视频、音频等)。参见 Image Smart FolderAudio Smart Folder

Mode - 选择引用资源的方式:

  • Path - 通过文件名/文件路径引用资源。
  • Auto Index - 通过 index 引用资源。这在 Duplicator 中使用 Smart Folder 时很有用。Smart Folder 按字母顺序排列,因此将模式设为 Auto Index 将按相同顺序输出资源。
  • Specific Index - 设置要输出的 Smart Folder 中的特定索引。可以设置值或连接 Behaviour 以向每个 context 传递不同的索引。

Smart Folder Asset - 将来自 Assets WindowImage Smart FolderAudio Smart Folder 连接到此属性。

Path - 输入文件名,或连接一个包含 Smart Folder 中资源文件名的 Spreadsheet 或 Array。

Index - 设置特定索引或连接一个 Behaviour。

Count - 一个只读属性,返回在 Image Smart FolderAudio Smart Folder 中找到的资源数量。注意,Smart Folder 限制为最大深度 5 个目录

Out Path - 一个只读属性,可用于输出资源的 Path。当 Mode 设为 Specific Index 时,可用于连接到 Render Queue ItemFile Name

可以通过将 Out Path 连接到 String,然后使用 Replace String 来编辑文件路径。例如:

要移除 .png 文件扩展名:

  • Replace 设为 .png
  • With 留空。

要将 / 替换为 -

  • Replace 设为 /
  • With 设为 -

然后可以将 String 连接到 Text Shape 作为”标签”,或连接到 Render Queue ItemFile Name 以在任何渲染中引用图片名称。

右键点击 Assets Window 中的 Smart Folder,选择 View File Paths… 以预览资源的索引。

  1. 导入一个包含文件 apple.pngorange.pngbanana.pngSmart Folder
  2. 将该 Smart FolderAssets Window 拖入 Attribute Editor 或 Viewport。
  3. 创建一个 String Array
  4. 使用 Button iconAdd 按钮添加另外两个索引,并分别输入 apple.pngorange.pngbanana.png
  5. String Array 连接到 Asset from Smart FolderPath 属性。
  6. 取消勾选 String ArrayAuto Index,并在 Index 中输入 1

图片应从苹果变为橙子。

尝试将 String Array 替换为 Spreadsheet,并将 Render ManagerDynamic Index 连接到其 Index