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

Compound Value XML Export #129

Closed
Tracked by #64
AsherGlick opened this issue Mar 1, 2023 · 1 comment
Closed
Tracked by #64

Compound Value XML Export #129

AsherGlick opened this issue Mar 1, 2023 · 1 comment
Labels
discussion A discussion around a feature or fix

Comments

@AsherGlick
Copy link
Owner

AsherGlick commented Mar 1, 2023

Idea for CompoundValue and CustomCompoundValue

Instead of having an implicit "if the child is exported it is not going to be exported in the parent, as discussed offline, we just explicitly define how the parent export works as a combination of its children.

xml_parent_export: "{arg1},{arg2},{arg3}"
xml_child_export: ["arg4", "arg5", "arg6"]

For CompoundValues this would be fully automated. For CustomCompoundValues this would be more bespoke, in that we could not automatically validate that the parent or child were being exported properly without parsing the c++ code, but it would setup the structure needed for the custom c++ code to write parent or child values, which is something.

Color

xml_parent_export: "{Red},{Green},{Blue}"
xml_children_export: ["Alpha"]
<POI Color="red,green,blue" Alpha="alpha" />

Position

xml_parent_export: ""
xml_children_export: ["XPos","YPos","ZPos"]
<POI XPos="xpos" YPos="ypos" ZPos="zpos" />

Position with QPos for 4 dimensional gaming

xml_parent_export: "{XPos},{YPoz},{ZPos}"
xml_children_export: ["QPos"]
<POI Position="xpos,ypos,zpos" QPos="qpos"

Euler Rotation

xml_parent_export: "{XRot},{YRot},{ZRot}"
xml_children_export: []
<Poi Rotation="xrot,yrot,zrot" />

Future Possibilities

A 3D Box with 3 dimentions (custom input output delimiters)

# something to know how to import compound values that are not comma delimited
xml_parent_import_patterns: [
    "{width}x{height}x{depth}",
    "{width},{height},{depth}"
]
xml_parent_export: "{width}x{height}x{depth}"
xml_children_export: []

A Datetime (partial compound values)

xml_parent_import_patterns: [
    "{hour}:{minute}:{second} {year}/{month}/{day}"
]

xml_parent_export: ""
xml_children_export: {
    "Date": "{year}/{month}/{day}"
    "Time": "{hour}:{minute}:{second}"
}

Even though this is really complicated and we might want to relegate it to a custom class, if we wanted to support this there would still need to be something that could define the input/output for compound custom classes

Lets ignore that for now and just require that the xml_parent_export to only contain tokens of the children separated by a single comma.

Validation

With this we can do some rudimentary validation that all of the children are being serialized properly to xml, while making it obvious how the serialization occurs from the documentation. Instead of the "not immediately obvious but clear once you know" solution of removing any specific children exports from the parent export.

@AsherGlick AsherGlick added the discussion A discussion around a feature or fix label Mar 1, 2023
This was referenced Mar 1, 2023
This was referenced Mar 22, 2023
@AsherGlick
Copy link
Owner Author

Closed with #140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion A discussion around a feature or fix
Projects
None yet
Development

No branches or pull requests

1 participant