Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search

Getting settings from VRay RenderData?

Author
Message
  Topic Search Topic Search
TechnoFeather View Drop Down
Member
Member


Joined: 2014 May 06
Online Status: Offline
Posts: 17
Direct Link To This Post Topic: Getting settings from VRay RenderData?
    Posted: 2014 Jul 07 at 1:48am
Hello,

I'm trying to get some infos on the active rendersettings - what's activated and what not. The problem with that is that those settings are in VrayBridge. If I pull anything from VrayBridge into the console then I get the code but cannot do anything with it.

example:
    doc = documents.GetActiveDocument()
    rd = doc.GetActiveRenderData().GetData()
    print rd[c4d.VP_VRAYBRIDGE_SPLITON]


just returns "None". Should return 0 or 1 (VrayBridge is the active renderer).

Greetings!

Edit:
If I hit Enter, then of course the console prints it out right:
[OK] VrayBridge[c4d.VP_VRAYBRIDGE_SPLITON]
0



Edited by TechnoFeather - 2014 Jul 07 at 8:35am
Back to Top
TechnoFeather View Drop Down
Member
Member


Joined: 2014 May 06
Online Status: Offline
Posts: 17
Direct Link To This Post Posted: 2014 Jul 09 at 3:24am
Nobody? Shocked
Back to Top
spedler View Drop Down
Member
Member


Joined: 2008 Apr 19
Location: United Kingdom
Online Status: Offline
Posts: 680
Direct Link To This Post Posted: 2014 Jul 09 at 1:15pm
It sounds as if you're getting confused between the render data and the Vray settings in the render settings dialog. You are looking for the value of the parameter VP_VRAYBRIDGE_SPLITON, but you won't find that in the render data class; you need to look at the base container of the videopost plugin that is the Vraybridge.

To do this, you will first need to get the Vraybridge videopost. Get the active render data, then get the first videpost (RenderData.GetFirstVideoPost()). Use its GetType function to check if this is the Vray VP, and if it isn't then iterate through all other VPs (GeListNode.GetNext()) until you find it.

When you do, get its base container(BaseList2D.GetDataInstance()) and then you can use that to get the value of VP_VRAYBRIDGE_SPLITON.

Back to Top
TechnoFeather View Drop Down
Member
Member


Joined: 2014 May 06
Online Status: Offline
Posts: 17
Direct Link To This Post Posted: 2014 Jul 10 at 1:24am
Hi!
Thank you for your post. Yes, I always thought VideoPost was not for the RenderEngine but for the PostEffects & MultiPass.

    doc = documents.GetActiveDocument()
    rd = doc.GetActiveRenderData()
    vp = rd.GetFirstVideoPost()
    if vp:
        print "PlugIn used: (ID)"
        print vp.GetType()
    else:
        print "Default RenderEngine used"
works so far! :)


Now comes the hard bit for me:
        bc = c4d.BaseContainer()
    bc.GetDataInstance()
.................... but thats is creating a new container I fear.

Think I'm a "little" stuck on basics... Is there any way of getting easy and fast input on these basics? Any book recommendation?
 
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2014 Jul 10 at 1:36am
It's not just the first VideoPost, it must be the one with the correct ID. Internally, VideoPosts can
also be standalone renderers, like VRay. 

import c4d

def find_vray_bridge(rd):
    vp = rd.GetFirstVideoPost()
    while vp and vp.GetType() != 1019782:
        vp = vp.GetNext()
    return vp

def main():
    vp = find_vray_bridge(doc.GetActiveRenderData())
    if not vp:
        print "VRay not enabled"
        return
    print vp[c4d.VP_VRAYBRIDGE_DISP]

main()

Best,
-Niklas


Edited by NiklasR - 2014 Jul 10 at 1:36am
Back to Top
TechnoFeather View Drop Down
Member
Member


Joined: 2014 May 06
Online Status: Offline
Posts: 17
Direct Link To This Post Posted: 2014 Jul 10 at 1:54am
hm okay just wanted to post that I've got it!:D But maybe not?

I want to check the active rendersettings on some parameters.

doc = documents.GetActiveDocument()
    rd = doc.GetActiveRenderData()
    vp = rd.GetFirstVideoPost()
    if vp == 1019782:
        print "PlugIn used: (ID)"
        print vp.GetType()
        vpvray = vp.GetDataInstance()
        print vpvray
        print vpvray[c4d.VP_VRAYBRIDGE_SPLITON]
        print vpvray[c4d.VP_VRAYBRIDGE_QMCSAMPLER_ADAPTTHR]
        print "-------------------------------------------------------------[End VRAY]-----------------"
    else:
        print "Warning ! Other RenderEngine then VRay is being used"


I always got quite a few rendersettings and this is how I want to check some data before exporting & rendering.
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2014 Jul 10 at 1:57am
Well, it's almost alright what you do, but the first VideoPost does not necessarily be the Vray
VideoPost. It could be some arbitrary other VideoPost, too. So you'll have to get the next VideoPost
until you found the on with the right ID.

And you get the ID with vp.GetType(), vp == 1019782 will always give you False.

-Niklas
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.