Link:INB Home|INB English| INB русский язык|INB العربية|INB Türkiye|INB فارسی|INB Español|INB Français|INB Português|INB Deutsch|INB 國語|INB 中文|INB 日本语|INB 한국어|INB ภาษาไทย|INB tiếng Việt||Maya 3D Tutorial One early solution mel language
INB English forum
Welcome to (Industry & Native boffin) The industrial age here is full of fighting spirit, you and I both through this network space with Native biological spirit boffin came to the mad labs. home, come and join us Permanent name:
INB English forum

Welcome to (Industry & Native boffin) The industrial age here is full of fighting spirit, you and I both through this network space with Native biological spirit boffin came to the mad labs. home, Permanent name:

You are not connected. Please login or register

《《《《《《《上一页INBforum   Go down

上一页INBforum》》》》》》》View previous topic View next topic Go down  Message [Page 1 of 1]

1 Maya 3D Tutorial One early solution mel language on Thu Oct 09, 2014 4:08 am


[You must be registered and logged in to see this image.]
To write a little mel literacy tutorials, mainly for beginners Maya people, if you've learned more than a month of Maya, then you can learn this mel tutorial. Maya does not have to wait very skilled master before going to school mel, On the contrary, if you are a novice when it right mel Maya understand, that for the future a better understanding and knowledge of Maya will play a multiplier effect.

Of course, the first thing to mention is the basic concept of mel as follows:
mel is Maya Embedded Language (Maya built-in language) acronym, is a powerful command and scripting language lets you direct control of Maya's features, processes and workflows.

Second, we must mention is what should adopt the attitude:
Many people think mel more difficult, my view is that the game is not difficult than research on the Internet often see someone attack a month off to spend time learning mel if we can achieve this state will be very great. Science may indeed be Kuzao mel, because so many people can not find you like CS kill.
mel is a very flexible thing, if you do not engage in program development, it should be possible to let mel to save you time, but do not spend too much time studying and writing mel procedures should be written in a simple and practical procedure . Do not blindly pursue advanced technology and delay your precious time bubble MM \
My tutorial is written for it, if you are ready, you and I went into mel's world now.

Today to talk about is the command combinations.
Open Maya, on the command line (Command Line) input "cone" and press Enter, view, create a cone.
If you do not see the command line, use Display-> UI Elements-> Command Line to display it.
You may ask to use the command line to create a cone with a menu created with any difference. I'll tell you, but the difference in form, in essence, menus and commands are executed mel command line, you can say you every move in Maya mel commands are executed.

Now open mel Editor (Script Editor), mel editor in two parts, the above is a historical window, here is the editing window.
History window displays the results you just execute the command or commands and error messages.
Editing window can enter the command, but you can enter multiple lines of command, but the command must end with a semicolon after each MEL.
Select mel editor menu Edit-> Clear History, the History window cleaner look.

"Cone -ax 0 1 0 -r 1;" and press Ctrl + Enter or the other side of the numeric keys Enter, view, create a cone upright input in the edit window. Look at the history of windows, more than two lines, the first line is just executed commands, the second line is the return value (Return Result) command. I will focus on talking about the return value of tomorrow, today, the first to explain the flag (Flag).
Just that "-ax" and "-r" is the "cone" sign command, usually a sign points the length of two ways for writing, such as "-r" and "-radius" is the same flag, write what will do. Long logo looks relatively clear, but it was easier to write a short mark. Therefore, you are more familiar with the signs, try to use short signs, are not familiar with it with a long flag.
Change it "cone" command "-r" behind the number, for example into "cone -ax 0 1 0 -r 3" and then executed, found a cone radius to create bigger, so you can know -r / - radius is controlled cone radius.

Of course "cone" command, there are many signs, to understand this command, the best way is to look at the help documentation, Maya offers a specially mel command (that help command) to quickly look for help. The implementation of "help -doc cone", you can open the help document cone command.
To see help all mel command, select the Maya menu Help-> MEL Command Reference ...
Maya's help file contains a total of nearly one thousand mel command, it sounds horrible. But never mind, in order to free survival in the harsh environment, we must first learn to turn a blind eye to the difficulties. See help by category (Categories) to see, as long as you're interested in looking through several categories on the line, if you are not interested, they do not look up, and so used the turn too late to go.

Now a serious problem in front of you is how you nearly a thousand from mel command to find that command you want. Do not worry, though you are not familiar with mel, but you are still not familiar with Maya's menu bar is not. Select Create-> NURBS Primitives-> Cone to create a cone, then you will find the history window mel more than a line command, where "cone -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -hr 2 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 1 -ch 1; "is a complete command to create a cone. Look at the command line command phrase, you will find you can get the same result with the menu. With this method, you do not have to master the mel command you worry a little while.

What you might have been aware of every step of the operation command means, that is, you can write these commands together, and then all of a sudden execution, like macros in Office and Photoshop in the Actions same. Well, it started.

Although Maya now supports default lighting rendering, but we often still hit a lamp to look at the modeling results. The specific process is to create a light, then move it to an appropriate location, and then rotate the angle, and then also adjust the brightness. If you often want to make light observation model, you will want to point a button to complete all of this, we have an instance of a will to solve this problem now.
-------------------------------------------------- ----
Example 1: display lights
First clean the window ready to record history mel command.
Select Create-> Lights-> Directional Light creates a straight spotlights, searchlights left behind the move to direct it, and then rotate the view so that it points to the direction of the center, Ctrl + a to open the property editor, the lights of the property (Intensity) to 1.2.
Then take a look at the history mel window, much like the following lines:
defaultDirectionalLight (1, 1,1,1, "0", 0,0,0);
move -r -5.393374 -0.124913 3.360977;
rotate -r -os -33.086209 0 0;
rotate -r -os 0 -24.179269 0;
setAttr "directionalLightShape1.intensity" 1.2;

These few lines are selected, with the left mouse button to drag it to the Shelf toolbar, you will find more than a mel on Shelf icon.
Create a file, click the icon mel, you will find success.

General user-written procedures are commonly placed Shelf mel inside, so you need to look for Shelf. The left mouse button in the lower left corner of the triangle where the press Shelf, in the drop-down menu to select the Shelf Editor ... Open Shelf editor.
About Shelf editor I do not speak up, you will understand the blind by moment. I would say that since you've started to learn mel, and to so many mess Shelf no use, you can only stay a General, others are deleted, and then create a Shelf, called myTools.
Note that I said these operations are carried out in the Shelf editor, do not go "your documents \ maya \ 5.0 \ prefs \ shelves" where to delete Shelf, then start Maya who otherwise would resurrection Shelf .
Change also Shelf Shelf icon editor, you can put that ugly mel icon into your favorite beauty.
Maya people in Hollywood to see the working interface used, are their own customized Shelf, we are not as good as others elsewhere, which is still much like with others.

Now explain just a few commands. With your understanding of English, in fact, few would have guessed that this meant it.

"defaultDirectionalLight" is to create a direct spotlights.
"move" is moving, "- r / -relative" is often used, meaning that the object relative to the current position.
Such as "move -r 1 0 0;" is said to move the object along the X-axis of a grid, and "move 1 0 0;" is said to "translateX" properties of objects to 1, "translateY" and "translateY" property is set to 0.
"rotate" used twice, is rotated twice, look at the value of the right of the channel box rotation, you can put a few words and make the sentence is "rotate -35.534708 -20.070585 13.771703;". "-os" refers to the object coordinate axis, the relative "-ws" in the world in terms of the coordinate axes. To get the object along the world coordinate axis, double-click the icon to open the tool rotary tool settings window, the Rotate Mode from Local to Global can.
"setAttr" is to set the property, this is a critical command, you need to pay attention to it.

You will not be unfamiliar for the property, which is the key to set up the animation. Properties can be modified in the Attribute Editor (Attribute Editor) and channel box (Channel Box), you can also directly modify the use mel's "setAttr". Written object attribute is an object name + "." + Attribute name (object.attribute), attribute names have the same length as two mel sign wording. Select the channel menu Channels-> Channel Names -> ... can switch the length of the name is displayed, usually to see that "Nice" were just to look good, at mel and expressions are useless.
I'll want to understand the properties mentioned expressions have decisive significance, the expression is through the object between the property and the time to establish some kind of relationship between attributes and attribute computing to control the animation.

According to the previous statement, "move 1 0 0 nurbsCone1;" can also be written as:
setAttr "nurbsCone1.translateX" 1;
setAttr "nurbsCone1.translateY" 0;
setAttr "nurbsCone1.translateZ" 0;
setAttr "nurbsCone1.tx" 1;
setAttr "nurbsCone1.ty" 0;
setAttr "" 0;

Finally, let us to compile a more practical combination mel command bar.
-------------------------------------------------- ----
Polygon Modeling head, generally half of the face is first built, built before the mirror, and then sleek look.
You build half of the face, it is hard to imagine the whole face look sleek mirrored bar. You now have learned mel command combinations that can achieve points a button to complete the mirror and sleek, so you can preview what the process is completed in the modeling results. Behind this useful program will continue to improve it, give it name from an image myFullMoon (full moon), the version is set at 1.0.
-------------------------------------------------- ----
Examples 2: myFullMoon1.0
Open your file half of his face, in order to reduce unnecessary trouble during the operation, we first look at the model of standardization:
If your model is the right half of the face, turning it into the left half of the face. To ensure that you can see the front view of the front face of the model, see the side face side view, top view to see the head. The model is placed on the left view centerline. Select the model, select Modify-> Center Pivot, select Modify-> Freeze Transformations, select Display-> Component Display-> Backfaces not displayed on the back, as shown, remember that your width is several lattice model. Do not forget to clean the window mel history.
Specification Well, keep what dish.

Select the model, you can now start recording commands.
Select the menu Edit Polygons-> Extrude Face.
History records the four lines mel command window, you have to know is that only one line is useful to you. Want to know why? You try to separate each command to know, only
polyExtrudeFacet -ch 1 -kft 0 -pvx -3.926295877 -pvy -1.118658066 -pvz 4.649739981 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -divisions 1 -off 0 -ltz 0 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 0 -ldz 0 -w 0 -gx 0 - gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 polySurface1.f [0: 682];
Phrase can be extruded surface.

Now we have to change a few properties in the channel box, Keep Face Tog property to on, Scale X is -1, Translate X model width negative (I was -7.5).
History of more than three lines of windows useful commands:
setAttr "polyExtrudeFace1.keepFacesTogether" on;
setAttr "polyExtrudeFace1.translateX" -7.5;
setAttr "polyExtrudeFace1.scaleX" -1;

Now you can see the normal model face backwards, well, it being over. Press F8 to return to object selection mode, select Edit Polygons-> Normals-> Reverse.
This time you should be seen from a few lines of command useful commands:
polyNormal -normalMode 0 -ch 1 polySurface1.f [0: 1449];

The next step is Polygons-> Smooth, find the phrase command:
polySmooth -mth 0 -dv 1 -c 1 -kb 1 -ksb 1 -khe 0 -kt 1 -sl 1 -dpe 1 -ps 0.1 -ro 1 -ch 1 polySurface1.f [0: 1449];

Finally, select Cancel models:
select -cl;

Well, the end of the operation. To sort out useful commands it, the results are as follows:
polyExtrudeFacet -ch 1 -kft 0 -pvx -3.926295877 -pvy -1.118658066 -pvz 4.649739981 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -divisions 1 -off 0 -ltz 0 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 0 -ldz 0 -w 0 -gx 0 - gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 polySurface1.f [0: 682];
setAttr "polyExtrudeFace1.keepFacesTogether" on;
setAttr "polyExtrudeFace1.translateX" -7.5;
setAttr "polyExtrudeFace1.scaleX" -1;
polyNormal -normalMode 0 -ch 1 polySurface1.f [0: 1449];
polySmooth -mth 0 -dv 1 -c 1 -kb 1 -ksb 1 -khe 0 -kt 1 -sl 1 -dpe 1 -ps 0.1 -ro 1 -ch 1 polySurface1.f [0: 1449];
select -cl;

These few lines of command are selected, with the left mouse button to drag it to the Shelf toolbar, mel icon appears on the Shelf. Reload the model file, click the icon mel, you once again a success

For Maya people will feel a little familiar with the three setAttr with very stupid, because the problem can be solved entirely in sign polyExtrudeFacet command.

In fact, our first step is only required to do, the second step is the requirement to do. The following is the result of over-simplification:
polyExtrudeFacet -ch 1 -kft 1 -pvx -3.926295877 -pvy -1.118658066 -pvz 4.649739981 -translateX -7.5 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -scaleX -1 -sy 1 -sz 1 -ran 0 -divisions 1 -off 0 -ltz 0 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 0 -ldz 0 -w 0 -gx 0 -gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 polySurface1.f [0: 682];
polyNormal -normalMode 0 -ch 1 polySurface1.f [0: 1449];
polySmooth -mth 0 -dv 1 -c 1 -kb 1 -ksb 1 -khe 0 -kt 1 -sl 1 -dpe 1 -ps 0.1 -ro 1 -ch 1 polySurface1.f [0: 1449];
select -cl;

Mel command on using a combination of methods, the last thing to mention, I found mel history window if you execute the command does not change, you can check the Script-> Echo All Commands in mel editor. Generally, we do not need to display so many commands, because many of our useless, so do not choose Echo All Commands.]

View user profile

上一页INBforum   Go down

上一页INBforumView previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum

Copyright ©2009-2016 LTD Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.



Create a forum on Forumotion | © PunBB | Free forum support | Contact | Report an abuse |