Projection modifier: setting source type to "vertex color" from script


I’m having a problem where I want to use the Projection modifier to project vertex colors from a high-density mesh onto a low-density one. Doing this by hand works fine. I have the beginnings of a script to automate it:

AddPModObjects #(projectorObj) true true objList:#(orig)
proj = projectorObj.modifiers[#Projection]
projMap = proj.getProjectionType 1
projMap.createNewHolder = true
projMap.sameAsSource = true
--Would like to set source channel here

The problem is that I don’t see how the source channel option is exposed to MaxScript. if I look at the docs or run showProperties on projMap, I see:

  .name : string
  .holderName (Projection_Holder_Name) : string
  .alwaysUpdate (Always_Update_Holder) : boolean
  .createNewHolder (Create_New_Holder) : boolean
  .sourceMapChannel (Source_Map_Channel) : integer
  .sameAsSource (Same_as_Source) : boolean
  .targetMapChannel (Target_Map_Channel) : integer
  .projectMaterialIDs (Project_Material_IDs) : boolean
  .sameTopology (Same_Topology) : boolean
  .ignoreBackfacing (Ignore_Backfacing) : boolean
  .testSeams (Test_Seams) : boolean
  .checkEdgeRatios (Check_Edge_Ratios) : boolean
  .weldUVs (Weld_UVs) : boolean
  .weldUVsThreshold (Weld_UVs_Threshold) : float
  .edgeRatioThreshold (Edge_Ratio_Threshold) : float

The most similar one is sourceMapChannel, but changing that only changes the integer map channel for the “Map Channel” source type - the red X in my screenshot. How can I set the radio button for the green arrow, “Vertex Color” from maxscript?



projMap.sourceMapChannel = 0


Wow, that worked. Thank you.

Additionally, it seems to be possible to set sourceMapChannel to a negative index to select the other radio buttons.

This behavior is undocumented, though. How did you know about it, may I ask?


tools > channel info
simple as that

btw mxs reference also say it pretty much clear
<Vertex_Color>.map Integer default: 0 -- integer; Map_ID