MaxScript Debug

Tuesday, December 21, 2010

Type Error: Call needs function of class, got undefined

--Solution: Your functions may be in the wrong order in your macroscript.

If function A calls function B, then function B must appear FIRST in the script.
The maxscript compiler is not very smart.

Monday, December 20, 2010

Iterate through all objects in a maxscript scene

allObjects = $*
for OBJ in allObjects do(
print OBJ as string
)


--Or you could try this if you just want geometry objects:

for OBJ in Geometry do(
print OBJ as string
)

I am sure there are other keywords corresponding to cameras and such...
But information on this was surprisingly hard to find.
If it were python this would have been 2 minutes of research.

Saturday, June 5, 2010

#Maps List for Default Material Within Multi_Sub

--meditMaterials[2].materialList[1][#Maps][1] = SubAnim:Ambient_Color_Amount
--meditMaterials[2].materialList[1][#Maps][2] = SubAnim:Ambient_Color__None
--meditMaterials[2].materialList[1][#Maps][3] = SubAnim:Diffuse_Color_Amount
--meditMaterials[2].materialList[1][#Maps][4] = SubAnim:SubAnim:Diffuse_Color__Bitmaptexture__DigiScroLL_00000_ifl
--meditMaterials[2].materialList[1][#Maps][5] = SubAnim:Specular_Color_Amount
--meditMaterials[2].materialList[1][#Maps][6] = SubAnim:Specular_Color__None
--meditMaterials[2].materialList[1][#Maps][7] = SubAnim:Specular_Level_Amount
--meditMaterials[2].materialList[1][#Maps][8] = SubAnim:Specular_Level__None
--meditMaterials[2].materialList[1][#Maps][9] = SubAnim:Glossiness_Amount
--meditMaterials[2].materialList[1][#Maps][10]= SubAnim:Glossiness__None
--meditMaterials[2].materialList[1][#Maps][11]= SubAnim:Self_Illumination_Amount
--meditMaterials[2].materialList[1][#Maps][12]= SubAnim:Self_Illumination__None
--13: SubAnim:Opacity_Amount
--14: SubAnim:Opacity__None
--15: SubAnim:Filter_Color_Amount
--16: SubAnim:Filter_Color__None
--17: SubAnim:Bump_Amount
--18: SubAnim:Bump__None
--19: SubAnim:Reflection_Amount
--20: SubAnim:Reflection__None
--21: SubAnim:Refraction_Amount
--22: SubAnim:Refraction__None
--23: Displacement_Amount
--24: Displacement__None
--25: SubAnim:_Amount
--26: SubAnim:__None
--27: SubAnim:_Amount
--28: SubAnim:__None
--29: SubAnim:_Amount
--30: SubAnim:__None
--You can hypothesize what the rest are.

Flash Code Displayer

I really need to finish my code displayer... It is getting ridiculous trying to post code on this blog...
Its unreadable when it removes my spaces and tabs.

SetSelection with Edit_Poly Modifier

So, I was having tons of trouble trying to set material ID's with an edit_poly modifier.
I looked at this forum and almost got my answer:
http://forums.cgsociety.org/archive/index.php/t-651273.html

Here is the solution:
--Step1: You must have the right mode and command panel settings before select command will work.
max modify mode
modPanel.setCurrentObject THE_CIL.modifiers[#Edit_Poly]
YOUROBJECT.modifiers[#Edit_Poly].SetEPolySelLevel #Face


--Step2: Now you can select
--Example1: Simple Select
YOUROBJECT.modifiers[#Edit_Poly].Select #Face #{1} --Select faces via bitarray

--Example2: Convert Array to bit array.
TheArray = #(1,2,3,4); --Numbers in array corrospond to faces to select.
--Could make this array in a do-loop.
BITarr = (TheArray as bitarray) --Convert normal array to bit array.
YOUROBJECT.modifiers[#Edit_Poly].Select #Face BITarr --Select faces via bitarray

--Sign:PolygonRunner

Followers