Profile Picture

X-Mirror / Invert Clip Script

Posted By 4u2ges 4 Years Ago
Rated 5 stars based on 4 votes.
Author
Message
4u2ges
4u2ges
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 5.0K, Visits: 15.9K
I actually have 2 scripts to present. They both are based on Pose Manager plugin script, but they work differently.
Both have about 99% mirror/invert precision. Both are slow (thought second script is twice as fast compare to first).

The problem I was facing here is with Set and Get data. Get data works with Scene time, Set data works with Clip Time.
Conversion Time to Frame and vice versa (which requires an extreme precision in this case), goes out of wack.
You guys may take a look at it and see if you can facilitate routines and make it faster. I did my best to make it working.

Before running scripts make sure to check every option in Animation > Motion Settings Options.

Invert_Clip.py - Mirrors the clip from one avatar to another.
* You have to have 2 avatars in the scene (spread them apart by X for best visual).
* Make sure avatars do not have a clips at frame 1. By default they do. So delete clip at first frame.
* Open script in an editor and specify 2 avatar names at the top. You may change clip_step from 1 to 2, or 3.
   Higher number makes the script to run faster. Number indicates how frequently to insert a clip. 1 - every frame, 2 every second frame, etc.
   Experiment to see if the high number of steps is acceptable for your clip.
* Add a clip to the avatar you specified first (clip does not have to start at frame 1)
* Load script and wait Whistling (go have a coffee or something...) With clip_step = 1, 10 seconds clip would take about 4 minutes to mirror.

At the end the second avatar should be assigned a mirrored clip for every frame (if clip_step = 1)
DO NOT attempt to merge those clips, nor Flatten them (that would invalidate them). Use Collect Clip and Add Motion to Library.
What interesting about this method is, that at the end, Mirrored clips are 100% match the original (you may use Orthogonal camera to verify).
However, when you use Collect Clip, save and add the resulted clip back to the timeline, there is a barely noticeable mismatch (no idea why...).

Invert_Clip2.py - creates a Mirrored clip to the right from the original for the same avatar.
* Load an avatar and delete a clip at frame 1.
* Optional: Open script in an editor and change clip_step value.   
   Higher number makes the script to run faster. Number indicates how frequently to insert a frame into the inverted clip. 1 - every frame, 2 every second frame, etc.
   Experiment to see if the high number of steps is acceptable for your clip. clip_offset specifies how far apart should mirrored clip be located from the original (default is 20 frames).
* Add a clip to the avatar (clip does not have to start at first frame).  Important: make sure you have enough frames at the timeline for the mirrored clip.
* Make sure avatar is selected, load script and wait. This one is faster. 10 sec clip mirrored in about 1.5 minute with clip_step = 1
At the end a single mirrored clip should be created to the right from the original. As with first script, DO NOT attempt to flatten mirrored clip. You may use Collect Clip and Add to Motion Library.
Or save the clip, add it back to the timeline, Now you may flatten it and save again.
This script is also produces a mirrored clip with barely noticeable difference for the original.

Here is a video for creating invert clip with Invert_Clip2.py (I cut out the script running time)



Feel free to comment, ask questions, customize / modify / add UI, or write your own script/plugin and share.




Update: Invert_CLip2.py was updated to force Avatar selection. If you did not select an Avatar you would get a friendly reminder.




Attachments
Invert.zip (572 views, 2.00 KB)
Edited
2 Years Ago by 4u2ges
wires
wires
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)Distinguished Member (15.0K reputation)

Group: Forum Members
Last Active: 3 days ago
Posts: 5.7K, Visits: 26.4K
Brilliant work again Gurgen, now all that we need is a Nobel Prize for iClone tip creators. CoolSmooooth

Gerry



System: Win 10 Pro (21H2), Asus X99-E WS, CPU i7-5930K -3,5 GHz, 32 GB DDR4 2666-16 RAM, NVidia GTX 1080 Ti GPU - 11 GB VRAM(Driver Studio-536.99), Samsung 850 Pro 512 GB SSD, 6 TB HD storage.


4u2ges
4u2ges
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 5.0K, Visits: 15.9K
https://forum.reallusion.com/uploads/images/ccb41ad6-62fd-441f-94a1-242b.png



Rampa
Rampa
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)

Group: Forum Members
Last Active: 8 hours ago
Posts: 8.1K, Visits: 60.5K
Great work Gurgen! Smile

I am happy to see this finally get a method inside iClone.
4u2ges
4u2ges
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 5.0K, Visits: 15.9K
Thanks Rampa Smile




Rampa
Rampa
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)

Group: Forum Members
Last Active: 8 hours ago
Posts: 8.1K, Visits: 60.5K
Is it quick and easy to add some code to automatically grab the character name, for the second version? That way only the step value would ever need changing, and we could just go with the defaults, usually.
4u2ges
4u2ges
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 5.0K, Visits: 15.9K
Yes, it sure is. I will update...




4u2ges
4u2ges
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)Distinguished Member (20.6K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 5.0K, Visits: 15.9K
Updated to have second script to force avatar selection.




Kelleytoons
Kelleytoons
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)Distinguished Member (35.6K reputation)

Group: Forum Members
Last Active: 2 hours ago
Posts: 9.1K, Visits: 21.8K
Glad you did this, Mr. G, sure saves me (to show you how little time I have right now, I can't even check this out.  Perhaps in a week or two).



Alienware Aurora R12, Win 10, i9-119000KF, 3.5GHz CPU, 128GB RAM, RTX 3090 (24GB), Samsung 960 Pro 4TB M-2 SSD, TB+ Disk space
Mike "ex-genius" Kelley
Rampa
Rampa
Posted 4 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)Distinguished Member (35.8K reputation)

Group: Forum Members
Last Active: 8 hours ago
Posts: 8.1K, Visits: 60.5K
Works pretty great! Smile That has been wanted for a long time.



Reading This Topic