[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39543] branches/soc-2011-tomato: Merging r39478 through r39542 from trunk into soc-2011-tomato
Sergey Sharybin
g.ulairi at gmail.com
Fri Aug 19 11:18:08 CEST 2011
Revision: 39543
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39543
Author: nazgul
Date: 2011-08-19 09:18:07 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Merging r39478 through r39542 from trunk into soc-2011-tomato
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=39542
Modified Paths:
--------------
branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
branches/soc-2011-tomato/release/scripts/startup/bl_operators/wm.py
branches/soc-2011-tomato/source/blender/blenkernel/intern/anim.c
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_handlers.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_intern.h
branches/soc-2011-tomato/source/blender/editors/interface/interface_layout.c
branches/soc-2011-tomato/source/blender/editors/screen/area.c
branches/soc-2011-tomato/source/blender/editors/space_buttons/buttons_context.c
branches/soc-2011-tomato/source/blender/editors/space_buttons/buttons_header.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/outliner_intern.h
branches/soc-2011-tomato/source/blender/editors/space_outliner/outliner_select.c
branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_header.c
branches/soc-2011-tomato/source/blender/editors/transform/transform.c
branches/soc-2011-tomato/source/blender/editors/uvedit/uvedit_unwrap_ops.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_cloth.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object_force.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_sensor.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_smoke.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_rna.c
branches/soc-2011-tomato/source/blender/render/intern/source/render_texture.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/blender:36831-39477
+ /trunk/blender:36831-39542
Modified: branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
===================================================================
--- branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.h 2011-08-19 08:06:36 UTC (rev 39542)
+++ branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.h 2011-08-19 09:18:07 UTC (rev 39543)
@@ -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-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
===================================================================
--- branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm 2011-08-19 08:06:36 UTC (rev 39542)
+++ branches/soc-2011-tomato/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm 2011-08-19 09:18:07 UTC (rev 39543)
@@ -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-tomato/release/scripts/startup/bl_operators/wm.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/wm.py 2011-08-19 08:06:36 UTC (rev 39542)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/wm.py 2011-08-19 09:18:07 UTC (rev 39543)
@@ -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
@@ -39,23 +43,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:
@@ -65,16 +76,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):
@@ -82,15 +142,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)
@@ -112,8 +178,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
@@ -125,7 +194,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
@@ -138,17 +211,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'}
@@ -160,11 +239,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
@@ -174,8 +254,11 @@
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
- value = FloatProperty(name="Value",
- description="Assignment value", default=0.0)
+ value = FloatProperty(
+ name="Value",
+ description="Assignment value",
+ default=0.0,
+ )
relative = rna_relative_prop
execute = execute_context_assign
@@ -188,8 +271,11 @@
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
- value = StringProperty(name="Value",
- description="Assign value", maxlen=1024, default="")
+ value = StringProperty(
+ name="Value",
+ description="Assign value",
+ maxlen=1024,
+ )
execute = execute_context_assign
@@ -201,9 +287,11 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list