@@ -232,6 +232,18 @@ func generate_screenshots(graph_edit : GraphEdit, parent_item : TreeItem = null)
232232 var image = get_viewport ().get_texture ().get_image ()
233233 var csf = mm_globals .main_window .get_window ().content_scale_factor
234234 image = image .get_region (Rect2 (csf * (new_nodes [0 ].global_position - Vector2 (6 , 6 )),csf * (new_nodes [0 ].size + Vector2 (14 , 12 ))))
235+ # Make background transparent
236+ image .convert (Image .FORMAT_RGBA8 )
237+ var border_color : Color = image .get_pixel (0 , 0 )
238+ for y : int in image .get_height ():
239+ for x : int in image .get_width ():
240+ if image .get_pixel (x , y ) != border_color :
241+ break
242+ image .set_pixel (x , y , Color (0 , 0 , 0 , 0 ))
243+ for x : int in range (image .get_width ()- 1 , 0 , - 1 ):
244+ if image .get_pixel (x , y ) != border_color :
245+ break
246+ image .set_pixel (x , y , Color (0 , 0 , 0 , 0 ))
235247 print (get_icon_name (get_item_path (item )))
236248 image .resize (image .get_size ().x / csf , image .get_size ().y / csf , Image .INTERPOLATE_LANCZOS )
237249 image .save_png ("res://material_maker/doc/images/node_" + get_icon_name (get_item_path (item ))+ ".png" )
0 commit comments