How to run a code written in PYTHON in iclone 8


https://forum.reallusion.com/Topic529010.aspx
Print Topic | Close Window

By yorgon - 3 Years Ago
I don't know about coding, how can I run a ready-made code block in iclone 8. can you please explain step by step?
By wires - 3 Years Ago
Copy the folder containing the completed Python files to C:\Program Files\Reallusion\iClone 8\Bin64\OpenPlugin. On start-up iClone will attempt to load the Main.py or Main.pdy depending on how the files have been compiled.
By yorgon - 3 Years Ago
There is no main.pdy file, only lines of code, where do we copy and paste it, 
By wires - 3 Years Ago
I seriously suggest that you read this post, follow the links within it and read all the other posts in the thread to understand about using Python in iClone. For your own purposes it would help learning Python, or at least asking the person who wrote the script to figure out how to get it to work in iClone.

Just out of curiosity, what is the intended purpose of the script?
By wires - 3 Years Ago
One thing that you can try is the "Load Python" option.

Under the Script menu first click on "Console Log" once that is loaded select "Load Python" from the menu. From the window that opens navigate to the Python file and select it. If there are any any errors they will be shown in the Console Log panel that you loaded.

https://forum.reallusion.com/uploads/images/68f711dd-617f-4a88-8aca-ace0.png


By yorgon - 3 Years Ago
I watched a video on reallusion's site, in that video, when you type the code, the animation happens, but I can't find this tutorial right now. Do you have any information about this?
By wires - 3 Years Ago
Using the search option on YouTube turned up this list of video playlists in iClone. You can go through them and see if you find what you are looking for. You can also read the information herehere and here
By yorgon - 3 Years Ago
the question I want to ask is exactly this, I want to paste the following code in the script section in iclone and run it, but how will it be? can you help the administrator? how can we paste and run lines of code like this.
It works very easily in the blender program when you paste the code, it doesn't work in iclone.
can you explain with an example video?
Here is the code:
# Import the necessary modules
from iclone import get_active_project
from iclone.global_functions import add_box_actor
from iclone.global_functions import move_actor
# Get the active project
project = get_active_project()
# Add 4 box actors to the project
box1 = add_box_actor(project, "Box1")
box2 = add_box_actor(project, "Box2")
box3 = add_box_actor(project, "Box3")
box4 = add_box_actor(project, "Box4")
# Set the initial positions of the boxes
move_actor(box1, 0, 10, 0)
move_actor(box2, 5, 10, 0)
move_actor(box3, -5, 10, 0)
move_actor(box4, 0, 10, 5)
# Set the jumping animation for the boxes
jump_animation = project.animation_library.get("Jump")
box1.animation_mixer.add_clip(jump_animation)
box2.animation_mixer.add_clip(jump_animation)
box3.animation_mixer.add_clip(jump_animation)
box4.animation_mixer.add_clip(jump_animation)
# Play the jumping animation
box1.animation_mixer.play()
box2.animation_mixer.play()
box3.animation_mixer.play()
box4.animation_mixer.play()