[Submission] /for console slash-command  [SUBMITTED]

Moderator: SecondMan

tberakis
Posts: 28
Joined: Mon Dec 29, 2014 2:30 pm
Been thanked: 5 times

[Submission] /for console slash-command  [SUBMITTED]

#1

Post by tberakis » Fri Feb 09, 2018 8:57 pm

With inspiration from this thread viewtopic.php?f=16&t=1877, I thought I would create an atom that uses the new slash-command functionality to make this kind of thing easier. It only supports a couple of sub-commands so far, but I can see a few more things that would be nice to add in future versions.

-----

The /for slash-command is used to quickly and easily apply changes across a number of tools.
Usage
/for (selected|visible|all) [tooltype[,tooltype...]] [where <condition>] <command> [ & <command>...]

Supported commands:
animate <input> [(with <modifier>|remove)] [force]
color [tile <color>] [text <color>] [fill <color>]
select [(add|remove)]
set <input> ([at <time>] to <value>|expression <exp>)

Examples:
Set the Size of all selected tools to 1.0:
/for selected set Size to 1.0
Set the SeetheRate of all FastNoise tools in the comp to 1.0:
/for all FastNoise set SeetheRate to 1.0
Double the current size of each Merge or Transform currently selected:
/for selected Merge,Transform set Size to value*2.0
Animate Size of all selected tools with default modifier (BezierSpline):
/for selected animate Size
Animate Size of all visible tools (ie not modifiers) with CubicSpline
/for visible animate Size with CubicSpline
Animate Size of all selected tools, replacing any already animated ones:
/for selected animate Size force
Animate Seethe of all FastNoise tools, creating a ramp from 1.0 to 5.0 over 100 frames:
/for all FastNoise animate Seethe & set Seethe at 0 to 1.0 & set Seethe at 100 to 5.0
Remove animation from Size of all selected tools:
/for selected animate Size remove
Set a Seethe expression on selected FastNoise tools:
/for selected FastNoise set Seethe expression time/10.0
Select all FastNoise tools:
/for all FastNoise select
Add all tools where Size > 1 to the selection:
/for all where Size > 1.0 select add
Remove all Merge tools where Angle < 0 from the selection:
/for all Merge where Angle < 0 select remove
Set the tile color to red for selected tools:
/for selected color tile 1,0,0
Set the text color to green for selected FastNoise tools with a non-zero SeetheRate:
/for selected FastNoise where SeetheRate ~= 0 color text 0,1,0
Attachments
com.wesuckless.SlashFor.zip
v1.1
(8.24 KiB) Downloaded 10 times
Last edited by tberakis on Sun Feb 11, 2018 1:54 pm, edited 1 time in total.

User avatar
SecondMan
Site Admin
Posts: 3416
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 4
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] /for console slash-command

#2

Post by SecondMan » Fri Feb 09, 2018 9:31 pm

:shock:

User avatar
SecondMan
Site Admin
Posts: 3416
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 4
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] /for console slash-command

#3

Post by SecondMan » Fri Feb 09, 2018 9:49 pm

I just tested this. It's absolutely brilliant - thanks so much for sharing!

It will take me a while to decipher that (astonishingly short) piece of code, there is so much to learn in there :)

In the meantime, let's get this into Reactor asap :cheer:

User avatar
Dunn
Moderator
Posts: 474
Joined: Mon Aug 04, 2014 4:27 am
Location: Hamburg, Germany
Been thanked: 2 times
Contact:

Re: [Submission] /for console slash-command

#4

Post by Dunn » Sat Feb 10, 2018 6:22 am

Totally amazing :shock: !
...we could make a custom UI to hold those functions right ?!

Nice one! :)

tberakis
Posts: 28
Joined: Mon Dec 29, 2014 2:30 pm
Been thanked: 5 times

Re: [Submission] /for console slash-command

#5

Post by tberakis » Sun Feb 11, 2018 1:58 pm

Now updated (in first post) with v1.1

New for this update:

/for can now be limited to a subset of tools using where <expression>:

Set the Size of all selected tools to 1.0, if it's already > 1.0:
/for selected where Size > 1 set Size to 1.0

* set can now set expressions:

Set a Seethe expression on selected FastNoise tools:
/for selected FastNoise set Seethe expression time/10.0

* Added a 'select' command:

Select all FastNoise tools:
/for all FastNoise select
Add all tools where Size > 1 to the selection:
/for all where Size > 1.0 select add
Remove all Merge tools where Angle < 0 from the selection:
/for all Merge where Angle < 0 select remove

Added a 'color' command:

Set the tile color to red for selected tools:
/for selected color tile 1,0,0
Set the text color to green for selected FastNoise tools with a non-zero SeetheRate:
/for selected FastNoise where SeetheRate ~= 0 color text 0,1,0

User avatar
SirEdric
Fusionator
Posts: 1822
Joined: Tue Aug 05, 2014 10:04 am
Answers: 2
Real name: Eric Westphal
Been thanked: 97 times
Contact:

Re: [Submission] /for console slash-command

#6

Post by SirEdric » Sun Feb 11, 2018 2:13 pm

Wow. Period.

User avatar
SecondMan
Site Admin
Posts: 3416
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 4
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] /for console slash-command

#7

Post by SecondMan » Sun Feb 11, 2018 2:22 pm

:cheer: fantastic! :)

So - not able to test this right now - I'm guessing 'where' could even be used with custom Info content? Maybe we could even make the code do (with some adjustments) something like:

/for all where Info contains "heavy tool" passthrough

tberakis
Posts: 28
Joined: Mon Dec 29, 2014 2:30 pm
Been thanked: 5 times

Re: [Submission] /for console slash-command

#8

Post by tberakis » Sun Feb 11, 2018 2:38 pm

What would 'info' be? The comments on the tool, or some custom data?

User avatar
Chad
Fusionator
Posts: 1390
Joined: Fri Aug 08, 2014 1:11 pm
Been thanked: 11 times

Re: [Submission] /for console slash-command

#9

Post by Chad » Sun Feb 11, 2018 4:19 pm

CustomData and Comments would cover most use cases.

User avatar
SecondMan
Site Admin
Posts: 3416
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 4
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] /for console slash-command

#10

Post by SecondMan » Sun Feb 11, 2018 4:23 pm

Comments was what I had in mind. Though CustomData would be great, too. Hmmm... I always forget about that one. Should really leverage that at some point.

tberakis
Posts: 28
Joined: Mon Dec 29, 2014 2:30 pm
Been thanked: 5 times

Re: [Submission] /for console slash-command

#11

Post by tberakis » Sun Feb 11, 2018 6:19 pm

Oh I just looked in Reactor and saw my v1 script already included. Nice!

I see you've changed the id - Should I go with that for submissions going forward?

I went with the wesuckless one as that's what my Temporal Filter fuse is. I'm not sure if that ought be changed too.

User avatar
Midgardsormr
Fusionator
Posts: 1057
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 1
Location: Los Angeles, CA, USA
Been thanked: 61 times
Contact:

Re: [Submission] /for console slash-command

#12

Post by Midgardsormr » Sun Feb 11, 2018 7:08 pm

Comments would be easiest for the end user. CustomData is comparatively difficult to access on the fly.

User avatar
SecondMan
Site Admin
Posts: 3416
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 4
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] /for console slash-command

#13

Post by SecondMan » Sun Feb 11, 2018 7:33 pm

tberakis wrote:
Sun Feb 11, 2018 6:19 pm
Oh I just looked in Reactor and saw my v1 script already included. Nice!

I see you've changed the id - Should I go with that for submissions going forward?

I went with the wesuckless one as that's what my Temporal Filter fuse is. I'm not sure if that ought be changed too.

Err, yes! Submitted! :cheer:

Sorry for the notification delay - I got distracted and messed up a little :) - thanks again for sharing!

You're right - your Temporal Filter was one of the first packaged with a host of other tools that we added from scavenging the WSL archives. It was also part of a larger topic where multiple people contributed. So I guess partly for that reason we kept it under that umbrella, while crediting you as the author in the Atom itself. We'll look into this. For the future, by all means use your own name.

tberakis
Posts: 28
Joined: Mon Dec 29, 2014 2:30 pm
Been thanked: 5 times

Re: [Submission] /for console slash-command

#14

Post by tberakis » Sun Feb 11, 2018 8:04 pm

Midgardsormr wrote:
Sun Feb 11, 2018 7:08 pm
Comments would be easiest for the end user. CustomData is comparatively difficult to access on the fly.
Yes I agree with this.. custom data is a bit obscure for most people - anyone who understands that can probably use real scripts rather than /for

But still, I'm thinking of two paths for additions. Firstly a simple way to query comments, using 'where info contains' ... or whatever.

But secondly, a more complex data interface. So 'where' supporting data, but also a 'setdata' command maybe, to allow setting custom data?

/for all BrightnessContrast where Gamma ~= 1.0 setdata GammaAdjust to true

Or something like that?

I'm open to ideas on this one, as it's getting in to workflow and pipeline ideas that might require a range of solutions.

User avatar
Chad
Fusionator
Posts: 1390
Joined: Fri Aug 08, 2014 1:11 pm
Been thanked: 11 times

Re: [Submission] /for console slash-command

#15

Post by Chad » Mon Feb 12, 2018 8:16 am

Midgardsormr wrote:
Sun Feb 11, 2018 7:08 pm
Comments would be easiest for the end user. CustomData is comparatively difficult to access on the fly.
That's the point. :D
CustomData isn't visible in the GUI, but is guaranteed to be available for any tool/comp. So for someone making an idiot-proof(ish) pipeline, CustomData is "safer" than Comments.