Tryin in all the ways i could think of but no success. This would be handy
Thanks a lot
Max
I do hope I've recalled this correctlyCreate a Preset of the Material node
Create a Custom Command using the Wizard
In this Wizard set the menu option to "siMenuTbGetMaterialID"
Generate Code
In the Custom Command Definition use Application.ApplyShader to apply the preset.
Save Command
I'm studying metals and found a way to achieve them in a realistic way (ala maxwell), wanted to add those in the menù, but still a bit of time before they are ready.Rork wrote:Still tinkering with your material presets I assume? ;)
Code: Select all
# mia_material
# Initial code generated by Softimage SDK Wizard
# Executed Fri Jun 15 03:26:17 UTC+0200 2012 by Max
#
# Tip: To add a command to this plug-in, right-click in the
# script editor and choose Tools > Add Command.
import win32com.client
from win32com.client import constants
null = None
false = 0
true = 1
def XSILoadPlugin( in_reg ):
in_reg.Author = "Max"
in_reg.Name = "mia_material"
in_reg.Major = 1
in_reg.Minor = 0
in_reg.RegisterCommand("Mia_Material","Mia_Material")
in_reg.RegisterMenu(constants.siMenuTbGetMaterialID,"Mia_Material_Menu",false,false)
#RegistrationInsertionPoint - do not remove this line
return true
def XSIUnloadPlugin( in_reg ):
strPluginName = in_reg.Name
Application.LogMessage(str(strPluginName) + str(" has been unloaded."),constants.siVerbose)
return true
def Mia_Material_Init( in_ctxt ):
oCmd = in_ctxt.Source
oCmd.Description = ""
oCmd.ReturnValue = true
return true
def Mia_Material_Execute( ):
Application.LogMessage("Mia_Material_Execute called",constants.siVerbose)
#
def Mia_Material_Execute( ):
Application.LogMessage("Mia_Material_Execute called",constants.siVerbose)
Application.ApplyShader("", "", "", "", "siLetLocalMaterialsOverlap")
sel = Application.Selection(0).Material
Application.LoadPreset("C:\\Users\\Max\\Autodesk\\Softimage_2013\\Data\\DSPresets\\Shaders\\Material\\mental images\\mia_Material.Preset", str(sel))
return true
def Mia_Material_Menu_Init( in_ctxt ):
oMenu = in_ctxt.Source
oMenu.AddCommandItem("Mia_Material","Mia_Material")
return true
Code: Select all
Application.SetValue("preferences.Interaction.autoinspect", false, null)Code: Select all
Application.InspectObj(sel)