[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33518] branches/soc-2008-mxcurioni/source /blender/freestyle/intern: * Fix for a freeze issue in stroke rendering when using round/square caps.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Mon Dec 6 23:17:19 CET 2010


Revision: 33518
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33518
Author:   kjym3
Date:     2010-12-06 23:17:19 +0100 (Mon, 06 Dec 2010)

Log Message:
-----------
* Fix for a freeze issue in stroke rendering when using round/square caps.
The problem was caused by a stroke with only one vertex.  Such a stroke was
generated when for some unknown reason a chained curve consisted of only
two vertices such that their 3D positions were exactly or almost the same.

* Fix for the Parameter Editor mode that failed when scene render layers
and/or linesets contain a single quote in their names.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2010-12-06 21:18:08 UTC (rev 33517)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2010-12-06 22:17:19 UTC (rev 33518)
@@ -131,14 +131,31 @@
 		//print_m4("proj", freestyle_proj);
 	}
 
+	static char *escape_quotes(char *name)
+	{
+		char *s= (char *)MEM_mallocN(strlen(name) * 2 + 1, "escape_quotes");
+		char *p= s;
+		while (*name) {
+			if (*name == '\'')
+				*p++= '\\';
+			*p++ = *name++;
+		}
+		*p = '\0';
+		return s;
+	}
+
 	static Text *create_lineset_handler(char *layer_name, char *lineset_name)
 	{
-		Text *text = add_empty_text(lineset_name);
+		char *s1= escape_quotes(layer_name);
+		char *s2= escape_quotes(lineset_name);
+		Text *text= add_empty_text(lineset_name);
 		write_text(text, "import parameter_editor; parameter_editor.process('");
-		write_text(text, layer_name);
+		write_text(text, s1);
 		write_text(text, "', '");
-		write_text(text, lineset_name);
+		write_text(text, s2);
 		write_text(text, "')\n");
+		MEM_freeN(s1);
+		MEM_freeN(s2);
 		return text;
 	}
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp	2010-12-06 21:18:08 UTC (rev 33517)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp	2010-12-06 22:17:19 UTC (rev 33518)
@@ -979,6 +979,11 @@
       stroke->push_back(stroke_vertex);
     }
   }
+  // Discard the stroke if the number of stroke vertices is less than two
+  if (stroke->strokeVerticesSize() < 2) {
+    delete stroke;
+    return NULL;
+  }
   stroke->setLength(currentCurvilignAbscissa);
   return stroke;
 }





More information about the Bf-blender-cvs mailing list