Skip to content
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

Support setting referent properties via attributes #843

Merged
merged 36 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2e1cf8c
Introduce RojoRef as a concept
Dekkonot Jan 29, 2024
2a925a1
Support RojoRef in InstanceMetadata
Dekkonot Jan 29, 2024
34c46c2
Support specifying RojoRefs in JSON files
Dekkonot Jan 29, 2024
0a5c34f
Use Arc<str> instead of Arc<String>
Dekkonot Jan 29, 2024
0d7c138
Track specified IDs as they're added to a RojoTree
Dekkonot Jan 29, 2024
32a3340
Add basic attribute-based ref support
Dekkonot Jan 29, 2024
3b9feb8
Update test snapshots
Dekkonot Jan 29, 2024
08ecfb8
Fix patch_apply implementation for refs
Dekkonot Jan 29, 2024
0c407fa
Add some QOL info to web UI
Dekkonot Jan 29, 2024
c6a65a7
Add test for attribute ref functionality
Dekkonot Jan 29, 2024
9d20755
Check for duplicates IDs and ignore null IDs
Dekkonot Jan 29, 2024
f70cc72
Implement IntoIterator for MultiMap
Dekkonot Jan 29, 2024
c185203
Defer the ref property rewrites until the end of the patch process
Dekkonot Jan 29, 2024
4aa47d4
Polish test + add snapshots
Dekkonot Jan 29, 2024
935c7fb
Actually use and track ID specified with Attributes
Dekkonot Jan 30, 2024
62349b1
Correctly update specified_ids when removing or update metadata
Dekkonot Jan 30, 2024
eb8286e
Add test for ref properties when a file is removed
Dekkonot Jan 30, 2024
4c93daa
Use Option<RojoRef> instead of RojoRef itself being Option
Dekkonot Jan 30, 2024
472ffd2
Revert all changes made to patch_compute.rs
Dekkonot Jan 30, 2024
a0b02c5
Add basic changelog entry
Dekkonot Jan 31, 2024
6cabe8e
Merge branch 'master' into ref-properties-upstream
Dekkonot Jan 31, 2024
b2b3c46
Swap to using Vec<u8> as backing for RojoRef, accept BinaryString ref…
Dekkonot Feb 1, 2024
14be5c4
Implement Display for RojoRef, use it for warning prints
Dekkonot Feb 1, 2024
7918cac
Check for duplicate IDs in remove_metadata and update_metadata
Dekkonot Feb 5, 2024
5d56919
Revert "Swap to using Vec<u8> as backing for RojoRef, accept BinarySt…
Dekkonot Feb 5, 2024
2f1c759
Fix implementation of Display for RojoRef
Dekkonot Feb 5, 2024
e531e6b
Accept BinaryString attributes but only if they're utf-8
Dekkonot Feb 5, 2024
c85d600
Make error message for pointer attributes better
Dekkonot Feb 5, 2024
d77eecc
Merge branch 'master' into ref-properties-upstream
Dekkonot Feb 5, 2024
bccec61
Use MultiMap for RojoRef -> Ref tracking (#4)
kennethloeffler Feb 6, 2024
e694a3d
Update documentation for specified_id_to_refs
Dekkonot Feb 6, 2024
05f181e
Add documentation for get_specified_id
Dekkonot Feb 6, 2024
008b887
Remove a single extra space in a comment
Dekkonot Feb 8, 2024
2c25ca6
Merge branch 'master' into ref-properties-upstream
Dekkonot Feb 12, 2024
6f23ea0
Merge branch 'master' into ref-properties-upstream
Dekkonot Jun 20, 2024
cc57ffd
Update test snapshot after merge
Dekkonot Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Rojo Changelog

## Unreleased Changes
* Projects may now manually link `Ref` properties together using `Attributes`. ([#843])
This has two parts: using `id` or `$id` in JSON files or a `Rojo_Target` attribute, an Instance
is given an ID. Then, that ID may be used elsewhere in the project to point to an Instance
using an attribute named `Rojo_Target_PROP_NAME`, where `PROP_NAME` is the name of a property.

As an example, here is a `model.json` for an ObjectValue that refers to itself:

```json
{
"id": "arbitrary string",
"attributes": {
"Rojo_Target_Value": "arbitrary string"
}
}
```

This is a very rough implementation and the usage will become more ergonomic
over time.

* Updated Undo/Redo history to be more robust ([#915])
* Fixed removing trailing newlines ([#903])
* Added Never option to Confirmation ([#893])
Expand Down Expand Up @@ -61,6 +80,7 @@
[#834]: https://github.com/rojo-rbx/rojo/pull/834
[#838]: https://github.com/rojo-rbx/rojo/pull/838
[#840]: https://github.com/rojo-rbx/rojo/pull/840
[#843]: https://github.com/rojo-rbx/rojo/pull/843
[#883]: https://github.com/rojo-rbx/rojo/pull/883
[#886]: https://github.com/rojo-rbx/rojo/pull/886
[#893]: https://github.com/rojo-rbx/rojo/pull/893
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-10:
Children: []
ClassName: ObjectValue
Id: id-10
Metadata:
ignoreUnknownInstances: true
Name: ProjectPointer
Parent: id-9
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: project target
Value:
Ref: id-9
id-11:
Children: []
ClassName: Model
Id: id-11
Metadata:
ignoreUnknownInstances: false
Name: ProjectPointer
Parent: id-7
Properties:
Attributes:
Attributes:
Rojo_Target_PrimaryPart:
String: project target
PrimaryPart:
Ref: id-9
id-2:
Children:
- id-3
ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: true
Name: ref_properties
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children:
- id-4
- id-5
- id-7
- id-9
ClassName: Workspace
Id: id-3
Metadata:
ignoreUnknownInstances: true
Name: Workspace
Parent: id-2
Properties: {}
id-4:
Children: []
ClassName: ObjectValue
Id: id-4
Metadata:
ignoreUnknownInstances: true
Name: CrossFormatPointer
Parent: id-3
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: folder target
Value:
Ref: id-5
id-5:
Children:
- id-6
ClassName: Folder
Id: id-5
Metadata:
ignoreUnknownInstances: false
Name: FolderTarget
Parent: id-3
Properties: {}
id-6:
Children: []
ClassName: ObjectValue
Id: id-6
Metadata:
ignoreUnknownInstances: false
Name: FolderPointer
Parent: id-5
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: folder target
Value:
Ref: id-5
id-7:
Children:
- id-8
- id-11
ClassName: Folder
Id: id-7
Metadata:
ignoreUnknownInstances: false
Name: ModelTarget
Parent: id-3
Properties:
Attributes:
Attributes:
Rojo_Id:
String: model target 2
id-8:
Children: []
ClassName: Model
Id: id-8
Metadata:
ignoreUnknownInstances: false
Name: ModelPointer
Parent: id-7
Properties:
Attributes:
Attributes:
Rojo_Target_PrimaryPart:
String: model target 2
PrimaryPart:
Ref: id-7
id-9:
Children:
- id-10
ClassName: Folder
Id: id-9
Metadata:
ignoreUnknownInstances: true
Name: ProjectTarget
Parent: id-3
Properties: {}
messageCursor: 1
sessionId: id-1

Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-10:
Children: []
ClassName: ObjectValue
Id: id-10
Metadata:
ignoreUnknownInstances: true
Name: ProjectPointer
Parent: id-9
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: project target
Value:
Ref: id-9
id-2:
Children:
- id-3
ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: true
Name: ref_properties
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children:
- id-4
- id-5
- id-7
- id-9
ClassName: Workspace
Id: id-3
Metadata:
ignoreUnknownInstances: true
Name: Workspace
Parent: id-2
Properties: {}
id-4:
Children: []
ClassName: ObjectValue
Id: id-4
Metadata:
ignoreUnknownInstances: true
Name: CrossFormatPointer
Parent: id-3
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: folder target
Value:
Ref: id-5
id-5:
Children:
- id-6
ClassName: Folder
Id: id-5
Metadata:
ignoreUnknownInstances: false
Name: FolderTarget
Parent: id-3
Properties: {}
id-6:
Children: []
ClassName: ObjectValue
Id: id-6
Metadata:
ignoreUnknownInstances: false
Name: FolderPointer
Parent: id-5
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: folder target
Value:
Ref: id-5
id-7:
Children:
- id-8
ClassName: Folder
Id: id-7
Metadata:
ignoreUnknownInstances: false
Name: ModelTarget
Parent: id-3
Properties: {}
id-8:
Children: []
ClassName: Model
Id: id-8
Metadata:
ignoreUnknownInstances: false
Name: ModelPointer
Parent: id-7
Properties:
Attributes:
Attributes:
Rojo_Target_PrimaryPart:
String: model target
PrimaryPart:
Ref: id-7
id-9:
Children:
- id-10
ClassName: Folder
Id: id-9
Metadata:
ignoreUnknownInstances: true
Name: ProjectTarget
Parent: id-3
Properties: {}
messageCursor: 0
sessionId: id-1

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tests/tests/serve.rs
expression: redactions.redacted_yaml(info)
---
expectedPlaceIds: ~
gameId: ~
placeId: ~
projectName: ref_properties
protocolVersion: 4
rootInstanceId: id-2
serverVersion: "[server-version]"
sessionId: id-1

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children:
- id-3
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: ref_properties_remove
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children: []
ClassName: ObjectValue
Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: pointer
Parent: id-2
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: test pointer
Value:
Ref: id-4
messageCursor: 1
sessionId: id-1

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children:
- id-3
- id-4
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: ref_properties_remove
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children: []
ClassName: ObjectValue
Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: pointer
Parent: id-2
Properties:
Attributes:
Attributes:
Rojo_Target_Value:
String: test pointer
Value:
Ref: id-4
id-4:
Children: []
ClassName: ObjectValue
Id: id-4
Metadata:
ignoreUnknownInstances: false
Name: target
Parent: id-2
Properties:
Attributes:
Attributes:
Rojo_Id:
String: test pointer
messageCursor: 0
sessionId: id-1

Loading
Loading