Help on function ExportModel in module maya.cmds:
ExportModel(*args, **keywords)
I guess you can do a command with a help flag to accommodate as a workaround, that’s a good question tho
Sent from Mail for Windows 10
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I guess you can do a command with a help flag to accommodate as a workaround, that’s a good question tho
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1KHBpAhmKMicXw%3DROJKwu3VN0EvQaXiz_%2B3Ndc8aMfcQ%40mail.gmail.com.
give it a try and report back.On Wed, Mar 14, 2018, 2:18 PM justin hidair <justin...@gmail.com> wrote:I guess you can do a command with a help flag to accommodate as a workaround, that’s a good question tho
Help flag seems like a good suggestion, seeing as you don't have control over the function that gets injected into the commands namespace to wrap your plugin.I haven't tried it, so this is just a brainstorm. What would happen if you manually set cmds.ExportModel.__doc__ at the end of your initializePlugin(mobject) function? Would it even let you? Would it then allow docstrings to work properly?
Sent from Mail for Windows 10
From: Michael Boon
Sent: Wednesday, March 14, 2018 12:59 AM
To: Python Programming for Autodesk Maya
Subject: [Maya-Python] Can Maya plugins do any self-documentation?
I have a plugin called ExportModel*. If I do help(cmds.ExportModel ) I get
Help on function ExportModel in module maya.cmds:
ExportModel(*args, **keywords)
which is next to useless.
Is there a way I can publish the expected arguments and return values of my plugin so that other scripters can see them inside Maya?
(* Names have been changed to protect the innocent)
--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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+unsub...@googlegroups.com.
That works for Python plugins! It won't be quite so simple for a C++ plugin (which my exporter is) but I willgive it a try and report back.
@Ian Jones - I didn't know that worked in MEL, thank you.
On Wednesday, 14 March 2018 21:00:14 UTC+11, Justin Israel wrote:
On Wed, Mar 14, 2018, 2:18 PM justin hidair <justin...@gmail.com> wrote:I guess you can do a command with a help flag to accommodate as a workaround, that’s a good question tho
Help flag seems like a good suggestion, seeing as you don't have control over the function that gets injected into the commands namespace to wrap your plugin.I haven't tried it, so this is just a brainstorm. What would happen if you manually set cmds.ExportModel.__doc__ at the end of your initializePlugin(mobject) function? Would it even let you? Would it then allow docstrings to work properly?
Sent from Mail for Windows 10
From: Michael Boon
Sent: Wednesday, March 14, 2018 12:59 AM
To: Python Programming for Autodesk Maya
Subject: [Maya-Python] Can Maya plugins do any self-documentation?
I have a plugin called ExportModel*. If I do help(cmds.ExportModel ) I get
Help on function ExportModel in module maya.cmds:
ExportModel(*args, **keywords)
which is next to useless.
Is there a way I can publish the expected arguments and return values of my plugin so that other scripters can see them inside Maya?
(* Names have been changed to protect the innocent)
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/519946dd-0c8b-4107-8f2a-f02a93ee0a5b%40googlegroups.com.
cmdsPlugin = getattr(cmds, kPluginCmdName)
cmdsPlugin.__doc__ = MyPluginClass.__doc__ # Typically this is a nice description of the class, though it doesn't describe the flags.
MString pyCmd;
pyCmd += "import maya.cmds as cmds\n";
pyCmd += "cmds." MY_PLUGIN_CMD ".__doc__ = '''";
pyCmd += MyPlugin::getDocString();
pyCmd += "'''\n";
MGlobal::executePythonCommand(pyCmd);
That works for C++ command plugins too. I verified it on one specifically.
Ian
On Wed, Mar 14, 2018, 7:27 PM Michael Boon <boon...@gmail.com> wrote:
That works for Python plugins! It won't be quite so simple for a C++ plugin (which my exporter is) but I willgive it a try and report back.
@Ian Jones - I didn't know that worked in MEL, thank you.
On Wednesday, 14 March 2018 21:00:14 UTC+11, Justin Israel wrote:
On Wed, Mar 14, 2018, 2:18 PM justin hidair <justin...@gmail.com> wrote:I guess you can do a command with a help flag to accommodate as a workaround, that’s a good question tho
Help flag seems like a good suggestion, seeing as you don't have control over the function that gets injected into the commands namespace to wrap your plugin.I haven't tried it, so this is just a brainstorm. What would happen if you manually set cmds.ExportModel.__doc__ at the end of your initializePlugin(mobject) function? Would it even let you? Would it then allow docstrings to work properly?
Sent from Mail for Windows 10
From: Michael Boon
Sent: Wednesday, March 14, 2018 12:59 AM
To: Python Programming for Autodesk Maya
Subject: [Maya-Python] Can Maya plugins do any self-documentation?
I have a plugin called ExportModel*. If I do help(cmds.ExportModel ) I get
Help on function ExportModel in module maya.cmds:
ExportModel(*args, **keywords)
which is next to useless.
Is there a way I can publish the expected arguments and return values of my plugin so that other scripters can see them inside Maya?
(* Names have been changed to protect the innocent)
--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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+unsub...@googlegroups.com.
OK to summarize:
I didn't want to add a help flag because I don't know how people would discover it.
The only built-in way, is to do as Ian Jones suggested and use MEL's help function. That will give you a list of parameters but no description.
As Justin suggested, for a Python plugin, it's relatively easy to add a Python docstring, so you can do help(cmds.myPluginCmd), by adding this to the end of initializePlugin(mobject):
cmdsPlugin = getattr(cmds, kPluginCmdName)
cmdsPlugin.__doc__ = MyPluginClass.__doc__ # Typically this is a nice description of the class, though it doesn't describe the flags.
For a C++ plugin, it's harder but it also works. I added a getDocString method that returns a very long MString and then did this, also in initializePlugin:
MString pyCmd;
pyCmd += "import maya.cmds as cmds\n";
pyCmd += "cmds." MY_PLUGIN_CMD ".__doc__ = '''";
pyCmd += MyPlugin::getDocString();
pyCmd += "'''\n";
MGlobal::executePythonCommand(pyCmd);
I also call MGlobal::displayError(MyPlugin::getDocString().asChar());
if my MArgDatabase constructor doesn't return kSuccess (ie if the user supplies illegal arguments).
On Thursday, 15 March 2018 14:32:43 UTC+11, Ian Jones wrote:That works for C++ command plugins too. I verified it on one specifically.Ian
On Wed, Mar 14, 2018, 7:27 PM Michael Boon <boon...@gmail.com> wrote:
That works for Python plugins! It won't be quite so simple for a C++ plugin (which my exporter is) but I willgive it a try and report back.
@Ian Jones - I didn't know that worked in MEL, thank you.
On Wednesday, 14 March 2018 21:00:14 UTC+11, Justin Israel wrote:
On Wed, Mar 14, 2018, 2:18 PM justin hidair <justin...@gmail.com> wrote:I guess you can do a command with a help flag to accommodate as a workaround, that’s a good question tho
Help flag seems like a good suggestion, seeing as you don't have control over the function that gets injected into the commands namespace to wrap your plugin.I haven't tried it, so this is just a brainstorm. What would happen if you manually set cmds.ExportModel.__doc__ at the end of your initializePlugin(mobject) function? Would it even let you? Would it then allow docstrings to work properly?
Sent from Mail for Windows 10
From: Michael Boon
Sent: Wednesday, March 14, 2018 12:59 AM
To: Python Programming for Autodesk Maya
Subject: [Maya-Python] Can Maya plugins do any self-documentation?
I have a plugin called ExportModel*. If I do help(cmds.ExportModel ) I get
Help on function ExportModel in module maya.cmds:
ExportModel(*args, **keywords)
which is next to useless.
Is there a way I can publish the expected arguments and return values of my plugin so that other scripters can see them inside Maya?
(* Names have been changed to protect the innocent)
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/519946dd-0c8b-4107-8f2a-f02a93ee0a5b%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/778c97d2-c68f-49ef-b898-ac9514af0449%40googlegroups.com.
import maya.cmds as cmds
import maya.cmds
print maya.cmds is cmds
help(cmds.ExportModel)
help(maya.cmds.ExportModel)
del cmds
del maya
import maya.cmds as cmds
help(cmds.ExportModel)
reload(cmds)
help(cmds.ExportModel)
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/519946dd-0c8b-4107-8f2a-f02a93ee0a5b%40googlegroups.com.
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+unsub...@googlegroups.com.
I'm creating a name in the global env either way. It would be good to delete it after setting the docString, I guess.
Both ways work afterwards, because the import path is "maya.cmds" in both cases so Python only stores one module object.prints "True"
import maya.cmds as cmds
import maya.cmds
print maya.cmds is cmds
And similarlygives exactly the same output as
help(cmds.ExportModel)
help(maya.cmds.ExportModel)
It still works after deleting the names and importing again, too
del cmds
del maya
import maya.cmds as cmds
help(cmds.ExportModel)
Here's one that surprised me though. It still works after reloading. I'm not sure what happens internally to make that work.
reload(cmds)
help(cmds.ExportModel)
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/519946dd-0c8b-4107-8f2a-f02a93ee0a5b%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/778c97d2-c68f-49ef-b898-ac9514af0449%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2db6f03b-097b-4161-baf2-8004f861306c%40googlegroups.com.
I think what Justin is saying is that, after I the user have loaded your plug-in, then I’d be able to say..
cmds.file(new=True)
..without actually from maya import cmds
. You’ve done that for me. It could cause issues whereby I make a script that assume cmds
is already imported, and then when your plug-in is no longer loaded for whatever reason, now suddenly my scripts no longer work. It’s a hard one to track down!
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/519946dd-0c8b-4107-8f2a-f02a93ee0a5b%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/778c97d2-c68f-49ef-b898-ac9514af0449%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2db6f03b-097b-4161-baf2-8004f861306c%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2wELhdm-1yx3SuZzzWD00r7MS%2BhXDm0SgX%3D%3DUhb%2BmSdg%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
import maya.cmds as _temp_cmds
# ... Do stuff with the __doc__ ...
del _temp_cmds
No matter what name I import maya.cmds as (including simply importing it as maya.cmds) I add that name to the global namespace.
I think the robust approach is to choose an obviously temp name (or check for the existence of a name and back it up, but that seems like overkill), and delete it afterwards
import maya.cmds as _temp_cmds
# ... Do stuff with the __doc__ ...
del _temp_cmds
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/24a69ba7-2dfb-447a-bcba-3a3b71150600%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5aa8787f.51951c0a.13a94.16ae%40mx.google.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/519946dd-0c8b-4107-8f2a-f02a93ee0a5b%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/778c97d2-c68f-49ef-b898-ac9514af0449%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2db6f03b-097b-4161-baf2-8004f861306c%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2wELhdm-1yx3SuZzzWD00r7MS%2BhXDm0SgX%3D%3DUhb%2BmSdg%40mail.gmail.com.
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7a756b16-2987-4b9a-a4d3-e0004ffbb969%40googlegroups.com.
On Fri, Mar 16, 2018, 11:47 AM Michael Boon <boon...@gmail.com> wrote:No matter what name I import maya.cmds as (including simply importing it as maya.cmds) I add that name to the global namespace.
I think the robust approach is to choose an obviously temp name (or check for the existence of a name and back it up, but that seems like overkill), and delete it afterwards
import maya.cmds as _temp_cmds
# ... Do stuff with the __doc__ ...
del _temp_cmdsWe are missing each other on this point.
I'm advocating the other way around. What is 100% expected is to use the exact fully qualified module path that Maya ships with as opposed to picking your own alias that you like best. I agree that in both cases you leave behind an imported module but at least one of them is full qualified. You shouldn't delete any of them after either, since you could be deleting something previously imported unkess you check first.
But we are probably overly nitpicking this point to death :-)
On Friday, 16 March 2018 11:44:02 UTC+11, Justin Israel wrote:On Fri, Mar 16, 2018, 11:47 AM Michael Boon <boon...@gmail.com> wrote:No matter what name I import maya.cmds as (including simply importing it as maya.cmds) I add that name to the global namespace.
I think the robust approach is to choose an obviously temp name (or check for the existence of a name and back it up, but that seems like overkill), and delete it afterwards
import maya.cmds as _temp_cmds
# ... Do stuff with the __doc__ ...
del _temp_cmdsWe are missing each other on this point.
Argh and I hate that :\
I'm advocating the other way around. What is 100% expected is to use the exact fully qualified module path that Maya ships with as opposed to picking your own alias that you like best. I agree that in both cases you leave behind an imported module but at least one of them is full qualified. You shouldn't delete any of them after either, since you could be deleting something previously imported unkess you check first.What's better about a fully qualified module name, and what makes it "100% expected"? Do you just mean that it's relatively unambiguous what "maya.cmds" is? Both approaches have the problem that they could theoretically change the way scripts behave depending on whether my plugin is loaded or not. One redefines "cmds" and the other redefines "maya".
But we are probably overly nitpicking this point to death :-)
Yeah this is unlikely to have any practical effects. I still hate the fact that I don't understand what you mean!
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1e417eb3-c781-4923-8959-885fc4bc80a6%40googlegroups.com.
I find examples are often the best way of getting a point across, and I think what Justin is saying is that in place of this..
import maya.cmds as _temp_cmds
You do..
import maya.cmds
And then use maya.cmds
wherever you would normally use _temp_cmds
. This way, nothing is redefined and nothing needs cleaning up. And you’ve even saved yourself from typing one character less. :)
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1e417eb3-c781-4923-8959-885fc4bc80a6%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0-mw-Gsyg5p-J9L_tph41%2Bi98DV4ii304YG1m02eXU0Q%40mail.gmail.com.
I find examples are often the best way of getting a point across, and I think what Justin is saying is that in place of this..
import maya.cmds as _temp_cmds
You do..
import maya.cmds
And then use
maya.cmds
wherever you would normally use_temp_cmds
. This way, nothing is redefined and nothing needs cleaning up. And you’ve even saved yourself from typing one character less. :)On 19 March 2018 at 00:28, Justin Israel <justin...@gmail.com> wrote:
On Mon, Mar 19, 2018 at 1:06 PM Michael Boon <boon...@gmail.com> wrote:
On Friday, 16 March 2018 11:44:02 UTC+11, Justin Israel wrote:On Fri, Mar 16, 2018, 11:47 AM Michael Boon <boon...@gmail.com> wrote:No matter what name I import maya.cmds as (including simply importing it as maya.cmds) I add that name to the global namespace.
I think the robust approach is to choose an obviously temp name (or check for the existence of a name and back it up, but that seems like overkill), and delete it afterwards
import maya.cmds as _temp_cmds
# ... Do stuff with the __doc__ ...
del _temp_cmdsWe are missing each other on this point.
Argh and I hate that :\
I'm advocating the other way around. What is 100% expected is to use the exact fully qualified module path that Maya ships with as opposed to picking your own alias that you like best. I agree that in both cases you leave behind an imported module but at least one of them is full qualified. You shouldn't delete any of them after either, since you could be deleting something previously imported unkess you check first.What's better about a fully qualified module name, and what makes it "100% expected"? Do you just mean that it's relatively unambiguous what "maya.cmds" is? Both approaches have the problem that they could theoretically change the way scripts behave depending on whether my plugin is loaded or not. One redefines "cmds" and the other redefines "maya".In my mind, the "maya" root namespace is shipped with Maya's site-package, so if I am going to leave symbols in the shared global python namespace I would want to leave them full qualified instead of choosing aliases or "from" imports.
But we are probably overly nitpicking this point to death :-)--
Yeah this is unlikely to have any practical effects. I still hate the fact that I don't understand what you mean!
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1e417eb3-c781-4923-8959-885fc4bc80a6%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0-mw-Gsyg5p-J9L_tph41%2Bi98DV4ii304YG1m02eXU0Q%40mail.gmail.com.
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAFs%2BTdA3CahbeGzU-fJdk2kWp%3D_dwB_j5WvpgJaLzO2w%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1e417eb3-c781-4923-8959-885fc4bc80a6%40googlegroups.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0-mw-Gsyg5p-J9L_tph41%2Bi98DV4ii304YG1m02eXU0Q%40mail.gmail.com.--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAFs%2BTdA3CahbeGzU-fJdk2kWp%3D_dwB_j5WvpgJaLzO2w%40mail.gmail.com.
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0L1WdxCiQt_KDmxaetOnoADE6LpMgYgVvDmGuG%2BUoAhg%40mail.gmail.com.