improvement
This commit is contained in:
121
plans/cutscene_generator_changes.md
Normal file
121
plans/cutscene_generator_changes.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# CutsceneGenerator Changes for Resource Management Focus
|
||||
|
||||
## Overview
|
||||
|
||||
This document describes the changes needed in CutsceneGenerator.gd to focus on resource management instead of code generation.
|
||||
|
||||
## Current Issues
|
||||
|
||||
The current CutsceneGenerator.gd has several issues:
|
||||
1. Focuses on generating GDScript code rather than working with resources
|
||||
2. Has methods for generating code that are not needed
|
||||
3. Should focus on converting graph data to runtime actions
|
||||
4. Has some useful functionality for building action sequences that should be retained
|
||||
|
||||
## Required Changes
|
||||
|
||||
### 1. Remove Code Generation Methods
|
||||
|
||||
Methods to remove:
|
||||
- `generate_gdscript_code()`
|
||||
- `_generate_action_sequence_code()`
|
||||
- `_generate_action_code()`
|
||||
- `export_to_format()` (or modify to only support resource formats)
|
||||
|
||||
### 2. Retain and Improve Resource-to-Action Conversion
|
||||
|
||||
Methods to keep and improve:
|
||||
- `generate_cutscene()` - This is the core method we want
|
||||
- `_build_action_sequence()` - Core logic for creating action sequences
|
||||
- `_create_action_from_node()` - Core logic for creating individual actions
|
||||
- `_handle_parallel_group()` - Logic for handling parallel actions
|
||||
|
||||
### 3. Update Data Access Methods
|
||||
|
||||
Current issues:
|
||||
- Uses old data structure access patterns
|
||||
- May need to access data differently with new structure
|
||||
|
||||
Changes needed:
|
||||
- Update to use new node structure with "id" instead of "name"
|
||||
- Update to use new connection structure
|
||||
- Remove any references to parallel_connections
|
||||
|
||||
### 4. Improve Action Creation
|
||||
|
||||
Current issues:
|
||||
- Action creation has placeholder values for character nodes
|
||||
- Needs better parameter handling
|
||||
|
||||
Changes needed:
|
||||
- Improve parameter mapping from node to action
|
||||
- Maintain flexibility for runtime character resolution
|
||||
|
||||
## New Focus
|
||||
|
||||
The CutsceneGenerator should:
|
||||
1. Take a CutsceneResource and convert it to a CutsceneManager with properly configured actions
|
||||
2. Not generate any code
|
||||
3. Focus purely on the data transformation from editor format to runtime format
|
||||
4. Handle all node types and connection logic correctly
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### 1. Remove Unnecessary Methods
|
||||
|
||||
- Delete all code generation methods
|
||||
- Remove export functionality that generates code
|
||||
- Keep only the core resource-to-action conversion logic
|
||||
|
||||
### 2. Update Core Methods
|
||||
|
||||
- `generate_cutscene()`: Ensure it works with new resource structure
|
||||
- `_build_action_sequence()`: Update to use new connection structure
|
||||
- `_create_action_from_node()`: Ensure parameter mapping is correct
|
||||
- `_handle_parallel_group()`: Update to work with new structure
|
||||
|
||||
### 3. Add Utility Methods
|
||||
|
||||
- Add methods for validating resource data
|
||||
- Add methods for resolving character/action references
|
||||
- Add error handling for malformed resources
|
||||
|
||||
### 4. Improve Documentation
|
||||
|
||||
- Update comments to reflect new purpose
|
||||
- Document the resource-to-action conversion process
|
||||
- Provide clear examples of usage
|
||||
|
||||
## Specific Code Changes
|
||||
|
||||
### In `generate_cutscene`:
|
||||
|
||||
```gdscript
|
||||
# OLD - May have issues with new structure
|
||||
for node_data in cutscene_resource.nodes:
|
||||
graph_nodes[node_data["name"]] = node_data
|
||||
|
||||
# NEW - Update to use new structure
|
||||
for node_data in cutscene_resource.nodes:
|
||||
graph_nodes[node_data["id"]] = node_data
|
||||
```
|
||||
|
||||
### In `_get_outgoing_connections`:
|
||||
|
||||
```gdscript
|
||||
# Should work the same but with new structure
|
||||
# Just ensure it's using the right fields
|
||||
```
|
||||
|
||||
### In `_create_action_from_node`:
|
||||
|
||||
```gdscript
|
||||
# This method is mostly correct but may need parameter updates
|
||||
# Ensure all parameter access matches the new structure
|
||||
```
|
||||
|
||||
## New Method Structure
|
||||
|
||||
The refactored CutsceneGenerator should have:
|
||||
|
||||
1. `generate_cutscene(cutscene
|
||||
Reference in New Issue
Block a user