GUI Font Size



  • On 13/05/2014 at 05:08, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   15 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hello,

    GetWorldContainerInstance()->GetBaseContainer( WPREF_FONT_STANDARD ) returns empty BaseContainer.  How should I be retrieving the application GUI font size?

    Ama



  • On 14/05/2014 at 10:45, xxxxxxxx wrote:

    The various sections of the preferences are plugins that start with the ID# 465001620.
    So you have to first get the plugin that holds the preferences you want to get.

    Example:

    #include "..\..\..\..\resource\res\description\prefsinterface.h"  
      
      
      BasePlugin *interface_plg = FindPlugin(465001620, PLUGINTYPE_PREFS); //Finds a specific plugin by ID#  
      //GePrint(interface_plg->GetName()+" "+LongToString(interface_plg->GetID()));      
      
      GeData d;  
      interface_plg->GetParameter(DescID(PREF_INTERFACE_FONTSTD), d, DESCFLAGS_GET_0);  
      FontData *fd = (FontData* )d.GetCustomDataType(FONTCHOOSER_DATA);  
      BaseContainer bcfont = fd->GetFont();  
      String name = bcfont.GetString(500);  
      LONG size = bcfont.GetLong(501);  
      GePrint(name);   
      GePrint(LongToString(size));
    

    If your next question is how to change it. I haven't figured that out yet.
    Perhaps someone else will be kind enough to post that one.

    -ScottA



  • On 15/05/2014 at 07:23, xxxxxxxx wrote:

    Thanks for the reply,

    In your code you reference a specific plugin id of 465001620.  Is this an internal C4D ID or one of your plugin IDs?  When I test this plugin is not found.

    thanks,
    Ama

    BasePlugin \*interface_plg = FindPlugin(465001620, PLUGINTYPE_PREFS); //Finds a specific plugin by ID#
    


  • On 15/05/2014 at 08:14, xxxxxxxx wrote:

    It's a built-in ID#.
    I'm using R13 on a PC. But It would be a bit strange if Maxon changed this for later versions or for Macs.

    You can try using this code to find all of your preference plugins ID#s:

        //Create an AtomArray to hold the plugins we find  
      //We will iterate through it to find the preferences plugins later on  
      AutoAlloc<AtomArray> plugs;                                            
      
      if(FilterPluginList(plugs, PLUGINTYPE_PREFS, TRUE))            //Return only the preferences type plugins  
      {  
          for(LONG i=0; i<plugs->GetCount(); i++)  
          {  
              BasePlugin *plugins = (BasePlugin* )plugs->GetIndex(i); //Cast each plugin to an integer type  
              GePrint(LongToString(plugins->GetID()));               //Print the ID# for each plugin found   
          }  
      }
    

    -ScottA



  • On 16/05/2014 at 04:39, xxxxxxxx wrote:

    That did not return anything.  I think this might have something to do with using the C4D demo version.
    thanks for the help.

    Ama



  • On 16/05/2014 at 09:15, xxxxxxxx wrote:

    The demos are pretty much the same as the paid versions when it comes to this coding stuff.
    If you're using R15. Then you'll have to change things in my code because Maxon made big changes to the SDK in R15.
    Things like LONG now are written as: Int32.

    Python has not changed like this though.
    Here's how to get the same font data from a Python script.
    If this works for you in Python. Then you can also use C++ with the correct syntax.

    #This script gets the Font settings from the preferences  
      
    import c4d  
    from c4d import plugins  
    def main() :  
        
      interface = plugins.FindPlugin(465001620, c4d.PLUGINTYPE_PREFS) #465001620 is the interface's ID#  
        
      fd = interface[c4d.PREF_INTERFACE_FONTSTD]  
      bc = fd.GetFont()  
      for i in bc: print i  
      
      c4d.EventAdd()     
      
    if __name__=='__main__':  
      main()
    

    -ScottA



  • On 16/05/2014 at 09:34, xxxxxxxx wrote:

    You can use the new names in Python if you want to. But that will make it not run on pre R15 versions.



  • On 17/05/2014 at 10:43, xxxxxxxx wrote:

    I think the previous method works.  I am using the demo currently and I think that is the problem.


Log in to reply