Jump to content
You must now use your email address to sign in [click for more info] ×

Test & Improve this macro?


Recommended Posts

One of the problems with a lot of my macros is they are intended to work on a single pixel layer, so if I apply them to a multi-layer document I often do not get the result I wanted. To fix this, I have been experimenting with doing a Merge Visible in a separate macro & then creating new 2 step macros with the first step as that macro & the second step as whichever existing macro I designed to work on a single pixel layer.

For convenience, I also want the first step macro to hide all the other layers & select the merged layer it created at the top of the layer stack. Since there is no loop or repeat macro function & there could be lots of layers to hide, the problem with that is making sure I hide all the other layers.

What I have been trying to deal with that is to create another macro, one that selects the layer one below the current one & hides it, & then adding that repeatedly to my Merge visible macro, like this:

2004980142_Mergemacrosteps.jpg.724abb443b04a4f688c9ef3263764bd8.jpg

The attached Merge.afmacros includes both the merge macro (named "Merge, hide, select, name v1") & the one it adds repeatedly (named "hide next"). The "hide next" macro is not needed to run the merge macro as is, but I included it in case it could be used in an improved version.

Obviously, my version will fail to hide more than 30 other layers, so if you can think of any better way to do this that gets around that limitation, please let me know.

Comments & criticisms also welcomed.

TIA

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

6 hours ago, anon2 said:

For the first macro, try:

  1. select all layers
  2. group
  3. hide
  4. duplicate
  5. rasterise
  6. show

Perfect!

Funny how easy it is to overlook some things. My first thought when considering how to do this was to select all the layers as step 1 but I looked no further on the Select menu than "Select All," forgetting that there is also a "Select All Layers" item on that menu.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

Good morning, R C-R...

I've made this macro for you (a single macro, not a macro category, hence the Macro panel and not the Library panel) which can serve as the beginning of whatever else you'd like to do. The steps are:

1-Deselect   [I usually put this at the top of any macro I do, so as not to confuse things]
2-Select All   [selects all the layers]
3-Group   [puts all the original layers in a group; they can be turned on/off with a single click]
4-Set Description "Original Layers in a Group"   [give the group a unique, therefore choose-able, name]
5-Merge Visible
6-Set Description "Merge Visible Layer'   [again, a unique name for possible later selection]
7-Set Current Selection   [selects the layer named "Original Layers in a Group"]
8-Set Visibility   [hides the group of original layers]
9-Set Current Selection   [selects the layer named "Merge Visible Layer']
10-Group
11-Set Description "Additional Editing to be Done"   [names the group uniquely so that it can be selected]
12-Set Current Selection   [selects the Merge Visible layer [which is Child Number 1 in the dialog]

I've constructed the macro this way because all of the additional editing can take place inside of a group. That way, any additional changes can be turned on and off with a single click, and can be done in a macro (since the group that contains the additional edits has a unique name). Obviously, you can recreate the macro and change the names of the layers and the groups as you wish!

Let me know what you think...

MergeAndContinue.afmacro

Affinity Photo 2, Affinity Publisher 2, Affinity Designer 2 (latest retail versions) - desktop & iPad
Culling - FastRawViewer; Raw Developer - Capture One Pro; Asset Management - Photo Supreme
Mac Studio with M2 Max (2023}; 64 GB RAM; macOS 13 (Ventura); Mac Studio Display - iPad Air 4th Gen; iPadOS 17

Link to comment
Share on other sites

21 minutes ago, smadell said:

I've made this macro for you (a single macro, not a macro category, hence the Macro panel and not the Library panel)

As far as I’m aware, the iPad version of APh still only understands *.macros files, so for maximum shareability it’s probably best to stick to exporting via the Library panel even when there’s only one macro in the file.

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

Alfred...

I'm aware that the iPad will only import categories, but I also know that R C-R is savvy enough to use the Macro panel on his desktop. Also, in and of itself, this macro doesn't actually accomplish anything. It merely sets the stage for additional editing. And, since the iPad can run macros but cannot create or edit them, importing this particular macro onto an iPad would simply be fruitless. In other words, there was a method to my madness...

Affinity Photo 2, Affinity Publisher 2, Affinity Designer 2 (latest retail versions) - desktop & iPad
Culling - FastRawViewer; Raw Developer - Capture One Pro; Asset Management - Photo Supreme
Mac Studio with M2 Max (2023}; 64 GB RAM; macOS 13 (Ventura); Mac Studio Display - iPad Air 4th Gen; iPadOS 17

Link to comment
Share on other sites

3 hours ago, smadell said:

Let me know what you think...

I assume in your second step you meant "select all layers" not "select all" -- that's what tripped me up when I first started & @anon2 helped me with.

As for the rest of it, I also added a step to name the group as in your step 4 & one to name the rasterized layer using anon2's method, but I prefer short names so they leave space for the parenthetical layer type suffix in the layers panel. I also generally prepend those names with an underscore (_) or something else I am unlikely to use in other situations to avoid duplication.

I have not yet decided if I want to use Merge Visible or Rasterize/Rasterize & trim to create the layer to pass on to other macros. They can produce slightly different results depending on the structure of my .afphoto files so I am still evaluating which would be best for me.

I am unlikely to include anything like your steps 9-12 in my version. I want to keep this macro simple & reserve creating more groups & children only if appropriate for the macros this one passes anything to. But again, this is something I am still evaluating.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

R C-R...

1) The second step, which I listed as "Select All" is indeed one which selects all layers. This step was created by choosing "Select All Layers" from the menu; it is listed as "Select All" in the macro, itself, and that is the reason for listing it the way I did.

2) I agree that naming layers in a macro requires that those names be (i) brief, and (ii) unique. I only named them the way I did as a means of explanation. Certainly, making shorter but still unique names is a laudable goal!

3) Many of the macros I have posted to the forum create an "effect." That is, they are macros for giving a photo a "Graphic Novel Effect" or an "Infrared Simulation" and so forth. Because of this, and because those effects require adding a number of layers to the original, I have started putting the additional layers inside a Group so that a user can turn the effect on and off with a single click. I simply employed that thinking when writing this particular macro.

Please post something new if you find a more elegant way of doing this. It's all about learning...

Affinity Photo 2, Affinity Publisher 2, Affinity Designer 2 (latest retail versions) - desktop & iPad
Culling - FastRawViewer; Raw Developer - Capture One Pro; Asset Management - Photo Supreme
Mac Studio with M2 Max (2023}; 64 GB RAM; macOS 13 (Ventura); Mac Studio Display - iPad Air 4th Gen; iPadOS 17

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.