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

    Error creating a new material with Alloc

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 726 Views
    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.
    • H Offline
      Helper
      last edited by

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

      On 16/01/2008 at 09:16, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.5 
      Platform:      Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      OK, here it is. My first C++ question 🙂

      I want to create a new material. Isn't this done with:

      > BaseMaterial *mat = Alloc(Mmaterial);

      I get a compiler error:

      > error: 'Alloc' was not declared in this scope

      Anyone?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 16/01/2008 at 10:22, xxxxxxxx wrote:

        Hello,

        better to use
        BaseMaterial *mat = BaseMaterial::Alloc(Mbase);

        Cheers
        Renato

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 16/01/2008 at 10:24, xxxxxxxx wrote:

          BaseMaterial* mat = BaseMaterial::Alloc(Mmaterial);

          There is no generic Alloc() method. Use the static Alloc() associated with the class type.

          X-post. 🙂

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 16/01/2008 at 11:51, xxxxxxxx wrote:

            OK, I'm now trying to use this new material, called 'mat' and assign it to a TextureTag. Like this:

            > BaseContainer *container = tag- >GetDataInstance();
            > container->SetData(TEXTURETAG_MATERIAL, mat);

            I get a new compiler error:

            > error: conversion from 'BaseMaterial*' to 'const GeData' is ambiguous

            What does this mean? Should work like this, no?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              On 16/01/2008 at 12:44, xxxxxxxx wrote:

              ((TextureTag* )tag)->SetMaterial(material);

              Seems easy enough. 🙂

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

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

                On 16/01/2008 at 14:28, xxxxxxxx wrote:

                Hm, I think this is easy enough. But what if I really really wanted to use containers for this? 🙂

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

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

                  On 16/01/2008 at 15:21, xxxxxxxx wrote:

                  You could try:

                  container->SetLink(TEXTURETAG_MATERIAL, mat);

                  or

                  container->SetData(TEXTURETAG_MATERIAL, GeData(mat));

                  but I can't guarantee that these work. 🙂

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

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

                    On 21/01/2008 at 02:12, xxxxxxxx wrote:

                    Check the example below if you really want to use a container.

                    > _
                    > AutoAlloc <BaseLink> link;
                    > if(!link) return FALSE;
                    >
                    > link->SetLink(mat); //mat is my Basematerial
                    >
                    > GeData d(link);
                    >      ttag->SetParameter(DescLevel(TEXTURETAG_MATERIAL),d,NULL);
                    > _

                    cheers,
                    Matthias

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