JustinPedersen / maya_fspy

Simple UI to import fSpy files into Autodesk Maya
MIT License
38 stars 0 forks source link

name definition error on Maya2020.4 #13

Closed ando-iis closed 2 years ago

ando-iis commented 2 years ago

Recently I've got into an issue with not able to execute this python script. When I run maya_fspy by importing maya_fspy.ui, I get a following error message,

  # Error: name 'windows' is not defined
  # Traceback (most recent call last):
  #   File "<maya console>", line 1, in <module>
  #   File "C:/Users/<user>/Documents/maya/scripts\maya_fspy\ui.py", line 22, in <module>
  #     import pymel.core as pm
  #   File "C:\Program Files\Autodesk\Maya2020\Python\lib\site-packages\pymel\core\__init__.py", line 77, in <module>
  #     objectTypeUI = windows.objectTypeUI = ui.objectTypeUI
  # NameError: name 'windows' is not defined # 

Is this an issue of pymel version on Maya2020.4?

Tak

JustinPedersen commented 2 years ago

Heya

Yeah that does appear to be an issue with your pymel installation. If you open a new Python tab and run the import pymel.core as pm does it produce a similar issue?

Possible solve for this would be re-installing maya if possible. Be sure on the re-install to make sure the install PyMel option is ticked.

Njordy commented 2 years ago

I have the same pyMEL problem on Maya 2023. And I did reinstalled it making sure pyMEL installation was checked. It was by default. But even after reinstalling the issue remained.

JustinPedersen commented 2 years ago

Could very well be an issue with the script then. Will try set asides some time to look at it.

Considering also re-writing it to all be cmds based and remove the PyMel need entirely

ando-iis commented 2 years ago

Hi

Thanks both @JustinPedersen and @Njordy for reply. I've run importpymel.core as pm and yes it returned the same error. I'll try re-installing 2020 as well as PyMel option. Note that there is no issue on 2022.3.

ando-iis commented 2 years ago

Tested re-installing Maya and experimented with various plug-ins and finally tracked down the problem. It is the Arnold and MtoA causing the issues.

Maya2020.4 with MtoA 5.0.0.4 works but with 5.1(Arnold Core 7.1.0.0) has started the same issue. I haven't digged into the code but there must be some chages in PyMel. Any idea for solution?

JustinPedersen commented 2 years ago

From what I know there isn't any use of anything from Arnold in the tool so there might be something on the AD side causing an issue. Just another reason for me to drop the use of PyMel from this thing.

Njordy commented 2 years ago

I actually don't know anything about pyMEL. I assume it's a way to execute MEL commands under the python.

I made a Houdini loader for fspy json files about 2 years ago. I think I've used just a very common modules like Path, os, json...

JustinPedersen commented 2 years ago

PyMel is very similar to cmds but it's a little more object orientated. So you refer to scene items and their properties with dot notation instead of strings. eg my_node.translateX.set(10) vs cmds.setAttr('my_node.translateX', 10) Under the hood they both wrap MEL but PyMel uses the OpenMaya API in places too from what I know about it.

That said I think I am set on refactoring everything to use cmds with some other improvements people have mentioned in other issues.

Going to close this one since it doesn't seem directly related to the script itself. Please feel free to re-open or make a new one if something else crops up!