text on line
This commit is contained in:
parent
d06bf038b0
commit
7534699fb5
3 changed files with 172 additions and 15 deletions
50
butils.py
50
butils.py
|
@ -23,10 +23,46 @@ def move_in_fontcollection(obj, fontcollection, scene):
|
|||
scene.collection.objects.unlink(obj)
|
||||
if fontcollection.objects.find(obj.name) < 0:
|
||||
fontcollection.objects.link(obj)
|
||||
if fontcollection.objects.find("glyphs") < 0:
|
||||
empty = bpy.data.objects.new("glyphs", None)
|
||||
empty.empty_display_type = 'PLAIN_AXES'
|
||||
fontcollection.objects.link(empty)
|
||||
glyphs = fontcollection.objects.get("glyphs")
|
||||
if obj.parent != glyphs:
|
||||
obj.parent = glyphs
|
||||
# TODO: move in glyphs
|
||||
# if fontcollection.objects.find("glyphs") < 0:
|
||||
# empty = bpy.data.objects.new("glyphs", None)
|
||||
# empty.empty_display_type = 'PLAIN_AXES'
|
||||
# fontcollection.objects.link(empty)
|
||||
# glyphs = fontcollection.objects.get("glyphs")
|
||||
# if obj.parent != glyphs:
|
||||
# obj.parent = glyphs
|
||||
|
||||
def ShowMessageBox(title = "Message Box", icon = 'INFO', message=""):
|
||||
|
||||
"""Show a simple message box
|
||||
|
||||
taken from `Link here <https://blender.stackexchange.com/questions/169844/multi-line-text-box-with-popup-menu>`_
|
||||
|
||||
:param title: The title shown in the message top bar
|
||||
:type title: str
|
||||
:param icon: The icon to be shown in the message top bar
|
||||
:type icon: str
|
||||
:param message: lines of text to display, a.k.a. the message
|
||||
:type message: str or (str, str, ..)
|
||||
|
||||
TIP: Check `Link blender icons <https://docs.blender.org/api/current/bpy_types_enum_items/icon_items.html>`_ for icons you can use
|
||||
TIP: Or even better, check `Link this addons <https://docs.blender.org/manual/en/latest/addons/development/icon_viewer.html>`_ to also see the icons.
|
||||
|
||||
usage:
|
||||
.. code-block:: python
|
||||
myLines=("line 1","line 2","line 3")
|
||||
butils.ShowMessageBox(message=myLines)
|
||||
|
||||
or:
|
||||
.. code-block:: python
|
||||
butils.ShowMessageBox(title="",message=("AAAAAH","NOOOOO"),icon=)
|
||||
|
||||
"""
|
||||
myLines=message
|
||||
def draw(self, context):
|
||||
if isinstance(myLines, str):
|
||||
self.layout.label(text=myLines)
|
||||
elif hasattr(myLines, "__iter__"):
|
||||
for n in myLines:
|
||||
self.layout.label(text=n)
|
||||
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue