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

    Bitmaps in custom shaders don't appear in Texture Manager

    Cinema 4D SDK
    r20 c++ sdk
    2
    5
    941
    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.
    • P
      peterakos
      last edited by

      Hello.

      I have a problem with Texture Manager.
      Even though it shows the bitmaps that are used in material shaders correctly, it doesn't always show the bitmaps in custom shaders and when it does, they appear duplicated.

      So first of all, why the sahders don't appear always in Texture Manager ?
      In this post, it's said that it's not possible to show the bitmaps in custom shaders in Texture Manager: https://developers.maxon.net/forum/topic/9640/12946_texture-manager-support-in-custom-shader/3

      Do I have to add the Bitmap Shaders that exist in ShaderData as children in materials ?

      Thank you.

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello,

        do you handle the message MSG_GETALLASSETS in your shader?

        See NodeData::Message() Manual

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • P
          peterakos
          last edited by

          Hello and thank you for your time helping me !

          I totally missed to use it in the custom shader.
          Nevertheless, even though I've just added it, the missing bitmap don't always appear in Texture Manager.
          I'm testing it using a scene saved in another machine (which didn't run this code).
          The image with wrong absolute path still doesn't appear in the Texture Manager list.

          If I start a new scene and create wrong bitmap absolute paths on purpose, they appear correctly.

          I'm a little bit confused. I suppose there isn't any way to make work in older versions since they have already been saved incorrectly right ?

          Thank you !

          1 Reply Last reply Reply Quote 0
          • P
            peterakos
            last edited by peterakos

            Hello.

            I would like to also ask something different, but very related to MSG_GETALLASSETS.
            If I have custom shaders inside custom shaders, in the top-most shader, do I have to get all the assets from the children as well or is it done autmatically by Cinema 4D ?

            Thank you !

            1 Reply Last reply Reply Quote 0
            • S
              s_bach
              last edited by

              Hello,

              I tested it with the Gradient Shader example from the cinema4dsdk and it works fine as far as I can tell.

              I just removed the check for ASSETDATA_FLAG::TEXTURESONLY:

              Bool SDKGradientClass::Message(GeListNode* node, Int32 type, void* data)
              {
                switch (type)
                {
                case MSG_GETALLASSETS:
                {
                  AssetData* const assetData = static_cast<AssetData*>(data);
                  // checks if only texture assets should be added
                  if (assetData == nullptr)
                    return true;
                    
                  BaseList2D* const baseList2D = static_cast<BaseList2D*>(node);
                  if (baseList2D != nullptr)
                  {
                    // get the file name
                    const Filename path = baseList2D->GetData().GetFilename(GRAD_FILE);
                    // check if the file name is set
                    if (path.IsPopulated())
                    {
                      // add the file name
                      assetData->Add(path, nullptr);
                    }
                  }
                  break;
                }
                }
              
                return SUPER::Message(node, type, data);
              };
              

              Regarding Shader hierarchies: I guess you can send the message to your child-shaders yourself, to make sure they receives the message.

              best wishes,
              Sebastian

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

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