#!/usr/bin/env python # vim: set fileencoding=utf-8 : from gimpfu import * def path_toggle_visibility(image, drawable, visibility, limitFloat): try: image.undo_group_start() if visibility: msg = 'Making %d path visible' else: msg = 'Making %d path not visible' limit=int(limitFloat) total=len(image.vectors) start=0 end=total index=0 if limit > 0: if image.active_vectors != None: start = image.vectors.index(image.active_vectors) end = start + limit if end > total: end = total total = end - start #gimp.message('start=%s, end=%s, total=%s' % (start, end, total)) gimp.progress_init(msg % total) for vector in image.vectors[start:end]: vector.visible = visibility gimp.progress_update( 1.0* index / total) index = index + 1 finally: image.undo_group_end() register( "python_fu_path_toggle_visibility", # 01: plugin name "Toggle path visibility", # 02: blurb (short description) "Make all/some path visible or not", # 03: help (long description) "Gaël LHEZ", # 04: author "Gaël LHEZ", # 05: copyright info "2021", # 06: date "Toggle path visibility", # 07: menu position and label "*", # 08: image types accepted [ (PF_IMAGE , "image" , "Input image", None), (PF_DRAWABLE , "drawable" , "Input layer", None), (PF_BOOL , "visibility", "Make visible", True), (PF_ADJUSTMENT, "limit" , "Path to make visible (0 = all)", 0, (0, 65536, 10)) ], [], # 10: output (results) path_toggle_visibility, # 11: method to call menu="/Tools/Paths" # 12: (optional) ) # # # # #(script-fu-register # "script-fu-path-ergonomics-visibility" ;func name # "Toggle path visibility" ;menu label # "Try to make the better out paths!" ;description # "Gaël LHEZ" ;author # "©2021 Yamete Kudasaï" ;copyright notice # "Jeudi 12 Août 2021" ;date created # "" ;image type that the script works on # SF-IMAGE "Image" 0 # SF-DRAWABLE "Drawable" 0 # SF-TOGGLE "Make visible" TRUE # SF-ADJUSTMENT "Path to make visible (0 = all)" '(0 0 65536 1 10 0 0) ;a spin-button #) #(script-fu-menu-register "script-fu-path-ergonomics-visibility" "/Tools/Paths") # #(define (script-fu-path-ergonomics-visibility inImage inDrawable inVisibility inLimit) # #) main()