Merging r38265 through r38295 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin 2011-07-11 08:43:34 +00:00
commit 1135dbcc36
47 changed files with 137 additions and 158 deletions

@ -792,11 +792,8 @@ elseif(WIN32)
if(WITH_IMAGE_OPENEXR) if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/gcc/openexr) set(OPENEXR ${LIBDIR}/gcc/openexr)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR) set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread) set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
set(OPENEXR_LIBPATH ${OPENEXR}/lib) set(OPENEXR_LIBPATH ${OPENEXR}/lib)
# TODO, gives linking errors, force off
set(WITH_IMAGE_OPENEXR OFF)
endif() endif()
if(WITH_IMAGE_TIFF) if(WITH_IMAGE_TIFF)

@ -82,8 +82,6 @@ add_library(bli_lib
"../../../source/blender/blenlib/intern/BLI_memarena.c" "../../../source/blender/blenlib/intern/BLI_memarena.c"
) )
message(STATUS "EEEk ${SRC_NEW}")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)

@ -48,8 +48,6 @@ def paths():
def modules(module_cache): def modules(module_cache):
import os import os
import sys
import time
path_list = paths() path_list = paths()
@ -173,11 +171,9 @@ def enable(module_name, default_set=True):
:return: the loaded module or None on failier. :return: the loaded module or None on failier.
:rtype: module :rtype: module
""" """
# note, this still gets added to _bpy_types.TypeMap
import os import os
import sys import sys
import bpy_types as _bpy_types
import imp import imp
def handle_error(): def handle_error():
@ -246,8 +242,6 @@ def disable(module_name, default_set=True):
:type module_name: string :type module_name: string
""" """
import sys import sys
import bpy_types as _bpy_types
mod = sys.modules.get(module_name) mod = sys.modules.get(module_name)
# possible this addon is from a previous session and didnt load a module this time. # possible this addon is from a previous session and didnt load a module this time.

@ -29,7 +29,7 @@ op_as_string = ops_module.as_string
op_get_rna = ops_module.get_rna op_get_rna = ops_module.get_rna
class bpy_ops(object): class BPyOps(object):
''' '''
Fake module like class. Fake module like class.
@ -42,7 +42,7 @@ class bpy_ops(object):
''' '''
if module.startswith('__'): if module.startswith('__'):
raise AttributeError(module) raise AttributeError(module)
return bpy_ops_submodule(module) return BPyOpsSubMod(module)
def __dir__(self): def __dir__(self):
@ -67,7 +67,7 @@ class bpy_ops(object):
return "<module like class 'bpy.ops'>" return "<module like class 'bpy.ops'>"
class bpy_ops_submodule(object): class BPyOpsSubMod(object):
''' '''
Utility class to fake submodules. Utility class to fake submodules.
@ -84,7 +84,7 @@ class bpy_ops_submodule(object):
''' '''
if func.startswith('__'): if func.startswith('__'):
raise AttributeError(func) raise AttributeError(func)
return bpy_ops_submodule_op(self.module, func) return BPyOpsSubModOp(self.module, func)
def __dir__(self): def __dir__(self):
@ -103,7 +103,7 @@ class bpy_ops_submodule(object):
return "<module like class 'bpy.ops.%s'>" % self.module return "<module like class 'bpy.ops.%s'>" % self.module
class bpy_ops_submodule_op(object): class BPyOpsSubModOp(object):
''' '''
Utility class to fake submodule operators. Utility class to fake submodule operators.
@ -151,7 +151,7 @@ class bpy_ops_submodule_op(object):
self.func = func self.func = func
def poll(self, *args): def poll(self, *args):
C_dict, C_exec = __class__._parse_args(args) C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
return op_poll(self.idname_py(), C_dict, C_exec) return op_poll(self.idname_py(), C_dict, C_exec)
def idname(self): def idname(self):
@ -170,16 +170,16 @@ class bpy_ops_submodule_op(object):
wm = context.window_manager wm = context.window_manager
# run to account for any rna values the user changes. # run to account for any rna values the user changes.
__class__._scene_update(context) BPyOpsSubModOp._scene_update(context)
if args: if args:
C_dict, C_exec = __class__._parse_args(args) C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
ret = op_call(self.idname_py(), C_dict, kw, C_exec) ret = op_call(self.idname_py(), C_dict, kw, C_exec)
else: else:
ret = op_call(self.idname_py(), None, kw) ret = op_call(self.idname_py(), None, kw)
if 'FINISHED' in ret and context.window_manager == wm: if 'FINISHED' in ret and context.window_manager == wm:
__class__._scene_update(context) BPyOpsSubModOp._scene_update(context)
return ret return ret
@ -208,4 +208,4 @@ class bpy_ops_submodule_op(object):
return "<function bpy.ops.%s.%s at 0x%x'>" % \ return "<function bpy.ops.%s.%s at 0x%x'>" % \
(self.module, self.func, id(self)) (self.module, self.func, id(self))
ops_fake_module = bpy_ops() ops_fake_module = BPyOps()

@ -99,7 +99,7 @@ def load_image(imagepath,
return _image_load(nfilepath) return _image_load(nfilepath)
if place_holder: if place_holder:
image = bpy.data.images.new(os.path.basename(filepath), 128, 128) image = bpy.data.images.new(os.path.basename(imagepath), 128, 128)
# allow the path to be resolved later # allow the path to be resolved later
image.filepath = imagepath image.filepath = imagepath
return image return image

@ -262,7 +262,7 @@ def path_reference(filepath, base_src, base_dst, mode='AUTO', copy_subdir="", co
filepath_abs = filepath_cpy filepath_abs = filepath_cpy
mode = 'RELATIVE' mode = 'RELATIVE'
else: else:
Excaption("invalid mode given %r" % mode) raise Exception("invalid mode given %r" % mode)
if mode == 'ABSOLUTE': if mode == 'ABSOLUTE':
return filepath_abs return filepath_abs

@ -212,8 +212,6 @@ def edge_loops_from_edges(mesh, edges=None):
if not hasattr(edges, "pop"): if not hasattr(edges, "pop"):
edges = edges[:] edges = edges[:]
edge_dict = {ed.key: ed for ed in mesh.edges if ed.select}
while edges: while edges:
current_edge = edges.pop() current_edge = edges.pop()
vert_end, vert_start = current_edge.vertices[:] vert_end, vert_start = current_edge.vertices[:]
@ -300,7 +298,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
if verts[i][1] == verts[i - 1][0]: if verts[i][1] == verts[i - 1][0]:
verts.pop(i - 1) verts.pop(i - 1)
fill = fill_polygon([verts]) fill = tesselate_polygon([verts])
else: else:
''' '''

@ -22,7 +22,6 @@ __all__ = (
"region_2d_to_vector_3d", "region_2d_to_vector_3d",
"region_2d_to_location_3d", "region_2d_to_location_3d",
"location_3d_to_region_2d", "location_3d_to_region_2d",
"location_3d_to_region_2d",
) )

@ -241,7 +241,7 @@ class _GenericBone:
chain.append(child) chain.append(child)
else: else:
if len(children_basename): if len(children_basename):
print("multiple basenames found, this is probably not what you want!", bone.name, children_basename) print("multiple basenames found, this is probably not what you want!", self.name, children_basename)
break break

@ -22,7 +22,6 @@
import bpy as _bpy import bpy as _bpy
import bpyml import bpyml
from bpyml import TAG, ARGS, CHILDREN from bpyml import TAG, ARGS, CHILDREN
from types import ModuleType
_uilayout_rna = _bpy.types.UILayout.bl_rna _uilayout_rna = _bpy.types.UILayout.bl_rna

@ -114,7 +114,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
to_dict = getattr(val, "to_dict", None) to_dict = getattr(val, "to_dict", None)
to_list = getattr(val, "to_list", None) to_list = getattr(val, "to_list", None)
val_orig = val # val_orig = val # UNUSED
if to_dict: if to_dict:
val = to_dict() val = to_dict()
val_draw = str(val) val_draw = str(val)

@ -121,7 +121,6 @@ class ProjectEdit(bpy.types.Operator):
def execute(self, context): def execute(self, context):
import os import os
import subprocess
EXT = "png" # could be made an option but for now ok EXT = "png" # could be made an option but for now ok

@ -87,8 +87,6 @@ class MeshMirrorUV(bpy.types.Operator):
def execute(self, context): def execute(self, context):
DIR = (self.direction == 'NEGATIVE') DIR = (self.direction == 'NEGATIVE')
from mathutils import Vector
ob = context.active_object ob = context.active_object
is_editmode = (ob.mode == 'EDIT') is_editmode = (ob.mode == 'EDIT')
if is_editmode: if is_editmode:

@ -98,8 +98,6 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
# Main Loop # Main Loop
for obj, bb_world in objs: for obj, bb_world in objs:
loc_world = obj.location
bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box] bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box]
Left_Up_Front = bb_world[1] Left_Up_Front = bb_world[1]

@ -315,7 +315,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator):
@property @property
def preset_subdir(self): def preset_subdir(self):
return __class__.operator_path(self.operator) return AddPresetOperator.operator_path(self.operator)
@property @property
def preset_values(self): def preset_values(self):

@ -78,7 +78,7 @@ class PlayRenderedAnim(bpy.types.Operator):
preset = prefs.filepaths.animation_player_preset preset = prefs.filepaths.animation_player_preset
player_path = prefs.filepaths.animation_player player_path = prefs.filepaths.animation_player
file_path = bpy.path.abspath(rd.filepath) # file_path = bpy.path.abspath(rd.filepath) # UNUSED
is_movie = rd.is_movie_format is_movie = rd.is_movie_format
# try and guess a command line if it doesn't exist # try and guess a command line if it doesn't exist

@ -42,7 +42,6 @@ def extend(obj, operator, EXTEND_MODE):
edge_average_lengths = {} edge_average_lengths = {}
OTHER_INDEX = 2, 3, 0, 1 OTHER_INDEX = 2, 3, 0, 1
FAST_INDICIES = 0, 2, 1, 3 # order is faster
def extend_uvs(face_source, face_target, edge_key): def extend_uvs(face_source, face_target, edge_key):
''' '''

@ -444,7 +444,7 @@ def lightmap_uvpack(meshes,
del even_dict del even_dict
del odd_dict del odd_dict
orig = len(pretty_faces) # orig = len(pretty_faces)
pretty_faces = [pf for pf in pretty_faces if not pf.has_parent] pretty_faces = [pf for pf in pretty_faces if not pf.has_parent]
@ -489,7 +489,10 @@ def lightmap_uvpack(meshes,
if PREF_APPLY_IMAGE: if PREF_APPLY_IMAGE:
if not PREF_PACK_IN_ONE: if not PREF_PACK_IN_ONE:
image = Image.New("lightmap", PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24) image = bpy.data.images.new(name="lightmap",
width=PREF_IMG_PX_SIZE,
height=PREF_IMG_PX_SIZE,
)
for f in face_sel: for f in face_sel:
# f.image = image # f.image = image
@ -530,7 +533,7 @@ def unwrap(operator, context, **kwargs):
return {'FINISHED'} return {'FINISHED'}
from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty from bpy.props import BoolProperty, FloatProperty, IntProperty
class LightMapPack(bpy.types.Operator): class LightMapPack(bpy.types.Operator):

@ -94,4 +94,5 @@ class OnionSkinButtonsPanel():
col.prop(arm, "show_only_ghost_selected", text="Selected Only") col.prop(arm, "show_only_ghost_selected", text="Selected Only")
if __name__ == "__main__": # only for live edit. if __name__ == "__main__": # only for live edit.
import bpy
bpy.utils.register_module(__name__) bpy.utils.register_module(__name__)

@ -299,10 +299,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # in
return (context.object) and (context.armature) return (context.object) and (context.armature)
def draw(self, context): def draw(self, context):
layout = self.layout
ob = context.object ob = context.object
self.draw_settings(context, ob.pose.animation_visualisation, bones=True) self.draw_settings(context, ob.pose.animation_visualisation, bones=True)

@ -122,7 +122,6 @@ class DATA_PT_curve_texture_space(CurveButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ob = context.object
curve = context.curve curve = context.curve
row = layout.row() row = layout.row()

@ -34,7 +34,6 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
space = context.space_data space = context.space_data
ob = context.object
if space.use_pin_id: if space.use_pin_id:
layout.template_ID(space, "pin_id") layout.template_ID(space, "pin_id")

@ -208,7 +208,7 @@ class TextureSlotPanel(TextureButtonsPanel):
return False return False
engine = context.scene.render.engine engine = context.scene.render.engine
return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES) return TextureButtonsPanel.poll(cls, context) and (engine in cls.COMPAT_ENGINES)
# Texture Type Panels # # Texture Type Panels #

@ -434,7 +434,6 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
rd = context.scene.render
sima = context.space_data sima = context.space_data
# display even when not in game mode because these settings effect the 3d view # display even when not in game mode because these settings effect the 3d view
return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME') return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME')

@ -126,7 +126,7 @@ class USERPREF_MT_appconfigs(bpy.types.Menu):
preset_operator = "wm.appconfig_activate" preset_operator = "wm.appconfig_activate"
def draw(self, context): def draw(self, context):
props = self.layout.operator("wm.appconfig_default", text="Blender (default)") self.layout.operator("wm.appconfig_default", text="Blender (default)")
# now draw the presets # now draw the presets
bpy.types.Menu.draw_preset(self, context) bpy.types.Menu.draw_preset(self, context)
@ -986,7 +986,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
split.label(text="Warning:") split.label(text="Warning:")
split.label(text=' ' + info["warning"], icon='ERROR') split.label(text=' ' + info["warning"], icon='ERROR')
user_addon = __class__.is_user_addon(mod, user_addon_paths) user_addon = USERPREF_PT_addons.is_user_addon(mod, user_addon_paths)
tot_row = bool(info["wiki_url"]) + bool(info["tracker_url"]) + bool(user_addon) tot_row = bool(info["wiki_url"]) + bool(info["tracker_url"]) + bool(user_addon)
if tot_row: if tot_row:
@ -1124,7 +1124,6 @@ class WM_OT_addon_install(bpy.types.Operator):
del pyfile_dir del pyfile_dir
# done checking for exceptional case # done checking for exceptional case
addon_files_old = set(os.listdir(path_addons))
addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)}
#check to see if the file is in compressed format (.zip) #check to see if the file is in compressed format (.zip)
@ -1137,7 +1136,7 @@ class WM_OT_addon_install(bpy.types.Operator):
if self.overwrite: if self.overwrite:
for f in file_to_extract.namelist(): for f in file_to_extract.namelist():
__class__._module_remove(path_addons, f) WM_OT_addon_install._module_remove(path_addons, f)
else: else:
for f in file_to_extract.namelist(): for f in file_to_extract.namelist():
path_dest = os.path.join(path_addons, os.path.basename(f)) path_dest = os.path.join(path_addons, os.path.basename(f))
@ -1161,7 +1160,7 @@ class WM_OT_addon_install(bpy.types.Operator):
path_dest = os.path.join(path_addons, os.path.basename(pyfile)) path_dest = os.path.join(path_addons, os.path.basename(pyfile))
if self.overwrite: if self.overwrite:
__class__._module_remove(path_addons, os.path.basename(pyfile)) WM_OT_addon_install._module_remove(path_addons, os.path.basename(pyfile))
elif os.path.exists(path_dest): elif os.path.exists(path_dest):
self.report({'WARNING'}, "File already installed to %r\n" % path_dest) self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
return {'CANCELLED'} return {'CANCELLED'}
@ -1226,7 +1225,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
return None, False return None, False
def execute(self, context): def execute(self, context):
path, isdir = __class__.path_from_addon(self.module) path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
if path is None: if path is None:
self.report('WARNING', "Addon path %r could not be found" % path) self.report('WARNING', "Addon path %r could not be found" % path)
return {'CANCELLED'} return {'CANCELLED'}
@ -1246,7 +1245,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
# lame confirmation check # lame confirmation check
def draw(self, context): def draw(self, context):
self.layout.label(text="Remove Addon: %r?" % self.module) self.layout.label(text="Remove Addon: %r?" % self.module)
path, isdir = __class__.path_from_addon(self.module) path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
self.layout.label(text="Path: %r" % path) self.layout.label(text="Path: %r" % path)
def invoke(self, context, event): def invoke(self, context, event):

@ -189,9 +189,9 @@ class InputKeyMapPanel:
if km.is_modal: if km.is_modal:
row.label(text="", icon='LINKED') row.label(text="", icon='LINKED')
if km.is_user_defined: if km.is_user_defined:
op = row.operator("wm.keymap_restore", text="Restore") row.operator("wm.keymap_restore", text="Restore")
else: else:
op = row.operator("wm.keymap_edit", text="Edit") row.operator("wm.keymap_edit", text="Edit")
if km.show_expanded_children: if km.show_expanded_children:
if children: if children:
@ -213,7 +213,7 @@ class InputKeyMapPanel:
col = self.indented_layout(col, level + 1) col = self.indented_layout(col, level + 1)
subcol = col.split(percentage=0.2).column() subcol = col.split(percentage=0.2).column()
subcol.enabled = km.is_user_defined subcol.enabled = km.is_user_defined
op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
col.separator() col.separator()
@ -234,7 +234,7 @@ class InputKeyMapPanel:
for pname, value in properties.bl_rna.properties.items(): for pname, value in properties.bl_rna.properties.items():
if pname != "rna_type" and not properties.is_property_hidden(pname): if pname != "rna_type" and not properties.is_property_hidden(pname):
if isinstance(value, bpy.types.OperatorProperties): if isinstance(value, bpy.types.OperatorProperties):
__class__.draw_kmi_properties(box, value, title=pname) InputKeyMapPanel.draw_kmi_properties(box, value, title=pname)
else: else:
flow.prop(properties, pname) flow.prop(properties, pname)
@ -325,7 +325,7 @@ class InputKeyMapPanel:
# Operator properties # Operator properties
props = kmi.properties props = kmi.properties
if props is not None: if props is not None:
__class__.draw_kmi_properties(box, props) InputKeyMapPanel.draw_kmi_properties(box, props)
# Modal key maps attached to this operator # Modal key maps attached to this operator
if not km.is_modal: if not km.is_modal:
@ -351,9 +351,9 @@ class InputKeyMapPanel:
row.label() row.label()
if km.is_user_defined: if km.is_user_defined:
op = row.operator("wm.keymap_restore", text="Restore") row.operator("wm.keymap_restore", text="Restore")
else: else:
op = row.operator("wm.keymap_edit", text="Edit") row.operator("wm.keymap_edit", text="Edit")
for kmi in filtered_items: for kmi in filtered_items:
self.draw_kmi(display_keymaps, kc, km, kmi, col, 1) self.draw_kmi(display_keymaps, kc, km, kmi, col, 1)
@ -362,7 +362,7 @@ class InputKeyMapPanel:
col = self.indented_layout(layout, 1) col = self.indented_layout(layout, 1)
subcol = col.split(percentage=0.2).column() subcol = col.split(percentage=0.2).column()
subcol.enabled = km.is_user_defined subcol.enabled = km.is_user_defined
op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
def draw_hierarchy(self, display_keymaps, layout): def draw_hierarchy(self, display_keymaps, layout):
for entry in KM_HIERARCHY: for entry in KM_HIERARCHY:
@ -723,9 +723,7 @@ class WM_OT_keyitem_add(bpy.types.Operator):
bl_label = "Add Key Map Item" bl_label = "Add Key Map Item"
def execute(self, context): def execute(self, context):
wm = context.window_manager
km = context.keymap km = context.keymap
kc = wm.keyconfigs.default
if km.is_modal: if km.is_modal:
km.keymap_items.new_modal("", 'A', 'PRESS') # kmi km.keymap_items.new_modal("", 'A', 'PRESS') # kmi

@ -2435,7 +2435,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
def draw(self, context): def draw(self, context):
import rna_prop_ui import rna_prop_ui
member = __class__._active_context_member(context) member = VIEW3D_PT_context_properties._active_context_member(context)
if member: if member:
# Draw with no edit button # Draw with no edit button

@ -60,7 +60,6 @@ def draw_gpencil_tools(context, layout):
# ********** default tools for objectmode **************** # ********** default tools for objectmode ****************
class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel): class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
bl_context = "objectmode" bl_context = "objectmode"
bl_label = "Object Tools" bl_label = "Object Tools"
@ -466,7 +465,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
settings = __class__.paint_settings(context) settings = self.paint_settings(context)
brush = settings.brush brush = settings.brush
if not context.particle_edit_object: if not context.particle_edit_object:
@ -687,7 +686,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
settings = __class__.paint_settings(context) settings = self.paint_settings(context)
brush = settings.brush brush = settings.brush
tex_slot = brush.texture_slot tex_slot = brush.texture_slot
@ -786,7 +785,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
settings = __class__.paint_settings(context) settings = self.paint_settings(context)
brush = settings.brush brush = settings.brush
col = layout.column(align=True) col = layout.column(align=True)
@ -821,7 +820,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
settings = __class__.paint_settings(context) settings = self.paint_settings(context)
brush = settings.brush brush = settings.brush
image_paint = context.image_paint_object image_paint = context.image_paint_object
@ -944,7 +943,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
tool_settings = context.tool_settings tool_settings = context.tool_settings
sculpt = tool_settings.sculpt sculpt = tool_settings.sculpt
settings = __class__.paint_settings(context)
layout.label(text="Lock:") layout.label(text="Lock:")
row = layout.row(align=True) row = layout.row(align=True)
@ -974,7 +972,6 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
layout = self.layout layout = self.layout
sculpt = context.tool_settings.sculpt sculpt = context.tool_settings.sculpt
settings = __class__.paint_settings(context)
split = layout.split() split = layout.split()
@ -1006,7 +1003,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
settings = __class__.paint_settings(context) settings = self.paint_settings(context)
brush = settings.brush brush = settings.brush
if brush is None: # unlikely but can happen if brush is None: # unlikely but can happen

@ -407,7 +407,7 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo):
# add the property name to the base path # add the property name to the base path
# rotation mode affects the property used # rotation mode affects the property used
if data.rotation_mode == 'QUATERNION': if data.rotation_mode == 'QUATERNION':
path = path_add_property(base_path, "delta_rotation_quaternion") path = keyingsets_utils.path_add_property(base_path, "delta_rotation_quaternion")
elif data.rotation_mode == 'AXIS_ANGLE': elif data.rotation_mode == 'AXIS_ANGLE':
# XXX: for now, this is not available yet # XXX: for now, this is not available yet
#path = path_add_property(base_path, "delta_rotation_axis_angle") #path = path_add_property(base_path, "delta_rotation_axis_angle")

@ -937,6 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
BoidValues val; BoidValues val;
BoidState *state = get_boid_state(boids, pa); BoidState *state = get_boid_state(boids, pa);
BoidParticle *bpa = pa->boid; BoidParticle *bpa = pa->boid;
ParticleSystem *psys = bbd->sim->psys;
int rand; int rand;
//BoidCondition *cond; //BoidCondition *cond;
@ -959,9 +960,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f; bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
/* create random seed for every particle & frame */ /* create random seed for every particle & frame */
BLI_srandom(bbd->sim->psys->seed + p); rand = (int)(PSYS_FRAND(psys->seed + p) * 1000);
rand = BLI_rand(); rand = (int)(PSYS_FRAND((int)bbd->cfra + rand) * 1000);
BLI_srandom((int)bbd->cfra + rand);
set_boid_values(&val, bbd->part->boids, pa); set_boid_values(&val, bbd->part->boids, pa);

@ -600,7 +600,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if(part->ren_as == PART_DRAW_GR && part->dup_group) { if(part->ren_as == PART_DRAW_GR && part->dup_group) {
for(go=part->dup_group->gobject.first; go; go=go->next) { for(go=part->dup_group->gobject.first; go; go=go->next) {
node2 = dag_get_node(dag, go->ob); node2 = dag_get_node(dag, go->ob);
dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Group Visualisation"); dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation");
} }
} }

@ -2889,8 +2889,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
if(psys_in_edit_mode(sim->scene, psys)) if(psys_in_edit_mode(sim->scene, psys))
if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0) if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
return; return;
BLI_srandom(psys->seed);
keyed = psys->flag & PSYS_KEYED; keyed = psys->flag & PSYS_KEYED;
baked = psys->pointcache->mem_cache.first && psys->part->type != PART_HAIR; baked = psys->pointcache->mem_cache.first && psys->part->type != PART_HAIR;
@ -4374,58 +4372,45 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
Object *ob = sim->ob; Object *ob = sim->ob;
ParticleSystem *psys = sim->psys; ParticleSystem *psys = sim->psys;
ParticleSystemModifierData *psmd = sim->psmd; ParticleSystemModifierData *psmd = sim->psmd;
float loc[3], nor[3], vec[3], side[3], len, obrotmat[4][4], qmat[4][4]; float loc[3], nor[3], vec[3], side[3], len;
float xvec[3] = {-1.0, 0.0, 0.0}, q[4], nmat[3][3]; float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co); sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co);
len= normalize_v3(vec); len= normalize_v3(vec);
if(psys->part->rotmode) { if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
if(pa == NULL) pa = psys->particles + cpa->pa[0];
pa= psys->particles+cpa->pa[0];
vec_to_quat( q,xvec, ob->trackflag, ob->upflag); if(pa)
quat_to_mat4( obrotmat,q); psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
obrotmat[3][3]= 1.0f; else
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
quat_to_mat4( qmat,pa->state.rot);
mul_m4_m4m4(mat, obrotmat, qmat);
}
else {
if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
pa = psys->particles + cpa->pa[0];
if(pa)
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
else
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
copy_m3_m4(nmat, ob->imat); copy_m3_m4(nmat, ob->imat);
transpose_m3(nmat); transpose_m3(nmat);
mul_m3_v3(nmat, nor); mul_m3_v3(nmat, nor);
/* make sure that we get a proper side vector */ /* make sure that we get a proper side vector */
if(fabs(dot_v3v3(nor,vec))>0.999999) { if(fabs(dot_v3v3(nor,vec))>0.999999) {
if(fabs(dot_v3v3(nor,xvec))>0.999999) { if(fabs(dot_v3v3(nor,xvec))>0.999999) {
nor[0] = 0.0f; nor[0] = 0.0f;
nor[1] = 1.0f; nor[1] = 1.0f;
nor[2] = 0.0f; nor[2] = 0.0f;
} }
else { else {
nor[0] = 1.0f; nor[0] = 1.0f;
nor[1] = 0.0f; nor[1] = 0.0f;
nor[2] = 0.0f; nor[2] = 0.0f;
}
} }
cross_v3_v3v3(side, nor, vec);
normalize_v3(side);
cross_v3_v3v3(nor, vec, side);
unit_m4(mat);
VECCOPY(mat[0], vec);
VECCOPY(mat[1], side);
VECCOPY(mat[2], nor);
} }
cross_v3_v3v3(side, nor, vec);
normalize_v3(side);
cross_v3_v3v3(nor, vec, side);
unit_m4(mat);
VECCOPY(mat[0], vec);
VECCOPY(mat[1], side);
VECCOPY(mat[2], nor);
*scale= len; *scale= len;
} }

@ -3510,13 +3510,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
static void hair_step(ParticleSimulationData *sim, float cfra) static void hair_step(ParticleSimulationData *sim, float cfra)
{ {
ParticleSystem *psys = sim->psys; ParticleSystem *psys = sim->psys;
/* ParticleSettings *part = psys->part; */ ParticleSettings *part = psys->part;
PARTICLE_P; PARTICLE_P;
float disp = (float)psys_get_current_display_percentage(psys)/100.0f; float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
BLI_srandom(psys->seed);
LOOP_PARTICLES { LOOP_PARTICLES {
pa->size = part->size;
if(part->randsize > 0.0f)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
if(PSYS_FRAND(p) > disp) if(PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP; pa->flag |= PARS_NO_DISP;
else else
@ -3801,8 +3803,6 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
PARTICLE_P; PARTICLE_P;
float disp, dietime; float disp, dietime;
BLI_srandom(psys->seed);
psys_update_effectors(sim); psys_update_effectors(sim);
disp= (float)psys_get_current_display_percentage(psys)/100.0f; disp= (float)psys_get_current_display_percentage(psys)/100.0f;
@ -4054,7 +4054,6 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* set particles to be not calculated TODO: can't work with pointcache */ /* set particles to be not calculated TODO: can't work with pointcache */
disp= (float)psys_get_current_display_percentage(psys)/100.0f; disp= (float)psys_get_current_display_percentage(psys)/100.0f;
BLI_srandom(psys->seed);
LOOP_PARTICLES { LOOP_PARTICLES {
if(PSYS_FRAND(p) > disp) if(PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP; pa->flag |= PARS_NO_DISP;

@ -1486,6 +1486,10 @@ int BKE_texture_dependsOnTime(const struct Tex *texture)
// assume anything in adt means the texture is animated // assume anything in adt means the texture is animated
return 1; return 1;
} }
else if(texture->type == TEX_NOISE) {
// noise always varies with time
return 1;
}
return 0; return 0;
} }

@ -1189,8 +1189,9 @@ void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, MVer
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert) void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert)
{ {
if(bvh->grids) { if(bvh->grids) {
if(totvert) *totvert= node->totprim*bvh->gridsize*bvh->gridsize; const int tot= node->totprim*bvh->gridsize*bvh->gridsize;
if(uniquevert) *uniquevert= *totvert; if(totvert) *totvert= tot;
if(uniquevert) *uniquevert= tot;
} }
else { else {
if(totvert) *totvert= node->uniq_verts + node->face_verts; if(totvert) *totvert= node->uniq_verts + node->face_verts;

@ -4986,6 +4986,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
where_is_pose(t->scene, pose_ob); where_is_pose(t->scene, pose_ob);
} }
/* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */
if (!cancelled && (t->mode != TFM_DUMMY))
count_set_pose_transflags(&t->mode, t->around, ob);
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */ /* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
if (!cancelled && t->mode==TFM_TRANSLATION) if (!cancelled && t->mode==TFM_TRANSLATION)
targetless_ik= apply_targetless_ik(ob); targetless_ik= apply_targetless_ik(ob);
@ -5002,8 +5006,6 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */ /* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */
if (!cancelled && (t->mode != TFM_DUMMY)) { if (!cancelled && (t->mode != TFM_DUMMY)) {
/* set BONE_TRANSFORM flags, they get changed by manipulator draw */
count_set_pose_transflags(&t->mode, t->around, ob);
autokeyframe_pose_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik); autokeyframe_pose_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
} }

@ -226,7 +226,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
GPUShadeInput shi; GPUShadeInput shi;
GPUShadeResult shr; GPUShadeResult shr;
bNodeSocket *sock; bNodeSocket *sock;
char hasinput[NUM_MAT_IN]; char hasinput[NUM_MAT_IN]= {'\0'};
int i; int i;
/* note: cannot use the in[]->hasinput flags directly, as these are not necessarily /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily

@ -36,8 +36,6 @@
#include "BLI_path_util.h" #include "BLI_path_util.h"
#endif #endif
#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
/* array utility function */ /* array utility function */
int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix) int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix)
{ {

@ -50,4 +50,6 @@ void PyC_MainModule_Restore(PyObject *main_mod);
void PyC_SetHomePath(const char *py_path_bundle); void PyC_SetHomePath(const char *py_path_bundle);
#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
#endif // PY_CAPI_UTILS_H #endif // PY_CAPI_UTILS_H

@ -41,6 +41,8 @@
#include "bpy_driver.h" #include "bpy_driver.h"
#include "../generic/py_capi_utils.h"
/* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */ /* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */
PyObject *bpy_pydriver_Dict= NULL; PyObject *bpy_pydriver_Dict= NULL;
@ -87,7 +89,7 @@ int bpy_pydriver_create_dict(void)
void BPY_driver_reset(void) void BPY_driver_reset(void)
{ {
PyGILState_STATE gilstate; PyGILState_STATE gilstate;
int use_gil= 1; // (PyThreadState_Get()==NULL); int use_gil= !PYC_INTERPRETER_ACTIVE;
if(use_gil) if(use_gil)
gilstate= PyGILState_Ensure(); gilstate= PyGILState_Ensure();
@ -120,7 +122,7 @@ static void pydriver_error(ChannelDriver *driver)
* *
* note: PyGILState_Ensure() isnt always called because python can call the * note: PyGILState_Ensure() isnt always called because python can call the
* bake operator which intern starts a thread which calls scene update which * bake operator which intern starts a thread which calls scene update which
* does a driver update. to avoid a deadlock check PyThreadState_Get() if PyGILState_Ensure() is needed. * does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE if PyGILState_Ensure() is needed.
*/ */
float BPY_driver_exec(ChannelDriver *driver) float BPY_driver_exec(ChannelDriver *driver)
{ {
@ -147,7 +149,7 @@ float BPY_driver_exec(ChannelDriver *driver)
return 0.0f; return 0.0f;
} }
use_gil= 1; //(PyThreadState_Get()==NULL); use_gil= !PYC_INTERPRETER_ACTIVE;
if(use_gil) if(use_gil)
gilstate= PyGILState_Ensure(); gilstate= PyGILState_Ensure();

@ -663,7 +663,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
#include "BLI_storage.h" #include "BLI_storage.h"
/* TODO, reloading the module isnt functional at the moment. */ /* TODO, reloading the module isnt functional at the moment. */
extern int main_python(int argc, const char **argv); static void bpy_module_free(void *mod);
extern int main_python_enter(int argc, const char **argv);
extern void main_python_exit(void);
static struct PyModuleDef bpy_proxy_def= { static struct PyModuleDef bpy_proxy_def= {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"bpy", /* m_name */ "bpy", /* m_name */
@ -673,8 +675,8 @@ static struct PyModuleDef bpy_proxy_def= {
NULL, /* m_reload */ NULL, /* m_reload */
NULL, /* m_traverse */ NULL, /* m_traverse */
NULL, /* m_clear */ NULL, /* m_clear */
NULL, /* m_free */ bpy_module_free, /* m_free */
}; };
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
@ -699,7 +701,7 @@ void bpy_module_delay_init(PyObject *bpy_proxy)
// printf("module found %s\n", argv[0]); // printf("module found %s\n", argv[0]);
main_python(argc, argv); main_python_enter(argc, argv);
/* initialized in BPy_init_modules() */ /* initialized in BPy_init_modules() */
PyDict_Update(PyModule_GetDict(bpy_proxy), PyModule_GetDict(bpy_package_py)); PyDict_Update(PyModule_GetDict(bpy_proxy), PyModule_GetDict(bpy_package_py));
@ -756,4 +758,9 @@ PyInit_bpy(void)
return bpy_proxy; return bpy_proxy;
} }
static void bpy_module_free(void *UNUSED(mod))
{
main_python_exit();
}
#endif #endif

@ -3847,9 +3847,11 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
case PROP_RAW_DOUBLE: case PROP_RAW_DOUBLE:
item= PyFloat_FromDouble((double) ((double *)array)[i]); item= PyFloat_FromDouble((double) ((double *)array)[i]);
break; break;
case PROP_RAW_UNSET: default: /* PROP_RAW_UNSET */
/* should never happen */ /* should never happen */
BLI_assert(!"Invalid array type - get"); BLI_assert(!"Invalid array type - get");
item= Py_None;
Py_INCREF(item);
break; break;
} }

@ -1798,10 +1798,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
pa_size = pa->size; pa_size = pa->size;
BLI_srandom(psys->seed+a); r_tilt = 2.0f*(PSYS_FRAND(a) - 0.5f);
r_length = PSYS_FRAND(a+1);
r_tilt = 2.0f*(BLI_frand() - 0.5f);
r_length = BLI_frand();
if(path_nbr) { if(path_nbr) {
cache = psys->pathcache[a]; cache = psys->pathcache[a];
@ -2047,7 +2045,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
mul_m4_v3(psys->parent->obmat, state.co); mul_m4_v3(psys->parent->obmat, state.co);
if(use_duplimat) if(use_duplimat)
mul_m4_v4(duplimat, state.co); mul_m4_v3(duplimat, state.co);
if(part->ren_as == PART_DRAW_BB) { if(part->ren_as == PART_DRAW_BB) {
bb.random = random; bb.random = random;

@ -1142,7 +1142,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
#ifdef WITH_PYTHON_MODULE #ifdef WITH_PYTHON_MODULE
/* allow python module to call main */ /* allow python module to call main */
#define main main_python #define main main_python_enter
static void *evil_C= NULL;
#endif #endif
int main(int argc, const char **argv) int main(int argc, const char **argv)
@ -1153,6 +1154,7 @@ int main(int argc, const char **argv)
#ifdef WITH_PYTHON_MODULE #ifdef WITH_PYTHON_MODULE
#undef main #undef main
evil_C= C;
#endif #endif
#ifdef WITH_BINRELOC #ifdef WITH_BINRELOC
@ -1325,6 +1327,14 @@ int main(int argc, const char **argv)
return 0; return 0;
} /* end of int main(argc,argv) */ } /* end of int main(argc,argv) */
#ifdef WITH_PYTHON_MODULE
void main_python_exit(void)
{
WM_exit((bContext *)evil_C);
evil_C= NULL;
}
#endif
static void error_cb(const char *err) static void error_cb(const char *err)
{ {

@ -1147,7 +1147,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
BGE_PROXY_REF(proxy) = NULL; BGE_PROXY_REF(proxy) = NULL;
BGE_PROXY_PTR(proxy) = ptr; BGE_PROXY_PTR(proxy) = ptr;
#ifdef USE_WEAKREFS #ifdef USE_WEAKREFS
BGE_PROXY_WKREF(self->m_proxy) = NULL; BGE_PROXY_WKREF(proxy) = NULL;
#endif #endif
return proxy; return proxy;
} }

@ -1022,10 +1022,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
return NULL; return NULL;
PyObject* argValue = PyTuple_New(2); PyObject* argValue = PyTuple_New(2);
if (argValue) { PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x));
PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x)); PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y));
PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y));
}
if(!PyVecTo(PygetScreenVect(argValue), vect)) if(!PyVecTo(PygetScreenVect(argValue), vect))
{ {

@ -327,7 +327,7 @@ void KX_GameObject::RemoveParent(KX_Scene *scene)
rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1); rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1);
} }
m_pPhysicsController1->RestoreDynamics(); m_pPhysicsController1->RestoreDynamics();
if (m_pPhysicsController1->IsDyna() && rootobj->m_pPhysicsController1) if (m_pPhysicsController1->IsDyna() && (rootobj != NULL && rootobj->m_pPhysicsController1))
{ {
// dynamic object should remember the velocity they had while being parented // dynamic object should remember the velocity they had while being parented
MT_Point3 childPoint = GetSGNode()->GetWorldPosition(); MT_Point3 childPoint = GetSGNode()->GetWorldPosition();