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
    1. Maxon Developers Forum
    2. Matthew_H
    3. Posts
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Matthew_H

    • RE: SetPortValue for Texture node ColorSpace

      Thank you so much, this was very helpful to learn.
      All the best.

      posted in Cinema 4D SDK
      M
      Matthew_H
    • SetPortValue for Texture node ColorSpace

      I checked the forum, and there are few posts that asked the same question yet I still can't get it to work.
      Here is my code:

             # Add a Texture node to the graph
              idTextureNode: maxon.Id = maxon.Id("com.redshift3d.redshift4c4d.nodes.core.texturesampler")
              textureNode: maxon.GraphNode = graph.AddChild(maxon.Id(), idTextureNode)
      
              # Ensure the Texture node was created successfully
              if textureNode.IsNullValue():
                  print("Error: Texture node creation failed.")
                  return
      
              # Set the Color Space port value to RAW
              colorSpacePort: maxon.GraphNode = textureNode.GetInputs().FindChild(
                  "com.redshift3d.redshift4c4d.nodes.core.texturesampler.colorspace")
              if colorSpacePort:
                  try:
                      colorSpacePort.SetPortValue("RS_INPUT_COLORSPACE_RAW ")
                  except Exception as e:
                      print(f"Failed to set color space value: {e}")
      
              # Commit the transaction
              transaction.Commit()
      

      I get this:
      Failed to set color space value: no target to copy for '<net.maxon.graph.interface.graphmodel>'
      All I'm trying to do is set the color space to RAW for incoming normal bitmaps later.
      I'm new to coding, so I am sure I'm doing something wrong here. Help is much appreciated.

      Thank you.

      posted in Cinema 4D SDK python 2024 windows
      M
      Matthew_H