Posted by: | ![]() | lukacs16 |
Data created: | 16 April 2010 |
Hello! I 've a question, I hope you can help me! So, how can declare the 'global' parameter in here: string myNode = MaxScriptExecute("$myNode", global).ToNode; | |
16 April 2010
#1761 | |
My problem is, I've a finished Maxscript script and I 'd like to run in c# ... It's create few model, and export that. It is possible? | |
16 April 2010
#1763 | |
Hi, Please have a look at this. Marsel Khadiyev (Software Developer, EPHERE Inc.) | |
16 April 2010
#1765 | |
Yes, I already saw that, but that was my first question, So, how can declare the 'global' parameter in here, what is the type: string myNode = MaxScriptExecute("$myNode", global).ToNode; | |
19 April 2010
#1770 | |
Yes, you 've right, I just don't interpreted your answer. Now that is work, but my other question, if I want to execute the script, I get a "NullReferenceException was unhandled" error. Do you have any idea why?
public class MyPlugin: IPlugin { private IGlobal _global; public void Initialize(IGlobal global, ISynchronizeInvoke sync) { // Use or store global for later use... this._global = global; }
internal static IValue MaxScriptExecute(string str, IGlobal global) { bool res = false; return global.ExecuteScript(global.StringStream.Create(str), res); }
public void runScript() { IINode myNode = MaxScriptExecute("assembly = dotNet.loadAssembly \"C:\\temp_viewer\\max.dll\""+ "ThisTestObject = dotNetObject \"max.TestObject\""+ "end = (ThisTestObject.readFromFile \"C:\\temp_viewer\\test.txt\")" + "for i= 0 to end - 1 do"+ "("+ "actionMan.executeAction 0 \"40021\" -- Selection: Select All" + "actionMan.executeAction 0 \"40020\" -- Edit: Delete Objects" + "Box lengthsegs:1 widthsegs:1 heightsegs:1 length:(ThisTestObject.zValue i) width:(ThisTestObject.xValue i) height:(ThisTestObject.yValue i) mapcoords:on pos:[-2.95203,1.10701,-130] isSelected:on"+ "modPanel.addModToSelection (Edit_Poly ()) ui:on"+ "meditMaterials[1] = Multimaterial ()"+ "meditMaterials[1].material1.diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\top.bmp\")"+ "meditMaterials[1].materialList[2].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\bottom.bmp\")"+ "meditMaterials[1].materialList[3].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\left.bmp\")"+ "meditMaterials[1].materialList[4].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\right.bmp\")"+ "meditMaterials[1].materialList[5].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\front.bmp\")"+ "meditMaterials[1].materialList[6].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\back.bmp\")" + "$.material = meditMaterials[1]" + "ExportFile (\"C:\\temp_viewer\\rubic_cube\" + (i as string)+ \".fbx\") #noPrompt"+ ")", _global).ToNode; } } } | |
27 April 2010
#1842 | |
Hey, did you get this resolved? I replied to you on CGTalk regarding this (asking why you place the code in Cleanup method). Marsel Khadiyev (Software Developer, EPHERE Inc.) |