graphicxtras Affinity Photo Designer Photoshop Illustrator Videos

How To Photoshop Pattern Script Editing Tutorial

Fill command

Photoshop pattern scripts are supplied for the fill command by Adobe, you can edit and modify the JavaScript files.

Create a copy / Location

This is not too complicated, I know it can look daunting to edit one of the core files but it is not, the key thing is to make a copy of the file in the folder. It can be found in Adobe Photoshop folder in applications (or program files) and in the sub folder of presets in Deco (why called Deco, they were originally called Deco back in the day but I haven't seen them called that in the main application ever since).

New name

Once you have Random Fill.jsx. Make a copy of it and call it something else such as Random Fill Division.jsx. If you go back to the fill command, you will now see that in drop down list for the patterns. You can delete the file from the folder and it will vanish from the list. You may need permissions to edit the file or the folder, give yourself system permissions to do this with your admin password.

Rotation of dabs

Edit the file. By a small change, you can modify the random rotation of the dabs used, so instead of rotating freely if random is used, you can set up a division of 1, 2, 3, 4, 5 etc and so you can create hexagons, etc in the structure of the random fill. Run the fill command and the division entry will appear.

Edit the JSX file

Edit, right click the JSX file and select notepad or textedit etc or perhaps an editor if you have that on your system. Create an entry called division_1 = 4, and that means the division1 defaults to 4 at the start, you can override it.

ApplyRotation

Go down to the code that has if parameters.applyRotation and inside that if statement add in var division_1 = parameters.division_1 (or whatever you called your parameter). Put rotate = 360 / division_1 etc.

Video

Please check out the video for the full code on this as it is easier to see in the video but only a few minor changes are needed to that line.

Second ApplyRotation

There is a second time that the applyrotation is used, update that as well. Go down to the menu section and copy the density entry and past in the same section and set up the label for the density setting, etc (again, the video gives more detail).

Slider option

Go for the slider option. Set the itemmin to 1 and itemmax to 60 etc, just avoid using 0 for the minimum. You can then save the file and go to the fill panel and select that file from the list. Run it and you will see the division entry appear in the panel.