회원 로그인
정보기억 정보기억에 체크할 경우 다음접속시 아이디와 패스워드를 입력하지 않으셔도 됩니다.
그러나, 개인PC가 아닐 경우 타인이 로그인할 수 있습니다.
PC를 여러사람이 사용하는 공공장소에서는 체크하지 마세요.
소셜네트워크 서비스를 통해서 로그인하시면 별도의 로그인 절차없이 회원서비스를 이용하실 수 있습니다.


최근 게시물

1.노션에서 작성 중

1.노션에서 작성 중

개편하기 전까지 노션에서 작성 중

2024.04.04//read more

2.ChatGPT

2.ChatGPT

OpenAI로 대규모 언어 모델대화형...

2023.03.16//read more

3.노코딩 게임 엔진 - 빌..

3.노코딩 게임 엔진 - 빌..

빌드 지원안드로이드iOS윈도우즈특이사...

2023.03.14//read more

4.(완료) 미접속 회원 정..

4.(완료) 미접속 회원 정..

[완료] 36명의 회원을 정리하였습니...

2023.02.16//read more

5.매뉴얼 플러스 - 전자제..



안정적인 DNS 서비스 DNSEver
DNS Powered by DNSEver.com


[스크랩] Maya help에 있는 Python 참조문 번역 - Python from an external interpreter

artsone | 2008.01.15 17:04 | 조회 4851

Python from an external interpreter

In addition to supporting Python within the Maya application, Maya also supports using the Python modules of Maya from a standalone Python interpreter. This is useful when doing batch processing, or when accessing the functionality of Maya from another application that uses Python (such as MotionBuilder or Toxik).
Maya는 Maya application내에서 Python을 지원한다, 게다가 단독 Python 해석프로그램에서 Python modul 쓰기역시 지원한다. 이것은 batch processing을 하는데 쓰이거나, Python을쓰는 Toxik이나 MotionBuilder와같은 다른 소프트웨어에 접근할때 아주 유용하게 쓰인다.

We provide a standalone Python interpreter which is configured correctly for importing Maya functionality.
Autodesk Maya는 Maya functionality를 impert하기 위해 설정된 단독 Python 해석프로그램;(이하 Python interpreter)을 제공한다.

* On Windows and Linux, run the mayapy executable from the bin directory of Maya.
* Windows와 Linux에서 Maya의 bin directory 에있는 mayapy 로 실행 가능하다.
* On Mac OS X, run the mayapy executable from ../ Maya.app/Contents/bin.
* Macd OS X에선는 ../ Maya.app/Contents/bin.에 있는 mayapy로 실행 가능하다.

Once the python interpreter is loaded, Maya must be loaded and initialized. To do so, type the following in the window:
일단 Python interpreter가 실행되면, maya는 실행되고 초기화 되어야 한다. 그렇게 하기위해서, 다음사항을 window에 써넣어라:

import maya.standalone
maya.standalone.initialize( name='python' )

(역주: mayapy.exe를 처음 실행하면 마야와는 상관없는 그냥 Python GUI이다.. 이상태에서는 sphere(r = 10)과 같은 명령어가 실행되지 않는다. 그러나

import maya.standalone
maya.standalone.initialize( name='python' )

를 실행시키고
import maya.cmds as lsd
lsd.sphere(r = 10)
라고 실행시키면 결과가 나오는 것을 알 수 있다)


Note
These commands take a significant amount of time to execute as they are loading all of the Maya's libraries and initializing the scene.
이 명령어는 명령어가 모든 maya의 librarie를 load하고 scene을 초기화 할때 실행을 위해 시간의 합계를 취한다.

The initialize routine takes only one parameter (name), and it is optional. The name parameter tells Maya what the name of the application is. The default value for name is python.
그 초기화 routine 은 오직 하나의 매계변수만을 취한다, 그리고 그것은 선택사항이다. 그 name매곈변수는 Maya에게 application의 이름이 무엇인지 알려준다. Name flag를 쓰지않고 비워둘경우 자동적으로 Python을 인식한다.

Once Maya is loaded and initialized, all Maya functionality should be available (maya.cmds, maya.OpenMaya, and so on). However, running Maya inside a Python interpreter is equivalent to running Maya in batch mode. That means that all normal Maya batch mode restrictions are in place, including the disabling of the UI commands.
일단 Maya가 load되고 초기화 되면, 모든 Maya maya.cmds, maya.OpenMaya, 등등과 같은 함수는 이용할 수 있을 것이다. 하지만, Python interpreter안의 Maya는 batch mode의 Maya와 동등하다. 그것은 UI 명령어를 사용할 수 없는 것을 포함한 모든 batch mode의 제약을 가지고 있다는 것이다.


Using a different Python interpreter

It is possible to use Maya from a Python interpreter other than the one that ships with Maya. However, it is recommended that you use the same version number of Python as is included in Maya. To use another interpreter, it is necessary to set up the correct environment.
Maya와 같이 가는 것보다는 Python 해독기에서 부터의 Maya를 이용하는 것이가능하다. 그렇지만, Maya에 포함된 Python vertion과 똑같은 vertion의 Python을 쓰는것이 유리하다.다른 Python interpreter 를 사용하기 위해서는 환경변수를 수정할 필요가 있다.

To set up the environment for a Python interpreter

1. Add the site-packages directory of Maya to your PYTHONPATH environment variable, or add it to sys.path inside of Python once the interpreter is initialized (but before Maya is initialized).
1. Maya의 site-packages 경로를 Python 환경변수에 추가 시켜라. 일단 Python이 초기화 되어있다면 sys.path에 당신의 site-packages경로를 추가하여라. (그전에 maya는 초기화 된다)
(역주: Python의 환경변수법은 바탕화면 내컴퓨터 우클릭 => 속성 = >고급 =>환경변수 들어가서 새로만들기 . 변수이름은 PYTHONPATH이고 변수값은 C:Program FilesAutodeskMaya8.5Pythonlibsite-packages로 설정하면 됩니다. 아니면 Python을 실행시킨상태에서 import sys=>sys.path.appand(' C:Program FilesAutodeskMaya8.5Pythonlibsite-packages')를 실행시키면 됩니다.)


This directory is:
site-packages가 있는 경로

* Windows: ../Python/Lib/site-packages
* Mac OS X: ../Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.4/site-packages
* Linux: ../lib/python2.4/site-packages

2. Set the MAYA_LOCATION environment variable to point to Maya's install location, so that Maya can find its resources.
MAYA_LOCATION 환경변수를 Maya의 install 한 위치에 지정하여라, 그러면 Maya는 그것의 resource를 찾을수 있다.

On Mac OS X, the MAYA_LOCATION must be set to point into the application bundle (that is, ../Maya.app/Contents).
Mac os x에서 MAYA_LOCATION은 application bundle에 지정 되어야 한다,

3. (Linux) Add the lib directory of the Maya distribution to the LD_LIBRARY_PATH so that Python can find the shared libraries when importing Maya.
3. (리눅스) LD _LIBRARY_PATH를 Maya의 lib directory에 더하여라, 그러면 maya importing할때 Python은 librarie부분을 찾을수 있다.

Tip
On Mac OS X, the mayapy executable is a shell script which can be copied and modified to use a different Python installation.
mayapy 의 실행가능은 다른 Python installation의 사용을 위해 복사되고 고쳐지는 shell script이다.
To set up the environment without the script
Script 없이 환경변수 지정하기.
1. Add ../Maya.app/Contents/MacOS to the DYLD_LIBRARY_PATH so that Python can find Maya's shared libraries.
1. DYLD_LIBRARY_PATH에 ../Maya.app/Contents/MacOS경로를 추가하여라. 그러면 Python은 Maya의 librarie부분을 찾을수 있다.
2. Add ../Maya.app/Contents/Frameworks to the DYLD_FRAMEWORK_PATH so that Python can find the frameworks that Maya depends upon.
2. DYLD_FRAMEWORK_PATH에 ../Maya.app/Contents/Frameworks경로를 추가 하여라 그러면 Python은 maya가 의존하는 frmawork를 찾을수 있다.
3. Set MAYA_NO_BUNDLE_RESOURCES to some value. This tells Maya to look up resources via MAYA_LOCATION rather than by looking in the main bundle. (When Maya is run in batch this way, then the main bundle is not Maya's main bundle.)
3. some value에 MAYA_NO_BUNDLE_RESOURCES을 지정하라. 이것은 main bundle에서 보는것보다 MAYA_LOCATION을 통해 resources를 찾는것이 좋다는것을 말해준다.(Maya가 이 방법으로 batch일때 main bundle은 Maya의 main bundle이 아니다.

466개(20/24페이지)
마야
번호 제목 글쓴이 조회 날짜
공지 마야 뷰포트 네비게이션 팁 푸딩뱃살 42370 2020.04.06 17:22
공지 Maya 버전 별 Python 버전 푸딩뱃살 63686 2014.01.08 17:59
84 [Rendering] [스크랩] 마야 - 렌더 패스 Tutorial 사진 첨부파일 artsone 4629 2008.01.15 17:26
83 [Rendering] [스크랩] 마야 멘탈레이 - Layer Render [ Occlusion ] 사진 첨부파일 artsone 3869 2008.01.15 17:14
82 [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Current limitations artsone 4299 2008.01.15 17:07
81 [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Important difference artsone 5454 2008.01.15 17:07
>> [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Python from an exter artsone 4852 2008.01.15 17:04
79 [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Python and threading artsone 4691 2008.01.15 17:02
78 [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Using Python 사진 첨부파일 artsone 5491 2008.01.15 16:56
77 [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Python in Maya artsone 5109 2008.01.15 16:54
76 [FX] Rigid Body 테스트 사진 첨부파일 artsone 2261 2007.12.20 16:53
75 [참고] MEL Script Site artsone 2685 2007.12.17 04:31
74 [Base] 단축키 artsone 2062 2007.12.17 03:55
73 [Script] Expression - Time (sin, cos, tan) test 사진 첨부파일 artsone 2708 2007.12.15 05:40
72 [Rendering] UV Check Maps 사진 첨부파일 artsOne 1896 2007.12.09 23:45
71 [Rendering] [스크랩] V-Ray for Maya 사진 첨부파일 artsone 2631 2007.12.06 02:04
70 [Rigging] Squash and Stretch 뼈대 만들기 - IK Spline Handle 활용 사진 첨부파일 artsone 2827 2007.11.18 23:17
69 [Rigging] Squash and Stretch 뼈대 만들기 - IK Handle 활용 2 (만들기) 사진 첨부파일 artsone 2640 2007.11.16 01:14
68 [Rigging] Squash and Stretch 뼈대 만들기 - IK Handle 활용 1 (정의) 사진 첨부파일 artsOne 2509 2007.11.15 13:53
67 [Script] Expression - rad_to_deg 사진 첨부파일 artsone 2673 2007.11.14 19:40
66 [Script] Expression - time 사진 첨부파일 artsone 2320 2007.11.14 19:36
65 [Script] 리깅에 사용되는 Utility Node - Condition Node 사진 첨부파일 artsone 2234 2007.11.13 02:54