Merging r39478 through r39542 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin 2011-08-19 09:18:07 +00:00
commit 4a99029a20
24 changed files with 541 additions and 266 deletions

@ -43,6 +43,7 @@ public:
// 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;

@ -143,7 +143,7 @@ GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(GHOST_System& sys)
// 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 @@ extern "C" {
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

@ -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 @@ class MESH_OT_delete_edgeloop(Operator):
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 @@ def context_path_validate(context, data_path):
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 @@ class BRUSH_OT_active_index_set(Operator):
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 @@ class WM_OT_context_set_boolean(Operator):
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 @@ class WM_OT_context_set_int(Operator): # same as enum
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 @@ class WM_OT_context_scale_int(Operator):
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 @@ class WM_OT_context_scale_int(Operator):
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 @@ class WM_OT_context_set_float(Operator): # same as enum
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 @@ class WM_OT_context_set_string(Operator): # same as enum
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 @@ class WM_OT_context_set_enum(Operator):
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
value = StringProperty(name="Value",
value = StringProperty(
name="Value",
description="Assignment value (as a string)",
maxlen=1024, default="")
maxlen=1024,
)
execute = execute_context_assign
@ -215,15 +303,18 @@ class WM_OT_context_set_value(Operator):
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
value = StringProperty(name="Value",
value = StringProperty(
name="Value",
description="Assignment value (as a string)",
maxlen=1024, default="")
maxlen=1024,
)
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'}
exec("context.%s=%s" % (self.data_path, self.value))
return {'FINISHED'}
exec("context.%s = %s" % (data_path, self.value))
return operator_path_undo_return(context, data_path)
class WM_OT_context_toggle(Operator):
@ -235,14 +326,14 @@ class WM_OT_context_toggle(Operator):
data_path = rna_path_prop
def execute(self, context):
data_path = self.data_path
if context_path_validate(context, self.data_path) is Ellipsis:
if context_path_validate(context, data_path) is Ellipsis:
return {'PASS_THROUGH'}
exec("context.%s=not (context.%s)" %
(self.data_path, self.data_path))
exec("context.%s = not (context.%s)" % (data_path, data_path))
return {'FINISHED'}
return operator_path_undo_return(context, data_path)
class WM_OT_context_toggle_enum(Operator):
@ -252,23 +343,30 @@ class WM_OT_context_toggle_enum(Operator):
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
value_1 = StringProperty(name="Value", \
description="Toggle enum", maxlen=1024, default="")
value_2 = StringProperty(name="Value", \
description="Toggle enum", maxlen=1024, default="")
value_1 = StringProperty(
name="Value",
description="Toggle enum",
maxlen=1024,
)
value_2 = StringProperty(
name="Value",
description="Toggle enum",
maxlen=1024,
)
def execute(self, context):
data_path = self.data_path
if context_path_validate(context, self.data_path) is Ellipsis:
if context_path_validate(context, data_path) is Ellipsis:
return {'PASS_THROUGH'}
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
(self.data_path, self.value_1,\
self.value_2, self.data_path,
self.value_2))
exec("context.%s = ('%s', '%s')[context.%s != '%s']" %
(data_path, self.value_1,
self.value_2, data_path,
self.value_2,
))
return {'FINISHED'}
return operator_path_undo_return(context, data_path)
class WM_OT_context_cycle_int(Operator):
@ -292,7 +390,7 @@ class WM_OT_context_cycle_int(Operator):
else:
value += 1
exec("context.%s=value" % data_path)
exec("context.%s = value" % data_path)
if value != eval("context.%s" % data_path):
# relies on rna clamping int's out of the range
@ -301,9 +399,9 @@ class WM_OT_context_cycle_int(Operator):
else:
value = -1 << 31
exec("context.%s=value" % data_path)
exec("context.%s = value" % data_path)
return {'FINISHED'}
return operator_path_undo_return(context, data_path)
class WM_OT_context_cycle_enum(Operator):
@ -316,15 +414,15 @@ class WM_OT_context_cycle_enum(Operator):
reverse = rna_reverse_prop
def execute(self, context):
value = context_path_validate(context, self.data_path)
data_path = self.data_path
value = context_path_validate(context, data_path)
if value is Ellipsis:
return {'PASS_THROUGH'}
orig_value = value
# Have to get rna enum values
rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1)
rna_struct_str, rna_prop_str = data_path.rsplit('.', 1)
i = rna_prop_str.find('[')
# just incse we get "context.foo.bar[0]"
@ -354,8 +452,8 @@ class WM_OT_context_cycle_enum(Operator):
advance_enum = enums[orig_index + 1]
# set the new value
exec("context.%s=advance_enum" % self.data_path)
return {'FINISHED'}
exec("context.%s = advance_enum" % data_path)
return operator_path_undo_return(context, data_path)
class WM_OT_context_cycle_array(Operator):
@ -381,9 +479,9 @@ class WM_OT_context_cycle_array(Operator):
array.append(array.pop(0))
return array
exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
exec("context.%s = cycle(context.%s[:])" % (data_path, data_path))
return {'FINISHED'}
return operator_path_undo_return(context, data_path)
class WM_MT_context_menu_enum(Menu):
@ -426,8 +524,11 @@ class WM_OT_context_set_id(Operator):
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,
)
def execute(self, context):
value = self.value
@ -449,16 +550,23 @@ class WM_OT_context_set_id(Operator):
if id_iter:
value_id = getattr(bpy.data, id_iter).get(value)
exec("context.%s=value_id" % data_path)
exec("context.%s = value_id" % data_path)
return {'FINISHED'}
return operator_path_undo_return(context, data_path)
doc_id = StringProperty(name="Doc ID",
description="", maxlen=1024, default="", options={'HIDDEN'})
doc_id = StringProperty(
name="Doc ID",
description="",
maxlen=1024,
options={'HIDDEN'},
)
doc_new = StringProperty(name="Edit Description",
description="", maxlen=1024, default="")
doc_new = StringProperty(
name="Edit Description",
description="",
maxlen=1024,
)
data_path_iter = StringProperty(
description="The data path relative to the context, must point to an iterable.")
@ -476,12 +584,13 @@ class WM_OT_context_collection_boolean_set(Operator):
data_path_iter = data_path_iter
data_path_item = data_path_item
type = EnumProperty(items=(
('TOGGLE', "Toggle", ""),
('ENABLE', "Enable", ""),
('DISABLE', "Disable", ""),
),
name="Type")
type = EnumProperty(
name="Type",
items=(('TOGGLE', "Toggle", ""),
('ENABLE', "Enable", ""),
('DISABLE', "Disable", ""),
),
)
def execute(self, context):
data_path_iter = self.data_path_iter
@ -507,6 +616,10 @@ class WM_OT_context_collection_boolean_set(Operator):
items_ok.append(item)
# avoid undo push when nothing to do
if not items_ok:
return {'CANCELLED'}
if self.type == 'ENABLE':
is_set = True
elif self.type == 'DISABLE':
@ -518,20 +631,26 @@ class WM_OT_context_collection_boolean_set(Operator):
for item in items_ok:
exec(exec_str)
return {'FINISHED'}
return operator_value_undo_return(item)
class WM_OT_context_modal_mouse(Operator):
'''Adjust arbitrary values with mouse input'''
bl_idname = "wm.context_modal_mouse"
bl_label = "Context Modal Mouse"
bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
bl_options = {'GRAB_POINTER', 'BLOCKING', 'UNDO', 'INTERNAL'}
data_path_iter = data_path_iter
data_path_item = data_path_item
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
invert = BoolProperty(default=False, description="Invert the mouse input")
input_scale = FloatProperty(
description="Scale the mouse movement by this value before applying the delta",
default=0.01,
)
invert = BoolProperty(
description="Invert the mouse input",
default=False,
)
initial_x = IntProperty(options={'HIDDEN'})
def _values_store(self, context):
@ -584,12 +703,13 @@ class WM_OT_context_modal_mouse(Operator):
self._values_delta(delta)
elif 'LEFTMOUSE' == event_type:
item = next(iter(self._values.keys()))
self._values_clear()
return {'FINISHED'}
return operator_value_undo_return(item)
elif event_type in {'RIGHTMOUSE', 'ESC'}:
self._values_restore()
return {'FINISHED'}
return {'CANCELLED'}
return {'RUNNING_MODAL'}
@ -613,7 +733,10 @@ class WM_OT_url_open(Operator):
bl_idname = "wm.url_open"
bl_label = ""
url = StringProperty(name="URL", description="URL to open")
url = StringProperty(
name="URL",
description="URL to open",
)
def execute(self, context):
import webbrowser
@ -627,7 +750,11 @@ class WM_OT_path_open(Operator):
bl_idname = "wm.path_open"
bl_label = ""
filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
filepath = StringProperty(
name="File Path",
maxlen=1024,
subtype='FILE_PATH',
)
def execute(self, context):
import sys
@ -662,9 +789,11 @@ class WM_OT_doc_view(Operator):
doc_id = doc_id
if bpy.app.version_cycle == "release":
_prefix = "http://www.blender.org/documentation/blender_python_api_%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s%s_release" %
("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char))
else:
_prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s" %
"_".join(str(v) for v in bpy.app.version))
def _nested_class_string(self, class_string):
ls = []
@ -682,8 +811,8 @@ class WM_OT_doc_view(Operator):
class_name, class_prop = id_split
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \
(self._prefix, class_name, class_name, class_prop)
url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
(self._prefix, class_name, class_name, class_prop))
else:
# detect if this is a inherited member and use that name instead
@ -696,8 +825,8 @@ class WM_OT_doc_view(Operator):
# It so happens that epydoc nests these, not sphinx
# class_name_full = self._nested_class_string(class_name)
url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \
(self._prefix, class_name, class_name, class_prop)
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
(self._prefix, class_name, class_name, class_prop))
else:
return {'PASS_THROUGH'}
@ -780,17 +909,36 @@ class WM_OT_doc_edit(Operator):
return wm.invoke_props_dialog(self, width=600)
rna_path = StringProperty(name="Property Edit",
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
rna_path = StringProperty(
name="Property Edit",
description="Property data_path edit",
maxlen=1024,
options={'HIDDEN'},
)
rna_value = StringProperty(name="Property Value",
description="Property value edit", maxlen=1024, default="")
rna_value = StringProperty(
name="Property Value",
description="Property value edit",
maxlen=1024,
)
rna_property = StringProperty(name="Property Name",
description="Property name edit", maxlen=1024, default="")
rna_property = StringProperty(
name="Property Name",
description="Property name edit",
maxlen=1024,
)
rna_min = FloatProperty(name="Min", default=0.0, precision=3)
rna_max = FloatProperty(name="Max", default=1.0, precision=3)
rna_min = FloatProperty(
name="Min",
default=0.0,
precision=3,
)
rna_max = FloatProperty(
name="Max",
default=1.0,
precision=3,
)
class WM_OT_properties_edit(Operator):
@ -804,7 +952,9 @@ class WM_OT_properties_edit(Operator):
value = rna_value
min = rna_min
max = rna_max
description = StringProperty(name="Tip", default="")
description = StringProperty(
name="Tip",
)
def execute(self, context):
data_path = self.data_path
@ -857,14 +1007,15 @@ class WM_OT_properties_edit(Operator):
return {'FINISHED'}
def invoke(self, context, event):
data_path = self.data_path
if not self.data_path:
if not data_path:
self.report({'ERROR'}, "Data path not set")
return {'CANCELLED'}
self._last_prop = [self.property]
item = eval("context.%s" % self.data_path)
item = eval("context.%s" % data_path)
# setup defaults
prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create
@ -885,7 +1036,8 @@ class WM_OT_properties_add(Operator):
data_path = rna_path
def execute(self, context):
item = eval("context.%s" % self.data_path)
data_path = self.data_path
item = eval("context.%s" % data_path)
def unique_name(names):
prop = 'prop'
@ -908,10 +1060,13 @@ class WM_OT_properties_context_change(Operator):
bl_idname = "wm.properties_context_change"
bl_label = ""
context = StringProperty(name="Context", maxlen=32)
context = StringProperty(
name="Context",
maxlen=32,
)
def execute(self, context):
context.space_data.context = (self.context)
context.space_data.context = self.context
return {'FINISHED'}
@ -924,7 +1079,8 @@ class WM_OT_properties_remove(Operator):
property = rna_property
def execute(self, context):
item = eval("context.%s" % self.data_path)
data_path = self.data_path
item = eval("context.%s" % data_path)
del item[self.property]
return {'FINISHED'}
@ -933,7 +1089,10 @@ class WM_OT_keyconfig_activate(Operator):
bl_idname = "wm.keyconfig_activate"
bl_label = "Activate Keyconfig"
filepath = StringProperty(name="File Path", maxlen=1024)
filepath = StringProperty(
name="File Path",
maxlen=1024,
)
def execute(self, context):
bpy.utils.keyconfig_set(self.filepath)
@ -961,7 +1120,10 @@ class WM_OT_appconfig_activate(Operator):
bl_idname = "wm.appconfig_activate"
bl_label = "Activate Application Configuration"
filepath = StringProperty(name="File Path", maxlen=1024)
filepath = StringProperty(
name="File Path",
maxlen=1024,
)
def execute(self, context):
import os

@ -1245,6 +1245,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
sim.ob= par;
sim.psys= psys;
sim.psmd= psys_get_modifier(par, psys);
/* make sure emitter imat is in global coordinates instead of render view coordinates */
invert_m4_m4(par->imat, par->obmat);
/* first check for loops (particle system object used as dupli object) */
if(part->ren_as == PART_DRAW_OB) {

@ -710,6 +710,27 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
return 1;
}
/* use to check if we need to disable undo, but dont make any changes
* returns FALSE if undo needs to be disabled. */
static int ui_but_is_rna_undo(uiBut *but)
{
if(but->rnapoin.id.data) {
/* avoid undo push for buttons who's ID are screen or wm level
* we could disable undo for buttons with no ID too but may have
* unforseen conciquences, so best check for ID's we _know_ are not
* handled by undo - campbell */
ID *id= but->rnapoin.id.data;
if(ELEM(GS(id->name), ID_SCR, ID_WM)) {
return FALSE;
}
else {
return TRUE;
}
}
return TRUE;
}
/* assigns automatic keybindings to menu items for fast access
* (underline key in menu) */
static void ui_menu_block_set_keyaccels(uiBlock *block)
@ -1245,14 +1266,14 @@ int ui_is_but_float(uiBut *but)
int ui_is_but_unit(uiBut *but)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int unit_type= uiButGetUnitType(but);
UnitSettings *unit= but->block->unit;
const int unit_type= uiButGetUnitType(but);
if(unit_type == PROP_UNIT_NONE)
return 0;
#if 1 // removed so angle buttons get correct snapping
if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
return 0;
#endif
@ -1260,7 +1281,7 @@ int ui_is_but_unit(uiBut *but)
if (unit_type == PROP_UNIT_TIME)
return 0;
if (scene->unit.system == USER_UNIT_NONE) {
if (unit->system == USER_UNIT_NONE) {
if (unit_type != PROP_UNIT_ROTATION) {
return 0;
}
@ -1293,19 +1314,19 @@ double ui_get_but_val(uiBut *but)
switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
if(RNA_property_array_length(&but->rnapoin, prop))
if(RNA_property_array_check(prop))
value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_boolean_get(&but->rnapoin, prop);
break;
case PROP_INT:
if(RNA_property_array_length(&but->rnapoin, prop))
if(RNA_property_array_check(prop))
value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_int_get(&but->rnapoin, prop);
break;
case PROP_FLOAT:
if(RNA_property_array_length(&but->rnapoin, prop))
if(RNA_property_array_check(prop))
value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_float_get(&but->rnapoin, prop);
@ -1459,19 +1480,20 @@ int ui_get_but_string_max_length(uiBut *but)
static double ui_get_but_scale_unit(uiBut *but, double value)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but);
if(unit_type == PROP_UNIT_LENGTH) {
return value * (double)scene->unit.scale_length;
return value * (double)unit->scale_length;
}
else if(unit_type == PROP_UNIT_AREA) {
return value * pow(scene->unit.scale_length, 2);
return value * pow(unit->scale_length, 2);
}
else if(unit_type == PROP_UNIT_VOLUME) {
return value * pow(scene->unit.scale_length, 3);
return value * pow(unit->scale_length, 3);
}
else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
Scene *scene= CTX_data_scene(but->block->evil_C);
return FRA2TIME(value);
}
else {
@ -1483,14 +1505,14 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
{
if(ui_is_but_unit(but)) {
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but);
char *orig_str;
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
orig_str= MEM_callocN(sizeof(char)*maxlen + 1, "textedit sub str");
memcpy(orig_str, str, maxlen);
bUnit_ToUnitAltName(str, maxlen, orig_str, scene->unit.system, unit_type>>16);
bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, unit_type>>16);
MEM_freeN(orig_str);
}
@ -1498,27 +1520,26 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT;
UnitSettings *unit= but->block->unit;
int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
int unit_type= uiButGetUnitType(but);
int precision= but->a2;
if(scene->unit.scale_length<0.0001f) scene->unit.scale_length= 1.0f; // XXX do_versions
if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
/* Sanity checks */
if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
else if(precision==0) precision= 2;
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type>>16, do_split, pad);
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad);
}
static float ui_get_but_step_unit(uiBut *but, float step_default)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int unit_type= uiButGetUnitType(but)>>16;
float step;
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), scene->unit.system, unit_type);
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type);
if(step > 0.0f) { /* -1 is an error value */
return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f;
@ -1606,12 +1627,11 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *
{
char str_unit_convert[256];
const int unit_type= uiButGetUnitType(but);
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
/* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type>>16);
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, unit_type>>16);
return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1);
}
@ -1958,7 +1978,10 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
block->active= 1;
block->dt= dt;
block->evil_C= (void*)C; // XXX
if (scn) block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
if (scn) {
block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
block->unit= &scn->unit;
}
BLI_strncpy(block->name, name, sizeof(block->name));
if(region)
@ -2506,12 +2529,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
{
const PropertyType proptype= RNA_property_type(prop);
uiBut *but;
PropertyType proptype;
int freestr= 0, icon= 0;
proptype= RNA_property_type(prop);
/* use rna values if parameters are not specified */
if(!str) {
if(type == MENU && proptype == PROP_ENUM) {
@ -2636,9 +2657,14 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
UI_DEF_BUT_RNA_DISABLE(but);
}
if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
but->flag &= ~UI_BUT_UNDO;
}
/* If this button uses units, calculate the step from this */
if(ui_is_but_unit(but))
if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
but->a1= ui_get_but_step_unit(but, but->a1);
}
if(freestr)
MEM_freeN((void *)str);
@ -2682,6 +2708,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname,
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
but->optype= ot;
but->opcontext= opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
if(!ot) {
but->flag |= UI_BUT_DISABLED;
@ -2711,6 +2738,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
but->optype= ot;
but->opcontext= opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
if(!ot) {
but->flag |= UI_BUT_DISABLED;

@ -2321,13 +2321,13 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
float fac= 1.0f;
if(ui_is_but_unit(but)) {
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but)>>16;
if(bUnit_IsValid(scene->unit.system, unit_type)) {
fac= (float)bUnit_BaseScalar(scene->unit.system, unit_type);
if(bUnit_IsValid(unit->system, unit_type)) {
fac= (float)bUnit_BaseScalar(unit->system, unit_type);
if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
fac /= scene->unit.scale_length;
fac /= unit->scale_length;
}
}
}

@ -332,7 +332,9 @@ struct uiBlock {
void *evil_C; // XXX hack for dynamic operator enums
float _hsv[3]; // XXX, only access via ui_block_hsv_get()
char color_profile; // color profile for correcting linear colors for display
char color_profile; // color profile for correcting linear colors for display
struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time.
};
typedef struct uiSafetyRct {

@ -1017,12 +1017,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
/* enum item */
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
const char *identifier= RNA_property_identifier(prop);
if(icon && name[0] && !icon_only)
uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else if(icon)
uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
}

@ -1407,6 +1407,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
"Displays current editor type. "
"Click for menu of available types");
uiButSetFunc(but, spacefunc, NULL, NULL);
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
return xco + UI_UNIT_X + 14;
}
@ -1415,6 +1416,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
{
ScrArea *sa= CTX_wm_area(C);
int xco= 8;
uiBut *but;
if (!sa->full)
xco= ED_area_header_switchbutton(C, block, yco);
@ -1422,20 +1424,22 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
uiBlockSetEmboss(block, UI_EMBOSSN);
if (sa->flag & HEADER_NO_PULLDOWN) {
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_RIGHT,
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Show pulldown menus");
}
else {
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_DOWN,
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Hide pulldown menus");
}
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
uiBlockSetEmboss(block, UI_EMBOSS);
return xco + UI_UNIT_X;

@ -904,6 +904,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
block= uiLayoutGetBlock(row);
uiBlockSetEmboss(block, UI_EMBOSSN);
but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
uiButSetFunc(but, pin_cb, NULL, NULL);
for(a=0; a<path->len; a++) {

@ -104,6 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
uiBlock *block;
uiBut *but;
int xco, yco= 2;
buttons_context_compute(C, sbuts);
@ -118,33 +119,32 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
xco -= UI_UNIT_X;
// Default panels
uiBlockBeginAlign(block);
if(sbuts->pathflag & (1<<BCONTEXT_RENDER))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_RENDER, 0, 0, "Render");
if(sbuts->pathflag & (1<<BCONTEXT_SCENE))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_SCENE, 0, 0, "Scene");
if(sbuts->pathflag & (1<<BCONTEXT_WORLD))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_WORLD, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_WORLD, 0, 0, "World");
if(sbuts->pathflag & (1<<BCONTEXT_OBJECT))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_OBJECT, 0, 0, "Object");
if(sbuts->pathflag & (1<<BCONTEXT_CONSTRAINT))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_CONSTRAINT, 0, 0, "Object Constraints");
if(sbuts->pathflag & (1<<BCONTEXT_MODIFIER))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MODIFIER, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifiers");
if(sbuts->pathflag & (1<<BCONTEXT_DATA))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, sbuts->dataicon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_DATA, 0, 0, "Object Data");
if(sbuts->pathflag & (1<<BCONTEXT_BONE))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_BONE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE, 0, 0, "Bone");
if(sbuts->pathflag & (1<<BCONTEXT_BONE_CONSTRAINT))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT_BONE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE_CONSTRAINT, 0, 0, "Bone Constraints");
if(sbuts->pathflag & (1<<BCONTEXT_MATERIAL))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MATERIAL, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MATERIAL, 0, 0, "Material");
if(sbuts->pathflag & (1<<BCONTEXT_TEXTURE))
uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_TEXTURE, 0, 0, "Texture");
if(sbuts->pathflag & (1<<BCONTEXT_PARTICLE))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles");
if(sbuts->pathflag & (1<<BCONTEXT_PHYSICS))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics");
#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
if(sbuts->pathflag & (1<<_ctx)) { \
but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, _tip); \
uiButClearFlag(but, UI_BUT_UNDO); \
} \
BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, "Render")
BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, "Scene");
BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, "World");
BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, "Object");
BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, "Object Constraints");
BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, "Object Modifiers");
BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, "Object Data");
BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, "Bone");
BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, "Bone Constraints");
BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, "Material");
BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, "Textures");
BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, "Particles");
BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, "Physics");
#undef BUTTON_HEADER_CTX
xco+= BUT_UNIT_X;
uiBlockEndAlign(block);

@ -143,9 +143,6 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space
void draw_outliner(const struct bContext *C);
/* outliner_select.c -------------------------------------------- */
void outliner_select(struct SpaceOops *soops, ListBase *lb, int *index, short *selecting);
int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set);

@ -106,10 +106,11 @@
/* ****************************************************** */
/* Outliner Selection (grey-blue highlight for rows) */
void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
{
TreeElement *te;
TreeStoreElem *tselem;
int change= 0;
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
tselem= TREESTORE(te);
@ -131,6 +132,8 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin
tselem->flag |= TSE_SELECTED;
else
tselem->flag &= ~TSE_SELECTED;
change |= 1;
}
}
else if ((tselem->flag & TSE_CLOSED)==0) {
@ -142,10 +145,12 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin
* function correctly
*/
(*index)--;
outliner_select(soops, &te->subtree, index, selecting);
change |= outliner_select(soops, &te->subtree, index, selecting);
(*index)++;
}
}
return change;
}
/* ****************************************************** */
@ -839,11 +844,14 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
fmval[0], fmval[1], NULL, &row);
/* select relevant row */
outliner_select(soops, &soops->tree, &row, &selecting);
if(outliner_select(soops, &soops->tree, &row, &selecting)) {
soops->storeflag |= SO_TREESTORE_REDRAW;
soops->storeflag |= SO_TREESTORE_REDRAW;
ED_undo_push(C, "Outliner selection event");
/* no need for undo push here, only changing outliner data which is
* scene level - campbell */
/* ED_undo_push(C, "Outliner selection event"); */
}
}
ED_region_tag_redraw(ar);

@ -1334,9 +1334,6 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
/* api callbacks */
ot->exec= sequencer_refresh_all_exec;
ot->poll= sequencer_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)

@ -2594,7 +2594,20 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
}
}
}
/* useful for debugging index vs shape key index */
#if 0
{
EditVert *eve;
int j;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
for(eve= em->verts.first, j= 0; eve; eve= eve->next, j++) {
sprintf(val, "%d:%d", j, eve->keyindex);
view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
}
#endif
if(v3d->zbuf) {
glEnable(GL_DEPTH_TEST);
bglPolygonOffset(rv3d->dist, 0.0f);

@ -281,31 +281,32 @@ static char *view3d_modeselect_pup(Scene *scene)
str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA);
if(ob==NULL || ob->data==NULL) return string;
if(ob->id.lib || ((ID *)ob->data)->lib) return string;
if(ob->id.lib) return string;
/* if active object is editable */
if ( ((ob->type == OB_MESH)
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
else if (ob->type == OB_ARMATURE) {
if (ob->mode & OB_MODE_POSE)
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
else
if(!((ID *)ob->data)->lib) {
/* if active object is editable */
if ( ((ob->type == OB_MESH)
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
else if (ob->type == OB_ARMATURE) {
if (ob->mode & OB_MODE_POSE)
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
else
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
if (ob->type == OB_MESH) {
str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
}
}
if (ob->type == OB_MESH) {
str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
}
/* if active object is an armature */
if (ob->type==OB_ARMATURE) {
str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT);
@ -465,6 +466,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
Object *ob= OBACT;
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
uiBut *but;
uiLayout *row;
const float dpi_fac= UI_DPI_FAC;
@ -512,9 +514,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
block= uiLayoutGetBlock(row);
if(v3d->twflag & V3D_USE_MANIPULATOR) {
uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
}
if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) {
@ -522,7 +527,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
}
str_menu = BIF_menustringTransformOrientation(C, "Orientation");
uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
MEM_freeN((void *)str_menu);
}

@ -1389,16 +1389,15 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
ToolSettings *ts = CTX_data_tool_settings(C);
int constraint_axis[3] = {0, 0, 0};
int proportional = 0;
PropertyRNA *prop;
if (RNA_struct_find_property(op->ptr, "value"))
{
if (t->flag & T_AUTOVALUES)
{
RNA_float_set_array(op->ptr, "value", t->auto_values);
if ((prop= RNA_struct_find_property(op->ptr, "value"))) {
float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values;
if (RNA_property_array_check(prop)) {
RNA_property_float_set_array(op->ptr, prop, values);
}
else
{
RNA_float_set_array(op->ptr, "value", t->values);
else {
RNA_property_float_set(op->ptr, prop, values[0]);
}
}

@ -205,11 +205,7 @@ static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short imp
float *uv[4];
int nverts;
if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
if(efa->h)
continue;
}
else if((efa->h) || (sel && (efa->f & SELECT)==0))
if((efa->h) || (sel && (efa->f & SELECT)==0))
continue;
tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@ -586,7 +582,7 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
return;
}
liveHandle = construct_param_handle(scene, em, 0, fillholes, 1, 1);
liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1);
param_lscm_begin(liveHandle, PARAM_TRUE, abf);
BKE_mesh_end_editmesh(obedit->data, em);

@ -294,6 +294,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL);
RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions");
RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "goalspring");
@ -313,6 +314,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING);
RNA_def_property_ui_text(prop, "Stiffness Scaling", "If enabled, stiffness can be scaled along a weight painted vertex group");
RNA_def_property_update(prop, 0, "rna_cloth_update");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "Cdis");

@ -770,7 +770,6 @@ static void rna_def_pointcache(BlenderRNA *brna)
prop= RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, point_cache_compress_items);
RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
RNA_def_property_update(prop, 0, NULL);
/* flags */
prop= RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);

@ -803,7 +803,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "axis");
RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input");
RNA_def_property_range(prop, 1, 2);
RNA_def_property_range(prop, 1, 8);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE);

@ -241,13 +241,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
RNA_def_property_enum_items(prop, smoke_cache_comp_items);
RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
RNA_def_property_update(prop, 0, NULL);
prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "border_collisions");
RNA_def_property_enum_items(prop, smoke_domain_colli_items);
RNA_def_property_ui_text(prop, "Border Collisions", "Selects which domain border will be treated as collision object.");
RNA_def_property_update(prop, 0, NULL);
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EffectorWeights");
@ -290,14 +289,12 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 0.001, 1);
RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4);
RNA_def_property_ui_text(prop, "Density", "");
RNA_def_property_update(prop, 0, NULL); // NC_OBJECT|ND_MODIFIER
prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "temp");
RNA_def_property_range(prop, -10, 10);
RNA_def_property_ui_range(prop, -10, 10, 1, 1);
RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
RNA_def_property_update(prop, 0, NULL);
prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "psys");
@ -309,24 +306,20 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW);
RNA_def_property_ui_text(prop, "Outflow", "Deletes smoke from simulation");
RNA_def_property_update(prop, 0, NULL);
prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE);
RNA_def_property_ui_text(prop, "Absolute Density", "Only allows given density value in emitter area.");
RNA_def_property_update(prop, 0, NULL);
prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY);
RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits it's velocity from the emitter particle");
RNA_def_property_update(prop, 0, NULL);
prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vel_multi");
RNA_def_property_range(prop, -2.0, 2.0);
RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke");
RNA_def_property_update(prop, 0, NULL);
}
static void rna_def_smoke_coll_settings(BlenderRNA *brna)

@ -84,7 +84,9 @@ int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
{
if(pysrna->ptr.type)
return 0;
PyErr_Format(PyExc_ReferenceError, "StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name);
PyErr_Format(PyExc_ReferenceError,
"StructRNA of type %.200s has been removed",
Py_TYPE(pysrna)->tp_name);
return -1;
}
@ -790,18 +792,23 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
const char *name;
if(!PYRNA_STRUCT_IS_VALID(self)) {
return PyUnicode_FromFormat("<bpy_struct, %.200s dead>", Py_TYPE(self)->tp_name);
return PyUnicode_FromFormat("<bpy_struct, %.200s dead>",
Py_TYPE(self)->tp_name);
}
/* print name if available */
name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
if(name) {
ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), name);
ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
RNA_struct_identifier(self->ptr.type),
name);
MEM_freeN((void *)name);
return ret;
}
return PyUnicode_FromFormat("<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
return PyUnicode_FromFormat("<bpy_struct, %.200s at %p>",
RNA_struct_identifier(self->ptr.type),
self->ptr.data);
}
static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
@ -811,18 +818,26 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
return pyrna_struct_str(self); /* fallback */
if(RNA_struct_is_ID(self->ptr.type)) {
return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]",
BKE_idcode_to_name_plural(GS(id->name)),
id->name+2);
}
else {
PyObject *ret;
const char *path;
path= RNA_path_from_ID_to_struct(&self->ptr);
if(path) {
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s",
BKE_idcode_to_name_plural(GS(id->name)),
id->name+2,
path);
MEM_freeN((void *)path);
}
else { /* cant find, print something sane */
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type));
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s",
BKE_idcode_to_name_plural(GS(id->name)),
id->name+2,
RNA_struct_identifier(self->ptr.type));
}
return ret;
@ -870,7 +885,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
if(name) {
ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
type_fmt,
RNA_struct_identifier(self->ptr.type),
RNA_property_identifier(self->prop),
name);
MEM_freeN((void *)name);
return ret;
}
@ -878,11 +897,16 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
if(RNA_property_type(self->prop) == PROP_COLLECTION) {
PointerRNA r_ptr;
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
return PyUnicode_FromFormat("<bpy_%.200s, %.200s>", type_fmt, RNA_struct_identifier(r_ptr.type));
return PyUnicode_FromFormat("<bpy_%.200s, %.200s>",
type_fmt,
RNA_struct_identifier(r_ptr.type));
}
}
return PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
return PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s>",
type_fmt,
RNA_struct_identifier(self->ptr.type),
RNA_property_identifier(self->prop));
}
static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
@ -902,7 +926,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
MEM_freeN((void *)path);
}
else { /* cant find, print something sane */
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop));
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s",
BKE_idcode_to_name_plural(GS(id->name)),
id->name+2,
RNA_property_identifier(self->prop));
}
return ret;
@ -911,7 +938,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
static PyObject *pyrna_func_repr(BPy_FunctionRNA *self)
{
return PyUnicode_FromFormat("<%.200s %.200s.%.200s()>", Py_TYPE(self)->tp_name, RNA_struct_identifier(self->ptr.type), RNA_function_identifier(self->func));
return PyUnicode_FromFormat("<%.200s %.200s.%.200s()>",
Py_TYPE(self)->tp_name,
RNA_struct_identifier(self->ptr.type),
RNA_function_identifier(self->func));
}
@ -2995,7 +3025,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
else if (self->ptr.type == &RNA_Context) {
bContext *C= self->ptr.data;
if(C==NULL) {
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name);
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context is 'NULL', can't get \"%.200s\" from context",
name);
ret= NULL;
}
else {
@ -3054,7 +3086,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
}
else {
#if 0
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name);
PyErr_Format(PyExc_AttributeError,
"bpy_struct: attribute \"%.200s\" not found",
name);
ret= NULL;
#endif
/* Include this incase this instance is a subtype of a python class
@ -3170,7 +3204,9 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
const char *attr_str= _PyUnicode_AsString(attr);
int ret= RNA_def_property_free_identifier(srna, attr_str);
if (ret == -1) {
PyErr_Format(PyExc_TypeError, "struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str);
PyErr_Format(PyExc_TypeError,
"struct_meta_idprop.detattr(): '%s' not a dynamic property",
attr_str);
return -1;
}
}
@ -3208,7 +3244,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
/* code just raises correct error, context prop's cant be set, unless its apart of the py class */
bContext *C= self->ptr.data;
if(C==NULL) {
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context", name);
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context is 'NULL', can't set \"%.200s\" from context",
name);
return -1;
}
else {
@ -3219,7 +3257,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
if(done==1) {
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context property \"%.200s\" is read-only", name);
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context property \"%.200s\" is read-only",
name);
BLI_freelistN(&newlb);
return -1;
}
@ -3363,7 +3403,9 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam
}
}
PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" not found", name);
PyErr_Format(PyExc_AttributeError,
"bpy_prop_collection: attribute \"%.200s\" not found",
name);
return -1;
}
@ -4048,11 +4090,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
}
/* error, invalid type given */
PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct", type->tp_name);
PyErr_Format(PyExc_TypeError,
"bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct",
type->tp_name);
return NULL;
}
else {
PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): expected a single argument");
PyErr_Format(PyExc_TypeError,
"bpy_struct.__new__(type): expected a single argument");
return NULL;
}
}
@ -4077,7 +4122,9 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
return (PyObject *)ret;
}
else {
PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop", type->tp_name);
PyErr_Format(PyExc_TypeError,
"bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop",
type->tp_name);
return NULL;
}
}
@ -4139,7 +4186,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
}
break;
default:
PyErr_Format(PyExc_TypeError, "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)", type);
PyErr_Format(PyExc_TypeError,
"RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
type);
ret= NULL;
break;
}
@ -4237,7 +4286,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
break;
}
default:
PyErr_Format(PyExc_TypeError, "RNA Error: unknown type \"%d\" (pyrna_param_to_py)", type);
PyErr_Format(PyExc_TypeError,
"RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
type);
ret= NULL;
break;
}

@ -2084,14 +2084,21 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
if(tex->ima) {
// crazy hack solution that gives results similar to normal mapping - part 2
float vec[2];
int dimx=512, dimy=512;
ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
if (ibuf) {
dimx = ibuf->x;
dimy = ibuf->y;
}
// crazy hack solution that gives results similar to normal mapping - part 2
vec[0] = tex->ima->gen_x*dxt[0];
vec[1] = tex->ima->gen_y*dxt[1];
vec[0] = dimx*dxt[0];
vec[1] = dimy*dxt[1];
dHdx *= 1.0f/len_v2(vec);
vec[0] = tex->ima->gen_x*dyt[0];
vec[1] = tex->ima->gen_y*dyt[1];
vec[0] = dimx*dyt[0];
vec[1] = dimy*dyt[1];
dHdy *= 1.0f/len_v2(vec);
}
}