Problem with VRayProperties and Maxscript

I have a script that needs to copy properties from one obj to another. The problem is that I cannot get the userproperties from an object that has been newly created without first opening the VRay Object Properties dialog for that object. To see what I mean execute this after creating an object.
getUserProp $ "VRay_GI_VisibleToGI"

I get undefined. Any help is appreciated. Thanks.

the propbuffer is indeed empty.
running doVRayObjectProperties opens the vray props dialog.
What that does is to add to the object user props this:

VRay_MoBlur_GeomSamples = 2
VRay_GI_Generate = True
VRay_GI_Receive = True
VRay_GI_Multipier = 1.000000
VRay_GI_GenerateMultipier = 1.000000
VRay_Caustics_Generate = True
VRay_Caustics_Receive = True
VRay_Caustics_Multipier = 1.000000
VRay_MoBlur_DefaultGeomSamples = True
VRay_Matte_Enable = False
VRay_Matte_Alpha = 1.000000
VRay_Matte_Shadows = False
VRay_Matte_ShadowAlpha = False
VRay_Matte_ShadowColor = [0,0,0]
VRay_Matte_ShadowBrightness = 1.000000
VRay_Matte_ReflectionAmount = 1.000000
VRay_Matte_RefractionAmount = 1.000000
VRay_Matte_GIAmount = 1.000000
VRay_Matte_GI_OtherMattes = True
VRay_GI_SurfaceID = 0
VRay_GI_VisibleToGI = True
VRay_GI_VisibleToReflections = True
VRay_GI_VisibleToRefractions = True

So a workaround is to first loop through any object which has no VRay user prop, add these as the default, and move on from there.
EDIT: to expand :```
if ( findstring (getUserPropBuffer $ ) “VRay” )== undefined do (
setUSerPropBuffer $ "VRay_MoBlur_GeomSamples = 2
VRay_GI_Generate = True
VRay_GI_Receive = True
VRay_GI_Multipier = 1.000000
VRay_GI_GenerateMultipier = 1.000000
VRay_Caustics_Generate = True
VRay_Caustics_Receive = True
VRay_Caustics_Multipier = 1.000000
VRay_MoBlur_DefaultGeomSamples = True
VRay_Matte_Enable = False
VRay_Matte_Alpha = 1.000000
VRay_Matte_Shadows = False
VRay_Matte_ShadowAlpha = False
VRay_Matte_ShadowColor = [0,0,0]
VRay_Matte_ShadowBrightness = 1.000000
VRay_Matte_ReflectionAmount = 1.000000
VRay_Matte_RefractionAmount = 1.000000
VRay_Matte_GIAmount = 1.000000
VRay_Matte_GI_OtherMattes = True
VRay_GI_SurfaceID = 0
VRay_GI_VisibleToGI = True
VRay_GI_VisibleToReflections = True
VRay_GI_VisibleToRefractions = True
"
)


Lele

Thanks Lele. I think that will do the trick. One note however, when you have a return in a string, you don’t need a space (at least it is so in R9). In case others need this at some point, your script has spaces at the end of each line and with the return, the space gets evaluated as part of the assignment, making the assingment "true " rather than simply true.

Anyway, thanks again.

this thread might also be of interest for you

http://www.chaosgroup.com/forum/phpBB2/viewtopic.php?t=19220

regards,
michael

Thanks. I saw that one and it doesn’t fix my problem.