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

    Need to _set_ POLYSELECTIONTAG_NAME

    SDK Help
    0
    6
    496
    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
      Helper
      last edited by

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

      On 13/07/2004 at 06:59, xxxxxxxx wrote:

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

      ---------
      I'm currently writing an import plugin that successfully loads and creates a PolygonObject.  I'm currently running into two problems...
      1. when I add the PolygonObject to the document, it adds fine ( ie. doc->InsertObject(op,NULL,NULL); ) , but doesn't 'show up' until the user manipulates the interface.
      2. I'm creating some selection tags on the new PolygonObject and those are alo being created fine, but the names I'm giving them are not showing up.  Here's a code snippet of what I'm doing:

          
          
          
          
          typedef struct _objGroup  
          {  
           String strGroupName;  
           DWORD numFaces;  
           DWORD currFace;  
           DWORD *pFaceIndices;  
          } objGroup;  
          
          
          
          
          
          void ObjLoader::SetGroups(PolygonObject *op)  
          {  
           objGroup *pGroup;  
           SelectionTag *pSelect;  
           BaseSelect *pbSelect;  
           DWORD *pFaceIndices;  
           DWORD i, j;
          
          
          
          
           pGroup = &m_pGroups[0];  
           for(i=0; i<m_numGroups; i++)  
           {  
            pSelect = (SelectionTag * )op->MakeTag(Tpolyselection);  
            pSelect->GetData().SetString(POLYSELECTIONTAG_NAME, pGroup->strGroupName);
          
          
          
          
            pFaceIndices = pGroup->pFaceIndices;  
            pbSelect = pSelect->GetBaseSelect();  
            for(j=0; j<pGroup->numFaces; j++)  
            {  
             pbSelect->Select(*pFaceIndices);  
             pFaceIndices++;  
            }  
            pGroup++;  
           }  
          }
          
          
          
          
            
          
      

      ...as I mentioned, the selections are created correctly (they include the correct polygons), but the name field is blank.
      I'd appreciate any help with either problem.. thanks.
      - Keith

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

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

        On 13/07/2004 at 07:03, xxxxxxxx wrote:

        ...on the first problem, I should note that the importer is being implemented as a MENU plugin (it's an .obj file loader and creating it as a FILTER doesn't seem to work since C4D does that already).  I've also tried sending MSG_UPDATE messages to both the document and the PolygonObject.

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

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

          On 13/07/2004 at 07:32, xxxxxxxx wrote:

          Update:  I found the answer to my first question in another message here in the forum...  I added a GeEventAdd(MSG_DOCUMENTCHANGED); and the new mesh shows up fine now.
          Question #2 above is still open, however.

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

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

            On 13/07/2004 at 09:15, xxxxxxxx wrote:

            In a related note, things like:

                
                
                
                
                 TextureTag *pTexture;  
                  pTexture = (TextureTag * )op->MakeTag(Ttexture);  
                  pTexture->GetData().SetString(TEXTURETAG_RESTRICTION, pMat->strMatName);  
                  pTexture->GetData().SetLong(TEXTURETAG_PROJECTION, P_UVW);  
                
            

            ...don't work either.  I assume that I'm doing something fundamentally wrong with all of these.  The objects themselves are being created and added fine, but none of my SetString()/SetLong() calls on the BaseContainer (fetched via GetData()) are working.
            - Keith

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

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

              On 13/07/2004 at 13:33, xxxxxxxx wrote:

              Well, I found the answer (trial, error and inferrence).  You can't just do:

                  
                  
                  
                  
                   TextureTag *pTexture;  
                  
                  
                  
                  
                  
                    pTexture = (TextureTag * )op->MakeTag(Ttexture);  
                    pTexture->GetData().SetString(TEXTURETAG_RESTRICTION, pMat->strMatName);  
                    pTexture->GetData().SetLong(TEXTURETAG_PROJECTION, P_UVW);  
                  
              

              ...you have to do:

                  
                  
                  
                  
                   BaseContainer bc;  
                   TextureTag *pTexture;  
                  
                  
                  
                  
                  
                    pTexture = (TextureTag * )op->MakeTag(Ttexture);  
                    bc = pTexture->GetData();  
                    bc.SetString(TEXTURETAG_RESTRICTION, pMat->strMatName);  
                    bc.SetLong(TEXTURETAG_PROJECTION, P_UVW);  
                    pTexture->SetData(bc);  
                  
                  
                  
                  
              

              ...the above code produces the desired results.
              Cheers,
              - Keith

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

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

                On 13/07/2004 at 16:20, xxxxxxxx wrote:

                Or, try this:-

                  
                BaseContainer *bc;  
                TextureTag *pTexture;  
                  
                pTexture = (TextureTag * )op->MakeTag(Ttexture);  
                bc = pTexture->GetDataInstance();  
                bc->SetString(TEXTURETAG_RESTRICTION, pMat->strMatName);  
                bc->SetLong(TEXTURETAG_PROJECTION, P_UVW);  
                

                This is better as it saves the overhead of the BaseContainer being copied twice, and will be faster for the same reason.

                The documentation for 'getContainerInstance' says:
                'Note: Don't forget to send a Message() if you change any settings.'

                Cheers - Steve

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