Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi @ferdinand Thanks for looking into this. Sorry for not supplying enough info. This is in c4d version 24.037, Windows 10 and RS version 3.0.53 I did actually tag the post initially
I did some more digging and found out that if the renderdata i'm copying has non default values, the child will not get these values after the script has executed. Try this:
But i figured out how to solve this by first inserting the child in the root of the Render Settings and then making it a child of the Redshift Deafult:
import c4d import redshift from c4d import gui def MakeRsDefault(renderdata): default = renderdata.GetClone() # Clone active renderdata default.SetName("Redshift Default") # Set name # Set output format default[c4d.RDATA_FORMAT] = 1016606 default[c4d.RDATA_FORMATDEPTH] = 2 # 32 bits default[c4d.RDATA_NAMEFORMAT] = 6 # name.000.ext doc.InsertRenderData(default) # insert new render setting # Set ACES 1.0 defaultvprs = redshift.FindAddVideoPost(default, redshift.VPrsrenderer) defaultvprs[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_VIEW] = 'ACES 1.0 SDR-video' defaultvprs[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_COMPENSATE_VIEW_TRANSFORM] = 1 return default def MakeRsRaw(renderdata, parent): raw = c4d.documents.RenderData() # Clone active renderdata raw.SetName("Redshift Raw") # Set name # Set output format raw[c4d.RDATA_FORMAT] = 1016606 raw[c4d.RDATA_FORMATDEPTH] = 2 # 32 bits raw[c4d.RDATA_NAMEFORMAT] = 6 # name.000.ext doc.InsertRenderData(raw) # insert "redshift raw" # Set Raw rawvprs = redshift.FindAddVideoPost(raw, redshift.VPrsrenderer) raw[c4d.RDATA_RENDERENGINE] = redshift.VPrsrenderer # Set Redshift as render rawvprs[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_VIEW] = 'Raw' rawvprs[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_COMPENSATE_VIEW_TRANSFORM] = 0 doc.InsertRenderData(raw, parent) # Make "redshift raw" a child of redshift default return raw def main(): active = doc.GetActiveRenderData() # Get active renderdata # Check if Redshift is installed vprs = redshift.FindAddVideoPost(active, redshift.VPrsrenderer) if vprs is None: return # Check if Redshift is active render if active[c4d.RDATA_RENDERENGINE] == 1036219: parent = MakeRsDefault(active) child = MakeRsRaw(active, parent) else: gui.MessageDialog('Only works with Redshift Rendersettings') return # Set project settings for linear workflow doc[c4d.DOCUMENT_LINEARWORKFLOW] = 1 doc[c4d.DOCUMENT_COLORPROFILE] = 0 doc.SetActiveRenderData(parent) # set new setting as the active render setting parent.SetBit(c4d.BIT_ACTIVERENDERDATA) c4d.EventAdd() # Execute main() if __name__=='__main__': main()
Regards Bonsak
Hi @ferdinand Maybe I'm just confused as to what is supposed to be expected behavior. The "Clone active renderdata" comment is a typo from a previous version Sorry about that. What i figured out (in my second version of the script) was that if i create a default renderdata instance as a child of a parent render setting directly (doc.InsertRenderData(raw, default)), it does not snap to all the values of the parent, But if i make a default renderdata instance in the root of the render settings, and then make it a child of the parent after wards, all its values will snap to the parent. That puzzled me, but as i now have a version that works like i want it to, we dont have to investigate this any further. Thank you very much for your time.
Hi I'm making a script that: 1 Copies (clones) the active render setting 2 Inserts a new one based on the clone 3 Then makes a new RS rendersetting 4 Inserts the new RS render setting as a child of the clone in step 2
But when the child is inserted, it's settings are not inherited from the parent. The "Inherit Parent Behavior" is active on the child but when i right click on a parameter in the child render setting the "Inherit Parent Setting" is grayed out.
import c4d import redshift from c4d import gui def main(): active = doc.GetActiveRenderData() # Get active renderdata default = active.GetClone() # Clone active renderdata default.SetName("Redshift Default") # Set name redshift.FindAddVideoPost(default, redshift.VPrsrenderer) default[c4d.RDATA_RENDERENGINE] = redshift.VPrsrenderer # Set Redshift as render doc.InsertRenderData(default) # insert new render setting raw = c4d.documents.RenderData() # Make new renderdata raw.SetName("Redshift Raw") # Set name redshift.FindAddVideoPost(raw, redshift.VPrsrenderer) raw[c4d.RDATA_RENDERENGINE] = redshift.VPrsrenderer # Set Redshift as render doc.InsertRenderData(raw, default) # insert "redshift raw" as a child of redshift default doc.SetActiveRenderData(default) #set new setting as the active render setting c4d.EventAdd() # Execute main() if __name__=='__main__': main()
I was expecting that the child would default to inheriting settings from its parent. Any help appreciated
Ok. I figured it out. The ID was wrong. It was supposed to be 465001634
-b
Hi I managed to delete my original plugin So now im recreating it. But when i run this plugin now with the findplugin argument, it returns None. As stated higher up in the thread im trying to set custom database paths in prefs on startup.
import c4d import os, sys def PluginMessage(id, data): if id == c4d.C4DPL_PROGRAM_STARTED: # try: # Get plugin object plugin = c4d.plugins.FindPlugin(1040566) # Print plugin object print('Plugin ', plugin) plugin.GetDescription(c4d.DESCFLAGS_DESC_0) dbPaths = plugin[c4d.PREF_DATABASE_PATHS] print('Existing DB paths {}').format(dbPaths)
Any help appreciated.
Thanks! Works like a charm!
So im trying to get this to work inside our startup plugin. I can set new database paths but i cant read the existing ones. So im constantly overwriting the paths field.
import c4d import os, sys def PluginMessage(id, data): if id == c4d.C4DPL_PROGRAM_STARTED: try: # Get plugin object plugin = c4d.plugins.FindPlugin(1040566) # Print plugin object print('Plugin {}').format(plugin) # Get existing paths dbPaths = plugin[c4d.PREF_DATABASE_PATHS] # Print existing paths print('Existing DB paths {}').format(dbPaths) # Set new paths dbPaths = dbPaths + "\n" + "S:/_3D_Central/Maxon/Racecar-Assets-Redshift" plugin[c4d.PREF_DATABASE_PATHS] = dbPaths # Print new paths print('New DB paths {}').format(dbPaths) except KeyError: sys.exit(1)
print('Existing DB paths {}').format(dbPaths) doesnt print anyting even though there are entries in the Databases field. Am i doing something wrong?
Thanks! Ill try that.
Hi I have a python startup plugin that sets texture paths in Prefs>File Assets! with SetGlobalTexturePaths(...) for all workstations and render slaves. Is there a similar method for setting custom paths for node material Asset Databases (below the File Assets field) ?
Omg! I had an old version of the plugin defined in the Plugins list in prefs that set the paths to []. Blush Deluxe! Sorry for wasting your time. Works perfectly fine.