Last active
August 16, 2022 23:05
-
-
Save JimaDobes/85c7a9db7716907f5919636579273f72 to your computer and use it in GitHub Desktop.
reproduce an error for layer.move(groupLayer, 'placeInside')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
setup: | |
* create a photoshop document with a layer, and a group layer below it | |
* run the following in the UXP Devtools (UDT) | |
results in error: | |
Uncaught TypeError: Cannot read properties of undefined (reading 'id') | |
at _directRef (uxp://uxp-internal/ps-app.js:1) | |
at Layer_Layer.moveInside (uxp://uxp-internal/ps-app.js:1) | |
at Layer_Layer.move (uxp://uxp-internal/ps-app.js:1) | |
at <anonymous>:2:13 | |
_directRef @ uxp://uxp-internal/ps-app.js:1 | |
moveInside @ uxp://uxp-internal/ps-app.js:1 | |
move @ uxp://uxp-internal/ps-app.js:1 | |
(anonymous) @ (index):2 | |
related info: | |
* https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/layer/#move | |
* https://forums.creativeclouddeveloper.com/t/issue-with-layer-move-targetlayer-elementplacement/4109 | |
* https://forums.creativeclouddeveloper.com/t/unable-to-move-layer-into-group-using-elementplacement-placeinside/4967/15 | |
in some cases selecting/making active the group layer then creating the new layers results in these new layers going into the group layer | |
* use executeAsModal to set: | |
layer.selected = true; | |
... layers created will now go into the group layer ... | |
*/ | |
const photoshop = globalThis.require('photoshop'); | |
let [normalLayer, groupLayer, ...otherLayers] = photoshop.app.activeDocument.layers; | |
photoshop.core.executeAsModal( (context, descriptor)=>{ | |
normalLayer.move( | |
groupLayer, | |
photoshop.constants.ElementPlacement.PLACEINSIDE | |
) | |
}, {commandName: `try to move, really really`}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment