회원 로그인
정보기억 정보기억에 체크할 경우 다음접속시 아이디와 패스워드를 입력하지 않으셔도 됩니다.
그러나, 개인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 참조문 번역 - Important differences between MEL and Python

artsone | 2008.01.15 17:07 | 조회 5454

Important differences between MEL and Python

Miscellaneous differences

* The eval, evalDeferred, scriptJob, and runTimeCommand Maya commands are not supported in Python. However, note the following:
eval, evalDeferred, scriptJob, 그리고 runTimeCommand 와같은 명령어는 Python에서 사용할수 없다. 하지만 다음 사항을 기억하라:

* Python has a built-in eval function for evaluating Python expressions.
* Python은 자체 Python문을 위한 eval 함수를 가지고 있다.
* Python has maya.mel.eval for evaluating MEL expressions.
* Python은 MEL문을 위한 maya.mel.eval 함수를 가지고 있다.
* evalDeferred is replaced by maya.utils.executeDeferred() in Python.
* evalDeferred는 maya.utils.executeDeferred()로 대신 된다.

For more information, seeCalling MEL from Python.

더 많은 정보를 위해 Calling MEL from Python을 보기바란다.

* To access MEL commands created using the MEL runTimeCommand command, use maya.mel.eval; for more information, see Calling MEL from Python.
* MEL명령어로 접근을위해 maya.mel.eval으로 runTimeCommand 쓴다. 추가정보를 위해 Calling MEL from Python보기 바란다.

* MEL has its own warning and error message reporting mechanisms integrated with Maya message reporting. This includes color feedback on the command line. Python comes with system modules that provide warning and error reporting functions; however, these are not integrated into Maya and do not provide color feedback in the command line.
MEL은 Maya message보고와 같은 warning 그리고 error massage보고 장치를 갖이고 있다. 이것은 command line의 color feedback또한 포함한다. Python은 warning그리고 errer massage보고를 지원하는 system module을 갖이고 있다. 하지만 그 module은 maya에 통합되지 않았고 command line의 color feedback역시 지원하지 않는다.

* Units in Python must be specified as strings with quote marks; for example:
Python에 Unit들은 반듯이 (') mark와 함께 문자로 설정되어야 한다. 예)

maya.cmds.scale(3, 3, 3, r=True, p=('0cm', '0.5cm', '0cm'))

* Command flag arguments in Python scripts take either a string that contains a Python script (as the MEL equivalent does) or a Python callable object such as a function.
Python script에서 comand의 flag 인수는 Python script 를 포함한 문자나 Python callable객체를 취한다.

import maya.cmds as cmds

def defaultButtonPush(*args):
print 'Default was pushed.'

cmds.window( width=150 )
cmds.columnLayout( adjustableColumn=True )
cmds.button( label='Default', command=defaultButtonPush )
cmds.button( label='Left', align='left' )
cmds.button( label='Center', align='center' )
cmds.button( label='Right', align='right' )
cmds.showWindow()


Returning and echoing results

There are two ways in which MEL and Python differ in the areas of returning and echoing results. One is relevant to proper script execution while the other is a superficial issue. This section discusses both echoing a result and returning a result -- they are sometimes confused.
MEL과 Python의 returning 과 echoing 결과 쪽의 2가지 다른 것이 있다. 하나는 적절한 script실행관련이고 다른 하는 표면상의 문제이다. 이 영역에서는 echoing결과와 returning의 결과모두 다룬다.

This section will mostly help those who are familiar with MEL, but new to Python.
이 문제는 가끔씩 혼란스러울수 있다. 이 영역은 대개 MEL에는 익숙해 있으나 Python에는 익숙하지 않은 사용자에게 도움이 된다.


Returning Results
When MEL executes a script, it returns the result of the last executed statement, if there is any. Statements that assign values to variables and procedure calls that return results are types of statements which return results. For example, the following block of code will have a result, which MEL will echo to the script editor and command line message area:
MEL이 script를 실행할때 마지막 실행된 명령문의 결과를 돌려준다. 값을 변수와 procedure에 할당하는 Statement는 결과를 반환하는 Statements의 type인 반환 결과를 호출한다. 예, 다음의 code는 결과를 갖이는데 그결과는 script editor와 command line message area에 다시 보여진다.

if ( $foo == 1 )
$bar = 42;
else
$bar = 7;

By contrast, statements that assign values in Python do not return results, though Python executes the assignment.
이에반해, Python에서 값을 할당하는 명령어는 결과를 되돌리지 않는다. 그럼에도 Python은 그 할당을 실행한다.

Python's syntax allows you to simply reference a variable in order to return its value. MEL’s syntax does not permit you to simply write the name of a variable as a complete statement.
Python의 문법은 사용자가 간단하게 변수의 값을 반환하기위해 변수를 참하는것을 허락한다. 그러나 Mel의 문법은 앞의 명령어와 같이 변수의 이름을 간단하게 쓰기를 허용하지 않는다.

The MEL code fragment above could be written as the following in Python. The final line (bar) returns the result.
상위의 MEL code는 다음의 Python code로 쓰여질수 있다. 마지막줄 (bar)는 결과를 돌려준다.

if foo == 1:
bar = 42
else
bar = 7
bar

Understanding this difference is important if you want to use values computed in one language in the context of the other. For example, if you want to use a Python value in MEL, you can simply do the following:
이 차이를 이해하는것은 중요하다. 만약 사용자가 하나의 언어에서 계산된 값을 다른언어의 문맥에서 사용하기를 원한다면. 예, Python의 값을 MEL에서 쓰고 싶다면 사용는 다음과 값이 간단히 할 수 있다:

$myMELvariable = python ("myPythonVariable");

Conversely, if you want to use a MEL variable in Python, you need to do something like:
반데로, 사용자가 MEL의 변수를 Python에서 사용하고 싶다면, 다음과 같이 할 필요가 있다.

import maya.mel
myPythonVariable = maya.mel.eval ('global $myMELvariable; $temp=$myMELvariable;' )

This works because the assignment statement, which is last in the script passed to the eval command, returns a result.

You can access only globally scoped MEL variables in Python.


Echoing Results

MEL echoes the result, if any, returned by the last statement of a script, regardless of how many lines are in it. Python only echoes results of a single statement.

466개(20/24페이지)
마야
번호 제목 글쓴이 조회 날짜
공지 마야 뷰포트 네비게이션 팁 푸딩뱃살 42370 2020.04.06 17:22
공지 Maya 버전 별 Python 버전 푸딩뱃살 63687 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
>> [Script] [스크랩] Maya help에 있는 Python 참조문 번역 - Important difference artsone 5455 2008.01.15 17:07
80 [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