Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Login

    [SOLVED]Create new renderdata

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 647 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 17/01/2017 at 13:53, xxxxxxxx wrote:

      Is there a way for creating completly new RenderData?
      For exemple set render engine to Hardware seem to broke the UI since we got the interface of the standar render but we don't have parameter for hardware.
      Also I'm not able to use some preset or set a custom size.

      import c4d
        
      def main() :
          rd = c4d.documents.RenderData()
          rd[c4d.RDATA_RENDERENGINE] = c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE #Not working ?
        
          rd[c4d.RDATA_FRAMESEQUENCE] = 2
          rd[c4d.RDATA_PRESET] = c4d.RDATA_PRESET_HDV1080_25#Not working
          rd[c4d.RDATA_XRES_VIRTUAL] = 1920.0#Not working
          rd[c4d.RDATA_YRES_VIRTUAL] = 1080.0#Not working
          rd[c4d.RDATA_FRAMERATE] = 25.0
          rd[c4d.VP_PREVIEWHARDWARE_ENHANCEDOPENGL] = True
          rd[c4d.VP_PREVIEWHARDWARE_SHADOW] = True
          rd[c4d.VP_PREVIEWHARDWARE_POSTEFFECT] = True
          rd[c4d.VP_PREVIEWHARDWARE_NOISE] = True
          rd[c4d.VP_PREVIEWHARDWARE_ANTIALIASING] = 32
          rd[c4d.RDATA_PATH] = "test"
          rd[c4d.RDATA_FORMAT] = c4d.FILTER_JPG
        
          c4d.StopAllThreads()
          doc.InsertRenderData(rd)
          doc.SetActiveRenderData(rd)
          c4d.EventAdd()
        
      if __name__=='__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 18/01/2017 at 08:56, xxxxxxxx wrote:

        Hi,

        let's go through this one by one:

        rd[c4d.RDATA_RENDERENGINE] = c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE #Not working ?
        

        The actual switching of the engine (in the sense of having the combo box change to the HW renderer) should work this way (at least it does here). The problem is, that you still need to manually add the actual video post effect "Hardware OpenGL" to make it work and have the relevant parameters.
        I suggest to take a look at the RenderData manual in our C++ documentation. Among others you can find a code snippet that actually switches to the HW preview render.

        rd[c4d.RDATA_PRESET] = c4d.RDATA_PRESET_HDV1080_25 #Not working
        

        Unfortunately the presets can not be used in Python (in C++ there might be workarounds using certain messages). The resolution preset does not get stored, instead certain parameters get modified, when the user interacts with the preset menu.

        rd[c4d.RDATA_XRES_VIRTUAL] = 1920.0#Not working
        rd[c4d.RDATA_YRES_VIRTUAL] = 1080.0#Not working
        

        Here we have two options. Either take a look at the above linked manual page and set the resolution via RDATA_XRES and RDATA_YRES IDs directly, like so:

        rd[c4d.RDATA_XRES] = 1920.0
        rd[c4d.RDATA_YRES] = 1080.0
        

        Or, if you want to stick to those virtual IDs (for whatever reason), then you need to fake user interaction in order to make it work. Like so:

        rd.SetParameter(c4d.RDATA_XRES_VIRTUAL, 1920, c4d.DESCFLAGS_SET_USERINTERACTION)
        rd.SetParameter(c4d.RDATA_YRES_VIRTUAL, 1080, c4d.DESCFLAGS_SET_USERINTERACTION)
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 18/01/2017 at 12:00, xxxxxxxx wrote:

          Thanks you a lot Andreas.
          I still don't have the reflex to check C++ but I should.

          Here is the correct python code if any other people want it

          import c4d
            
          def main() :
              rd = c4d.documents.RenderData()
              rd_bc = rd.GetDataInstance()
              
              rd_bc[c4d.RDATA_RENDERENGINE] = c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE
              
              hardware_vp = c4d.BaseList2D(c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE)
              hardware_vp[c4d.VP_PREVIEWHARDWARE_ENHANCEDOPENGL] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_SHADOW] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_POSTEFFECT] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_NOISE] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_TESSELLATION] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_SSAO] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_REFLECTIONS] = True
              hardware_vp[c4d.VP_PREVIEWHARDWARE_ANTIALIASING] = 32
              rd.InsertVideoPost(hardware_vp)
              
              rd_bc[c4d.RDATA_XRES] = 1920
              rd_bc[c4d.RDATA_YRES]  = 1080
              rd_bc[c4d.RDATA_FRAMERATE] = 25
              rd_bc[c4d.RDATA_FORMAT] = c4d.FILTER_JPG
              rd_bc[c4d.RDATA_PATH] = "test"
              
              c4d.StopAllThreads()
              doc.InsertRenderDataLast(rd)
              doc.SetActiveRenderData(rd)
              c4d.EventAdd()
              
          if __name__=='__main__':
              main()
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post