Enabling Material Channels



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/07/2004 at 20:31, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   7.303 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;  C++  ;

    ---------
    Next issue... ;)
    My plugin creates BaseMaterial nodes and adds them to the document.  I can get the BaseChannels and set up the desired colors/texture filenames, etc., but my question is:
    How do I 'enable' say the Alpha channel?
    If you open up a material dialog, there's a list of checkboxes down the left-hand side (v7.303) for:
    Color
    Diffusion
    Luminance
    Transparency
    etc..
    How do I (programatically) enable those checkboxes?
    Thanks,
    - Keith



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/07/2004 at 21:04, xxxxxxxx wrote:

    Ok, after researching this further, I ran across what I'm looking for - sort of...
    The problem is, AllocBaseMaterial() is documented (and prototyped) as returning a pointer to a 'BaseMaterial' class, but it apparently actually returns a pointer to a 'Material' class - which has the functions I needed.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/07/2004 at 01:07, xxxxxxxx wrote:

    Ok. I guess it doesn't matter anymore, since the material system has now changed.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/07/2004 at 06:13, xxxxxxxx wrote:

    Hmm... are there release notes in the v8.xxx SDK that describe compatibility issues between versions?  I'd like for my plugin to work in v8.xxx, even if I need to bypass some functionality (I'd like for it to at least not crash).
    Thanks,
    - Keith



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/07/2004 at 22:31, xxxxxxxx wrote:

    There is some description of the changes involved. But the easiest way is probably to compile two different versions of your plugin; just too much has changed in R8. Otherwise you're at the mercy of the emulation layer, which is not always 100% accurate.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/07/2004 at 11:16, xxxxxxxx wrote:

    On a related note... Under 7.303, 'texturetag->GetMaterial()' (while documented and prototyped as returning a BaseMaterial) returned a Material pointer, but apparently, the emulation layer for 8.5 returns NULL pointers instead <sigh>. 
    Is this a known problem?  Is there any way around it, except for compiling separate, version-specific plugins?
    Thanks,
    - keith



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/07/2004 at 04:07, xxxxxxxx wrote:

    First of all, GetMaterial() returns either a Material or a PluginMaterial, both of which are derived from BaseMaterial. This is a common principle in the API. So only when you know that it actually is a Material is it safe to cast it.
    Second, I couldn't reproduce the bug you describe. In a sample scene with just a cube with a standard material assigned to it, this gave a non-NULL result:

        
        
        BaseMaterial* mat =   
          static_cast<TextureTag*>(  
            doc->GetFirstObject()->GetTag(Ttexture))->GetMaterial();  
        GePrint(LongToString(reinterpret_cast<LONG>(mat)));
    

    To answer your last question, I'd recommend compiling different versions, rather than spending time working with the emulation layer.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/07/2004 at 08:16, xxxxxxxx wrote:

    Hmmm... I'm not sure what specific situation resulted in NULL pointers being returned, but I was definately getting them.
    At any rate, I've since ported the plugin to the 8.5 SDK and your statement above has me concerned because it's still relevent to my ported code...
    "So only when you know that it actually is a Material is it safe to cast it"
    How can I determine that it's actually a Material?
    Thanks,
    - Keith



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/07/2004 at 16:39, xxxxxxxx wrote:

        
        
        BaseMaterial* bmat = ...;  
        if (bmat && bmat->GetType() == Mmaterial)  
        {  
          Material* mat = static_cast<Material*>(bmat);  
          ...  
        }
    

Log in to reply