Basics – Part 1

Estimated reading: 2 minutes 145 views

Basics Part 1

When creating a new script in most cases we are talking about very simple things. The best example is the Smoothing  Octopus where we are simply triggering a simple two liner mascript.

To learn more about Editable Poly object related actions you normally have to deal with the polyop primitive struct. Under this structure you can find almost all the Editable Poly related functions. (like: getting/setting the vertex, edge or face selections, performing an auto smooth and many other things) Here you can also perform almost all the actions that you are normally doing with hotkeys or from the Mod Panel.

Smoothing Octal Menu

In the Smooth menu, we are basically just adjusting the AutoSmooth Threshold value and hitting the Auto Smooth button, but all of this from a maxscript. If you are using the Smooth octal menu, you just have to hover the mouse cursor over a button to perform the action. But how it works?

So a quick explanation:

The MOST important character is the ‘&’ character. The ‘&’ character represents your selection.

$

When you type this into the listener and hit enter it will return you actual selection in your scene. So when you have a Sphere selected, then it will return your Sphere object. If it’s an Editable Poly object then it will return your Editable Poly object. In the above example I have a Sphere that has been converted to an Editable Poly object.

The Editable Poly object has a bunch of parameters that you can get or set like the autosmooth value:

$.autoSmoothThreshold = 20

To click on the AutoSmooth button we have to use this command:

polyop.autoSmooth &

So the entire script consists of only two lines.

So in short:

  1. Set the Auto Smooth value
  2. Perform the AutoSmooth

Setting Up The Button

To set up the action on a button you just have to create a new menu or select an existing one and simple insert the two lines. In the below example we are setting the threshold to 90, but it’s up to you to use any threshold value.

The entire Smooth Octal menu is using these two lines with different threshold values.

$.autoSmoothThreshold = 90
polyop.autosmooth $

Not complicated right? Let’s get to the second part.

Share this Doc

Basics – Part 1

Or copy link

CONTENTS
Shopping Cart
×