fix for grease pencil conversion to bezier curve reading past the end of the array.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 21 Mar 2011 23:30:56 +0000 (23:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 21 Mar 2011 23:30:56 +0000 (23:30 +0000)
build_files/package_spec/build_archive.py
source/blender/editors/gpencil/gpencil_edit.c

index 79e42af7b692450a4191197327e97458ee20975e..3c41cd5911ec0c1a45c90aa8542676417e5a093f 100755 (executable)
@@ -10,8 +10,8 @@ import sys
 
 # get parameters
 if len(sys.argv) < 5:
-       sys.stderr.write('Excepted arguments: ./build_archive.py name extension install_dir output_dir')
-       sys.exit(1)
+    sys.stderr.write('Excepted arguments: ./build_archive.py name extension install_dir output_dir')
+    sys.exit(1)
 
 package_name = sys.argv[1]
 extension = sys.argv[2]
@@ -23,47 +23,46 @@ package_dir = package_name
 
 # remove existing package with the same name
 try:
-       if os.path.exists(package_archive):
-               os.remove(package_archive)
-       if os.path.exists(package_dir):
-               shutil.rmtree(package_dir)
+    if os.path.exists(package_archive):
+        os.remove(package_archive)
+    if os.path.exists(package_dir):
+        shutil.rmtree(package_dir)
 except:
-       sys.stderr.write('Failed to clean up old package files: ' + sys.exc_info()[0] + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to clean up old package files: ' + sys.exc_info()[0] + '\n')
+    sys.exit(1)
 
 # create temporary package dir
 try:
-       shutil.copytree(install_dir, package_dir)
+    shutil.copytree(install_dir, package_dir)
 
-       for f in os.listdir(package_dir):
-               if f.startswith('makes'):
-                       os.remove(os.path.join(package_dir, f))
+    for f in os.listdir(package_dir):
+        if f.startswith('makes'):
+            os.remove(os.path.join(package_dir, f))
 except:
-       sys.stderr.write('Failed to copy install directory: ' + sys.exc_info()[0] + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to copy install directory: ' + sys.exc_info()[0] + '\n')
+    sys.exit(1)
 
 # create archive
 try:
-       if not os.path.exists(output_dir):
-               os.mkdir(output_dir)
+    if not os.path.exists(output_dir):
+        os.mkdir(output_dir)
 
-       if extension == 'zip':
-               archive_cmd = ['zip', '-9', '-r', package_archive, package_dir]
-       elif extension == 'tar.bz2':
-               archive_cmd = ['tar', 'cjf', package_archive, package_dir]
-       else:
-               sys.stderr.write('Unknown archive extension: ' + extension)
-               sys.exit(-1)
+    if extension == 'zip':
+        archive_cmd = ['zip', '-9', '-r', package_archive, package_dir]
+    elif extension == 'tar.bz2':
+        archive_cmd = ['tar', 'cjf', package_archive, package_dir]
+    else:
+        sys.stderr.write('Unknown archive extension: ' + extension)
+        sys.exit(-1)
 
-       subprocess.call(archive_cmd)
+    subprocess.call(archive_cmd)
 except:
-       sys.stderr.write('Failed to create package archive: ' + sys.exc_info()[0] + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to create package archive: ' + sys.exc_info()[0] + '\n')
+    sys.exit(1)
 
 # empty temporary package dir
 try:
-       shutil.rmtree(package_dir)
+    shutil.rmtree(package_dir)
 except:
-       sys.stderr.write('Failed to clean up package directory: ' + sys.exc_info()[0] + '\n')
-       sys.exit(1)
-
+    sys.stderr.write('Failed to clean up package directory: ' + sys.exc_info()[0] + '\n')
+    sys.exit(1)
index f1be2ae9a64eecc50c7fc5dd3dd3497d4deb2faa..e9154b59ebf4f09546d71b557de65c4fb7c89345 100644 (file)
@@ -488,7 +488,7 @@ static void gp_stroke_to_bezier (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, C
                copy_v3_v3(p3d_prev, p3d_cur);
                copy_v3_v3(p3d_cur, p3d_next);
 
-               if (i < tot) {
+               if (i + 1 < tot) {
                        gp_strokepoint_convertcoords(C, gps, pt+1, p3d_next);
                }
        }