Read scenes right in the node editor.

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-02-08 18:30:28 +00:00
parent 618c72e22e
commit cfd9286c7a
2 changed files with 61 additions and 18 deletions

View file

@ -325,7 +325,7 @@ def end_node(outlayer, win, x, y, width, height):
node_dot(outlayer, win, x-2, y+height-12) 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. # 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 # Making the layer
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height)) surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
layer = cairo.Context(surface) layer = cairo.Context(surface)
layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
selected = False selected = False
@ -573,22 +573,65 @@ def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0)
layer.move_to(15,15) layer.move_to(15,15)
layer.show_text(name) layer.show_text(name)
# 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") text_height = 10
UI_elements.roundrect(layer, win,
10, # Fraction
height-20, if fraction:
(width-20)*fraction,
0, text_height = 40
5)
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 # Outputting the layer

View file

@ -944,7 +944,7 @@ def layer(win):
#Draw #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: except:
pass pass