Child render setting does not inhertit from parent
-
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 2But 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 appreciatedRegards
Bonsak -
Hello @bonsak,
thank you for reaching out to us. Please remember to follow our Forum Guidelines regarding tagging your postings.
About your question: I cannot reproduce the behavior described by you on either S24 or R25. On which specific version and OS are you? I assume S24.110, but which OS? What might be a source for confusion is how that feature works in the first place. The command Inherit Parent Setting will simply copy over settings from the parent. It will always be grayed out when the parameter of the
RenderData
which is a child of anotherRenderData
is already of the same value as the parameter of the parent. See end of my posting for details.If this does not solve your problem, I would have to ask you to provide more precise information as lined out in the Forum Guidelines.
Cheers,
Ferdinandedit: Hm, I could have sworn that the tags have not been there 5 minutes ago. Probably just getting old But It would be still necessary that you clarify the OS.
How Inherit Parent Setting works:
-
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 initiallyI 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:
- In your "My Render Settings" change the render resolution
- Make a depth AOV in the RS AOV manager
- Run the script
= The resolution of the child is 1280x720 an there is no AOV in the childs RS AOV manager, but the parent has the same res as the original and a depth AOV in the manager (at least on my machine)
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 -
Hello @bonsak,
unfortunately, I still cannot reproduce your problem. Your script runs fine for me and does what its code tells it to do. One source of ambiguity might be your function
MakeRSRaw()
.def MakeRsRaw(renderdata, parent): raw = c4d.documents.RenderData() # Clone active renderdata raw.SetName("Redshift Raw") # Set name # ...
The comment in code and the fact that you say here in the thread 'i' am copying has non default values, the child will not get these values' implies that there is a misunderstanding. First of all, there is obviously no cloning going on in your code. You simply create a RenderData instance from scratch which then will also come with default values. Secondly, Inherent Parent Behavior does not mean that the node data are being copied over all the time. Which you do seem to expect when you expect a new instance of RenderData to automatically 'snap' to its parent. The option only means that a value is being copied over to the children when it is being edited on the parent. When you want the child to be a carbon copy of its parent form the getgo, you must either clone the parent or overwrite all values of the parent.
I would recommend our user manual for details on the topic, as it does explain it better than I do.
I hope this helps and cheers,
Ferdinand -
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.Regards
Bonsak -
Hello @bonsak,
I assume you do not have any further questions here? Without any further questions, we will regard this topic as solved and flag it accordingly by Monday, September, the 8th.
Thank you for your understanding,
Ferdinand -
Hi,
I stumbled upon the same problem. The script from bonsak didn't solve the problem for me.
But thanks to a tip I found a working solution.
It is possible to make a parent-child setup. But you have to change the values in the parent settings after creating the child settings.import c4d from c4d import gui import redshift def main(): #Create main render setting rd = c4d.documents.RenderData() rd.SetName('render_group') rd[c4d.RDATA_RENDERENGINE] = redshift.VPrsrenderer rd_red = redshift.FindAddVideoPost(rd, redshift.VPrsrenderer) doc.InsertRenderData(rd) #Create child render setting child_setting = c4d.documents.RenderData() child_setting.SetName('child setting') child_setting[c4d.RDATA_RENDERENGINE] = redshift.VPrsrenderer doc.InsertRenderData(child_setting , rd) redshift.FindAddVideoPost(child_setting, redshift.VPrsrenderer) doc.InsertRenderData(child_setting , rd) #Change main render settings rd[c4d.RDATA_XRES] = 1920.0 rd[c4d.RDATA_YRES] = 1080.0 rd[c4d.RDATA_FRAMERATE] = 25.0 rd[c4d.RDATA_FORMAT] = 1023671 #PNG rd[c4d.RDATA_FORMATDEPTH] = 1 #depth 16bit #Change Redshift post effect rd_red[c4d.REDSHIFT_RENDERER_ENABLE_AUTOMATIC_SAMPLING] = 0 rd_red[c4d.REDSHIFT_RENDERER_UNIFIED_MIN_SAMPLES] = 32 rd_red[c4d.REDSHIFT_RENDERER_UNIFIED_MAX_SAMPLES] = 256 rd_red[c4d.REDSHIFT_RENDERER_MOTION_BLUR_ENABLED] = 1 rd_red[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_VIEW] = 'Un-tone-mapped' if __name__=='__main__': main()