Alrigh, i managed to add the shader to the menù, and it works fine, the only weird thing that happens is once i apply it to an object it pops up the Phong PPG instead of its own PPG. Anyone have any clue how to solve this?
Here is the code i used. It works and it applies the shader, but it pops up wrong PPg.
Code:
# 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
Thanks everyone, and thx Hirazi