@@ -56,7 +56,8 @@ func visual_select():
5656
5757
5858func visual_deselect ():
59- selected_style .hide ()
59+ if selected_style :
60+ selected_style .hide ()
6061
6162
6263# called by the timeline before adding it to the tree
@@ -309,8 +310,6 @@ func _draw():
309310 var pos_x = (27 * _scale )
310311 var pos_y = 46 * _scale
311312
312-
313-
314313 # Adjusting the pos_x. Not sure why it is not consistent between render scales
315314 if _scale == 1.5 :
316315 pos_x -= 3
@@ -319,21 +318,42 @@ func _draw():
319318 if _scale == 2 :
320319 pos_x -= 6
321320
322- # If the event is the last one, don't draw a line aftwards
321+ # If the event is the last one, don't draw anything aftwards
323322 if timeline_children [timeline_lenght - 1 ] == self :
324323 return
324+
325+ # Drawing long lines on questions and conditions
326+ if event_name == 'Question' or event_name == 'Condition' :
327+ var keep_going = true
328+ var end_reference
329+ for e in timeline_children :
330+ if keep_going :
331+ if e .get_index () > get_index ():
332+ if e .current_indent_level == current_indent_level :
333+ if e .event_name == 'End Branch' :
334+ end_reference = e
335+ keep_going = false
336+ if e .event_name == 'Question' or event_name == 'Condition' :
337+ keep_going = false
338+ if keep_going == false :
339+ if end_reference :
340+ # This line_size thing should be fixed, not sure why it is different when
341+ # the indent level is 0 and when it is bigger.
342+ var line_size = 0
343+ if current_indent_level > 0 :
344+ line_size = (indent_size * current_indent_level ) + (4 * _scale )
345+ # end the line_size thingy
346+
347+ # Drawing the line from the Question/Condition node to the End Branch one.
348+ draw_rect (Rect2 (
349+ Vector2 (pos_x + line_size , pos_y ),
350+ Vector2 (line_width , (end_reference .rect_global_position .y - rect_global_position .y ) - (43 * _scale ))
351+ ),
352+ line_color , true )
325353
326- # Figuring out the next event
354+ # Drawing other lines and archs
327355 var next_event = timeline_children [get_index () + 1 ]
328-
329356 if current_indent_level > 0 :
330- # Root (level 0) Vertical Line
331- draw_rect (Rect2 (Vector2 (pos_x , pos_y - (45 * _scale )),
332- Vector2 (line_width , rect_size .y + (5 * _scale ))),
333- line_color , true )
334-
335- # Todo: previous lines when needed
336-
337357 # Line at current indent
338358 var line_size = (indent_size * current_indent_level ) + (4 * _scale )
339359 if next_event .event_name != 'End Branch' and event_name != 'Choice' :
@@ -342,14 +362,17 @@ func _draw():
342362 pass
343363 else :
344364 draw_rect (Rect2 (
345- Vector2 (pos_x + line_size , pos_y ),
346- Vector2 (line_width , rect_size .y - (40 * _scale ))),
347- line_color , true )
365+ Vector2 (pos_x + line_size , pos_y ),
366+ Vector2 (line_width , rect_size .y - (40 * _scale ))
367+ ),
368+ line_color ,
369+ true )
348370 else :
349371 # Root (level 0) Vertical Line
350372 draw_rect (Rect2 (Vector2 (pos_x , pos_y ),
351373 Vector2 (line_width , rect_size .y - (40 * _scale ))),
352- line_color , true )
374+ line_color ,
375+ true )
353376
354377 # Drawing arc
355378 if event_name == 'Choice' :
0 commit comments