CPForm:面向 DCC 工具开发的声明式
PyQt / PySideUI 库。一次开发,原生 / Maya / 3ds Max多端兼容+统一样式。
版本兼容:Maya 2018 - 20263ds Max 2018 - 2026Python 2.7 - 3.xPyQt5-6 / PySide2-6
- 跨软件代码兼容,包括Maya、3ds Max、还有原生环境。
- 全局统一样式,各个软件以及各个版本下一致的UI与行为
- 全局可配置,可以所以调整主题色、背景色等各个参数。
- 声明式写法,便于构建UI以及布局。
- 表单提交功能,便于收集输入的数据。
- CPForm 目前尚未发布到 PyPI,但你可以通过以下步骤从源代码安装:
git clone git@github.com:cpcgskill/cpform.git
cd cpform- 或者直接从 GitHub 下载源代码压缩包并解压。
CPForm 提供了一个简单的测试脚本,可以通过以下命令运行:
python3 ./scripts/cpform_test/core.py # python3 可能需要替换为你自己的 Python 路径这里以PySide2+Python3为例,其他版本的PyQt/PySide使用方法类似。
from PySide2.QtWidgets import *
import sys
app = QApplication(sys.argv)
from cpform.widget.core import *
import cpform.docker as docker
def show():
ui = ScrollArea(
VBoxLayout(
childs=[
Label('Label'),
PrimaryButton(text='PrimaryButton'),
AttentionButton(text='AttentionButton'),
SuccessButton(text='SuccessButton'),
WarningButton(text='WarningButton'),
ErrorButton(text='ErrorButton'),
NormalButton(text='Button'),
],
align='top'
)
)
docker.default_docker(title='Native Example', form=ui)
show()
app.exec_()CPForm 在 Maya 中的使用方法与 Native 类似,但在maya中启动时无需创建 QApplication 实例。你可以直接在 Maya 的 Python 脚本编辑器中运行以下代码:
from cpform.widget.core import *
import cpform.docker as docker
def show():
ui = ScrollArea(
VBoxLayout(
childs=[
Label('Label'),
PrimaryButton(text='PrimaryButton'),
AttentionButton(text='AttentionButton'),
SuccessButton(text='SuccessButton'),
WarningButton(text='WarningButton'),
ErrorButton(text='ErrorButton'),
NormalButton(text='Button'),
],
align='top'
)
)
docker.default_docker(title='Maya Example', form=ui)
show()todo, CPForm 会自动完成代码的兼容,所以在 3ds Max 中的使用方法与 Maya 类似。只需要注意将其添加到 3ds Max 的 Python 路径中即可。
你可以查看项目根目录下的 llms.txt 文件,它为大语言模型提供:
- 精简的 API/组件及布局清单
- 数据收集与
read_data()机制说明 - 主题配置 (
config_manager) 与自定义指南 - 典型使用模式(窗口 / 弹出 / 表单提交)
将 llms.txt 作为提示上下文,可显著减少模型推断时间并提升回答准确性。
该项目签署了Apache-2.0 授权许可,详情请参阅 LICENSE

