Function to create a row per input with columns for each metadata attribute as applicable.
42 {
43
44
45
46 let boxStyle = "width: 100%; font-size: 12px; border:solid thin lightskyblue; background-color: #000000"
47
48
49 let row = document.createElement("div");
50 row.classList.add("row", "row_hover", "pb-2", "pt-2", 'g-1');
51
52
53 let nameCol = document.createElement("div");
54 nameCol.classList.add("col-sm-2", "text-start");
55 let nameLabel = document.createElement("label");
56 nameLabel.textContent = data.name;
57 nameLabel.classList.add("form-label");
58 nameCol.appendChild(nameLabel);
59 row.appendChild(nameCol);
60
61
62 let typeCol = document.createElement("div");
63 typeCol.classList.add("col-sm-2");
64 let typeLabel = document.createElement("label");
65 typeLabel.textContent = data.type;
66 typeLabel.classList.add("form-label");
67 typeCol.setAttribute("data-type", data.type);
68 typeCol.appendChild(typeLabel);
69 row.appendChild(typeCol);
70
71
72 let uinameCol = document.createElement("div");
73 uinameCol.classList.add("col-sm");
74 let uinameInput = document.createElement("input");
75 uinameInput.type = "text";
76 uinameInput.style = boxStyle;
77 uinameInput.classList.add("form-control", "form-control-sm");
78 uinameInput.value = data.uiname || "";
79 uinameInput.setAttribute("data-ui-name", "true");
80 uinameCol.appendChild(uinameInput);
81 row.appendChild(uinameCol);
82
83
84 let uifolderCol = document.createElement("div");
85 uifolderCol.classList.add("col-sm");
86 let uifolderInput = document.createElement("input");
87 uifolderInput.type = "text";
88 uifolderInput.style = boxStyle;
89 uifolderInput.classList.add("form-control", "form-control-sm");
90 uifolderInput.value = data.uifolder || ""
91 uifolderInput.setAttribute("data-ui-group", "true");
92 uifolderCol.appendChild(uifolderInput);
93 row.appendChild(uifolderCol);
94
95
96
97 let ui_items = [data.uimin, data.uimax, data.uistep, data.uisoftmin, data.uisoftmax];
98 let ui_item_ids = ['data-ui-min', 'data-ui-max', 'data-ui-step', 'data-ui-softmin', 'data-ui-softmax'];
99
100 for (let u = 0; u < 5; u++) {
101
102
103 let inputCol = document.createElement("div");
104 inputCol.classList.add("col-sm");
105
106 let ui_item = ui_items[u];
107 let ui_item_id = ui_item_ids[u];
108 let ui_default = 0;
109 if (u == 1 || u == 4) {
110 if (data.type === 'integer')
111 ui_default = 10
112 else
113 ui_default = 1;
114 }
115 else if (u == 2) {
116 if (data.type === 'integer')
117 ui_default = 1
118 else
119 ui_default = 0.01;
120 }
121
122 if (data.type === "float" || data.type == "integer") {
123
124 let input = document.createElement("input");
125 input.setAttribute(ui_item_id, "true");
126 input.type = "number";
127 input.style = boxStyle;
128 input.classList.add("form-control", "form-control-sm");
129 if (ui_item != undefined)
130 input.value = ui_item
131 else
132 input.value = (auto_assign_default ? ui_default : null);
133 inputCol.appendChild(input);
134 }
135 else if (data.type === "vector2" || data.type == "vector3" || data.type == "vector4") {
136 let count = 0;
137 if (data.type === "vector2") {
138 count = 2;
139 }
140 else if (data.type === "vector3") {
141 count = 3;
142 }
143 else if (data.type === "vector4") {
144 count = 4;
145 }
146
147
148 let container = document.createElement("div");
149 container.classList.add("container", "p-2", "rounded-2");
150
151 container.style.border = "1px solid #f0f0f0";
152
153 for (let i = 0; i < count; i++) {
154
155 let input = document.createElement("input");
156 input.type = "number";
157 input.style = boxStyle;
158 input.classList.add("form-control", "form-control-sm", "me-2", "mb-2");
159 if (ui_item && ui_item[i] != undefined)
160 {
161
162 input.value = ui_item[i]
163 }
164 else
165 {
166
167 input.value = (auto_assign_default ? ui_default : null);
168 }
169 input.setAttribute(ui_item_id, "true");
170
171 container.appendChild(input);
172 }
173 inputCol.appendChild(container);
174 }
175 row.appendChild(inputCol);
176 }
177 return row;
178 }