Hi all,
I'm in the process of learning some MEL scripting for Maya and am following a youtube tutorial series by Dhruv Govil.
On the video I'm watching, he created a Custom UI window with buttons, some of which are referring to a previously created function in a different script. He mentioned in the earlier video how to save, load, source and scope scripts. To call a function made in another script in the custom UI window, he made the script global in an earlier video.
I've followed along but am still lost as to why Maya isn't able to call that function.
Here's the playlist I'm following:
Please let me know your thoughts on how to proceed.
Thanks in advance!
Solved! Go to Solution.
Hi all,
I'm in the process of learning some MEL scripting for Maya and am following a youtube tutorial series by Dhruv Govil.
On the video I'm watching, he created a Custom UI window with buttons, some of which are referring to a previously created function in a different script. He mentioned in the earlier video how to save, load, source and scope scripts. To call a function made in another script in the custom UI window, he made the script global in an earlier video.
I've followed along but am still lost as to why Maya isn't able to call that function.
Here's the playlist I'm following:
Please let me know your thoughts on how to proceed.
Thanks in advance!
Solved! Go to Solution.
Solved by stuzzz. Go to Solution.
Here's the answer I wish I could have you if I were you:
Do not create UI with the melscript!! it's old fashionned.
Go with the PyQt or PySide framework, it will save you a lot of time and it is way more powerfull. Furthermore, if you need to get a job and have no clue of what are the frameworks I'm talking about, you will drastically reduce your change to get hired.
If you start learning code in Maya, learn python instead. A good reason for that, it's object oriented. I can quote some other good reasons, but this one is just enough.
Here's the answer I wish I could have you if I were you:
Do not create UI with the melscript!! it's old fashionned.
Go with the PyQt or PySide framework, it will save you a lot of time and it is way more powerfull. Furthermore, if you need to get a job and have no clue of what are the frameworks I'm talking about, you will drastically reduce your change to get hired.
If you start learning code in Maya, learn python instead. A good reason for that, it's object oriented. I can quote some other good reasons, but this one is just enough.
But to answer your question.
I don't know what video exactly your talk about but generally speaking, If you don't have access to your mel's function:
make sure that it's a global function "global proc ...".
make sure that you have sourced it "source mymelfile.mel"
then you should be able to use it everywhere since it's global (in the main scope)
But to answer your question.
I don't know what video exactly your talk about but generally speaking, If you don't have access to your mel's function:
make sure that it's a global function "global proc ...".
make sure that you have sourced it "source mymelfile.mel"
then you should be able to use it everywhere since it's global (in the main scope)
Thanks for the reply! I'm quite new to Maya scripting so I'm not familiar with those terms. I will look into those though!
Sourcing the script did the trick, thanks!
Thanks for the reply! I'm quite new to Maya scripting so I'm not familiar with those terms. I will look into those though!
Sourcing the script did the trick, thanks!
awesome!
Hi, please do let us know more reason why learn Python instead of Mel. I was trying to learn a script to connect attributes from a 2015 video, and no matter what I do the code does not work. Is there anything in the code below that would not work in Maya 2020 Mel?
string $sel[] = 'ls -sl -tr';
string $dis = 'shadingNode -asUtility distanceBetween -n "distance2"';
connectAttr ($sel[0] + ".worldMatrix") ($dis + ".inMatrix1");
connectAttr ($sel[1] + ".worldMatrix") ($dis + ".inMatrix2");
connectAttr ($sel[0] + ".rotatePivotTranslate") ($dis + ".point1");
connectAttr ($sel[1] + ".rotatePivotTranslate") ($dis + ".point2");
Hi, please do let us know more reason why learn Python instead of Mel. I was trying to learn a script to connect attributes from a 2015 video, and no matter what I do the code does not work. Is there anything in the code below that would not work in Maya 2020 Mel?
string $sel[] = 'ls -sl -tr';
string $dis = 'shadingNode -asUtility distanceBetween -n "distance2"';
connectAttr ($sel[0] + ".worldMatrix") ($dis + ".inMatrix1");
connectAttr ($sel[1] + ".worldMatrix") ($dis + ".inMatrix2");
connectAttr ($sel[0] + ".rotatePivotTranslate") ($dis + ".point1");
connectAttr ($sel[1] + ".rotatePivotTranslate") ($dis + ".point2");
Can't find what you're looking for? Ask the community or share your knowledge.