Digital Art Zone

 
     
‘App.getRenderOptions’ [undefined] is not a function…?
Posted: 26 May 2012 12:55 PM   [ Ignore ]
Active Member
Avatar
RankRank
Total Posts:  820
Joined  2007-01-08

I’m trying something along the lines of Yacomo’s render script here: http://forumarchive.daz3d.com/viewtopic.php?p=1628030#1628030
but I get an error about:

WARNING: Script Error: Line 5
WARNING: TypeError: Result of expression ‘App.getRenderOptions’ [undefined] is not a function.

This used to work in both DS2 and 3. Any idea on what do I need to do?

Profile
 
 
Posted: 29 May 2012 04:00 AM   [ Ignore ]   [ # 1 ]
Active Member
Avatar
RankRank
Total Posts:  820
Joined  2007-01-08

I was able to export a Render Preset in “deprecated” format that does what I want. Doesn’t look all that different to me, but this one works.

Profile
 
 
Posted: 31 May 2012 01:25 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRank
Total Posts:  336
Joined  2003-10-09

First get the Render Manager from the App, then get the Render Options from the Render Manager.

var oRenderMgr App.getRenderMgr();
var 
oRenderOpts oRenderMgr.getRenderOptions(); 

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 31 May 2012 02:10 PM   [ Ignore ]   [ # 3 ]
Active Member
Avatar
RankRank
Total Posts:  820
Joined  2007-01-08

Hmm, testing some more and comparing with Yacomo’s script, the variable declarations are on a different line in his script, which is apparently what throws the error. Not sure if it is intended behaviour.

I’m also trying to use setCropWindow which in DS3 was in DzRenderHandler, but I can’t see any working example apart from what you guys did in the Ambient Occlusion scripted render script, which however hides part of its declarations. If I use your property enumeration script on DzScriptedRenderer I get a very long list which from my perusal doesn’t seem to include setCropWindow. confused I know I must get the Handler (not enumerated either with your script), but the example in the DS3 documentation doesn’t work in DS4. I must say I’m feeling like one of those proverbial monkeys on a typewriter at this point… :-( Hmm and can the DzScriptedRenderer class be used in regular scripts that do not get run from the Scripted Renderer drop-down?
Here is one of the attempts I did, based on the DS3 getHandler script:

// Get the active viewport and camera
var oActiveView MainWindow.getViewportMgr().getActiveViewport();
var 
oCamera oActiveView.get3DViewport().getCamera();

// Get the render options
var oRenderOptions App.getRenderMgr().getRenderOptions();
var 
RSize = new Size(600,600);
var 
oRect=Rect0.1,0.5,0.2,0.3 );
var 
RName="Render.jpg";
var 
On=1;

// Create a handler
var oHandler DzRenderHandler.getHandler(RSize,0,RName );

// If we have a valid handler
if( oHandler ){
    
// Set the background color
    
DzScriptedRenderer.setUseCropWindow(On);
    
DzScriptedRenderer.setCropWindowoRect );


    
// Get the renderer
    
var oRenderer oRenderOptions.getActiveRenderer();

     
Renderusing our handler and options
    oRenderer
.renderoHandleroCameraoRenderOptions );


Edit, BTW for anybody else who may be lurking, Rob’s property enumeration script can be found here

Profile
 
 
Posted: 02 June 2012 11:16 PM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRank
Total Posts:  336
Joined  2003-10-09

Apologies, ReDave, there are quite a few issues with your script… but I don’t have time right now to explain it all.

A night or two ago I wrote an example that would work and I was going to post it for you to compare/study, but in so doing found a couple bugs with the class factories (code that allows C++ objects to be created by script and converted) for the requisite render handlers. The bugs have since been fixed, but I wanted to look into using a different approach to work around them… so you wouldn’t have to wait until the build with the fix becomes available in order for the script to be useful.

Yes, you can use the scripted render in “regular” scripts that to not populate the combobox… that is how it was done prior the combobox being added (for convenience).

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 04 June 2012 01:06 PM   [ Ignore ]   [ # 5 ]
Active Member
Avatar
RankRank
Total Posts:  820
Joined  2007-01-08

OK, thanks for everything you’re doing! And no worries I can wait a few days. ^_^

Profile
 
 
Posted: 12 June 2012 04:06 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRank
Total Posts:  336
Joined  2003-10-09

I added some rendering samples to the Documentation Center last night. I still have some tweaks to make, but there is enough there to begin dissecting.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 16 June 2012 12:24 PM   [ Ignore ]   [ # 7 ]
Active Member
Avatar
RankRank
Total Posts:  820
Joined  2007-01-08

Awesome, thanks Rob! After a quick perusal it looks like setCropWindow can only be used in viewport renders?

Profile
 
 
Posted: 16 June 2012 06:26 PM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRank
Total Posts:  336
Joined  2003-10-09

No, the setCropWindow() method is inherited from DzRenderHandler...

Dz3DViewRenderHandler and DzViewRenderHandler both inherit from DzImageRenderHandler and DzImageRenderHandler inherits from DzRenderHandler.

Do you understand how inheritance works? A very basic explination boils down to… an object can access all of the methods/signals/properties of its own, along with all of the methods/signals/properties of the object it inherits (aka “superclass”), along with all of the methods/signals/properties of the object that object inherits… and so on up the chain. On the C++ side of things, there are some very specific details that have to be considered, but I usually don’t go into all that when I’m describing something to someone who is scripting rather than someone who is exposing their API to script.

So, anyway, in the context of Dz3DViewRenderHandler... a Dz3DViewRenderHandler object can access all of it own methods/signals/properties, along with all of the methods/signals/properties on DzImageRenderHandler and all of the methods/signals/properties on DzRenderHandler.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 17 June 2012 11:03 AM   [ Ignore ]   [ # 9 ]
Active Member
Avatar
RankRank
Total Posts:  820
Joined  2007-01-08

Yes I do understand the idea of inheritance, I believe you explained it already a couple of times on the old forums, at least since I am a member. I see now the script was intended as two examples. wink I hope I’ll have time to piece it this week!

Profile