[Closed] Camera_Map_Per_Pixel () camera node name
Hi everyone,
I’m trying to create an array of Camera_Map_Per_Pixel maps via maxscript:
VarCMPP_map[iCount] = Camera_Map_Per_Pixel ()
VarCMPP_map[iCount].texture= VarCMPP_texture[iCount]
VarCMPP_map[iCount].mask = VarCMPP_mask[iCount]
VarCMPP_map[iCount].zbuffer = VarRender_Zdepth_BitMap[iCount]
this works well. All the slots are filled with my texture, mask, zdepth maps.
but:
VarCMPP_map[iCount].camera = $Camera001
VarCMPP_map[iCount].name = “MyMap”
The .camera should be a camera node and the .name a string.
Both won’t show up after i save the map to a custom material library(not the meditmaterials)
Strangly:
meditmaterials[iCount] = Camera_Map_Per_Pixel ()
meditmaterials[iCount].camera = $Camera001
meditmaterials[iCount].name = “MyMap”
…works fine.
Anybody an idea on how and why?
thx,
David, Holland :love:
Are you try something like this
VarCMPP_map[iCount] = Camera_Map_Per_Pixel name:("MyName_"+iCount as string) \
camera:$Camera001 texture:VarCMPP_texture[iCount] \
mask:VarCMPP_mask[iCount] zbuffer:VarRender_Zdepth_BitMap[iCount]
Hi,
thanks, that code is quicker and gets the same result. I just noticed the real problem:
When put in the custom material library, it is oke, but the moment I save it:
saveTempMaterialLibrary VarMatLib ((VarCMPP_texture_BasePath as string)+ “\matlib\CMPP.mat”)
it removes the name and camera node!
Try the following:
-create a Camera_Map_Per_Pixel in the Material editor
-assign a scene camera to the Camera node in the map
-drag the material into a (new) custom loaded material library in the Material Browser
-save the library (right-click menu on the name)
-name has been removed, and when you drag it back into a material editor slot the camera node is gone as well.
Hmm…?
Yep. I think that max prevent to get any error because in a new scene you may not have cameras. I hope someone can explain better this CMPP map behavior.:surprised
It’s because the node name is referencing a node with a handle ID (each object in max has it’s own 1234567 number that is used when referencing so that names can change and not break links), it’s not built on the actual camera name string. Thus if you had two scenes with two cameras with the same name you could not just bring in the material into both scenes, it wouldn’t pick up the camera based on name alone unfortunately.
Thx, too bad it works that way, now i have to save the Camera Maps to a scene material, not too a new library.
Any access possible to the ‘real’ name?
thanks for the explainations,
David
The real name is usually referred to as the ‘handle’ or animHandle.
This will return the handle of the object:
handle = getHandleByAnim object
And this will return the object if you already have its handle.
object = getAnimByHandle handle