Everything related to SDK.
User avatar
By Brany
#387259
With just one MXS scene and a sequence of HDRIs is really easy to create a MXS sequence using pyton/c++ sdk.
Python example:
Code: Select all
import pymaxwell as mw
import os

hdrifolder = 'c:/hdri/timelapse'
mxspath = 'c:/scenes/myscene.mxs'
outputfolder = 'c:/scenes/output'

if not os.path.exists(outputfolder):
	os.makedirs(outputfolder)

hdris = mw.getFilesFromPath(hdrifolder,'exr')
ibltypelist = [mw.IBL_LAYER_BACKGROUND,mw.IBL_LAYER_REFLECTION,mw.IBL_LAYER_REFRACTION,mw.IBL_LAYER_ILLUMINATION]

mxs = mw.Cmaxwell()
index = 0

if mxs.readMXS(mxspath):
	for hdri in hdris:
		hdripath = os.path.join(hdirfolder,hdri)
		for ibltype in ibltypelist:
			bitmap,st,sm,interp,intensity,ut,vt,uto,vto,ok = mxs.getEnvironment().getEnvironmentLayer(ibltype)
			if not ok:
				print('Error getting IBL')
				continue
			ok = mxs.getEnvironment().setEnvironmentLayer(ibltype,hdripath,st,sm,interp,intensity,ut,vt,uto,vto)
			if not ok:
				print('Error setting IBL')
				continue
		outpath = os.path.join(outputfolder,'timelapse_{0:0>4d}'.format(index))
		if not mxs.writeMXS(outpath):
			print('Error writting '+outpath)
		index = index + 1
Last edited by Brany on Mon Jun 29, 2015 10:29 am, edited 1 time in total.
User avatar
By greengreen
#387264
Thanks Brany, this is great. I'll have to spend some time this weekend to see if I can get it to work, I haven't done scripting in Maxwell yet.
I'll post back
User avatar
By greengreen
#387270
I tried exporting a quick 5 frame test with the .exr file, although maybe I should have only animated the sun and not the environment. I would hope the .exr would timelapse with it's own intelligence somehow?

Image

It seemed like it didn't read my path correctly on my external drive

Image

So I changed it, but I don't think I know what to do now

Image
User avatar
By Brany
#387284
No, you can't expect that IBL EXRs updates magically in each frame ;). What you see in the parameters' panel is what you get.

You should use slash (/) instead of backslash (\) to set the paths. Another option is to use double backslash (\\).

Please check out tabulation on lines 29-30-31 in your code, I made a mistake in the code I posted (I've just fixed it, see my 1st post edited).
New podcast - CG Talks

Hi guys! We've just finished the first season of […]

Thanks, Luis, appreciated. It looks like industria[…]

That looks like a low bpc (bits per channel) norma[…]

Fully working plugin for C4D

When you will be working on it please try to keep […]