[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39545] branches/soc-2011-salad: Merging r39478 through r39544 from trunk into soc-2011-salad

Sergey Sharybin g.ulairi at gmail.com
Fri Aug 19 11:27:36 CEST 2011


Revision: 39545
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39545
Author:   nazgul
Date:     2011-08-19 09:27:35 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Merging r39478 through r39544 from trunk into soc-2011-salad

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

Modified Paths:
--------------
    branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
    branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
    branches/soc-2011-salad/release/scripts/startup/bl_operators/wm.py
    branches/soc-2011-salad/source/blender/blenkernel/intern/anim.c
    branches/soc-2011-salad/source/blender/editors/interface/interface.c
    branches/soc-2011-salad/source/blender/editors/interface/interface_handlers.c
    branches/soc-2011-salad/source/blender/editors/interface/interface_intern.h
    branches/soc-2011-salad/source/blender/editors/interface/interface_layout.c
    branches/soc-2011-salad/source/blender/editors/screen/area.c
    branches/soc-2011-salad/source/blender/editors/space_buttons/buttons_context.c
    branches/soc-2011-salad/source/blender/editors/space_buttons/buttons_header.c
    branches/soc-2011-salad/source/blender/editors/space_outliner/outliner_intern.h
    branches/soc-2011-salad/source/blender/editors/space_outliner/outliner_select.c
    branches/soc-2011-salad/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2011-salad/source/blender/editors/transform/transform.c
    branches/soc-2011-salad/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_cloth.c
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_object_force.c
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_sensor.c
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_smoke.c
    branches/soc-2011-salad/source/blender/python/intern/bpy_rna.c
    branches/soc-2011-salad/source/blender/render/intern/source/render_texture.c

Property Changed:
----------------
    branches/soc-2011-salad/
    branches/soc-2011-salad/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-salad
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798,30815
/branches/soc-2011-carrot:36828-39099
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-38309
/branches/soc-2011-pepper:36830-39479
/branches/soc-2011-tomato:36831-39481
/trunk/blender:36834-39477
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798,30815
/branches/soc-2011-carrot:36828-39099
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-38309
/branches/soc-2011-pepper:36830-39479
/branches/soc-2011-tomato:36831-39481
/trunk/blender:36834-39544

Modified: branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
===================================================================
--- branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.h	2011-08-19 09:18:47 UTC (rev 39544)
+++ branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.h	2011-08-19 09:27:35 UTC (rev 39545)
@@ -43,6 +43,7 @@
 	// whether multi-axis functionality is available (via the OS or driver)
 	// does not imply that a device is plugged in or being used
 	bool available();
+	bool oldDRV();
 
 private:
 	unsigned short m_clientID;

Modified: branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
===================================================================
--- branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm	2011-08-19 09:18:47 UTC (rev 39544)
+++ branches/soc-2011-salad/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm	2011-08-19 09:27:35 UTC (rev 39545)
@@ -143,7 +143,7 @@
 
 		// printf("ndof: client id = %d\n", m_clientID);
 
-		if (SetConnexionClientButtonMask != NULL) {
+		if (oldDRV()) {
 			has_old_driver = false;
 			SetConnexionClientButtonMask(m_clientID, kConnexionMaskAllButtons);
 		}
@@ -176,5 +176,14 @@
 		return InstallConnexionHandlers != NULL;
 		// this means that the driver is installed and dynamically linked to blender
 	}
+
+	bool GHOST_NDOFManagerCocoa::oldDRV()
+	{
+		extern OSErr SetConnexionClientButtonMask() __attribute__((weak_import));
+		// Make the linker happy for the framework check (see link below for more info)
+		// http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html
+		return SetConnexionClientButtonMask != NULL;
+		// this means that the driver has this symbol
+	}
 }
 #endif // WITH_INPUT_NDOF

Modified: branches/soc-2011-salad/release/scripts/startup/bl_operators/wm.py
===================================================================
--- branches/soc-2011-salad/release/scripts/startup/bl_operators/wm.py	2011-08-19 09:18:47 UTC (rev 39544)
+++ branches/soc-2011-salad/release/scripts/startup/bl_operators/wm.py	2011-08-19 09:27:35 UTC (rev 39545)
@@ -20,8 +20,12 @@
 
 import bpy
 from bpy.types import Menu, Operator
-from bpy.props import StringProperty, BoolProperty, IntProperty, \
-                      FloatProperty, EnumProperty
+from bpy.props import (StringProperty,
+                       BoolProperty,
+                       IntProperty,
+                       FloatProperty,
+                       EnumProperty,
+                       )
 
 from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
 
@@ -42,23 +46,30 @@
 
         return {'CANCELLED'}
 
-rna_path_prop = StringProperty(name="Context Attributes",
-        description="rna context string", maxlen=1024, default="")
+rna_path_prop = StringProperty(
+        name="Context Attributes",
+        description="rna context string",
+        maxlen=1024,
+        )
 
-rna_reverse_prop = BoolProperty(name="Reverse",
-        description="Cycle backwards", default=False)
+rna_reverse_prop = BoolProperty(
+        name="Reverse",
+        description="Cycle backwards",
+        default=False,
+        )
 
-rna_relative_prop = BoolProperty(name="Relative",
+rna_relative_prop = BoolProperty(
+        name="Relative",
         description="Apply relative to the current value (delta)",
-        default=False)
+        default=False,
+        )
 
 
 def context_path_validate(context, data_path):
-    import sys
     try:
         value = eval("context.%s" % data_path) if data_path else Ellipsis
-    except AttributeError:
-        if "'NoneType'" in str(sys.exc_info()[1]):
+    except AttributeError as e:
+        if str(e).startswith("'NoneType'"):
             # One of the items in the rna path is None, just ignore this
             value = Ellipsis
         else:
@@ -68,16 +79,65 @@
     return value
 
 
+def operator_value_is_undo(value):
+    if value in {None, Ellipsis}:
+        return False
+
+    # typical properties or objects
+    id_data = getattr(value, "id_data", Ellipsis)
+
+    if id_data is None:
+        return False
+    elif id_data is Ellipsis:
+        # handle mathutils types
+        id_data = getattr(getattr(value, "owner", None), "id_data", None)
+
+        if id_data is None:
+            return False
+
+    # return True if its a non window ID type
+    return (isinstance(id_data, bpy.types.ID) and
+            (not isinstance(id_data, (bpy.types.WindowManager,
+                                      bpy.types.Screen,
+                                      bpy.types.Scene,
+                                      bpy.types.Brush,
+                                      ))))
+
+
+def operator_path_is_undo(context, data_path):
+    # note that if we have data paths that use strings this could fail
+    # luckily we dont do this!
+    #
+    # When we cant find the data owner assume no undo is needed.
+    data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".")
+
+    if not data_path_head:
+        return False
+
+    value = context_path_validate(context, data_path_head)
+
+    return operator_value_is_undo(value)
+
+
+def operator_path_undo_return(context, data_path):
+    return {'FINISHED'} if operator_path_is_undo(context, data_path) else {'CANCELLED'}
+
+
+def operator_value_undo_return(value):
+    return {'FINISHED'} if operator_value_is_undo(value) else {'CANCELLED'}
+
+
 def execute_context_assign(self, context):
-    if context_path_validate(context, self.data_path) is Ellipsis:
+    data_path = self.data_path
+    if context_path_validate(context, data_path) is Ellipsis:
         return {'PASS_THROUGH'}
 
     if getattr(self, "relative", False):
-        exec("context.%s+=self.value" % self.data_path)
+        exec("context.%s += self.value" % data_path)
     else:
-        exec("context.%s=self.value" % self.data_path)
+        exec("context.%s = self.value" % data_path)
 
-    return {'FINISHED'}
+    return operator_path_undo_return(context, data_path)
 
 
 class BRUSH_OT_active_index_set(Operator):
@@ -85,15 +145,21 @@
     bl_idname = "brush.active_index_set"
     bl_label = "Set Brush Number"
 
-    mode = StringProperty(name="mode",
-            description="Paint mode to set brush for", maxlen=1024)
-    index = IntProperty(name="number",
-            description="Brush number")
+    mode = StringProperty(
+            name="mode",
+            description="Paint mode to set brush for",
+            maxlen=1024,
+            )
+    index = IntProperty(
+            name="number",
+            description="Brush number",
+            )
 
     _attr_dict = {"sculpt": "use_paint_sculpt",
                   "vertex_paint": "use_paint_vertex",
                   "weight_paint": "use_paint_weight",
-                  "image_paint": "use_paint_image"}
+                  "image_paint": "use_paint_image",
+                  }
 
     def execute(self, context):
         attr = self._attr_dict.get(self.mode)
@@ -115,8 +181,11 @@
     bl_options = {'UNDO', 'INTERNAL'}
 
     data_path = rna_path_prop
-    value = BoolProperty(name="Value",
-            description="Assignment value", default=True)
+    value = BoolProperty(
+            name="Value",
+            description="Assignment value",
+            default=True,
+            )
 
     execute = execute_context_assign
 
@@ -128,7 +197,11 @@
     bl_options = {'UNDO', 'INTERNAL'}
 
     data_path = rna_path_prop
-    value = IntProperty(name="Value", description="Assign value", default=0)
+    value = IntProperty(
+            name="Value",
+            description="Assign value",
+            default=0,
+            )
     relative = rna_relative_prop
 
     execute = execute_context_assign
@@ -141,17 +214,23 @@
     bl_options = {'UNDO', 'INTERNAL'}
 
     data_path = rna_path_prop
-    value = FloatProperty(name="Value", description="Assign value", default=1.0)
-    always_step = BoolProperty(name="Always Step",
-        description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
-        default=True)
+    value = FloatProperty(
+            name="Value",
+            description="Assign value",
+            default=1.0,
+            )
+    always_step = BoolProperty(
+            name="Always Step",
+            description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
+            default=True,
+            )
 
     def execute(self, context):
-        if context_path_validate(context, self.data_path) is Ellipsis:
+        data_path = self.data_path
+        if context_path_validate(context, data_path) is Ellipsis:
             return {'PASS_THROUGH'}
 
         value = self.value
-        data_path = self.data_path
 
         if value == 1.0:  # nothing to do
             return {'CANCELLED'}
@@ -163,11 +242,12 @@
             else:
                 add = "-1"
                 func = "min"
-            exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
+            exec("context.%s = %s(round(context.%s * value), context.%s + %s)" %
+                 (data_path, func, data_path, data_path, add))
         else:
-            exec("context.%s *= value" % self.data_path)
+            exec("context.%s *= value" % data_path)
 
-        return {'FINISHED'}
+        return operator_path_undo_return(context, data_path)
 
 
 class WM_OT_context_set_float(Operator):  # same as enum
@@ -177,8 +257,11 @@
     bl_options = {'UNDO', 'INTERNAL'}
 
     data_path = rna_path_prop
-    value = FloatProperty(name="Value",
-            description="Assignment value", default=0.0)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list