PDA

View Full Version : Scripting Question About Script Used in Render Channel Features on Softimage Site


maddav99
01-17-2007, 02:21 AM
On the Softimage New Features page there is a video for the new Render Channels capablilities and a script used to add an 8 color mixer to all the materials used in any given scene.

http://www.softimage.com/products/xsi/tour/video_tour.aspx?video_id=27

I've tried to copy this script as what I could see in the video, but it failed miserably. As I am fairly new to XSI and don't know scripting in XSI or Visual Basic for that matter I have no idea how to do this. If anyone could tell me what the script is, or how to put it together, or where I can get some "easy to learn" training on how I can do this myself it would be very much appreciated. Thanks in advance.

CiaranM
01-17-2007, 02:32 AM
I'm pretty sure this code was posted by some keen observer on the XSI mailing list. You should try browsing here: http://archives.itg.uiuc.edu/softimage/xsi/

maddav99
01-17-2007, 06:01 AM
Thanks, I'll do that.

maddav99
01-17-2007, 06:09 AM
Yes, it was there. Thanks again. I'll go ahead and post the link and the script for anyone else that might be looking for it.

http://archives.itg.uiuc.edu/softimage/xsi/2007-01/msg00134.htm


var sel = application.selection ;
for (i=0;i<sel.count;i++) {
logmessage(sel(i).fullname) ;
var OldShader = sel(i).Shaders;
logmessage (OldShader(0).name);

SIApplyShaderToCnxPoint ("Texture\\Mixers\\Mix_8colors", sel(i) + ".surface","Buffers",true);
SIConnectShaderToCnxPoint (OldShader(0), sel(i) + ".Buffers.base_color", false);
SIConnectShaderToCnxPoint(sel(i) + ".Buffers", sel(i) + ".shadow", false);
SIConnectShaderToCnxPoint(sel(i) + ".Buffers", sel(i) + ".Photon", false);
for (j=1;j<7;j++) {
SetValue(sel(i) + ".Buffers.inuse" + j, true, null) ;
SetValue(sel(i) + ".Buffers.weight" + j +".red", 0, null);
SetValue(sel(i) + ".Buffers.weight" + j +".green",0, null);
SetValue(sel(i) + ".Buffers.weight" + j +".blue", 0, null);

}
}

maddav99
01-17-2007, 06:38 AM
New problem- I keep getting an error every time I try to run the script-

' ERROR : Expected end of statement - [line 1]

As I said, I am not fluent with scripting in XSI and really don't know what this means, especially when I see it used just fine in the videos. HELP. Anyway, any guidance is much appreciated.

maddav99
01-17-2007, 06:44 AM
Now I think I made it worse. I tried to add it as a button on a toolbar and run it and I got this error-

' ERROR : Expected end of statement - [line 1]
' ERROR : (Microsoft VBScript compilation error)
' ERROR : >[1] var sel = application.selection;
' ERROR : [2] for (i=0;i<sel.count;i++) {
' ERROR : [3] logmessage(sel(i).fullname) ;
' ERROR : [4] var OldShader = sel(i).Shaders;
' ERROR : Expected end of statement
I, obviously, do not know what I'm doing with this script!

5quid
01-17-2007, 07:14 AM
try changing the scripting engine to JScript (in the prefs of the script editor)

maddav99
01-17-2007, 11:11 PM
That was it, thanks. I figured it was something simple, it was just, entirely, a matter of knowing what to do. Thanks again.

CGTalk Moderation
01-17-2007, 11:11 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.