Copying layer structure on to an existing layer

Please use this part to report bugs & errors, ask questions & "How to..."
Post Reply
Yddari
Posts: 3
Joined: 15 Nov 2018, 18:05

Copying layer structure on to an existing layer

Post by Yddari » 04 Mar 2019, 16:26

Hello everyone

This is my first post on the forum but I have used it a lot to help me learn TVPaint over the last few months, so thank you! I have searched for the answer to this on the forum but I couldn't find anything. If the topic already exists, I would really appreciate a link so I can read up.

I am wondering if there is a way to copy a layer's structure on to an existing layer and deleting all frames that do not hit an instance head.
I am running some of my layers through a process in a different program to achieve an effect. The other program does not have the exposure information so when I import the layer back into TVPaint, the layer is on 1s.
Here is a visual of the original layer in red, and the output in blue:
Layer_Structure.PNG
Layer_Structure.PNG (6.09 KiB) Viewed 2423 times
The extra frames are unnecessary and are starting to cause problems. Is there a way to delete out the unneeded frames in the blue layer other than manually adjusting the layer?
I have quite a lot of material to process this way so doing it manually is not really an option I want to use. Any insight on this would be really helpful.

Thank you!

User avatar
slowtiger
Posts: 2346
Joined: 08 May 2008, 21:10
Location: berlin, germany
Contact:

Re: Copying layer structure on to an existing layer

Post by slowtiger » 04 Mar 2019, 17:06

Look up "recompute instances" in the manual.
TVP 10.0.18, Mac Pro Quadcore 3 GHz, 16 GB RAM, OS 10.11, QT 7.7.3

Yddari
Posts: 3
Joined: 15 Nov 2018, 18:05

Re: Copying layer structure on to an existing layer

Post by Yddari » 04 Mar 2019, 18:09

slowtiger wrote:
04 Mar 2019, 17:06
Look up "recompute instances" in the manual.
Thank you for your quick response.

I tried using Recompute Exposures but no matter what number I put in as a threshold it either did nothing or deleted every frame after the first.
The outside process seems to be making some imperceptible (to me) changes on every frame so TVPaint counts them all as different, and for some reason the Recompute Exposures does not pick up on the actual changes in the animation.

User avatar
slowtiger
Posts: 2346
Joined: 08 May 2008, 21:10
Location: berlin, germany
Contact:

Re: Copying layer structure on to an existing layer

Post by slowtiger » 04 Mar 2019, 18:42

In that case maybe a script could help - something like "take structure from layer X and apply it to layer Y" - but that's outside my abilities.
TVP 10.0.18, Mac Pro Quadcore 3 GHz, 16 GB RAM, OS 10.11, QT 7.7.3

Yddari
Posts: 3
Joined: 15 Nov 2018, 18:05

Re: Copying layer structure on to an existing layer

Post by Yddari » 04 Mar 2019, 19:04

slowtiger wrote:
04 Mar 2019, 18:42
In that case maybe a script could help - something like "take structure from layer X and apply it to layer Y" - but that's outside my abilities.
You're probably right, I suspected that might be the case anyway. I have someone who can script for me so I'll be able to figure something out, but I just wanted to make sure there wasn't something obvious I was missing (I was, it just didn't solve this particular problem)

Thank you so much for the responses and for teaching me about a feature I didn't know about!

Svengali
Posts: 1250
Joined: 28 Dec 2006, 10:08
Contact:

Re: Copying layer structure on to an existing layer

Post by Svengali » 04 Mar 2019, 23:18

Hey, this might do the trick.
Spoiler : :

Code: Select all

ExposureString = ""

Menu = "=== MatchExposures ===|1. Create master Head&Exposure list from current layer|2. Apply master Head&Exposure list to current layer|Cancel"
tv_ListRequest Menu
parse result Reply d

IF Reply == 0 || Reply == 3
	EXIT
END
tv_UndoOpenStack
IF Reply == 1
	tv_LayerCurrentID
	LayerID = result
	tv_LayerInfo LayerID
	parse result  d d d d d FrameStart FrameEnd d
	FOR i = FrameStart TO FrameEnd
		tv_ExposureInfo i
		FrameInfo = result
		IF CMP(FrameInfo,"head")
			Frame = 1
		ELSE
			Frame = 0
		END
		ExposureString = ExposureString""Frame
	END
	tv_WriteUserString "MatchExposures" "ExpString" ExposureString
	tv_warn "ExposureString = " ExposureString
END

IF Reply == 2
	tv_ReadUserString "MatchExposures" "ExpString" 
	ExposureString = result
	TotalFrames = LEN(ExposureString)
	tv_LayerCurrentID
	LayerID = result
	tv_LayerInfo LayerID
	parse result d d d d d FrameStart FrameEnd d
	FOR i = FrameStart TO FrameEnd
		tv_LayerImage i
		FrameNo = i + 1
		FrameType = CUT(ExposureString,FrameNo,FrameNo)
		IF CMP(FrameType,"1")
			FrameTypeName = "head"
			tv_ImagePush
		ELSE
			FrameTypeName = "exposure"
			tv_ImagePop
			tv_ImagePush
		END
	END
	tv_ImagePop
	tv_LayerRecomputeExposure LayerID FrameStart FrameStop
END
tv_UndoCloseStack
How to use:
Open the Spoiler window, SelectAll and copy the script.
Create a new action button and embed (paste) the script.

For the original layer of the project:
* select the original layer.
* click button and choose menu option 1 (which encodes the head frames/exposure frames information into a string and stores it).

For the processed layer of project:
* process the layer externally using your other software, then reimport it.
* select the imported layer.
* click button and choose menu option 2(which reads the encoded head frame/exposure frame info and applies it to the processed (current) layer.
* result, same heads/exposures as the original layer.

How it works:
* menu option one encodes a string where a 1 represents each head and a 0 represents each exposure.
* menu option two reads the string back.
* If it finds a 1, it pushes the appropriate head frame to an image stack.
* If it finds a 0, it pops a copy of the head frame image from stack to the appropriate exposure frame.
* finally, it processes the layer using the LayerRecomputeExposure operation, turning each duplicate frame into an exposure.

Sven
Desktop: tvp Pro 11.0.9-64bit, Win8.1 - 24GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.36-1
Android Tablet: release 11, Samsung Galaxy Note10.1 - 32GB internal - microSD 32GB

Post Reply