[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28950] branches/render25: Render Branch: manual merge from commit 28949, merging -r28890:28948

Campbell Barton ideasman42 at gmail.com
Mon May 24 10:25:40 CEST 2010


Revision: 28950
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28950
Author:   campbellbarton
Date:     2010-05-24 10:25:40 +0200 (Mon, 24 May 2010)

Log Message:
-----------
Render Branch: manual merge from commit 28949, merging -r28890:28948
Brecht: please check tiff.c, still has minor change compare to trunk, not sure this is intentional.

also copied netrender repath module.

Modified Paths:
--------------
    branches/render25/source/blender/imbuf/intern/tiff.c
    branches/render25/source/blender/makesrna/intern/rna_scene.c
    branches/render25/source/blender/render/intern/source/bake.c
    branches/render25/source/blender/render/intern/source/texture_stack.c

Added Paths:
-----------
    branches/render25/release/scripts/io/netrender/repath.py
    branches/render25/release/scripts/modules/add_object_utils.py

Added: branches/render25/release/scripts/io/netrender/repath.py
===================================================================
--- branches/render25/release/scripts/io/netrender/repath.py	                        (rev 0)
+++ branches/render25/release/scripts/io/netrender/repath.py	2010-05-24 08:25:40 UTC (rev 28950)
@@ -0,0 +1,145 @@
+# ##### 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import sys, os
+import subprocess
+
+import bpy
+
+from netrender.utils import *
+import netrender.model
+
+BLENDER_PATH = sys.argv[0]
+
+def reset(job):
+    main_file = job.files[0]
+    
+    job_full_path = main_file.filepath
+
+    if os.path.exists(job_full_path + ".bak"):
+        os.remove(job_full_path) # repathed file
+        os.renames(job_full_path + ".bak", job_full_path)
+
+def update(job):
+    paths = []
+    
+    main_file = job.files[0]
+    
+    job_full_path = main_file.filepath
+
+        
+    path, ext = os.path.splitext(job_full_path)
+    
+    new_path = path + ".remap" + ext 
+    
+    all = main_file.filepath == main_file.original_path 
+    
+    for rfile in job.files[1:]:
+        if all or rfile.original_path != rfile.filepath:
+            paths.append(rfile.original_path)
+            paths.append(rfile.filepath)
+    
+    # Only update if needed
+    if paths:        
+        process = subprocess.Popen([BLENDER_PATH, "-b", "-noaudio", job_full_path, "-P", __file__, "--", new_path] + paths, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        process.wait()
+        
+        os.renames(job_full_path, job_full_path + ".bak")
+        os.renames(new_path, job_full_path)
+
+def process(paths):
+    def processPointCache(point_cache):
+        point_cache.external = False
+
+    def processFluid(fluid):
+        new_path = path_map.get(fluid.path, None)
+        if new_path:
+            fluid.path = new_path
+    
+    path_map = {}
+    for i in range(0, len(paths), 2):
+        # special case for point cache
+        if paths[i].endswith(".bphys"):
+            pass # Don't need them in the map, they all use the default external path
+            # NOTE: This is probably not correct all the time, need to be fixed.
+        # special case for fluids
+        elif paths[i].endswith(".bobj.gz"):
+            path_map[os.path.split(paths[i])[0]] = os.path.split(paths[i+1])[0]
+        else:
+            path_map[paths[i]] = paths[i+1]
+    
+    ###########################
+    # LIBRARIES
+    ###########################
+    for lib in bpy.data.libraries:
+        file_path = bpy.utils.expandpath(lib.filename)
+        new_path = path_map.get(file_path, None)
+        if new_path:
+            lib.filename = new_path
+
+    ###########################
+    # IMAGES
+    ###########################
+    for image in bpy.data.images:
+        if image.source == "FILE" and not image.packed_file:
+            file_path = bpy.utils.expandpath(image.filename)
+            new_path = path_map.get(file_path, None)
+            if new_path:
+                image.filename = new_path
+            
+
+    ###########################
+    # FLUID + POINT CACHE
+    ###########################
+    for object in bpy.data.objects:
+        for modifier in object.modifiers:
+            if modifier.type == 'FLUID_SIMULATION' and modifier.settings.type == "DOMAIN":
+                processFluid(settings)
+            elif modifier.type == "CLOTH":
+                processPointCache(modifier.point_cache)
+            elif modifier.type == "SOFT_BODY":
+                processPointCache(modifier.point_cache)
+            elif modifier.type == "SMOKE" and modifier.smoke_type == "TYPE_DOMAIN":
+                processPointCache(modifier.domain_settings.point_cache_low)
+                if modifier.domain_settings.highres:
+                    processPointCache(modifier.domain_settings.point_cache_high)
+            elif modifier.type == "MULTIRES" and modifier.external:
+                file_path = bpy.utils.expandpath(modifier.filename)
+                new_path = path_map.get(file_path, None)
+                if new_path:
+                    modifier.filename = new_path
+
+        # particles modifier are stupid and don't contain data
+        # we have to go through the object property
+        for psys in object.particle_systems:
+            processPointCache(psys.point_cache)
+                
+
+if __name__ == "__main__":
+    try:
+        i = sys.argv.index("--")
+    except:
+        i = 0
+    
+    if i:
+        new_path = sys.argv[i+1]
+        args = sys.argv[i+2:]
+        
+        process(args)
+        
+        bpy.ops.wm.save_as_mainfile(path=new_path, check_existing=False)


Property changes on: branches/render25/release/scripts/io/netrender/repath.py
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/render25/release/scripts/modules/add_object_utils.py
===================================================================
--- branches/render25/release/scripts/modules/add_object_utils.py	                        (rev 0)
+++ branches/render25/release/scripts/modules/add_object_utils.py	2010-05-24 08:25:40 UTC (rev 28950)
@@ -0,0 +1,74 @@
+# ##### 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+import mathutils
+
+def _align_matrix(context):
+    # TODO, local view cursor!
+    location = mathutils.TranslationMatrix(context.scene.cursor_location)
+
+    if context.user_preferences.edit.object_align == 'VIEW' and context.space_data.type == 'VIEW_3D':
+        rotation = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+    else:
+        rotation = mathutils.Matrix()
+
+    align_matrix = location * rotation
+
+    return align_matrix
+
+
+def add_object_data(obdata, context):
+
+    scene = context.scene
+
+    # ugh, could be made nicer
+    for ob in scene.objects:
+        ob.selected = False
+
+    obj_new = bpy.data.objects.new(obdata.name, obdata)
+
+    base = scene.objects.link(obj_new)
+    base.selected = True
+
+    if context.space_data and context.space_data.type == 'VIEW_3D':
+        base.layers_from_view(context.space_data)
+
+
+    obj_new.matrix = _align_matrix(context)
+
+    obj_act = scene.objects.active
+
+    if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type:
+        bpy.ops.object.mode_set(mode='OBJECT')
+
+        obj_act.selected = True
+        scene.update() # apply location
+        #scene.objects.active = obj_new
+
+        bpy.ops.object.join() # join into the active.
+
+        bpy.ops.object.mode_set(mode='EDIT')
+    else:
+        scene.objects.active = obj_new
+        if context.user_preferences.edit.enter_edit_mode:
+            bpy.ops.object.mode_set(mode='EDIT')
+
+    return base

Modified: branches/render25/source/blender/imbuf/intern/tiff.c
===================================================================
--- branches/render25/source/blender/imbuf/intern/tiff.c	2010-05-24 08:02:15 UTC (rev 28949)
+++ branches/render25/source/blender/imbuf/intern/tiff.c	2010-05-24 08:25:40 UTC (rev 28950)
@@ -40,10 +40,12 @@
  * used to compress images.
  */
 
+#ifdef WITH_TIFF
+
 #include <string.h>
 
 #include "imbuf.h"
-
+ 
 #include "BKE_global.h"
 #include "BKE_utildefines.h"
 
@@ -57,7 +59,7 @@
 #include "IMB_filetype.h"
 #include "IMB_filter.h"
 
-#include "dynlibtiff.h"
+#include "tiffio.h"
 
 
 
@@ -267,7 +269,7 @@
 	memFile->offset = 0;
 	memFile->size = size;
 
-	return libtiff_TIFFClientOpen("(Blender TIFF Interface Layer)", 
+	return TIFFClientOpen("(Blender TIFF Interface Layer)", 
 		"r", (thandle_t)(memFile),
 		imb_tiff_ReadProc, imb_tiff_WriteProc,
 		imb_tiff_SeekProc, imb_tiff_CloseProc,
@@ -299,16 +301,77 @@
 		 (memcmp(lil_endian, mem, IMB_TIFF_NCB) == 0) );
 }
 
-static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
+static void scanline_contig_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int spp)
 {
+	int i;
+	for (i=0; i < scanline_w; i++) {
+		rect[i*4 + 0] = cbuf[i*spp + 0];
+		rect[i*4 + 1] = cbuf[i*spp + 1];
+		rect[i*4 + 2] = cbuf[i*spp + 2];
+		rect[i*4 + 3] = (spp==4)?cbuf[i*spp + 3]:255;
+	}
+}
+
+static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int spp)
+{
+	int i;
+	for (i=0; i < scanline_w; i++) {
+		rectf[i*4 + 0] = sbuf[i*spp + 0] / 65535.0;
+		rectf[i*4 + 1] = sbuf[i*spp + 1] / 65535.0;
+		rectf[i*4 + 2] = sbuf[i*spp + 2] / 65535.0;
+		rectf[i*4 + 3] = (spp==4)?(sbuf[i*spp + 3] / 65535.0):1.0;
+	}
+}
+
+static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int spp)
+{
+	int i;
+	for (i=0; i < scanline_w; i++) {
+		rectf[i*4 + 0] = fbuf[i*spp + 0];
+		rectf[i*4 + 1] = fbuf[i*spp + 1];
+		rectf[i*4 + 2] = fbuf[i*spp + 2];
+		rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0;
+	}
+}
+
+static void scanline_separate_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int chan)
+{
+	int i;
+	for (i=0; i < scanline_w; i++)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list