OK here is the code. I hace actually created this in a folder called 00MyFirstExperriment.
I intend to keep these simple and named 01------ 02----- etc so I have something I can go back to remind me of things I might forget about
import RLPy #This is creting a reference to iClones API engine which gives us abilities to controll what iClone does through python codes
import PySide2 #This converts a 3rd party application named QT into python library functions. QT creates classic and embedded graphical user interfaces into many applications using python.
#NOTE: QT (pronounsed cute) was automatically installed when you updated iClone to 7.4 or above.
from PySide2 import * #??????? I think its importing everything in QT into this program but not sure whether my thought on that is correct yet
from PySide2.shiboken2 import wrapInstance #wrapInstance is a reference to QT's method for adding things to other programs elements. In this case to iClones Plugins menu bar.
#the way I see this is it just makes it a bit easier to reference it in the code.
#Rather than typing ic_dlg = PySide2.shiboken2.wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow)
# we can just type ic_dlg = wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow)
def initialize_plugin():
createAllTheAnimationOptions() #I did it this way to make it easier to follow what the code is doing. Its my style.
createAllThePropControlOptions() #I did it this way to make it easier to follow what the code is doing. Its my style.
createAllTheiCloneEventOptions() #I did it this way to make it easier to follow what the code is doing. Its my style.
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def createAllTheAnimationOptions():
ic_dlg = wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow) #I tried making ic_dlg a global variable but it stopped working. Going to look into that later
#First we check to see if AnimationFunctions already exists in iClones plugins menu bar and if it doesn't it gets added
AnimationFunctions = ic_dlg.menuBar().findChild(QtWidgets.QMenu, "AnimationFunctions_menu")
if (AnimationFunctions == None):
AnimationFunctions = wrapInstance(int(RLPy.RUi.AddMenu("Animation Functions", RLPy.EMenu_Plugins)), QtWidgets.QMenu)
AnimationFunctions.setObjectName("AnimationFunctions_menu")
#Second we add the Animtion functions that users can click to achieve something. Probably should be a check to see if they exist also but not doing that yet
AnimType1 = AnimationFunctions.addAction("Animation 1") #Next we create links to appear within the AnimationFunctions
AnimType1.triggered.connect(show_AnimType1) #And tell it what function to call when the user clicks it
AnimType2 = AnimationFunctions.addAction("Animation 2") #Next we create links to appear within the AnimationFunctions
AnimType2.triggered.connect(show_AnimType2) #And tell it what function to call when the user clicks it
AnimType3 = AnimationFunctions.addAction("Animation 3") #Next we create links to appear within the AnimationFunctions
AnimType3.triggered.connect(show_AnimType3) #And tell it what function to call when the user clicks it
#Here are the functions that will get called when the user clicks one of the animation links added to iclones plugins menu bar
def show_AnimType1():
RLPy.RUi.ShowMessageBox("AnimType1", "Need to figure out what AnimType1 is going to do", RLPy.EMsgButton_Ok)
def show_AnimType2():
RLPy.RUi.ShowMessageBox("AnimType2", "Need to figure out what AnimType2 is going to do", RLPy.EMsgButton_Ok)
def show_AnimType3():
RLPy.RUi.ShowMessageBox("AnimType3", "Need to figure out what AnimType3 is going to do", RLPy.EMsgButton_Ok)
#Not commenting the rest of these because they are really similar to what is done with the Animation Options
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def createAllThePropControlOptions():
ic_dlg = wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow)
PopControlFunctions = ic_dlg.menuBar().findChild(QtWidgets.QMenu, "PopControlFunctions_menu")
if (PopControlFunctions == None):
PopControlFunctions = wrapInstance(int(RLPy.RUi.AddMenu("Pop Functions", RLPy.EMenu_Plugins)), QtWidgets.QMenu)
PopControlFunctions.setObjectName("PopControlFunctions_menu")
PopType1 = PopControlFunctions.addAction("Pop Control 1")
PopType1.triggered.connect(show_PopType1)
PopType2 = PopControlFunctions.addAction("Pop Control 2")
PopType2.triggered.connect(show_PopType2)
PopType3 = PopControlFunctions.addAction("Pop Control 3")
PopType3.triggered.connect(show_PopType3)
def show_PopType1():
RLPy.RUi.ShowMessageBox("PopType1", "Need to figure out what PopControl1 is going to do", RLPy.EMsgButton_Ok)
def show_PopType2():
RLPy.RUi.ShowMessageBox("PopType2", "Need to figure out what PopControl2 is going to do", RLPy.EMsgButton_Ok)
def show_PopType3():
RLPy.RUi.ShowMessageBox("PopType3", "Need to figure out what PopControl3 is going to do", RLPy.EMsgButton_Ok)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def createAllTheiCloneEventOptions():
ic_dlg = wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow)
EventOptionFunctions = ic_dlg.menuBar().findChild(QtWidgets.QMenu, "EventOptionFunctions_menu")
if (EventOptionFunctions == None):
EventOptionFunctions = wrapInstance(int(RLPy.RUi.AddMenu("Event Functions", RLPy.EMenu_Plugins)), QtWidgets.QMenu)
EventOptionFunctions.setObjectName("EventOptionFunctions_menu")
EventOption1 = EventOptionFunctions.addAction("Event Option 1")
EventOption1.triggered.connect(show_EventOption1)
EventOption2 = EventOptionFunctions.addAction("Event Option 2")
EventOption2.triggered.connect(show_EventOption2)
EventOption3 = EventOptionFunctions.addAction("Event Option 3")
EventOption3.triggered.connect(show_EventOption3)
def show_EventOption1():
RLPy.RUi.ShowMessageBox("EventOption1", "Need to figure out what EventOption1 is going to do", RLPy.EMsgButton_Ok)
def show_EventOption2():
RLPy.RUi.ShowMessageBox("EventOption2", "Need to figure out what EventOption2 is going to do", RLPy.EMsgButton_Ok)
def show_EventOption3():
RLPy.RUi.ShowMessageBox("EventOption3", "Need to figure out what EventOption3 is going to do", RLPy.EMsgButton_Ok)
i7-3770 3.4GHz CPU 16 GB Ram
GeForce GTX1080 TI 11GB
Windows 10 Pro 64bit
Edited
6 Years Ago by
Delerna