Announcement

Collapse
No announcement yet.

Vray object properties undefined until you open them???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vray object properties undefined until you open them???

    Hi all

    Quick test,

    New scene, create teapots and run this code

    Code:
    for i in geometry do print (getUserProp i"VRay_Matte_Alpha")
    you should have a list of undefined

    now select all teapots, open vray properties dialogue, then run code again.

    This should now return if matt alpha is ticked.


    Basically I am trying to find a way to automatically enable these when I run my script as not have the properties definable is a bit of an issue.

    Any ideas much appreciated

    Cheers

    Will.

  • #2
    This is correct, the properties are not set until you open the V-Ray object settings dialog. However nothing stops you from setting them anyways, i.e. calling setUserProp() will still work fine.

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      I'm not trying to set them, basically i am setting the wirecolour based on them so I need to be able to call them without having already opened the dialog box.

      This is what I am trying

      Code:
      select (for i = geometry collect i)
      doVRayObjectProperties()
      for i in geometry do print (getUserProp i"VRay_Matte_Alpha")
      but that means everytime i open my script I have to close the vray dialog box.

      Is there a way to close the dialog box via maxscript? Nothing is coming up in the listener?
      Last edited by irwit; 25-07-2012, 07:56 AM.

      Comment


      • #4
        Why not simply wrap your getUserProp call in a try/catch statement to ignore objects that don't have the properties set?

        Comment


        • #5
          Because I want the script set so I can change wirecolour based on their values, so if they are undefined it leaves gaps in the info. Basically I want to see in the viewport what has a matt object ticked and what doesn't. So the true statement turns objects white, false black.

          Comment


          • #6
            Well if the property is not set you know that matte is definitely not set. So you can assume false in that case.

            Regards,
            Thorsten
            Last edited by instinct; 25-07-2012, 08:14 AM.

            Comment


            • #7
              Thats a good point Will try it out.

              Cheers

              Comment


              • #8
                Works great, means a bit more code as I will have to write alternatives for each button but I guess it saves having the vray object properties box opening everytime I run the script!

                Would still be interested to know how to auto close the vray properties dialog box.

                Thanks for the help, much appreciated!

                Will.

                Comment


                • #9
                  Originally posted by irwit View Post
                  Would still be interested to know how to auto close the vray properties dialog box.
                  I've already posted this on your thread on CGTalk but thought it might be of interest to others on here. The following code sets up a callback to close the vray properties dialog as soon as it is opened.
                  Code:
                  (
                  	dialogMonitorOPS.unRegisterNotification id:#closeVRayProperties
                  
                  	fn closeVP = --checks whether the recently opened window is the VRay object properties dialog
                  	(
                  		windowHandle = dialogMonitorOPS.GetWindowHandle()
                  		if (UIAccessor.getWindowText windowHandle) == "VRay object properties" do
                  		(
                  			UIAccessor.closeDialog windowHandle
                  		)
                  		true
                  	)
                  
                  	dialogMonitorOPS.registerNotification closeVP id:#closeVRayProperties --registers fn closeVP
                  	dialogMonitorOPS.Enabled = true --enables dialogMonitorOPS callback system
                  	doVRayObjectProperties() --open VRay object properties dialog
                  	dialogMonitorOPS.Enabled = false --disables dialogMonitorOPS callback system
                  	dialogMonitorOPS.unRegisterNotification id:#closeVRayProperties --unregisters fn closeVP
                  )
                  Dan Brew

                  Comment


                  • #10
                    Alternatively you can set the prop buffer without opening and closing the VrayProps window.

                    Code:
                    if ( findstring (getUserPropBuffer o ) "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_GI_SubdivsMultiplier = 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
                    	VRay_Mesh_Geometry = 2
                    	"
                    )
                    Maxscript made easy....
                    davewortley.wordpress.com
                    Follow me here:
                    facebook.com/MaxMadeEasy

                    If you don't MaxScript, then have a look at my blog and learn how easy and powerful it can be.

                    Comment

                    Working...
                    X