Hi Tesira, Can you try it in iClone v7.92? Molly Reallusion
oh sorry, the crashing script is without this line if len(items) > 0 with this line it dos work.
def update_interface(dia):
items = RLPy.RScene.GetSelectedObjects()
newname=items[0].GetName()
print (newname) … well I have found out more ….. already this little script lets iClone crash, when I load a new Project or delete the seleted item …..
class EventCallback(RLPy.REventCallback):
def __init__(self):
RLPy.REventCallback.__init__(self)
dia=0
def OnObjectSelectionChanged(self):
print("selection changed")
update_interface(1)
def OnObjectDeleted(self):
print("event Object Deleted")
update_interface(2)
def update_interface(dia):
items = RLPy.RScene.GetSelectedObjects()
if len(items) > 0:
newname=items[0].GetName()
print (newname)
events["event_callback"] = EventCallback()
events["event_callback_id"] = RLPy.REventHandler.RegisterCallback(events["event_callback"])
But, if I add a line to update_interface(dia), I can load also a new Project or delete an item:
def update_interface(dia):
items = RLPy.RScene.GetSelectedObjects()
if len(items) > 0:
newname=items[0].GetName()
print (newname)
I think, this should not happen, that this dos crash iClone, if there are no items selcted. There could be an error message. Just to clarify: you mean you actually load a project, while a script is running? I would think that that would cause the state of the environment to change including variable bindings, etc. So that will cause a crash.