rojo icon indicating copy to clipboard operation
rojo copied to clipboard

Support Ref properties in .meta and .model files via relative string paths.

Open nightcycle opened this issue 7 months ago • 2 comments

Currently the vast majority of times I'm required to store a roblox instance as a binary, it's because of ref properties. I would prefer to keep everything as text, which would require support for ref properties.

Proposal

Implicitly:

{
  "className": "ObjectValue",
  "properties": {
    "Value": "./Path/To/Instance",
  }
}

Explicitly:

{
  "className": "ObjectValue",
  "properties": {
    "Value": {
      "Ref": "./Path/To/Instance"
    },
  }
}

I could imagine there might be some pain points in implementation as properties are applied when the instance is constructed, where an external instance might not have been constructed yet. This would likely need to be implemented as a pass at the end of the sync / build sequence.

I'm open to doing it myself, but I would want confirmation that this matches the goal of the project before creating a pull request. Let me know what works best, thank you!

nightcycle avatar May 01 '25 19:05 nightcycle

This runs into some trouble because there might be Instances with shared paths. As a trivial example, copy and paste literally any model in Roblox.

It's possible in .rbxm files too, which complicated building for the same reason.

What would your preference be if there's a conflict? I'm leaning towards an error, but something more complicated like "if there's one managed by Rojo, use that" for syncing.

Dekkonot avatar May 03 '25 20:05 Dekkonot

Mhm, the duplicate path stuff would certainly be a headache. I definitely prefer things failing loudly than secretly switching to a different reference.

It also as an error would be a passive push for people to better structure their projects in more standardized string-path compatible ways. Much of the rojo ecosystem (for example, stylua, darklua, even rojo for project config) relies on distinct string paths - the sooner devs modify their workflow to fit that convention, the easier their life will be. This just becomes a passive push for it.

nightcycle avatar May 03 '25 20:05 nightcycle