From dade60863e5faf098ea66bc2d849216afa69a432 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 10 Sep 2012 13:19:38 +0900 Subject: [PATCH] Move the entity class comment into its own box. Blender doesn't support multiline text or word wrapping, so the tooltips were rather ugly. The double spacing used by layout.label() is still a little ugly, but the resulting text box just below the entity classname is much more usable. --- tools/io_qfmap/entity.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/io_qfmap/entity.py b/tools/io_qfmap/entity.py index 3e104fe21..aa916c411 100644 --- a/tools/io_qfmap/entity.py +++ b/tools/io_qfmap/entity.py @@ -94,8 +94,8 @@ def qfentity_items(self, context): entclasses = qfmap.entity_classes.entity_classes eclist = list(entclasses.keys()) eclist.sort() - enum = (('', '--', 'No class. Will be exported as part of the world entity.'),) - enum += tuple(map(lambda ec: (ec, ec, entclasses[ec].comment), eclist)) + enum = (('', "--", ""),) + enum += tuple(map(lambda ec: (ec, ec, ""), eclist)) return enum class QFEntityProp(bpy.types.PropertyGroup): @@ -151,6 +151,20 @@ class EntityPanel(bpy.types.Panel): flags += ("!easy", "!medium", "!hard", "!dm") row = layout.row() row.prop(qfentity, "classname") + box=layout.box() + for l in ec.comment.split("\n"): + if not l: + continue + words = l.split(" ") + line = "" + while words: + if len(line) + len(words[0]) > 40: + box.label(line) + line = "" + line += (line and " " or "") + words[0] + del words[0] + if line: + box.label(line) row = layout.row() for c in range(3): col = row.column()