report an error when user blender versions other then 2.4x for animation playback.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 28 Jul 2011 05:09:31 +0000 (05:09 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 28 Jul 2011 05:09:31 +0000 (05:09 +0000)
release/scripts/startup/bl_operators/screen_play_rendered_anim.py

index 4b3435eacbe410af02d0c49d86122ee591f7f19b..a38d817d738f281d9a99e4fe768afc79442f428c 100644 (file)
@@ -110,6 +110,31 @@ class PlayRenderedAnim(bpy.types.Operator):
         cmd = [player_path]
         # extra options, fps controls etc.
         if preset == 'BLENDER24':
+            # -----------------------------------------------------------------
+            # Check blender is not 2.5x until it supports playback again
+            try:
+                process = subprocess.Popen([player_path, '--version'],
+                                           stdout=subprocess.PIPE,
+                                           )
+            except:
+                # ignore and allow the main execution to catch the problem.
+                process = None
+
+            if process is not None:
+                process.wait()
+                out = process.stdout.read()
+                process.stdout.close()
+                out_split = out.strip().split()
+                if out_split[0] == b'Blender':
+                    if not out_split[1].startswith(b'2.4'):
+                        self.report({'ERROR'},
+                                    "Blender %s doesn't support playback: %r" %
+                                    (out_split[1].decode(), player_path))
+                        return {'CANCELLED'}
+                del out, out_split
+            del process
+            # -----------------------------------------------------------------
+
             opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), file]
             cmd.extend(opts)
         elif preset == 'DJV':
@@ -146,5 +171,6 @@ class PlayRenderedAnim(bpy.types.Operator):
             self.report({'ERROR'},
                         "Couldn't run external animation player with command "
                         "%r\n%s" % (" ".join(cmd), str(e)))
+            return {'CANCELLED'}
 
         return {'FINISHED'}