-
Notifications
You must be signed in to change notification settings - Fork 75
Animation Frame Packer and Unpacking. #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Introduces functionality to export animation frames as packed JSON/PNG sprite sheets and import them back, including new context menu items and dialogs for options. Adds supporting classes for JSON structure in PackerClasses.cs and integrates handlers in AnimationListControl for packing and unpacking frames.
Refactored the animation frame import process to prompt the user once for overwrite/append behavior across all directions, improving usability. Added palette building and region extraction helpers for more efficient and accurate color mapping. Enhanced error handling and memory management during large imports.
Introduces a 'One row per direction' checkbox to the PackOptionsForm, allowing packed sprite sheets to organize frames with each direction on a separate row. Updates packing logic to support this option and outputs a text file with row mapping when enabled.
Introduces a 'FrameSpacing' option in the animation packing dialog, allowing users to specify spacing between frames when exporting packed animations. Updates layout logic to respect the spacing value, and adds a UI slider for user control.
Introduces an 'Export all animations' checkbox to the pack options form, allowing users to export all actions for the selected body. Refactors export logic to support batch exporting and updates UI layout to accommodate the new option.
Introduces a 'Bulk Unpack Frames' menu item and handler to allow importing multiple animation JSON files at once. Refactors unpack logic into a reusable method and adds overwrite/append options for bulk imports, improving workflow for batch animation imports.
Added a check to skip processing animation directions greater than 4 in AnimationListControl. This prevents handling unsupported or invalid direction values.
Moved PackedOutput, PackedMeta, PackedFrameEntry, Rect, PointStruct, and SizeStruct classes from AnimationListControl.cs to UoFiddler.Controls/Classes for reuse and better organization. Deleted PackerClasses.cs, consolidating all packed animation-related data structures into the new shared classes. Adjusted button layout in AnimationListControl for improved UI.
Introduces an 'Import Animation' menu item to the context menu in AnimationListControl, allowing users to import animations via unpacking frames. Also refactors the export animation submenu to remove unpack options, consolidating import-related actions under the new menu item.
The PackOptionsForm class was relocated from AnimationListControl.cs to its own file, PackOptionsForm.cs, to improve code organization and maintain compilation visibility.
Introduced AnimationDebugHelper to create a debug image with frame bounds and center crosshairs. Updated AnimationListControl to generate and save this debug image alongside the packed sprite and JSON output.
Introduces export and import functionality for packed item ranges in ItemsControl, including new classes for packed item metadata and output, a range input form, and UI integration. Users can export selected item ranges to a sprite sheet and JSON, and import them back, facilitating easier sharing and management of item graphics.
AsYlum-
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Minor changes needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be reverted. Formatting changes in unrelated file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this to Forms directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
Animation Packing & Unpacking System
Overview
This PR introduces a robust system for exporting (packing) and importing (unpacking) animations in UOFiddler. It allows users to easily transfer animation data between UOFiddler and external tools by converting complex UO frame structures into standard PNG sprite sheets with accompanying JSON metadata.
Key Features
1. Pack Frames (Export)
anim_{body}_{action}.png(sprite sheet) andanim_{body}_{action}.json(metadata).Index(Frame order)Centerpoint (The "pivot" or "anchor" of the frame, essential for correct alignment in-game)2. Unpack Frames (Import)
Centerpoints for every frame.3. Bulk Unpack (Batch Import)
*.jsonfiles.anim_{body}_{action}.json) to automatically map data to the correct Body and Action IDs.Technical Implementation
How to Test