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

    Load string from description?

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 415 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/08/2012 at 01:04, xxxxxxxx wrote:

      Hello,

      I can load a string from the plugins resource using c4d.plugins.GeLoadString(). But this function
      does not work for description-elements. I want to get the string associated with the ID Tphong or
      PRIM_CUBE_LEN, just for example. How can I get it?

      Thanks in advance,
      Niklas

      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 07/08/2012 at 01:41, xxxxxxxx wrote:

        Originally posted by xxxxxxxx

        I can load a string from the plugins resource using c4d.plugins.GeLoadString(). But this function
        does not work for description-elements. I want to get the string associated with the ID Tphong or
        PRIM_CUBE_LEN, just for example. How can I get it?

        To get the name of a tag type you can call c4d.GetTagName() function that was added in R13:

        c4d.GetTagName(c4d.Tphong)
        

        Also another function to get an object type's name was added, c4d.GetObjectName() :

        c4d.GetObjectName(c4d.Ocube)
        

        And it's currently not possible to access the description parameters of objects. So we cannot get the name of PRIM_CUBE_LEN parameter (would be the id c4d.DESC_NAME in the description container for the parameter). But it's possible to access dynamic descriptions with BaseList2D.GetUserDataContainer().

        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 07/08/2012 at 01:54, xxxxxxxx wrote:

          Thanks for your answer Yannick.The GetTagName() function is what I searched for, thanks. 🙂

          > (would be the id c4d.DESC_NAME in the description container for the parameter).
          Wouldn't that require an instance of the actual object/tag so that we can obtain the description? (As you said, it's not possible Python anyway..)

          Regards,
          Niklas

          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 07/08/2012 at 02:03, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            Wouldn't that require an instance of the actual object/tag so that we can obtain the description?

            Yes, but that's not a big deal because the object doesn't need to be present in a document but in memory. Here's an handy function that returns the name of an object's parameter:

            String GetObjectParameterName(LONG type, LONG id)
            {
                BaseObject *op = BaseObject::Alloc(type);
                if (op->GetType()==type)
                {
                    AutoAlloc<Description> desc; if (!desc) return String();
                    if (!op->GetDescription(desc,DESCFLAGS_DESC_0)) return String();
                    const BaseContainer *bc = desc->GetParameterI(id,NULL);
                    if (bc)
                        return bc->GetString(DESC_NAME);
                }
                return String();
            }
            

            So for PRIM_CUBE_LEN we would call it like this:

            GetObjectParameterName(Ocube, PRIM_CUBE_LEN)
            
            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 07/08/2012 at 02:06, xxxxxxxx wrote:

              Haha, ok! I just thought that would be kind of a large overhead. 😉 But thanks for pointing it out.

              -Nik

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