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

    Howto create layerobject

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 668 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 22/07/2009 at 14:39, xxxxxxxx wrote:

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

      ---------

      Howto create LayerObject?

      First wrong

      > BaseObject\* lay = BaseObject::Alloc(Olayer); \> (!lay) return FALSE;     // return null pointer \> lay->SetName(LayNameString); \> doc->InsertObject(lay,NULL,NULL,FALSE);

      Second wrong

      > LayerObject\* lay = LayerObject::Alloc(); \> (!lay) return FALSE;     // Good \> lay->SetName(LayNameString); \> doc->InsertObject((BaseObject\* )lay,NULL,NULL,FALSE);//Crash

      Please 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 22/07/2009 at 14:56, xxxxxxxx wrote:

        Hi dinnye,

        The LayerObject has nothing to do with BaseObject. See class hierarchy.

        What you want to do?

        Bye, Sebastian

        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 22/07/2009 at 15:12, xxxxxxxx wrote:

          Hi Shawni

          I want create layer in the Layer Browser (and assign to object (later))

          My code

          > Bool AC4DPOLY::CreateLayer     (BaseDocument \*mydoc, String LayNameString) \> { \>      GeListHead \*layerlist = NULL; \>      layerlist = mydoc->GetLayerObjectRoot(); \>      if(!layerlist) return FALSE; \>      Bool laycheck =TRUE; \> \>      //check current layerlist \>      LayerObject \*layer = (LayerObject\* )layerlist->GetFirst(); \>      if (layer) \>      { \>           for (layer; layer; layer = layer->GetNext()) \>           { \>                if (LayNameString == layer->GetName()) \>                { \>                     laycheck = FALSE; \>                     break; \>                } \>           } \>      } \> \>      //Create layer \>      if (laycheck) \>      { \>           //Create layer with LayNameString name; \>      } \> \>      return TRUE; \> }

          Dont know howto alloc LayerObject, not sample in SDK.
          Sorry my bad english.

          Thanks
          Dinnye

          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 22/07/2009 at 16:18, xxxxxxxx wrote:

            LayerObject* lo = LayerObject::Alloc();
            if (!lo) // allocation failed

            I see you tried doc->InsertObject(). You probably need to get the layer root (doc->GetLayerObjectRoot()) and append to the list (GeListHead->InsertLast(lo)).

            Set an object to the layer using obj->SetLayerObject(lo).

            Use lo->GetLayerData(doc,...) to get the layer settings.

            About all that I can tell you about layers. 😄

            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 23/07/2009 at 01:12, xxxxxxxx wrote:

              Thanks. Try 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 23/07/2009 at 02:05, xxxxxxxx wrote:

                Yes, you have to insert the layer into the layer's list.

                Simple example, inserts a layer:

                > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      LayerObject \*layer = NULL; \>      layer = LayerObject::Alloc(); \>      if (!layer) return FALSE; \> \>      GeListHead \*layerlist = NULL; \>      layerlist = doc->GetLayerObjectRoot(); \>      if (!layerlist) return FALSE; \> \>      layerlist->Insert(layer, NULL, NULL); \> \>      layerlist->Message(MSG_UPDATE); \> \>      EventAdd(); \> \>      return TRUE; \> } \>

                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 23/07/2009 at 03:26, xxxxxxxx wrote:

                  wow, cool!

                  Thanks Matthias.

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