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
    • Login

    Change a rendering parameter in python xpresso node

    Cinema 4D SDK
    5
    12
    1.9k
    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.
    • ferdinandF
      ferdinand
      last edited by

      Hi,

      I am a bit confused. If you have the plugin id, I do not quite understand what exactly the problem is. You will have to get the plugin instance with c4d.plugins.FindPlugin(PLUGIN_ID) and then change the parameter on the returned node.

      For the case that you misspoke and actually meant that you know the symbol of the parameter and not the id of the plugin, here you can learn how to find out the plugin id for any node in Cinema 4D. The link is an example for an entry in the preferences dialog, but it will work exactly the same for a VideoPost plugin. You can of course also just grep the plugin folder, but since Vray has probably more than one plugin id (i.e. consists of multiple plugins), inspecting the node type in question in the console is probably a bit faster than grep.

      Cheers,
      zipit

      MAXON SDK Specialist
      developers.maxon.net

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        @zipit said in Change a rendering parameter in python xpresso node:

        Hi,
        I am a bit confused. If you have the plugin id, I do not quite understand what exactly the problem is.

        You're right @zipit, nothing to get confused about it was just me taking a different mind path. Your proposed approach is indeed correct and also more effective. Thanks for pointing it out!

        1 Reply Last reply Reply Quote 0
        • Passion3DP
          Passion3D
          last edited by

          Thanks to both of you 😉 I'll test all this tomorrow and let you know the result.

          1 Reply Last reply Reply Quote 0
          • Passion3DP
            Passion3D
            last edited by

            What's wrong in my code?

            import c4d
            
            def main():
                # check doc
                if doc is None:
                    return
            
                # get the active RenderData
                activeRD = doc.GetActiveRenderData()
                if activeRD is None:
                    return
            
                # get the first BaseVideoPost (Active Render)
                firstVP = activeRD.GetFirstVideoPost()
                if firstVP is None:
                    return
                shader = firstVP[c4d.VP_VRAYBRIDGE_ENVIRONMENT_BACKGROUNDTEX]
                if shader == None:
                    shader = c4d.BaseShader(c4d.Xbitmap)
                    firstVP.GetDataInstance()[c4d.VP_VRAYBRIDGE_ENVIRONMENT_BACKGROUNDTEX] = shader
                shader[c4d.BITMAPSHADER_FILENAME] = "approaching_storm_4k.hdr"
                c4d.EventAdd()
            
            if __name__=='__main__':
                main()
            
            
            CairynC P 2 Replies Last reply Reply Quote 0
            • CairynC
              Cairyn @Passion3D
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • P
                PluginStudent @Passion3D
                last edited by

                Shader creation requires inserting the shader using InsertShader().

                E.g. Python Generator - Adding Shaders to Deformer Objects.

                1 Reply Last reply Reply Quote 0
                • Passion3DP
                  Passion3D
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • Passion3DP
                    Passion3D
                    last edited by

                    @PluginStudent
                    Your link is about the creation of a material (and that I already know how to do), not a render parameter.

                    But I have tound the solution.

                        shader = firstVP[c4d.VP_VRAYBRIDGE_ENVIRONMENT_BACKGROUNDTEX]
                        if shader == None:
                            shader = c4d.BaseList2D(c4d.Xbitmap)
                            firstVP.InsertShader(shader)
                            firstVP.GetDataInstance()[c4d.VP_VRAYBRIDGE_ENVIRONMENT_BACKGROUNDTEX] = shader
                        shader[c4d.BITMAPSHADER_FILENAME] = "approaching_storm_4k.hdr"
                    
                    

                    Other question, how to remove it? I don't have found "DeleteShader" or "RemoveShader"🤔

                    CairynC 1 Reply Last reply Reply Quote 0
                    • CairynC
                      Cairyn @Passion3D
                      last edited by

                      @Passion3D The link is about a deformer, not a material. InsertShader() is a function of the class BaseList2D, which is a quite common base class; from what I gather you need to use InsertShader() with all classes that use a shader, whether it's material, render parameter, deformer or whatever.

                      In GeListNode (one class up from BaseList2D) you will find the method Remove(), which can be applied to a shader, no need for a specific "RemoveShader".

                      1 Reply Last reply Reply Quote 0
                      • Passion3DP
                        Passion3D
                        last edited by Passion3D

                        @Cairyn Thanks, all work fine for this module 👍

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post