Content API (if I call it correctly) has an option to export hidden assets forceRenditionRootVisible
. How can I do it using current api? When I export hidden layer I just get an empty image.
If nodes are hidden in the document, they are actually invisible in the document as well. What’s the use case of creating renditions of these hidden, invisible nodes?
The use case might be user has 1 button with 4 states, 1 state is visible, other hidden. All 4 marked for export. I need to get renditions for all 4 states not just one visible.
Maybe I said it wrong I mean bitmap or svg are empty when I export layer itself, not the entire document or one of the parent layers. This problem was fixed for content api with forceRenditionRootVisible flag.
This is another use case that requires us to support to get at par with CAAPI @afuchs
OK, I’ll bite. What’s CAAPI? CA API?
Content Access API which was opened privately for a few partners in the early days (before plugin APIs).
@stevekwak, I have a pretty similar use case like @gdreyv does. Are there any workarounds for this? Thanks!
@afuchs Can this use case be covered by plugin APIs to make sure smooth transition for CAAPI partners (and people who requested this above)?
Hi @stevekwak thank you for taking this forward but is there any workaround or a hack to render hidden layers?
Not that I’m aware of… @kerrishotts any idea here? (regarding UXP createRenditions hack to export hidden assets)
Well I did a hack to get around this issue. That is,
- Traverse through the scenegraph tree and change the visibility setting of the nodes that are hidden by
const mutatedNodes = {};
if (!node.visible) {
node.visible = true;
mutatedNodes[node.guid] = node.name;
}
mutatedNodes
will help in O(1) lookup in the step 3.
I had to create a panel around my initial code to use app.editDocument()
function to alter the visibility.
-
Now render all the exportable nodes using
app.createRenditions()
-
Once the above-mentioned async operation is done, traverse through the scenegraph tree again, and check if the node’s GUID is in the
mutatedNodes
object to revert the visibility back to it’s original state.
Make sure that the artboard is not deselected when the above process is ongoing. If you did by mistake, ctrl+z
will bring the changes back.
With respect to performance, overall time complexity is O(N) and a worst case space complexity of O(N) as well.
If there’s any elegant solution, please share it in this thread!
Peace!
But won’t you run into issues with the edit context with that?
The specific case that I am working deals only with Artboards and it must (and will) use Group
to group other graphic nodes (so strictly no RepeatGrid and SymbolInstances, etc.,). Thus the edit context spans from the selected Artboard, and all the way to the leaf nodes (any graphic nodes). Thus, for a selected Artboard, this technique just works fine, unless the artboard that is currently under processing gets deselected. Therefore, I have not had any issues with Edit Context so far.
Again, this is not the long term solution I am planning to settle with. It would be really great if AdobeXD allows for forcing a node to flip its visibility via an API.