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
    • Recent
    • Tags
    • Users
    • Login

    depending on Material-Name set a Layer

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 579 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 07/05/2009 at 11:40, xxxxxxxx wrote:

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

      ---------
      Hi all,
      I have a new Problem ;.}
      I want to set a layer to an objekt depending on the Material-Name of the objekt:
      In words like this:
      run through all ojekts
      If "Material-Name" = xxx
          then
            set  Layer to the object = "YYY"
      ende 
      An other problem for me is to set the material-projekttion.
      In words like this:
      run through all ojekts
      If "Material-Name" = xxx
         then
           set material-projektion = cubic
      ende
      Thanks so much for all your help.

      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 11/05/2009 at 07:36, xxxxxxxx wrote:

        Please be a bit more specific. What exactly is the problem?

        cheers,
        Matthias

        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 12/05/2009 at 06:00, xxxxxxxx wrote:

          Hi Mathias,
          thanks for your replay.
          Problem is, that we diddn't  know the structure of the databases in C4D.
          So the programmming is to much try and error.
          If there would be a stucture-diagramm it would be verry helpful.
          The problem in the upper question is, that we want to set an existing layer to an existing objekt in case of it´s material-name.
          So first we have go to the first objekt,
          then read out the materal name,
          then, set a Layer to the objekt.
          For example:
          Material = "Wood 01" asign object to Layer "01"
          Material = "Metall 01" asign object to layer "02"
          .
          .
          .

          The problem we have is, that we do not know how to read out the material-name from the current object.
          i seams verry simple, but we don't get the current material Name ;-}}}
          cheers,
          Ronny

          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 13/05/2009 at 00:53, xxxxxxxx wrote:

            Hallo Mathias,
            hier unser aktueller Stand. Die rote Stelle macht mir probleme wiel ich nicht auf das Materialtag und den Namen des Materials komme.
            #include "c4d.h"
            #include "c4d_symbols.h"
             
            class HelloWorld : public CommandData
            {
            public:
            virtual Bool Execute(BaseDocument* doc);
            };
            /**
            * This function is called by Cinema4D when the plugin shall be executed.
            */
            void StepThruHierarchy(BaseObject *obj, LayerObject *layer)
            {
            while (obj && layer)
            // hier kommt die Abfrage nach dem Materialnamen
            //ich benötige den Namen des Materials
            // mname = doc - >get...
            __ 
            {
            obj->SetLayerObject(layer);
            obj->Message(MSG_UPDATE);
            StepThruHierarchy(obj->GetDown(), layer);
            obj = obj->GetNext();
            }
            }
            Bool HelloWorld::Execute (BaseDocument* doc)
            {
            StopAllThreads();
            GeListHead *layerlist = NULL;
            layerlist = doc->GetLayerObjectRoot();
            if (!layerlist) return FALSE;
            StepThruHierarchy(doc->GetFirstObject(), (LayerObject* )layerlist->GetFirst());
            EventAdd();
            return TRUE;
            }
            // -----------------------------------------------------------------
            Bool RegisterV4D_1(void)
            {
            HelloWorld *helloWorld = NULL;
            // initialize global resource object
            if (!resource.Init()) return FALSE;
            // create new instance of HelloWorld class
            helloWorld = gNew HelloWorld;
            return (RegisterCommandPlugin(PLUGIN_ID, GeLoadString (IDS_PLUGIN_NAME),0,"Icon.tif", GeLoadString (IDS_PLUGIN_DESCR), helloWorld));
            }

            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 13/05/2009 at 03:30, xxxxxxxx wrote:

              Since you want to get the material of each object you simply have to get the material tag for each object and going from there to get the material assigned to the material tag.

              Here is a little example printing the name of the first material of each object.

              > \> void StepThruHierarchy(BaseObject \*obj) \> { \>      while (obj) \>      { \>           TextureTag \*ttag = NULL; \>           ttag = static_cast<TextureTag\*>(obj->GetTag(Ttexture)); \>           if (ttag) \>           { \>                BaseMaterial \*mat = NULL; \>                mat = ttag->GetMaterial(); \>                if (mat) GePrint(mat->GetName()); \>           } \> \>           StepThruHierarchy(obj->GetDown()); \>           obj = obj->GetNext(); \>      } \> } \>

              cheers,
              Matthias

              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 13/05/2009 at 05:49, xxxxxxxx wrote:

                Dear Mathias,
                thanks for the help.
                Now it becomes clearer how to jump from the objekt to a Tag!!
                Tkanks so much
                (next is following;-}}})

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