Bitmaps in custom shaders don't appear in Texture Manager



  • 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://plugincafe.maxon.net/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.



  • Hello,

    do you handle the message MSG_GETALLASSETS in your shader?

    See NodeData::Message() Manual

    best wishes,
    Sebastian



  • 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 !



  • 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 !



  • 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


Log in to reply