I'm working on a part of my plugin easyText. (http://ranincodes.wix.com/easytext)
I want the import Font part to automaticly check if the Font is already imported. How do I get the name of the selected file (=filebuff)? If it is, the font should not be imported
This is the part of the code wich is important for it
#Atribute
atr = bpy.types.Scene
atr.font = StringProperty(name = "Text Font", description = "Font of the Text")
atr.filebuff = StringProperty(name = "", description = "Choose Font to Import", subtype="FILE_PATH")
#window
class windowFont (bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_label = "Import Font"
bl_category = "easyText"
def draw(self, context):
scene = bpy.context.scene
layout = self.layout
layout.label("Choose + Import Font")
col = layout.column(align = True)
layout.prop(scene, "filebuff")
layout.operator("load.font", text="Import", icon="LOAD_FACTORY")
#button
class OBJECT_OT_buttonLoad(bpy.types.Operator):
bl_label = "Load Font"
bl_idname = "load.font"
bl_description = "Import the choosen Font"
def execute(self, context):
scene = bpy.context.scene
fontb = scene.filebuff
bpy.ops.font.open(filepath=fontb, relative_path=False)
return{'FINISHED'}
Thank you!
