Profile Picture

Frame index offset

Posted By RobertoColombo 5 Years Ago
You don't have permission to rate!
Author
Message
RobertoColombo
RobertoColombo
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K, Visits: 3.0K
Hi RL,

in order to verify my finding, I am using the code provided at http://manual.reallusion.com/iClone/script/python/md_docs__way_to_control_prop.html 
I simplified the prop positioning with just a set of the X=100 at frame 1.
What happens when executed ? The prop has the X=100 at frame 2 !!
Therefore I did not find a way to set a key at frame 1...

Any hints ?

Here is the code:

import os, RLPy, math
from winreg import *

#-- Get iClone 7 default template path --#
Registry = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
RawKey = OpenKey(Registry, r"SOFTWARE\Reallusion\iClone\7.0")
ic_template_path = os.path.abspath(QueryValueEx(RawKey, "Template Data" )[0])

#-- Load Box_001.iProp --#
RLPy.RFileIO.LoadFile(ic_template_path + "//iClone Template//Props//3D Blocks//Box_001.iProp")

#-- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box_001")

#-- Get Transform Control and Data --#
ts_control = prop.GetControl("Transform")
ts_data_block = ts_control.GetDataBlock()

#-- Set X transform Key to 100 at frame 1 --#
ts_data_block.SetData("Position/PositionX", RLPy.RTime.IndexedFrameTime(1, RLPy.RGlobal.GetFps()), RLPy.RVariant(100))


My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12

gordryd
gordryd
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)Distinguished Member (4.6K reputation)

Group: Forum Members
Last Active: Last Week
Posts: 711, Visits: 7.6K
What happens if you set it to Frame 0?

Reallusion Certified Director / Reallusion Best Visual Award / Reallusion Certified Content Developer
See all the G-Tools Plug-Ins available for iClone here: G-Tools Plug-Ins


Johnny (RL)
Johnny (RL)
Posted 5 Years Ago
View Quick Profile
Junior Member

Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)Junior Member (180 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 17, Visits: 645
Hi,

The time using in API is starting from 0, and should be decremented by 1 when retrieving the frame value from the UI.
RLPy.RTime.IndexedFrameTime(frame_on_UI - 1, RLPy.RGlobal.GetFps())
Edited
5 Years Ago by cryang
RobertoColombo
RobertoColombo
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K, Visits: 3.0K
gordryd (1/16/2019)
What happens if you set it to Frame 0?

That`s the first thing I tried: the key frame 1 does not report the updated X value...

EIDT: ok, I tried again and that's what really happens.

The prop is moved but thr Modify window (F6) does not reports the correct X displacement.
It does only after Play is pressed at least once.
That's what cheated me because I had teh preview window without Grid and just relied on the X value in the Modify window.

So, now the question for RL are:

1. is it correct that the Modify window data is not updated ?
2. Because the Frame index in the timeline starts from 1, in my opinion, th eshift should be done seamlessly within the time to frame conversion routines.
    Can you plan also this update ? It iust not a big issue, obviously, but the API code should refer to what we see, i.e. frame numbering starting from 1.
    Anyway, it is something today not documented...

  Roberto



My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12

Edited
5 Years Ago by RobertoColombo
dogged2003
dogged2003
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 418, Visits: 4.5K
RobertoColombo
Edit: without play (RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(20))) screenshot is wrong.
Yesterday I completely reinstalled iClone. And your code works correctly. The key is set in the first frame.
https://forum.reallusion.com/uploads/images/166cb11d-a592-4a6e-ac9c-c324.jpg

Try make full reinstall iClone.


My YouTube channel.
Edited
5 Years Ago by dogged2003
The-any-Key
The-any-Key
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)

Group: Forum Members
Last Active: 2 Weeks Ago
Posts: 356, Visits: 1.9K
Isn't it better to design using time instead of frames? So you can just set it at time 0. And if you need another "frame" you can just frame_you_need*RLPy.RGlobal.GetFps()

# Add first key
RLPy.RTime(0)

# Add at other frame
fps=RLPy.RGlobal.GetFps()
# frame count start at 0
frame=1
RLPy.RTime(frame*fps)




iClone 7, 3DXchange 7 Pipeline, CC3 Pipeline, CT8 Pipeline, Iray, Live Face, iPhone Xr, Win 10, i9 9900K ~5GHz, Nvidia RTX 2080 8GB, 16GB Ram, M.2 SSD
Edited
5 Years Ago by The-any-Key
RobertoColombo
RobertoColombo
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K, Visits: 3.0K
Hi,

it depends.
Both ways can have a meaning.
For exmaple, the videos that I usually make (here is an example: https://forum.reallusion.com/400937/Drifting) shall be synced on a chropma-keyed video and I work on frame index, i.e. I do not care about time, only what shall be the exact frame.
Anyway, IMO the shift of the index shall be done under-the-hood: time starts from 0, frames (at least on the Timeline) starts from 1.
Anyway, not a big issue...once it is documented (the available doc shall really be impoved... so much missing...)

  Roberto

My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12

Edited
5 Years Ago by RobertoColombo
RobertoColombo
RobertoColombo
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K, Visits: 3.0K
dogged2003 (1/16/2019)
RobertoColombo
Yesterday I completely reinstalled iClone. And your code works correctly. The key is set in the first frame.
https://forum.reallusion.com/uploads/images/166cb11d-a592-4a6e-ac9c-c324.jpg

Try make full reinstall iClone.


Hi,

pls, see my FULL reply above with the UPDATED section.

Regards

  Roberto



My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12

dogged2003
dogged2003
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)Distinguished Member (5.2K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 418, Visits: 4.5K
I’ve played around.
0 eq 1 frame
1 eq 2 frame
Try adding (as is in doc):

RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(20))

And see True! Wow

P.S. 
Did not see the latest posts.

P.P.S. It seems to me that the RL programmers came from C ++. Because of this, we see not Python, but C ++ in Python. Hehe


My YouTube channel.
Edited
5 Years Ago by dogged2003
luke (RL)
luke (RL)
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)Distinguished Member (1.3K reputation)

Group: Power Developer
Last Active: Last Week
Posts: 245, Visits: 5.3K

1. is it correct that the Modify window data is not updated ?

Yes, because of update the display value in modify panel or timeline will cause performance issue (getting slow) so all the values or UI will not update until you press the "Play" button.

2. Because the Frame index in the timeline starts from 1, in my opinion, the shift should be done seamlessly within the time to frame conversion routines.
    Can you plan also this update ? It just not a big issue, obviously, but the API code should refer to what we see, i.e. frame numbering starting from 1.
    Anyway, it is something today not documented...

hmm, we will discuss it internally, except the frame, there are many differences between core value and display value. I'm not sure it's a huge effort for us or not to make it the same. So I can't give you a solid answer now.




Reading This Topic