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

    restore selection from edgeSelTag

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 660 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/12/2008 at 08:43, xxxxxxxx wrote:

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

      ---------
      Hi,

      i have an edgeSelectionTag and I want to restore the edge selection on the object, that the tag belongs to.
      I cannot find any info on this, but maybe im not looking in the right spot..

      can somebody hint me in the right direction?

      thanks,
      Daniel

      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/12/2008 at 08:56, xxxxxxxx wrote:

        SelectionTag::GetBaseSelect() returns the selection stored in the tag.

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

          thanks, but how would i use it to select the edges that are stored in the tag?

          i tried it like this, but it doesnt seem to be the right way to do it:

          > <code>
          > // deselect all     
          > ToPoly(edges->GetObject())->GetEdgeS()->DeselectAll();     
          > // restore selection from tag
          > BaseSelect* bs = edges->GetBaseSelect();
          > LONG seg=0,a,b,i;
          > while (bs->GetRange(seg++,&a;,&b;)){
          >     for (i=a; i<=b; ++i){
          >      bs->Select(i);
          >     }
          > }
          > </code>

          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/12/2008 at 09:34, xxxxxxxx wrote:

            ok i tried it differently now, using setSelectedEdges().
            It does select some edges now, but not the right ones.
            Looks like its using the wrong edge indices..

            > <code>
            > PolygonObject* polyObj = ToPoly(edges->GetObject());
            >      // deselect all
            >      polyObj->GetEdgeS()->DeselectAll();     
            >      // restore selection from tag
            >      Neighbor* ne = new Neighbor();     
            >      ne->Init(polyObj->GetPointCount(), polyObj->GetPolygon(), polyObj->GetPolygonCount(), NULL);
            >      polyObj->SetSelectedEdges(ne,edges->GetBaseSelect(),EDGES_SELECTION);
            >      ne->Flush();
            > </code>

            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/12/2008 at 10:22, xxxxxxxx wrote:

              looks like sth is wrong with the baseSelect.

              > <code>
              > SelectionTag* edges = (SelectionTag* ) op->GetDataInstance()->GetLink(ES_EDGE_LINK,op->GetDocument());
              > BaseSelect* bs = edges->GetBaseSelect();
              > // restore selection from tag
              > .
              > .
              > </code>

              The link-field accepts 'Tedgeselection'.

              if i create the baseselect like this it works:

              > <code>
              > .
              > .
              > bs = polyObj->GetSelectedEdges(ne,EDGES_SELECTION);
              > // restore selection from tag
              > .
              > .
              > </code>

              but i dont want the current selection, i want the selection that is stored in the edgeSelectionTag..

              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/12/2008 at 11:45, xxxxxxxx wrote:

                Howdy,

                For Cinema 4D's Edge Selection tag, an easy way would be to simulate clicking the "Restore Selection" button by sending a message to the tag like this:

                > \> DescriptionCommand dc; \> dc.id = DescID(EDGESELECTIONTAG_COMMAND1); \> edgSelTag->Message(MSG_DESCRIPTION_COMMAND,&dc;); \>

                Adios,
                Cactus Dan

                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 28/12/2008 at 09:49, xxxxxxxx wrote:

                  Thanks Dan,
                  thats indeed how i did it now (found a code snippet in some old post).

                  Still i wonder what was wrong in the code above.
                  If i ever find out i'll add the solution here.

                  greetings,
                  Daniel

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

                    The selected edges in the Selection tag are encoded like this:
                    (4*poly)+edge, where edge goes from 0-3

                    Here an example that prints the poly and edge indices of a Selection tag:

                    > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      BaseObject \*op = NULL; \>      op = doc->GetActiveObject(); \>      if(!op) return TRUE; \> \>      if(op->GetType() == Opolygon) \>      { \>           SelectionTag \*tag = NULL; \>           tag = (SelectionTag\* )op->GetTag(Tedgeselection, 0); \> \>           if(tag) \>           { \>                BaseSelect \*sel = NULL; \>                sel = tag->GetBaseSelect(); \>                if(sel) \>                { \>                     LONG seg=0,a,b,i; \> \>                     while (sel->GetRange(seg++,&a;,&b;)) \>                     { \>                          for (i=a; i<=b; ++i) \>                          { \>                               LONG polyindex = i/4; \>                               LONG edgeindex = Mod(i,4); \> \>                               GePrint("poly index "+LongToString(polyindex)); \>                               GePrint("edge index "+LongToString(edgeindex)); \>                          } \>                     } \>                } \>           } \>      } \> \>      return TRUE; \> } \>

                    cheers,
                    Matthias

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