# Issues with imported file and canvas (Time Offset and Speed)

**URL:** https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406
**Category:** Debugging
**Created:** [July 21, 2021, 12:08pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406 "2021-07-21T12:08:54Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)
#### Post date: [July 21, 2021, 12:08pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/1 "2021-07-21T12:08:54Z")

</div>

Synfig crashes when trying to import a file into itself.

To reproduce:

Create a file  
Save the file  
Within the same file, Go to file import and select the same file.  
Synfig crashes

Expected  
Do not allow to import a file into itself (Display a message not to import the file into itself)

I know that it is a stupid idea to import a file into itself. I just wanted to see what happens (I thought I would get infinite canvas within each other 😅)

---

<div class="post-metadata">

### Author: ![Khemardi](https://forums.synfig.org/user_avatar/forums.synfig.org/khemardi/32/8668_2.png) [@Khemardi](https://forums.synfig.org/u/Khemardi)
#### Post date: [July 21, 2021, 12:54pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/2 "2021-07-21T12:54:28Z")

</div>

lol, I see you have a lot of time on your hands. xD

---

<div class="post-metadata">

### Author: ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)
#### Post date: [July 21, 2021, 2:03pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/3 "2021-07-21T14:03:52Z")

</div>

> [@veermetri05](#):
>
> I know that it is a stupid idea to import a file into itself. I just wanted to see what happens (I thought I would get infinite canvas within each other 😅)

I thought you did it by mistake lol

---

<div class="post-metadata">

### Author: ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)
#### Post date: [July 21, 2021, 2:10pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/4 "2021-07-21T14:10:08Z")

</div>

Feature for creating precomp and using it in Synfig is great but it has some issues and I did figure out some workarounds too.

The problem is with Time Offset  
Normally, I expected that when we put an offset of 10f all the keyframes of that canvas/group should move 10f ahead, but Synfig moves it backward. So the workaround is simple just put -10f and it will move it 10 frames forward. This is not an issue at all but I do think that offset should move it in forward time.

Another issue is also related to Time offset.

**When nested precomp/canvas, time offset stops working.**

For example, I have some animation in file comp1.sifz,  
then I import that into “comp2.sifz” and so on till comp5.sifz. Now, let “comp5.sifz” have 2 “comp4.sifz”, so when I change the time offset of one of the “comp4.sifz” nothing occurs. But if I disable one of the 2 “comp4.sifz” and the time offset of the other is set to for example 10f then it will work. Initially, I thought that this was a problem with the preview. I tried to render the frame but it doesn’t do anything different.

So a workaround for this is every time you import a file more than once create a new directory and copy all the files below that level for example you want “comp4.sifz” twice in your “comp5.sifz”. The copy “comp4.sifz” with all its inner child precomps i.e. comp1, comp2, comp3. Into a separate folder and then import them into “comp5.sifz”. By doing this the time offset will work, but this completely dismisses the use of precomps in the first place. So for example I need to edit some small animation in “comp1.sifz”. I have to go to all comp1 in all folder to achieve that.

(Also I have tried making comp1 common and then have comp2, comp3, comp4 into different directory but somehow the renderer detects them as same thing and in fact they are same thing, and the time offset doesn’t work )

Take a look at the file from

> [@Animation in Synfig | Micro Animation by me \[project files included\]](https://forums.synfig.org/t/animation-in-synfig-micro-animation-by-me-project-files-included/12092/73):
>
> [[image] ](https://i.imgur.com/o43G0Ef.gif)[CompMagic.zip](https://forums.synfig.org/uploads/short-url/vUHg9cvkNt3DfAcakxPazoQ26rI.zip) (160.1 KB) 54th animation of 100 animations.

Everything works fine in that example.  
Here is the time offset doesn’t work, open comp5 and try disable a layer and changing the offset.

[CompMagic (TimeOffset).zip](https://forums.synfig.org/uploads/short-url/AhUlp29UY8EWpyegInDtINaoeBH.zip) (12.6 KB)

---

<div class="post-metadata">

### Author: ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)
#### Post date: [July 21, 2021, 6:38pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/5 "2021-07-21T18:38:18Z")

</div>

Please take a look at Duplicate layer 🙂 It can help you to quadruplicate the rectangle corner you animated, by using its exported value named “Index” to rotate the group.

Regarding the time offset, I’ll try to take a look later. If I or anyone else don’t answer you, please file the issue on our Github repository.

---

<div class="post-metadata">

### Author: ![BobSynfig](https://forums.synfig.org/user_avatar/forums.synfig.org/bobsynfig/32/175_2.png) [@BobSynfig](https://forums.synfig.org/u/BobSynfig)
#### Post date: [July 26, 2021, 1:16pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/6 "2021-07-26T13:16:37Z")

</div>

> [@veermetri05](#):
>
> I know that it is a stupid idea to import a file into itself. I just wanted to see what happens (I thought I would get infinite canvas within each other 😅)

![](https://media.giphy.com/media/26CaL75EXGMsOx0yI/giphy-downsized.gif)

😛

---

<div class="post-metadata">

### Author: ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)
#### Post date: [July 26, 2021, 1:34pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/7 "2021-07-26T13:34:29Z")

</div>

> [@veermetri05](#):
>
> Synfig crashes when trying to import a file into itself.

Fixed on master branch 🙂 [[Studio] Fixed a crash when trying to import a file into itself by rodolforg · Pull Request #2239 · synfig/synfig · GitHub](https://github.com/synfig/synfig/pull/2239)

---

<div class="post-metadata">

### Author: ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)
#### Post date: [July 26, 2021, 4:05pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/8 "2021-07-26T16:05:48Z")

</div>

> [@BobSynfig](#):
>
> ![](https://media.giphy.com/media/26CaL75EXGMsOx0yI/giphy-downsized.gif)

Something like that 😄

@rodolforg anything about the Time Offset issue?

---

<div class="post-metadata">

### Author: ![Kai](https://forums.synfig.org/user_avatar/forums.synfig.org/kai/32/5124_2.png) [@Kai](https://forums.synfig.org/u/Kai)
#### Post date: [July 26, 2021, 4:50pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/9 "2021-07-26T16:50:06Z")

</div>

I think the time offset feature works as it was intended.  
[Rescale Animations - Synfig Animation Studio](https://wiki.synfig.org/Doc:Rescale_Animations)

---

<div class="post-metadata">

### Author: ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)
#### Post date: [July 26, 2021, 5:12pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/10 "2021-07-26T17:12:03Z")

</div>

> [@Kai](#):
>
> I think the time offset feature works as it was intended.

I don’t understand.

The issue is Time Offset parameter of Group layer stops working if a file(B.sif) has imported other file (A.sif) more than once, then Time Offset stops working. Also deactivating a layer will make a time offset work (if you disable layer at the top, then the time offset will work for layer below it, if both the layers are activated the time offset of the topmost level is only considered and offset of other layers is ignored).

Steps to reproduce:  
Create a file with basic animation (A.sif)  
Import in another file (B.sif), import again the same file (A.sif) or duplicate the imported layer.  
Change time offset of imported layer groups.

Try deactivating layers (you may need to move time cursor to see the effect, sometimes it don’t update the canvas properly), try changing the level of layers.

I hope this makes it clear.  
Also you can check this file

> [@veermetri05](#):
>
> Here is the time offset doesn’t work, open comp5 and try disable a layer and changing the offset.
> 
> [CompMagic (TimeOffset).zip](https://forums.synfig.org/uploads/short-url/AhUlp29UY8EWpyegInDtINaoeBH.zip) (12.6 KB)

---

<div class="post-metadata">

### Author: ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)
#### Post date: [July 26, 2021, 5:25pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/11 "2021-07-26T17:25:20Z")

</div>

> [@veermetri05](#):
>
> Something like that 😄

I suppose it can be done via exported canvas. But I didn’t try it.

> [@Kai](#):
>
> I think the time offset feature works as it was intended.

It works ok when only one instance is imported. If you import something twice (or more), if you change “time offset” or “speed” it’ll affect others too.

> [@veermetri05](#):
>
> @rodolforg anything about the Time Offset issue?

I just checked. Not so easy to solve ☹ As it is now, AFAIK Synfig loads a Canvas only once and every import refers to same Canvas object (it’s logical and ok for memory saving).  
However, `Layer_PasteCanvas::set_time_vfunc(IndependentContext context, Time time)const` will then  
change them all (as they are actually a single one) together.  
We need to think about it to find a good solution… @ice0 @KonstantinDmitriev@Keyikedalube

```c++
void
Layer_PasteCanvas::set_time_vfunc(IndependentContext context, Time time)const
{
	context.set_time(time);

	if (!sub_canvas)
		return;
	if (depth == MAX_DEPTH)
		return;
	depth_counter counter(depth);

	Real time_dilation = param_time_dilation.get(Real());
	Time time_offset = param_time_offset.get(Time());
	sub_canvas->set_time(time*time_dilation + time_offset);
}

```

---

<div class="post-metadata">

### Author: ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)
#### Post date: [July 27, 2021, 6:16am UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/12 "2021-07-27T06:16:21Z")

</div>

> [@veermetri05](#):
>
> @rodolforg anything about the Time Offset issue?

I found a workaround: export the canvas of (at least) one of imported canvas 😉

1. Import a sif file
2. Import the same sif file of step 1
3. Select one of the imported SIF in Layer Panel
4. In Parameter Panel, right-click on `canvas` parameter and select `Export Value`
5. Type a name to export it

Voilà.  
(I didn’t test it too much though)

---

<div class="post-metadata">

### Author: ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)
#### Post date: [July 27, 2021, 7:47am UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/13 "2021-07-27T07:47:32Z")

</div>

Doing this is the same as the Embed Layer option (by right-clicking the imported layer).

But it dismisses the main advantage of importing a canvas/file that is I can edit the animation in one file and then use it in many other animations, many times.

Embedding a Layer will just no longer give that advantage, I need to go to each file that has imported the animation and edit them individually, if I would like make changes.

---

<div class="post-metadata">

### Author: ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)
#### Post date: [July 27, 2021, 8:09am UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/14 "2021-07-27T08:09:14Z")

</div>

I did try it with exported canvas, the time offset and speed don’t work.

To reproduce:

1. Create an animation, group the animation (Group1)
2. Export the canvas of Group1 (canvas1)
3. Create a group and change its canvas to canvas1
4. Change the time offset/speed

The time offset and speed doesn’t work. So this problem is not only on imported layers but also for exported canvas.

I think this is a serious issue to fix.

---

<div class="post-metadata">

### Author: ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)
#### Post date: [July 27, 2021, 12:19pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/15 "2021-07-27T12:19:34Z")

</div>

Synfig has no concept of instantiation yet. 😕  
Implementing it could take a time because it could break a lot of (hidden) stuff, as we don’t have enough active people with a long-time experience with such inner code. I started to contribute in the middle of 2019. I still don’t know many things of its core.

---

<div class="post-metadata">

### Author: ![Keyikedalube](https://forums.synfig.org/user_avatar/forums.synfig.org/keyikedalube/32/7725_2.png) [@Keyikedalube](https://forums.synfig.org/u/Keyikedalube)
#### Post date: [July 27, 2021, 3:34pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/16 "2021-07-27T15:34:29Z")

</div>

> [@rodolforg](#):
>
> `Layer_PasteCanvas::set_time_vfunc(IndependentContext context, Time time)`

So that’s the final code statement that’s executed when OP duplicates (or imports) his comp layer…?

If so OP already kinda correctly answered his issue:

> [@veermetri05](#):
>
> somehow the renderer detects them as same thing and in fact they are same thing, and the time offset doesn’t work

Because his recent time offset modification to one of comp4’s canvas (actually layer) group ie., -20f is also applied for the duplicated second comp4 group layer since both of these two layer groups recursively import and point to the same child canvases instead of OP’s assumption of working on isolated canvases. That’s my logical understanding why time offset isn’t working as expected.

However, the waypoints placement displayed on the timebar for second comp4’s group time offset 0f is misleading.

BTW, I don’t know anything about precomp stuff commented above so I had to look up what that keyword means in animation. Found this awesome YouTube video [https://www.youtube.com/watch?v=9Fv3XVdTOXM](https://www.youtube.com/watch?v=9Fv3XVdTOXM) and am totally amazed by how complex and impressive animation precomps can do!

Precomposing or precomps is actually a separate feature in After Effects where canvases are actually isolated within the same file and sadly Synfig doesn’t have that feature (at least googling “Synfig precomp” didn’t lead me anywhere). Just duplicating the imported layer doesn’t create a separate canvas. That duplicated layer too is rendered on the same canvas so others suggestion for exporting a sub-canvas is a viable solution I think.

Anyway @veermetri05 impressive work 😉 I like how you creatively replicated the precomps behavior by importing each incrementing comp\*.sifz files as layers. Sorry, I can’t help much because I’m a self-taught animator and your work is waaaaay beyond my skillset.

> [@veermetri05](#):
>
> I did try it with exported canvas, the time offset and speed don’t work.

@veermetri05 did you try saving, closing, and reopening the file again after step 4? I did that and time offset changes were reflected correctly on my end.

---

<div class="post-metadata">

### Author: ![Keyikedalube](https://forums.synfig.org/user_avatar/forums.synfig.org/keyikedalube/32/7725_2.png) [@Keyikedalube](https://forums.synfig.org/u/Keyikedalube)
#### Post date: [July 27, 2021, 3:37pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/17 "2021-07-27T15:37:28Z")

</div>

> [@veermetri05](#):
>
> The problem is with Time Offset  
> Normally, I expected that when we put an offset of 10f all the keyframes of that canvas/group should move 10f ahead, but Synfig moves it backward. So the workaround is simple just put -10f and it will move it 10 frames forward. This is not an issue at all but I do think that offset should move it in forward time.

According to Synfig wiki on [Time offset parameter](https://wiki.synfig.org/Time_Offset_Parameter):

_“It brings the animation of the entire contents of the referenced layer forward by the given value. Using negative values it is possible to delay the grouped layer, too.”_

---

<div class="post-metadata">

### Author: ![Keyikedalube](https://forums.synfig.org/user_avatar/forums.synfig.org/keyikedalube/32/7725_2.png) [@Keyikedalube](https://forums.synfig.org/u/Keyikedalube)
#### Post date: [July 27, 2021, 3:53pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/18 "2021-07-27T15:53:48Z")

</div>

> [@veermetri05](#):
>
> Synfig crashes when trying to import a file into itself.

Fix for this issue just uploaded by @rodolforg a few hours ago.

> <https://github.com/synfig/synfig/pull/2243>
>
> If you try to import a file into a not-yet-saved Synfig document,
> it does nothi…ng.
> 
> Mistake made by me in
> commit 798bfbf95983ff6c01ca019ac72b390fbc259eab

---

<div class="post-metadata">

### Author: ![Kai](https://forums.synfig.org/user_avatar/forums.synfig.org/kai/32/5124_2.png) [@Kai](https://forums.synfig.org/u/Kai)
#### Post date: [August 2, 2021, 12:46pm UTC](https://forums.synfig.org/t/issues-with-imported-file-and-canvas-time-offset-and-speed/12406/19 "2021-08-02T12:46:24Z")

</div>

I’ve noticed that when I export a canvas and then duplicate that exported canvas group and try to give different time offset values to the these group, those groups act as if they have the same offset.
