Creating and moving an artLayer inside "active" layerSet

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

User avatar
StoryCave
Posts: 20
Joined: Wed Sep 21, 2016 2:14 pm

Re: Creating and moving an artLayer inside "active" layerSet

Post by StoryCave »

I make sure I work with only one document, if sometimes I have too many panels (ie. layerSets) that slows down Photoshop, I split the file.
I usually don't have any problems with my actions, and don't use many camera moves so it's not really an issue, but if I could get to create the CAM layer with only 1 step that would be sweet ;)
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Creating and moving an artLayer inside "active" layerSet

Post by Kukurykus »

Hi again,

It's not an answer for your last question. I was browsing my scripts folder and was circious what some scripts I wrote are doing. I found that one I wrote for you is buggy. Of course if you use it only one specific way there is no problem, but sometimes you want to do something different and then if either throw an error or work unintended way. Now I refreshed it that you may use it whereever there is one layer or many layerSets with some subset(layers) etc

Code: Select all

if (documents.length) {
aL = (aD = 'activeDocument') +'.activeLayer', bol = true, arr = []

while(bol) aL += '.parent', String(AL = eval(aL)).slice(1, 9) != 'LayerSet' ? bol = !bol : arr.push(AL.name)

aDl = aD + l = '.layers', n = arr.length - 1, evl = eval(aDl);

(function set() {
for(i = 0; i < evl.length; i++) {
if (evl[i].name == arr[n]) {
aDl += '[i]' + l, n--, aD += l + '[' + i + ']'
if (!n) {
for(j = 0; j < eval('(ARR = ' + aD +'.layers.getByName(arr[0]).layers).length'); j++) {
if (!ARR[j].kind) {bol = true; break} else bol = false
}
}
if (n > -1) set(); break
}
}
})()

L = eval("(aL = activeDocument.activeLayer).kind == 'LayerKind.NORMAL' ?\
((lay = (P = aL.parent).layers).length == 1 ?\
(bol ? 1 : (!n ? 2 : (P.name.slice(0, 1) == 'A' ? 1 : (n < 0 ? 1 : 2)))) :\
(!n ? 2 : (bol ? 1 : (lay[0] == aL ? (arr.length > 1 ? 2 : 1) : 2)))) : 2")

lyr = eval(aD).artLayers.add(), eval('doc.activeHistoryState =\
(hS = (doc = activeDocument).historyStates)[hS.length - L]'), lyr.name = 'CAM'
} else alert('Create/Open at least one document!')
Attachments
SubLayerSets2.rar
(932 Bytes) Downloaded 388 times
User avatar
StoryCave
Posts: 20
Joined: Wed Sep 21, 2016 2:14 pm

Re: Creating and moving an artLayer inside "active" layerSet

Post by StoryCave »

Hi Kukurykus,

Thanks a lot for the update, I've looked into it and saw you added some code, I combined it with my other script and it works, I don't know what bug you might referring to but it's probably my level in programming that's still behind ;)
I've actually resumed the courses I was taking and hopefully will get there.

I'll be back soon with another script I'll be asking some help with, it's slower than I expected.

Cheers.

K.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Creating and moving an artLayer inside "active" layerSet

Post by Kukurykus »

I can say that I spent few hours to check all cases and make sure it will always work whatever you will do. Maybe there are some things I didn't imagine someone can try this script with, but with ((sub)set)Layers finally after many attemts I couldn't make it broke working of script. That wasn't so obvious to make it working, because when I fixed one thing I found other doesn't work what before even couldn't be processed. When I fixed another thing, then I noticed that thing worked before it doesn't. When all seemd to work then again I found it works in very complicated cases but stops in the simple ones. Really when you match first part of script and then that second you will see many differences but at least now it won't ever fail.

For ex. if there was (in previous version) subsetaLayer in some subsetLayer it worked fine, but if you wanted to make another subfolder with some layer inside (so folder in folder in folder) it wouldn't go. And another example, when I fixed that like I wrote before I found something else and so on. There were about 10 cases that first script (beeing still updated by me) couldn't handle.

Are you some artist, is it easy and fast for you to imagine and paint graphics? That one from http://storycave.org/ is really nice!
User avatar
StoryCave
Posts: 20
Joined: Wed Sep 21, 2016 2:14 pm

Re: Creating and moving an artLayer inside "active" layerSet

Post by StoryCave »

Hehe, even when you say that it's buggy it's still works amazingly, so hats off for being a perfectionist ! ;)

Thanks for your feedback on the front page !
For your information I'm a storyboard artist, and usually draw characters that already were designed by someone else in production, I don't need to imagine them but I have to be fast and rough because deadlines are very tight, though with practice (as usual) it gets a little bit easier.

For imagination, well, for me that's harder and very slow, but like anything else, with research and exploration it eventually gets better, it's more important to draw ideas clearly, the technique is secondary and (again) with practice it improves if we're consistent.

If you're interested in improving your drawing skills, I'll share that age-long advice that is to recommend to have a sketchbook with you and draw as regularly as you can, if you can start with 5-10 minutes a day, imagine how much you'll get better in 2 weeks, compare your drawings, and you'll notice some interesting stuff you can't believe would happen. ;)
Drawing people and places outside, in cafés, in the bus, anywhere basically is really the best way to go, it'll help with your creative drawings as you'll have some references to build from.