[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12763] branches/soc-2007-joeedh: Forgot to add new files from merge, thanks to

Joseph Eagar joeedh at gmail.com
Sun Dec 2 22:56:30 CET 2007


Revision: 12763
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12763
Author:   joeedh
Date:     2007-12-02 22:56:30 +0100 (Sun, 02 Dec 2007)

Log Message:
-----------
Forgot to add new files from merge, thanks to
brecht for compiling a list of 'em.  I wonder
if svn merge has an option for this? I didn't
see any in svn --help merge or the tortoisesvn
frontend.

Added Paths:
-----------
    branches/soc-2007-joeedh/release/scripts/weightpaint_average.py
    branches/soc-2007-joeedh/source/blender/imbuf/IMB_thumbs.h
    branches/soc-2007-joeedh/source/blender/imbuf/intern/IMB_imginfo.h
    branches/soc-2007-joeedh/source/blender/imbuf/intern/imginfo.c
    branches/soc-2007-joeedh/source/blender/imbuf/intern/md5.c
    branches/soc-2007-joeedh/source/blender/imbuf/intern/md5.h
    branches/soc-2007-joeedh/source/blender/imbuf/intern/thumbs.c
    branches/soc-2007-joeedh/source/blender/include/BIF_filelist.h
    branches/soc-2007-joeedh/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
    branches/soc-2007-joeedh/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
    branches/soc-2007-joeedh/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
    branches/soc-2007-joeedh/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
    branches/soc-2007-joeedh/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
    branches/soc-2007-joeedh/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
    branches/soc-2007-joeedh/source/blender/render/intern/include/qmc.h
    branches/soc-2007-joeedh/source/blender/src/filelist.c
    branches/soc-2007-joeedh/source/blender/src/fsmenu.c
    branches/soc-2007-joeedh/source/blender/src/prvicons.c

Added: branches/soc-2007-joeedh/release/scripts/weightpaint_average.py
===================================================================
--- branches/soc-2007-joeedh/release/scripts/weightpaint_average.py	                        (rev 0)
+++ branches/soc-2007-joeedh/release/scripts/weightpaint_average.py	2007-12-02 21:56:30 UTC (rev 12763)
@@ -0,0 +1,122 @@
+#!BPY
+"""
+Name: 'Vertex Groups Island Average'
+Blender: 243
+Group: 'WeightPaint'
+Tooltip: 'Average the vertex weights for each connected set of verts'
+"""
+
+# -------------------------------------------------------------------------- 
+# ***** BEGIN GPL LICENSE BLOCK ***** 
+# 
+# This program is free software; you can redistribute it and/or 
+# modify it under the terms of the GNU General Public License 
+# as published by the Free Software Foundation; either version 2 
+# of the License, or (at your option) any later version. 
+# 
+# This program is distributed in the hope that it will be useful, 
+# but WITHOUT ANY WARRANTY; without even the implied warranty of 
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+# GNU General Public License for more details. 
+# 
+# You should have received a copy of the GNU General Public License 
+# along with this program; if not, write to the Free Software Foundation, 
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
+# 
+# ***** END GPL LICENCE BLOCK ***** 
+# --------------------------------------------------------------------------
+import Blender
+from Blender import Scene, Mesh, Window, sys, Draw
+from BPyMesh import meshWeight2List, list2MeshWeight, mesh2linkedFaces
+
+import BPyMessages
+import bpy
+
+def faceGroups2VertSets(face_groups):
+	'''	Return the face groups as sets of vert indicies	'''
+	return [set([v.index for f in fg for v in f]) for fg in face_groups]
+
+
+def vgroup_average(ob_orig, me, sce, PREF_ALL_VGROUPS=True):
+	if not me.getVertGroupNames():
+		return
+	
+	weight_names, weight_list = meshWeight2List(me)
+	
+	weight_names_len = len(weight_names)
+	vgroup_dummy = [0.0] * weight_names_len
+	vgroup_range = range(weight_names_len)
+	
+	if not PREF_ALL_VGROUPS:
+		weight_active_index = weight_names.index(me.activeGroup)
+	
+	for vert_set in faceGroups2VertSets( mesh2linkedFaces(me) ):
+		if not vert_set:
+			continue
+		
+		
+		if PREF_ALL_VGROUPS:
+			# We need to average the vgroups
+			collected_group = vgroup_dummy[:]
+			for i in vert_set:
+				vert_group = weight_list[i]			# get the original weight
+				weight_list[i] = collected_group	# replace with the collected group
+				
+				for j in vgroup_range: # iter through the vgroups
+					collected_group[j] += vert_group[j]
+			
+			for j in vgroup_range:
+				collected_group[j] /= len(vert_set)
+		else:
+			# Active group only
+			vert_weight = 0.0
+			for i in vert_set:
+				vert_weight += weight_list[i][weight_active_index]
+			
+			vert_weight /= len(vert_set)
+			
+			for i in vert_set:
+				weight_list[i][weight_active_index] = vert_weight
+	
+	list2MeshWeight(me, weight_names, weight_list)
+
+def main():
+	
+	# Gets the current scene, there can be many scenes in 1 blend file.
+	sce = bpy.data.scenes.active
+	
+	# Get the active object, there can only ever be 1
+	# and the active object is always the editmode object.
+	ob_act = sce.objects.active
+	
+	if not ob_act or ob_act.type != 'Mesh':
+		BPyMessages.Error_NoMeshActive()
+		return 
+	
+	# Saves the editmode state and go's out of 
+	# editmode if its enabled, we cant make
+	# changes to the mesh data while in editmode.
+	is_editmode = Window.EditMode()
+	Window.EditMode(0)
+	
+	PREF_ALL_VGROUPS = Draw.PupMenu("All Groups?%t|All Groups%x1|Active Group Only%x0")
+	if PREF_ALL_VGROUPS==-1:
+		return
+	
+	print "sd", PREF_ALL_VGROUPS
+	Window.WaitCursor(1)
+	me = ob_act.getData(mesh=1) # old NMesh api is default
+	t = sys.time()
+	
+	# Run the mesh editing function
+	vgroup_average(ob_act, me, sce, PREF_ALL_VGROUPS)
+	
+	# Timing the script is a good way to be aware on any speed hits when scripting
+	print 'Average VGroups in %.2f seconds' % (sys.time()-t)
+	Window.WaitCursor(0)
+	if is_editmode: Window.EditMode(1)
+	
+	
+# This lets you can import the script without running it
+if __name__ == '__main__':
+	main()
\ No newline at end of file

Added: branches/soc-2007-joeedh/source/blender/imbuf/IMB_thumbs.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/imbuf/IMB_thumbs.h	                        (rev 0)
+++ branches/soc-2007-joeedh/source/blender/imbuf/IMB_thumbs.h	2007-12-02 21:56:30 UTC (rev 12763)
@@ -0,0 +1,74 @@
+/**
+ * $Id: IMB_thumbs.h 11945 2007-09-05 17:55:44Z elubie $ 
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Andrea Weikert.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef _IMB_THUMBS_H
+#define _IMB_THUMBS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ImBuf;
+
+/** Thumbnail creation and retrieval according to the 'Thumbnail Management Standard'
+ * supported by Gimp, Gnome (Nautilus), KDE etc.
+ * Reference: http://jens.triq.net/thumbnail-spec/index.html
+ */
+
+
+typedef enum ThumbSize {
+	THB_NORMAL,
+	THB_LARGE,
+	THB_FAIL
+} ThumbSize;
+
+typedef enum ThumbSource {
+	THB_SOURCE_IMAGE,
+	THB_SOURCE_MOVIE
+} ThumbSource;
+
+// IB_imginfo
+
+/* create thumbnail for file and returns new imbuf for thumbnail */
+ImBuf* IMB_thumb_create(const char* dir, const char* file, ThumbSize size, ThumbSource source);
+
+/* read thumbnail for file and returns new imbuf for thumbnail */
+ImBuf* IMB_thumb_read(const char* dir, const char* file, ThumbSize size);
+
+/* delete all thumbs for the file */
+void IMB_thumb_delete(const char* dir, const char* file, ThumbSize size);
+
+/* return the state of the thumb, needed to determine how to manage the thumb */
+ImBuf* IMB_thumb_manage(const char* dir, const char* file, ThumbSize size, ThumbSource source);
+
+
+
+
+#endif /* _IMB_THUMBS_H */
+

Added: branches/soc-2007-joeedh/source/blender/imbuf/intern/IMB_imginfo.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/imbuf/intern/IMB_imginfo.h	                        (rev 0)
+++ branches/soc-2007-joeedh/source/blender/imbuf/intern/IMB_imginfo.h	2007-12-02 21:56:30 UTC (rev 12763)
@@ -0,0 +1,85 @@
+/**
+ * $Id: IMB_imginfo.h 12306 2007-10-20 16:17:27Z campbellbarton $ 
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Austin Benesh. Ton Roosendaal.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef _IMB_IMGINFO_H
+#define _IMB_IMGINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ImBuf;
+
+typedef struct ImgInfo {
+	struct ImgInfo *next, *prev;
+	char* key;
+	char* value;
+	int len;
+} ImgInfo;
+
+/** The imginfo is a list of key/value pairs (both char*) that can me 
+    saved in the header of several image formats.
+	Apart from some common keys like 
+	'Software' and 'Description' (png standard) we'll use keys within the 
+	Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum'
+	etc... 
+*/
+
+
+/* free blender ImgInfo struct */
+void IMB_imginfo_free(struct ImBuf* img);
+
+/** read the field from the image info into the field 
+ *  @param img - the ImBuf that contains the image data
+ *  @param key - the key of the field
+ *  @param value - the data in the field, first one found with key is returned, 
+                  memory has to be allocated by user.
+ *  @param len - length of value buffer allocated by user.
+ *  @return    - 1 (true) if ImageInfo present and value for the key found, 0 (false) otherwise
+ */
+int IMB_imginfo_get_field(struct ImBuf* img, const char* key, char* value, int len);
+
+/** set user data in the ImgInfo struct, which has to be allocated with IMB_imginfo_create
+ *  before calling this function.
+ *  @param img - the ImBuf that contains the image data
+ *  @param key - the key of the field
+ *  @param value - the data to be written to the field. zero terminated string
+ *  @return    - 1 (true) if ImageInfo present, 0 (false) otherwise
+ */
+int IMB_imginfo_add_field(struct ImBuf* img, const char* key, const char* field);
+
+/** delete the key/field par in the ImgInfo struct.
+ * @param img - the ImBuf that contains the image data
+ * @param key - the key of the field
+ * @return - 1 (true) if delete the key/field, 0 (false) otherwise
+ */
+int IMB_imginfo_del_field(struct ImBuf *img, const char *key);
+
+#endif /* _IMB_IMGINFO_H */
+

Added: branches/soc-2007-joeedh/source/blender/imbuf/intern/imginfo.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/imbuf/intern/imginfo.c	                        (rev 0)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list