Skip to content

[v1.4.0] Lottie export failed with exception #1922

Open

Description

@quentincaffeino

Synfig version & platform:
v1.4.0 & 1.4.0 flathub
elementary OS 5.1.7 Hera, Built on Ubuntu 18.04.4 LTS, Linux 5.9.10-050910-generic, GTK 3.22.30

Issue description:

  • With app image downloaded from releases page I'm getting this exception:
synfig(13789) [10:39:36 PM] info: Python 3 binary found: python3
synfig(13789) [10:39:37 PM] info: Traceback (most recent call last):
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/lottie-exporter.py", line 163, in <module>
    new_file_name = parse(FILE_NAME)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/lottie-exporter.py", line 68, in parse
    gen_layers(settings.lottie_format["layers"], canvas, canvas.get_num_layers() - 1)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/driver.py", line 82, in gen_layers
    itr)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/group.py", line 94, in gen_layer_group
    asset = add_precomp_asset(settings.lottie_format["assets"][-1], canvas, canvas.get_num_layers())
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/sources/precomp.py", line 29, in add_precomp_asset
    layers.driver.gen_layers(lottie["layers"], canvas, layer_itr-1)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/driver.py", line 82, in gen_layers
    itr)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/group.py", line 94, in gen_layer_group
    asset = add_precomp_asset(settings.lottie_format["assets"][-1], canvas, canvas.get_num_layers())
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/sources/precomp.py", line 29, in add_precomp_asset
    layers.driver.gen_layers(lottie["layers"], canvas, layer_itr-1)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/driver.py", line 82, in gen_layers
    itr)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/group.py", line 94, in gen_layer_group
    asset = add_precomp_asset(settings.lottie_format["assets"][-1], canvas, canvas.get_num_layers())
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/sources/precomp.py", line 29, in add_precomp_asset
    layers.driver.gen_layers(lottie["layers"], canvas, layer_itr-1)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/driver.py", line 82, in gen_layers
    itr)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/group.py", line 94, in gen_layer_group
    asset = add_precomp_asset(settings.lottie_format["assets"][-1], canvas, canvas.get_num_layers())
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/sources/precomp.py", line 29, in add_precomp_asset
    layers.driver.gen_layers(lottie["layers"], canvas, layer_itr-1)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/driver.py", line 69, in gen_layers
    itr)
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/layers/shape_solid.py", line 87, in gen_layer_shape_solid
    gen_mask(lottie["masksProperties"][0], invert, bline_point, index.inc())
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/helpers/mask.py", line 40, in gen_mask
    convert_non_loop(lottie["pt"])
  File "/tmp/.mount_bVxKgN/usr/share/synfig/plugins/lottie-exporter/helpers/mask.py", line 60, in convert_non_loop
    posi["o"][-1][0] = posi["o"][-1][1] = 0
IndexError: list index out of range

synfig(13789) [10:40:17 PM] info: ipc.cpp:278: fifo activity: 'F'

It could be because that I haven't created any animations yet, just imported svg. But still, it shouldn't crash like that I guess.

  • With Flatpak version I receive: no module lxml found, tho I have both python-lxml and python3-lxml installed on my system.

Activity

  1. morevnaproject commented on Dec 13, 2020

    @morevnaproject
    Member

    Hi! Thank you for report. Can you please attach file you have problems with?

  2. added this to the v1.4.1 milestone on Dec 13, 2020
  3. quentincaffeino commented on Dec 13, 2020

    @quentincaffeino
    Author

    Yeah sure, thought it wouldn't help you because it's basically empty.

    apple.sifz.zip

  4. rodolforg commented on Jan 15, 2021

    @rodolforg
    Contributor

    The problem is in lottie-exporter/helpers/mask.py.

    def convert_non_loop(lottie):
        """
        Converts the non loop shapes to looped shapes by changing the in and out
        tangents accordingly
    
        Args:
            lottie (dict) : The shape to be modified
    
        Returns:
            (None)
        """
        for chld in lottie["k"]:
            if "s" in chld.keys() and "e" in chld.keys():
                char_dict = {"s", "e"}
                for char in char_dict:
                    posi = chld[char][0]
                    if not posi["c"]:
                        posi["o"][-1][0] = posi["o"][-1][1] = 0
                        posi["i"][0][0] = posi["i"][0][1] = 0
                        posi["c"] = True

    When exporting the sample provided by OP, at third time code reaches if not posi["c"]: line evaluated as True, posi contents are:

    {'i': [], 'o': [], 'v': [], 'c': False}

    And that's the reason exception is thrown ("IndexError: list index out of range").

    But I don't know the code to mess with it.

  5. AnishGG commented on Jan 18, 2021

    @AnishGG
    Member

    Hi, will try to have a look at this issue as soon as possible.

  6. AnishGG commented on Jan 18, 2021

    @AnishGG
    Member

    The issue is:
    There is one outline which has only one vertex in your apple.sifz. And this is handled in Synfig here:

    if (side_a.size() < 2 || side_b.size() < 2) return;

    We are handling the same thing in Lottie exporter here:

    if len(side_a) < 2 or len(side_b) < 2:
    return

    So, I just need to put a check in the code, which will prevent this error when we have only 1 vertex.

    Anyway, In my knowledge, I don't know any purpose(visually) of an Outline layer with 1 vertex. So ig if you remove it, then the animation works perfectly. @rodolforg any views here? ^__^

  7. rodolforg commented on Jan 18, 2021

    @rodolforg
    Contributor

    Hmm... visually, it could a single dot or am I wrong?

    Anyway, as Synfig Studio can open and render the file, I think Lottie exporter should be able to render. It could warn about the ignored spline.

    What do you think?

  8. AnishGG commented on Jan 18, 2021

    @AnishGG
    Member

    Oh yes, I see. It is a single dot.

    And yes, Lottie exporter should also behave in a similar way. Will look into this.

  9. rodolforg commented on Jan 18, 2021

    @rodolforg
    Contributor

    Synfig doesn't render this single dot, but…

    1. I think it should
    2. This doesn't prevents the document to be opened and rendered
  10. AnishGG commented on Jan 18, 2021

    @AnishGG
    Member

    Well for me, when I increase the outline width of an Outline layer, I am able to see some figure(probably single dot). Or this could be happening because I am using an older version of Synfig.
    I have made some changes in the exporter, and now your 2nd point is followed in the exporter too.

  11. rodolforg commented on Jan 18, 2021

    @rodolforg
    Contributor

    Or this could be happening because I am using an older version of Synfig.

    I can't see anything on master branch nor on 1.4.0 (Debian).

    I have made some changes in the exporter, and now your 2nd point is followed in the exporter too.

    👍

  12. AnishGG commented on Jan 18, 2021

    @AnishGG
    Member

    I can't see anything on master branch nor on 1.4.0 (Debian).

    Well, that is good in a way. I won't have to make any more changes in the exporter 😄
    I will submit a PR to close this issue soon.

  13. changed the title [-]Lottie export[/-] [+][v1.4.0/AppImage] Lottie export failed with exception[/+] on Jan 19, 2021
  14. changed the title [-][v1.4.0/AppImage] Lottie export failed with exception[/-] [+][v1.4.0] Lottie export failed with exception[/+] on Jan 19, 2021
  15. AnishGG commented on Jan 19, 2021

    @AnishGG
    Member

    I can't see anything on master branch nor on 1.4.0 (Debian).

    @rodolforg I just built Synfig from master branch, and I am able to see a dot like structure for a single vertex.
    I am attaching the file here:
    check.zip

  16. rodolforg commented on Jan 25, 2021

    @rodolforg
    Contributor

    Yes I can see it too. But, somehow, not that problematic path on apple.sifz

  17. AnishGG commented on Jan 28, 2021

    @AnishGG
    Member

    But, somehow, not that problematic path on apple.sifz

    So, for now, I will just ignore the rendering of the outlines with a single vertex?

    To make Lottie exporter behave in an exact way(make a dot-like structure), I need to understand where is it rendering the dot in Synfig code. Can someone help with this?
    I am using somewhat old code of Synfig(non-optimized, but does not affect Lottie export): https://github.com/synfig/synfig/blob/678cc3a7b1208fcca18c8b54a29a20576c499927/synfig-core/src/modules/mod_geometry/outline.cpp

  18. rodolforg commented on Feb 18, 2021

    @rodolforg
    Contributor

    Sorry for the delay @AnishGG
    I don't understand exactly what you asked.

    The Layer_Outline is based on Layer_Shape.
    Layer_Shape define its shape by its member variable contour, that is built by methods like void Layer_Shape::move_to(Real x, Real y) and void Layer_Shape::line_to(Real x, Real y) for example.

    void Layer_Shape::line_to(Real x, Real y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions