Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  inspiration alert!!!
(36 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Vertex Paint Maxcript problem
show user profile  Coxy
Hey guys,

I am trying to use Maxscript to create a template for vertex paint for visibility analysis. I am using this script:

addmodifier $Box001 (VertexPaint())
$Box001.modifiers[#VertexPaint].castShadows = on
$Box001.modifiers[#VertexPaint].lightingModel = 0
$Box001.modifiers[#VertexPaint].colorBy = 1

AssignVertexColors.ApplyNodes $Box001 vertexPaint:$Box001.modifiers[#VertexPaint]

collapseStack $Box001

Whenever I apply this it adds the modifier, but it does so with the default values, shadows are not on etc. I have searched around and I cannot work out what I am doing wrong, it is probably something ridiculously simple,

Coxy.



www.artasmedia.com
read 1799 times
2/21/2011 5:06:34 PM (last edit: 2/21/2011 5:06:34 PM)
show user profile  Dave
I don't understand... if you comment out the collapseStack you can see the modifier with the settings you've given it... soo, yeah, not sure I know what you're trying to achieve here??

Interestingly though... .colorBy = 1 is "color by face" in the MAXScript help docs, but in actuality, to get that result you'd do .colorBy = 0.

That isn't of any help to you... my bad.

"I flew over Egypt once"

read 1784 times
2/21/2011 11:37:05 PM (last edit: 2/21/2011 11:37:40 PM)
show user profile  Garp
I don't understand either.
You assign the vertex colors of Box001 to... Box001?




read 1776 times
2/21/2011 11:48:49 PM (last edit: 2/21/2011 11:48:49 PM)
show user profile  Coxy
Without the collapse stack I can see the result, the trouble is that that result is always at the default settings instead of what it is being told to do. I.E turn on bake shadows.

It is as if it is applying the modifier, but not correctly assigning the selections as you would do with the button in the modifier if that makes sense?



www.artasmedia.com
read 1774 times
2/21/2011 11:51:40 PM (last edit: 2/21/2011 11:51:40 PM)
show user profile  Dave
"the trouble is that that result is always at the default settings instead of what it is being told to do"

That's the bit I'm not understanding... it definitely is doing what it's being told to do...??? I R Confuzzled.

Turns on shadows, sets to Lighting Only, Color by Vertex... and yeah, gets the wire/geo color of the object and sets it to the vert color?? (correct me if I'm wrong on that), is that not what you want to happen?

"I flew over Egypt once"

read 1771 times
2/21/2011 11:56:41 PM (last edit: 2/21/2011 11:56:41 PM)
show user profile  Coxy
That is what I want to happen and what should be happening, but that isn't the result I am getting. That is how it should work in theory according to the maxscript, but when the script is run it doesn't turn on shadows, it simply applies the modifier with its default settings, it seems to not apply any of the things I have told it to apply in the Maxscript.

So even when in the Maxscript it is being told castShadows = on, the result is that the shadows are off, because that is the default value.




www.artasmedia.com
read 1769 times
2/22/2011 12:01:13 AM (last edit: 2/22/2011 12:01:13 AM)
show user profile  Dave
Actually.. I've just noticed is keeps resetting the vert color to black. (my object was black... thus, confusion)

Errrmmmmmmm, definitely out of my league, but are you saying the options are on as you intended... you're just not getting anything in the viewport?

"I flew over Egypt once"

read 1764 times
2/22/2011 12:03:51 AM (last edit: 2/22/2011 12:03:51 AM)
show user profile  Coxy
I am saying it isn't applying the options in the modifier at all. The script runs, modifier is added, but without the selections I want, only with the default values. Cast shadows as an option is not on period, even though Maxscript should be putting them on.



www.artasmedia.com
read 1755 times
2/22/2011 12:09:57 AM (last edit: 2/22/2011 12:10:55 AM)
show user profile  Dave
Oh... well, that is weird. This is basically 100% the same, but run this: (I've commented out the collapse, just so you can look at the settings)

addmodifier selection (VertexPaint())
selection[1].modifiers.surviveCondense = true
selection[1].modifiers.lightingModel = 0
selection[1].modifiers.colorBy = 1
selection[1].modifiers.castShadows = on
AssignVertexColors.ApplyNodes selection vertexPaint:selection[1]
--collapseStack selection


"I flew over Egypt once"

read 1752 times
2/22/2011 12:14:48 AM (last edit: 2/22/2011 12:14:48 AM)
show user profile  Coxy
Ok, thanks a lot mate!!



www.artasmedia.com
read 1750 times
2/22/2011 12:16:27 AM (last edit: 2/22/2011 12:16:27 AM)
#Maxforums IRC
Open chat window


Support Maxforums.org