v4.0
Returns the filename of the script or module containing the
custom operator definition as a String.
Note: This is not used for custom operators that are runtime
operators, which are implemented on the fly (that is, the
definition of the custom operator is contained within the scene and
not saved on file). If you use this on a runtime operator, an empty
string is returned.
// get accessor String rtn = CustomOperator.FileName; |
NewScene( null, false ); var filename = Application.InstallationPath(siUserPath) + "\\Data\\Scripts\\MySOP.js"; // save scripted operator code to disk var fso = XSIFactory.CreateActiveXObject("Scripting.FileSystemObject"); var f = fso.CreateTextFile(filename, true); f.WriteLine( Update.toString() ); f.Close(); // Create a scripted operator connected to posx var null1 = GetPrim( "Null" ); var sop = null1.posx.AddScriptedOpFromFile( filename ); Application.LogMessage( "logic of scripted op defined in: " + sop.filename ); Application.LogMessage( "code of scripted op = " + sop.code ); // The operator's update function function Update( ctx, out ) { out.Value = 0.00; } |