2015-10-27 2 views
1

Я импортирую maya.standalone, инициализируя его, а затем импортирую pymel.core as pmc в свой интерпретатор Maya Python, который работает в powershell. На данный момент я получаю много предупреждений. После того, когда я звоню: xform, shape = pmc.polysphere(), я получаю предупреждение: name 'xform' is not definedКак импортировать ядро ​​PyMEL?

Это выход из импорта pymel

> Warning: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/initialStartup.mel line 195: 
> Y-axis is already the Up-axis Initialized VP2.0 renderer { Version : 
> 6.3.16.0. Feature Level 5. Adapter : Intel(R) HD Graphics 4600 Vendor ID: 32902. Device ID : 1046 Driver : 
> nvwgf2umx.dll:9.18.13.5306. API : DirectX V.11. Max texture size : 
> 16384 * 16384. Max tex coords : 32 Shader versions supported 
> (Vertex: 5, Geometry: 5, Pixel 5). Active stereo support available : 
> 0 GPU Memory Limit : 2080 MB. CPU Memory Limit: 15472.7 MB. } 
> OpenCL evaluator is attempting to initialize OpenCL. Detected 2 OpenCL 
> Platforms: 0: Intel(R) Corporation. Intel(R) OpenCL. OpenCL 1.2 . 
> Supported extensions: cl_intel_dx9_media_sharing 
> cl_khr_byte_addressable_store cl_khr_d3d11_sharing 
> cl_khr_dx9_media_sharing cl_khr_gl_sharing 
> cl_khr_global_int32_base_atomics cl_khr_global 
> _int32_extended_atomics cl_khr_icd cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics 1: NVIDIA Corporation. NVIDIA 
> CUDA. OpenCL 1.2 CUDA 7.5.8. Supported extensions: 
> cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing 
> cl_nv_compiler_options cl_nv_device_attribute_query 
> cl_nv_pragma_unroll cl_nv_d3d9_sharing cl_nv_d3d10_shari ng 
> cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts OpenCL 
> evaluator choosing OpenCL platform Intel(R) Corporation. Choosing 
> OpenCL Device Intel(R) HD Graphics 4600. Device Type: GPU Device is 
> available. OpenCL device does not support out of order execution 
> 
> Error: file: C:/Program 
> Files/Autodesk/Maya2016/plug-ins/xgen/scripts/igInitialize.mel line 
> 63: ImportError: file <maya console> line 1: No module named xgenm 
> Error: Unable to execute igInitialize.mel. Unable to execute 
> igInitialize.mel.Error: line 0: ImportError: file <maya console> line 
> 1: No module named xgenm Error: Unable to execute xgen.mel. Unable to 
> execute xgen.mel.xgmNurbsPatch [u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmP atch', 
> u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmNurbsPatch'] pymel.internal.apicache : WARNING 
> : lineage for node xgmNurbsPatch is cyclical: [u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u's urfaceShape', u'THsurfaceShape', u'xgmPatch', 
> u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u' xgmNurbsPatch'] xgmSubdPatch [u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmPatch', 
> u'containerBase', u'e ntity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmSubdPatch'] pymel.internal.apicache : WARNING 
> : lineage for node xgmSubdPatch is cyclical: [u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'su rfaceShape', u'THsurfaceShape', u'xgmPatch', 
> u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'x gmSubdPatch'] xgmArchiveGuide 
> [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmGuide', u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', 
> u'xgmArchiveGuide'] pymel.internal.apicache : WARNING : lineage for 
> node xgmArchiveGuide is cyclical: [u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u 'surfaceShape', u'THsurfaceShape', u'xgmGuide', 
> u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmArchiveGuide'] xgmCardGuide [u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmGuide', 
> u'containerBase', u'e ntity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmCardGuide'] pymel.internal.apicache : WARNING 
> : lineage for node xgmCardGuide is cyclical: [u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'su rfaceShape', u'THsurfaceShape', u'xgmGuide', 
> u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'x gmCardGuide'] xgmSphereGuide [u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmGuide', 
> u'containerBase', u 'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmSphereGuide'] pymel.internal.apicache : 
> WARNING : lineage for node xgmSphereGuide is cyclical: 
> [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u' surfaceShape', 
> u'THsurfaceShape', u'xgmGuide', u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u 
> 'xgmSphereGuide'] xgmSplineGuide [u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmGuide', 
> u'containerBase', u 'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u'surfaceShape', 
> u'THsurfaceShape', u'xgmSplineGuide'] pymel.internal.apicache : 
> WARNING : lineage for node xgmSplineGuide is cyclical: 
> [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'deformableShape', u'controlPoint', u' surfaceShape', 
> u'THsurfaceShape', u'xgmGuide', u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'deformableShape', 
> u'controlPoint', u'surfaceShape', u'THsurfaceShape', u 
> 'xgmSplineGuide'] AbcExport v1.0 using Alembic 1.5.4 (built May 8 
> 2014 13:47:10) Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> ImportError: file <maya console> line 1: No module named 
> mtoa.lightFilters 
> 
> API error detected in plugins\mtoa\extension\PxMayaNode.cpp at line 
> 222 : (kFailure): Unexpected Internal Failure Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> ImportError: file <maya console> line 1: No module named 
> mtoa.lightFilters 
> 
> API error detected in plugins\mtoa\extension\PxMayaNode.cpp at line 
> 222 : (kFailure): Unexpected Internal Failure Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> ImportError: file <maya console> line 1: No module named 
> mtoa.lightFilters 
> 
> API error detected in plugins\mtoa\extension\PxMayaNode.cpp at line 
> 222 : (kFailure): Unexpected Internal Failure Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> ImportError: file <maya console> line 1: No module named 
> mtoa.lightFilters 
> 
> API error detected in plugins\mtoa\extension\PxMayaNode.cpp at line 
> 222 : (kFailure): Unexpected Internal Failure 00:00:00 359MB ERROR 
> | [mtoa] [xgenTranslator] Could not find xgen_procedural in search 
> path $ARNOLD_PLUGIN_PATH Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> ImportError: file <maya console> line 1: No module named 
> mtoa.api.extensions 
> 
> API error detected in plugins\mtoa\extension\ExtensionsManager.cpp at 
> line 571 : (kFailure): Unexpected Internal Failure Error: file: 
> C:/Program Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel 
> line 46: ImportError: file <maya console> line 1: No module named 
> mtoa.api.extensions 
> 
> API error detected in plugins\mtoa\extension\ExtensionsManager.cpp at 
> line 571 : (kFailure): Unexpected Internal Failure Error: file: 
> C:/Program Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel 
> line 46: ImportError: file <maya console> line 1: No module named 
> mtoa.api.extensions 
> 
> API error detected in plugins\mtoa\extension\ExtensionsManager.cpp at 
> line 571 : (kFailure): Unexpected Internal Failure Error: file: 
> C:/Program Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel 
> line 46: ImportError: file <maya console> line 1: No module named 
> arnold 
> 
> API error detected in plugins\mtoa\Main.cpp at line 770 : (kFailure): 
> Unexpected Internal Failure 00:00:00 362MB ERROR | Failed to 
> import python module 'arnold' Error: Failed to import python module 
> 'arnold' aiSkyDomeLight [u'containerBase', u'entity', u'dagNode', 
> u'shape', u'geometryShape', u'locator', u'THlocatorShape', 
> u'SphereLocator', u'containerBase', u'entity', u'dagNode', u'shape', 
> u'geo metryShape', u'locator', u'THlocatorShape', u'aiSkyDomeLight'] 
> pymel.internal.apicache : WARNING : lineage for node aiSkyDomeLight is 
> cyclical: [u'containerBase', u'entity', u'dagNode', u'shape', 
> u'geometryShape', u'locator', u'THlocatorShape', u'Sphere Locator', 
> u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'locator', u'THlocatorShape', u'aiSkyDomeLight'] aiSky 
> [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', 
> u'locator', u'THlocatorShape', u'SphereLocator', u'containerBase', 
> u'entity', u'dagNode', u'shape', u'geometryShap e', u'locator', 
> u'THlocatorShape', u'aiSky'] pymel.internal.apicache : WARNING : 
> lineage for node aiSky is cyclical: [u'containerBase', u'entity', 
> u'dagNode', u'shape', u'geometryShape', u'locator', u'THlocatorShape', 
> u'SphereLocator', u'containerBase', u'entity', u'dagNode', u'shape', 
> u'geometryShape', u'locator', u'THlocatorShape', u'aiSky'] Error: 
> file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> initializePlugin function failed (mtoa) AbcImport v1.0 using Alembic 
> 1.5.4 (built May 8 2014 13:47:10) BifrostMain plug-in loaded (built Feb 26 2015 18:01:51) Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> ImportError: file C:/Program 
> Files/Autodesk/Maya2016/plug-ins/xgen/plug-ins/xgenMR.py line 9: No m 
> odule named xgenm Warning: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> Failed to run file: C:/Program 
> Files/Autodesk/Maya2016/plug-ins/xgen/plug-ins/xgenMR.py pymel : ERROR 
> : Failed to get controlCommand list from xgenMR pymel : ERROR : Failed 
> to get modelEditorCommand list from xgenMR pymel : ERROR : Failed to 
> get command list from xgenMR pymel : ERROR : Failed to get 
> constraintCommand list from xgenMR pymel.core : ERROR : Failed to get 
> depend nodes list from xgenMR Error: file: C:/Program 
> Files/Autodesk/Maya2016/scripts/startup/autoLoadPlugin.mel line 46: 
> (xgenMR) 
> >>> 

Я работаю через книгу Практических Майя программирование, здесь текст из книга:

Теперь мы начнем копаться в Maya и PyMEL. Начнем с инициализации Maya в интерпретаторе mayapy, чтобы мы могли использовать более только стандартные функции Python. Мы делаем это, вызывая maya.standalone.initialize, как показано в следующем коде:

>>> import maya.standalone 
>>> maya.standalone.initialize() 
>>> import pymel.core as pmc 
>>> xform, shape = pmc.polySphere() 

импорт pymel.core неявно называть maya.standalone.initialize автоматически, но я это делаю явно здесь, так что ясно, что происходит. В будущем вы можете вообще пропустить вызов maya.standalone.initialize и просто импортировать pymel.core.

Существует много мы можем узнать об этих объектах PyMEL, , которые представляют узлы Maya, используя базовый Python. Например, чтобы увидеть тип любого из наших объектов, мы можем использовать функцию встроенного типа (мы углубимся в типы далее в этой главе).

Может ли кто-нибудь объяснить ошибки, которые я получаю в своем интерпретаторе, и предложить решение?

ответ

2

Как вы на окна, убедитесь, что вы не используете Powershell ISE. Просто используйте стандартную Powershell.

Как поясняет @Boon, большинство этих ошибок связаны с плагинами и битами майи, которые могли бы быть написаны лучше.

Поскольку вы фокусируетесь на программировании обучения, вам не нужны эти плагины. Вы можете отключить их от интерактивного сеанса майя:

  1. Open Maya.
  2. Выберите Windows-> Настройки/Настройки-> Менеджер плагинов
  3. Выключите "Loaded" и "Auto Load" для всех плагинов, которые не верхняя секция: т.е. XGEN, Bifrost, вещества, mtoa и т.д.
  4. Закрыть майя.

Теперь попробуйте еще раз в вашей оболочке:

mayapy 
import maya.standalone 
maya.standalone.initialize() 
import pymel.core as pm 

На данный момент, я вижу предупреждение о Y-Up, а некоторые Alembic информацию о версии, и ничего другого. Ни о чем не беспокоиться.

Подсказка >>>, что хорошо. Вы должны быть в состоянии ввести pymel команды в настоящее время: Тип (по одному за раз, чтобы увидеть выход):

pm.about(version=True) 
pm.polySphere() 
pm.ls(type="mesh") 

EDIT

Если вы используете PowerShell и настроить профиль, может сэкономить время, добавив следующую строку в profile.ps1:

function ms { mayapy -i -c "import maya.standalone;maya.standalone.initialize();import pymel.core as pm;print('maya standalone initialized and pymel.core imported as pm')" } 

Теперь вы можете открыть, тип PowerShell ms и начать кодирование.

4

(Это не полный ответ, но я нуб, так что я не разрешено комментировать.)

Пучок предупреждений, которые выглядят как

xgmNurbsPatch [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmPatch', u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmNurbsPatch'] 
# Warning: pymel.internal.apicache : lineage for node xgmNurbsPatch is cyclical: [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmPatch', u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', u'controlPoint', u'surfaceShape', u'THsurfaceShape', u'xgmNurbsPatch'] # 

являются (я думаю,) проблема с Maya 2016, возможно, не о чем вам нужно беспокоиться.

Я работаю в Редакторе скриптов, не используя maya.standalone. Когда я импортирую Pymel в Maya 2016, я получаю 6 из этих предупреждений для разных классов «xgm», то же самое, что и вы. В предыдущих версиях майя этого не произошло.

Что касается ошибок, mtoa/Arnold и xgen являются плагинами (и все ваши ошибки, похоже, связаны с загрузкой плагинов). Может быть, вы можете отключить их? Извините, я не работал с переводчиком Maya Python за пределами основного приложения Maya.

Edit: Я вижу, кто-то другой (или, может быть, вы?), Имеющих подобные ошибки с XGEN, Арнольд и Майя 2016 года здесь: http://forums.cgsociety.org/archive/index.php?t-1287693.html

+0

Спасибо за вход .. Дал вам выдержку, чтобы помочь вам прокомментировать в будущем :) – shfury