Skip to content

Conversation

@jakubjezek001
Copy link
Member

@jakubjezek001 jakubjezek001 commented Dec 18, 2025

Changelog Description

This enhancement enables Flame to publish clips without linked media by implementing on-demand media rendering. Previously, clips with unlinked segments failed during the publishing workflow. The system now detects missing media paths and automatically renders the segment content using configurable export presets, allowing seamless publishing of both linked and unlinked media types. This resolves workflow bottlenecks where artists need to publish segments that exist only in Flame's timeline without source media.

The settings schema has been restructured for improved clarity, separating missing media handling, thumbnail generation, and additional representation exports into distinct configuration sections. This modular approach provides better control over export pipelines and makes preset management more intuitive.

Links:

Additional info

Core Changes:

The extract_product_resources.py plugin now follows a detection-and-render pattern:

  1. Clip Data Extraction - The new get_clip_data() method centralizes all clip attribute extraction, returning a comprehensive dictionary containing segment metadata, frame ranges, handles, and retiming information. This data structure is reused across all export preset processors.

  2. Missing Media Detection - When clip_data["clip_path"] is None, the plugin automatically triggers missing_media_link_export_preset_process(), which uses the new convert_unlinked_segment_to_clip() method. This method:

    • Exports the unlinked segment to a temporary file using Flame's PyExporter
    • Imports the rendered result back as a PyClip object
    • Updates clip_data["clip_path"] with the rendered media path
  3. Modular Preset Processing - Three specialized processors handle different export scenarios:

    • missing_media_link_export_preset_process() - Renders unlinked segments
    • thumbnail_preset_process() - Generates thumbnail representations
    • additional_representation_export_process() - Handles custom export presets
  4. Settings Schema Refactor - Migrated from flat export_presets_mapping list to nested structure:

    • missing_media_link_export_preset - Dedicated config for unlinked media rendering
    • thumbnail_preset - Isolated thumbnail generation settings
    • additional_representation_export - Contains legacy export presets mapping

A conversion function _convert_collect_shots_plugins_1_3_1() ensures backward compatibility with existing studio configurations.

Technical Implementation:

The refactored code introduces several helper methods that improve maintainability:

  • _process_preset_export() - Unified export logic handling both linked and unlinked clips
  • _process_exported_files() - Normalizes file discovery and nested folder handling
  • _create_representation_data() - Standardizes representation dictionary construction
  • _get_imageio_colorspace() - Extracts and remaps colorspace information

Error handling now validates clip data availability early in the process, raising PublishError when segment attributes cannot be retrieved. The clipData is now stored on the instance during collection, eliminating redundant API calls to Flame during extraction.

Testing notes:

  1. Unlinked Media Test:

    • Create a new sequence in Flame
    • Add a segment without linking to media (use Flame's internal effects/generators)
    • Publish the sequence through AYON
    • Verify the unlinked segment renders successfully and publishes with the configured preset
  2. Linked Media Test:

    • Import media into Flame and create a timeline
    • Publish the sequence
    • Confirm the workflow remains unchanged and uses the original linked media path
  3. Settings Validation:

    • Open AYON Studio Settings > Flame > Publish Plugins > Extract Product Resources
    • Verify three distinct configuration sections are present
    • Modify the missing_media_link_export_preset XML preset and colorspace
    • Test that settings changes affect the rendered output
  4. Backward Compatibility:

    • Load an existing project with legacy settings
    • Verify the conversion function migrates old export_presets_mapping correctly
    • Confirm publishing workflows continue without configuration reset

Restructures ExtractProductResources settings to separate missing media
link export presets from additional representation exports. Includes
conversion function to migrate legacy settings from version 1.3.0 to the
new nested structure under additional_representation_export.
Reorganize plugin to use dedicated setting attributes instead of generic
lists. Split processing into separate methods for missing media links,
thumbnails, and additional representations. Rename 'active' field to
'enabled' in export presets and move thumbnail configuration from
default_presets to dedicated thumbnail_preset setting.
Implement early return when thumbnail preset is disabled or not set. Add
placeholder for thumbnail generation logic that should be refactored
from additional_representation_export_process.
Refactor `process` method to extract all clip-related data into a
separate `get_clip_data` method that returns a dictionary. Update all
processing methods to accept and use this shared clip data, eliminating
duplicate data extraction code.
Only render missing media when clip path is not present, and update
clip_data with the result of the rendering process.
Extract preset processing logic into separate method and simplify preset
configuration handling. Remove export_presets from clip_data and process
presets directly from settings. Add type hints and improve import
ordering. Mark clip abstraction task as complete.
- Replace .format() calls with f-strings for regular strings
- Use %-style formatting for logging statements (best practice)
- Collapse multi-line string formatting for readability
- Simplify docstrings by removing unnecessary blank lines
- Change elif to or for cleaner conditional logic
- Add comprehensive type hints and docstrings to get_clip_data method
- Document return dictionary structure with all keys and types
- Check 'enabled' flag instead of 'active' in preset filtering
- Remove unused 'activated_preset' variable from _should_skip
- Add Raises section to _process_preset_export docstring
- Reformat _process_preset_export signature for readability
- Remove redundant local variable extractions in export methods
Replace os.path operations with pathlib.Path equivalents for more
idiomatic Python. Add existence check when listing directory contents
and use mkdir with exist_ok flag for safer directory creation.
Move clip data retrieval to collect_shots plugin and cache it in
instance data, eliminating redundant API calls in downstream plugins.
Consolidate staging directory creation and improve file handling logic
for export presets.
Refactors exported file processing code from `_process_preset_export`
into a new `_process_exported_files` method to improve code organization
and readability. Also fixes a syntax error where a colon was missing
after an if statement.
Extract extension from preset config at the start of processing rather
than passing entire preset_config to _process_exported_files. Add safety
checks for optional preset fields and validate frame range data exists
before adding to representation.
The representation data was being created but not added to the
instance's representations list, causing it to be lost.
- Use correct thumbnail_preset instead of
  missing_media_link_export_preset
- Extract segment from clip_data for unlinked media handling
- Refactor colorspace logic into _get_imageio_colorspace method
- Add convert_unlinked_segment_to_clip to handle segments without linked
  media by exporting and re-importing them
- Only import clip when clip_path is available
@jakubjezek001 jakubjezek001 changed the title Add missing media export preset to settings schema Enable on-demand rendering for unlinked media segments | YN-0073 Dec 18, 2025
@jakubjezek001 jakubjezek001 self-assigned this Dec 18, 2025
@jakubjezek001 jakubjezek001 added type: enhancement Improvement of existing functionality or minor addition sponsored This is directly sponsored by a client or community member labels Dec 18, 2025
@jakubjezek001 jakubjezek001 changed the title Enable on-demand rendering for unlinked media segments | YN-0073 YN-0073 Enable on-demand rendering for unlinked media segments Dec 18, 2025
Initialize error_message, segment_name, and fpath as empty strings and
populate error_message instead of overwriting segment_name when
validation fails. Separate error messages from segment name in clip data

Initialize separate `error_message` and `segment_name` fields in clip
data dictionary, and populate error messages in the dedicated field
instead of overwriting the segment name.
- Remove the unused import ayon_flame.api as ayfapi
- Merge parent editorial data into instance data earlier in the process
- Remove the duplicate merge block at the end of the method
This ensures parent instance data is available before removing
reviewable source and review data from the instance.
…dering_clips_with_no_linked_media' into enhncement/YN-0073_on_demand_rendering_clips_with_no_linked_media
- Persist parent shot creator attributes as shotCreatorAttrs on the
  collected clip
- Extend shot collection to include creator_attributes
- Use shotCreatorAttrs to supply frameStart, clipIn, and clipOut when
  missing in extraction
Add fallback logic to calculate retiming attributes directly from
segment data when no clip path exists. Unlinked segments lack OTIO
references, so compute speed, handles, and source range using segment's
source_in, source_out, and record_duration values.
- Return and reuse exporting_clip to avoid redundant imports
- Fix unlinked segment conversion using temp library duplication
- Only clear representations if additional presets are enabled
- Use extension directly for representation name consistency
- Add debug logging for instance representations
- Handle missing parsed_comment_attrs gracefully
- Ensure Path objects are used consistently for clip_path
- Convert clip_path to POSIX string format for cross-platform
  compatibility
- Remove deletion of exporting_clip to preserve the clip after export
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YN-0073: Publishing Clip without media source link

2 participants