Refactor reference handling in Rojo system to prioritize path-based attributes

- Updated attribute prefixes to use REF_PATH_ATTRIBUTE_PREFIX for path-based references.
- Enhanced PatchApplyContext and related functions to support path-based linking, falling back to ID-based references when necessary.
- Implemented cleanup for legacy attributes to ensure they do not persist in the live game.
- Improved error handling and logging for reference resolution processes.
This commit is contained in:
Joe 2026-01-20 21:34:37 -06:00
parent 3cf452cb7b
commit 196cf7aed7
5 changed files with 275 additions and 165 deletions

View file

@ -2,11 +2,14 @@ use std::{fmt, sync::Arc};
use serde::{Deserialize, Serialize};
/// Legacy: ID attribute on target instances (kept for backwards compatibility)
pub const REF_ID_ATTRIBUTE_NAME: &str = "Rojo_Id";
/// Legacy: Pointer attribute prefix using IDs (kept for backwards compatibility)
pub const REF_POINTER_ATTRIBUTE_PREFIX: &str = "Rojo_Target_";
/// Prefix for attributes storing paths to external references (instances outside
/// the sync tree, like SoundGroups in SoundService).
pub const REF_EXTERNAL_ATTRIBUTE_PREFIX: &str = "Rojo_External_";
/// Prefix for path-based reference attributes. This is the preferred system
/// that stores the path to the target instance (e.g., "SoundService/Effects").
/// No modification to the target instance is needed.
pub const REF_PATH_ATTRIBUTE_PREFIX: &str = "Rojo_Ref_";
// TODO add an internment strategy for RojoRefs
// Something like what rbx-dom does for SharedStrings probably works