This tutorial introduces COMPs (Component Operators) in TouchDesigner. COMPs are unique compared to other operator families because they can contain other networks inside them, making them essential for organizing complex projects.

Understanding COMPs

The Four Sub-Families

COMPs are organized into four sub-families:

  1. 3D Objects - For 3D rendering (Camera, Geometry, Light)
  2. Panels - For user interface elements (Container, Button, Slider)
  3. Other - Utility components (Window)
  4. Dynamics - For physics simulations

Building a 3D Render Network

Adding Multiple Operators

To add multiple operators at once:

  1. Press Tab to open the OP Create dialog
  2. Hold Ctrl and click on multiple operators (Camera, Geometry, Light)
  3. Release Ctrl and add a Render TOP from the TOP family

How Rendering Works

The Render TOP uses:

  • The Camera as its perspective viewpoint
  • Geometry components for 3D objects
  • Lights to illuminate the scene

Transforming Geometry

To rotate geometry:

  • Middle mouse click on the rotate parameter
  • Use the Value Ladder to select your increment
  • Drag left or right to change values

Exploring Inside Components

The geometry you see (like a Torus) is actually located inside the Geometry COMP:

  • Use the mouse scroll wheel or press I to zoom inside a component
  • Inside, you’ll find the actual SOP network that defines the geometry
  • Use the scroll wheel to zoom back out

This nested structure is what makes COMPs powerful for organization.

Building User Interfaces with Panels

Container Components

Containers are how we organize UI elements in TouchDesigner:

  • Every container has an associated Panel - a canvas for laying out interface elements
  • Panels can be interacted with to capture user input

Panel CHOP for Interaction Data

To capture panel interaction:

  1. Add a Panel CHOP from Channel Operators
  2. Drag your Container onto the Panel CHOP
  3. Make the container Viewer Active using the A key or the viewer active flag

The Panel CHOP provides:

  • U/V position - Where the cursor is located
  • Inside U/V - Position when inside the panel
  • Select channels (lselect, mselect, rselect) - Which mouse button is pressed

Adding UI Elements

To add buttons and sliders:

  1. Add a Button or Slider component
  2. Use the top/bottom connectors to create hierarchy
  3. Connect UI elements to the Container to make them appear inside

Arranging UI Elements

When UI elements stack on top of each other:

  1. Make the Container non-viewer active first
  2. Select the Container
  3. Go to the Children page in parameters
  4. Use Align options (left to right, right to left)
  5. Set Justification (horizontal or vertical)

Window Component for Output

Creating Floating Windows

The Window component displays operators in separate windows:

  1. Add a Window component from the “Other” sub-family
  2. Add content (like a Movie File In TOP)
  3. Click and drag the operator onto the Window’s operator parameter
  4. Select which monitor to display on
  5. Click Open as Separate Window

Window Options

You can customize the window:

  • Toggle borders on/off
  • Display TOPs (texture operators) or other components
  • Use UI containers as window content for custom interfaces

Key Takeaways

  1. COMPs contain networks - They can hold other operators inside, enabling modular organization
  2. Four sub-families - 3D Objects, Panels, Other, and Dynamics serve different purposes
  3. Geometry lives inside - 3D objects are defined by networks inside Geometry COMPs
  4. Containers for UI - Use containers and their children alignment options to build interfaces
  5. Panel CHOP - Captures interaction data from container panels
  6. Window COMP - Creates floating windows for output display

COMPs are fundamental to building organized, modular projects in TouchDesigner, whether you’re creating 3D scenes or user interfaces.

本教程介绍TouchDesigner中的COMPs(组件操作符)。与其他操作符家族相比,COMPs是独特的,因为它们可以在内部包含其他网络,这使它们成为组织复杂项目的关键。

理解COMPs

四个子家族

COMPs分为四个子家族:

  1. 3D Objects(3D对象) - 用于3D渲染(Camera、Geometry、Light)
  2. Panels(面板) - 用于用户界面元素(Container、Button、Slider)
  3. Other(其他) - 实用组件(Window)
  4. Dynamics(动力学) - 用于物理模拟

构建3D渲染网络

添加多个操作符

要一次添加多个操作符:

  1. Tab打开OP创建对话框
  2. 按住Ctrl并点击多个操作符(Camera、Geometry、Light)
  3. 释放Ctrl并从TOP家族添加Render TOP

渲染工作原理

Render TOP使用:

  • Camera作为视角
  • Geometry组件作为3D对象
  • Lights照亮场景

变换几何体

要旋转几何体:

  • 鼠标中键点击旋转参数
  • 使用**Value Ladder(数值阶梯)**选择增量
  • 左右拖动以更改值

探索组件内部

您看到的几何体(如圆环)实际上位于Geometry COMP内部:

  • 使用鼠标滚轮或按I键缩放进入组件内部
  • 在内部,您会找到定义几何体的实际SOP网络
  • 使用滚轮缩放返回

这种嵌套结构使COMPs在组织方面非常强大。

使用面板构建用户界面

Container组件

Container是我们在TouchDesigner中组织UI元素的方式:

  • 每个Container都有一个关联的Panel(面板) - 用于布局界面元素的画布
  • 可以与面板交互以捕获用户输入

Panel CHOP获取交互数据

要捕获面板交互:

  1. 从Channel Operators添加Panel CHOP
  2. 将Container拖到Panel CHOP上
  3. 使用A键或viewer active标志使Container进入Viewer Active状态

Panel CHOP提供:

  • U/V位置 - 光标所在位置
  • Inside U/V - 在面板内时的位置
  • Select通道(lselect、mselect、rselect)- 按下了哪个鼠标按钮

添加UI元素

要添加按钮和滑块:

  1. 添加ButtonSlider组件
  2. 使用顶部/底部连接器创建层级关系
  3. 将UI元素连接到Container使其显示在内部

排列UI元素

当UI元素相互堆叠时:

  1. 首先使Container退出viewer active状态
  2. 选择Container
  3. 进入参数中的Children页面
  4. 使用**Align(对齐)**选项(从左到右、从右到左)
  5. 设置Justification(对齐方式)(水平或垂直)

Window组件用于输出

创建浮动窗口

Window组件在单独的窗口中显示操作符:

  1. 从”Other”子家族添加Window组件
  2. 添加内容(如Movie File In TOP
  3. 点击并拖动操作符到Window的operator参数上
  4. 选择要显示的显示器
  5. 点击Open as Separate Window(作为单独窗口打开)

窗口选项

您可以自定义窗口:

  • 切换边框开/关
  • 显示TOPs(纹理操作符)或其他组件
  • 使用UI容器作为窗口内容以创建自定义界面

关键要点

  1. COMPs包含网络 - 它们可以在内部容纳其他操作符,实现模块化组织
  2. 四个子家族 - 3D Objects、Panels、Other和Dynamics服务于不同目的
  3. 几何体在内部 - 3D对象由Geometry COMPs内部的网络定义
  4. Container用于UI - 使用Container及其子元素对齐选项构建界面
  5. Panel CHOP - 从Container面板捕获交互数据
  6. Window COMP - 创建用于输出显示的浮动窗口

COMPs是在TouchDesigner中构建有组织的模块化项目的基础,无论您是创建3D场景还是用户界面。