File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,23 @@ class SpriteSheetProperties(bpy.types.PropertyGroup):
8181 description = "Automatically create an animated GIF when rendering is complete" ,
8282 default = True )
8383
84+
85+ def find_bin_path_windows ():
86+ import winreg
87+
88+ REG_PATH = "SOFTWARE\ImageMagick\Current"
89+
90+ try :
91+ registry_key = winreg .OpenKey (winreg .HKEY_LOCAL_MACHINE , REG_PATH , 0 ,
92+ winreg .KEY_READ )
93+ value , regtype = winreg .QueryValueEx (registry_key , "BinPath" )
94+ winreg .CloseKey (registry_key )
95+
96+ except WindowsError :
97+ return None
98+
99+ return value
100+
84101
85102@persistent
86103def spritify (scene ):
@@ -118,8 +135,16 @@ def gifify(scene):
118135 if os .path .exists (bpy .path .abspath (scene .spritesheet .filepath [:- 3 ] + "gif" )):
119136 os .remove (bpy .path .abspath (scene .spritesheet .filepath [:- 3 ] + "gif" ))
120137
138+ # If windows, try and find binary
139+ convert_path = "convert"
140+ if os .name == "nt" :
141+ bin_path = find_bin_path_windows ()
142+
143+ if bin_path :
144+ convert_path = os .path .join (bin_path , "convert" )
145+
121146 subprocess .call ([
122- "convert" ,
147+ convert_path ,
123148 "-delay" , "1x" + str (scene .render .fps ),
124149 "-dispose" , "background" ,
125150 "-loop" , "0" ,
You can’t perform that action at this time.
0 commit comments