cables-gl / cables_docs

cables documentation docs.cables.gl
https://cables.gl/docs/docs
45 stars 16 forks source link

Presets Op : add Op's "text" fields #756

Closed 60-hz closed 5 months ago

60-hz commented 6 months ago

Would be very handy to include the Op "text" entries when creating a preset and not only "id" & "objName" which are less meaningful when we want to edit json external.

steam0r commented 6 months ago

hm, what do you mean by "text" and how are you generating the json externally? in general objName is not a good thing to rely on, since we sometimes rename or deprecate ops. which then would break your preset.

60-hz commented 6 months ago

When working on complex projects, it's nice to store variables in human like format like json. Preset op in sidebar is handy because it create a string that can be parsed with all the program variables. But if I want to edit manually this file, the names of my SideBar's parameters (fields "text" in cables, for ex: "Background Opacity" etc...) are not present so it's difficult to edit it externally.

Here is a sample of my preset formated with Pretty JSON addon in Sublime:

"ops":
[
    {
        "id": "id861618897",
        "objName": "Ops.Sidebar.SideBarSwitch",
        "ports":
        {
            "Index": 0
        }
    },
    {
        "id": "id58824562",
        "objName": "Ops.Sidebar.Slider_v3",
        "ports":
        {
            "Result": 1
        }
    },
    {
        "id": "id-1146164907",
        "objName": "Ops.Sidebar.Toggle_v3",
        "ports":
        {
            "Value": 0
        }
    },
    {
        "id": "id1664347139",
        "objName": "Ops.Sidebar.DropDown_v2",
        "ports":
        {
            "Index": 2
        }
    },
steam0r commented 5 months ago

i pushed a small change on dev.cables.gl that will add text/title/label to the json in the preset. this is ONLY added for orientation purposes and not used in deserialize, changing the title externally does nothing.

this is the least-breaking change i can make, i hope this helps a bit to give more orientation when manually working with this data

steam0r commented 5 months ago

we changed this to contain the title of the op, not the textfield, this is a more stable solution. if you need to distinguish the ops in the preset json, change the title of the op.

Bildschirmfoto 2024-06-03 um 10 30 04