Bug 145010 - Invisible animations in Impress
Summary: Invisible animations in Impress
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
6.1.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Object-Animations
  Show dependency treegraph
 
Reported: 2021-10-08 21:01 UTC by ns-libreoffice-91934
Modified: 2023-06-02 18:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example with an invisible animation between the first and the second visible ones (286.98 KB, application/vnd.oasis.opendocument.presentation)
2021-10-09 06:20 UTC, ns-libreoffice-91934
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ns-libreoffice-91934 2021-10-08 21:01:21 UTC
I am seeing weird behavior in Impress which can be best explained with invisible animations, i.e. animations that exist but are not shown in the animation list and don’t have a visible effect during presentation.

What I did

- I created a couple of slides
- and added Fade In animation for the text fields.
- Then I copied all the slides and adjusted the animations (from “On Click” to “With Previous” and adjustments for Delays etc.).
- Finally I saved the file and opened it again.

What I observe

1. Many of my animations on the text bodies were gone, i.e. the text was immediately visible in presentation mode.
2. So I created the animations again. But when shifting them in the order, there seems to be an invisible element in the list which I have to pass. What do I mean with this:
   I have animations A, B and C (in this order), and I want to shift C above B. To achieve this, I have to click “Move Up” twice. I can move B above A with another “Move Up”, so it is not a general problem. It is the same when moving it back down: I can move B below A with one “Move Down”, and need two more “Move Downs” to move B below C. There seems to be an invisible animation item in the list above C!
3. During presentation, I have to click once after the B animation, and one more time to start C. So this invisible animation seems to start On Click, but there is nothing that happens.
Comment 1 ns-libreoffice-91934 2021-10-08 21:31:27 UTC
I upgraded to version 7.0.4 and the issue is still the same.
Comment 2 Regina Henschel 2021-10-09 00:17:08 UTC
Please attach a presentation that has the described problems.
Comment 3 ns-libreoffice-91934 2021-10-09 06:20:50 UTC
Created attachment 175608 [details]
Example with an invisible animation between the first and the second visible ones
Comment 4 Regina Henschel 2021-10-09 11:39:31 UTC
That invisible animation node exists in fact in the file. It has no object assigned. You could delete this node in the file.

I think, that the issue is here, that LibreOffice does only show animation nodes with assigned object and that is has no tool to clean up the animation tree.
Comment 5 ns-libreoffice-91934 2021-10-09 20:53:58 UTC
That sounds reasonable. Thanks for looking into this!

Can you point me to something how I can read and write ODP files in python? I tried to open it as ZipFile, but to save it again with a modified contents.xml I have to copy all other content to a new ZipFile, and I am not able to read all files (I get "Bad magic number for file header" errors for some files line "Configurations2/accelerator/current.xml" and Pictures).
Comment 6 Regina Henschel 2021-10-09 21:22:52 UTC
(In reply to ns-libreoffice-91934 from comment #5)
> Can you point me to something how I can read and write ODP files in python?
> I tried to open it as ZipFile, but to save it again with a modified
> contents.xml I have to copy all other content to a new ZipFile, and I am not
> able to read all files (I get "Bad magic number for file header" errors for
> some files line "Configurations2/accelerator/current.xml" and Pictures).

I cannot help with python. But perhaps this description helps already:
https://wiki.documentfoundation.org/WikiAction/edit/Documentation/ODF_Markup?section=3

To get help on python with LibreOffice you can use any of our support channels: https://www.libreoffice.org/get-help/community-support/
or try a forum:
https://wiki.documentfoundation.org/Website/Unofficial_Community_Pages
Comment 7 ns-libreoffice-91934 2021-10-12 17:13:19 UTC
Thank you! I didn't know about the flat file format. I could use it to repair my presentation:

```
    import lxml.etree as ET
    
    ns = {
        "smil":         "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0",
        "anim":         "urn:oasis:names:tc:opendocument:xmlns:animation:1.0",
    }
    
    path_in  = "Quiz1.fodp"
    path_out = "Quiz2.fodp"
    
    # parse fodp as xml
    with open(path_in, "rb") as odp:
        root = ET.fromstring(odp.read())
    
    # find damaged animations
    setsWithoutTarget = root.xpath("//anim:set[not(@smil:targetElement)]", namespaces=ns)
    setsWithoutTarget.extend(root.xpath("//anim:animateColor[not(@smil:targetElement)]", namespaces=ns))
    
    # remove these nodes
    for set in setsWithoutTarget:
        parent = set.getparent()
        while len(parent.getchildren()) == 1:
            parent = parent.getparent()
        parent.getparent().remove(parent)
    
    # write new fodp
    with open(path_out, "w") as odp:
        odp.write('<?xml version="1.0" encoding="UTF-8"?>\n\n')
        odp.write(ET.tostring(root, encoding="unicode", pretty_print=True))
```

It would be good if Impress would automatically remove such invalid animations, but it would be even better if these animations wouldn't be created at all ;)