7
$\begingroup$

I want to make all of the files in the windows/font/ folder open all at once in blender instead of needing to add each one in the folder individually. I need all of the fonts to be pre loaded or open so they display in this menu here:
font setting for text object

$\endgroup$
4
$\begingroup$

Use python.

from bpy import ops
from glob import glob
from os import chdir, path

directory = "C:\\Windows\\Fonts"

chdir(directory)
for file in glob("*.ttf") + glob("*.otf"):
    ops.font.open(filepath = path.join(directory, file), relative_path=False)

Replace the directory variable with the folder path, which contains your font files. Escape \ with \.

Paste the script in the text editor and press Run Script.

$\endgroup$
  • $\begingroup$ That worked 100% thank you! Would you also happen to know how to add all fonts in blender to the create font list node automatically? [dl.dropboxusercontent.com/s/bdpjwieekqjsp9k/… $\endgroup$ – Mark Foxworthy Dec 15 '16 at 0:27
  • $\begingroup$ Couple of suggestions can set the font path in user preferences files context.user_preferences.filepaths.font_directory, this can be used for directory. Using os.path.join(directory, file) in font.open(..) will make the script cross platform. $\endgroup$ – batFINGER Dec 15 '16 at 3:08
  • $\begingroup$ @Nicholas Ask a new question. batFINGERThanks for the correction. I updated the post. $\endgroup$ – Leander Dec 15 '16 at 6:52
  • $\begingroup$ IMO font.open should be multi file, (letting you select multiple or all with "a"). Using your code could quickly make an override of operator that uses the selected files list. $\endgroup$ – batFINGER Dec 15 '16 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.