Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login
    1. Home
    2. bonsak
    B
    • Profile
    • Following 0
    • Followers 1
    • Topics 8
    • Posts 31
    • Best 1
    • Controversial 0
    • Groups 0

    bonsak

    @bonsak

    1
    Reputation
    193
    Profile views
    31
    Posts
    1
    Followers
    0
    Following
    Joined Last Online

    bonsak Unfollow Follow

    Best posts made by bonsak

    • RE: Child render setting does not inhertit from parent

      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:

      • 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

      posted in Cinema 4D SDK
      B
      bonsak

    Latest posts made by bonsak

    • RE: Child render setting does not inhertit from parent

      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

      posted in Cinema 4D SDK
      B
      bonsak
    • RE: Child render setting does not inhertit from parent

      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:

      • 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

      posted in Cinema 4D SDK
      B
      bonsak
    • 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 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()
      

      12eb8526-2832-4b02-b809-094af86dc559-image.png
      24ed2070-7b56-429d-8664-e3d73c55782d-image.png

      I was expecting that the child would default to inheriting settings from its parent.
      Any help appreciated

      Regards
      Bonsak

      posted in Cinema 4D SDK s24 python
      B
      bonsak
    • RE: How can i set custom Databases paths in prefs with python?

      Ok. I figured it out. The ID was wrong. It was supposed to be 465001634

      -b

      posted in Cinema 4D SDK
      B
      bonsak
    • RE: How can i set custom Databases paths in prefs with python?

      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.

      Regards
      Bonsak

      posted in Cinema 4D SDK
      B
      bonsak
    • RE: How can i set custom Databases paths in prefs with python?

      Thanks! Works like a charm!

      -b

      posted in Cinema 4D SDK
      B
      bonsak
    • RE: How can i set custom Databases paths in prefs with python?

      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?

      Regards
      Bonsak

      posted in Cinema 4D SDK
      B
      bonsak
    • RE: How can i set custom Databases paths in prefs with python?

      Thanks! Ill try that.

      Regards
      Bonsak

      posted in Cinema 4D SDK
      B
      bonsak
    • How can i set custom Databases paths in prefs with python?

      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) ?
      c5385534-5590-4fa6-a08b-fd3c08bbfab2-image.png

      Any help appreciated.

      -b

      posted in Cinema 4D SDK python r21
      B
      bonsak
    • RE: Setting texture paths with plugin on startup

      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.

      Regards
      Bonsak

      posted in Cinema 4D SDK
      B
      bonsak