On 09/01/2013 at 14:56, xxxxxxxx wrote:
This is a complete noob question so please bare with me.
Im trying to write a script that uses Vray to render a user selected region to the pictureviewer. Its supposed to work like the built in C4d Render region command just that it render the area to the picture viewer instead. I stumble upon a couple of problems.
- How can i get the mouse coordinates (user drags out a rectangle) from the viewport.
- How can i convert the above coordinates to percentage values of the viewport size.
I have figured out how to set the region in the Render settings, but im completely lost on the mouse/viewport thing
I really wish the SDK had more meaningful examples. This would make it so much easier for noobs like myself to learn faster.
import c4d import sys from c4d import documents, bitmaps, gui #Welcome to the world of Python doc = documents.GetActiveDocument() rd = doc.GetActiveRenderData() post = rd.GetFirstVideoPost() if post == None: pass else: while post: if post.GetType() == 1019782: ## if Video Post Effect is V-Ray Bridge vray = post post = None ## changes post object to none so the loop is broken else: post = post.GetNext() ## Try the next Post-Effect vray[c4d.VP_VRAYBRIDGE_REGIONON] = True # Turns on Render region in the Vray effect vray[c4d.VP_VRAYBRIDGE_REGIONRENDER_X1] = 0.1 #Sets the values for the region in the Vray effect vray[c4d.VP_VRAYBRIDGE_REGIONRENDER_Y1] = 0.1 vray[c4d.VP_VRAYBRIDGE_REGIONRENDER_X2] = 0.9 vray[c4d.VP_VRAYBRIDGE_REGIONRENDER_Y2] = 0.9
Any help appreciated