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

    TakeSystem changes bitmap [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 359 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 31/01/2017 at 00:14, xxxxxxxx wrote:

      I'd like to operate TakeSystem in Python.

      github.com/PluginCafe/cinema4d_py_sdk/blob/master/scripts/takesystem/takesystem_MaterialOverride.py

      This script is consulted. I'd like to replace a texture of a material by take.

      materialColorParameter = c4d.DescID(c4d.DescLevel(c4d.MATERIAL_COLOR_COLOR, c4d.DTYPE_COLOR, 0))
      hsv = c4d.Vector(float(i) * 0.1, 1.0, 1.0)
      rgb = c4d.utils.HSVToRGB(hsv)
      overrideNode = materialVariation.FindOrAddOverrideParam(takeData, material,materialColorParameter, rgb)

      This part was changed.

      materialColorParameter = c4d.DescID(c4d.DescLevel(c4d.MATERIAL_COLOR_SHADER, c4d.DTYPE_TEXTURE, 0))
      shader = c4d.BaseList2D(c4d.Xbitmap)
      shader[c4d.BITMAPSHADER_FILENAME] = "Bitmap_path"
      overrideNode = pathVariation.FindOrAddOverrideParam(takeData,arnold_sky,materialColorParameter, shader)

      I'd like to make and change bitmap Shader of a material.
      When Script is carried out, a texture of a material will be None.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 31/01/2017 at 01:41, xxxxxxxx wrote:

        Hello and welcome,

        in your code you are creating a new shader but you do not insert this shader into anything (nobody owns that shader). A new shader must be inserted into the element that uses that shader using BaseList2D.InsertShader().

        Alternatively, you could add the override to the shader directly and not to the material. Then you would override just the BITMAPSHADER_FILENAME parameter.

        best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 31/01/2017 at 02:37, xxxxxxxx wrote:

          Special thanks!!!!
          I forgot Shader insert.

          materialColorParameter = c4d.DescID(c4d.DescLevel(c4d.MATERIAL_COLOR_SHADER, c4d.DTYPE_TEXTURE, 0))
          shader = c4d.BaseList2D(c4d.Xbitmap)
          shader[c4d.BITMAPSHADER_FILENAME] = "Bitmap_path"
          material.InsertShader(shader)
          material.Message(c4d.MSG_UPDATE)

          overrideNode = pathVariation.FindOrAddOverrideParam(takeData,material,materialColorParameter, shader)

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