diff --git a/studio/studio_nodes.py b/studio/studio_nodes.py index d9fb0e7..6c34c26 100644 --- a/studio/studio_nodes.py +++ b/studio/studio_nodes.py @@ -325,7 +325,7 @@ def end_node(outlayer, win, x, y, width, height): node_dot(outlayer, win, x-2, y+height-12) -def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0): +def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0, shots=[]): # This function will draw scene nodes. @@ -342,7 +342,7 @@ def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0) # Making the layer surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height)) layer = cairo.Context(surface) - + layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) selected = False @@ -572,24 +572,67 @@ def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0) layer.set_font_size(15) layer.move_to(15,15) layer.show_text(name) + + + text_height = 10 # Fraction - UI_color.set(layer, win, "progress_background") - UI_elements.roundrect(layer, win, - 10, - height-20, - width-20, - 0, - 5) - - UI_color.set(layer, win, "progress_active") - UI_elements.roundrect(layer, win, - 10, - height-20, - (width-20)*fraction, - 0, - 5) + if fraction: + + text_height = 40 + + + UI_color.set(layer, win, "progress_background") + UI_elements.roundrect(layer, win, + 10, + height-20, + width-20, + 0, + 5) + + UI_color.set(layer, win, "progress_active") + UI_elements.roundrect(layer, win, + 10, + height-20, + (width-20)*fraction, + 0, + 5) + # A bit of the scene itself if the size allows. + + if width > 100 and height > text_height: + + # Very simple text from the scene, nothing fancy + alltext = "" + for i in shots: + for b in i[-1]: + if b[0] == "frase": + alltext = alltext + b[1][-1]+": " + alltext = alltext + b[-1] + alltext = alltext.replace("\n", " \n ") + + # Rendering it. + fx = 15 + fy = 50 + for word in alltext.split(" "): + if word == "\n" or len(word)*9 + fx > width: + fy = fy + 20 + fx = 15 + + if fy > height - text_height: + break + + if word != "\n": + UI_color.set(layer, win, "text_normal") + layer.set_font_size(15) + layer.move_to(fx,fy) + layer.show_text(word) + + fx = fx + len(word)*9 + 10 + + + + # Outputting the layer outlayer.set_source_surface(surface, x, y) diff --git a/studio/studio_storyLayer.py b/studio/studio_storyLayer.py index 998826d..7742f3c 100644 --- a/studio/studio_storyLayer.py +++ b/studio/studio_storyLayer.py @@ -944,7 +944,7 @@ def layer(win): #Draw - studio_nodes.scene_node(layer, win, sx, sy, ssx, ssy, name=scene, fraction=sf) + studio_nodes.scene_node(layer, win, sx, sy, ssx, ssy, name=scene, fraction=sf, shots=win.story["scenes"][scene]["shots"]) except: pass