From d5984b2d50c25cdc97ebad70f00b37c523cd757e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Jul 2011 17:41:39 +0000 Subject: [PATCH 01/13] fix [#27683] Blender hangs when baking a particle system when a driver is present --- source/blender/python/generic/py_capi_utils.c | 2 -- source/blender/python/generic/py_capi_utils.h | 2 ++ source/blender/python/intern/bpy_driver.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 801e44bd008..81aea8571f8 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -36,8 +36,6 @@ #include "BLI_path_util.h" #endif -#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL) - /* array utility function */ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix) { diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index bf2eb175882..96c93ab71f8 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -50,4 +50,6 @@ void PyC_MainModule_Restore(PyObject *main_mod); 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 diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index dec393bd1e4..bcd5df97c2c 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -41,6 +41,8 @@ #include "bpy_driver.h" +#include "../generic/py_capi_utils.h" + /* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */ PyObject *bpy_pydriver_Dict= NULL; @@ -87,7 +89,7 @@ int bpy_pydriver_create_dict(void) void BPY_driver_reset(void) { PyGILState_STATE gilstate; - int use_gil= 1; // (PyThreadState_Get()==NULL); + int use_gil= !PYC_INTERPRETER_ACTIVE; if(use_gil) gilstate= PyGILState_Ensure(); @@ -120,7 +122,7 @@ static void pydriver_error(ChannelDriver *driver) * * note: PyGILState_Ensure() isnt always called because python can call the * 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) { @@ -147,7 +149,7 @@ float BPY_driver_exec(ChannelDriver *driver) return 0.0f; } - use_gil= 1; //(PyThreadState_Get()==NULL); + use_gil= !PYC_INTERPRETER_ACTIVE; if(use_gil) gilstate= PyGILState_Ensure(); From 65d1e27ff5b5d315a462c27d9e194561b78072ec Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Jul 2011 19:16:32 +0000 Subject: [PATCH 02/13] fix for using uninitialized value in gpu_shader_material --- intern/ghost/test/CMakeLists.txt | 2 -- source/blender/nodes/intern/SHD_nodes/SHD_material.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt index a012f6af61c..f834b55b387 100644 --- a/intern/ghost/test/CMakeLists.txt +++ b/intern/ghost/test/CMakeLists.txt @@ -82,8 +82,6 @@ add_library(bli_lib "../../../source/blender/blenlib/intern/BLI_memarena.c" ) -message(STATUS "EEEk ${SRC_NEW}") - find_package(OpenGL REQUIRED) diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c index 4e1b53e2026..f78dd9ec727 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c @@ -226,7 +226,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUShadeInput shi; GPUShadeResult shr; bNodeSocket *sock; - char hasinput[NUM_MAT_IN]; + char hasinput[NUM_MAT_IN]= {'\0'}; int i; /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily From 7370ba1839973010dd6e0ed0349c34477d8ece0a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Jul 2011 19:59:32 +0000 Subject: [PATCH 03/13] fix for NULL pointer usages --- source/blender/blenlib/intern/pbvh.c | 5 +++-- source/blender/python/intern/bpy_rna.c | 4 +++- source/gameengine/Expressions/PyObjectPlus.cpp | 2 +- source/gameengine/Ketsji/KX_Camera.cpp | 6 ++---- source/gameengine/Ketsji/KX_GameObject.cpp | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index f7b79b35cbc..85d79ae3b85 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -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) { if(bvh->grids) { - if(totvert) *totvert= node->totprim*bvh->gridsize*bvh->gridsize; - if(uniquevert) *uniquevert= *totvert; + const int tot= node->totprim*bvh->gridsize*bvh->gridsize; + if(totvert) *totvert= tot; + if(uniquevert) *uniquevert= tot; } else { if(totvert) *totvert= node->uniq_verts + node->face_verts; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index c1c7e0ea740..4f6edb02a7c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3847,9 +3847,11 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) case PROP_RAW_DOUBLE: item= PyFloat_FromDouble((double) ((double *)array)[i]); break; - case PROP_RAW_UNSET: + default: /* PROP_RAW_UNSET */ /* should never happen */ BLI_assert(!"Invalid array type - get"); + item= Py_None; + Py_INCREF(item); break; } diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 10906cdae02..3a25df73f9b 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -1147,7 +1147,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v BGE_PROXY_REF(proxy) = NULL; BGE_PROXY_PTR(proxy) = ptr; #ifdef USE_WEAKREFS - BGE_PROXY_WKREF(self->m_proxy) = NULL; + BGE_PROXY_WKREF(proxy) = NULL; #endif return proxy; } diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 473ebbd74bf..c60c931c33b 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -1022,10 +1022,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay, return NULL; PyObject* argValue = PyTuple_New(2); - if (argValue) { - PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x)); - PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y)); - } + PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x)); + PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y)); if(!PyVecTo(PygetScreenVect(argValue), vect)) { diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 47d83c16659..7ca8e7e3b52 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -327,7 +327,7 @@ void KX_GameObject::RemoveParent(KX_Scene *scene) rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1); } 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 MT_Point3 childPoint = GetSGNode()->GetWorldPosition(); From b62a956cc8c9402880d249d0a70c880af5813bc3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Jul 2011 12:51:37 +0000 Subject: [PATCH 04/13] cleanup for python scripts - unused vars and imports --- release/scripts/modules/addon_utils.py | 6 ------ release/scripts/modules/bpy_extras/view3d_utils.py | 1 - release/scripts/modules/bpy_types.py | 2 +- release/scripts/modules/bpyml_ui.py | 1 - release/scripts/modules/rna_prop_ui.py | 2 +- release/scripts/startup/bl_operators/image.py | 1 - release/scripts/startup/bl_operators/mesh.py | 2 -- release/scripts/startup/bl_operators/object_align.py | 2 -- .../startup/bl_operators/screen_play_rendered_anim.py | 2 +- .../scripts/startup/bl_operators/uvcalc_follow_active.py | 1 - release/scripts/startup/bl_operators/uvcalc_lightmap.py | 9 ++++++--- 11 files changed, 9 insertions(+), 20 deletions(-) diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 3877f711b7f..07f1dc618dc 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -48,8 +48,6 @@ def paths(): def modules(module_cache): import os - import sys - import time path_list = paths() @@ -173,11 +171,9 @@ def enable(module_name, default_set=True): :return: the loaded module or None on failier. :rtype: module """ - # note, this still gets added to _bpy_types.TypeMap import os import sys - import bpy_types as _bpy_types import imp def handle_error(): @@ -246,8 +242,6 @@ def disable(module_name, default_set=True): :type module_name: string """ import sys - import bpy_types as _bpy_types - mod = sys.modules.get(module_name) # possible this addon is from a previous session and didnt load a module this time. diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py index 01ac543aec7..c0c0f9186bd 100644 --- a/release/scripts/modules/bpy_extras/view3d_utils.py +++ b/release/scripts/modules/bpy_extras/view3d_utils.py @@ -22,7 +22,6 @@ __all__ = ( "region_2d_to_vector_3d", "region_2d_to_location_3d", "location_3d_to_region_2d", - "location_3d_to_region_2d", ) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index eaa7563c757..f2cd46b20ae 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -241,7 +241,7 @@ class _GenericBone: chain.append(child) else: 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 diff --git a/release/scripts/modules/bpyml_ui.py b/release/scripts/modules/bpyml_ui.py index 1e0522974d1..5df04b8bf34 100644 --- a/release/scripts/modules/bpyml_ui.py +++ b/release/scripts/modules/bpyml_ui.py @@ -22,7 +22,6 @@ import bpy as _bpy import bpyml from bpyml import TAG, ARGS, CHILDREN -from types import ModuleType _uilayout_rna = _bpy.types.UILayout.bl_rna diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index b0fb3b66d0a..388ae2b0e13 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -114,7 +114,7 @@ def draw(layout, context, context_member, property_type, use_edit=True): to_dict = getattr(val, "to_dict", None) to_list = getattr(val, "to_list", None) - val_orig = val + # val_orig = val # UNUSED if to_dict: val = to_dict() val_draw = str(val) diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index 1e5217217dd..34c5b0d922a 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -121,7 +121,6 @@ class ProjectEdit(bpy.types.Operator): def execute(self, context): import os - import subprocess EXT = "png" # could be made an option but for now ok diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 8dca30e54df..03b0e469310 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -87,8 +87,6 @@ class MeshMirrorUV(bpy.types.Operator): def execute(self, context): DIR = (self.direction == 'NEGATIVE') - from mathutils import Vector - ob = context.active_object is_editmode = (ob.mode == 'EDIT') if is_editmode: diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index 644f30a4745..3202a717001 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -98,8 +98,6 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to): # Main Loop for obj, bb_world in objs: - - loc_world = obj.location bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box] Left_Up_Front = bb_world[1] diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 64af25e7b0f..910ccf96c0e 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -78,7 +78,7 @@ class PlayRenderedAnim(bpy.types.Operator): preset = prefs.filepaths.animation_player_preset 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 # try and guess a command line if it doesn't exist diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index edd09d9c66b..43ca9af59ba 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -42,7 +42,6 @@ def extend(obj, operator, EXTEND_MODE): edge_average_lengths = {} OTHER_INDEX = 2, 3, 0, 1 - FAST_INDICIES = 0, 2, 1, 3 # order is faster def extend_uvs(face_source, face_target, edge_key): ''' diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 40eaf91b042..9ae0cd0ddf9 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -444,7 +444,7 @@ def lightmap_uvpack(meshes, del even_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] @@ -489,7 +489,10 @@ def lightmap_uvpack(meshes, if PREF_APPLY_IMAGE: 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: # f.image = image @@ -530,7 +533,7 @@ def unwrap(operator, context, **kwargs): return {'FINISHED'} -from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty +from bpy.props import BoolProperty, FloatProperty, IntProperty class LightMapPack(bpy.types.Operator): From de7592b48900221844fa8d687e9d850294c90746 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 10 Jul 2011 17:04:56 +0000 Subject: [PATCH 05/13] Fix for [#26873] Animated displacement modifier on an object doesn't work with hair particle objects * Noise is now considered an animated texture as it changes with every frame * Converted a few places in particles code to use the particle system's own random table instead of BLI_frand. --- source/blender/blenkernel/intern/boids.c | 6 +++--- source/blender/blenkernel/intern/particle.c | 2 -- source/blender/blenkernel/intern/particle_system.c | 5 ----- source/blender/blenkernel/intern/texture.c | 4 ++++ source/blender/render/intern/source/convertblender.c | 6 ++---- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 9f808704eee..a0f38e675f9 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -937,6 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) BoidValues val; BoidState *state = get_boid_state(boids, pa); BoidParticle *bpa = pa->boid; + ParticleSystem *psys = bbd->sim->psys; int rand; //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; /* create random seed for every particle & frame */ - BLI_srandom(bbd->sim->psys->seed + p); - rand = BLI_rand(); - BLI_srandom((int)bbd->cfra + rand); + rand = (int)(PSYS_FRAND(psys->seed + p) * 1000); + rand = (int)(PSYS_FRAND((int)bbd->cfra + rand) * 1000); set_boid_values(&val, bbd->part->boids, pa); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 72c92eed312..5e615a28eb2 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2889,8 +2889,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) if(psys_in_edit_mode(sim->scene, psys)) if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0) return; - - BLI_srandom(psys->seed); keyed = psys->flag & PSYS_KEYED; baked = psys->pointcache->mem_cache.first && psys->part->type != PART_HAIR; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index b2e5c059edf..50f39704488 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3514,8 +3514,6 @@ static void hair_step(ParticleSimulationData *sim, float cfra) PARTICLE_P; float disp = (float)psys_get_current_display_percentage(psys)/100.0f; - BLI_srandom(psys->seed); - LOOP_PARTICLES { if(PSYS_FRAND(p) > disp) pa->flag |= PARS_NO_DISP; @@ -3801,8 +3799,6 @@ static void cached_step(ParticleSimulationData *sim, float cfra) PARTICLE_P; float disp, dietime; - BLI_srandom(psys->seed); - psys_update_effectors(sim); disp= (float)psys_get_current_display_percentage(psys)/100.0f; @@ -4054,7 +4050,6 @@ static void system_step(ParticleSimulationData *sim, float cfra) /* set particles to be not calculated TODO: can't work with pointcache */ disp= (float)psys_get_current_display_percentage(psys)/100.0f; - BLI_srandom(psys->seed); LOOP_PARTICLES { if(PSYS_FRAND(p) > disp) pa->flag |= PARS_NO_DISP; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 64f3c111434..036ba34d0c8 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1486,6 +1486,10 @@ int BKE_texture_dependsOnTime(const struct Tex *texture) // assume anything in adt means the texture is animated return 1; } + else if(texture->type == TEX_NOISE) { + // noise always varies with time + return 1; + } return 0; } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 4c0ce24e3e7..0f6751850ef 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1798,10 +1798,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem pa_size = pa->size; - BLI_srandom(psys->seed+a); - - r_tilt = 2.0f*(BLI_frand() - 0.5f); - r_length = BLI_frand(); + r_tilt = 2.0f*(PSYS_FRAND(a) - 0.5f); + r_length = PSYS_FRAND(a+1); if(path_nbr) { cache = psys->pathcache[a]; From 301e5b4ea0bbcb2129528265b95e7247920a88da Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Jul 2011 17:26:15 +0000 Subject: [PATCH 06/13] fix for various python bugs and remove unused var. --- release/scripts/modules/bpy_extras/image_utils.py | 2 +- release/scripts/modules/bpy_extras/io_utils.py | 2 +- release/scripts/modules/bpy_extras/mesh_utils.py | 4 +--- .../scripts/startup/bl_ui/properties_animviz.py | 1 + .../startup/bl_ui/properties_data_armature.py | 3 --- .../scripts/startup/bl_ui/properties_data_curve.py | 1 - release/scripts/startup/bl_ui/properties_object.py | 1 - .../scripts/startup/bl_ui/properties_texture.py | 2 +- release/scripts/startup/bl_ui/space_image.py | 1 - release/scripts/startup/bl_ui/space_userpref.py | 3 +-- .../scripts/startup/bl_ui/space_userpref_keymap.py | 14 ++++++-------- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 3 --- release/scripts/startup/keyingsets_builtins.py | 2 +- 13 files changed, 13 insertions(+), 26 deletions(-) diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index 551940b26e2..f91535a0ad4 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -99,7 +99,7 @@ def load_image(imagepath, return _image_load(nfilepath) 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 image.filepath = imagepath return image diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index 12c2d809132..cfa2233f7b6 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -262,7 +262,7 @@ def path_reference(filepath, base_src, base_dst, mode='AUTO', copy_subdir="", co filepath_abs = filepath_cpy mode = 'RELATIVE' else: - Excaption("invalid mode given %r" % mode) + raise Exception("invalid mode given %r" % mode) if mode == 'ABSOLUTE': return filepath_abs diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index 8ed50972c54..34925ccb5e9 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -212,8 +212,6 @@ def edge_loops_from_edges(mesh, edges=None): if not hasattr(edges, "pop"): edges = edges[:] - edge_dict = {ed.key: ed for ed in mesh.edges if ed.select} - while edges: current_edge = edges.pop() 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]: verts.pop(i - 1) - fill = fill_polygon([verts]) + fill = tesselate_polygon([verts]) else: ''' diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index eb1bbfd2fb1..3b33a7ccc61 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -94,4 +94,5 @@ class OnionSkinButtonsPanel(): col.prop(arm, "show_only_ghost_selected", text="Selected Only") if __name__ == "__main__": # only for live edit. + import bpy bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 9477dc866ab..f2a3bac2373 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -299,10 +299,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # in return (context.object) and (context.armature) def draw(self, context): - layout = self.layout - ob = context.object - self.draw_settings(context, ob.pose.animation_visualisation, bones=True) diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index 00d8d08852e..3c88127c724 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -122,7 +122,6 @@ class DATA_PT_curve_texture_space(CurveButtonsPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - ob = context.object curve = context.curve row = layout.row() diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index ae66642e903..cdbcf2cf533 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -34,7 +34,6 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel): def draw(self, context): layout = self.layout space = context.space_data - ob = context.object if space.use_pin_id: layout.template_ID(space, "pin_id") diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 01890bc3c99..f0265f8db67 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -208,7 +208,7 @@ class TextureSlotPanel(TextureButtonsPanel): return False 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 # diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index b1322d453fc..722b46aba11 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -434,7 +434,6 @@ class IMAGE_PT_game_properties(bpy.types.Panel): @classmethod def poll(cls, context): - rd = context.scene.render sima = context.space_data # display even when not in game mode because these settings effect the 3d view return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME') diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index c598788006c..24b90988953 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -126,7 +126,7 @@ class USERPREF_MT_appconfigs(bpy.types.Menu): preset_operator = "wm.appconfig_activate" 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 bpy.types.Menu.draw_preset(self, context) @@ -1124,7 +1124,6 @@ class WM_OT_addon_install(bpy.types.Operator): del pyfile_dir # 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)} #check to see if the file is in compressed format (.zip) diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index e99cefb91b8..29ec6301fc1 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -189,9 +189,9 @@ class InputKeyMapPanel: if km.is_modal: row.label(text="", icon='LINKED') if km.is_user_defined: - op = row.operator("wm.keymap_restore", text="Restore") + row.operator("wm.keymap_restore", text="Restore") else: - op = row.operator("wm.keymap_edit", text="Edit") + row.operator("wm.keymap_edit", text="Edit") if km.show_expanded_children: if children: @@ -213,7 +213,7 @@ class InputKeyMapPanel: col = self.indented_layout(col, level + 1) subcol = col.split(percentage=0.2).column() 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() @@ -351,9 +351,9 @@ class InputKeyMapPanel: row.label() if km.is_user_defined: - op = row.operator("wm.keymap_restore", text="Restore") + row.operator("wm.keymap_restore", text="Restore") else: - op = row.operator("wm.keymap_edit", text="Edit") + row.operator("wm.keymap_edit", text="Edit") for kmi in filtered_items: self.draw_kmi(display_keymaps, kc, km, kmi, col, 1) @@ -362,7 +362,7 @@ class InputKeyMapPanel: col = self.indented_layout(layout, 1) subcol = col.split(percentage=0.2).column() 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): for entry in KM_HIERARCHY: @@ -723,9 +723,7 @@ class WM_OT_keyitem_add(bpy.types.Operator): bl_label = "Add Key Map Item" def execute(self, context): - wm = context.window_manager km = context.keymap - kc = wm.keyconfigs.default if km.is_modal: km.keymap_items.new_modal("", 'A', 'PRESS') # kmi diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 52eb76d0710..9a85b87a9eb 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -60,7 +60,6 @@ def draw_gpencil_tools(context, layout): # ********** default tools for objectmode **************** - class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel): bl_context = "objectmode" bl_label = "Object Tools" @@ -944,7 +943,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel): tool_settings = context.tool_settings sculpt = tool_settings.sculpt - settings = __class__.paint_settings(context) layout.label(text="Lock:") row = layout.row(align=True) @@ -974,7 +972,6 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): layout = self.layout sculpt = context.tool_settings.sculpt - settings = __class__.paint_settings(context) split = layout.split() diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index 8cb63ea48cf..dcc1afed74b 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -407,7 +407,7 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo): # add the property name to the base path # rotation mode affects the property used 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': # XXX: for now, this is not available yet #path = path_add_property(base_path, "delta_rotation_axis_angle") From 2fb4a37baaac6c7045ea0d7ace2826f1112714c5 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 10 Jul 2011 17:30:31 +0000 Subject: [PATCH 07/13] Fix for [#27289] Hair: Render Option - Object does not point objects to end of "hair path" * Objects are now always rotated in the directions of the hair paths * Secondary fix: particle size wasn't updated for hair particles, so dupliobject size couldn't be change after the hair was edited --- source/blender/blenkernel/intern/particle.c | 73 ++++++++----------- .../blenkernel/intern/particle_system.c | 6 +- 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 5e615a28eb2..5995b895061 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4372,58 +4372,45 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa Object *ob = sim->ob; ParticleSystem *psys = sim->psys; ParticleSystemModifierData *psmd = sim->psmd; - float loc[3], nor[3], vec[3], side[3], len, obrotmat[4][4], qmat[4][4]; - float xvec[3] = {-1.0, 0.0, 0.0}, q[4], nmat[3][3]; + float loc[3], nor[3], vec[3], side[3], len; + float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3]; sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co); len= normalize_v3(vec); - if(psys->part->rotmode) { - if(pa == NULL) - pa= psys->particles+cpa->pa[0]; + if(pa == NULL && psys->part->childflat != PART_CHILD_FACES) + pa = psys->particles + cpa->pa[0]; - vec_to_quat( q,xvec, ob->trackflag, ob->upflag); - quat_to_mat4( obrotmat,q); - obrotmat[3][3]= 1.0f; - - 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); + 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); - transpose_m3(nmat); - mul_m3_v3(nmat, nor); + copy_m3_m4(nmat, ob->imat); + transpose_m3(nmat); + mul_m3_v3(nmat, nor); - /* make sure that we get a proper side vector */ - if(fabs(dot_v3v3(nor,vec))>0.999999) { - if(fabs(dot_v3v3(nor,xvec))>0.999999) { - nor[0] = 0.0f; - nor[1] = 1.0f; - nor[2] = 0.0f; - } - else { - nor[0] = 1.0f; - nor[1] = 0.0f; - nor[2] = 0.0f; - } + /* make sure that we get a proper side vector */ + if(fabs(dot_v3v3(nor,vec))>0.999999) { + if(fabs(dot_v3v3(nor,xvec))>0.999999) { + nor[0] = 0.0f; + nor[1] = 1.0f; + nor[2] = 0.0f; + } + else { + nor[0] = 1.0f; + nor[1] = 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; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 50f39704488..63a9c224971 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3510,11 +3510,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim) static void hair_step(ParticleSimulationData *sim, float cfra) { ParticleSystem *psys = sim->psys; -/* ParticleSettings *part = psys->part; */ + ParticleSettings *part = psys->part; PARTICLE_P; float disp = (float)psys_get_current_display_percentage(psys)/100.0f; 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) pa->flag |= PARS_NO_DISP; else From 1f6a79ecb59e958385544270c6226f6419c12ecd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 10 Jul 2011 18:21:40 +0000 Subject: [PATCH 08/13] Fix #27926: autokey not working with auto IK, broke this with an earlier bugfix. --- source/blender/editors/transform/transform_conversions.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index de8eda78d63..16bfc75c979 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4979,6 +4979,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t) 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 (!cancelled && t->mode==TFM_TRANSLATION) targetless_ik= apply_targetless_ik(ob); @@ -4995,8 +4999,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) */ 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); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } From 80eb1eae42940664452d7d4ec94a6a383a8c1e9d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Jul 2011 18:54:02 +0000 Subject: [PATCH 09/13] run WM_exit(C) when blender as a python module exits --- source/blender/python/intern/bpy_interface.c | 15 +++++++++++---- source/creator/creator.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 422d55ecefe..f091a511e93 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -663,7 +663,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * #include "BLI_storage.h" /* 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= { PyModuleDef_HEAD_INIT, "bpy", /* m_name */ @@ -673,8 +675,8 @@ static struct PyModuleDef bpy_proxy_def= { NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ - NULL, /* m_free */ -}; + bpy_module_free, /* m_free */ +}; typedef struct { PyObject_HEAD @@ -699,7 +701,7 @@ void bpy_module_delay_init(PyObject *bpy_proxy) // printf("module found %s\n", argv[0]); - main_python(argc, argv); + main_python_enter(argc, argv); /* initialized in BPy_init_modules() */ PyDict_Update(PyModule_GetDict(bpy_proxy), PyModule_GetDict(bpy_package_py)); @@ -756,4 +758,9 @@ PyInit_bpy(void) return bpy_proxy; } +static void bpy_module_free(void *UNUSED(mod)) +{ + main_python_exit(); +} + #endif diff --git a/source/creator/creator.c b/source/creator/creator.c index a8b24d0c9bc..fddd6d286db 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1134,7 +1134,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) #ifdef WITH_PYTHON_MODULE /* allow python module to call main */ -#define main main_python +#define main main_python_enter +static void *evil_C= NULL; #endif int main(int argc, const char **argv) @@ -1145,6 +1146,7 @@ int main(int argc, const char **argv) #ifdef WITH_PYTHON_MODULE #undef main + evil_C= C; #endif #ifdef WITH_BINRELOC @@ -1313,6 +1315,14 @@ int main(int argc, const char **argv) return 0; } /* 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) { From add56df7ca651530b9f1ce91a2a3b1fdf2badc40 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 10 Jul 2011 20:04:56 +0000 Subject: [PATCH 10/13] -OpenEXR fixed so enabling if user has enabled -Added Iex to lib list, was causing link time errors --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7e8d7dc172..f5ce397bee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -789,11 +789,8 @@ elseif(WIN32) if(WITH_IMAGE_OPENEXR) set(OPENEXR ${LIBDIR}/gcc/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) - - # TODO, gives linking errors, force off - set(WITH_IMAGE_OPENEXR OFF) endif() if(WITH_IMAGE_TIFF) From 2ebc5cbe75af394dc4ed1910f730bb4fb6d9f6ed Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 10 Jul 2011 23:24:15 +0000 Subject: [PATCH 11/13] Fix for [#27293] Group Instance of particle system is rendered wrong * Silly mul_m4_v3 had turned into a mul_m4_v4 at some point! --- source/blender/render/intern/source/convertblender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 0f6751850ef..583b792f240 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -2045,7 +2045,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem mul_m4_v3(psys->parent->obmat, state.co); if(use_duplimat) - mul_m4_v4(duplimat, state.co); + mul_m4_v3(duplimat, state.co); if(part->ren_as == PART_DRAW_BB) { bb.random = random; From 897cbe4b42a31ad7afe6ab3e4e89ac5318eef91a Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 10 Jul 2011 23:49:59 +0000 Subject: [PATCH 12/13] Fix for [#27398] Particle systems with animated groups render incorrectly in viewport * Hmph.. depsgraph and group duplication == illogical. --- source/blender/blenkernel/intern/depsgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index c2800410657..d39be9d683c 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -599,7 +599,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O if(part->ren_as == PART_DRAW_GR && part->dup_group) { for(go=part->dup_group->gobject.first; go; go=go->next) { 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"); } } From dbc9e36f72303bdec0c2050daf5512ef191b108f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Jul 2011 05:50:49 +0000 Subject: [PATCH 13/13] make python3.3 compatible, __class__ is no longer in the class methods namespace. --- release/scripts/modules/bpy/ops.py | 20 +++++++++---------- .../scripts/startup/bl_operators/presets.py | 2 +- .../scripts/startup/bl_ui/space_userpref.py | 10 +++++----- .../startup/bl_ui/space_userpref_keymap.py | 4 ++-- release/scripts/startup/bl_ui/space_view3d.py | 2 +- .../startup/bl_ui/space_view3d_toolbar.py | 10 +++++----- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index f54b0a1fefc..64c5a1a5f5f 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -29,7 +29,7 @@ op_as_string = ops_module.as_string op_get_rna = ops_module.get_rna -class bpy_ops(object): +class BPyOps(object): ''' Fake module like class. @@ -42,7 +42,7 @@ class bpy_ops(object): ''' if module.startswith('__'): raise AttributeError(module) - return bpy_ops_submodule(module) + return BPyOpsSubMod(module) def __dir__(self): @@ -67,7 +67,7 @@ class bpy_ops(object): return "" -class bpy_ops_submodule(object): +class BPyOpsSubMod(object): ''' Utility class to fake submodules. @@ -84,7 +84,7 @@ class bpy_ops_submodule(object): ''' if func.startswith('__'): raise AttributeError(func) - return bpy_ops_submodule_op(self.module, func) + return BPyOpsSubModOp(self.module, func) def __dir__(self): @@ -103,7 +103,7 @@ class bpy_ops_submodule(object): return "" % self.module -class bpy_ops_submodule_op(object): +class BPyOpsSubModOp(object): ''' Utility class to fake submodule operators. @@ -151,7 +151,7 @@ class bpy_ops_submodule_op(object): self.func = func 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) def idname(self): @@ -170,16 +170,16 @@ class bpy_ops_submodule_op(object): wm = context.window_manager # run to account for any rna values the user changes. - __class__._scene_update(context) + BPyOpsSubModOp._scene_update(context) 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) else: ret = op_call(self.idname_py(), None, kw) if 'FINISHED' in ret and context.window_manager == wm: - __class__._scene_update(context) + BPyOpsSubModOp._scene_update(context) return ret @@ -208,4 +208,4 @@ class bpy_ops_submodule_op(object): return "" % \ (self.module, self.func, id(self)) -ops_fake_module = bpy_ops() +ops_fake_module = BPyOps() diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 2175d7528a4..f3c799c9ac2 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -315,7 +315,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator): @property def preset_subdir(self): - return __class__.operator_path(self.operator) + return AddPresetOperator.operator_path(self.operator) @property def preset_values(self): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 24b90988953..6a809aefb9d 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -986,7 +986,7 @@ class USERPREF_PT_addons(bpy.types.Panel): split.label(text="Warning:") 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) if tot_row: @@ -1136,7 +1136,7 @@ class WM_OT_addon_install(bpy.types.Operator): if self.overwrite: for f in file_to_extract.namelist(): - __class__._module_remove(path_addons, f) + WM_OT_addon_install._module_remove(path_addons, f) else: for f in file_to_extract.namelist(): path_dest = os.path.join(path_addons, os.path.basename(f)) @@ -1160,7 +1160,7 @@ class WM_OT_addon_install(bpy.types.Operator): path_dest = os.path.join(path_addons, os.path.basename(pyfile)) 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): self.report({'WARNING'}, "File already installed to %r\n" % path_dest) return {'CANCELLED'} @@ -1225,7 +1225,7 @@ class WM_OT_addon_remove(bpy.types.Operator): return None, False 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: self.report('WARNING', "Addon path %r could not be found" % path) return {'CANCELLED'} @@ -1245,7 +1245,7 @@ class WM_OT_addon_remove(bpy.types.Operator): # lame confirmation check def draw(self, context): 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) def invoke(self, context, event): diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index 29ec6301fc1..85764c55304 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -234,7 +234,7 @@ class InputKeyMapPanel: for pname, value in properties.bl_rna.properties.items(): if pname != "rna_type" and not properties.is_property_hidden(pname): if isinstance(value, bpy.types.OperatorProperties): - __class__.draw_kmi_properties(box, value, title=pname) + InputKeyMapPanel.draw_kmi_properties(box, value, title=pname) else: flow.prop(properties, pname) @@ -325,7 +325,7 @@ class InputKeyMapPanel: # Operator properties props = kmi.properties if props is not None: - __class__.draw_kmi_properties(box, props) + InputKeyMapPanel.draw_kmi_properties(box, props) # Modal key maps attached to this operator if not km.is_modal: diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 2b58f2a216f..aef6accb4e1 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2410,7 +2410,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel): def draw(self, context): import rna_prop_ui - member = __class__._active_context_member(context) + member = VIEW3D_PT_context_properties._active_context_member(context) if member: # Draw with no edit button diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 9a85b87a9eb..e1efeed87ea 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -465,7 +465,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - settings = __class__.paint_settings(context) + settings = self.paint_settings(context) brush = settings.brush if not context.particle_edit_object: @@ -686,7 +686,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - settings = __class__.paint_settings(context) + settings = self.paint_settings(context) brush = settings.brush tex_slot = brush.texture_slot @@ -785,7 +785,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - settings = __class__.paint_settings(context) + settings = self.paint_settings(context) brush = settings.brush col = layout.column(align=True) @@ -820,7 +820,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - settings = __class__.paint_settings(context) + settings = self.paint_settings(context) brush = settings.brush image_paint = context.image_paint_object @@ -1003,7 +1003,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - settings = __class__.paint_settings(context) + settings = self.paint_settings(context) brush = settings.brush if brush is None: # unlikely but can happen