modelPanel problem fix?
by TheRiverside on Nov.07, 2009, under MEL Scripting Final
Well, I think I might have a solution to the modelPanel issue in my script.
I spoke to my professor today about the issue. He suggested explicitly deleting the UI element using an “if” statement similar to the way you would delete/refresh the entire UI if the script is run twice without the window being closed.
Deleting the UI:
if (`window -exists dcg_fp_lighterUIWindow`) {
deleteUI dcg_fp_lighterUIWindow;
}
Deleting the UI element:
if (`modelPanel -exists dcg_lighter_guiElem_modelPanel`) {
deleteUI dcg_lighter_guiElem_modelPanel;
}
I thought this would fix my script, end war, fix the economy, and eliminate poverty. It turns out that, as it stands, it did none of the above. When I added the delete-modelPanel block to my script, its almost like it ignored it. When the UI is closed and the script is run a second time, it still errors out saying that the name “dcg_lighter_guiElem_modelPanel” is not unique (in other words, it didn’t delete the modelPanel).
I tried each line individually…
modelPanel -exists dcg_lighter_guiElem_modelPanel;
This returned a value of 1… true… it still exists. Ok, let’s delete it…
deleteUI dcg_lighter_guiElem_modelPanel;
Maya crashes…
Sooo… problem not solved… yet…