ScriptSpot

Forum topic · Scripts Wanted

rendering controls

By titane357 · 2011-01-21

Description

Hello

I made some "scripts" to help me control my scene before rendering.

for exemple :
-------
$*.wirecolor = black
for bbb in objects where bbb.primaryVisibility == off do bbb.wirecolor = red
-------
so, I can control in viewport if objects will be or not seen by cam.

I would like to do this with VrayAlphacontribution and so on...
but I don't really even understand where to search in Vray docs...

AND I would like to be able to overwrite temporarily object materials with wirecolor, so I could see solid color not just wires.

If anybody find this usefull... :-)

Comments (6)

Hi.

Garp · 2011-01-30

Use

getUserPropBuffer bbb

to see all the properties.
Then the

getUserProp()

and

setUserprop()

methods.

if getUserProp bbb "VRay_Matte_Alpha" == 0 do bbb.wireColor = red

Note that depending on countries, some OS use a comma instead of a point as a decimal separator. In those cases, the corresponding user property is returned as a string with a comma in it (which sucks).
To make sure your code works on all machines, you need something like this:

(
  local matteAlpha = getUserProp bbb "VRay_Matte_Alpha" as string
  local pDec = findString matteAlpha ","
  if pDec != undefined do matteAlpha = replace matteAlpha pDec 1 "."
  if matteAlpha as float == 0 do bbb.wireColor = red
)

titane357 · 2011-01-30

thanks Garp, it works fine ! :-)
for the comma/point problem I think it is system unit preference (I use french os but I define comma as default.

titane357 · 2011-01-30

Thanks Anubis, looks cool but I don't know how to revert...

le1setreter I tried your soluce but I don't know how to use:
for bbb in objects where bbb.VRay_Matte_Alpha == 0.0000 do bbb.wirecolor = red
I get :
-- Error occurred in bbb loop
-- Frame:
-- bbb: $Box001
-- Unknown property: "VRay_Matte_Alpha" in $Box:Box001 @ [14.514389,31.687920,0.000000]

Anubis · 2011-01-31

You dont need to revert, if will render in Max of course, but if intended by other purpose, its easy too:

for obj in objects where obj.mat != null and \
classOf obj.mat == Shell_Material do
obj.mat = obj.mat.originalMaterial

cheers

le1setreter · 2011-01-28

maybe i can help a bit regarding the vray object properties:

1) as far as i know you can not "directly" access each vray-object-property by maxscript... but

2) if you have seen/opened and therefor enabled the vray-object-props for example by rightclicking the object and opening the dialog with the properties ... then the vray props are stored as string in the "normal" user-defined properties of your object. you can work you way up from there with various string operations and/or creating temp arrays for better handling of the props.

----

the vray object properties can opened/enabled via maxscript with "doVRayObjectProperties()"

more vray max functions/properties can be found here:
http://www.spot3d.com/vray/help/150SP1/render_maxscript.htm

for working with the object user defined properties have a look at the maxscript helpfile: "Node User-Defined Properties and Methods"

Hi Titane

Anubis · 2011-01-27

I not use Vray so cant help on this one, but about the 2nd question (overwriting the mats) - did you try Shell material?

for obj in objects where obj.mat != null do
(
	obj.mat = Shell_Material originalMaterial:obj.mat
	obj.mat.bakedMaterial.diffuseColor = obj.wirecolor
	obj.mat.viewportMtlIndex = 1
)