[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38516] branches/soc-2011-tomato: Merging r38454 through r38515 from trunk into soc-2011-tomato

Sergey Sharybin g.ulairi at gmail.com
Tue Jul 19 21:58:02 CEST 2011


Revision: 38516
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38516
Author:   nazgul
Date:     2011-07-19 19:58:01 +0000 (Tue, 19 Jul 2011)
Log Message:
-----------
Merging r38454 through r38515 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38454
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38515

Modified Paths:
--------------
    branches/soc-2011-tomato/GNUmakefile
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemX11.cpp
    branches/soc-2011-tomato/release/scripts/modules/addon_utils.py
    branches/soc-2011-tomato/release/scripts/modules/bpy/path.py
    branches/soc-2011-tomato/release/scripts/modules/bpy_extras/io_utils.py
    branches/soc-2011-tomato/release/scripts/startup/bl_operators/object_align.py
    branches/soc-2011-tomato/release/scripts/startup/bl_operators/uvcalc_smart_project.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_material.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_userpref.py
    branches/soc-2011-tomato/source/blender/blenkernel/intern/particle_system.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_ops.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object_api.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_util.h
    branches/soc-2011-tomato/source/blender/nodes/intern/SHD_util.c
    branches/soc-2011-tomato/source/blender/python/generic/bgl.c
    branches/soc-2011-tomato/source/blender/python/intern/bpy_rna.c
    branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_operators.c
    branches/soc-2011-tomato/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Added Paths:
-----------
    branches/soc-2011-tomato/source/tests/check_deprecated.py

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/release/scripts/templates/batch_export.py


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/blender:36831-38453
   + /trunk/blender:36831-38515

Modified: branches/soc-2011-tomato/GNUmakefile
===================================================================
--- branches/soc-2011-tomato/GNUmakefile	2011-07-19 16:52:47 UTC (rev 38515)
+++ branches/soc-2011-tomato/GNUmakefile	2011-07-19 19:58:01 UTC (rev 38516)
@@ -99,14 +99,18 @@
 
 # run pep8 check check on scripts we distribute.
 test_pep8:
-	python source/tests/pep8.py > test_pep8.log 2>&1
+	python3 source/tests/pep8.py > test_pep8.log 2>&1
 	@echo "written: test_pep8.log"
 
 # run some checks on our cmakefiles.
 test_cmake:
-	python build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
+	python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
 	@echo "written: test_cmake_consistency.log"
 
+# run deprecation tests, see if we have anything to remove.
+test_deprecated:
+	python3 source/tests/check_deprecated.py
+
 clean:
 	make -C $(BUILD_DIR) clean
 

Modified: branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemX11.cpp	2011-07-19 16:52:47 UTC (rev 38515)
+++ branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemX11.cpp	2011-07-19 19:58:01 UTC (rev 38516)
@@ -150,10 +150,11 @@
 	if (gettimeofday(&tv,NULL) == -1) {
 		GHOST_ASSERT(false,"Could not instantiate timer!");
 	}
-
-	m_start_time = GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000);
 	
+	// Taking care not to overflow the tv.tv_sec*1000
+	m_start_time = GHOST_TUns64(tv.tv_sec)*1000 + tv.tv_usec/1000;
 	
+	
 	/* use detectable autorepeate, mac and windows also do this */
 	int use_xkb;
 	int xkb_opcode, xkb_event, xkb_error;
@@ -199,7 +200,8 @@
 		GHOST_ASSERT(false,"Could not compute time!");
 	}
 
-	return  GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000) - m_start_time;
+	// Taking care not to overflow the tv.tv_sec*1000
+	return  GHOST_TUns64(tv.tv_sec)*1000 + tv.tv_usec/1000 - m_start_time;
 }
 	
 	GHOST_TUns8 

Modified: branches/soc-2011-tomato/release/scripts/modules/addon_utils.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/modules/addon_utils.py	2011-07-19 16:52:47 UTC (rev 38515)
+++ branches/soc-2011-tomato/release/scripts/modules/addon_utils.py	2011-07-19 19:58:01 UTC (rev 38516)
@@ -31,6 +31,8 @@
 import bpy as _bpy
 
 
+error_duplicates = False
+
 def paths():
     # RELEASE SCRIPTS: official scripts distributed in Blender releases
     paths = _bpy.utils.script_paths("addons")
@@ -47,8 +49,11 @@
 
 
 def modules(module_cache):
+    global error_duplicates
     import os
 
+    error_duplicates = False
+
     path_list = paths()
 
     # fake module importing
@@ -117,7 +122,12 @@
             modules_stale -= {mod_name}
             mod = module_cache.get(mod_name)
             if mod:
-                if mod.__time__ != os.path.getmtime(mod_path):
+                if mod.__file__ != mod_path:
+                    print("multiple addons with the same name:\n  %r\n  %r" %
+                          (mod.__file__, mod_path))
+                    error_duplicates = True
+
+                elif mod.__time__ != os.path.getmtime(mod_path):
                     print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path)
                     del module_cache[mod_name]
                     mod = None

Modified: branches/soc-2011-tomato/release/scripts/modules/bpy/path.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/modules/bpy/path.py	2011-07-19 16:52:47 UTC (rev 38515)
+++ branches/soc-2011-tomato/release/scripts/modules/bpy/path.py	2011-07-19 19:58:01 UTC (rev 38516)
@@ -35,7 +35,7 @@
     :type start: string
     """
     if path.startswith("//"):
-        return _os.path.join(_os.path.dirname(_bpy.data.filepath if start is None else start), path[2:])
+        return _os.path.join(_os.path.dirname(_bpy.data.filepath) if start is None else start, path[2:])
 
     return path
 

Modified: branches/soc-2011-tomato/release/scripts/modules/bpy_extras/io_utils.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/modules/bpy_extras/io_utils.py	2011-07-19 16:52:47 UTC (rev 38515)
+++ branches/soc-2011-tomato/release/scripts/modules/bpy_extras/io_utils.py	2011-07-19 19:58:01 UTC (rev 38516)
@@ -22,6 +22,7 @@
     "ExportHelper",
     "ImportHelper",
     "axis_conversion",
+    "axis_conversion_ensure",
     "create_derived_objects",
     "free_derived_objects",
     "unpack_list",
@@ -154,14 +155,52 @@
     if from_forward == to_forward and from_up == to_up:
         return Matrix().to_3x3()
 
+    if from_forward[-1] == from_up[-1] or to_forward[-1] == to_up[-1]:
+        raise Exception("invalid axis arguments passed, "
+                        "can't use up/forward on the same axis.")
+
     value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3) for i, a in enumerate((from_forward, from_up, to_forward, to_up))))
 
     for i, axis_lut in enumerate(_axis_convert_lut):
         if value in axis_lut:
             return Matrix(_axis_convert_matrix[i])
-    assert("internal error")
+    assert(0)
 
+    
+def axis_conversion_ensure(operator, forward_attr, up_attr):
+    """
+    Function to ensure an operator has valid axis conversion settings, intended
+    to be used from :class:`Operator.check`.
 
+    :arg operator: the operator to access axis attributes from.
+    :type operator: :class:`Operator`
+    :arg forward_attr: 
+    :type forward_attr: string
+    :arg up_attr: the directory the *filepath* will be referenced from (normally the export path).
+    :type up_attr: string
+    :return: True if the value was modified.
+    :rtype: boolean
+    """
+    def validate(axis_forward, axis_up):
+        if axis_forward[-1] == axis_up[-1]:
+            axis_up = axis_up[0:-1] + 'XYZ'[('XYZ'.index(axis_up[-1]) + 1) % 3]
+        
+        return axis_forward, axis_up
+    
+    change = False
+
+    axis = getattr(operator, forward_attr), getattr(operator, up_attr)
+    axis_new = validate(*axis)
+
+    if axis != axis_new:
+        setattr(operator, forward_attr, axis_new[0])
+        setattr(operator, up_attr, axis_new[1])
+
+        return True
+    else:
+        return False
+
+
 # return a tuple (free, object list), free is True if memory should be freed later with free_derived_objects()
 def create_derived_objects(scene, ob):
     if ob.parent and ob.parent.dupli_type != 'NONE':

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_operators/object_align.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/object_align.py	2011-07-19 16:52:47 UTC (rev 38515)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/object_align.py	2011-07-19 19:58:01 UTC (rev 38516)
@@ -21,13 +21,102 @@
 import bpy
 from mathutils import Vector
 
+def GlobalBB_LQ(bb_world):
+    
+    # Initialize the variables with the 8th vertex
+    left, right, front, back, down, up =\
+    bb_world[7][0],\
+    bb_world[7][0],\
+    bb_world[7][1],\
+    bb_world[7][1],\
+    bb_world[7][2],\
+    bb_world[7][2]
+    
+    # Test against the other 7 verts
+    for i in range (7):
+        
+        # X Range
+        val = bb_world[i][0]
+        if val < left:
+            left = val
+            
+        if val > right:
+            right = val
+            
+        # Y Range
+        val = bb_world[i][1]
+        if val < front:
+            front = val
+            
+        if val > back:
+            back = val
+            
+        # Z Range
+        val = bb_world[i][2]
+        if val < down:
+            down = val
+            
+        if val > up:
+            up = val
+        
+    return (Vector((left, front, up)), Vector((right, back, down)))
 
-def align_objects(align_x, align_y, align_z, align_mode, relative_to):
+def GlobalBB_HQ(obj):
+    
+    matrix_world = obj.matrix_world.copy()
+    
+    # Initialize the variables with the last vertex
+    
+    verts = obj.data.vertices
+    
+    val = verts[-1].co * matrix_world
+    
+    left, right, front, back, down, up =\
+    val[0],\
+    val[0],\
+    val[1],\
+    val[1],\
+    val[2],\
+    val[2]
+    
+    # Test against all other verts
+    for i in range (len(verts)-1):
+        
+        vco = verts[i].co * matrix_world
+        
+        # X Range
+        val = vco[0]
+        if val < left:
+            left = val
+            
+        if val > right:
+            right = val
+            
+        # Y Range
+        val = vco[1]
+        if val < front:
+            front = val
+            
+        if val > back:
+            back = val
+            
+        # Z Range
+        val = vco[2]
+        if val < down:
+            down = val
+            
+        if val > up:
+            up = val
+        
+    return (Vector((left, front, up)), Vector((right, back, down)))
 
+
+def align_objects(align_x, align_y, align_z, align_mode, relative_to, bb_quality):
+
     cursor = bpy.context.scene.cursor_location
 
-    Left_Up_Front_SEL = [0.0, 0.0, 0.0]
-    Right_Down_Back_SEL = [0.0, 0.0, 0.0]
+    Left_Front_Up_SEL = [0.0, 0.0, 0.0]
+    Right_Back_Down_SEL = [0.0, 0.0, 0.0]
 
     flag_first = True
 
@@ -42,79 +131,90 @@
         return False
 
     for obj, bb_world in objs:
-        Left_Up_Front = bb_world[1]
-        Right_Down_Back = bb_world[7]
+        
+        if bb_quality:
+            GBB = GlobalBB_HQ(obj)
+        else:
+            GBB = GlobalBB_LQ(bb_world)
+            
+        Left_Front_Up = GBB[0]
+        Right_Back_Down = GBB[1]
 
         # Active Center
 
         if obj == bpy.context.active_object:
 
-            center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0
-            center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0
-            center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0
+            center_active_x = (Left_Front_Up[0] + Right_Back_Down[0]) / 2.0
+            center_active_y = (Left_Front_Up[1] + Right_Back_Down[1]) / 2.0
+            center_active_z = (Left_Front_Up[2] + Right_Back_Down[2]) / 2.0
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list