adobe-photoshop / spaces-design

Adobe Photoshop Design Space
http://adobe-photoshop.github.io/
Other
853 stars 74 forks source link

Exporting empty artboard or empty layer causes error #2273

Open ktaki opened 9 years ago

ktaki commented 9 years ago

Export Failed for asset 0 of layerID 3, documentID 401, with error Cannot call method 'info' of undefinedTypeError: Cannot call method 'info' of undefined

mcilroyc commented 9 years ago

The terribleness of the above error is being addressed in a generator plugin fix: https://github.com/adobe-photoshop/generator-spaces/commit/2ef03036af896fd55edc795b68719bf9349d7bf5

A in-progress DS PR will fix the way this is handled (or better yet, prevented).

mcilroyc commented 9 years ago

Note to self: empty artboards, and empty text layer (eg., a single whitespace text) is reported by our internal model as non-empty, yet generator complains in both cases that they are empty.

mcilroyc commented 9 years ago

As of yesterday (jenkins dev mac 594), when an export fails, the underlying message from generator plugin is more meaningful. This, combined with the above-merged PR which prevents empty artboards and layer from attempting to export, addresses this issue.

There may be situations where the export fails and we can not have predicted it. We should at least be handling it somewhat correctly now, and I'd like to log those issues individually as they occur.

ktaki commented 9 years ago

I still see the sam error. Create a new artboard doc. Select the Artboard 1 in layers panel. Click on export icon, then export it.

mcilroyc commented 9 years ago

The case you just described seems to me to be a very unlikely edge case that I will have to handle separately. Namely the first artboard with the empty placeholder layer. (Who's trying to export an empty artboard!?)

mcilroyc commented 9 years ago

note to future self: I think the method layerstructure.isEmptyGroup could be safely modified to check for groups that (recursively) contain empty (zero bounds area) layers. But this touches several features, so I don't think it is worth the risk pre-MAX

iwehrman commented 9 years ago

The console error is really more of a warning w.r.t. Design Space at this point, and since we can't fully predict Generator errors I don't think this is really a bug. However, I agree with @mcilroyc's wish to extend isEmptyGroup to recursively check for empty subgroups. I also agree this isn't worth trying to do for M3, so I'm kicking it to M4.

iwehrman commented 9 years ago

Actually, can't you just do bounds = document.layers.childBounds(layer); empty = !bounds || bounds.empty? That's recursive as all get-out.