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

    SetLink in a material

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 628 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 15/01/2008 at 18:53, xxxxxxxx wrote:

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

      ---------
      Hello All,

      i'm trying to setlink inside a my custom material with two others materials allocated and inserted in the same scene with:

      front=(BaseMaterial* )bcmat->GetMaterialLink(VRAY2SIDEDMATERIAL_PARAMS_LINK1, pp->GetDocument());
      back=(BaseMaterial* )bcmat->GetMaterialLink(VRAY2SIDEDMATERIAL_PARAMS_LINK2, pp->GetDocument());

      if (front) {
      frontMat=(BaseMaterial* )front->GetClone(NULL,NULL);
      scene->pDoc->InsertMaterial(frontMat);
      bcmat->SetLink(VRAY2SIDEDMATERIAL_PARAMS_LINK1,frontMat);
      }

      but if just here i try to get the linked material:

      front=(BaseMaterial* )bcmat->GetMaterialLink(VRAY2SIDEDMATERIAL_PARAMS_LINK1, node->GetDocument());

      front is 0x00000000

      so.. seem that i'm using the wrong way to fill the material link inside my materil..

      Any help?

      Thanks
      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 15/01/2008 at 22:25, xxxxxxxx wrote:

        This is the material snapshot:

        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 08:36, xxxxxxxx wrote:

          Hi all,

          please it's urgent for us 😞

          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 17/01/2008 at 20:28, xxxxxxxx wrote:

            Hi all,

            i see that the CopyTo for this material is called 3 time.

            1. The first one is all ok, the snode links to materials are copied to the dnode.. it work 🙂

            2. now the current dnode is the same (same pointer) as the previous dnode.. but the 2 material link are now NULL;

            the rendering is called..

            1. as the first time, it work but unuseless.. 😞

            What i really don't understand, why the entire container is not copied? I used to play inside the copyto to understand what's can be the cause..

            still investigating..
            Renato T.

            Edit:

            I forgot.. this problem is only in the material preview.. all kind of rendering are working very good..

            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 20/01/2008 at 08:44, xxxxxxxx wrote:

              The problem is that the material preview is designed to only copy one material to a new (internal) document. Links only work within the same document, so that's why it fails.
              I'm sorry, but I don't see a solution for this type of purpose right now!

              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 20/01/2008 at 08:58, xxxxxxxx wrote:

                Hello Philip,

                Thanks for your answer.. but really there is no solution?
                Do i must write my custom preview routine and bypass the pDoc things?

                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 20/01/2008 at 09:17, xxxxxxxx wrote:

                  You could try to detect a material preview situation and use GetData(id).GetBaseLink()->ForceGetLink() instead of GetMaterialLink().
                  ForceGetLink does no document checking but is risky in a multithreaded environment as the one document might be long gone by the time you access it. Therefore it should be limited to the material preview situation only.

                  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 20/01/2008 at 11:28, xxxxxxxx wrote:

                    Thanks Philip,

                    i'll try..

                    but what about a custom preview scene?

                    Cheers
                    Renato

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