Page 1 of 2
python and settings
Posted: Wed Oct 22, 2014 4:06 am
by 1Lyubomir
I'm new to scripting. Could you tell me how to set and get values from "Octane settings" window (Kernel) using python??
Re: python and settings
Posted: Wed Oct 22, 2014 1:13 pm
by aoktar
Are you happy to see a little c++ code?
Re: python and settings
Posted: Wed Oct 22, 2014 2:28 pm
by salmon
Re: python and settings
Posted: Wed Oct 22, 2014 2:37 pm
by aoktar

Ok, sorry. All settings is on a object. Which is named "myOctaneSettings" and hidden.
You can find it and get BaseContainer. code is "BaseContainer *bc = paramObject->GetDataInstance()" Which is similar in phyton.
You should know all parameters with Id and types also. I can post a c++ to see this parameters. like this
Code: Select all
/// --------------- DirectLighting Kernel---------------
DlGIMod = bc->GetLong( SET_DIRECT_GIMOD, 4);
DLAODist = (float) bc->GetReal(SET_DIRECT_AODIST, 5.0);
DlMaxSamples = bc->GetLong( SET_DIRECT_MAXSAMPLES, 128);
DlDifDepth = bc->GetLong( SET_DIRECT_DIFDEPTH, 2);
DlGlosDepth = bc->GetLong( SET_DIRECT_GLOSDEPTH, 2);
DlFsize = (float) bc->GetReal( SET_DIRECT_FSIZE, 1.2);
Re: python and settings
Posted: Sat Oct 25, 2014 12:44 am
by 1Lyubomir
Thank you! But one more question. How to refresh "Octane Settings" window after setting new values?
Re: python and settings
Posted: Sat Oct 25, 2014 8:56 am
by LudovicRouy
Here is a script to put in a python script tag (sorry I don't know how to force indentation in post replace * by tab):
import c4d
def main():
* op[c4d.EXPRESSION_ENABLE]=0
* octSet = 0
* oLst = doc.GetObjects()
* for i in oLst :
** if i.GetName()=="myOctaneSettings":
*** octSet = i.GetDataInstance()
* if octSet :
** print " GI mode : " + str(octSet[c4d.SET_DIRECT_GIMOD])
** print " AO distance : " + str(octSet[c4d.SET_DIRECT_AODIST])
** print " Max samples : " + str(octSet[c4d.SET_DIRECT_MAXSAMPLES])
** print " Diffuse depth : " + str(octSet[c4d.SET_DIRECT_DIFDEPTH])
** print " Glossy depth : " + str(octSet[c4d.SET_DIRECT_GLOSDEPTH])
** print " Filter size : " + str(octSet[c4d.SET_DIRECT_FSIZE])
Hope this will help other python coders
Thanks to Ahmet and his c++ settings

Re: python and settings
Posted: Sat Oct 25, 2014 11:56 am
by 1Lyubomir
LudovicRouy wrote:Here is a script to put in a python script tag (sorry I don't know how to force indentation in post replace * by tab):
Good script. Thanks.
But when I write my own value to settings like:
octSet[c4d.SET_DIRECT_MAXSAMPLES]=2000.0
setting changes but in Octane Settings window nothing happens and
c4d.EventAdd() useless
Re: python and settings
Posted: Sat Oct 25, 2014 12:59 pm
by LudovicRouy
Yes, i didn't know how to update the settings window
BUT if you close it, execute your script then reopen it, you'll see that settings are changed and updated.
Or as you know the keys you can close the window run your script and just use the print statement to verify updates.
Please Ahmet could you post other c++ settings ?
Re: python and settings
Posted: Sat Oct 25, 2014 3:04 pm
by aoktar
All command is in txt file. I don't know a way to force updates on external dialog.But IDD_SETTINGS_DIALOG is id for settings dialog. Also you can see all values in "vprender.h" and "c4d_symbols.h".
Setting ID's are also same on Octane render settings.
Re: python and settings
Posted: Sun Oct 26, 2014 7:32 am
by LudovicRouy
Thanks Ahmet,
Its a good starting point
