This patch creates an interface for ["Text"] properties in Font objects.
[blender.git] / release / scripts / startup / bl_ui / space_logic.py
index 1fc58475ace5773f42e2738c0333abcd94a7acc0..79a3f72ff4866a5ddcf5b61b50da511cbb975dcd 100644 (file)
 import bpy
 from bpy.types import Header, Menu, Panel
 
+def get_id_by_name(properties, name):
+    """returns ID"""
+    for i, prop in enumerate(properties):
+            if prop.name == name:
+                return i
+    return -1
 
 class LOGIC_PT_properties(Panel):
     bl_space_type = 'LOGIC_EDITOR'
@@ -37,10 +43,29 @@ class LOGIC_PT_properties(Panel):
         ob = context.active_object
         game = ob.game
 
+        if ob.type == 'FONT':
+            prop = game.properties.get("Text")
+            if prop:
+                layout.operator("object.game_property_remove", text="Text Game Property", icon='X').index = get_id_by_name(game.properties, "Text")
+                row = layout.row()
+                sub=row.row()
+                sub.enabled=0
+                sub.prop(prop, "name", text="")
+                row.prop(prop, "type", text="")
+                # get the property from the body, not the game property
+                row.prop(ob.data, "body", text="")
+            else:
+                props=layout.operator("object.game_property_new", text="Text Game Property", icon='ZOOMIN')
+                props.name='Text'
+                props.type='STRING'
+
         layout.operator("object.game_property_new", text="Add Game Property", icon='ZOOMIN')
 
         for i, prop in enumerate(game.properties):
 
+            if ob.type == 'FONT' and prop.name == "Text":
+                continue
+
             box = layout.box()
             row = box.row()
             row.prop(prop, "name", text="")