okay thanks for your help, i think its better I ask my friends to copy the file in there maya path
On Friday, June 28, 2019 at 1:18:09 AM UTC+5:30, Justin Israel wrote: > > > > On Thu, Jun 27, 2019, 11:23 PM Vishal Kadam <vishalk...@gmail.com > <javascript:>> wrote: > >> Script is in the maya path but I want to share the script with my friends >> who are in the same shared network, if I use execfile in GUI then I dont >> have to ask them to copy the script file in there maya path. so I thought >> of creating a GUI using execfile if they run the script and click on the >> button ( MB_straightenUVs_Tool ) will execute. >> >> so I have multiple scripts that I don't want to ask them to copy in maya >> path and create a custom shortcut key, if I create a single GUI script >> using python it would be really helpful for my friends to use, just click >> the button and they will have the script whatever I use. >> > > Sounds like you have your own plan then. > Usually in a shared environment people would set up their PYTHONPATH to > include some shared network location for scripts, which can then be > imported normally the way I had shown. > execfile() is going to bring the contents of that module into your global > namespace, giving you a MB_straightenUVs object to call. Could get messy > with lots of these. > > >> On Thursday, June 27, 2019 at 2:32:38 PM UTC+5:30, Justin Israel wrote: >>> >>> >>> >>> On Thu, Jun 27, 2019, 6:20 PM Vishal Kadam <vishalk...@gmail.com> wrote: >>> >>>> I already have hotkeys and its working fine, Actually i'm trying to >>>> create a GUI for all my custom hotkeys to a single GUI using buttons, when >>>> I run the script manually it works fine but when I try to run it from a >>>> button its not working. >>>> >>>> from maya import cmds >>>> if(cmds.window('window1',q=1,ex=1)):cmds.deleteUI('window1') >>>> cmds.window('window1',t='test file',mb=1) >>>> cmds.columnlayout() >>>> cmds.button(c='testMEL()',l='test') >>>> cmds.columnlayout(p='window1') >>>> cmds.button(c='straightenUVs()',l='test2') >>>> cmds.showWindow('window1') >>>> >>>> def straightenUVs(): >>>> execfile("//usr/people/vishal/MB_straightenUVs_Tool.py") >>>> >>>> def testMEL(): >>>> mel.eval('source "/usr/people/vishal/test.mel"') >>>> >>> >>> You are already in a python script. There is no need to use execfile as >>> long as the tool is in the Maya PYTHONPATH. The button command can accept a >>> python callable object. >>> >>> import MB_straightenUVs_Tool >>> >>> from maya import cmds >>> if(cmds.window('window1',q=1,ex=1)):cmds.deleteUI('window1') >>> cmds.window('window1',t='test file',mb=1) >>> cmds.columnlayout() >>> cmds.columnlayout(p='window1') >>> cmds.button(c=MB_straightenUVs_Tool.MB_straightenUVs, l='test2') >>> cmds.showWindow('window1') >>> >>> >>> >>>> >>>> >>>> >>>> >>>> On Thursday, June 27, 2019 at 12:46:34 AM UTC+5:30, Justin Israel wrote: >>>>> >>>>> >>>>> >>>>> On Thu, Jun 27, 2019, 12:50 AM Vishal Kadam <vishalk...@gmail.com> >>>>> wrote: >>>>> >>>>>> import MB_straightenUVs_Tool >>>>>> MB_straightenUVs_Tool.MB_straightenUVs() >>>>>> >>>>>> do I need to add the above two lines in python script, please guide >>>>>> me I'm very new to this scripting >>>>>> >>>>> >>>>> I'm not sure how you are trying to apply this. In that archive there >>>>> is already a complete python script. Those two lines that I pasted are >>>>> taken from the Mel script that launches the python script. You can paste >>>>> those two lines into the Script Editor or a python hotkey, etc. Can you >>>>> please explain where you are stuck? >>>>> >>>>> >>>>>> On Wednesday, June 26, 2019 at 1:16:08 AM UTC+5:30, Justin Israel >>>>>> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Jun 25, 2019, 11:13 PM Vishal Kadam <vishalk...@gmail.com> >>>>>>> wrote: >>>>>>> >>>>>>>> hi, >>>>>>>> >>>>>>>> Please find the attachment >>>>>>>> A script by Martin Baadsgaard >>>>>>>> <https://www.highend3d.com/users/martin-baadsgaard> >>>>>>>> >>>>>>>> can this script be written in a single python rather than calling >>>>>>>> from mel >>>>>>>> >>>>>>> >>>>>>> It is already written in Python. The Mel script is just for the >>>>>>> convenience of exposing it as a global proc in Mel, with a few lines. >>>>>>> You >>>>>>> could completely ignore it and do this from python: >>>>>>> >>>>>>> import MB_straightenUVs_Tool >>>>>>> MB_straightenUVs_Tool.MB_straightenUVs() >>>>>>> >>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to python_inside_maya+unsubscr...@googlegroups.com. >>>>>>>> To view this discussion on the web visit >>>>>>>> https://groups.google.com/d/msgid/python_inside_maya/51351af2-4fd4-4383-9d8d-c5b5af28572b%40googlegroups.com >>>>>>>> >>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/51351af2-4fd4-4383-9d8d-c5b5af28572b%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>> . >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to python_inside_maya+unsubscr...@googlegroups.com. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/python_inside_maya/7a1d5821-8c04-43eb-90b9-99dab458161e%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/python_inside_maya/7a1d5821-8c04-43eb-90b9-99dab458161e%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to python_inside_maya+unsubscr...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/python_inside_maya/e22c780e-a39e-4ae8-8f8e-8b07d001b73e%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/python_inside_maya/e22c780e-a39e-4ae8-8f8e-8b07d001b73e%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to python_inside_maya+unsubscr...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/6a1c5325-782f-4c27-9314-db84630c75d2%40googlegroups.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/6a1c5325-782f-4c27-9314-db84630c75d2%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ac571188-4520-45df-a545-1f9209877bea%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.