Interface: SME
The SME Core Interface introduced in 3ds Max 2011 exposes properties and methods related to the Slate Material Editor.
Interface: SME
Properties:
sme.activeView : index : Read|Write
Get/set the Slate Material Editor's active View.
sme.fileDropCallback : value : Read|Write
Get/set a callback that can process files dropped into the SME window.
The callback takes three parameters:
- A boolean flag indicating whether the callback should just test whether the files can be dropped. If true, the callback does not process the files, but should instead indicate whether it could handle the files. If the callback returned true in the first (testing) callback, the cursor will indicate the user the ability to drop and on drop the callback is called again (this time with test set to false).
- A list of files in the drag and drop operation
- The position of the mouse in the active NodeView. This can be used to create new nodes and the cursor position.
If the callback returns true, the native drag'n'drop handling of SME will not be performed.
For example:
fn dropme test urls pos = (
print urls
isSuccess = false
for url in urls do (
if (getFilenameType (pathConfig.stripPathToLeaf url)) == ".jpg" then
(
if test == true then
(
isSuccess = true
)
else
(
bm = openBitMap url
bmt = bitmapTexture()
bmt.bitmap = bm
sm = PhysicalMaterial()
sm.base_color_map = bmt
pos.x -= 100
pos.y -= 40
node_view = SME.getView SME.activeView
node_view.CreateNode sm pos
isSuccess = true
)
)
)
return isSuccess
)
SME.fileDropCallback = dropme
sme.thumbnailCacheValid : boolean : Read
For internal use.
Methods:
<void>sme.Open()
Opens the Slate Material Editor.
<void>sme.Close()
Closes the Slate Material Editor.
<boolean>sme.IsOpen()
Returns true if the Slate Material Editor is open, false if it is closed.
<integer>sme.GetNumViews()
Returns the number of Node Views as an integer.
<index>sme.CreateView <string>name
Creates a new Node View with the given name and returns its index.
<IObject>sme.GetView <index>index
Returns an IObject:IFP_NodeViewImp object representing the indexed Node View.
<index>sme.GetViewIndex <IObject>view
Returns the index of the given Node View IObject:IFP_NodeViewImp object.
<index>sme.GetViewByName <string>name
Returns the index of the named Node View.
<void>sme.DeleteView <index>index <boolean>ask_user
Deletes the indexed Slate Material Editor view.
If the second argument is true, prompts the user for confirmation, otherwise deletes the view without prompting.
<maxObject>sme.GetMtlInParamEditor()
Returns the material or map current displayed in the Parameter Editor of the Slate Material Editor.
sme.SetMtlInParamEditor <maxObject>
Sets the material or map to be displayed in the Parameter Editor of the Slate Material Editor.
Available in 3ds Max 2014 and higher.
<Interface>sme.GetNavigator()
Returns an WndBase Interface to the Slate Material Editor's Navigator.
<Interface>sme.GetMaterialPool()
Returns an WndBase Interface to the Slate Material Editor's Material Pool.
<Interface>sme.GetParamEditor()
Returns an WndBase Interface to the Slate Material Editor's Parameter Editor.
<Interface>sme.GetMainframe()
Returns an WndBase Interface to the Slate Material Editor's Main Frame.
<maxObject>DoMtlBrowseDlg <HWND>parent <integer>flags <&boolean>newMat <&boolean>cancel fromLibrary:<&boolean> copiedMaterial:<&boolean>
newMat is In and Out parameter
cancel is In and Out parameter
fromLibrary default value: undefined
fromLibrary is In and Out parameter
copiedMaterial default value: undefined
copiedMaterial is In and Out parameter
Opens a modal Material/Map browser dialog.
The first argument is the window handle of the parent window, use 0 for none.
The second argument is a flags value controlling the display of materials and maps in the dialog. Possible Flag values are:
1,5,9... - Materials, Sample Slots
2,6,10... - Maps
0,3,7,11... - Maps, Materials, Sample Slots
4,8,12... - None
The third by-reference argument will contain true if a new material was created, false if an existing one was picked.
The fourth by-reference argument will contain true if the Cancel button was clicked, false if the OK button was clicked.
EXAMPLE
isNew = false
isCanceled = false
c = sme.DoMtlBrowseDlg 0 0 &isNew &isCanceled
<void>sme.OpenMtlBrowseDlg()
Opens the Material Browser Dialog.
<boolean>sme.OpenMtlLib <string>path name:<string>
name default value: ""
Opens the material library specified by the file path and optional name. If only the material library file name is specified in the path, the current material library directory is searched for the specified filename. The optional name parameter can specify a path to a library as it is named in the Material Browser, where backslashes denote folder hierarchy. For example, "Maps\OSL\Shiny Things" would open a material library named "Shiny Things" in a folder named "OSL" in the folder named "Maps". Available in 3ds Max 2021 and higher. Returns true if the library was successfully found and opened, false if not.
For example:
sme.OpenMtlLib "Nature.mat"
<boolean>sme.HasMtlLib <string>path
Returns true if the specified material library is open in the Slate Material Editor. Available in 3ds Max 2021 and higher.
<boolean>sme.IsMtlLibModified <string>path
Returns true if the specified material library has been modified (materials have been added, deleted, or changed), false if not. Available in 3ds Max 2021 and higher.
<boolean>sme.SaveMtlLib <string>path [saveAsVersion:<integer>]
Saves the specified material library, returning true if successful, false if not. Available in 3ds Max 2021 and higher.
The optional saveAsVersion
parameter specifies the version of 3ds Max for which the saved archive is compatible. This version can be one of the three previous versions. If not specified, the current 3ds Max version is used.
<boolean>sme.SaveMtlLibAs <string>path newPath:<&string> [saveAsVersion:<integer>]
newPath default value: ""
newPath is In and Out parameter
Saves a copy of the specified material library from the location and file name specified by path
to the optional newPath
. If newPath
is empty, a file chooser dialog is displayed and the user is prompted for a new path and filename, and the selected path is returned in newPath
.
Available in 3ds Max 2021 and higher.
The optional saveAsVersion
parameter specifies the version of 3ds Max for which the saved archive is compatible. This version can be one of the three previous versions. If not specified, the current 3ds Max version is used.
<boolean>sme.CloseMtlLib <string>path
Closes the material library specified by path
.
Available in 3ds Max 2021 and higher.
IFP_NodeViewImp : IObject
Interface: NodeView
Properties:
.name : string : Read|Write
Get/set the name of the Node View.
Methods:
<integer>GetNumNodes()
Returns the number of nodes in the View.
<Interface>GetNode <index>index
Returns the Node Interface of the indexed node from the View.
<Interface>GetNodeByRef <maxObject>ref
Returns the Node Interface to the given Material or Map object reference, or undefined if the reference does not exist in the Node View.
<Interface>CreateNode <maxObject>ref <&point2>pos
pos is In and Out parameter
Creates a new node from the given Material or Map object reference at the position specified by-reference.
<void>DeleteSelection()
Deletes the selected nodes.
<void>SelectNone()
Deselects all nodes in the Node View.
Available in 3ds Max 2014 and higher.
<void>SelectAll()
Selects all nodes in the Node View.
Available in 3ds Max 2014 and higher.
<void>SelectInvert()
Inverts the node selection in the Node View.
Available in 3ds Max 2014 and higher.
<void>GetSelectedSceneMaterials()
Selects and zooms to materials in the node view that are on selected objects in the scene.
<void>GetAllSceneMaterials()
Selects all scene materials in the node view.
<void>LayoutAll()
Lays out all the material nodes in the Node View so they are arranged nicely.
<Interface by value array>GetSelectedNodes()
Returns the selected nodes in the Node View as an array of Node Interfaces.
Available in 3ds Max 2014 and higher.
<void>SetSelectedNodes <maxObject by value array>refs
Sets the Node View selection to the array of Materials and/or Maps object references provided as argument.
Setting the selection will deselect any other previously selected nodes.
This function will not open any items in the Parameter Editor - you can use the sme.SetMtlInParamEditor()
method documented earlier in this topic.
Available in 3ds Max 2014 and higher.
<void>ZoomExtents type:<enum>
type enums: {#all|#selected}
type default value: #all
Zooms the Node View to show all nodes or all selected nodes according to the type optional keyword argument.
Available in 3ds Max 2014 and higher.
<Interface>PackageSelectionIntoCompound <&point2>pos
pos is In and Out parameter
Creates a new Compound
node from the currently selected nodes at the specified pos
, returning the Compound
interface for the new node.
<Interface>PackageNodesIntoCompound <maxObject array>refs <&point2>pos
pos is In and Out parameter
Creates a new Compound
node from the nodes in the refs
array, returning the Compound
interface for the new node.
<Interface array>UnpackageCompound <maxObject>ref
Unpacks the specified ref
Compound node into its component nodes in the current NodeView
.
<boolean>EditCompound <maxObject>ref
Enters or exits the Compound edit view in the SME Editor, for the specified ref
object, and return true on success, false on failure. Note that the ref
is not a Compound
node, but rather the underlying object (the .reference
property of the Compound).
Interface: WndBase
Properties:
.position : point2 by value : Read|Write
Get/set the Position of the Node View.
.size : point2 by value : Read|Write
Get/set the Size of the Node View.
.visible : boolean : Read|Write
Get/set the Visibility of the Node View.
Methods:
<void>SetFocus()
Sets the focus on the Node View.
<Interface>GetParent()
Returns the WndBase interface of the Parent of the Node View.
Interface: Node
Properties:
.name : string : Read|Write
Get/set the name of the Node.
.position : point2 by value : Read|Write
Get/set the Position of the Node inside the Node View.
.width : integer : Read|Write
Get/set the width of the node inside the Node View.
.height : integer : Read
Get the height of the node inside the Node View. This property is read-only.
.selected : boolean : Read|Write
Get/set the Selected state of the Node.
Available in 3ds Max 2014 and higher.
.hideUnusedNodeSlots : boolean : Read|Write
Get/set whether to hide unused parameter slots on the node.
.reference : maxObject : Read
Gets the underlying material or texture object for the node.
Methods:
<void>SelectChildren()
Selects all the child nodes for the node in the SME.
<void>ShowAllAdditionalParams <boolean>show openMode:<enum>
openMode enums: {#topLevelOnly|#recursive}
openMode default value: #topLevelOnly
Shows (show
=true) or hides (show
=false) the additional parameters rollout for the node in the SME. If show
is specified as true, you can also specify the openMode
keyword parameter, where:
#topLevelOnly
- only the top level of additional parameters is displayed (the default)#recursive
- if any additional parameters are wired to nodes, the additional parameters rollout is also displayed on those nodes.