simvx.editor.templates¶
Script Templates – Boilerplate generators for new nodes and projects.
Provides templates for each major node type so that users can quickly scaffold
new scripts via File > New Script. Also includes project wizard templates
for creating new projects (Empty, 2D Game, 3D Game).
Template variables: ${class_name} - PascalCase class name ${base_class} - Base class to inherit from ${file_name} - Snake_case file name (without .py)
Module Contents¶
Classes¶
A script template with a name, base class, and code body. |
|
Template for creating a new project. |
Functions¶
Generate a script from a template. |
|
Generate script source text from a template (no file I/O). |
|
Create a new project from a template. |
Data¶
API¶
- simvx.editor.templates.log¶
‘getLogger(…)’
- simvx.editor.templates.__all__¶
[‘ScriptTemplate’, ‘TEMPLATES’, ‘generate_script’, ‘ProjectTemplate’, ‘PROJECT_TEMPLATES’, ‘generate…
- class simvx.editor.templates.ScriptTemplate¶
A script template with a name, base class, and code body.
- name: str¶
None
- base_class: str¶
None
- body: str¶
None
- description: str = <Multiline-String>¶
- simvx.editor.templates.TEMPLATES: dict[str, simvx.editor.templates.ScriptTemplate]¶
None
- simvx.editor.templates.generate_script(template_name: str, class_name: str, file_name: str | None = None, output_path: str | pathlib.Path | None = None) str¶
Generate a script from a template.
Args: template_name: Key in TEMPLATES (e.g. “Node3D”). class_name: PascalCase class name. file_name: Snake_case file name (auto-derived if None). output_path: If given, write the script to this path.
Returns: The generated script text.
- simvx.editor.templates.generate_script_text(template_name: str, class_name: str) str¶
Generate script source text from a template (no file I/O).
- class simvx.editor.templates.ProjectTemplate¶
Template for creating a new project.
- name: str¶
None
- description: str¶
None
- files: dict[str, str]¶
None
- simvx.editor.templates.PROJECT_TEMPLATES: dict[str, simvx.editor.templates.ProjectTemplate]¶
None
- simvx.editor.templates.generate_project(template_name: str, project_name: str, output_dir: str | pathlib.Path) pathlib.Path¶
Create a new project from a template.
Args: template_name: Key in PROJECT_TEMPLATES (e.g. “3D Game”). project_name: Name for the project. output_dir: Directory to create the project in.
Returns: Path to the created project directory.