Notifications
Clear all

[Closed] Collect all settings from Renderdialog Common tab

So here’s the thing.

I want to collect all render related settings of a scene.
Being a big fan of getPropnames to collect all settings and values of a maxObject,
I use that to store the values of those props.

For instance, I use

PropValue = for p in PropNames collect (getProperty RC p)

to collect of settings of renderers.current (RC) and store them in a struct

but I can’t for the life of me figure out how to collect all settings from the common tab.
There doesn’t appear to be a maxObject for that one like there is for renderers.current.
So for now it looks like i have to store all those settings ‘manualy’ but I hope one of you can prove me wrong.

I tried using a struct in a stuct to just store the settings I REALLY need, but to read them back out in the same loop
as the other stuff makes the script fail.

what I want to acclompish it to store all those rendersettings, then do stuff to the scene, then restore to the original starting point.

here’s the code (snippet) I have so far to collect the rendersettings I need:

(
	clearListener()
	local settingsDataArr = #()
	RC = renderers.current
	struct renderSettings (width, height, aspect, outputFile, saveFile)

	local sunLight = (getclassinstances VRaySun)[1]
	local domeLight = (for l in lights where classof l == vraylight and l.type == 1 collect l)[1]

	fn storeSettings = (
		commonSettings = renderSettings width:renderwidth height:renderheight aspect:(GetRendImageAspect()) outputFile:"" saveFile:false

		local thePresets = #(sunLight, domeLight, commonSettings)

		struct data (item, settings, values)

		for i = 1 to thePresets.count do (
			d=data()
			d.item = thePresets[i]
				format "%\n" d.item
			d.settings = (getPropNames thePresets[i])
			d.values = (for p in (getPropNames thePresets[i]) collect (getProperty thePresets[i] p))
				format "\tsettings:% | value:%\n" d.settings d.values
			append settingsDataArr d
		)
	)

	fn restoreSettings = (
		for i in settingsDataArr do (
			format "%\n" i.item
			for p = 1 to i.settings.count do (
				format "\tsettings:% | value:%\n" i.settings[p] i.values[p]
				setProperty i.item i.settings[p] i.values[p]
			)
		)
		
	)
    storeSettings()
    --getPropnames settingsDataArr[3].settings #height
    --sunLight.enabled = false
    --restoreSettings()
)
3 Replies
1 Reply
(@serejah)
Joined: 11 months ago

Posts: 0

If you want to collect them just to restore them later on use holdMaxFile() & fetchMaxFile()

With files taking 10+ minutes to load. … I think I’ll pass on that.

That’s actually the entire reason to try and accomplish this.
I submit the same file 3 times with lots of stuff changed to the farm (special passes I cant accomplish with render elements), but want to end up with the original
(so I save a copy which will be rendered on the farm, change settings, save a cop and so on)

Can you not just create 3-4 different RPS files and run them through a pre-render script to load them in? If you are just changing settings/render elements this should work fine. If you are using deadline or back burner you can use the same script which loads you chosen RPS file. You could even create one for the original default status of the file just in case you need that too. They are very quick and easy to use.