Skip to content

Commit 4fb75e0

Browse files
authored
Merge pull request #489 from chrisgoringe/dev
1.6.1
2 parents 922a558 + 1210e2c commit 4fb75e0

30 files changed

+1423
-408
lines changed

README.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ There will normally be one controller window created for you. If not, or to add
2323
right click on the background and select "New Controller" from the menu (if it isn't there, check the Controller is active!).
2424

2525
At first, the Controller will be empty. To add nodes to it, right-click on the node and in the Controller Panel menu select "Include this node".
26+
You can also select multiple nodes and add them all at once.
2627

2728
![menu](images/menu.png)
2829

@@ -37,14 +38,19 @@ as a panel with the same title and colour as the node, underneath which are all
3738
If you now edit the values in those widgets, the changes will be reflected in the workflow (and vica versa).
3839
Combo boxes, toggle switches, buttons, and text fields all work just as you would expect.
3940

41+
### Sliders for numeric values
42+
4043
Numeric fields (like width in the image) a represented using an editable slider.
4144
Click on the slider and drag left or right, and the value will change between the minimum and maximum values.
4245
You can also just hover the mouse over the slider and move the value up or down with your mouse scrollwheel.
4346
To enter a precise value, double click and the slider turns into a text entry box where you can type the value you want.
47+
4448
If the minimum and maximum values, or the step size, aren't convenient, shift-click on the slider to change them.
4549
Note that changes made here will be reflected in the actual widget as well, however, if you set a value outside
4650
of the original limits the workflow may fail to validate on the server.
4751

52+
![edit](images/slider-edit.png)
53+
4854
You can change the way the scrollwheel interacts with the sliders, and the keys required to edit the limits, in the main settings.
4955

5056
## Groups and Tabs
@@ -103,16 +109,18 @@ If you have a batch of images, you can click through them on the preview using t
103109

104110
### Mask Editor
105111

106-
ctrl-click on an image in the controller to bring up a context menu, from which you can launch the mask editor.
112+
ctrl-click or right-click on an image in the controller to bring up a context menu, from which you can launch the mask editor.
107113

108114
### Selectively hide widgets
109115

110-
ctrl-click on the title of a nodeblock and you can hide/show specific widgets. Note that hide/show is specific to the controller,
116+
ctrl-click or right-click on the title of a nodeblock and you can hide/show specific widgets. Note that hide/show is specific to the controller,
111117
so you can have the same node showing different widgets on different controllers if you want!
112118

119+
![context](images/nodeblock-context.png)
120+
113121
### Hover and zoom
114122

115-
If the magnifying glass in the top control is active ![image](images/top.png) then when you move you mouse over a node in
123+
If the magnifying glass in the top control is active - ![image](images/top.png) - then when you move you mouse over a node in
116124
the controller it will be highlighted in the workflow, and when you move your mouse over a group tab, the group will
117125
be highlighted.
118126

@@ -157,7 +165,7 @@ There's also a debug setting that I might ask you to use if you report a problem
157165
There is a little drag box at the bottom right of the controller that you can use to resize it.
158166
You can also move it around by dragging the header.
159167

160-
## Snapping
168+
### Snapping
161169

162170
Controllers will snap to each other and move around together. To break them apart, move the controller on the right or bottom.
163171

__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "1.5"
1+
VERSION = "1.6.1"
22
WEB_DIRECTORY = "./js"
33

44
NODE_CLASS_MAPPINGS= {}

images/nodeblock-context.png

9.83 KB
Loading

images/slider-edit.png

5.66 KB
Loading

images/top.png

-704 Bytes
Loading

js/combo.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { extension_hiding } from "./utilities.js"
2+
import { open_context_menu, close_context_menu } from "./context_menu.js"
3+
import { WidgetChangeManager } from "./widget_change_manager.js"
4+
5+
export class ExtendedCombo extends HTMLSpanElement {
6+
constructor(choices, target_widget, node) {
7+
super()
8+
this.classList.add('input')
9+
this.classList.add('clickabletext')
10+
this.innerText = extension_hiding(target_widget.value)
11+
this.draggable = false
12+
this.addEventListener('click', (e)=>{
13+
e.stopPropagation()
14+
open_context_menu(e, "", choices, {
15+
className: "dark",
16+
callback: (v)=>{
17+
close_context_menu()
18+
target_widget.value=v;
19+
this.innerText = extension_hiding(v)
20+
target_widget.callback(v, app.canvas, node)
21+
WidgetChangeManager.notify(target_widget)
22+
},
23+
}, node)
24+
})
25+
}
26+
}
27+
28+
customElements.define('extended-combo-widget', ExtendedCombo, {extends: 'span'})

js/constants.js

+32-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
export const VERSION = "1.4.1"
2+
export const VERSION = "1.6.1"
3+
4+
//export const MAXIMUM_UPSTREAM = 4
35

46
export class SettingIds {
57
static KEYBOARD_TOGGLE = "Controller.Display.keyboard"
@@ -10,23 +12,27 @@ export class SettingIds {
1012
static DEBUG_LEVEL = "Controller.Debug.level"
1113
static FONT_SIZE = "Controller.Display.font_size"
1214
static TOOLTIPS = "Controller.Display.tooltips"
15+
static MINIMUM_TAB_WIDTH = "Controller.Display.minimum_tab_width"
1316
static DEFAULT_APPLY_TO_SIMILAR = "Controller.Sliders.default_apply_to_similar"
1417
static SHOW_SCROLLBARS = "Controller.Display.show_scrollbars"
1518
static SHOW_IN_FOCUS_MODE = "Controller.Display.show_in_focus_mode"
19+
static HIDE_EXTENSIONS = "Controller.Display.hide_extensions"
1620
}
1721

1822
export class SettingNames {
1923
static KEYBOARD_TOGGLE = "Toggle controller visibility:"
2024
static FONT_SIZE = "Base font size:"
2125
static CONTROL_AFTER_GENERATE = "Show 'control before/after generate'"
2226
static TOOLTIPS = "Show tooltips"
27+
static MINIMUM_TAB_WIDTH = "Minimum tab width"
2328
static DEFAULT_APPLY_TO_SIMILAR = "Default apply to similar"
2429
static SHOW_IN_FOCUS_MODE = "Show controllers in focus mode"
2530
static SCROLL_MOVES_SLIDERS = "Scrollwheel changes sliders"
2631
static SCROLL_REVERSED = "Scrollwheel reversed for sliders"
2732
static SHOW_SCROLLBARS = "Controller scrollbars"
2833
static EDIT_SLIDERS = "Edit slider limits"
2934
static DEBUG_LEVEL = "Debug level"
35+
static HIDE_EXTENSIONS = "Hide extensions"
3036
}
3137

3238
export class Generic {
@@ -43,46 +49,56 @@ export class Generic {
4349
static D3 = "Verbose"
4450
static SHOW = "Show"
4551
static HIDE = "Hide"
52+
static SHOW_ALL = "[Show all widgets]"
53+
static HIDE_ALL = "[Hide all widgets]"
4654
}
4755

4856
export class Tooltips {
4957
static FONT_SIZE = "All font sizes will be scaled relative to this value"
5058
static CONTROL_AFTER_GENERATE = "Allow the control_after_generate widget to be shown"
5159
static TOOLTIPS = "Refresh controller after changing"
60+
static MINIMUM_TAB_WIDTH = "Minimum width of a tab before switching to stacked layout"
5261
static DEFAULT_APPLY_TO_SIMILAR = "Default setting of 'apply to similar' checkbox"
5362
static SCROLL_REVERSED = "Scroll up to reduce value"
5463
static SHOW_SCROLLBARS = "If off, can still scroll with scrollwheel"
5564
static DEBUG_LEVEL = "Press f12 for js console"
65+
static HIDE_EXTENSIONS = "Hide filename extensions"
5666
}
5767

5868
export class InclusionOptions {
5969
static EXCLUDE = "Don't include this node"
6070
static INCLUDE = "Include this node"
6171
static ADVANCED = "Include this node as advanced control"
62-
static EXCLUDES = InclusionOptions.EXCLUDE.replace('this node', 'these nodes')
72+
static FAVORITE = "Include this node as favorite"
73+
static EXCLUDES = InclusionOptions.EXCLUDE.replace('this node', 'these nodes')
6374
static INCLUDES = InclusionOptions.INCLUDE.replace('this node', 'these nodes')
6475
static ADVANCEDS = InclusionOptions.ADVANCED.replace('this node', 'these nodes')
76+
static FAVORITES = InclusionOptions.FAVORITE.replace('this node', 'these nodes')
6577
}
6678

6779
export class Timings { // ms
6880
static GENERIC_SHORT_DELAY = 20
6981
static GENERIC_LONGER_DELAY = 1000
7082
static GENERIC_MUCH_LONGER_DELAY = 5000
71-
static PERIODIC_CHECK = 1000
83+
static PERIODIC_CHECK = 1000 // on_change 'tick'
7284
static DRAG_PAUSE_OVER_BACKGROUND = 500
7385
static SLIDER_ACTIVE_DELAY = 300
7486
static UPDATE_EXCEPTION_WAITTIME = 10000
7587
static PAUSE_STACK_WAIT = 101
7688
static ACTIVE_ELEMENT_DELAY = 234
77-
static ON_CHANGE_GAP = 200
78-
static ON_WINDOW_RESIZE_GAP = 27
79-
static GROUP_CHANGE_DELAY = 10
89+
static ON_CHANGE_GAP = 200 // must be less than PERIODIC_CHECK. How long to wait for gap in on_change calls
8090
static ALLOW_LAYOUT = 1000
8191
}
8292

8393
export class Colors {
8494
static DARK_BACKGROUND = '#222222'
8595
static MENU_HIGHLIGHT = '#C08080'
96+
static FAVORITES_FG = '#CC4444'
97+
static FAVORITES_GROUP = '#223322'
98+
static FOREGROUND = '#FFFFFF'
99+
static OPTIONS = ['#FFFFFF', '#000000']
100+
static UNSELECTED_DARKEN = 0.4
101+
static HEADER_DARKEN = 0.666
86102
}
87103

88104
export class Pixels {
@@ -93,6 +109,7 @@ export class Pixels {
93109
export class Texts {
94110
static ALL_GROUPS = "All"
95111
static UNGROUPED = "Ungrouped"
112+
static FAVORITES = "❤"
96113
static CONTEXT_MENU = "Controller Panel"
97114
static MODE_TOOLTIP = {
98115
0 : "Click to bypass</br>ctrl&#8209;click to mute",
@@ -103,6 +120,15 @@ export class Texts {
103120
static REMOVE = "Remove from controllers"
104121
static EDIT_WV = "Edit widget visibility"
105122
static IMAGE_WIDGET_NAME = "image viewer"
123+
static UNCONNECTED = "Unconnected Input"
124+
static ACCEPT_UPSTREAM = "Show upstream images"
125+
static REJECT_UPSTREAM = "Only show my images"
126+
static STACK_ALWAYS = "Only show active tab"
127+
static STACK_IF_NEEDED = "Show all tabs if space allows"
128+
}
129+
130+
export const DisplayNames = {
131+
"&#x2764;" : "&#x2764; Favorites"
106132
}
107133

108134
export const BASE_PATH = "extensions/cg-controller"

js/context_menu.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { app } from "../../scripts/app.js"
2+
import { Timings } from "./constants.js"
23

34
var context_menu
5+
var closable = false
46

57
function autoclose(e) {
68
if (context_menu?.root?.contains(e.target)) return
@@ -9,17 +11,30 @@ function autoclose(e) {
911

1012
export function close_context_menu() {
1113
context_menu?.close()
14+
if (closable) {
15+
Array.from(document.getElementsByClassName('litecontextmenu')).forEach((e)=>e.remove())
16+
}
17+
closable = false
1218
context_menu = null
1319
}
1420

15-
function _open_context_menu(e, title, values) {
21+
export function register_closable() {
22+
closable = true
23+
}
24+
25+
function _open_context_menu(e, title, values, opts) {
1626
close_context_menu()
27+
1728
const options = {
1829
"title":title,
1930
"event":e,
2031
}
32+
if (opts) Object.assign(options, opts)
2133
context_menu = LiteGraph.ContextMenu(values, options, app.canvas.getCanvasWindow())
2234
}
23-
export function open_context_menu(e, title, values) { setTimeout(_open_context_menu, 10, e, title, values) }
35+
export function open_context_menu(e, title, values, opts, node) {
36+
if (node) app.canvas.current_node = node
37+
setTimeout(_open_context_menu, Timings.GENERIC_SHORT_DELAY, e, title, values, opts)
38+
}
2439

2540
window.addEventListener('click',autoclose)

0 commit comments

Comments
 (0)