Page 1 of 1

Switching between Mode Instance/Frame

Posted: 19 Dec 2023, 09:34
by Joost
Hi!

Is there a way to make a keyboard shortcut to toggle between (only) "Mode Instance" and "Mode Frame" On the Light Table?

If not, it's a feature request from me. (And I never use the other two modes, so it would be nice to exclude these from the toggle. Or just a keyboard shortcut to go to "Mode Instance" and "Mode Frame" would also work for me)


Thanks!

Joost

Re: Switching between Mode Instance/Frame

Posted: 19 Dec 2023, 17:14
by Peter Wassink
+1!

it seems there is something possible in george: "tv_lighttablemode ["value" iIndex iOpacity] ... ["interval" "instance"|"image"|"bookmark"|"imagemark"] ["imagemarkcolor" iIndex]...."

but i don't know how to create a script for that so a shortcut would be great for us non programmers.

Re: Switching between Mode Instance/Frame

Posted: 19 Dec 2023, 20:22
by Cardin
Using the command Peter listed, I created a button that toggles the light table mode between image and instance(frame).

-install custom button
-click the 'x' to close the button's window so that it is no longer visible.
-the button is now installed and is listed in your shortcuts menu to be assigned a key.

Here's the code from the embedded script in case you just want to create the button for yourself. Not much of a programmer myself but it seems to work when I tested it...

Code: Select all

tv_lighttablemode 
parse result  interval interval_value  remaining

IF ( CMP( interval_value, "bookmark" ) == 1 || CMP( interval_value, "imagemark" ) == 1 )
tv_lighttablemode interval "image"
EXIT
END

IF ( CMP( interval_value, "image") == 1)
tv_lighttablemode interval "instance"
EXIT
END

IF ( CMP( interval_value, "instance") == 1)
tv_lighttablemode interval "image"
EXIT
END

Re: Switching between Mode Instance/Frame

Posted: 19 Dec 2023, 21:33
by Peter Wassink
That works like a charm,
Thank you very much Cardin!!!

Re: Switching between Mode Instance/Frame

Posted: 19 Dec 2023, 22:10
by Cardin
Peter Wassink wrote: 19 Dec 2023, 21:33 That works like a charm,
Thank you very much Cardin!!!
You're welcome, Peter!
Glad it's helpful :)

Re: Switching between Mode Instance/Frame

Posted: 20 Dec 2023, 08:55
by Joost
That is exactly what I was looking for! Thanks a lot Cardin!
This will save me a lot of time :)

(Maybe TVPaint can implement this in the future?)

Re: Switching between Mode Instance/Frame

Posted: 20 Dec 2023, 13:05
by Peter Wassink
Cardin wrote: 19 Dec 2023, 22:10
Peter Wassink wrote: 19 Dec 2023, 21:33 That works like a charm,
Thank you very much Cardin!!!
You're welcome, Peter!
Glad it's helpful :)
something weird.
yesterday the script worked but now no longer?!

i closed tvpaint yesterday ...accidently without saving my config .
so today i loaded your custom panel and assigned a key again.

but now it toggles between Image and instance...?
instead of between instance and imagemark


Would you care to explain how this script works, or what i could be doing wrong..?
it looks simple enough.
but for instance... i don't get why it says [ tv_lighttablemode interval "image" ] , instead of [ tv_lighttablemode interval "image mark" ]
( i tried changing it but that broke it :( )
it kind of makes sense from the script that it now it toggles between image and instance ...
yet it really did switch to image mark yesterday!? i'm confused now.


Also Dev team could you please remove the lighttable option "mode frame"/ "image"
i for the life of me cannot think of a single reason to have that.

tv_lighttablemode
parse result interval interval_value remaining

IF ( CMP( interval_value, "bookmark" ) == 1 || CMP( interval_value, "imagemark" ) == 1 )
tv_lighttablemode interval "image"
EXIT
END

IF ( CMP( interval_value, "image") == 1)
tv_lighttablemode interval "instance"
EXIT
END

IF ( CMP( interval_value, "instance") == 1)
tv_lighttablemode interval "image"
EXIT
END

Re: Switching between Mode Instance/Frame

Posted: 20 Dec 2023, 17:05
by Cardin
Joost wrote: 20 Dec 2023, 08:55 That is exactly what I was looking for! Thanks a lot Cardin!
This will save me a lot of time :)

(Maybe TVPaint can implement this in the future?)
yer welcome, Joost :)


Peter Wassink wrote: 20 Dec 2023, 13:05
Would you care to explain how this script works, or what i could be doing wrong..?
....
but now it toggles between Image and instance...?
instead of between instance and imagemark
From what I understood of Joost's request, he wanted a shortcut to toggle exclusively between image and instance, omitting "image mark" and "bookmark".

yet it really did switch to image mark yesterday!? i'm confused now.
That is strange! Can't really explain that one :?

but for instance... i don't get why it says [ tv_lighttablemode interval "image" ] , instead of [ tv_lighttablemode interval "image mark" ]
( i tried changing it but that broke it :( )

The error was probably "image mark" instead of "imagemark" [the enumator value designated for image mark]. Removing the 'space' character might fix the issue for you.


Peter, I modified the script to switch exclusively between Instance and Image Mark, brief explanations are provided in yellow comments.
tv_lighttablemode //fetch light table data
parse result interval interval_value remaining //disseminate data from fetch into separate variables


//*This part is to resolve situations where the mode was somehow set to a value we didn't want
//Section 2: This bit checks if the current value is set to image or bookmark;
//if either are true then it simply changes the value to "image". Setting it to "image"
//was an arbitrary decision since we only want/need the choices to be instance and image mark.
//After the change, the script is terminated because we don't want to do anymore checks at this time.

IF ( CMP( interval_value, "bookmark" ) == 1 || CMP( interval_value, "image" ) == 1 )
tv_lighttablemode interval "instance"
EXIT
END

//This bit checks if the current value is set to instance. If so, it toggles to image mark then terminates script.
IF ( CMP( interval_value, "instance") == 1)
tv_lighttablemode interval "imagemark"
EXIT
END

//This bit checks if the current value is set to image mark. If so, toggles to instance then terminates script.
IF ( CMP( interval_value, "imagemark") == 1)
tv_lighttablemode interval "instance"
EXIT
END
edited: Mixed up instance and image in the code; fixed now

Re: Switching between Mode Instance/Frame

Posted: 20 Dec 2023, 18:54
by Peter Wassink
Yes now it really works!

Thank you for your Trouble!

Sorry, yesterday i did not test it thoroughly i'm afraid and probably did not look close, imagining it worked :?

I actually don't quite understand why Joost would need that toggle between frame and image mark.
And am curious to learn, because i don't see how "mode frame" offers anything "mode instance" doesn't?

Re: Switching between Mode Instance/Frame

Posted: 20 Dec 2023, 19:41
by D.T. Nethery
Cardin wrote: 19 Dec 2023, 20:22 Using the command Peter listed, I created a button that toggles the light table mode between image and instance(frame).

-install custom button
-click the 'x' to close the button's window so that it is no longer visible.
-the button is now installed and is listed in your shortcuts menu to be assigned a key.

Here's the code from the embedded script in case you just want to create the button for yourself. Not much of a programmer myself but it seems to work when I tested it...

Code: Select all

tv_lighttablemode 
parse result  interval interval_value  remaining

IF ( CMP( interval_value, "bookmark" ) == 1 || CMP( interval_value, "imagemark" ) == 1 )
tv_lighttablemode interval "image"
EXIT
END

IF ( CMP( interval_value, "image") == 1)
tv_lighttablemode interval "instance"
EXIT
END

IF ( CMP( interval_value, "instance") == 1)
tv_lighttablemode interval "image"
EXIT
END

Thank you, Cardin ! That looks very useful. Looking forward to trying it out (and I read the follow-up with Peter)

.