Drawing text to editor view



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

    On 20/11/2006 at 16:02, xxxxxxxx wrote:

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

    ---------
    Hi,

    is that possible? I can't find anything in the BaseDraw or BaseView classes. I just want to output some realtime data during my simulation in the style of c4d's HUD. Any ideas? I'm afraid having to use LineCS() or something.

    Maybe one can use GeClipMap drawing to a bitmap, but I can't find any way to copy it to the editor view.



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

    On 20/11/2006 at 16:12, xxxxxxxx wrote:

    Sorry. First time not have used the search before posting. Sorry. Found a thread from 2003 that says: No.

    But maybe 3 years later? :-)



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

    On 20/11/2006 at 17:12, xxxxxxxx wrote:

    Nope. Still no way to do it. The suggested solution is to develop your own vector font and use Line2D() - but is it worth the effort? I don't think so. Maybe if you have existing code or library to load some format vector font, then you can automate the process of drawing (?).

    An interesting solution might be to do a font as thin 3D objects (using the Text object, for instance). Export each character as wavefront and load into your plugin for use with BaseDraw::PolygonObject(). They would need their Mg() oriented towards the active camera though (like billboarding).



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

    On 21/11/2006 at 01:59, xxxxxxxx wrote:

    I want to use a very small and simple font, monospacing, maybe 6x6 pixels. So I think 3D polygon characters might not be readable. I think about using bitmap definitions and plotting the charcters using Point2D(). Or do you think it's too slow?



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

    On 21/11/2006 at 10:35, xxxxxxxx wrote:

    It is possible that you can get this going but no idea on how fast or slow the plotting would be. My suggestion would be to take a single character map and start with just plotting one character as a test. If that doesn't seem to impact the redraw, try something like ten characters and so on.

    If it works, you could probably sell the darned thing as a supplimental lib for SDK developers who need the same functionality. There are a few, including yours truly. :)



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

    On 22/11/2006 at 14:53, xxxxxxxx wrote:

    It works very well! I can't detect any slowdown. I limit the supported characters to capital letters and digits. Since the storing is very memory friendly (8 bytes per character), one may add the whole ASCII set as well.

      
    // Bitmaps for 0...9ABC...Z  
    UCHAR hudFont[] = {0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70...}  
      
    // Draw a single character   
      
    void Draw_Char(CHAR c, Vector pos, BaseDraw* bd)  
    {  
         LONG offset, i, j;  
         UCHAR     b;  
         Vector     p = pos;  
           
         if (c == 32)    // space  
              return;            
      
         if (c == 46)     // dot  
         {  
              p.x += 3;  
              p.y += 7;  
              bd->Point2D(p);  
              return;  
         }  
         if (c <= 57)     // digit  
              offset = (c - 48) << 3;  
         else  
              offset = (c - 65 + 10) << 3;     // capital letters  
         }  
      
         UCHAR     *pp = &hudFont;[offset];  
      
         for (i=0; i<8; i++)  
         {  
              b = *pp++;  
              for (j=0; j<5; j++)  
              {  
                   if (b & 0x80)  
                        bd->Point2D(p);  
                   b <<= 1;  
                   p.x += 1;  
              }  
              p.y += 1;  
              p.x = pos.x;  
         }  
    }  
      
    // Draw a text line. The string must contain digits, capital letters, points and spaces only  
      
    void Draw_Text(String text, Vector pos, BaseDraw* bd)  
    {  
         LONG len = text.GetLength();  
         LONG j;  
      
         for (j=0; j<len; j++)  
         {  
              Draw_Char(text[j], pos, bd);  
              pos.x += 6;  
         }  
    }  
      
    


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

    On 22/11/2006 at 15:13, xxxxxxxx wrote:

    Well done! :) I'll have to play with this in a day or two (official release update imminent).

    Thank you very much for sharing the code!


Log in to reply