getting access to the render settings via coffee

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  09 September 2013
getting access to the render settings via coffee

Hey everyone,

I thought, that it is quite simple, but I wanted to do, but apparently it doesn't work the way I want. Just the background: I have to render out objects in different sizes. The important thing is, that if the objects is 20cm in c4d, it should be 20cm in my tiff as well. So far not really a problem. But now I have to render out other objects as well. Some are 10cm, some 18 etc. The thing is, I could render them all out in the file, where the sizes are ok, but then I have so much white around, if the objects are small. I could cut it out in PS, but I wanted to do it in c4d. Just because I would like to know how

So my idea was to link the camera distance to the size of the render setting. I just thought I can do it over Xpresso and a coffee node, but I am not getting access to the render settings size. I looked it up in the skd but it is not working.

I thought putting in a number into Input1 and then tell the render setting size being this number. But it doesn't work.
, that's my try:

main(doc,op)
{
var size_x = Input1;
RDATA_XRES_VIRTUAL = size_x
}

So I guess I forgot something (as always). Would be great if someone could help me

Thanks a lot

Anna
 
  09 September 2013
has it to be coffee ? my coffee got worse and worse over the years.

1. you can access your render settings in xpresso. just open the render settings
(CTRL/CMD + B) and drag and drop your active render setting from the small render
settings treeview into your xpresso graphview. you will get a object node pointing
to the RenderData BaseList2D

2. if you want to do it more programmatically nevertheless you should take a look into
python. The BaseDocument class does grant access to its render settings (RenderData).

# in an expression environment, where doc is defined as the active document
myRenderData = doc.GetActiveRenderData()
myRenderData[c4d.RDATA_XRES_VIRTUAL] = magic_value
__________________
There are holes in the sky. Where the rain gets in.
But they're ever so small. That's why the rain is thin.
 
  09 September 2013
thank you so much, saved my day ;-)

I actually wanted to do it with Xpresso completely, as I am much better with this than with writing code. But you know normally you can just drag in the things, but I didn't get it work with the settings in the render settings. I didn't think about the small tree thing. So thanks a lot Now it is perfectly working.

Anna
 
  09 September 2013
Hey,

I just ran over another problem. I am now getting access to all the render settings. But if I am using a constant node let's say Real(10) and connect it with the height, the height is not changing. Nothing is happening. It is working, if I am connecting the same constant node with frame rate etc. but not with height and width. Does anyone know, why this could be?

Anna
 
  09 September 2013
Hi,

the problem is a more technical one than you might think. The resolution settings are
actually stored in two invisible fields, while the two visible fields height and width are
actually only there to reflect those hidden values ( RDATA_XRES_VIRTUAL , RDATA_XRES
and the same for the height, the virtual value is the one you can see and directly access
in c4d).

Here is a little python expression you could use in a python node to avoid that problem for
the height and width values. http://codepad.org/XQRU7Ggp. The code does expect there
to be two input ports on the python node, named 'x' and 'y' of the type float or integer.
__________________
There are holes in the sky. Where the rain gets in.
But they're ever so small. That's why the rain is thin.

Last edited by littledevil : 09 September 2013 at 12:45 PM.
 
  09 September 2013
Thanks a lot, that's working perfect Now I am understanding, why I cannot change them directly, as well.

But I have one last question, or actually a friend of mine. He saw my xpresso set up and asked, if he could use it as well. So that's not a problem, but he has an old c4d version, which hasn't got python in it. So I was wondering, what would be the coffee script for this pytohn script? I think I only have to get access to the right class, but when I tried it, it didn't work.

So it would be great, if someone could help me with this.

Thanks a lot and have a nice weekend

Anna
 
  09 September 2013
Tell your friend to go here: https://sites.google.com/site/scottayersmedia/scripting

At the top of the page there is a link to the "Coffee Bible".
Inside that zip file there is also a text file that lists the render settings. And how to execute them.

-ScottA
__________________
My Gallery
 
  09 September 2013
wow, thanks a lot for your help
 
  09 September 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:30 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.