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

    phong break

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 602 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 19/03/2007 at 16:33, xxxxxxxx wrote:

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

      ---------
      Hi,

      I can't get the phong break working in my virtual polygon object.

      First I tried to select the appropriate edges and then use SendModellingCommand(MCOMMAND_BREAKPHONG, md). No effect. If I make the object editable, I can see, that the right edges are selected. If I use another ModellingCommand like the Bevel tool, that works.

      Then I tried GetPhongBreak() and write the edge selection into that baseselect. No effect.

      I select the edges using bs->Select(polyIndex*4 + edgeIndex).

      Can anyone please help? Isn't it possible at all to make a phong break in a virtual polygon object?

      Here the code snippet:

        
      BaseSelect          *bs = pp->GetPhongBreak();  
      Neighbor          nb;  
      PolyInfo          *pli;  
        
      if (!nb.Init(pcnt, vAdr, vcnt, NULL))  
          return FALSE;  
        
      for (i=0; i<vcnt; i++)  
      {  
          pli = nb.GetPolyInfo(i);  
          for (j=0; j<4; j++)  
          {  
           if ((pli->face[j] == NOTOK) || (pli->mark[j]))   
                continue;  
        
           switch (j)  
           {  
           case 0: a=vAdr _.a; b=vAdr _.b; break;  
           case 1: a=vAdr _.b; b=vAdr _.c; break;  
           case 2: a=vAdr _.c; b=vAdr _.d; break;  
           case 3: a=vAdr _.d; b=vAdr _.a; break;  
           }                 
        
           p1 = pAdr[a] * m;  
           p2 = pAdr *** m;  
        
           for (l=0; l<k; l+=2)  
           {  
               p = pVert[l];  
               v = pVert[l+1];  
        
               if ((Len(PointLineDistance(p, v, p1)) <= tol) && (Len(PointLineDistance(p, v, p2)) <= tol))  
               {  
                bs->Select(i*4+j);       
                ecnt++;  
                break;  
               }  
           }  
          }  
      }  
        
      
      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 19/03/2007 at 16:38, xxxxxxxx wrote:

        P.S.: The CODE tag of this forum is really incredible. Of cause I used vAdr _and p2 = vAdr **, but the CODE tag doesn't do what it should: leave the included text untouched!

        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 19/03/2007 at 16:39, xxxxxxxx wrote:

          Isn't it possible to write some code using an array indexed by "i" ???

          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 20/03/2007 at 05:39, xxxxxxxx wrote:

            tried pp->Message( MSG_UPDATE ) ?

            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 20/03/2007 at 07:36, xxxxxxxx wrote:

              certainly. I tried it even twice, once after generating the polymesh and again after phong breaking. No effect.

              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 20/03/2007 at 08:35, xxxxxxxx wrote:

                Got it. The selection in my code above doesn't work, since it selectes - how to say - only single edges, i.e. the pli->mark[] exclusion prevents selecting edges twice from polygons that share one edge. This way is recommended in the sdk and works for other cases, but for phong break you have to allow this double selection. I also use GetEdgeS to select the edges and then break the phong with SendModellingCommand(). Gathering edges using GetPhongBreak() doesn't work.

                  
                for (j=0; j<4; j++)  
                {  
                //     if ((pli->face[j] == NOTOK) || (pli->mark[j])) --> doesn't work for MCOMMAND_BREAKPHONG  
                     if ((j==2) && (vAdr[ i ].c == vAdr[ i ].d)) // just exclude edge 2 for triangles works for MCOMMAND_BREAKPHONG  
                          continue;  
                  
                     switch (j)  
                     {  
                     case 0: a=vAdr[ i ].a; b=vAdr[ i ].b; break;  
                     case 1: a=vAdr[ i ].b; b=vAdr[ i ].c; break;  
                     case 2: a=vAdr[ i ].c; b=vAdr[ i ].d; break;  
                     case 3: a=vAdr[ i ].d; b=vAdr[ i ].a; break;  
                     }  
                   ...  
                }                 
                  
                
                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/03/2007 at 02:45, xxxxxxxx wrote:

                  oh well.. should have seen that.

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