I’m trying to do a few simple things with API but it seems that most of online samples are for iClone 7 while I’m using iClone 8. Documentation is also not always helping so I’m hoping someone here could provide advice for these few things I’m trying to do.
How to manipulate the scene’s avatar Transform properly at frame 0? I assume it has something to do with DataBlock but I failed to update it
Add/manipulate a scene prop so it gets attached to the scene’s avatar
Change render frames for RenderVideo. Or is that always hardcoded to 60?
For avatar transform at frame 0, use GetControl("Transform") , create an RTransformKey , and call AddKey(key, RGlobal.GetFps()) .
For attaching a prop, SetParent(avatar) is the correct basic parenting operation. Then set the prop’s local transform if you need an offset relative to the avatar.
RenderVideo() is not fixed to 60 frames. The frame range is controlled by the start_time and end_time arguments you pass in.
import RLPy
import os
import sys
import tempfile
rl_plugin_info = {"ap": "iClone", "ap_version": "8.0"}
def run_script():
# 1. manipulate the scene’s avatar Transform properly at frame 0
avatar_list = RLPy.RScene.GetAvatars()
if len(avatar_list) == 0:
print ("please load an avatar first.")
return
avatar = avatar_list[0]
print (avatar.GetName())
transform_control = avatar.GetControl("Transform")
transform_db = transform_control.GetDataBlock()
trans = avatar.LocalTransform()
trans.T().SetX(100)
trans.R().SetX(0.2588)
trans.R().SetW(0.9659)
time_obj = RLPy.RTime.FromValue(0)
key_frame = RLPy.RTransformKey()
key_frame.SetTime(time_obj)
key_frame.SetTransform(trans)
transform_control.AddKey(key_frame)
transform_control.SetKeyTransition(time_obj, RLPy.ETransitionType_Linear, 1.0)
RLPy.RGlobal.ObjectModified(avatar, RLPy.EObjectModifiedType_Transform|RLPy.EObjectModifiedType_Attribute|RLPy.EObjectModifiedType_Motion)
# 2. attach a prop to the avatar
prop_list = RLPy.RScene.GetProps()
if len(prop_list) <= 1:
print ("please load a prop first.")
return
prop = prop_list[1]
print (prop.GetName())
ret = prop.SetParent(avatar)
# 3.Change render frames for RenderVideo
excute_parent_path = os.path.abspath(os.path.join(sys.executable, os.pardir))
temp_dir = tempfile.gettempdir()
filePath = temp_dir + "//Test.mp4"
srt_time = RLPy.IndexedFrameTime(0, RLPy.RGlobal.GetFps())
end_time = RLPy.IndexedFrameTime(60, RLPy.RGlobal.GetFps())
result = RLPy.RGlobal.RenderVideo(srt_time, end_time, filePath)
I tested the RenderImageSequence API on our side, and the output result appears to be the same as rendering from the Render panel with Image and Sequence selected. I did not see the 15% vertical squash issue in the rendered output.
import RLPy
Could you please provide more details about the issue you are seeing with RenderImageSequence in iClone 9?
Once we have the screenshots and sample rendered files, we can investigate the issue more accurately.
Hi Johnny, thank you very much for your helpful insight!
After I followed your instructions on a brand new project, the squashing disappeared and everything rendered proportionally. However, I manged to pinpoint the exact cause of the earlier issue.
Whenever I use any other Frame Size besides HD 1080, Ultra HD or Custom (set at those two), the output render gets somehow squashed / distorted. I’m specifically using Custom 4:3 640x480 for my sequenced renderer and it’s rendering squashed files.
No issues at all if I just use RenderImage but that one’s very slow since I have to jump every frame and it seems to be internally “restarting the system” so it takes a while to finish.