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

    Best practices for loading textures?

    Cinema 4D SDK
    sdk c++ 2023
    3
    3
    498
    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.
    • J
      jpheneger
      last edited by

      I would like to create a C++ plugin that is able to load textures from a directory and allow the user to drag/drop the textures into C4D for use in creating materials.

      Is there a document that describes the best practices for accomplishing this task?

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @jpheneger
        last edited by ferdinand

        Hello @jpheneger,

        Welcome to the forum and thank you for reaching out to us. Your question is a bit too broad and specific at the same time to be answered in a truly meaningful manner. Or in short, we neither do have a code example, nor a manual which covers this specific case. We also cannot guide each new user manually through the stages of creating a plugin. Or put absolutely, 'if necessary, we will provide code examples, but we will not provide full solutions or design applications', as stated in under scope of support in our forum guidelines.

        I would however recommend reading these:

        • Plugin Development: Describes the technical requirements for building plugins with the Cinema 4D SDK.
        • CommandData: The plugin hook you probably want to implement here.
        • GeDialog: Represents a window which can be opened, closed, docked, and populated with GUI gadgets. Your CommandData will/can use such dialog to realize its GUI. You can find C++ GUI examples in general here. Most of them are a bit bloated, a smaller one is gedialog_gadgets which exemplifies both CommandData and GeDialog.
        • TreeViewFunctions and SimpleListView: These are the handler interfaces for GUIs specialized in displaying tree and lists of things which you might need here. See also ListView example and TreeView examples.
        • Resource File Manual: Describes how to describe GUIs with the classic API GUI markup of Cinema 4D, resource files.
        • Cinema 4D Threads Manual: Cinema 4D comes with threading restrictions especially regarding scene manipulation, one should be aware of them.

        And last but not least, what you want to do, is largely covered by the Asset API - storing textures as reusable things, displaying them in a manager, etc. Depending on what you want to do, you could either simply open an Asset Browser popup for the existing asset sub type SubType_ENUM_MediaImage or write your own asset type wrapping textures. If you wanted to, you could also write your own "Asset Manager" with the techniques described above and only use the Asset API as a data layer.

        You could also use WatchFolderAssetRepositoryInterface to store your assets in watch folders instead of the more abstract native database format.

        • Asset API Handbook: Demonstrates how to provide content as reusable assets served with the Cinema 4D Asset Browser.
        • Get asset from asset browser python: Thread here on the forum, I showed there how to create materials via asset textures with drag and drop in Python. I had to be a bit creative in some places due to the limitations of the Python API. In C++ you do not have to do this, but this might still be helpful.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • M
          m_adam
          last edited by

          Hello @jpheneger,

          without further questions or postings, we will consider this topic as solved by Friday 02/06/2023 and flag it accordingly.

          Thank you for your understanding,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

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