Skip to content

Howchilll/PythonEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Python 扩展模板生成器 / Python Extension Template Generator

一个 Unity 编辑器工具,用于快速生成调用 Python 脚本的 C# 扩展模板。

A Unity editor tool for quickly generating C# extension templates that call Python scripts.

功能 / Features

  • 🚀 一键生成 Python 扩展模板

  • 📝 支持自定义参数列表

  • 🎯 自动处理命名规范(C# PascalCase / Python snake_case)

  • 💡 智能生成:有参数时自动创建参数输入面板

  • 🚀 One-click Python extension template generation

  • 📝 Customizable parameter list

  • 🎯 Automatic naming convention handling (C# PascalCase / Python snake_case)

  • 💡 Smart generation: auto-creates parameter input panel when parameters exist

使用方法 / Usage

  1. 打开菜单:Tools > PyFunctions > 生成 Python 扩展模板

  2. 输入扩展名称(例如:MyScript

  3. 添加参数(可选,例如:inputPath, outputPath

  4. 点击"生成模板"按钮

  5. Open menu: Tools > PyFunctions > 生成 Python 扩展模板

  6. Enter extension name (e.g., MyScript)

  7. Add parameters (optional, e.g., inputPath, outputPath)

  8. Click "生成模板" button

生成的文件 / Generated Files

生成的文件将位于 Editor/EditorPython/[扩展名]/ 目录下:

Generated files will be located in Editor/EditorPython/[ExtensionName]/ directory:

  • [扩展名].cs - C# 调用脚本

  • [扩展名_snake_case].py - Python 脚本

  • [ExtensionName].cs - C# calling script

  • [ExtensionName_snake_case].py - Python script

示例 / Example

输入 / Input:

  • 扩展名称: ImageProcessor
  • 参数: inputPath, outputPath

生成 / Generated:

  • ImageProcessor.cs - 带参数输入面板的 C# 类

  • image_processor.py - Python 脚本,自动接收参数

  • ImageProcessor.cs - C# class with parameter input panel

  • image_processor.py - Python script that automatically receives parameters

注意事项 / Notes

  • 扩展名称会自动转换为符合规范的类名

  • 参数名称会自动规范化(C# camelCase / Python snake_case)

  • 无参数时,点击菜单项直接执行;有参数时,会弹出参数输入面板

  • Extension names are automatically converted to valid class names

  • Parameter names are automatically normalized (C# camelCase / Python snake_case)

  • No parameters: click menu item to execute directly; With parameters: parameter input panel will pop up

About

Use Python do to Editor extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published