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. lednevandrey
    3. Topics
    L
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 8
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by lednevandrey

    • L

      What is the meaning of code like `doc: c4d.documents.BaseDocument`?

      Cinema 4D SDK
      • python • • lednevandrey
      4
      0
      Votes
      4
      Posts
      754
      Views

      L

      Hello, Ferdinand!

      Thank you for your attention to my question, your time, and your academic explanations.

    • L

      How to change the projection type for a created material.

      Cinema 4D SDK
      • 2023 python windows • • lednevandrey
      5
      0
      Votes
      5
      Posts
      884
      Views

      ferdinandF

      Hey @lednevandrey,

      without wanting to be rude, I really struggle with understanding what you want to convey. Material[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_UVW does not work because Python is case sensitive and you gave your BaseMaterial instance the symbol material. So, Python is complaining about that.

      But as said before, a material, i.e., BaseMaterial is not the right place to set the projection. It is the counter part to the thing you see in the Material Manager of Cinema 4D and has no projection. The projection is set in the Material Tag, which slightly confusingly is called TextureTag in the API.

      Cheers,
      Ferdinand

      """Assigns the first material in the document to the selected object and sets its projection to UVW. """ import c4d import mxutils doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ if not op: raise ValueError("Please select an object.") # Get the first material in the document. material: c4d.BaseMaterial = doc.GetFirstMaterial() if not material: raise ValueError("No materials found in the document.") # Get the first existing texture tag on #op or create a new one when none exists. tag: c4d.BaseTag = op.GetTag(c4d.Ttexture) or op.MakeTag(c4d.Ttexture) if not tag: raise ValueError("Failed to get or create a texture tag.") # Set the material and projection. tag[c4d.TEXTURETAG_MATERIAL] = material tag[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_UVW # Update the Cinema 4D UI. c4d.EventAdd() if __name__ == '__main__': main()
    • L

      images for the material shaders not assigned to the specified shader

      Cinema 4D SDK
      • python 2023 windows • • lednevandrey
      6
      0
      Votes
      6
      Posts
      891
      Views

      ferdinandF

      Great to hear that you found your solution! Do not hesitate to ask more questions when you run into problems while exploring our Python API. But just as a heads up, we prefer users opening new topics for new questions. For details see the Support Procedures linked above.

      Cheers,
      Ferdinand