cables-gl / cables_docs

cables documentation docs.cables.gl
https://cables.gl/docs/docs
33 stars 14 forks source link

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

Open 60-hz opened 2 weeks ago

60-hz commented 2 weeks 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 2 weeks 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 2 weeks 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 3 days 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