I am having trouble with something. I am trying to get the currently selected material in the Slate material editor and assign it to the object/s selected in the viewport. I found a script on ScriptSpot by Pixamoon, which is basically a funtion, which returns the currently selected object in the SME. Here it is:
function SMEGetSelMats = ( viewNode = sme.GetView (sme.activeView) smeSelMats = #() for n = 1 to trackViewNodes[#sme][(sme.activeView)].numSubs do ( m = trackViewNodes[#sme][(sme.activeView)][n].reference b = viewNode.GetNodeByRef m if b.selected do append smeSelMats m ) return smeSelMats ) newmat = SMEGetSelMats() selection.material = newmat --do something here print (SMEGetSelMats())
So that means that once I got that selected material I just have to write the code to apply it to the selected object/s in the scene, right? For some reason, I can’t get it working. Do you know why is that?
Any help will be greatly appreciated!
Thanks in advance!