From 86f791676700dc317a12cb94b2c02fcfd972260a Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sat, 16 Feb 2013 19:24:50 +0000 Subject: Code cleanup, remove redundant function wrapper --- source/blender/blenkernel/intern/scene.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ede0925e01f..9e83c11a021 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -378,7 +378,7 @@ void BKE_scene_free(Scene *sce) BKE_color_managed_view_settings_free(&sce->view_settings); } -static Scene *scene_add(Main *bmain, const char *name) +Scene *BKE_scene_add(Main *bmain, const char *name) { Scene *sce; ParticleEditSettings *pset; @@ -613,11 +613,6 @@ static Scene *scene_add(Main *bmain, const char *name) return sce; } -Scene *BKE_scene_add(Main *bmain, const char *name) -{ - return scene_add(bmain, name); -} - Base *BKE_scene_base_find(Scene *scene, Object *ob) { return BLI_findptr(&scene->base, ob, offsetof(Base, object)); -- cgit v1.2.3 From 500bc0c5e948079bd0ab7bd2c96a78a1451964f1 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sat, 16 Feb 2013 19:24:52 +0000 Subject: rigidbody: Fix [#34277] Deleting a copied bullet scene crashes blender. Copying scenes didn't handle rigid body worlds previously. Since we use groups to keep track of objecs in the rigid body sim it's tricky to do the right thing here since groups aren't duplicated. One option would be to create new groups and add the duplicated objects into those but that has other drawbacks. So the rigid body world isn't copied for now. TODO find a better way of handling this. --- source/blender/blenkernel/intern/scene.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9e83c11a021..6dba03ce22d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -173,6 +173,7 @@ Scene *BKE_scene_copy(Scene *sce, int type) scen->obedit = NULL; scen->stats = NULL; scen->fps_info = NULL; + scen->rigidbody_world = NULL; /* RB_TODO figure out a way of copying the rigid body world */ BLI_duplicatelist(&(scen->markers), &(sce->markers)); BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces)); -- cgit v1.2.3 From 9cd01c6a5c68543ed40bfe33d5faa564006b0717 Mon Sep 17 00:00:00 2001 From: Monique Dewanchand Date: Sat, 16 Feb 2013 20:21:41 +0000 Subject: Added option for group node buffering in the compositor. Justa cluster did not have enough memory to handle all Mango 4k scenes. Option is default disabled and can be enabled in the performance panel. - At Mind - --- release/scripts/startup/bl_ui/space_node.py | 1 + source/blender/compositor/intern/COM_CompositorContext.h | 3 ++- source/blender/compositor/nodes/COM_GroupNode.cpp | 3 ++- source/blender/makesdna/DNA_node_types.h | 8 +++++--- source/blender/makesrna/intern/rna_nodetree.c | 4 ++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index c46b1c20738..104c1500756 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -252,6 +252,7 @@ class NODE_PT_quality(bpy.types.Panel): col = layout.column() col.prop(tree, "use_opencl") + col.prop(tree, "use_groupnode_buffer") col.prop(tree, "two_pass") col.prop(snode, "show_highlight") col.prop(snode, "use_hidden_preview") diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 2f5e8c0648d..840a9e59584 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -74,7 +74,7 @@ private: * @brief does this system have active opencl devices? */ bool m_hasActiveOpenCLDevices; - + /** * @brief Skip slow nodes */ @@ -178,6 +178,7 @@ public: void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;} bool isFastCalculation() {return this->m_fastCalculation;} + inline bool isGroupnodeBufferEnabled() {return this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER;} }; diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp index 4cef337d994..05c749345d5 100644 --- a/source/blender/compositor/nodes/COM_GroupNode.cpp +++ b/source/blender/compositor/nodes/COM_GroupNode.cpp @@ -64,11 +64,12 @@ void GroupNode::ungroup(ExecutionSystem &system) } } + const bool groupnodeBuffering = system.getContext().isGroupnodeBufferEnabled(); for (index = 0; index < outputsockets.size(); index++) { OutputSocket *outputSocket = outputsockets[index]; bNodeSocket *editorOutput = outputSocket->getbNodeSocket(); if (editorOutput->groupsock) { - SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput, true); + SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput, groupnodeBuffering); outputSocket->relinkConnections(proxy->getOutputSocket(0)); ExecutionSystemHelper::addNode(system.getNodes(), proxy); } diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 7f2e388cd69..5aaf46a541f 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -309,9 +309,11 @@ typedef struct bNodeTree { #define NTREE_TYPE_INIT 1 /* ntree->flag */ -#define NTREE_DS_EXPAND 1 /* for animation editors */ -#define NTREE_COM_OPENCL 2 /* use opencl */ -#define NTREE_TWO_PASS 4 /* two pass */ +#define NTREE_DS_EXPAND 1 /* for animation editors */ +#define NTREE_COM_OPENCL 2 /* use opencl */ +#define NTREE_TWO_PASS 4 /* two pass */ +#define NTREE_COM_GROUPNODE_BUFFER 8 /* use groupnode buffers */ + /* XXX not nice, but needed as a temporary flags * for group updates after library linking. */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 397e05b6a97..2140f90664e 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -4971,6 +4971,10 @@ static void rna_def_composite_nodetree(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_OPENCL); RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations"); + prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_GROUPNODE_BUFFER); + RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes"); + prop = RNA_def_property(srna, "two_pass", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_TWO_PASS); RNA_def_property_ui_text(prop, "Two Pass", "Use two pass execution during editing: first calculate fast nodes, " -- cgit v1.2.3 From 772a3b1e1e536e88ca141b404eacc1fbecb73bbf Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Sat, 16 Feb 2013 21:21:04 +0000 Subject: Fix for [#34182] Movie Distortion and Bilateral Blur doesn't work together * added area of interest based on a radius around the input tile. If someone can implement a correct formula (based on K1, K2 and K3) and send it to me, I will be happy to apply it! - At Mind - --- .../compositor/operations/COM_MovieDistortionOperation.cpp | 13 +++++++++++++ .../compositor/operations/COM_MovieDistortionOperation.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index 68a61dff801..cf379d91652 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -112,3 +112,16 @@ void MovieDistortionOperation::executePixel(float output[4], float x, float y, P this->m_inputOperation->read(output, x, y, COM_PS_BILINEAR); } } + +bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ + const int marginX = this->m_width*0.15; + const int marginY = this->m_height*0.15; + + rcti newInput; + newInput.xmin = input->xmin - marginX; + newInput.ymin = input->ymin - marginY; + newInput.xmax = input->xmax + marginX; + newInput.ymax = input->ymax + marginY; + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); +} diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index 9f8aa065e3e..4596fbd555b 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -162,6 +162,8 @@ public: void setMovieClip(MovieClip *clip) { this->m_movieClip = clip; } void setFramenumber(int framenumber) { this->m_framenumber = framenumber; } + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); + }; void deintializeDistortionCache(void); -- cgit v1.2.3 From ed39f334cab23347738a7b2255c4bfd8a360eb45 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 16 Feb 2013 21:32:05 +0000 Subject: Fix performance regression with anchor brush in sculpt mode When restoring coordinates in sculpt mode (used for several brushes including anchor brush), can use sculpt_undo_get_node() for non-dyntopo sculpting instead of sculpt_undo_push_node(). This should bring speed of anchor brush back to 2.65 level for regular mesh/multires sculpting. Fixes projects.blender.org/tracker/?func=detail&atid=498&aid=34208&group_id=9 --- source/blender/editors/sculpt_paint/sculpt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 10f4dc2aebc..f737b6ccee7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -441,7 +441,12 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob) SculptUndoType type = (brush->sculpt_tool == SCULPT_TOOL_MASK ? SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS); - unode = sculpt_undo_push_node(ob, nodes[n], type); + if (ss->bm) { + unode = sculpt_undo_push_node(ob, nodes[n], type); + } + else { + unode = sculpt_undo_get_node(nodes[n]); + } if (unode) { PBVHVertexIter vd; SculptOrigVertData orig_data; -- cgit v1.2.3 From 39ee06421c63f52afa2a544cf090cb62be954b94 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 16 Feb 2013 21:36:26 +0000 Subject: Fix for harmless uninitialized-variable warning --- source/blender/editors/sculpt_paint/sculpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index f737b6ccee7..976181f837a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3158,7 +3158,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob) PBVHVertexIter vd; PBVHProxyNode *proxies; int proxy_count; - float (*orco)[3]; + float (*orco)[3] = NULL; if (use_orco && !ss->bm) orco = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS)->co; -- cgit v1.2.3 From 2e0017efd4d6858a1d4d78dc5e72fdd2f1aafaa9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 03:57:20 +0000 Subject: code cleanup: change order of args in void BKE_object_where_is_calc_time_ex() so extra arg is at the end (loose convention for *_ex() funcs). also some style cleanup. --- source/blender/blenkernel/BKE_object.h | 3 +- source/blender/blenkernel/intern/object.c | 11 ++--- source/blender/blenkernel/intern/rigidbody.c | 2 +- .../operations/COM_MovieDistortionOperation.cpp | 4 +- source/blender/editors/sculpt_paint/sculpt.c | 51 +++++++++++----------- 5 files changed, 37 insertions(+), 34 deletions(-) diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 19c04676548..8a929297acf 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -103,7 +103,8 @@ struct Object *BKE_object_pose_armature_get(struct Object *ob); void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob); void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob); void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime); -void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float ctime); +void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct Object *ob, float ctime, + struct RigidBodyWorld *rbw); void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob); void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 117e9fe280c..ef3c98ee3f4 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2118,7 +2118,8 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[ } /* note, scene is the active scene while actual_scene is the scene the object resides in */ -void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float ctime) +void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime, + RigidBodyWorld *rbw) { if (ob == NULL) return; @@ -2163,7 +2164,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime) { - BKE_object_where_is_calc_time_ex(scene, NULL, ob, ctime); + BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL); } /* get object transformation matrix without recalculating dependencies and @@ -2189,17 +2190,17 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob) { - BKE_object_where_is_calc_time_ex(scene, rbw, ob, BKE_scene_frame_get(scene)); + BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw); } void BKE_object_where_is_calc(Scene *scene, Object *ob) { - BKE_object_where_is_calc_time_ex(scene, NULL, ob, BKE_scene_frame_get(scene)); + BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL); } -void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) /* was written for the old game engine (until 2.04) */ /* It seems that this function is only called * for a lamp that is the child of another object */ +void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) { Object *par; float *fp1, *fp2; diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 26f0c25617f..66edfe2fe15 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1308,7 +1308,7 @@ struct RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, s struct RigidBodyWorld *BKE_rigidbody_get_world(Scene *scene) { return NULL; } void BKE_rigidbody_remove_object(Scene *scene, Object *ob) {} void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob) {} -void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime) {} +void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) {} void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle) {} void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) {} void BKE_rigidbody_do_simulation(Scene *scene, float ctime) {} diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index cf379d91652..b0fc21d4d55 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -115,8 +115,8 @@ void MovieDistortionOperation::executePixel(float output[4], float x, float y, P bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { - const int marginX = this->m_width*0.15; - const int marginY = this->m_height*0.15; + const int marginX = this->m_width * 0.15; + const int marginY = this->m_height * 0.15; rcti newInput; newInput.xmin = input->xmin - marginX; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 976181f837a..342671698d2 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -883,7 +883,7 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather) /* Return a multiplier for brush strength on a particular vertex. */ static float tex_strength(SculptSession *ss, Brush *br, - const float point[3], + const float point[3], const float len, const float sculpt_normal[3], const short vno[3], @@ -1411,8 +1411,8 @@ static float bmesh_neighbor_average_mask(BMesh *bm, BMVert *v) for (i = 0; i < 3; i++) { BMVert *v2 = adj_v[i]; float *vmask = CustomData_bmesh_get(&bm->vdata, - v2->head.data, - CD_PAINT_MASK); + v2->head.data, + CD_PAINT_MASK); avg += (*vmask); total++; } @@ -1423,8 +1423,8 @@ static float bmesh_neighbor_average_mask(BMesh *bm, BMVert *v) } else { float *vmask = CustomData_bmesh_get(&bm->vdata, - v->head.data, - CD_PAINT_MASK); + v->head.data, + CD_PAINT_MASK); return (*vmask); } } @@ -1938,11 +1938,11 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) if (sculpt_brush_test(&test, orig_data.co)) { const float fade = bstrength * tex_strength(ss, brush, - orig_data.co, - test.dist, + orig_data.co, + test.dist, ss->cache->sculpt_normal_symm, - orig_data.no, - NULL, vd.mask ? *vd.mask : 0.0f); + orig_data.no, + NULL, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -2077,11 +2077,11 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode if (sculpt_brush_test(&test, orig_data.co)) { const float fade = bstrength * tex_strength(ss, brush, - orig_data.co, - test.dist, + orig_data.co, + test.dist, ss->cache->sculpt_normal_symm, orig_data.no, - NULL, vd.mask ? *vd.mask : 0.0f); + NULL, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -2135,7 +2135,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod test.dist, ss->cache->sculpt_normal_symm, orig_data.no, - NULL, vd.mask ? *vd.mask : 0.0f); + NULL, vd.mask ? *vd.mask : 0.0f); mul_v3_m4v3(proxy[vd.i], m, orig_data.co); sub_v3_v3(proxy[vd.i], orig_data.co); @@ -3005,7 +3005,7 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush) if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) { BKE_pbvh_bmesh_update_topology(ss->pbvh, mode, - ss->cache->location, + ss->cache->location, ss->cache->radius); } @@ -3313,7 +3313,7 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, typedef void (*BrushActionFunc)(Sculpt *sd, Object *ob, Brush *brush); static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, - BrushActionFunc action, + BrushActionFunc action, const char symm, const int axis, const float feather) { @@ -4077,7 +4077,7 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin) } if (BKE_pbvh_node_raycast(srd->ss->pbvh, node, origco, use_origco, - srd->ray_start, srd->ray_normal, &srd->dist)) + srd->ray_start, srd->ray_normal, &srd->dist)) { srd->hit = 1; *tmin = srd->dist; @@ -4665,24 +4665,25 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o } static int sculpt_dynamic_topology_toggle_invoke(bContext *C, wmOperator *op, - wmEvent *UNUSED(event)) + wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); Mesh *me = ob->data; SculptSession *ss = ob->sculpt; const char *msg = "Dynamic-topology sculpting will not preserve" - "vertex colors, UVs, or other customdata"; + "vertex colors, UVs, or other customdata"; if (!ss->bm) { int i; for (i = 0; i < CD_NUMTYPES; i++) { if (!ELEM7(i, CD_MVERT, CD_MEDGE, CD_MFACE, - CD_MLOOP, CD_MPOLY, CD_PAINT_MASK, - CD_ORIGINDEX) && - (CustomData_has_layer(&me->vdata, i) || - CustomData_has_layer(&me->edata, i) || - CustomData_has_layer(&me->fdata, i))) { + CD_MLOOP, CD_MPOLY, CD_PAINT_MASK, + CD_ORIGINDEX) && + (CustomData_has_layer(&me->vdata, i) || + CustomData_has_layer(&me->edata, i) || + CustomData_has_layer(&me->fdata, i))) + { /* The mesh has customdata that will be lost, let the * user confirm this is OK */ return WM_operator_confirm_message(C, op, msg); @@ -4763,8 +4764,8 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op)) /* Symmetrize and re-triangulate */ BMO_op_callf(ss->bm, BMO_FLAG_DEFAULTS, - "symmetrize input=%avef direction=%i", - sd->symmetrize_direction); + "symmetrize input=%avef direction=%i", + sd->symmetrize_direction); sculpt_dynamic_topology_triangulate(ss->bm); /* Finish undo */ -- cgit v1.2.3 From 00f48914f32f9df4266ff73550a0f80a085baa32 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 04:35:50 +0000 Subject: code cleanup: missed r54603, arg reordering. --- source/blender/blenkernel/BKE_object.h | 3 ++- source/blender/blenkernel/intern/object.c | 5 +++-- source/blender/blenkernel/intern/scene.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 8a929297acf..89860cd0da9 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -150,7 +150,8 @@ void BKE_object_tfm_protected_restore(struct Object *ob, const short protectflag); void BKE_object_handle_update(struct Scene *scene, struct Object *ob); -void BKE_object_handle_update_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob); +void BKE_object_handle_update_ex(struct Scene *scene, struct Object *ob, + struct RigidBodyWorld *rbw); void BKE_object_sculpt_modifiers_changed(struct Object *ob); int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ef3c98ee3f4..b810aa89257 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2631,7 +2631,8 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob) /* the main object update call, for object matrix, constraints, keys and displist (modifiers) */ /* requires flags to be set! */ /* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */ -void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob) +void BKE_object_handle_update_ex(Scene *scene, Object *ob, + RigidBodyWorld *rbw) { if (ob->recalc & OB_RECALC_ALL) { /* speed optimization for animation lookups */ @@ -2833,7 +2834,7 @@ void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob) */ void BKE_object_handle_update(Scene *scene, Object *ob) { - BKE_object_handle_update_ex(scene, NULL, ob); + BKE_object_handle_update_ex(scene, ob, NULL); } void BKE_object_sculpt_modifiers_changed(Object *ob) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6dba03ce22d..279c321d371 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1125,7 +1125,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen for (base = scene->base.first; base; base = base->next) { Object *ob = base->object; - BKE_object_handle_update_ex(scene_parent, scene->rigidbody_world, ob); + BKE_object_handle_update_ex(scene_parent, ob, scene->rigidbody_world); if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) group_handle_recalc_and_update(scene_parent, ob, ob->dup_group); -- cgit v1.2.3 From 34805a4752b0ce6a66d24389b04f86b26fb7e71f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 05:16:48 +0000 Subject: BLI_mempool totalloc was being used un-initialized, normally this would cause bugs but turns out its not used, ifdef'd it out but keep in the struct in BLI_mempool for now. --- source/blender/blenlib/intern/BLI_mempool.c | 14 +++++++++++--- source/blender/makesrna/intern/makesrna.c | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 7670b057a7f..5f0c90f234d 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -54,6 +54,9 @@ #define FREEWORD MAKE_ID('f', 'r', 'e', 'e') +/* currently totalloc isnt used */ +// #define USE_TOTALLOC + typedef struct BLI_freenode { struct BLI_freenode *next; int freeword; /* used to identify this as a freed node */ @@ -110,6 +113,7 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) pool->pchunk = pchunk; pool->csize = esize * pchunk; pool->chunks.first = pool->chunks.last = NULL; + pool->totalloc = 0; pool->totused = 0; maxchunks = totelem / pchunk + 1; @@ -159,10 +163,11 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) } } - /* set the end of this chunks memoryy to the new tail for next iteration */ + /* set the end of this chunks memory to the new tail for next iteration */ lasttail = curnode; - +#ifdef USE_TOTALLOC pool->totalloc += pool->pchunk; +#endif } /* terminate the list */ curnode->next = NULL; @@ -213,8 +218,9 @@ void *BLI_mempool_alloc(BLI_mempool *pool) } } curnode->next = NULL; /* terminate the list */ - +#ifdef USE_TOTALLOC pool->totalloc += pool->pchunk; +#endif } retval = pool->free; @@ -282,7 +288,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) } BLI_addtail(&pool->chunks, first); +#ifdef USE_TOTALLOC pool->totalloc = pool->pchunk; +#endif pool->free = first->data; /* start of the list */ for (tmpaddr = first->data, i = 0; i < pool->pchunk; i++) { diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 96ca3805d3e..95222a067af 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1798,7 +1798,7 @@ static const char *rna_parameter_type_cpp_name(PropertyRNA *prop) } } -static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, +static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srna), FunctionDefRNA *dfunc, const char *namespace, int close_prototype) { PropertyDefRNA *dp; -- cgit v1.2.3 From 18f12c3fa4196189c8c8a21c147ac3c46abac74d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 05:39:55 +0000 Subject: allow alt or Ckey to toggle clamping for vertex slide. --- source/blender/editors/transform/transform.c | 14 ++++++++------ source/blender/editors/transform/transform.h | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8ffa04050a2..ae00f012846 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -6054,7 +6054,6 @@ static int createVertSlideVerts(TransInfo *t) } sld->is_proportional = true; - sld->is_clamp = true; sld->curr_sv_index = 0; sld->flipped_vtx = false; @@ -6252,7 +6251,7 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event) { /* use like a modifier key */ if (event->val == KM_PRESS) { - sld->is_clamp = !sld->is_clamp; + t->flag ^= T_ALT_TRANSFORM; calcVertSlideCustomPoints(t); return 1; } @@ -6278,7 +6277,8 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event) case MOUSEMOVE: { /* don't recalculat the best edge */ - if (sld->is_clamp) { + const bool is_clamp = !(t->flag & T_ALT_TRANSFORM); + if (is_clamp) { calcVertSlideMouseActiveEdges(t, event->mval); } calcVertSlideCustomPoints(t); @@ -6303,6 +6303,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t) const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f; const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f; const int alpha_shade = -30; + const bool is_clamp = !(t->flag & T_ALT_TRANSFORM); int i; if (v3d && v3d->zbuf) @@ -6319,7 +6320,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t) glLineWidth(line_size); UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); glBegin(GL_LINES); - if (sld->is_clamp) { + if (is_clamp) { sv = sld->sv; for (i = 0; i < sld->totsv; i++, sv++) { glVertex3fv(sv->co_orig_3d); @@ -6412,7 +6413,8 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2])) VertSlideData *sld = t->customData; const bool flipped = sld->flipped_vtx; const bool is_proportional = sld->is_proportional; - const bool is_constrained = !(sld->is_clamp == false || hasNumInput(&t->num)); + const bool is_clamp = !(t->flag & T_ALT_TRANSFORM); + const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num)); final = t->values[0]; @@ -6439,7 +6441,7 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2])) if (!is_proportional) { str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(F)lipped: %s, ", flipped ? "ON" : "OFF"); } - str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(C)lamp: %s", sld->is_clamp ? "ON" : "OFF"); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "Alt or (C)lamp: %s", is_clamp ? "ON" : "OFF"); /* done with header string */ if (is_constrained) { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 78f346be2aa..4e3f2b04de0 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -239,7 +239,6 @@ typedef struct VertSlideData { float perc; bool is_proportional; - bool is_clamp; bool flipped_vtx; int curr_sv_index; -- cgit v1.2.3 From b0a7370284f076cdb0570d05d8afd955f3cdc231 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 05:58:18 +0000 Subject: vertex slide: dont write clamped value back into TransInfo.values, this meant toggling clamp didn't take any effect until the mouse was moved. (annoying glitch) --- source/blender/editors/transform/transform.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ae00f012846..e5b4a6c7bae 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -6444,15 +6444,11 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2])) str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "Alt or (C)lamp: %s", is_clamp ? "ON" : "OFF"); /* done with header string */ - if (is_constrained) { - CLAMP(final, 0.0f, 1.0f); - } - - t->values[0] = final; /*do stuff here*/ - if (t->customData) + if (t->customData) { doVertSlide(t, final); + } else { strcpy(str, "Invalid Vert Selection"); t->state = TRANS_CANCEL; -- cgit v1.2.3 From 6e0cedd61cba2cfcdbf470cdd89f5604ca8fe7f0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 07:17:04 +0000 Subject: code cleanup: operator/function mismatch --- source/blender/editors/object/object_hook.c | 4 ++-- source/blender/editors/object/object_intern.h | 4 ++-- source/blender/editors/object/object_ops.c | 4 ++-- source/blender/editors/uvedit/uvedit_intern.h | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 1387ef94091..b1612a2b9d3 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -558,7 +558,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) } } -void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) +void OBJECT_OT_hook_add_selob(wmOperatorType *ot) { /* identifiers */ ot->name = "Hook to Selected Object"; @@ -592,7 +592,7 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *op) } } -void OBJECT_OT_hook_add_newobj(wmOperatorType *ot) +void OBJECT_OT_hook_add_newob(wmOperatorType *ot) { /* identifiers */ ot->name = "Hook to New Object"; diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 0be9c92897e..4523ac098d6 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -127,8 +127,8 @@ void OBJECT_OT_join_shapes(struct wmOperatorType *ot); void OBJECT_OT_convert(struct wmOperatorType *ot); /* object_hook.c */ -void OBJECT_OT_hook_add_selobj(struct wmOperatorType *ot); -void OBJECT_OT_hook_add_newobj(struct wmOperatorType *ot); +void OBJECT_OT_hook_add_selob(struct wmOperatorType *ot); +void OBJECT_OT_hook_add_newob(struct wmOperatorType *ot); void OBJECT_OT_hook_remove(struct wmOperatorType *ot); void OBJECT_OT_hook_select(struct wmOperatorType *ot); void OBJECT_OT_hook_assign(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index d26ea89bd1e..bf408d6dbe4 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -217,8 +217,8 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_group_link); WM_operatortype_append(OBJECT_OT_group_remove); - WM_operatortype_append(OBJECT_OT_hook_add_selobj); - WM_operatortype_append(OBJECT_OT_hook_add_newobj); + WM_operatortype_append(OBJECT_OT_hook_add_selob); + WM_operatortype_append(OBJECT_OT_hook_add_newob); WM_operatortype_append(OBJECT_OT_hook_remove); WM_operatortype_append(OBJECT_OT_hook_select); WM_operatortype_append(OBJECT_OT_hook_assign); diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index 7faec33ca98..d1893d639bb 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -79,7 +79,7 @@ void uvedit_get_aspect(struct Scene *scene, struct Object *ob, struct BMEditMesh void UV_OT_average_islands_scale(struct wmOperatorType *ot); void UV_OT_cube_project(struct wmOperatorType *ot); void UV_OT_cylinder_project(struct wmOperatorType *ot); -void UV_OT_from_view(struct wmOperatorType *ot); +void UV_OT_project_from_view(struct wmOperatorType *ot); void UV_OT_minimize_stretch(struct wmOperatorType *ot); void UV_OT_pack_islands(struct wmOperatorType *ot); void UV_OT_reset(struct wmOperatorType *ot); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index e158f8843b7..a17d3c20c1c 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -4053,7 +4053,7 @@ void ED_operatortypes_uvedit(void) WM_operatortype_append(UV_OT_average_islands_scale); WM_operatortype_append(UV_OT_cube_project); WM_operatortype_append(UV_OT_cylinder_project); - WM_operatortype_append(UV_OT_from_view); + WM_operatortype_append(UV_OT_project_from_view); WM_operatortype_append(UV_OT_minimize_stretch); WM_operatortype_append(UV_OT_pack_islands); WM_operatortype_append(UV_OT_reset); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 00b82e26a05..4ddf4bd6a5c 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1387,7 +1387,7 @@ static int uv_from_view_poll(bContext *C) return (rv3d != NULL); } -void UV_OT_from_view(wmOperatorType *ot) +void UV_OT_project_from_view(wmOperatorType *ot) { /* identifiers */ ot->name = "Project From View"; -- cgit v1.2.3 From c524b479121179fbd82c158c59c876bb06b2b999 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 17 Feb 2013 13:56:49 +0000 Subject: =?UTF-8?q?Another=20huge=20bunch=20of=20UI=20translation=20fixes,?= =?UTF-8?q?=20mostly=20reported=20by=20Leon=20Cheung,=20Sv.Lockal,=20Gabri?= =?UTF-8?q?el=20Gazz=C3=A1n=20and=20Satoshi=20Yamasaki,=20thanks!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/startup/bl_ui/properties_material.py | 8 +-- source/blender/blenkernel/intern/pointcache.c | 24 +++---- source/blender/editors/curve/editcurve.c | 13 ++-- .../blender/editors/interface/interface_regions.c | 12 ++-- .../editors/interface/interface_templates.c | 2 +- source/blender/editors/space_clip/CMakeLists.txt | 4 ++ source/blender/editors/space_clip/SConscript | 3 + source/blender/editors/space_clip/clip_buttons.c | 73 +++++++++++----------- source/blender/editors/space_clip/clip_toolbar.c | 10 ++- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 3 +- source/blender/windowmanager/intern/wm_operators.c | 24 ++++--- 12 files changed, 102 insertions(+), 76 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 273b2450200..a13c722ea62 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -566,7 +566,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel): row.prop(halo, toggle, text="") sub = row.column() sub.active = getattr(halo, toggle) - sub.prop(halo, number, text=name) + sub.prop(halo, number, text=name, translate=False) if not color == "": sub.prop(mat, color, text="") @@ -593,9 +593,9 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel): col.prop(halo, "use_soft") col = split.column() - number_but(col, "use_ring", "ring_count", "Rings", "mirror_color") - number_but(col, "use_lines", "line_count", "Lines", "specular_color") - number_but(col, "use_star", "star_tip_count", "Star tips", "") + number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color") + number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color") + number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "") class MATERIAL_PT_flare(MaterialButtonsPanel, Panel): diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 4302032ade1..27c5e03132e 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -52,6 +52,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "PIL_time.h" #include "WM_api.h" @@ -3505,11 +3507,11 @@ void BKE_ptcache_update_info(PTCacheID *pid) /* smoke doesn't use frame 0 as info frame so can't check based on totpoint */ if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes) - BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes); + BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%i frames found!"), totframes); else if (totframes && cache->totpoint) - BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint); + BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%i points found!"), cache->totpoint); else - BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!"); + BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("No valid data to read!")); return; } @@ -3518,9 +3520,9 @@ void BKE_ptcache_update_info(PTCacheID *pid) int totpoint = pid->totpoint(pid->calldata, 0); if (cache->totpoint > totpoint) - BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint); + BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i cells + High Resolution cached"), totpoint); else - BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint); + BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i cells cached"), totpoint); } else { int cfra = cache->startframe; @@ -3530,7 +3532,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) totframes++; } - BLI_snprintf(mem_info, sizeof(mem_info), "%i frames on disk", totframes); + BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames on disk"), totframes); } } else { @@ -3554,17 +3556,18 @@ void BKE_ptcache_update_info(PTCacheID *pid) mb = (bytes > 1024.0f * 1024.0f); - BLI_snprintf(mem_info, sizeof(mem_info), "%i frames in memory (%.1f %s)", + BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames in memory (%.1f %s)"), totframes, bytes / (mb ? 1024.0f * 1024.0f : 1024.0f), - mb ? "Mb" : "kb"); + mb ? IFACE_("Mb") : IFACE_("kb")); } if (cache->flag & PTCACHE_OUTDATED) { - BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info); + BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%s, cache is outdated!"), mem_info); } else if (cache->flag & PTCACHE_FRAMES_SKIPPED) { - BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact); + BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%s, not exact since frame %i."), + mem_info, cache->last_exact); } else { BLI_snprintf(cache->info, sizeof(cache->info), "%s.", mem_info); @@ -3586,4 +3589,3 @@ void BKE_ptcache_invalidate(PointCache *cache) cache->last_exact = MIN2(cache->startframe, 0); } } - diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index a67bf00a559..a72d3767b69 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2481,10 +2481,11 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short /**************** select start/end operators **************/ -/* (de)selects first or last of visible part of each Nurb depending on selFirst */ -/* selFirst: defines the end of which to select */ -/* doswap: defines if selection state of each first/last control point is swapped */ -/* selstatus: selection status in case doswap is false */ +/* (de)selects first or last of visible part of each Nurb depending on selFirst + * selFirst: defines the end of which to select + * doswap: defines if selection state of each first/last control point is swapped + * selstatus: selection status in case doswap is false + */ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus) { ListBase *editnurb = object_editcurve_get(obedit); @@ -2558,7 +2559,7 @@ void CURVE_OT_de_select_first(wmOperatorType *ot) /* identifiers */ ot->name = "(De)select First"; ot->idname = "CURVE_OT_de_select_first"; - ot->description = "(De)select first of visible part of each Nurb"; + ot->description = "(De)select first of visible part of each NURBS"; /* api cfirstbacks */ ot->exec = de_select_first_exec; @@ -2583,7 +2584,7 @@ void CURVE_OT_de_select_last(wmOperatorType *ot) /* identifiers */ ot->name = "(De)select Last"; ot->idname = "CURVE_OT_de_select_last"; - ot->description = "(De)select last of visible part of each Nurb"; + ot->description = "(De)select last of visible part of each NURBS"; /* api clastbacks */ ot->exec = de_select_last_exec; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 9b2ed9f0984..36717507072 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2621,7 +2621,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...) va_list ap; char titlestr[256]; - BLI_snprintf(titlestr, sizeof(titlestr), "OK? %%i%d", ICON_QUESTION); + BLI_snprintf(titlestr, sizeof(titlestr), IFACE_("OK? %%i%d"), ICON_QUESTION); va_start(ap, str); vconfirm_opname(C, opname, titlestr, str, ap); @@ -2635,7 +2635,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...) * The operator state for this is implicitly OPERATOR_RUNNING_MODAL */ void uiPupMenuSaveOver(bContext *C, wmOperator *op, const char *filename) { - confirm_operator(C, op, "Save Over?", filename); + confirm_operator(C, op, IFACE_("Save Over?"), filename); } void uiPupMenuNotice(bContext *C, const char *str, ...) @@ -2653,7 +2653,7 @@ void uiPupMenuError(bContext *C, const char *str, ...) char nfmt[256]; char titlestr[256]; - BLI_snprintf(titlestr, sizeof(titlestr), "Error %%i%d", ICON_ERROR); + BLI_snprintf(titlestr, sizeof(titlestr), IFACE_("Error %%i%d"), ICON_ERROR); BLI_strncpy(nfmt, str, sizeof(nfmt)); @@ -2680,13 +2680,13 @@ void uiPupMenuReports(bContext *C, ReportList *reports) /* pass */ } else if (report->type >= RPT_ERROR) { - BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message); + BLI_dynstr_appendf(ds, IFACE_("Error %%i%d%%t|%s"), ICON_ERROR, report->message); } else if (report->type >= RPT_WARNING) { - BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message); + BLI_dynstr_appendf(ds, IFACE_("Warning %%i%d%%t|%s"), ICON_ERROR, report->message); } else if (report->type >= RPT_INFO) { - BLI_dynstr_appendf(ds, "Info %%i%d%%t|%s", ICON_INFO, report->message); + BLI_dynstr_appendf(ds, IFACE_("Info %%i%d%%t|%s"), ICON_INFO, report->message); } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index f827da6fcc4..8dc51387db7 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -3001,7 +3001,7 @@ void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop); - uiItemL(layout, "Input Color Space:", ICON_NONE); + uiItemL(layout, IFACE_("Input Color Space:"), ICON_NONE); uiItemR(layout, &colorspace_settings_ptr, "name", 0, "", ICON_NONE); } diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index 75e3d8d5685..e09a8b41262 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -57,4 +57,8 @@ set(SRC clip_intern.h ) +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_space_clip "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_clip/SConscript b/source/blender/editors/space_clip/SConscript index 2cbefee0170..c65a076186f 100644 --- a/source/blender/editors/space_clip/SConscript +++ b/source/blender/editors/space_clip/SConscript @@ -32,4 +32,7 @@ defs = [] incs = '../include ../../blenkernel ../../blenloader ../../blenfont ../../blenlib ../../imbuf ../../makesdna' incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../gpu' +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + env.BlenderLib ( 'bf_editors_space_clip', sources, Split(incs), defs, libtype=['core'], priority=[95] ) diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 2cb6d8c9234..e442de2ba66 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -43,6 +43,8 @@ #include "BLI_listbase.h" #include "BLI_rect.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_screen.h" @@ -124,7 +126,7 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c row = uiLayoutRow(layout, FALSE); block = uiLayoutGetBlock(row); - uiDefBut(block, LABEL, 0, "File Path:", 0, 19, 145, 19, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, IFACE_("File Path:"), 0, 19, 145, 19, NULL, 0, 0, 0, 0, ""); row = uiLayoutRow(layout, FALSE); split = uiLayoutSplit(row, 0.0f, FALSE); @@ -387,9 +389,9 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P block = uiLayoutGetBlock(layout); if (cb->marker_flag & MARKER_DISABLED) - tip = "Marker is disabled at current frame"; + tip = TIP_("Marker is disabled at current frame"); else - tip = "Marker is enabled at current frame"; + tip = TIP_("Marker is enabled at current frame"); bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip); @@ -405,7 +407,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P if (track->flag & TRACK_LOCKED) { uiLayoutSetActive(layout, FALSE); block = uiLayoutAbsoluteBlock(layout); - uiDefBut(block, LABEL, 0, "Track is locked", 0, 0, 300, 19, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, 300, 19, NULL, 0, 0, 0, 0, ""); return; } @@ -434,12 +436,12 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P uiBlockSetNFunc(block, marker_update_cb, cb, NULL); if (cb->marker_flag & MARKER_DISABLED) - tip = "Marker is disabled at current frame"; + tip = TIP_("Marker is disabled at current frame"); else - tip = "Marker is enabled at current frame"; + tip = TIP_("Marker is enabled at current frame"); - uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, "Enabled", 10, 190, 145, 19, &cb->marker_flag, - 0, 0, 0, 0, tip); + uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, IFACE_("Enabled"), 10, 190, 145, 19, + &cb->marker_flag, 0, 0, 0, 0, tip); col = uiLayoutColumn(layout, TRUE); uiLayoutSetActive(col, (cb->marker_flag & MARKER_DISABLED) == 0); @@ -447,33 +449,34 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P block = uiLayoutAbsoluteBlock(col); uiBlockBeginAlign(block); - uiDefBut(block, LABEL, 0, "Position:", 0, 190, 300, 19, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_POS, "X:", 10, 171, 145, 19, &cb->marker_pos[0], - -10 * width, 10.0 * width, step, digits, "X-position of marker at frame in screen coordinates"); - uiDefButF(block, NUM, B_MARKER_POS, "Y:", 165, 171, 145, 19, &cb->marker_pos[1], - -10 * height, 10.0 * height, step, digits, "Y-position of marker at frame in screen coordinates"); - - uiDefBut(block, LABEL, 0, "Offset:", 0, 152, 300, 19, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_OFFSET, "X:", 10, 133, 145, 19, &cb->track_offset[0], - -10 * width, 10.0 * width, step, digits, "X-offset to parenting point"); - uiDefButF(block, NUM, B_MARKER_OFFSET, "Y:", 165, 133, 145, 19, &cb->track_offset[1], - -10 * height, 10.0 * height, step, digits, "Y-offset to parenting point"); - - uiDefBut(block, LABEL, 0, "Pattern Area:", 0, 114, 300, 19, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Width:", 10, 95, 300, 19, &cb->marker_pat[0], 3.0f, - 10.0 * width, step, digits, "Width of marker's pattern in screen coordinates"); - uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Height:", 10, 76, 300, 19, &cb->marker_pat[1], 3.0f, - 10.0 * height, step, digits, "Height of marker's pattern in screen coordinates"); - - uiDefBut(block, LABEL, 0, "Search Area:", 0, 57, 300, 19, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "X:", 10, 38, 145, 19, &cb->marker_search_pos[0], - -width, width, step, digits, "X-position of search at frame relative to marker's position"); - uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "Y:", 165, 38, 145, 19, &cb->marker_search_pos[1], - -height, height, step, digits, "X-position of search at frame relative to marker's position"); - uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Width:", 10, 19, 300, 19, &cb->marker_search[0], 3.0f, - 10.0 * width, step, digits, "Width of marker's search in screen soordinates"); - uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Height:", 10, 0, 300, 19, &cb->marker_search[1], 3.0f, - 10.0 * height, step, digits, "Height of marker's search in screen soordinates"); + uiDefBut(block, LABEL, 0, IFACE_("Position:"), 0, 190, 300, 19, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, NUM, B_MARKER_POS, IFACE_("X:"), 10, 171, 145, 19, &cb->marker_pos[0], + -10 * width, 10.0 * width, step, digits, TIP_("X-position of marker at frame in screen coordinates")); + uiDefButF(block, NUM, B_MARKER_POS, IFACE_("Y:"), 165, 171, 145, 19, &cb->marker_pos[1], + -10 * height, 10.0 * height, step, digits, + TIP_("Y-position of marker at frame in screen coordinates")); + + uiDefBut(block, LABEL, 0, IFACE_("Offset:"), 0, 152, 300, 19, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, NUM, B_MARKER_OFFSET, IFACE_("X:"), 10, 133, 145, 19, &cb->track_offset[0], + -10 * width, 10.0 * width, step, digits, TIP_("X-offset to parenting point")); + uiDefButF(block, NUM, B_MARKER_OFFSET, IFACE_("Y:"), 165, 133, 145, 19, &cb->track_offset[1], + -10 * height, 10.0 * height, step, digits, TIP_("Y-offset to parenting point")); + + uiDefBut(block, LABEL, 0, IFACE_("Pattern Area:"), 0, 114, 300, 19, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, NUM, B_MARKER_PAT_DIM, IFACE_("Width:"), 10, 95, 300, 19, &cb->marker_pat[0], 3.0f, + 10.0 * width, step, digits, TIP_("Width of marker's pattern in screen coordinates")); + uiDefButF(block, NUM, B_MARKER_PAT_DIM, IFACE_("Height:"), 10, 76, 300, 19, &cb->marker_pat[1], 3.0f, + 10.0 * height, step, digits, TIP_("Height of marker's pattern in screen coordinates")); + + uiDefBut(block, LABEL, 0, IFACE_("Search Area:"), 0, 57, 300, 19, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, NUM, B_MARKER_SEARCH_POS, IFACE_("X:"), 10, 38, 145, 19, &cb->marker_search_pos[0], + -width, width, step, digits, TIP_("X-position of search at frame relative to marker's position")); + uiDefButF(block, NUM, B_MARKER_SEARCH_POS, IFACE_("Y:"), 165, 38, 145, 19, &cb->marker_search_pos[1], + -height, height, step, digits, TIP_("Y-position of search at frame relative to marker's position")); + uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, IFACE_("Width:"), 10, 19, 300, 19, &cb->marker_search[0], 3.0f, + 10.0 * width, step, digits, TIP_("Width of marker's search in screen coordinates")); + uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, IFACE_("Height:"), 10, 0, 300, 19, &cb->marker_search[1], 3.0f, + 10.0 * height, step, digits, TIP_("Height of marker's search in screen coordinates")); uiBlockEndAlign(block); } diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index ad70abf5732..7543988b5aa 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -33,11 +33,15 @@ #include "DNA_windowmanager_types.h" +#include "RNA_access.h" + #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_screen.h" @@ -197,16 +201,16 @@ static void clip_panel_operator_redo_header(const bContext *C, Panel *pa) wmOperator *op = WM_operator_last_redo(C); if (op) - BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); + BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname)); else - BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname)); + BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname)); } static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op) { if (op->type->flag & OPTYPE_MACRO) { for (op = op->macro.first; op; op = op->next) { - uiItemL(pa->layout, op->type->name, ICON_NONE); + uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE); clip_panel_operator_redo_operator(C, pa, op); } } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 2d2d29d9eaa..0d1156a837a 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1084,7 +1084,7 @@ void IMAGE_OT_match_movie_length(wmOperatorType *ot) { /* identifiers */ ot->name = "Match Movie Length"; - ot->description = "Set image's users length to the one of this video"; + ot->description = "Set image's user's length to the one of this video"; ot->idname = "IMAGE_OT_match_movie_length"; /* api callbacks */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 2140f90664e..612802c46d1 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3800,7 +3800,8 @@ static void def_cmp_bokehblur(StructRNA *srna) /* duplicated in def_cmp_blur */ prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE); - RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input"); + RNA_def_property_ui_text(prop, "Variable Size", + "Support variable blur per-pixel when using an image for size input"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); #if 0 diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 41dd618caa5..f43541ec283 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1681,18 +1681,26 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar split = uiLayoutSplit(layout, 0.0f, FALSE); col = uiLayoutColumn(split, FALSE); - uiItemL(col, "Links", ICON_NONE); - uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); - uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); - uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-266"); - uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.6/Manual"); + uiItemL(col, IFACE_("Links"), ICON_NONE); + uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", + "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); + uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", + "http://www.blender.org/development/credits"); + uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", + "http://www.blender.org/development/release-logs/blender-266"); + uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", + "http://wiki.blender.org/index.php/Doc:2.6/Manual"); uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); - uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); + uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", + "http://www.blender.org/community/user-community"); if (strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release") == 0) { - BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION / 100, BLENDER_VERSION % 100); + BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" + STRINGIFY(BLENDER_VERSION_CHAR) "_release", + BLENDER_VERSION / 100, BLENDER_VERSION % 100); } else { - BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION); + BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", + BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION); } uiItemStringO(col, IFACE_("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url); uiItemL(col, "", ICON_NONE); -- cgit v1.2.3 From 7cdff04f9f1b792eb99a0128189ad145f3921922 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 17 Feb 2013 14:00:40 +0000 Subject: Fixes for BMO_error_raise extraction regex, and add hindi to "active" translations. Also enhanced the ugly py ast parsing code, so that it now can handle (up to some extent) "name" function nodes, and add bpy.app.translations.pgettext func familly to extracted ones... This ast py parsing becomes more and more ugly, should probably try to refactor it a bit. :/ --- .../modules/bl_i18n_utils/bl_process_msg.py | 148 +++++++++++++-------- release/scripts/modules/bl_i18n_utils/settings.py | 4 +- 2 files changed, 92 insertions(+), 60 deletions(-) diff --git a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py index 5381af8d543..006d7170571 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py +++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py @@ -435,41 +435,71 @@ def dump_py_messages_from_files(messages, check_ctxt, files): # ------------------------------------------------------------------------- # Gather function names - # so far only 'text' keywords, but we may want others translated later - translate_kw = ("text", ) - - # key: func_id - # val: [(arg_kw, arg_pos), (arg_kw, arg_pos), ...] + # In addition of UI func, also parse pgettext ones... + # Tuples of (module name, (short names, ...)). + pgettext_variants = ( + ("pgettext", ("_",)), + ("pgettext_iface", ("iface_",)), + ("pgettext_tip", ("tip_",)) + ) + pgettext_variants_args = {"msgid": (0, {"msgctxt": 1})} + + # key: msgid keywords. + # val: tuples of ((keywords,), context_getter_func) to get a context for that msgid. + # Note: order is important, first one wins! + translate_kw = { + "text": ((("text_ctxt",), _ctxt_to_ctxt), + (("operator",), _op_to_ctxt), + ), + "msgid": ((("msgctxt",), _ctxt_to_ctxt), + ), + } + + context_kw_set = {} + for k, ctxts in translate_kw.items(): + s = set() + for c, _ in ctxts: + s |= set(c) + context_kw_set[k] = s + + # {func_id: {msgid: (arg_pos, + # {msgctxt: arg_pos, + # ... + # } + # ), + # ... + # }, + # ... + # } func_translate_args = {} - # as we only have one translate keyword, no need for complex context extraction setup for now... - # And it's already enough complex like that! - # Note: order is important, first one wins! - context_kw = ((("text_ctxt",), _ctxt_to_ctxt), - (("operator",), _op_to_ctxt), - ) - context_kw_set = set() - for c, _ in context_kw: - context_kw_set |= set(c) - - # Like func_translate_args. - func_context_args = {} + # First, functions from UILayout + # First loop is for msgid args, second one is for msgctxt args. + for func_id, func in bpy.types.UILayout.bl_rna.functions.items(): + # check it has one or more arguments as defined in translate_kw + for arg_pos, (arg_kw, arg) in enumerate(func.parameters.items()): + if ((arg_kw in translate_kw) and (not arg.is_output) and (arg.type == 'STRING')): + func_translate_args.setdefault(func_id, {})[arg_kw] = (arg_pos, {}) + for func_id, func in bpy.types.UILayout.bl_rna.functions.items(): + if func_id not in func_translate_args: + continue + for arg_pos, (arg_kw, arg) in enumerate(func.parameters.items()): + if (not arg.is_output) and (arg.type == 'STRING'): + for msgid, msgctxts in context_kw_set.items(): + if arg_kw in msgctxts: + func_translate_args[func_id][msgid][1][arg_kw] = arg_pos + # We manually add funcs from bpy.app.translations + for func_id, func_ids in pgettext_variants: + func_translate_args[func_id] = pgettext_variants_args + for func_id in func_ids: + func_translate_args[func_id] = pgettext_variants_args + #print(func_translate_args) # Break recursive nodes look up on some kind of nodes. # E.g. we don’t want to get strings inside subscripts (blah["foo"])! - stopper_nodes = {ast.Subscript, } + stopper_nodes = {ast.Subscript} # Consider strings separate: ("a" if test else "b") - separate_nodes = {ast.IfExp, } - - # For now only consider functions from UILayout... - for func_id, func in bpy.types.UILayout.bl_rna.functions.items(): - # check it has one or more arguments as defined in translate_kw - for (arg_pos, (arg_kw, arg)) in enumerate(func.parameters.items()): - if ((arg_kw in translate_kw) and (not arg.is_output) and (arg.type == 'STRING')): - func_translate_args.setdefault(func_id, []).append((arg_kw, arg_pos)) - elif ((arg_kw in context_kw_set) and (not arg.is_output) and (arg.type == 'STRING')): - func_context_args.setdefault(func_id, []).append((arg_kw, arg_pos)) - #print(func_context_args) + separate_nodes = {ast.IfExp} check_ctxt_py = None if check_ctxt: @@ -489,40 +519,42 @@ def dump_py_messages_from_files(messages, check_ctxt, files): # print("found function at") # print("%s:%d" % (fp, node.lineno)) - # lambda's + # We can't skip such situations! from blah import foo\nfoo("bar") would also be an ast.Name func! if type(node.func) == ast.Name: + func_id = node.func.id + elif hasattr(node.func, "attr"): + func_id = node.func.attr + # Ugly things like getattr(self, con.type)(context, box, con) + else: continue - # getattr(self, con.type)(context, box, con) - if not hasattr(node.func, "attr"): - continue - - # First try to get i18n context. - context_args = func_context_args.get(node.func.attr, ()) - context = "" - context_elements = {} - for arg_kw, arg_pos in context_args: - if arg_pos < len(node.args): - context_elements[arg_kw] = node.args[arg_pos] - else: - for kw in node.keywords: - if kw.arg == arg_kw: - context_elements[arg_kw] = kw.value + func_args = func_translate_args.get(func_id, {}) + + # First try to get i18n contexts, for every possible msgid id. + contexts = dict.fromkeys(func_args.keys(), "") + for msgid, (_, context_args) in func_args.items(): + context_elements = {} + for arg_kw, arg_pos in context_args.items(): + if arg_pos < len(node.args): + context_elements[arg_kw] = node.args[arg_pos] + else: + for kw in node.keywords: + if kw.arg == arg_kw: + context_elements[arg_kw] = kw.value + break + #print(context_elements) + for kws, proc in translate_kw[msgid]: + if set(kws) <= context_elements.keys(): + args = tuple(context_elements[k] for k in kws) + #print("running ", proc, " with ", args) + ctxt = proc(*args) + if ctxt: + contexts[msgid] = ctxt break - #print(context_elements) - for kws, proc in context_kw: - if set(kws) <= context_elements.keys(): - args = tuple(context_elements[k] for k in kws) - #print("running ", proc, " with ", args) - ctxt = proc(*args) - if ctxt: - context = ctxt - break - - translate_args = func_translate_args.get(node.func.attr, ()) + #print(translate_args) # do nothing if not found - for arg_kw, arg_pos in translate_args: + for arg_kw, (arg_pos, _) in func_args.items(): estr_lst = [(None, ())] if arg_pos < len(node.args): estr_lst = extract_strings_split(node.args[arg_pos]) @@ -535,7 +567,7 @@ def dump_py_messages_from_files(messages, check_ctxt, files): #print(estr, nds) for estr, nds in estr_lst: if estr: - key = (context, estr) + key = (contexts[arg_kw], estr) if nds: msgsrc = ["{}:{}".format(fp_rel, sorted({nd.lineno for nd in nds})[0])] else: diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 01bc925cedd..232f54f5140 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -94,7 +94,7 @@ LANGUAGES_FILE = "languages" IMPORT_MIN_LEVEL = -1 # Languages in /branches we do not want to import in /trunk currently... -IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'hi', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'} +IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'} # The comment prefix used in generated messages.txt file. MSG_COMMENT_PREFIX = "#~ " @@ -229,7 +229,7 @@ PYGETTEXT_KEYWORDS = (() + tuple(("{}\\((?:[^\"',]+,){{1,2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf")) + - tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*,").format(it) + tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it) for it in ("BMO_error_raise",)) + tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) -- cgit v1.2.3 From 4529459a07082e714b7f9c222b9a8003939a145b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Feb 2013 14:38:35 +0000 Subject: remove stipple from console selection drawing. --- source/blender/editors/space_info/textview.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index fc0a7b3b883..14a0aee09bd 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -74,15 +74,12 @@ static void console_draw_sel(const int sel[2], const int xy[2], const int str_le const int sta = max_ii(sel[0], 0); const int end = min_ii(sel[1], str_len_draw); - glEnable(GL_POLYGON_STIPPLE); - glPolygonStipple(stipple_halftone); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4ub(255, 255, 255, 48); glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2); - glDisable(GL_POLYGON_STIPPLE); glDisable(GL_BLEND); } } -- cgit v1.2.3 From 0aabcaca2844ce1bc0f702c20c60a7cef53eef44 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 17 Feb 2013 14:53:29 +0000 Subject: Fix #34285: sculpt/paint radial control F key operators did not adjust brush size to retina pixel size correctly. --- source/blender/windowmanager/intern/wm_operators.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f43541ec283..9939e6b69ba 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3391,6 +3391,11 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd break; } + /* adjust for DPI, like BKE_brush_size_get */ + r1 *= U.pixelsize; + r2 *= U.pixelsize; + tex_radius *= U.pixelsize; + /* Keep cursor in the original place */ x = rc->initial_mouse[0] - ar->winrct.xmin; y = rc->initial_mouse[1] - ar->winrct.ymin; -- cgit v1.2.3 From 3de87ebf649fbe4adddc281e1b6fa5473508e6b8 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 17 Feb 2013 15:04:56 +0000 Subject: Minor fix... --- release/scripts/modules/bl_i18n_utils/spell_check_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py index f2d777d22f1..6adf3213b56 100644 --- a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py +++ b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py @@ -220,7 +220,7 @@ dict_uimsgs = { "grless", "http", "init", - "kbit", + "kbit", "kb", "lensdist", "loc", "rot", "pos", "lorem", -- cgit v1.2.3 From 85b6bbe6cd0dd7cc7b9bb403c42aaa6399dea710 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sun, 17 Feb 2013 18:13:22 +0000 Subject: ribidbody: Fix setting "Bake to Keyframes" start frame above 2 Simulation needs to run from the beginning to work properly. --- release/scripts/startup/bl_operators/rigidbody.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index bb3a9a6330f..652ad4bf784 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -120,7 +120,8 @@ class BakeToKeyframes(Operator): if objects: # store transformation data - for f in list(range(self.frame_start, self.frame_end + 1)): + # need to start at scene start frame so simulation is run from the beginning + for f in list(range(scene.frame_start, self.frame_end + 1)): scene.frame_set(f) if f in frames: mat = {} -- cgit v1.2.3 From ee64cbaf3916002845af17e153855ca125f67bd7 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Sun, 17 Feb 2013 18:33:10 +0000 Subject: fix #34284 Collada: update problem for vertex weights directly after import. --- source/blender/collada/ArmatureImporter.cpp | 75 ++++++++++++++++++----------- source/blender/collada/DocumentImporter.cpp | 19 +++++--- 2 files changed, 58 insertions(+), 36 deletions(-) diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index fefad7dd8ec..c270a1e6b20 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -415,10 +415,23 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) break; } - if (shared) + if (!shared && this->joint_parent_map.size() > 0) { + // All armatures have been created while creating the Node tree. + // The Collada exporter currently does not create a + // strict relationship between geometries and armatures + // So when we reimport a Blender collada file, then we have + // to guess what is meant. + // XXX This is not safe when we have more than one armatures + // in the import. + shared = this->joint_parent_map.begin()->second; + } + + if (shared) { ob_arm = skin.set_armature(shared); - else + } + else { ob_arm = skin.create_armature(scene); //once for every armature + } // enter armature edit mode ED_armature_to_edit(ob_arm); @@ -659,38 +672,44 @@ void ArmatureImporter::make_shape_keys() //Prereq: all the geometries must be imported and mesh objects must be made Object *source_ob = this->mesh_importer->get_object_by_geom_uid((*mc)->getSource()); - Mesh *source_me = (Mesh*) source_ob->data; - //insert key to source mesh - Key *key = source_me->key = BKE_key_add((ID *)source_me); - key->type = KEY_RELATIVE; - KeyBlock *kb; - - //insert basis key - kb = BKE_keyblock_add_ctime(key, "Basis", FALSE); - BKE_key_convert_from_mesh(source_me, kb); + if (source_ob) { - //insert other shape keys - for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) { - //better to have a seperate map of morph objects, - //This'll do for now since only mesh morphing is imported - - Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]); + Mesh *source_me = (Mesh*) source_ob->data; + //insert key to source mesh + Key *key = source_me->key = BKE_key_add((ID *)source_me); + key->type = KEY_RELATIVE; + KeyBlock *kb; - if (me) { - me->key = key; - std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name); + //insert basis key + kb = BKE_keyblock_add_ctime(key, "Basis", FALSE); + BKE_key_convert_from_mesh(source_me, kb); + + //insert other shape keys + for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) { + //better to have a seperate map of morph objects, + //This'll do for now since only mesh morphing is imported - kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE); - BKE_key_convert_from_mesh(me, kb); + Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]); - //apply weights - weight = morphWeights.getFloatValues()->getData()[i]; - kb->curval = weight; - } - else { - fprintf(stderr, "Morph target geometry not found.\n"); + if (me) { + me->key = key; + std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name); + + kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE); + BKE_key_convert_from_mesh(me, kb); + + //apply weights + weight = morphWeights.getFloatValues()->getData()[i]; + kb->curval = weight; + } + else { + fprintf(stderr, "Morph target geometry not found.\n"); + } } } + else { + fprintf(stderr, "Morph target object not found.\n"); + } } } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 8af4d0652d9..b1103d78394 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -180,14 +180,16 @@ void DocumentImporter::finish() { if (mImportStage != General) return; - + + Main *bmain = CTX_data_main(mContext); + // TODO: create a new scene except the selected - use current blender scene for it + Scene *sce = CTX_data_scene(mContext); + /** TODO Break up and put into 2-pass parsing of DAE */ std::vector::iterator it; for (it = vscenes.begin(); it != vscenes.end(); it++) { PointerRNA sceneptr, unit_settings; PropertyRNA *system, *scale; - // TODO: create a new scene except the selected - use current blender scene for it - Scene *sce = CTX_data_scene(mContext); // for scene unit settings: system, scale_length @@ -228,7 +230,6 @@ void DocumentImporter::finish() } // update scene - Main *bmain = CTX_data_main(mContext); DAG_scene_sort(bmain, sce); DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL); @@ -241,6 +242,8 @@ void DocumentImporter::finish() armature_importer.set_tags_map(this->uid_tags_map); armature_importer.make_armatures(mContext); armature_importer.make_shape_keys(); + DAG_scene_sort(bmain, sce); + DAG_ids_flush_update(bmain, 0); #if 0 armature_importer.fix_animation(); @@ -273,8 +276,8 @@ void DocumentImporter::finish() } libnode_ob.clear(); - DAG_scene_sort(CTX_data_main(mContext), sce); - DAG_ids_flush_update(CTX_data_main(mContext), 0); + DAG_scene_sort(bmain, sce); + DAG_ids_flush_update(bmain, 0); } } @@ -541,13 +544,13 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) { //Check if Object is armature, by checking if immediate child is a JOINT node. if (is_armature(node)) { - ob = bc_add_object(sce, OB_ARMATURE, NULL); + ob = bc_add_object(sce, OB_ARMATURE, name.c_str()); } else { ob = bc_add_object(sce, OB_EMPTY, NULL); } - objects_done->push_back(ob); + } // XXX: if there're multiple instances, only one is stored -- cgit v1.2.3 From 029686a2fd7819ef0047dc4dc566d4f08d647624 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 17 Feb 2013 18:46:50 +0000 Subject: Bug fix #34281 The RNA path interpretor code was using a function to get the portion between quotes, this function was not even checking if there *are* quotes at all! Causing bad memory allocs or crashes. --- source/blender/blenlib/intern/string.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 28fdf7b61db..3500f3f1805 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -199,12 +199,15 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict /* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */ startMatch = strstr(str, prefix) + prefixLen + 1; - - /* get the end point (i.e. where the next occurance of " is after the starting point) */ - endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */ - - /* return the slice indicated */ - return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch)); + if (startMatch) { + /* get the end point (i.e. where the next occurance of " is after the starting point) */ + endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */ + + if (endMatch) + /* return the slice indicated */ + return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch)); + } + return BLI_strdupn("", 0); } /* Replaces all occurrences of oldText with newText in str, returning a new string that doesn't -- cgit v1.2.3 From 3e0725854c091c48695bf89da66e927aad611574 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sun, 17 Feb 2013 19:38:08 +0000 Subject: rigidbody: Fix regression in background scene fix Since BKE_object_where_is_calc() might be called outside of scene_update_tagged_recursive(), we need to fall back to the scene's rigid body world. --- source/blender/blenkernel/intern/object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b810aa89257..58b47398a7d 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2145,6 +2145,8 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime, BKE_object_to_mat4(ob, ob->obmat); } + /* try to fall back to the scene rigid body world if none given */ + rbw = rbw ? rbw : scene->rigidbody_world; /* read values pushed into RBO from sim/cache... */ BKE_rigidbody_sync_transforms(rbw, ob, ctime); -- cgit v1.2.3 From aefa6261c324b8117c25041c285b6cb1eaab31f8 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 17 Feb 2013 21:44:13 +0000 Subject: == Sequencer == This fixes a bug in sequencer cut tool: * if you cut two strips of the same name class (MVI_XXXX.MOV and MVI_XXXX.001) the two new generated strips will end up with the same name. (easy test case: add a MOV file with it's accompanying audio track to the timeline and then cut both strips at once into two pieces) * visible problem: your animation data will get messed up on the way, since the animation system doesn't know, which strip it should assign the animation. Problem was caused by generating a new list of sequences within the cut_seq_list() function: Since dupli_seq() can't see the members of the new list of sequences, it won't be able to assign unique names in all cases. --- .../editors/space_sequencer/sequencer_edit.c | 48 ++++++++++++++-------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 97943f7e6ac..cec9373ebd7 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -817,40 +817,56 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) /* like duplicate, but only duplicate and cut overlapping strips, - * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */ -static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe, + * strips to the left of the cutframe are ignored and strips to the right + * are moved to the end of slist + * we have to work on the same slist (not using a seperate list), since + * otherwise dupli_seq can't check for duplicate names properly and + * may generate strips with the same name (which will mess up animdata) + */ + +static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, Sequence * (*cut_seq)(Scene *, Sequence *, int)) { int did_something = FALSE; Sequence *seq, *seq_next_iter; - seq = old->first; + for (seq = slist->first; seq; seq = seq->next) { + seq->tmp = NULL; + } - while (seq) { + seq = slist->first; + + while (seq && !seq->tmp) { seq_next_iter = seq->next; /* we need this because we may remove seq */ - - seq->tmp = NULL; + /* only handle strips not marked as new */ if (seq->flag & SELECT) { if (cutframe > seq->startdisp && cutframe < seq->enddisp) { Sequence *seqn = cut_seq(scene, seq, cutframe); if (seqn) { - BLI_addtail(new, seqn); + BLI_addtail(slist, seqn); + seqn->tmp = seq; /* mark as new */ + did_something = TRUE; } - did_something = TRUE; } else if (seq->enddisp <= cutframe) { /* do nothing */ } else if (seq->startdisp >= cutframe) { - /* move into new list */ - BLI_remlink(old, seq); - BLI_addtail(new, seq); + /* move to tail and mark as new */ + BLI_remlink(slist, seq); + BLI_addtail(slist, seq); + seq->tmp = seq; } } seq = seq_next_iter; } + + for (; seq; seq = seq->next) { + seq->tmp = NULL; + } + return did_something; } @@ -1488,25 +1504,21 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) Editing *ed = BKE_sequencer_editing_get(scene, FALSE); int cut_side, cut_hard, cut_frame; - ListBase newlist; int changed; cut_frame = RNA_int_get(op->ptr, "frame"); cut_hard = RNA_enum_get(op->ptr, "type"); cut_side = RNA_enum_get(op->ptr, "side"); - newlist.first = newlist.last = NULL; - if (cut_hard == SEQ_CUT_HARD) { - changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard); + changed = cut_seq_list(scene, ed->seqbasep, cut_frame, cut_seq_hard); } else { - changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft); + changed = cut_seq_list(scene, ed->seqbasep, cut_frame, cut_seq_soft); } - if (newlist.first) { /* got new strips ? */ + if (changed) { /* got new strips ? */ Sequence *seq; - BLI_movelisttolist(ed->seqbasep, &newlist); if (cut_side != SEQ_SIDE_BOTH) { SEQP_BEGIN (ed, seq) -- cgit v1.2.3 From 42a81550f9b1ab4af7945580922c897425becf7f Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 17 Feb 2013 22:13:00 +0000 Subject: == Sequencer == Made my last fix a little bit faster and more elegant by not playing around with seq->tmp (only reseting it to NULL, like the old code). --- .../editors/space_sequencer/sequencer_edit.c | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index cec9373ebd7..ab7a2f38744 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -827,18 +827,14 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, Sequence * (*cut_seq)(Scene *, Sequence *, int)) { - int did_something = FALSE; Sequence *seq, *seq_next_iter; - - for (seq = slist->first; seq; seq = seq->next) { - seq->tmp = NULL; - } + Sequence *seq_first_new = NULL; seq = slist->first; - while (seq && !seq->tmp) { + while (seq && seq != seq_first_new) { seq_next_iter = seq->next; /* we need this because we may remove seq */ - /* only handle strips not marked as new */ + seq->tmp = NULL; if (seq->flag & SELECT) { if (cutframe > seq->startdisp && cutframe < seq->enddisp) @@ -846,28 +842,24 @@ static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, Sequence *seqn = cut_seq(scene, seq, cutframe); if (seqn) { BLI_addtail(slist, seqn); - seqn->tmp = seq; /* mark as new */ - did_something = TRUE; + seq_first_new = seq_first_new ?: seqn; } } else if (seq->enddisp <= cutframe) { /* do nothing */ } else if (seq->startdisp >= cutframe) { - /* move to tail and mark as new */ + /* move to tail */ BLI_remlink(slist, seq); BLI_addtail(slist, seq); - seq->tmp = seq; + + seq_first_new = seq_first_new ?: seq; } } seq = seq_next_iter; } - for (; seq; seq = seq->next) { - seq->tmp = NULL; - } - - return did_something; + return (seq_first_new != NULL); } static int insert_gap(Scene *scene, int gap, int cfra) -- cgit v1.2.3 From d45612aa412798d5529027afd068adc79b8465f1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Feb 2013 02:36:36 +0000 Subject: fix [#34279] Python console: Selected region is not highlighted when using white background color --- .../presets/interface_theme/back_to_black.xml | 3 ++- .../presets/interface_theme/blender_24x.xml | 3 ++- .../scripts/presets/interface_theme/elsyiun.xml | 3 ++- .../scripts/presets/interface_theme/hexagon.xml | 3 ++- .../presets/interface_theme/ubuntu_ambiance.xml | 3 ++- source/blender/blenlib/intern/math_color_inline.c | 3 ++- source/blender/editors/include/UI_resources.h | 1 + source/blender/editors/interface/resources.c | 10 ++++++++ .../blender/editors/space_console/console_draw.c | 5 ++++ source/blender/editors/space_info/info_draw.c | 4 +++- source/blender/editors/space_info/textview.c | 28 +++++++++++++++------- source/blender/editors/space_info/textview.h | 1 + source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/makesrna/intern/rna_userdef.c | 7 ++++++ 14 files changed, 59 insertions(+), 17 deletions(-) diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml index bb625c6452c..05216841cbd 100644 --- a/release/scripts/presets/interface_theme/back_to_black.xml +++ b/release/scripts/presets/interface_theme/back_to_black.xml @@ -800,7 +800,8 @@ line_input="#cecece" line_info="#00aa00" line_error="#dc6060" - cursor="#dc6060"> + cursor="#dc6060" + select="#ffffff30"> + cursor="#dc6060" + select="#c6777799"> + cursor="#dc6060" + select="#4e4e8f80"> + cursor="#dc6060" + select="#ffffff30"> + cursor="#f47421" + select="#641f4480"> console_error; break; case TH_CONSOLE_CURSOR: cp = ts->console_cursor; break; + case TH_CONSOLE_SELECT: + cp = ts->console_select; break; case TH_HANDLE_VERTEX: cp = ts->handle_vertex; @@ -937,6 +939,7 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tconsole.console_info, 0, 170, 0, 255); rgba_char_args_set(btheme->tconsole.console_error, 220, 96, 96, 255); rgba_char_args_set(btheme->tconsole.console_cursor, 220, 96, 96, 255); + rgba_char_args_set(btheme->tconsole.console_select, 255, 255, 255, 48); /* space time */ btheme->ttime = btheme->tv3d; @@ -2135,6 +2138,13 @@ void init_userdef_do_versions(void) } } + if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 11)) { + bTheme *btheme; + for (btheme = U.themes.first; btheme; btheme = btheme->next) { + rgba_char_args_test_set(btheme->tconsole.console_select, 255, 255, 255, 48); + } + } + /* NOTE!! from now on use U.versionfile and U.subversionfile */ diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index c195cb39157..73747239255 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -193,6 +193,10 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha return TVC_LINE_FG; } +static void console_textview_const_colors(TextViewContext *UNUSED(tvc), unsigned char bg_sel[4]) +{ + UI_GetThemeColor4ubv(TH_CONSOLE_SELECT, bg_sel); +} static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar, int draw, int mval[2], void **mouse_pick, int *pos_pick) @@ -210,6 +214,7 @@ static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar, tvc.step = console_textview_step; tvc.line_get = console_textview_line_get; tvc.line_color = console_textview_line_color; + tvc.const_colors = console_textview_const_colors; tvc.arg1 = sc; tvc.arg2 = NULL; diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 54afc9a0849..a748c303b5d 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -251,7 +251,8 @@ static int report_textview_line_color(struct TextViewContext *tvc, unsigned char #undef USE_INFO_NEWLINE -static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick) +static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, ReportList *reports, + int draw, int mval[2], void **mouse_pick, int *pos_pick) { int ret = 0; @@ -264,6 +265,7 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, Re tvc.step = report_textview_step; tvc.line_get = report_textview_line_get; tvc.line_color = report_textview_line_color; + tvc.const_colors = NULL; tvc.arg1 = sinfo; tvc.arg2 = reports; diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 14a0aee09bd..66f4904c340 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -68,7 +68,8 @@ BLI_INLINE void console_step_sel(ConsoleDrawContext *cdc, const int step) cdc->sel[1] += step; } -static void console_draw_sel(const int sel[2], const int xy[2], const int str_len_draw, int cwidth, int lheight) +static void console_draw_sel(const int sel[2], const int xy[2], const int str_len_draw, int cwidth, int lheight, + const unsigned char bg_sel[4]) { if (sel[0] <= str_len_draw && sel[1] >= 0) { const int sta = max_ii(sel[0], 0); @@ -76,7 +77,7 @@ static void console_draw_sel(const int sel[2], const int xy[2], const int str_le glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4ub(255, 255, 255, 48); + glColor4ubv(bg_sel); glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2); @@ -84,12 +85,11 @@ static void console_draw_sel(const int sel[2], const int xy[2], const int str_le } } - /* return 0 if the last line is off the screen * should be able to use this for any string type */ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const int str_len, - const unsigned char *fg, const unsigned char *bg) + const unsigned char fg[3], const unsigned char bg[3], const unsigned char bg_sel[4]) { int rct_ofs = cdc->lheight / 4; int tot_lines = (str_len / cdc->console_width) + 1; /* total number of lines for wrapping */ @@ -105,7 +105,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i /* wrap */ if (str_len > cdc->console_width) - ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next - cdc->xy[1])) * tot_lines)))); + ofs += cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / + (float)(y_next - cdc->xy[1])) * tot_lines))); CLAMP(ofs, 0, str_len); *cdc->pos_pick += str_len - ofs; @@ -155,7 +156,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i if (cdc->sel[0] != cdc->sel[1]) { console_step_sel(cdc, -initial_offset); // glColor4ub(255, 0, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight, bg_sel); console_step_sel(cdc, cdc->console_width); glColor3ubv(fg); } @@ -170,7 +171,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i if (cdc->sel[0] != cdc->sel[1]) { // glColor4ub(0, 255, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight, bg_sel); console_step_sel(cdc, cdc->console_width); glColor3ubv(fg); } @@ -204,7 +205,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i isel[1] = str_len - cdc->sel[0]; // glColor4ub(255, 255, 0, 96); // debug - console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); + console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight, bg_sel); console_step_sel(cdc, -(str_len + 1)); } @@ -266,6 +267,11 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous } if (tvc->begin(tvc)) { + unsigned char bg_sel[4] = {0}; + + if (draw && tvc->const_colors) { + tvc->const_colors(tvc, bg_sel); + } do { const char *ext_line; @@ -279,7 +285,11 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous tvc->line_get(tvc, &ext_line, &ext_len); - if (!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) { + if (!console_draw_string(&cdc, ext_line, ext_len, + (color_flag & TVC_LINE_FG) ? fg : NULL, + (color_flag & TVC_LINE_BG) ? bg : NULL, + bg_sel)) + { /* when drawing, if we pass v2d->cur.ymax, then quit */ if (draw) { break; /* past the y limits */ diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h index d0fab880dc3..653c9b83a50 100644 --- a/source/blender/editors/space_info/textview.h +++ b/source/blender/editors/space_info/textview.h @@ -46,6 +46,7 @@ typedef struct TextViewContext { int (*step)(struct TextViewContext *tvc); int (*line_get)(struct TextViewContext *tvc, const char **, int *); int (*line_color)(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3]); + void (*const_colors)(struct TextViewContext *tvc, unsigned char bg_sel[4]); /* constant theme colors */ void *iter; int iter_index; int iter_char; /* char intex, used for multi-line report display */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index cc53caa4c20..26b33783535 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -250,7 +250,7 @@ typedef struct ThemeSpace { char ds_channel[4], ds_subchannel[4]; /* dopesheet */ char console_output[4], console_input[4], console_info[4], console_error[4]; - char console_cursor[4]; + char console_cursor[4], console_select[4], pad1[4]; char vertex_size, outline_width, facedot_size; char noodle_curving; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2b2f1a2469b..9d5a0024c0a 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1689,6 +1689,13 @@ static void rna_def_userdef_theme_space_console(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Cursor", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "console_select"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Selection", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + } static void rna_def_userdef_theme_space_info(BlenderRNA *brna) -- cgit v1.2.3 From a0ede5be1de91beaf4bc23d4aea201a35845c6c0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Feb 2013 03:36:10 +0000 Subject: resolve build error in MSVC, was using a GNU C extension for ternary conditional. --- source/blender/editors/space_sequencer/sequencer_edit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index ab7a2f38744..7be2d51a3c0 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -842,7 +842,9 @@ static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, Sequence *seqn = cut_seq(scene, seq, cutframe); if (seqn) { BLI_addtail(slist, seqn); - seq_first_new = seq_first_new ?: seqn; + if (seq_first_new == NULL) { + seq_first_new = seqn; + } } } else if (seq->enddisp <= cutframe) { @@ -853,7 +855,9 @@ static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, BLI_remlink(slist, seq); BLI_addtail(slist, seq); - seq_first_new = seq_first_new ?: seq; + if (seq_first_new == NULL) { + seq_first_new = seq; + } } } seq = seq_next_iter; -- cgit v1.2.3 From 5cc377022b810cb2ab291a0064e5749b976e185a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 10:12:44 +0000 Subject: Correction to r54600 Calculate dependent area based on distortion model rather than using 15% of image resolution for this. Some assumptions here: - We're assuming real-life camera calibration is used here - Maximal undistortion delta would be achieved on frame boundary - Distortion fully goes inside frame This makes it possible to approximate margin for distortion by checking undistortion delta across frame boundary and use it for dependent area of interest. We do not use any formula-based equation here because we're likely support other distortion models and in that case it'll be stupid to try detecting formula here. --- source/blender/blenkernel/BKE_tracking.h | 3 ++ source/blender/blenkernel/intern/tracking.c | 61 ++++++++++++++++++++++ .../operations/COM_MovieDistortionOperation.cpp | 33 +++++++++--- .../operations/COM_MovieDistortionOperation.h | 1 + 4 files changed, 91 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index eb7004b1ced..9bdc96e187d 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -46,6 +46,7 @@ struct MovieDistortion; struct Camera; struct Object; struct Scene; +struct rcti; /* **** Common functions **** */ @@ -156,6 +157,8 @@ struct ImBuf *BKE_tracking_undistort_frame(struct MovieTracking *tracking, struc struct ImBuf *BKE_tracking_distort_frame(struct MovieTracking *tracking, struct ImBuf *ibuf, int calibration_width, int calibration_height, float overscan); +void BKE_tracking_max_undistortion_delta_across_bound(struct MovieTracking *tracking, struct rcti *rect, float delta[2]); + /* **** Image sampling **** */ struct ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, struct ImBuf *struct_ibuf, struct MovieTrackingTrack *track, diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 8b81e474e76..a6519f8005c 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1605,6 +1605,67 @@ ImBuf *BKE_tracking_distort_frame(MovieTracking *tracking, ImBuf *ibuf, int cali calibration_height, overscan, FALSE); } +void BKE_tracking_max_undistortion_delta_across_bound(MovieTracking *tracking, rcti *rect, float delta[2]) +{ + int a; + float pos[2], warped_pos[2]; + const int coord_delta = 5; + + delta[0] = delta[1] = -FLT_MAX; + + for (a = rect->xmin; a <= rect->xmax + coord_delta; a += coord_delta) { + if (a > rect->xmax) + a = rect->xmax; + + /* bottom edge */ + pos[0] = a; + pos[1] = rect->ymin; + + BKE_tracking_undistort_v2(tracking, pos, warped_pos); + + delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0])); + delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1])); + + /* top edge */ + pos[0] = a; + pos[1] = rect->ymax; + + BKE_tracking_undistort_v2(tracking, pos, warped_pos); + + delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0])); + delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1])); + + if (a >= rect->xmax) + break; + } + + for (a = rect->ymin; a <= rect->ymax + coord_delta; a += coord_delta) { + if (a > rect->ymax) + a = rect->ymax; + + /* left edge */ + pos[0] = rect->xmin; + pos[1] = a; + + BKE_tracking_undistort_v2(tracking, pos, warped_pos); + + delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0])); + delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1])); + + /* right edge */ + pos[0] = rect->xmax; + pos[1] = a; + + BKE_tracking_undistort_v2(tracking, pos, warped_pos); + + delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0])); + delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1])); + + if (a >= rect->ymax) + break; + } +} + /*********************** Image sampling *************************/ static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale) diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index b0fc21d4d55..863a404ba67 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -75,9 +75,31 @@ void MovieDistortionOperation::initExecution() calibration_width, calibration_height, this->m_distortion); s_cache.push_back(newC); this->m_cache = newC; + + if (this->m_distortion) { + float delta[2]; + rcti full_frame; + full_frame.xmin = full_frame.ymin = 0; + full_frame.xmax = this->m_width; + full_frame.ymax = this->m_height; + BKE_tracking_max_undistortion_delta_across_bound(&this->m_movieClip->tracking, &full_frame, delta); + + /* 5 is just in case we didn't hit real max of distortion in + * BKE_tracking_max_undistortion_delta_across_bound + */ + m_margin[0] = delta[0] + 5; + m_margin[1] = delta[1] + 5; + } + else { + /* undistortion with sane distortion coefficients would be mapped inside + * of each tile, should be no need in margin in this case + */ + m_margin[0] = m_margin[1] = 0; + } } else { this->m_cache = NULL; + m_margin[0] = m_margin[1] = 0; } } @@ -115,13 +137,10 @@ void MovieDistortionOperation::executePixel(float output[4], float x, float y, P bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { - const int marginX = this->m_width * 0.15; - const int marginY = this->m_height * 0.15; - rcti newInput; - newInput.xmin = input->xmin - marginX; - newInput.ymin = input->ymin - marginY; - newInput.xmax = input->xmax + marginX; - newInput.ymax = input->ymax + marginY; + newInput.xmin = input->xmin - m_margin[0]; + newInput.ymin = input->ymin - m_margin[1]; + newInput.xmax = input->xmax + m_margin[0]; + newInput.ymax = input->ymax + m_margin[1]; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index 4596fbd555b..c9629451992 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -148,6 +148,7 @@ private: DistortionCache *m_cache; SocketReader *m_inputOperation; MovieClip *m_movieClip; + int m_margin[2]; protected: bool m_distortion; -- cgit v1.2.3 From 971b0f1ed63c5d82c8e2956573affa663837543d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 10:45:46 +0000 Subject: Correction to cmake rules for libmv/ceres libmv still requires optimization switched off because of some incompatibility of SSBA and MSVC optimizer which makes bundle adjustment work just wrong. This shall not be an issue for Ceres and no need to disable optimization for extern_ceres --- extern/libmv/CMakeLists.txt | 4 ++-- extern/libmv/bundle.sh | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index a51f576d965..6b5a9a3b67a 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -26,6 +26,8 @@ # If you're doing changes in this file, please update template # in that script too +add_subdirectory(third_party) + set(INC . ../colamd/Include @@ -243,5 +245,3 @@ add_definitions( ) blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}") - -add_subdirectory(third_party) diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh index 23e90fc8f7d..27f964ad5b3 100755 --- a/extern/libmv/bundle.sh +++ b/extern/libmv/bundle.sh @@ -122,6 +122,8 @@ cat > CMakeLists.txt << EOF # If you're doing changes in this file, please update template # in that script too +add_subdirectory(third_party) + set(INC . ../colamd/Include -- cgit v1.2.3 From de23a9bfd5f693ac2e45f015ab0c9dc28782aee3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 11:50:03 +0000 Subject: Correction to previous commit, needed to tweak some include directories after shuffling order of subdirectories and compiler flags tweaks. --- extern/libmv/third_party/ceres/CMakeLists.txt | 1 + extern/libmv/third_party/ceres/bundle.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/extern/libmv/third_party/ceres/CMakeLists.txt b/extern/libmv/third_party/ceres/CMakeLists.txt index e2f06d74646..f0c0a4b269f 100644 --- a/extern/libmv/third_party/ceres/CMakeLists.txt +++ b/extern/libmv/third_party/ceres/CMakeLists.txt @@ -31,6 +31,7 @@ set(INC include internal ../gflags + ../../ ) set(INC_SYS diff --git a/extern/libmv/third_party/ceres/bundle.sh b/extern/libmv/third_party/ceres/bundle.sh index ccf6d0aca16..76630bc0626 100755 --- a/extern/libmv/third_party/ceres/bundle.sh +++ b/extern/libmv/third_party/ceres/bundle.sh @@ -120,6 +120,7 @@ set(INC include internal ../gflags + ../.. ) set(INC_SYS -- cgit v1.2.3 From 1c216337f08af38fbba0f60b9dc6036491a6ab2a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Feb 2013 12:00:17 +0000 Subject: make autocomplete use unicode character stepping (needed for bugfix). --- .../blender/editors/space_text/text_autocomplete.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 94977fc5f0f..62e5728bd3c 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -162,23 +162,28 @@ static GHash *text_autocomplete_build(Text *text) gh = BLI_ghash_str_new(__func__); for (linep = text->lines.first; linep; linep = linep->next) { - int i_start = 0; - int i_end = 0; + size_t i_start = 0; + size_t i_end = 0; + size_t i_step = 0; while (i_start < linep->len) { /* seek identifier beginning */ - while (i_start < linep->len && !text_check_identifier_nodigit(linep->line[i_start])) { - i_start++; + while ((i_start < linep->len) && + (!text_check_identifier_nodigit(BLI_str_utf8_as_unicode_step(&linep->line[i_start], &i_step)))) + { + i_start = i_step; } i_end = i_start; - while (i_end < linep->len && text_check_identifier(linep->line[i_end])) { - i_end++; + while ((i_end < linep->len) && + (!text_check_identifier(BLI_str_utf8_as_unicode_step(&linep->line[i_end], &i_step)))) + { + i_end = i_step; } if ((i_start != i_end) && /* check we're at the beginning of a line or that the previous char is not an identifier - * this prevents digits from being added */ - ((i_start < 1) || !text_check_identifier(linep->line[i_start - 1]))) + * this prevents digits from being added */ + ((i_start < 1) || !text_check_identifier(BLI_str_utf8_as_unicode(&linep->line[i_start - 1])))) { char *str_sub = &linep->line[i_start]; const int choice_len = i_end - i_start; -- cgit v1.2.3 From 5c5b7537798554cf7981a913ec3d248b6959893f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 18 Feb 2013 13:30:40 +0000 Subject: Fix [#34300] Slider for list of particle systems (keyed particles) is not doing anything. Navigating a list of more than 5 elements requires keyboard. Systematically adding some custom id to template_list using default UI_UL_list class, this one is commoly used more than once in an area, yielding collision issues if they do not have a custom id... --- release/scripts/startup/bl_ui/properties_data_armature.py | 3 ++- release/scripts/startup/bl_ui/properties_particle.py | 13 ++++++++----- release/scripts/startup/bl_ui/properties_physics_common.py | 3 ++- release/scripts/startup/bl_ui/properties_scene.py | 2 +- release/scripts/startup/bl_ui/space_clip.py | 2 +- release/scripts/startup/bl_ui/space_view3d_toolbar.py | 6 +++--- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 0f9d525f168..74f33170384 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -184,7 +184,8 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel): if poselib: # list of poses in pose library row = layout.row() - row.template_list("UI_UL_list", "", poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5) + row.template_list("UI_UL_list", "pose_markers", poselib, "pose_markers", + poselib.pose_markers, "active_index", rows=5) # column of operators for active pose # - goes beside list diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 0aa2c14a0c7..f6784cbbaa3 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -97,7 +97,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): if ob: row = layout.row() - row.template_list("UI_UL_list", "", ob, "particle_systems", ob.particle_systems, "active_index", rows=2) + row.template_list("UI_UL_list", "particle_systems", ob, "particle_systems", + ob.particle_systems, "active_index", rows=2) col = row.column(align=True) col.operator("object.particle_system_add", icon='ZOOMIN', text="") @@ -637,7 +638,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): layout.label(text="Fluid interaction:") row = layout.row() - row.template_list("UI_UL_list", "", psys, "targets", psys, "active_particle_target_index") + row.template_list("UI_UL_list", "particle_targets", psys, "targets", psys, "active_particle_target_index") col = row.column() sub = col.row() @@ -703,7 +704,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel): # Currently boids can only use the first state so these are commented out for now. #row = layout.row() - #row.template_list("UI_UL_list", "", boids, "states", boids, "active_boid_state_index", compact="True") + #row.template_list("UI_UL_list", "particle_boids", boids, "states", + # boids, "active_boid_state_index", compact="True") #col = row.row() #sub = col.row(align=True) #sub.operator("boid.state_add", icon='ZOOMIN', text="") @@ -724,7 +726,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel): row.label(text="") row = layout.row() - row.template_list("UI_UL_list", "", state, "rules", state, "active_boid_rule_index") + row.template_list("UI_UL_list", "particle_boids_rules", state, "rules", state, "active_boid_rule_index") col = row.column() sub = col.row() @@ -887,7 +889,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): if part.use_group_count and not part.use_whole_group: row = layout.row() - row.template_list("UI_UL_list", "", part, "dupli_weights", part, "active_dupliweight_index") + row.template_list("UI_UL_list", "particle_dupli_weights", part, "dupli_weights", + part, "active_dupliweight_index") col = row.column() sub = col.row() diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 90cf397f526..2d9d4649e28 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -108,7 +108,8 @@ def point_cache_ui(self, context, cache, enabled, cachetype): if not cachetype == 'RIGID_BODY': row = layout.row() - row.template_list("UI_UL_list", "", cache, "point_caches", cache.point_caches, "active_index", rows=2) + row.template_list("UI_UL_list", "point_caches", cache, "point_caches", + cache.point_caches, "active_index", rows=2) col = row.column(align=True) col.operator("ptcache.add", icon='ZOOMIN', text="") col.operator("ptcache.remove", icon='ZOOMOUT', text="") diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 68a097e6188..519f9ca47fa 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -94,7 +94,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): row = layout.row() col = row.column() - col.template_list("UI_UL_list", "", scene, "keying_sets", scene.keying_sets, "active_index", rows=2) + col.template_list("UI_UL_list", "keying_sets", scene, "keying_sets", scene.keying_sets, "active_index", rows=2) col = row.column(align=True) col.operator("anim.keying_set_add", icon='ZOOMIN', text="") diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index bc5d89fd45b..e32db805a29 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -746,7 +746,7 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel): layout.active = stab.use_2d_stabilization row = layout.row() - row.template_list("UI_UL_list", "", stab, "tracks", + row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks", stab, "active_track_index", rows=3) sub = row.column(align=True) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 2fb420dabea..d64920625f7 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1222,7 +1222,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel): if pe.type == 'PARTICLES': if ob.particle_systems: if len(ob.particle_systems) > 1: - layout.template_list("UI_UL_list", "", ob, "particle_systems", + layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems", ob.particle_systems, "active_index", rows=2, maxrows=3) ptcache = ob.particle_systems.active.point_cache @@ -1232,8 +1232,8 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel): ptcache = md.point_cache if ptcache and len(ptcache.point_caches) > 1: - layout.template_list("UI_UL_list", "", ptcache, "point_caches", ptcache.point_caches, "active_index", - rows=2, maxrows=3) + layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches", + ptcache.point_caches, "active_index", rows=2, maxrows=3) if not pe.is_editable: layout.label(text="Point cache must be baked") -- cgit v1.2.3 From b99dcf3b51ac2b4d3b44521fcdc83b017b11a026 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 18 Feb 2013 13:34:26 +0000 Subject: Minor precision in template_list doc, to always use a custom list_id when using default UI_UL_list class. --- source/blender/makesrna/intern/rna_ui_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 2043832a3f8..d0b21948a41 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -771,7 +771,8 @@ void RNA_api_ui_layout(StructRNA *srna) parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "list_id", "", 0, "", - "Identifier of this list widget. " + "Identifier of this list widget (should be systematically used with default UI_UL_list " + "class). " "If this is set, the uilist gets a custom ID, otherwise it takes the " "name of the class used to define the uilist (for example, if the " "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the " -- cgit v1.2.3 From 21ab95c7d15b5bb8909aa2d624c8ecda9bb8c9f7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 13:43:18 +0000 Subject: Fix #34289: Wrong grid color on light background Grid was blending with wrong theme color. Since r53636 TH_HIGH_GRAD is used as a background and this color shall be used for blending. This is possible other usages of TH_BACK are wrong here as well, but would want Antony to check on this. --- source/blender/editors/space_view3d/view3d_draw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 2b28b958248..c41fb926ab0 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -345,7 +345,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** CLAMP(blend_fac, 0.3f, 1.0f); - UI_ThemeColorBlend(TH_BACK, TH_GRID, blend_fac); + UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, blend_fac); drawgrid_draw(ar, wx, wy, x, y, dx_scalar); } @@ -374,7 +374,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** } } else { /* start blending out */ - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); + UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); @@ -382,7 +382,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** } } else { /* start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX * 10)) */ - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); + UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); @@ -401,21 +401,21 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** drawgrid_draw(ar, wx, wy, x, y, dx); } else { - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); + UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); drawgrid_draw(ar, wx, wy, x, y, dx * sublines); } } else { - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); + UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); drawgrid_draw(ar, wx, wy, x, y, dx * sublines); } } else { - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); + UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); drawgrid_draw(ar, wx, wy, x, y, dx * sublines); -- cgit v1.2.3 From b187d3375161ee6a0583f0c05181929a6d1f1774 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Mon, 18 Feb 2013 13:51:01 +0000 Subject: pointcache: Set start frame soft limit to 1 Right now most simulations can't handle cache start frame < 1 unfortunately. There are two main problems: 1. frame 0 is a special case so some simulations will just pop back to their initial state on frame 0. 2. blender doesn't allow playing the animation starting from negative start frames, so most simulations only work when baked and not during regular playback. Just change soft limit since sart frame < 1 can work in some cases, but this needs to be fixed properly in the individual simulations if we really want to allow it. --- source/blender/makesrna/intern/rna_object_force.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 873ea49824c..dcb288a6f32 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -764,7 +764,7 @@ static void rna_def_pointcache(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startframe"); RNA_def_property_range(prop, -MAXFRAME, MAXFRAME); - RNA_def_property_ui_range(prop, -1000, MAXFRAME, 1, 1); + RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1); RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts"); prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME); -- cgit v1.2.3 From d7058f12e5f4eeecf32e16e73e08ec3f142729f9 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 18 Feb 2013 14:03:26 +0000 Subject: Make list_id mandatory when using default UI_UL_list class for a template_list. --- release/scripts/startup/bl_ui/__init__.py | 1 + source/blender/editors/include/UI_interface.h | 2 ++ source/blender/editors/interface/interface_templates.c | 7 +++++++ source/blender/makesrna/intern/rna_ui_api.c | 4 ++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 982c723f08e..09813d8b1c2 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -137,6 +137,7 @@ def unregister(): # Define a default UIList, when a list does not need any custom drawing... +# Keep in sync with its #defined name in UI_interface.h class UI_UL_list(bpy.types.UIList): pass diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 434fb58184f..eb74dd1e274 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -832,6 +832,8 @@ void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *te void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C); void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr); +/* Default UIList class name, keep in sync with its declaration in bl_ui/__init__.py */ +#define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list" void uiTemplateList(uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id, struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr, const char *active_propname, int rows, int maxrows, int layout_type); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8dc51387db7..5805806a9a9 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2478,6 +2478,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co int min, max; /* validate arguments */ + /* Forbid default UI_UL_DEFAULT_CLASS_NAME list class without a custom list_id! */ + if (!strcmp(UI_UL_DEFAULT_CLASS_NAME, listtype_name) && !(list_id && list_id[0])) { + RNA_warning("template_list using default '" UI_UL_DEFAULT_CLASS_NAME + "' UIList class must provide a custom list_id"); + return; + } + block = uiLayoutGetBlock(layout); if (!active_dataptr->data) { diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index d0b21948a41..0ce98e0b364 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -771,8 +771,8 @@ void RNA_api_ui_layout(StructRNA *srna) parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "list_id", "", 0, "", - "Identifier of this list widget (should be systematically used with default UI_UL_list " - "class). " + "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME + "\" class). " "If this is set, the uilist gets a custom ID, otherwise it takes the " "name of the class used to define the uilist (for example, if the " "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the " -- cgit v1.2.3 From 98c5da4a819c72efa1b94523553c97438dadb798 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 18 Feb 2013 14:03:50 +0000 Subject: Fix #34276: OpenGL render not doing color space conversion to linear correctly with transparency, would show as too dark colors on edges. Found a strange issue here though, the alpha value in the OpenGL render result is not the same as the one specified in the material. It's not clear to me why this happens, color space conversions should not influence the alpha channel. --- source/blender/editors/render/render_opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 7ba6a92e4be..ea18f2c8fbb 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -264,7 +264,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) /* sequencer has got tricker ocnversion happened above */ IMB_buffer_float_from_float(rr->rectf, rr->rectf, - 4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, FALSE, + 4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, TRUE, oglrender->sizex, oglrender->sizey, oglrender->sizex, oglrender->sizex); } -- cgit v1.2.3 From 4ae3a28fcb0a53b634205fc54a2fc7869ab54f36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Feb 2013 14:52:49 +0000 Subject: fix bpy_extras.mesh_utils.edge_face_count_dict() helper api function. it was using tessfaces when theres no need to. --- release/scripts/modules/bpy_extras/mesh_utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index 8b93b5922e9..d02fd6e34dc 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -152,10 +152,14 @@ def edge_face_count_dict(mesh): faces using each edge. :rtype: dict """ - face_edge_keys = [face.edge_keys for face in mesh.tessfaces] + + #face_edge_keys = [face.edge_keys for face in ] face_edge_count = {} - for face_keys in face_edge_keys: - for key in face_keys: + loops = mesh.loops + edges = mesh.edges + for poly in mesh.polygons: + for i in poly.loop_indices: + key = edges[loops[i].edge_index].key try: face_edge_count[key] += 1 except: -- cgit v1.2.3 From b0c6f87e2d31207b8046d809f0b384265c4ad903 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 18 Feb 2013 15:08:23 +0000 Subject: Fix #34290: backface culling option in 3d view was not interacting well with the option in the material in texture draw mode, now it always overrides the material. --- source/blender/editors/space_view3d/drawmesh.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 35a0111e575..2cef10e1981 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -236,8 +236,9 @@ static struct TextureDrawState { Object *ob; int is_lit, is_tex; int color_profile; + bool use_backface_culling; unsigned char obcol[4]; -} Gtexdraw = {NULL, 0, 0, 0, {0, 0, 0, 0}}; +} Gtexdraw = {NULL, 0, 0, 0, false, {0, 0, 0, 0}}; static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw) { @@ -250,7 +251,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m static int c_has_texface; Object *litob = NULL; /* to get mode to turn off mipmap in painting mode */ - int backculled = GEMAT_BACKCULL; + int backculled = GEMAT_BACKCULL || gtexdraw.use_backface_culling; int alphablend = 0; int textured = 0; int lit = 0; @@ -274,7 +275,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m if (ma) { alphablend = ma->game.alpha_blend; if (ma->mode & MA_SHLESS) lit = 0; - backculled = ma->game.flag & GEMAT_BACKCULL; + backculled = (ma->game.flag & GEMAT_BACKCULL) || gtexdraw.use_backface_culling; } if (texface) { @@ -375,17 +376,12 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O Gtexdraw.is_tex = is_tex; Gtexdraw.color_profile = BKE_scene_check_color_management_enabled(scene); + Gtexdraw.use_backface_culling = (v3d->flag2 & V3D_BACKFACE_CULLING) != 0; memcpy(Gtexdraw.obcol, obcol, sizeof(obcol)); set_draw_settings_cached(1, NULL, NULL, Gtexdraw); glShadeModel(GL_SMOOTH); - if (v3d->flag2 & V3D_BACKFACE_CULLING) { - glEnable(GL_CULL_FACE); - glCullFace(GL_BACK); - } - else { - glDisable(GL_CULL_FACE); - } + glCullFace(GL_BACK); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE); } -- cgit v1.2.3 From 5ba0eb0ae50bedd5026239f10937c1a2db11cf79 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 18 Feb 2013 15:08:27 +0000 Subject: Fix some popups being too small on retina display, among them the new image dialog. --- source/blender/editors/armature/poseobject.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/editors/space_text/text_ops.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 38924105316..55b344bfd62 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -238,7 +238,7 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNU /* show popup dialog to allow editing of range... */ // FIXME: hardcoded dimensions here are just arbitrary - return WM_operator_props_dialog_popup(C, op, 200, 200); + return WM_operator_props_dialog_popup(C, op, 10*UI_UNIT_X, 10*UI_UNIT_Y); } /* For the object with pose/action: create path curves for selected bones diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 4807e7364ea..f03bc8b5afa 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1151,7 +1151,7 @@ static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *U /* show popup dialog to allow editing of range... */ /* FIXME: hardcoded dimensions here are just arbitrary */ - return WM_operator_props_dialog_popup(C, op, 200, 200); + return WM_operator_props_dialog_popup(C, op, 10*UI_UNIT_X, 10*UI_UNIT_Y); } /* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0d1156a837a..40a98c5ebfe 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1777,7 +1777,7 @@ static int image_new_exec(bContext *C, wmOperator *op) /* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */ static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - return WM_operator_props_dialog_popup(C, op, 300, 100); + return WM_operator_props_dialog_popup(C, op, 15*UI_UNIT_X, 5*UI_UNIT_Y); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index b60528bcee8..514ac0a4d63 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1929,7 +1929,7 @@ static int text_jump_exec(bContext *C, wmOperator *op) static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - return WM_operator_props_dialog_popup(C, op, 200, 100); + return WM_operator_props_dialog_popup(C, op, 10*UI_UNIT_X, 5*UI_UNIT_Y); } -- cgit v1.2.3 From bd7648b2d2835143a3af748608bb87219e994d62 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 18 Feb 2013 15:14:34 +0000 Subject: Bug fix #34292 CTRL + MMB zoom in 2d editors now depends on 'max zoom' level. This makes zooms in UI (very limited) go smoother, but for fcurve or timeline it's same. --- source/blender/editors/interface/view2d_ops.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index fbbcb650e68..7f1140501b5 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1034,14 +1034,17 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) } else { /* 'continuous' or 'dolly' */ - float fac; + float fac, zoomfac = 0.001f * v2d->maxzoom; + + /* some view2d's (graph) don't have min/max zoom, or extreme ones */ + CLAMP (zoomfac, 0.001f, 0.01f); /* x-axis transform */ - fac = 0.01f * (event->x - vzd->lastx); + fac = zoomfac * (event->x - vzd->lastx); dx = fac * BLI_rctf_size_x(&v2d->cur); /* y-axis transform */ - fac = 0.01f * (event->y - vzd->lasty); + fac = zoomfac * (event->y - vzd->lasty); dy = fac * BLI_rctf_size_y(&v2d->cur); } -- cgit v1.2.3 From 4cd487d731a69b1f6c4144eebec56a28e25cd201 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Feb 2013 15:47:13 +0000 Subject: checking for V3D_LOCAL was duplicated in transform.c, and both checks not quite correct. - When checking edimode, make sure its mesh editmode. - Graph editor supports this option but wasn't being checked. --- release/scripts/modules/bpy_extras/mesh_utils.py | 3 +- source/blender/editors/transform/transform.c | 37 ++++++++++++------------ source/blender/makesrna/intern/rna_space.c | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index d02fd6e34dc..f4fdfece947 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -152,8 +152,7 @@ def edge_face_count_dict(mesh): faces using each edge. :rtype: dict """ - - #face_edge_keys = [face.edge_keys for face in ] + face_edge_count = {} loops = mesh.loops edges = mesh.edges diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index e5b4a6c7bae..a8efd998583 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -104,6 +104,16 @@ static int doVertSlide(TransInfo *t, float perc); static void drawEdgeSlide(const struct bContext *C, TransInfo *t); static void drawVertSlide(const struct bContext *C, TransInfo *t); +static bool transdata_check_local_center(TransInfo *t) +{ + return ((t->around == V3D_LOCAL) && ( + (t->flag & (T_OBJECT | T_POSE)) || + (t->obedit && t->obedit->type == OB_MESH && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) || + (t->obedit && t->obedit->type == OB_ARMATURE) || + (t->spacetype == SPACE_IPO)) + ); +} + /* ************************** SPACE DEPENDANT CODE **************************** */ void setTransformViewMatrices(TransInfo *t) @@ -3005,12 +3015,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) } /* local constraint shouldn't alter center */ - if ((t->around == V3D_LOCAL) && - ( (t->flag & (T_OBJECT | T_POSE)) || - ((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) || - (t->obedit && t->obedit->type == OB_ARMATURE)) - ) - { + if (transdata_check_local_center(t)) { copy_v3_v3(center, td->center); } else if (t->options & CTX_MOVIECLIP) { @@ -3387,20 +3392,16 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short { float vec[3], totmat[3][3], smat[3][3]; float eul[3], fmat[3][3], quat[4]; - float *center = t->center; + const float *center; /* local constraint shouldn't alter center */ - if (around == V3D_LOCAL) { - if ( (t->flag & (T_OBJECT | T_POSE)) || - (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE)) || - (t->obedit && t->obedit->type == OB_ARMATURE)) - { - center = td->center; - } - - if (t->options & CTX_MOVIECLIP) { - center = td->center; - } + if (transdata_check_local_center(t) || + ((around == V3D_LOCAL) && (t->options & CTX_MOVIECLIP))) + { + center = td->center; + } + else { + center = t->center; } if (t->flag & T_POINTS) { diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a742e6d4a1a..0ab74fb617f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2548,7 +2548,7 @@ static void rna_def_space_graph(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - /* this is basically the same as the one for the 3D-View, but with some entries ommitted */ + /* this is basically the same as the one for the 3D-View, but with some entries omitted */ static EnumPropertyItem gpivot_items[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""}, {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""}, -- cgit v1.2.3 From 9ab3d4ff1eaacb8156043ac33bca7e9ac07806e6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Feb 2013 16:35:13 +0000 Subject: fix [#34303] Rotation fcurves don't work with transforming with individual centers --- source/blender/editors/animation/anim_draw.c | 17 ++++++++++------- source/blender/editors/include/ED_anim_api.h | 3 ++- source/blender/editors/transform/transform.c | 7 +++++++ source/blender/editors/transform/transform.h | 4 ++++ .../blender/editors/transform/transform_conversions.c | 16 +++++++++++++--- source/blender/editors/transform/transform_generics.c | 5 ++++- 6 files changed, 40 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index d83d1805f0e..eb1f5ef1043 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -399,20 +399,23 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest static short bezt_unit_mapping_apply(KeyframeEditData *ked, BezTriple *bezt) { /* mapping factor is stored in f1, flags are stored in i1 */ - short only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS); - short sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS); + const bool only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS); + const bool sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS); + const bool skip_knot = (ked->i1 & ANIM_UNITCONV_SKIPKNOTS); float fac = ked->f1; /* adjust BezTriple handles only if allowed to */ - if (only_keys == 0) { - if ((sel_vs == 0) || (bezt->f1 & SELECT)) + if (only_keys == false) { + if ((sel_vs == false) || (bezt->f1 & SELECT)) bezt->vec[0][1] *= fac; - if ((sel_vs == 0) || (bezt->f3 & SELECT)) + if ((sel_vs == false) || (bezt->f3 & SELECT)) bezt->vec[2][1] *= fac; } - if ((sel_vs == 0) || (bezt->f2 & SELECT)) - bezt->vec[1][1] *= fac; + if (skip_knot == false) { + if ((sel_vs == false) || (bezt->f2 & SELECT)) + bezt->vec[1][1] *= fac; + } return 0; } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 551d3041398..20f568a3642 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -552,7 +552,8 @@ typedef enum eAnimUnitConv_Flags { /* only touch selected BezTriples */ ANIM_UNITCONV_ONLYSEL = (1 << 2), /* only touch selected vertices */ - ANIM_UNITCONV_SELVERTS = (1 << 3) + ANIM_UNITCONV_SELVERTS = (1 << 3), + ANIM_UNITCONV_SKIPKNOTS = (1 << 4), } eAnimUnitConv_Flags; /* Get unit conversion factor for given ID + F-Curve */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a8efd998583..befeb2bce25 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -7388,3 +7388,10 @@ void BIF_TransformSetUndo(const char *UNUSED(str)) // TRANSFORM_FIX_ME //Trans.undostr = str; } + + +/* TODO, move to: transform_queries.c */ +bool checkUseLocalCenter_GraphEdit(TransInfo *t) +{ + return ((t->around == V3D_LOCAL) && !ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)); +} diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 4e3f2b04de0..9c57c74a26d 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -745,4 +745,8 @@ void projectEdgeSlideData(TransInfo *t, bool is_final); void freeVertSlideVerts(TransInfo *t); + +/* TODO. transform_queries.c */ +bool checkUseLocalCenter_GraphEdit(TransInfo *t); + #endif diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 7d62775ae58..32ceaf97331 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -123,6 +123,7 @@ #include "BLO_sys_types.h" // for intptr_t support + /* local function prototype - for Object/Bone Constraints */ static short constraints_list_needinv(TransInfo *t, ListBase *list); @@ -3530,7 +3531,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) int count = 0, i; float cfra; float mtx[3][3], smtx[3][3]; - const short use_handle = !(sipo->flag & SIPO_NOHANDLES); + const bool use_handle = !(sipo->flag & SIPO_NOHANDLES); + const bool use_local_center = checkUseLocalCenter_GraphEdit(t); + const short anim_map_flag = ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS; /* determine what type of data we are operating on */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -3662,7 +3665,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (fcu->bezt == NULL) continue; - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag); /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { @@ -3697,7 +3700,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* only include main vert if selected */ - if (sel2 && (sipo->around != V3D_LOCAL || ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE))) { + if (sel2 && (use_local_center == false)) { /* move handles relative to center */ if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { @@ -3733,6 +3736,13 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* Sets handles based on the selection */ testhandles_fcurve(fcu, use_handle); + + /* even though transform values are written back right after during transform, + * using individual center's with rotation means the center point wont + * be touched again see: [#34303] */ + if (use_local_center) { + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag | ANIM_UNITCONV_RESTORE); + } } /* cleanup temp list */ diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index ef775ae3128..da761365671 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -130,6 +130,7 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3]) /* ************************** GENERICS **************************** */ + static void clipMirrorModifier(TransInfo *t, Object *ob) { ModifierData *md = ob->modifiers.first; @@ -407,7 +408,9 @@ static void recalcData_graphedit(TransInfo *t) continue; // fixme: only do this for selected verts... - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, + ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE | + (checkUseLocalCenter_GraphEdit(t) ? ANIM_UNITCONV_SKIPKNOTS : 0)); /* watch it: if the time is wrong: do not correct handles yet */ -- cgit v1.2.3 From 525da1f872a79a212e56f0692472d7831ddaf442 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 18 Feb 2013 17:39:44 +0000 Subject: Fix wrong alpha channel for OpenGL render results with transparent textures or materials, the typical glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); blend function does not give correct destination alpha. --- source/blender/gpu/intern/gpu_draw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 80f35d531cd..c631f7efbe9 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -395,7 +395,12 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend) } else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) { glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + /* for OpenGL render we use the alpha channel, this makes alpha blend correct */ + if (GLEW_VERSION_1_4) + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + else + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* if U.glalphaclip == 1.0, some cards go bonkers... * turn off alpha test in this case */ -- cgit v1.2.3 From 58c9691d19ef0b1b60b84f4c0fcc8f1d4721171a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 17:51:07 +0000 Subject: Correction to own r44749 -- layers from view were always used, shall use active layer now for real. --- release/scripts/modules/bpy_extras/object_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 5797b8b7bf3..ab5dc3e6aee 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -124,8 +124,9 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True): else: base.layers = [True if i == scene.active_layer else False for i in range(len(scene.layers))] - if v3d: - base.layers_from_view(context.space_data) + else: + if v3d: + base.layers_from_view(context.space_data) obj_new.matrix_world = add_object_align_init(context, operator) -- cgit v1.2.3 From 167dcc88c78b68540ecdd1abc3e26ade73d2d27c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 19:34:14 +0000 Subject: Force movie clips always use default alpha mode, before this straight alpha was used for them which doesn't work for cleaned footage stored in EXR file format. Perhaps we need to support configurable alpha mode for clips, but that's for later (maybe even after release), --- source/blender/blenkernel/intern/movieclip.c | 2 +- source/blender/imbuf/intern/readimage.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 943d9e9452a..eceac61ddb6 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -216,7 +216,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user, colorspace = clip->colorspace_settings.name; } - loadflag = IB_rect | IB_multilayer; + loadflag = IB_rect | IB_multilayer | IB_alphamode_detect; /* read ibuf */ ibuf = IMB_loadiffname(name, loadflag, colorspace); diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 00bc78ee488..4d47d883444 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -75,6 +75,8 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co if (type->load) { ibuf = type->load(mem, size, flags, effective_colorspace); if (ibuf) { + int alpha_flags; + if (colorspace) { if (ibuf->rect) { /* byte buffer is never internally converted to some standard space, @@ -86,11 +88,16 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co BLI_strncpy(colorspace, effective_colorspace, IM_MAX_SPACE); } + if (flags & IB_alphamode_detect) + alpha_flags = ibuf->flags & IB_alphamode_premul; + else + alpha_flags = flags & IB_alphamode_premul; + if (flags & IB_ignore_alpha) { IMB_rectfill_alpha(ibuf, 1.0f); } else { - if (flags & IB_alphamode_premul) { + if (alpha_flags & IB_alphamode_premul) { if (ibuf->rect) { IMB_unpremultiply_alpha(ibuf); } -- cgit v1.2.3 From 47c29c1c2ed43f98f64e9e3a5d06e74aec34a072 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Mon, 18 Feb 2013 21:19:43 +0000 Subject: Themes: disabled items on menus were using a color mix of text and text_selected, this didn't work nice with dark themes and text shadows and overall didn't make much sense. Now, disabled items use a mix of text and menu item background (inner) color. Same results, but allows dark themes with bright selected text to use shadows. Example case: http://pasteall.org/pic/show.php?id=45697 --- source/blender/editors/interface/interface_widgets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 6735c8b173c..68df8e29957 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1804,7 +1804,7 @@ static void widget_state_menu_item(uiWidgetType *wt, int state) } /* regular disabled */ else if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { - widget_state_blend(wt->wcol.text, wt->wcol.text_sel, 0.5f); + widget_state_blend(wt->wcol.text, wt->wcol.inner, 0.5f); } /* regular active */ else if (state & UI_ACTIVE) { -- cgit v1.2.3 From 442d16b46879f9109f4536d48553aa36824b17b1 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 18 Feb 2013 23:41:28 +0000 Subject: Fix for [#34308] only half width of material list row is used for material name. * Issue was caused in r54393. --- release/scripts/startup/bl_ui/properties_material.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index a13c722ea62..9a3957fe353 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -84,8 +84,6 @@ class MATERIAL_UL_matslots(UIList): layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode)) elif ma.use_nodes: layout.label(text="Node ") - else: - layout.label(text="") elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' layout.label(text="", icon_value=icon) -- cgit v1.2.3 From 4e73ff0d637772950f1f54c0259edbc60027cfba Mon Sep 17 00:00:00 2001 From: Alex Fraser Date: Tue, 19 Feb 2013 02:24:52 +0000 Subject: Fix for [#34099] Particles leaking from moving meshes This was caused by a floating point precision error. During collision detection, Newton-Raphson iteration is used to find the exact time of the collision. But when using subframes, the initial Newton step was too small. Now the initial step is given in absolute units. When subframes = 0, this should behave almost the same as before. Thanks to Janne Karhu, Lukas Toenne and Ton Roosendaal for their help with this patch, and to AutoCRC for funding. --- source/blender/blenkernel/BKE_particle.h | 5 ++- source/blender/blenkernel/intern/particle_system.c | 52 ++++++++++++++++------ 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index a9a8bc32064..6c207675cb1 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -220,7 +220,10 @@ typedef struct ParticleCollision { ParticleCollisionElement pce; - float total_time, inv_timestep; + /* total_time is the amount of time in this subframe + * inv_total_time is the opposite + * inv_timestep is the inverse of the amount of time in this frame */ + float total_time, inv_total_time, inv_timestep; float radius; float co1[3], co2[3]; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 6e4937d11ec..3efe25794e1 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3028,13 +3028,20 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f normalize_qt(pa->state.rot); } -/************************************************/ -/* Collisions */ -/************************************************/ +/************************************************ + * Collisions + * + * The algorithm is roughly: + * 1. Use a BVH tree to search for faces that a particle may collide with. + * 2. Use Newton's method to find the exact time at which the collision occurs. + * http://en.wikipedia.org/wiki/Newton's_method + * + ************************************************/ #define COLLISION_MAX_COLLISIONS 10 #define COLLISION_MIN_RADIUS 0.001f #define COLLISION_MIN_DISTANCE 0.0001f #define COLLISION_ZERO 0.00001f +#define COLLISION_INIT_STEP 0.00008f typedef float (*NRDistanceFunc)(float *p, float radius, ParticleCollisionElement *pce, float *nor); static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisionElement *pce, float *nor) { @@ -3189,16 +3196,20 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce /* find first root in range [0-1] starting from 0 */ static float collision_newton_rhapson(ParticleCollision *col, float radius, ParticleCollisionElement *pce, NRDistanceFunc distance_func) { - float t0, t1, d0, d1, dd, n[3]; + float t0, t1, dt_init, d0, d1, dd, n[3]; int iter; pce->inv_nor = -1; + /* Initial step size should be small, but not too small or floating point + * precision errors will appear. - z0r */ + dt_init = COLLISION_INIT_STEP * col->inv_total_time; + /* start from the beginning */ t0 = 0.f; collision_interpolate_element(pce, t0, col->f, col); d0 = distance_func(col->co1, radius, pce, n); - t1 = 0.001f; + t1 = dt_init; d1 = 0.f; for (iter=0; iter<10; iter++) {//, itersum++) { @@ -3208,11 +3219,6 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part d1 = distance_func(pce->p, radius, pce, n); - /* no movement, so no collision */ - if (d1 == d0) { - return -1.f; - } - /* particle already inside face, so report collision */ if (iter == 0 && d0 < 0.f && d0 > -radius) { copy_v3_v3(pce->p, col->co1); @@ -3220,7 +3226,24 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part pce->inside = 1; return 0.f; } - + + /* Zero gradient (no movement relative to element). Can't step from + * here. */ + if (d1 == d0) { + /* If first iteration, try from other end where the gradient may be + * greater. Note: code duplicated below. */ + if (iter == 0) { + t0 = 1.f; + collision_interpolate_element(pce, t0, col->f, col); + d0 = distance_func(col->co2, radius, pce, n); + t1 = 1.0f - dt_init; + d1 = 0.f; + continue; + } + else + return -1.f; + } + dd = (t1-t0)/(d1-d0); t0 = t1; @@ -3228,14 +3251,14 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part t1 -= d1*dd; - /* particle movin away from plane could also mean a strangely rotating face, so check from end */ + /* Particle moving away from plane could also mean a strangely rotating + * face, so check from end. Note: code duplicated above. */ if (iter == 0 && t1 < 0.f) { t0 = 1.f; collision_interpolate_element(pce, t0, col->f, col); d0 = distance_func(col->co2, radius, pce, n); - t1 = 0.999f; + t1 = 1.0f - dt_init; d1 = 0.f; - continue; } else if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f)) @@ -3683,6 +3706,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa memset(&col, 0, sizeof(ParticleCollision)); col.total_time = timestep * dfra; + col.inv_total_time = 1.0f/col.total_time; col.inv_timestep = 1.0f/timestep; col.cfra = cfra; -- cgit v1.2.3 From 098e4234b113fdff9804ef76b6f0bdb12a6bac3b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 02:30:02 +0000 Subject: minor change to own recent commit with transform fcurve centers and some style edits and typo corrections. --- source/blender/blenfont/BLF_translation.h | 2 +- source/blender/bmesh/intern/bmesh_polygon.c | 5 +++-- source/blender/editors/armature/poseobject.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/space_clip/clip_editor.c | 2 +- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/editors/space_text/text_ops.c | 2 +- source/blender/editors/transform/transform_generics.c | 7 ++++--- source/blender/imbuf/intern/dds/dds_api.cpp | 2 +- source/blender/imbuf/intern/iris.c | 2 +- source/blender/python/generic/bpy_internal_import.c | 2 +- 11 files changed, 16 insertions(+), 14 deletions(-) diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index fd8b30d1d1b..cbfc7c28d8d 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -112,7 +112,7 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid); /* Default, void context. * WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level! - * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can’t use "natural" + * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can't use "natural" * None value in rna string properties... :/ * For perf reason, we only use the first char to detect this context, so other contexts should never start * with the same char! diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 1aa4d7c5e00..9592c34fc75 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -674,7 +674,7 @@ static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use i = (((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) > len_squared_v3v3(larr[1]->v->co, larr[3]->v->co) * bias)) != use_beauty); i4 = (i + 3) % 4; - /* Check produced tris aren’t too flat/narrow... + /* Check produced tris aren't too flat/narrow... * Probably not the best test, but is quite efficient and should at least avoid null-area faces! */ cos1 = fabsf(cos_v3v3v3(larr[i4]->v->co, larr[i]->v->co, larr[i + 1]->v->co)); cos2 = fabsf(cos_v3v3v3(larr[i4]->v->co, larr[i + 2]->v->co, larr[i + 1]->v->co)); @@ -741,7 +741,8 @@ static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use /* Compare to prev best (i.e. lowest) cos. */ if (cos < bestcos) { /* We must check this tri would not leave a (too much) degenerated remaining face! */ - /* For now just assume if the average of cos of all "remaining face"'s corners is below a given threshold, it’s OK. */ + /* For now just assume if the average of cos of all + * "remaining face"'s corners is below a given threshold, it's OK. */ float avgcos = fabsf(cos_v3v3v3(v1->co, v3->co, l_iter->next->next->v->co)); const int i_limit = (i - 1 + len) % len; avgcos += fabsf(cos_v3v3v3(l_iter->prev->prev->v->co, v1->co, v3->co)); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 55b344bfd62..c7d1e428355 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -238,7 +238,7 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNU /* show popup dialog to allow editing of range... */ // FIXME: hardcoded dimensions here are just arbitrary - return WM_operator_props_dialog_popup(C, op, 10*UI_UNIT_X, 10*UI_UNIT_Y); + return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y); } /* For the object with pose/action: create path curves for selected bones diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index f03bc8b5afa..a13c0509824 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1151,7 +1151,7 @@ static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *U /* show popup dialog to allow editing of range... */ /* FIXME: hardcoded dimensions here are just arbitrary */ - return WM_operator_props_dialog_popup(C, op, 10*UI_UNIT_X, 10*UI_UNIT_Y); + return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y); } /* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */ diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 927834a8924..728110dfeee 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -618,7 +618,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf, const unsign context->last_texture = glaGetOneInteger(GL_TEXTURE_2D); /* image texture need to be rebinded if displaying another image buffer - * assuming displaying happens of footage frames only on which painting doesn't heppen. + * assuming displaying happens of footage frames only on which painting doesn't happen. * so not changed image buffer pointer means unchanged image content */ need_rebind |= context->texture_ibuf != ibuf; need_rebind |= context->display_buffer != display_buffer; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 40a98c5ebfe..dc834d88323 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1777,7 +1777,7 @@ static int image_new_exec(bContext *C, wmOperator *op) /* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */ static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - return WM_operator_props_dialog_popup(C, op, 15*UI_UNIT_X, 5*UI_UNIT_Y); + return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, 5 * UI_UNIT_Y); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 514ac0a4d63..9b5d453d8a3 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1929,7 +1929,7 @@ static int text_jump_exec(bContext *C, wmOperator *op) static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - return WM_operator_props_dialog_popup(C, op, 10*UI_UNIT_X, 5*UI_UNIT_Y); + return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y); } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index da761365671..f97a8175101 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -378,6 +378,8 @@ static void recalcData_graphedit(TransInfo *t) bAnimListElem *ale; int dosort = 0; + + const bool use_local_center = checkUseLocalCenter_GraphEdit(t); /* initialize relevant anim-context 'context' data from TransInfo data */ @@ -406,11 +408,10 @@ static void recalcData_graphedit(TransInfo *t) /* ignore unselected fcurves */ if (!fcu_test_selected(fcu)) continue; - - // fixme: only do this for selected verts... + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE | - (checkUseLocalCenter_GraphEdit(t) ? ANIM_UNITCONV_SKIPKNOTS : 0)); + (use_local_center ? ANIM_UNITCONV_SKIPKNOTS : 0)); /* watch it: if the time is wrong: do not correct handles yet */ diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 4098b466377..0c240f16227 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -96,7 +96,7 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags, char colo Color32 pixel; Color32 *pixels = 0; - /* OCIO_TODO: never was able to save DDS, so can'ttest loading + /* OCIO_TODO: never was able to save DDS, so can't test loading * but profile used to be set to sRGB and can't see rect_float here, so * default byte space should work fine */ diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index dec5f6fb39e..47bd3e54a6f 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -672,7 +672,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) * represents one pixel. xsize and ysize specify the dimensions of * the pixel array. zsize specifies what kind of image file to * write out. if zsize is 1, the luminance of the pixels are - * calculated, and a sinlge channel black and white image is saved. + * calculated, and a single channel black and white image is saved. * If zsize is 3, an RGB image file is saved. If zsize is 4, an * RGBA image file is saved. * diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 8d146bedb48..0c0ad50ebe4 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -66,7 +66,7 @@ static PyObject *imp_reload_orig = NULL; * * However Python's alternative is to use import hooks, * which are implemented in a way that we can't use our own importer as a - * fall-back (instead we must try and fail - raise an exception evert time). + * fall-back (instead we must try and fail - raise an exception every time). * Since importing from blenders text-blocks is not the common case * I prefer to use Pythons import by default and fall-back to * Blenders - which we can only do by intercepting import calls I'm afraid. -- cgit v1.2.3 From 6550fb8452da5cdb1f913a1e57e13354b4ea6f5f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 02:48:14 +0000 Subject: bpy.props.RemoveProperty() had incorrect docstring. --- source/blender/python/intern/bpy_props.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index b42fdbd0ca4..7ffce0e9a93 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2796,12 +2796,17 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject } PyDoc_STRVAR(BPy_RemoveProperty_doc, -".. function:: RemoveProperty(attr)\n" +".. function:: RemoveProperty(cls, attr)\n" "\n" " Removes a dynamically defined property.\n" "\n" +" :arg cls: The class containing the property.\n" +" :type cls: type\n" " :arg attr: Property name.\n" " :type attr: string\n" +"\n" +".. note:: Typically this function doesn't need to be accessed directly.\n" +" Instead use ``del cls.attr``\n" ); static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw) { -- cgit v1.2.3 From 926e0e7eb71726fdd1be3f9d299bf3d9c3ad0a7a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 19 Feb 2013 03:26:18 +0000 Subject: Bugfix [#34283] armature bones losing their roll setting upon translation in edit mode My earlier fix for [#33974] (in r.54061) was causing some problems where manually specified roll values on horizontal or angled bones were getting reset. This could be nasty as you might not notice the changes for a while (especially when using stick bones without axes displayed). I've now put in place a hacky compromise solution which should catch both of these situations nicely. For z-axis (i.e. vertical) movements, the r.54061 fix is used, while for everything else (moving or just touch-n-go), the old setting is used. --- .../blender/editors/transform/transform_generics.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index f97a8175101..76ca9d8959a 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -809,6 +809,7 @@ static void recalcData_view3d(TransInfo *t) if (td->extra) { float vec[3], up_axis[3]; float qrot[4]; + bool ztrans_hack = false; ebo = td->extra; copy_v3_v3(up_axis, td->axismtx[2]); @@ -823,7 +824,25 @@ static void recalcData_view3d(TransInfo *t) mul_m3_v3(t->mat, up_axis); } - ebo->roll = ED_rollBoneToVector(ebo, up_axis, TRUE); + /* "ztrans_hack" is a hacky compromise fix for two bug reports + * - [#33974] : When extruding/translating bones vertically, + * the roll of each bone in such vertical chains would + * flip between z-axis forward and z-axis backwards + * - [#34283] : For "normal" transforms, the original fix for [#33974] + * would cause manually-set roll values on horizontal and + * diagonal bones to constantly get reset to values the system + * deems "correct" (usually 180 degree flips of the manual version) + */ + if (t->mode == TFM_TRANSLATION) { + const float ZAXIS_REF[3] = {0.0f, 0.0f, 1.0f}; + float tdelta[3]; + + /* tdelta is the translation - enable this hack when it is z-axis movement */ + normalize_v3_v3(tdelta, t->values); + ztrans_hack = compare_v3v3(tdelta, ZAXIS_REF, 0.1f); + } + + ebo->roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack); } } } -- cgit v1.2.3 From c68d5325d0706305937372e42bd981197440de24 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 04:37:28 +0000 Subject: fix for [#34283] wasn't working in my tests (attached to original report), made bone roll get compatible angle values with the original roll. --- source/blender/blenlib/BLI_math_rotation.h | 2 ++ source/blender/blenlib/intern/math_rotation.c | 6 ++++++ source/blender/editors/transform/transform_generics.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index e349a05ac23..5ba37d70ca5 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -186,6 +186,8 @@ float fov_to_focallength(float fov, float sensor); float angle_wrap_rad(float angle); float angle_wrap_deg(float angle); +float angle_compat_rad(float angle, float angle_compat); + int mat3_from_axis_conversion(int from_forward, int from_up, int to_forward, int to_up, float r_mat[3][3]); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index c0ea817ae4a..26576b2dcb2 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1740,6 +1740,12 @@ float angle_wrap_deg(float angle) return mod_inline(angle + 180.0f, 360.0f) - 180.0f; } +/* returns an angle compatible with angle_compat */ +float angle_compat_rad(float angle, float angle_compat) +{ + return angle + (floorf(((angle_compat - angle) / (float)M_PI) + 0.5f)) * (float)M_PI; +} + /* axis conversion */ static float _axis_convert_matrix[23][3][3] = { {{-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}}, diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 76ca9d8959a..aa32518b489 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -809,6 +809,7 @@ static void recalcData_view3d(TransInfo *t) if (td->extra) { float vec[3], up_axis[3]; float qrot[4]; + float roll; bool ztrans_hack = false; ebo = td->extra; @@ -842,7 +843,8 @@ static void recalcData_view3d(TransInfo *t) ztrans_hack = compare_v3v3(tdelta, ZAXIS_REF, 0.1f); } - ebo->roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack); + roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack); + ebo->roll = angle_compat_rad(roll, ebo->roll); } } } -- cgit v1.2.3 From e5a135e0b26d7a268e7507ffb1be2f2fcc1b0b9c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 Feb 2013 08:37:08 +0000 Subject: Fixes for alpha mode do_versions code Before this change only old flag "Premultiply" was used to detect alpha mode, which is not enough actually. Now the logic here is: - If "Premultiply" was enabled it is likely float image with straight alpha, which shall be premultiplied before usage. In this case image/sequence Alpha Mode is set to Straight. - Otherwise use default alpha mode for image format based on an extension. This could fail in some cases like TIFF, but this wasn't handled fully correct in older blender anyway. Initial discovered issue was that EXR images saved in older Blender versions were set to Straight alpha mode, which is obviously a straight way to lots of headache. --- source/blender/blenkernel/BKE_image.h | 3 +++ source/blender/blenkernel/BKE_sequencer.h | 2 ++ source/blender/blenkernel/intern/image.c | 14 ++++++++++++++ source/blender/blenkernel/intern/sequencer.c | 18 ++++++++++++++++++ source/blender/blenloader/intern/readfile.c | 12 ++++++++++-- 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index d12b048bc96..dd7e06259bd 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -152,6 +152,9 @@ void BKE_image_pool_free(struct ImagePool *pool); struct ImBuf *BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool); void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool); +/* set an alpha mode based on file extension */ +void BKE_image_alpha_mode_from_extension(struct Image *image); + /* returns a new image or NULL if it can't load */ struct Image *BKE_image_load(struct Main *bmain, const char *filepath); /* returns existing Image when filename/type is same (frame optional) */ diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index e3d9c513c5c..eef134a6872 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -356,6 +356,8 @@ typedef struct SeqLoadInfo { typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *); struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine); + +void BKE_sequence_alpha_mode_from_extension(struct Sequence *seq); void BKE_sequence_init_colorspace(struct Sequence *seq); struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index de85cb54cfd..3655afdf088 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -571,6 +571,20 @@ static void image_init_color_management(Image *ima) } } +void BKE_image_alpha_mode_from_extension(Image *image) +{ + if (BLI_testextensie(image->name, ".exr") || + BLI_testextensie(image->name, ".cin") || + BLI_testextensie(image->name, ".dpx") || + BLI_testextensie(image->name, ".hdr")) + { + image->alpha_mode = IMA_ALPHA_PREMUL; + } + else { + image->alpha_mode = IMA_ALPHA_STRAIGHT; + } +} + Image *BKE_image_load(Main *bmain, const char *filepath) { Image *ima; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 45393726add..68618287546 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3955,6 +3955,24 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine) return seq; } +void BKE_sequence_alpha_mode_from_extension(Sequence *seq) +{ + if (seq->strip && seq->strip->stripdata) { + char *name = seq->strip->stripdata->name; + + if (BLI_testextensie(name, ".exr") || + BLI_testextensie(name, ".cin") || + BLI_testextensie(name, ".dpx") || + BLI_testextensie(name, ".hdr")) + { + seq->alpha_mode = IMA_ALPHA_PREMUL; + } + else { + seq->alpha_mode = IMA_ALPHA_STRAIGHT; + } + } +} + void BKE_sequence_init_colorspace(Sequence *seq) { if (seq->strip && seq->strip->stripdata) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 94dfb0cf399..4471e45be1d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8653,8 +8653,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) SEQ_BEGIN (scene->ed, seq) { - if (seq->flag & SEQ_MAKE_PREMUL) + if (seq->flag & SEQ_MAKE_PREMUL) { seq->alpha_mode = SEQ_ALPHA_STRAIGHT; + } + else { + BKE_sequence_alpha_mode_from_extension(seq); + } } SEQ_END @@ -8680,8 +8684,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } for (image = main->image.first; image; image = image->id.next) { - if (image->flag & IMA_DO_PREMUL) + if (image->flag & IMA_DO_PREMUL) { image->alpha_mode = IMA_ALPHA_STRAIGHT; + } + else { + BKE_image_alpha_mode_from_extension(image); + } image->flag &= ~IMA_DONE_TAG; } -- cgit v1.2.3 From 2d2164f10bffec1e523c95b4243f6cdf9560d1cf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 09:41:48 +0000 Subject: fix [#34295] Color picker brightness to infinity simply clamp the color to the buttons softrange since color conversion can cause the value to scale outside the intended button limits. --- source/blender/editors/interface/interface_handlers.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b166e532f84..7e2d79262fc 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3404,6 +3404,19 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut return WM_UI_HANDLER_CONTINUE; } +/* scales a vector so no axis exceeds max + * (could become BLI_math func) */ +static void clamp_axis_max_v3(float v[3], const float max) +{ + const float v_max = max_fff(v[0], v[1], v[2]); + if (v_max > max) { + mul_v3_fl(v, max / v_max); + if (v[0] > max) v[0] = max; + if (v[1] > max) v[1] = max; + if (v[2] > max) v[2] = max; + } +} + static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my, const short shift) { float rgb[3]; @@ -3480,6 +3493,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, if (color_profile && ((int)but->a1 != UI_GRAD_SV)) ui_block_to_scene_linear_v3(but->block, rgb); + /* clamp because with color conversion we can exceed range [#34295] */ + if ((int)but->a1 == UI_GRAD_V_ALT) { + clamp_axis_max_v3(rgb, but->softmax); + } + copy_v3_v3(data->vec, rgb); data->draglastx = mx; -- cgit v1.2.3 From fdb25a1d272633c32e32432499802d4793d37825 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 Feb 2013 09:51:32 +0000 Subject: Fix #34249: collapse edges crash blender with a specific mesh OpenMP block was using shared variable, which for sure leads to threading issues. --- source/blender/bmesh/intern/bmesh_operators.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 98958596324..00f8dbe06bf 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -595,13 +595,13 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE}; - BMIter iter; BMElemF *ele; int i; #pragma omp parallel for schedule(dynamic) if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT) for (i = 0; i < 3; i++) { if (htype & flag_types[i]) { + BMIter iter; BM_ITER_MESH (ele, &iter, bm, iter_types[i]) { BMO_elem_flag_disable(bm, ele, oflag); } -- cgit v1.2.3 From c5e6a35e856ee9a4e459a863e8165cff5d969368 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 19 Feb 2013 10:10:09 +0000 Subject: Remove ztrans_hack. Looks like just keeping the angles compatible works well enough. --- .../blender/editors/transform/transform_generics.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index aa32518b489..9ee1d11a036 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -810,7 +810,6 @@ static void recalcData_view3d(TransInfo *t) float vec[3], up_axis[3]; float qrot[4]; float roll; - bool ztrans_hack = false; ebo = td->extra; copy_v3_v3(up_axis, td->axismtx[2]); @@ -825,25 +824,8 @@ static void recalcData_view3d(TransInfo *t) mul_m3_v3(t->mat, up_axis); } - /* "ztrans_hack" is a hacky compromise fix for two bug reports - * - [#33974] : When extruding/translating bones vertically, - * the roll of each bone in such vertical chains would - * flip between z-axis forward and z-axis backwards - * - [#34283] : For "normal" transforms, the original fix for [#33974] - * would cause manually-set roll values on horizontal and - * diagonal bones to constantly get reset to values the system - * deems "correct" (usually 180 degree flips of the manual version) - */ - if (t->mode == TFM_TRANSLATION) { - const float ZAXIS_REF[3] = {0.0f, 0.0f, 1.0f}; - float tdelta[3]; - - /* tdelta is the translation - enable this hack when it is z-axis movement */ - normalize_v3_v3(tdelta, t->values); - ztrans_hack = compare_v3v3(tdelta, ZAXIS_REF, 0.1f); - } - - roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack); + /* roll has a tendency to flip in certain orientations - [#34283], [#33974] */ + roll = ED_rollBoneToVector(ebo, up_axis, false); ebo->roll = angle_compat_rad(roll, ebo->roll); } } -- cgit v1.2.3 From 0f359c41ead3d1724b8b6e53bcff067137b219a6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 19 Feb 2013 10:31:29 +0000 Subject: Style tweak - missing braces --- source/blender/editors/curve/editcurve.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index a72d3767b69..e736c494add 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2034,11 +2034,12 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) EditNurb *editnurb = cu->editnurb; Nurb *nu; - for (nu = editnurb->nurbs.first; nu; nu = nu->next) + for (nu = editnurb->nurbs.first; nu; nu = nu->next) { if (isNurbsel(nu)) { BKE_nurb_direction_switch(nu); keyData_switchDirectionNurb(cu, nu); } + } if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); -- cgit v1.2.3 From 0528162eb691e9d0de39b5f72c427a4d96542f64 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 12:05:38 +0000 Subject: patch [#34320] Cross compiling with mingw-w64 on ubuntu from Martijn Berger (juicyfruit) applying since this is only corrects header case which is ignored on windows anyway. --- intern/cycles/util/util_dynlib.cpp | 2 +- intern/ghost/intern/GHOST_DropTargetWin32.cpp | 2 +- intern/utfconv/utf_winfunc.c | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/creator/creator.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/intern/cycles/util/util_dynlib.cpp b/intern/cycles/util/util_dynlib.cpp index 5836073a07a..3eaa16ab37d 100644 --- a/intern/cycles/util/util_dynlib.cpp +++ b/intern/cycles/util/util_dynlib.cpp @@ -22,7 +22,7 @@ #ifdef _WIN32 -#include +#include CCL_NAMESPACE_BEGIN diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp index 89e9a91b34c..5288b77a3c6 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp +++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp @@ -32,7 +32,7 @@ #include "GHOST_Debug.h" #include "GHOST_DropTargetWin32.h" -#include +#include #include "utf_winfunc.h" #include "utfconv.h" diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c index 18f0e808562..77209313926 100644 --- a/intern/utfconv/utf_winfunc.c +++ b/intern/utfconv/utf_winfunc.c @@ -29,7 +29,7 @@ #include "utf_winfunc.h" #include -#include +#include #include diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index de0da3df868..da0c6dd2a63 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -33,7 +33,7 @@ #include #ifdef WIN32 -# include +# include #endif #include "MEM_guardedalloc.h" diff --git a/source/creator/creator.c b/source/creator/creator.c index 4b74e225ec4..d7b2d87ffe8 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -48,7 +48,7 @@ #endif #ifdef WIN32 -# include +# include # include "utfconv.h" #endif -- cgit v1.2.3 From f7848569063386b5925cb692652b584ea8765572 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 13:15:34 +0000 Subject: make asserts that check for unit length vectors into a macro. this was really not nice logic to try to fit into an assert. --- source/blender/blenlib/BLI_math_base.h | 22 +++++++++++++++++++++- source/blender/blenlib/intern/math_geom.c | 5 +---- source/blender/blenlib/intern/math_vector.c | 19 +++++-------------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 94063c9a40a..639512f7433 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -217,5 +217,25 @@ extern double round(double x); double double_round(double x, int ndigits); -#endif /* __BLI_MATH_BASE_H__ */ +/* asserts, some math functions expect normalized inputs + * check the vector is unit length, or zero length (which can't be helped in some cases). + */ +#ifdef DEBUG +# define BLI_ASSERT_UNIT_EPSILON 0.0001f +# define BLI_ASSERT_UNIT_V3(v) { \ + const float _test_unit = len_squared_v3(v); \ + BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ + (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ +} (void)0 + +# define BLI_ASSERT_UNIT_V2(v) { \ + const float _test_unit = len_squared_v2(v); \ + BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ + (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ +} (void)0 +#else +# define BLI_ASSERT_UNIT_V2(v) (void)0 +# define BLI_ASSERT_UNIT_V3(v) (void)0 +#endif +#endif /* __BLI_MATH_BASE_H__ */ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 810c15437dc..baca7bb8f8a 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2001,10 +2001,7 @@ bool axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3]) float angle; /* double check they are normalized */ -#ifdef DEBUG - float test; - BLI_assert(fabsf((test = len_squared_v3(normal)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f); -#endif + BLI_ASSERT_UNIT_V3(normal); cross_v3_v3v3(axis, normal, up); angle = saacos(dot_v3v3(normal, up)); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 490ed2a99fb..58d444f5794 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -235,11 +235,8 @@ float angle_signed_v2v2(const float v1[2], const float v2[2]) float angle_normalized_v3v3(const float v1[3], const float v2[3]) { /* double check they are normalized */ -#ifdef DEBUG - float test; - BLI_assert(fabsf((test = len_squared_v3(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f); - BLI_assert(fabsf((test = len_squared_v3(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f); -#endif + BLI_ASSERT_UNIT_V3(v1); + BLI_ASSERT_UNIT_V3(v2); /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */ if (dot_v3v3(v1, v2) < 0.0f) { @@ -258,11 +255,8 @@ float angle_normalized_v3v3(const float v1[3], const float v2[3]) float angle_normalized_v2v2(const float v1[2], const float v2[2]) { /* double check they are normalized */ -#ifdef DEBUG - float test; - BLI_assert(fabsf((test = len_squared_v2(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f); - BLI_assert(fabsf((test = len_squared_v2(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f); -#endif + BLI_ASSERT_UNIT_V2(v1); + BLI_ASSERT_UNIT_V2(v2); /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */ if (dot_v2v2(v1, v2) < 0.0f) { @@ -449,10 +443,7 @@ void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[ const float sintheta = sin(angle); /* double check they are normalized */ -#ifdef DEBUG - float test; - BLI_assert(fabsf((test = len_squared_v3(axis)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f); -#endif + BLI_ASSERT_UNIT_V3(axis); r[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) + (((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) + -- cgit v1.2.3 From e3b2df5806037d5c466dd01c54ffb3fb53d2ab1c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 19 Feb 2013 13:37:48 +0000 Subject: Fix #34315: memory leak cancelling move to layer operator, after change to make it not execute immediately when opening the popup. --- source/blender/editors/include/UI_interface.h | 2 +- source/blender/editors/interface/interface_handlers.c | 2 +- source/blender/editors/interface/interface_intern.h | 2 +- source/blender/editors/interface/interface_regions.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 15 ++++++++++++--- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index eb74dd1e274..648f8bfd8dd 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -361,7 +361,7 @@ void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registere * but allow using all button types and creating an own layout. */ typedef uiBlock * (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1); -typedef void (*uiBlockCancelFunc)(void *arg1); +typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1); void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg); void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 7e2d79262fc..017ab559911 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7159,7 +7159,7 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) WM_operator_name_call(C, temp.optype->idname, temp.opcontext, NULL); } else if (temp.cancel_func) - temp.cancel_func(temp.popup_arg); + temp.cancel_func(C, temp.popup_arg); } else { /* re-enable tooltips */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index eb7f09c7b34..b1e8b7b001e 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -429,7 +429,7 @@ struct uiPopupBlockHandle { int popup; void (*popup_func)(struct bContext *C, void *arg, int event); - void (*cancel_func)(void *arg); + void (*cancel_func)(struct bContext *C, void *arg); void *popup_arg; struct wmTimer *scrolltimer; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 36717507072..03c127f33c8 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2574,7 +2574,7 @@ static void operator_cb(bContext *C, void *arg, int retval) WM_operator_free(op); } -static void confirm_cancel_operator(void *opv) +static void confirm_cancel_operator(bContext *UNUSED(C), void *opv) { WM_operator_free(opv); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9939e6b69ba..357da5c8f4b 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1243,7 +1243,7 @@ wmOperator *WM_operator_last_redo(const bContext *C) return op; } -static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event)) +static void wm_block_redo_cb(bContext *C, void *arg_op, int arg_event) { wmOperator *op = arg_op; @@ -1260,6 +1260,15 @@ static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event)) } } +static void wm_block_redo_cancel_cb(bContext *C, void *arg_op) +{ + wmOperator *op = arg_op; + + /* if operator never got executed, free it */ + if (op != WM_operator_last_redo(C)) + WM_operator_free(op); +} + static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) { wmOperator *op = arg_op; @@ -1402,7 +1411,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) return block; } -static void wm_operator_ui_popup_cancel(void *userData) +static void wm_operator_ui_popup_cancel(struct bContext *UNUSED(C), void *userData) { wmOpPopUp *data = userData; if (data->free_op && data->op) { @@ -1452,7 +1461,7 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_ if (!(U.uiflag & USER_GLOBALUNDO)) return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, UI_UNIT_Y); - uiPupBlock(C, wm_block_create_redo, op); + uiPupBlockEx(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op); if (do_call) wm_block_redo_cb(C, op, 0); -- cgit v1.2.3 From f5bdd591e989b7c99509473cdff1053e456f78b3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 Feb 2013 13:38:36 +0000 Subject: Remove define which is not actually needed and could have been conflicted with one from IMB_colormanagement.h --- source/blender/imbuf/intern/IMB_colormanagement_intern.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h index ba9e20ac411..e2a8e1e3442 100644 --- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h +++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h @@ -33,8 +33,6 @@ #include "DNA_listBase.h" -#define BCM_CONFIG_FILE "config.ocio" - struct OCIO_ConstProcessorRcPtr; struct ImBuf; -- cgit v1.2.3 From 54311fde29aef9494a6b752786a8d5476867a174 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 13:41:53 +0000 Subject: revert own commit r54625, broke autocomplete. --- .../blender/editors/space_text/text_autocomplete.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 62e5728bd3c..94977fc5f0f 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -162,28 +162,23 @@ static GHash *text_autocomplete_build(Text *text) gh = BLI_ghash_str_new(__func__); for (linep = text->lines.first; linep; linep = linep->next) { - size_t i_start = 0; - size_t i_end = 0; - size_t i_step = 0; + int i_start = 0; + int i_end = 0; while (i_start < linep->len) { /* seek identifier beginning */ - while ((i_start < linep->len) && - (!text_check_identifier_nodigit(BLI_str_utf8_as_unicode_step(&linep->line[i_start], &i_step)))) - { - i_start = i_step; + while (i_start < linep->len && !text_check_identifier_nodigit(linep->line[i_start])) { + i_start++; } i_end = i_start; - while ((i_end < linep->len) && - (!text_check_identifier(BLI_str_utf8_as_unicode_step(&linep->line[i_end], &i_step)))) - { - i_end = i_step; + while (i_end < linep->len && text_check_identifier(linep->line[i_end])) { + i_end++; } if ((i_start != i_end) && /* check we're at the beginning of a line or that the previous char is not an identifier - * this prevents digits from being added */ - ((i_start < 1) || !text_check_identifier(BLI_str_utf8_as_unicode(&linep->line[i_start - 1])))) + * this prevents digits from being added */ + ((i_start < 1) || !text_check_identifier(linep->line[i_start - 1]))) { char *str_sub = &linep->line[i_start]; const int choice_len = i_end - i_start; -- cgit v1.2.3 From ba375ae699b9f58b0e82276790471a68e438311e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 Feb 2013 13:41:58 +0000 Subject: Small correction to make strict compiler setup be happy --- source/blender/windowmanager/intern/wm_operators.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 357da5c8f4b..9562f6d698f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1243,7 +1243,7 @@ wmOperator *WM_operator_last_redo(const bContext *C) return op; } -static void wm_block_redo_cb(bContext *C, void *arg_op, int arg_event) +static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event)) { wmOperator *op = arg_op; -- cgit v1.2.3 From 917252175dce5d4425de76763b2b4d4c88391283 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 14:14:37 +0000 Subject: internal: increase error threshold for normalize assert since normals converted from shorts are not always exactly unit length. --- source/blender/blenlib/BLI_math_base.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 639512f7433..aa4e697b48b 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -221,7 +221,8 @@ double double_round(double x, int ndigits); * check the vector is unit length, or zero length (which can't be helped in some cases). */ #ifdef DEBUG -# define BLI_ASSERT_UNIT_EPSILON 0.0001f +/* note: 0.0001 is too small becaues normals may be converted from short's: see [#34322] */ +# define BLI_ASSERT_UNIT_EPSILON 0.0002f # define BLI_ASSERT_UNIT_V3(v) { \ const float _test_unit = len_squared_v3(v); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ -- cgit v1.2.3 From bc52cb1be305998ca93d3a344963727b5ad2c979 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 14:19:53 +0000 Subject: fix for apply rotation/location failing for surface object types (were recognized as 2d curves). --- source/blender/editors/object/object_transform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 9dd34623739..13523154d62 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -424,7 +424,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo cu = ob->data; - if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) { + if (((ob->type == OB_CURVE) && !(cu->flag & CU_3D)) && (apply_rot || apply_loc)) { BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2D curve, doing nothing"); change = 0; -- cgit v1.2.3 From 9f0dffb202c2db3476199ce27865541cf218931e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 14:36:26 +0000 Subject: fix [#34033] Mesh customdata settings are missing Mesh edge number buttons were removed when the custom-data layers weren't present. More of a usability regression than a bug. --- .../blender/editors/space_view3d/view3d_buttons.c | 39 ++++++++++------------ 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index ec716284bf3..65fe9dba258 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -222,6 +222,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } } } + else { + totedgedata = bm->totedgesel; + } /* check for defgroups */ if (evedef) @@ -427,26 +430,16 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float /* Meshes... */ if (meshdata) { if (totedgedata) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; - BMesh *bm = em->bm; - - const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT); - const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE); - - if (cd_edge_crease_offset != -1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, - totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"), - 0, yi -= buth + but_margin, 200, buth, - &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 3, TIP_("Weight used by SubSurf modifier")); - } - - if (cd_edge_bweight_offset != -1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, - totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"), - 0, yi -= buth + but_margin, 200, buth, - &(tfp->ve_median[M_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used by Bevel modifier")); - } + /* customdata layer added on demand */ + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"), + 0, yi -= buth + but_margin, 200, buth, + &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 3, TIP_("Weight used by SubSurf modifier")); + /* customdata layer added on demand */ + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"), + 0, yi -= buth + but_margin, 200, buth, + &(tfp->ve_median[M_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used by Bevel modifier")); } if (totskinradius) { uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, @@ -529,7 +522,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } if (median[M_CREASE] != 0.0f) { - const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE); + const int cd_edge_crease_offset = (BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE), + CustomData_get_offset(&bm->edata, CD_CREASE)); const float sca = compute_scale_factor(ve_median[M_CREASE], median[M_CREASE]); BMEdge *eed; @@ -561,7 +555,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } if (median[M_WEIGHT] != 0.0f) { - const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT); + const int cd_edge_bweight_offset = (BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_BWEIGHT), + CustomData_get_offset(&bm->edata, CD_BWEIGHT)); const float sca = compute_scale_factor(ve_median[M_WEIGHT], median[M_WEIGHT]); BMEdge *eed; -- cgit v1.2.3 From c3b96f33af3d5325b9475b07ef8204e1aa4fcd43 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 15:15:34 +0000 Subject: internal: add include so blender builds against libpng1.6 --- intern/smoke/intern/WAVELET_NOISE.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h index fce901b68aa..1b2fbfab58c 100644 --- a/intern/smoke/intern/WAVELET_NOISE.h +++ b/intern/smoke/intern/WAVELET_NOISE.h @@ -45,6 +45,8 @@ #include +#include + #ifdef WIN32 #include #define isnan _isnan -- cgit v1.2.3 From 1a620ac9c331cd9a9eb5a378a22818163fd61ab4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 15:21:12 +0000 Subject: bpy.props.RemoveProperty() py api docs were still incorrect. --- source/blender/python/intern/bpy_props.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 7ffce0e9a93..830c2c8de3a 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2796,13 +2796,13 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject } PyDoc_STRVAR(BPy_RemoveProperty_doc, -".. function:: RemoveProperty(cls, attr)\n" +".. function:: RemoveProperty(cls, attr="")\n" "\n" " Removes a dynamically defined property.\n" "\n" -" :arg cls: The class containing the property.\n" +" :arg cls: The class containing the property (must be a positional argument).\n" " :type cls: type\n" -" :arg attr: Property name.\n" +" :arg attr: Property name (must be passed as a keyword).\n" " :type attr: string\n" "\n" ".. note:: Typically this function doesn't need to be accessed directly.\n" @@ -2821,7 +2821,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw return ret; } else if (PyTuple_GET_SIZE(args) > 1) { - PyErr_SetString(PyExc_ValueError, "all args must be keywords"); + PyErr_SetString(PyExc_ValueError, "expected one positional arg, one keyword arg"); return NULL; } -- cgit v1.2.3 From 04d628a5b510e3e8f0c8cf67f07af021aa3f46cf Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 19 Feb 2013 15:45:56 +0000 Subject: Another huge bunch of new UI translations (some reported by Leon Cheung, thanks!)... --- source/blender/blenkernel/intern/context.c | 4 +- source/blender/editors/gpencil/gpencil_paint.c | 19 +- .../editors/interface/interface_templates.c | 41 +++-- source/blender/editors/mesh/editface.c | 4 +- source/blender/editors/mesh/editmesh_knife.c | 15 +- source/blender/editors/mesh/editmesh_loopcut.c | 10 +- source/blender/editors/mesh/editmesh_tools.c | 25 ++- .../editors/space_buttons/buttons_context.c | 7 +- .../blender/editors/space_view3d/view3d_buttons.c | 26 +-- source/blender/editors/space_view3d/view3d_draw.c | 40 +++-- source/blender/editors/transform/transform.c | 191 +++++++++++---------- .../editors/transform/transform_constraints.c | 28 +-- .../blender/editors/transform/transform_generics.c | 16 +- .../editors/transform/transform_orientations.c | 10 +- source/blender/editors/uvedit/CMakeLists.txt | 5 + source/blender/editors/uvedit/SConscript | 9 +- source/blender/editors/uvedit/uvedit_buttons.c | 10 +- 17 files changed, 251 insertions(+), 209 deletions(-) diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index a45afa5e69a..a9e3d52f223 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -48,6 +48,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_main.h" #include "BKE_screen.h" @@ -851,7 +853,7 @@ void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg) const char *CTX_wm_operator_poll_msg_get(bContext *C) { - return C->wm.operator_poll_msg; + return IFACE_(C->wm.operator_poll_msg); } /* data context */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 41ef4bd0b95..8cd2bd861bc 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -39,6 +39,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "PIL_time.h" #include "BKE_gpencil.h" @@ -1457,28 +1459,27 @@ static void gpencil_draw_status_indicators(tGPsdata *p) case GP_STATUS_PAINTING: /* only print this for paint-sessions, otherwise it gets annoying */ if (GPENCIL_SKETCH_SESSIONS_ON(p->scene)) - ED_area_headerprint(p->sa, "Grease Pencil: Drawing/erasing stroke... Release to end stroke"); + ED_area_headerprint(p->sa, IFACE_("Grease Pencil: Drawing/erasing stroke... Release to end stroke")); break; case GP_STATUS_IDLING: /* print status info */ switch (p->paintmode) { case GP_PAINTMODE_ERASER: - ED_area_headerprint(p->sa, - "Grease Pencil Erase Session: Hold and drag LMB or RMB to erase |" - " ESC/Enter to end"); + ED_area_headerprint(p->sa, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase |" + " ESC/Enter to end")); break; case GP_PAINTMODE_DRAW_STRAIGHT: - ED_area_headerprint(p->sa, "Grease Pencil Line Session: Hold and drag LMB to draw | " - "ESC/Enter to end"); + ED_area_headerprint(p->sa, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | " + "ESC/Enter to end")); break; case GP_PAINTMODE_DRAW: - ED_area_headerprint(p->sa, "Grease Pencil Freehand Session: Hold and drag LMB to draw | " - "ESC/Enter to end"); + ED_area_headerprint(p->sa, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | " + "ESC/Enter to end")); break; default: /* unhandled future cases */ - ED_area_headerprint(p->sa, "Grease Pencil Session: ESC/Enter to end"); + ED_area_headerprint(p->sa, IFACE_("Grease Pencil Session: ESC/Enter to end")); break; } break; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 5805806a9a9..a9227158a20 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -542,8 +542,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. Only for images, sound and fonts */ if (id && BKE_pack_check(id)) { - - but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "Packed File"); + but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, + UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack")); uiButGetOperatorPtrRNA(but); RNA_string_set(but->opptr, "id_name", id->name + 2); @@ -691,7 +691,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co uiItemL(row, text, ICON_NONE); } else - uiItemL(row, "ID-Block:", ICON_NONE); + uiItemL(row, IFACE_("ID-Block:"), ICON_NONE); /* ID-Type Selector - just have a menu of icons */ /* FIXME: the icon-only setting doesn't work when we supply a blank name */ @@ -735,7 +735,7 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna /************************ Modifier Template *************************/ -#define ERROR_LIBDATA_MESSAGE "Can't edit external libdata" +#define ERROR_LIBDATA_MESSAGE IFACE_("Can't edit external libdata") static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v) { @@ -835,8 +835,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, block = uiLayoutGetBlock(row); /* VIRTUAL MODIFIER */ /* XXX this is not used now, since these cannot be accessed via RNA */ - BLI_snprintf(str, sizeof(str), "%s parent deform", md->name); - uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); + BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name); + uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name")); but = uiDefBut(block, BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Convert virtual modifier to a real modifier")); @@ -943,18 +943,22 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) { if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) - uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_duplicates_make_real"); + uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE, + "OBJECT_OT_duplicates_make_real"); else if (psys->part->ren_as == PART_DRAW_PATH) - uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_modifier_convert"); + uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE, + "OBJECT_OT_modifier_convert"); } } else { uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); - uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), + 0, "apply_as", MODIFIER_APPLY_DATA); if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) { - uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0, - "apply_as", MODIFIER_APPLY_SHAPE); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", + CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"), + 0, "apply_as", MODIFIER_APPLY_SHAPE); } } @@ -964,7 +968,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke)) { - uiItemO(row, IFACE_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy"); + uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE, + "OBJECT_OT_modifier_copy"); } } @@ -1086,10 +1091,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) cti = BKE_constraint_get_typeinfo(con); if (cti == NULL) { /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ - BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr)); + BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? IFACE_("Null") : IFACE_("Unknown"), sizeof(typestr)); } else - BLI_strncpy(typestr, cti->name, sizeof(typestr)); + BLI_strncpy(typestr, IFACE_(cti->name), sizeof(typestr)); /* determine whether constraint is proxy protected or not */ if (BKE_proxylocked_constraints_owner(ob, pchan)) @@ -1194,7 +1199,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* Set but-locks for protected settings (magic numbers are used here!) */ if (proxy_protected) - uiBlockSetButLock(block, 1, "Cannot edit Proxy-Protected Constraint"); + uiBlockSetButLock(block, 1, IFACE_("Cannot edit Proxy-Protected Constraint")); /* Draw constraint data */ if ((con->flag & CONSTRAINT_EXPAND) == 0) { @@ -1478,7 +1483,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr); row = uiLayoutRow(layout, FALSE); - uiItemR(row, &ptr, "position", 0, "Pos", ICON_NONE); + uiItemR(row, &ptr, "position", 0, IFACE_("Pos"), ICON_NONE); bt = block->buttons.last; uiButSetFunc(bt, colorband_update_cb, bt, coba); @@ -2480,8 +2485,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* validate arguments */ /* Forbid default UI_UL_DEFAULT_CLASS_NAME list class without a custom list_id! */ if (!strcmp(UI_UL_DEFAULT_CLASS_NAME, listtype_name) && !(list_id && list_id[0])) { - RNA_warning("template_list using default '" UI_UL_DEFAULT_CLASS_NAME - "' UIList class must provide a custom list_id"); + RNA_warning("template_list using default '%s' UIList class must provide a custom list_id", + UI_UL_DEFAULT_CLASS_NAME); return; } diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 3fbfaabbc0d..7ac27e038a4 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -34,6 +34,8 @@ #include "BLI_math.h" #include "BLI_edgehash.h" +#include "BLF_translation.h" + #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -429,7 +431,7 @@ void seam_mark_clear_tface(Scene *scene, short mode) if (me == 0 || me->totpoly == 0) return; if (mode == 0) - mode = pupmenu("Seams %t|Mark Border Seam %x1|Clear Seam %x2"); + mode = pupmenu(IFACE_("Seams %t|Mark Border Seam %x1|Clear Seam %x2")); if (mode != 1 && mode != 2) return; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index bc7fe783e78..98fa9d10ab9 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -41,6 +41,8 @@ #include "BLI_smallhash.h" #include "BLI_memarena.h" +#include "BLF_translation.h" + #include "BKE_DerivedMesh.h" #include "BKE_context.h" @@ -215,12 +217,13 @@ static void knife_update_header(bContext *C, KnifeTool_OpData *kcd) #define HEADER_LENGTH 190 char header[HEADER_LENGTH]; - BLI_snprintf(header, HEADER_LENGTH, "LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, E: new cut, Ctrl: midpoint snap (%s), " - "Shift: ignore snap (%s), C: angle constrain (%s), Z: cut through (%s)", - kcd->snap_midpoints ? "On" : "Off", - kcd->ignore_edge_snapping ? "On" : "Off", - kcd->angle_snapping ? "On" : "Off", - kcd->cut_through ? "On" : "Off"); + BLI_snprintf(header, HEADER_LENGTH, IFACE_("LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, " + "E: new cut, Ctrl: midpoint snap (%s), Shift: ignore snap (%s), " + "C: angle constrain (%s), Z: cut through (%s)"), + kcd->snap_midpoints ? IFACE_("On") : IFACE_("Off"), + kcd->ignore_edge_snapping ? IFACE_("On") : IFACE_("Off"), + kcd->angle_snapping ? IFACE_("On") : IFACE_("Off"), + kcd->cut_through ? IFACE_("On") : IFACE_("Off")); ED_area_headerprint(CTX_wm_area(C), header); } diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index d1373363992..83542915ec2 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -37,6 +37,8 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_modifier.h" #include "BKE_report.h" @@ -411,10 +413,8 @@ static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt) lcd->eed = edge; ringsel_find_edge(lcd, 1); } - ED_area_headerprint(sa, - "Select a ring to be cut, " - "use mouse-wheel or page-up/down for number of cuts, " - "Hold Alt for smooth"); + ED_area_headerprint(sa, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, " + "hold Alt for smooth")); return OPERATOR_RUNNING_MODAL; } @@ -543,7 +543,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) if (show_cuts) { char buf[64]; - BLI_snprintf(buf, sizeof(buf), "Number of Cuts: %d, Smooth: %.2f (Alt)", cuts, smoothness); + BLI_snprintf(buf, sizeof(buf), IFACE_("Number of Cuts: %d, Smooth: %.2f (Alt)"), cuts, smoothness); ED_area_headerprint(CTX_wm_area(C), buf); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 4957d498e98..3dd9adc264b 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -47,6 +47,8 @@ #include "BLI_math.h" #include "BLI_rand.h" +#include "BLF_translation.h" + #include "BKE_material.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -4673,9 +4675,10 @@ typedef struct { static void edbm_bevel_update_header(wmOperator *op, bContext *C) { #ifdef NEW_BEVEL - static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), offset: %s, segments: %d"; + const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RMB), Offset: %s, Segments: %d"); #else - static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), factor: %s, Use Dist (D): %s: Use Even (E): %s"; + const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RMB), Factor: %s, Use Dist (D): %s, " + "Use Even (E): %s"); BevelData *opdata = op->customdata; #endif @@ -4698,8 +4701,8 @@ static void edbm_bevel_update_header(wmOperator *op, bContext *C) BLI_snprintf(factor_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "percent")); BLI_snprintf(msg, HEADER_LENGTH, str, factor_str, - RNA_boolean_get(op->ptr, "use_dist") ? "On" : "Off", - RNA_boolean_get(op->ptr, "use_even") ? "On" : "Off" + RNA_boolean_get(op->ptr, "use_dist") ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "use_even") ? IFACE_("On") : IFACE_("Off") ); #endif @@ -5212,12 +5215,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) { InsetData *opdata = op->customdata; - static const char str[] = "Confirm: Enter/LClick, " - "Cancel: (Esc/RClick), " - "thickness: %s, " - "depth (Ctrl to tweak): %s (%s), " - "Outset (O): (%s), " - "Boundary (B): (%s)"; + const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " + "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); @@ -5233,9 +5232,9 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) BLI_snprintf(msg, HEADER_LENGTH, str, flts_str, flts_str + NUM_STR_REP_LEN, - opdata->modify_depth ? "On" : "Off", - RNA_boolean_get(op->ptr, "use_outset") ? "On" : "Off", - RNA_boolean_get(op->ptr, "use_boundary") ? "On" : "Off" + opdata->modify_depth ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off") ); ED_area_headerprint(sa, msg); diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 2a5b64cd6ed..0bdae9e32f4 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -36,6 +36,8 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_armature_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -1028,7 +1030,8 @@ 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"); + but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, + 0, 0, 0, 0, IFACE_("Follow context or keep fixed datablock displayed")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ uiButSetFunc(but, pin_cb, NULL, NULL); @@ -1068,7 +1071,7 @@ void buttons_context_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context"); strcpy(pt->idname, "BUTTONS_PT_context"); - strcpy(pt->label, "Context"); + strcpy(pt->label, N_("Context")); /* XXX C panels are not available through RNA (bpy.types)! */ pt->draw = buttons_panel_context; pt->flag = PNL_NO_HEADER; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 65fe9dba258..bb286194992 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -403,28 +403,28 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBlockBeginAlign(block); /* Should be no need to translate these. */ - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, yi -= buth, 200, buth, + but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("X:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[LOC_X]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, yi -= buth, 200, buth, + but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Y:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[LOC_Y]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, yi -= buth, 200, buth, + but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Z:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[LOC_Z]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); if (totcurvebweight == tot) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, yi -= buth, 200, buth, + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("W:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[C_BWEIGHT]), 0.01, 100.0, 1, 3, ""); } uiBlockBeginAlign(block); uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, IFACE_("Global"), 0, yi -= buth + but_margin, 100, buth, - &v3d->flag, 0, 0, 0, 0, "Displays global values"); + &v3d->flag, 0, 0, 0, 0, TIP_("Displays global values")); uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, IFACE_("Local"), 100, yi, 100, buth, - &v3d->flag, 0, 0, 0, 0, "Displays local values"); + &v3d->flag, 0, 0, 0, 0, TIP_("Displays local values")); uiBlockEndAlign(block); /* Meshes... */ @@ -454,11 +454,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } /* Curve... */ else if (totcurvedata == 1) { - uiDefButR(block, NUM, 0, "Weight", 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, NUM, 0, IFACE_("Weight"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL); - uiDefButR(block, NUM, 0, "Radius", 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, NUM, 0, IFACE_("Radius"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL); - uiDefButR(block, NUM, 0, "Tilt", 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, NUM, 0, IFACE_("Tilt"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "tilt", 0, -FLT_MAX, FLT_MAX, 1, 3, NULL); } else if (totcurvedata > 1) { @@ -476,7 +476,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } /* Lattice... */ else if (totlattdata == 1) { - uiDefButR(block, NUM, 0, "Weight", 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, NUM, 0, IFACE_("Weight"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL); } else if (totlattdata > 1) { @@ -1269,20 +1269,20 @@ void view3d_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object"); strcpy(pt->idname, "VIEW3D_PT_object"); - strcpy(pt->label, "Transform"); + strcpy(pt->label, N_("Transform")); /* XXX C panels not available through RNA (bpy.types)! */ pt->draw = view3d_panel_object; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil"); strcpy(pt->idname, "VIEW3D_PT_gpencil"); - strcpy(pt->label, "Grease Pencil"); + strcpy(pt->label, N_("Grease Pencil")); /* XXX C panels are not available through RNA (bpy.types)! */ pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup"); strcpy(pt->idname, "VIEW3D_PT_vgroup"); - strcpy(pt->label, "Vertex Groups"); + strcpy(pt->label, N_("Vertex Groups")); /* XXX C panels are not available through RNA (bpy.types)! */ pt->draw = view3d_panel_vgroup; pt->poll = view3d_panel_vgroup_poll; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index c41fb926ab0..a34b4c5157b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -75,7 +75,9 @@ #include "BIF_glutil.h" #include "WM_api.h" + #include "BLF_api.h" +#include "BLF_translation.h" #include "ED_armature.h" #include "ED_keyframing.h" @@ -804,28 +806,28 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d) switch (rv3d->view) { case RV3D_VIEW_FRONT: - if (rv3d->persp == RV3D_ORTHO) name = "Front Ortho"; - else name = "Front Persp"; + if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Front Ortho"); + else name = IFACE_("Front Persp"); break; case RV3D_VIEW_BACK: - if (rv3d->persp == RV3D_ORTHO) name = "Back Ortho"; - else name = "Back Persp"; + if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Back Ortho"); + else name = IFACE_("Back Persp"); break; case RV3D_VIEW_TOP: - if (rv3d->persp == RV3D_ORTHO) name = "Top Ortho"; - else name = "Top Persp"; + if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Top Ortho"); + else name = IFACE_("Top Persp"); break; case RV3D_VIEW_BOTTOM: - if (rv3d->persp == RV3D_ORTHO) name = "Bottom Ortho"; - else name = "Bottom Persp"; + if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Bottom Ortho"); + else name = IFACE_("Bottom Persp"); break; case RV3D_VIEW_RIGHT: - if (rv3d->persp == RV3D_ORTHO) name = "Right Ortho"; - else name = "Right Persp"; + if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Right Ortho"); + else name = IFACE_("Right Persp"); break; case RV3D_VIEW_LEFT: - if (rv3d->persp == RV3D_ORTHO) name = "Left Ortho"; - else name = "Left Persp"; + if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Left Ortho"); + else name = IFACE_("Left Persp"); break; default: @@ -833,14 +835,14 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d) if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) { Camera *cam; cam = v3d->camera->data; - name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho"; + name = (cam->type != CAM_ORTHO) ? IFACE_("Camera Persp") : IFACE_("Camera Ortho"); } else { - name = "Object as Camera"; + name = IFACE_("Object as Camera"); } } else { - name = (rv3d->persp == RV3D_ORTHO) ? "User Ortho" : "User Persp"; + name = (rv3d->persp == RV3D_ORTHO) ? IFACE_("User Ortho") : IFACE_("User Persp"); } break; } @@ -855,7 +857,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) char tmpstr[24]; if (v3d->localvd) { - BLI_snprintf(tmpstr, sizeof(tmpstr), "%s (Local)", name); + BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name); name = tmpstr; } @@ -918,7 +920,7 @@ static void draw_selected_name(Scene *scene, Object *ob, rcti *rect) if (kb) { BLI_snprintf(shapes, sizeof(shapes), ": %s ", kb->name); if (ob->shapeflag == OB_SHAPE_LOCK) { - strcat(shapes, " (Pinned)"); + strcat(shapes, IFACE_(" (Pinned)")); } } } @@ -2846,11 +2848,11 @@ static void draw_viewport_fps(Scene *scene, rcti *rect) /* is this more then half a frame behind? */ if (fps + 0.5f < (float)(FPS)) { UI_ThemeColor(TH_REDALERT); - BLI_snprintf(printable, sizeof(printable), "fps: %.2f", fps); + BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %.2f"), fps); } else { UI_ThemeColor(TH_TEXT_HI); - BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps + 0.5f)); + BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), (int)(fps + 0.5f)); } BLF_draw_default_ascii(rect->xmin + U.widget_unit, rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable)); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index befeb2bce25..1a7a425fbc9 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -94,6 +94,7 @@ #include "RNA_access.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "transform.h" @@ -790,22 +791,29 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm if (!(t->flag & T_NO_CONSTRAINT)) { int constraint_axis, constraint_plane; int edit_2d = (t->flag & T_2D_EDIT); - char msg1[] = "along _"; - char msg2[] = "along %s _"; - char msg3[] = "locking %s _"; + const char *msg1 = "", *msg2 = "", *msg3 = ""; char axis; /* Initialize */ switch (key_type) { case XKEY: + msg1 = IFACE_("along X"); + msg2 = IFACE_("along %s X"); + msg3 = IFACE_("locking %s X"); axis = 'X'; constraint_axis = CON_AXIS0; break; case YKEY: + msg1 = IFACE_("along Y"); + msg2 = IFACE_("along %s Y"); + msg3 = IFACE_("locking %s Y"); axis = 'Y'; constraint_axis = CON_AXIS1; break; case ZKEY: + msg1 = IFACE_("along Z"); + msg2 = IFACE_("along %s Z"); + msg3 = IFACE_("locking %s Z"); axis = 'Z'; constraint_axis = CON_AXIS2; break; @@ -813,9 +821,6 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm /* Invalid key */ return; } - msg1[sizeof(msg1) - 2] = axis; - msg2[sizeof(msg2) - 2] = axis; - msg3[sizeof(msg3) - 2] = axis; constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & (~constraint_axis)); if (edit_2d && (key_type != ZKEY)) { @@ -1005,10 +1010,10 @@ int transformEvent(TransInfo *t, wmEvent *event) } else { if (t->flag & T_2D_EDIT) { - setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X"); + setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), IFACE_("along X")); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS0), "along %s X"); + setUserConstraint(t, t->current_orientation, (CON_AXIS0), IFACE_("along %s X")); } } t->redraw |= TREDRAW_HARD; @@ -1021,10 +1026,10 @@ int transformEvent(TransInfo *t, wmEvent *event) } else { if (t->flag & T_2D_EDIT) { - setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y"); + setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), IFACE_("along Y")); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS1), "along %s Y"); + setUserConstraint(t, t->current_orientation, (CON_AXIS1), IFACE_("along %s Y")); } } t->redraw |= TREDRAW_HARD; @@ -1036,7 +1041,7 @@ int transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS2), "along %s Z"); + setUserConstraint(t, t->current_orientation, (CON_AXIS2), IFACE_("along %s Z")); } t->redraw |= TREDRAW_HARD; } @@ -1047,7 +1052,7 @@ int transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), "locking %s X"); + setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X")); } t->redraw |= TREDRAW_HARD; } @@ -1058,7 +1063,7 @@ int transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), "locking %s Y"); + setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y")); } t->redraw |= TREDRAW_HARD; } @@ -1069,7 +1074,7 @@ int transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), "locking %s Z"); + setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z")); } t->redraw |= TREDRAW_HARD; } @@ -1174,7 +1179,7 @@ int transformEvent(TransInfo *t, wmEvent *event) /* exception for switching to dolly, or trackball, in camera view */ if (t->flag & T_CAMERA) { if (t->mode == TFM_TRANSLATION) - setLocalConstraint(t, (CON_AXIS2), "along local Z"); + setLocalConstraint(t, (CON_AXIS2), IFACE_("along local Z")); else if (t->mode == TFM_ROTATION) { restoreTransObjects(t); initTrackball(t); @@ -1666,7 +1671,7 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) { rcti rect; - const char printable[] = "Auto Keying On"; + const char *printable = IFACE_("Auto Keying On"); float printable_size[2]; int xco, yco; @@ -2699,13 +2704,13 @@ int Warp(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Warp: %s", c); + sprintf(str, IFACE_("Warp: %s"), c); circumfac = DEG2RADF(circumfac); } else { /* default header print */ - sprintf(str, "Warp: %.3f", RAD2DEGF(circumfac)); + sprintf(str, IFACE_("Warp: %.3f"), RAD2DEGF(circumfac)); } t->values[0] = circumfac; @@ -2840,11 +2845,11 @@ int Shear(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Shear: %s %s", c, t->proptext); + sprintf(str, IFACE_("Shear: %s %s"), c, t->proptext); } else { /* default header print */ - sprintf(str, "Shear: %.3f %s (Press X or Y to set shear axis)", value, t->proptext); + sprintf(str, IFACE_("Shear: %.3f %s (Press X or Y to set shear axis)"), value, t->proptext); } t->values[0] = value; @@ -2936,30 +2941,30 @@ static void headerResize(TransInfo *t, float vec[3], char *str) if (t->con.mode & CON_APPLY) { switch (t->num.idx_max) { case 0: - spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); + spos += sprintf(spos, IFACE_("Scale: %s%s %s"), &tvec[0], t->con.text, t->proptext); break; case 1: - spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], + spos += sprintf(spos, IFACE_("Scale: %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], t->con.text, t->proptext); break; case 2: - spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], + spos += sprintf(spos, IFACE_("Scale: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext); } } else { if (t->flag & T_2D_EDIT) { - spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], + spos += sprintf(spos, IFACE_("Scale X: %s Y: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], t->con.text, t->proptext); } else { - spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], + spos += sprintf(spos, IFACE_("Scale X: %s Y: %s Z: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext); } } if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { - spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); + spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size); } (void)spos; @@ -3318,11 +3323,11 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "To Sphere: %s %s", c, t->proptext); + sprintf(str, IFACE_("To Sphere: %s %s"), c, t->proptext); } else { /* default header print */ - sprintf(str, "To Sphere: %.4f %s", ratio, t->proptext); + sprintf(str, IFACE_("To Sphere: %.4f %s"), ratio, t->proptext); } @@ -3662,17 +3667,17 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - spos += sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext); + spos += sprintf(spos, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext); /* Clamp between -180 and 180 */ final = angle_wrap_rad(DEG2RADF(final)); } else { - spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext); + spos += sprintf(spos, IFACE_("Rot: %.2f%s %s"), RAD2DEGF(final), t->con.text, t->proptext); } if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { - spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); + spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size); } (void)spos; @@ -3761,17 +3766,17 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[NUM_STR_REP_LEN], t->proptext); + spos += sprintf(spos, IFACE_("Trackball: %s %s %s"), &c[0], &c[NUM_STR_REP_LEN], t->proptext); phi[0] = DEG2RADF(phi[0]); phi[1] = DEG2RADF(phi[1]); } else { - spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext); + spos += sprintf(spos, IFACE_("Trackball: %.2f %.2f %s"), RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext); } if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { - spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); + spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size); } (void)spos; @@ -3882,7 +3887,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) short chainlen = t->settings->autoik_chainlen; if (chainlen) - sprintf(autoik, "AutoIK-Len: %d", chainlen); + sprintf(autoik, IFACE_("AutoIK-Len: %d"), chainlen); else autoik[0] = '\0'; } @@ -3915,7 +3920,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) } if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { - spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); + spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size); } (void)spos; } @@ -4077,7 +4082,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) /* header print for NumInput */ str_p = str; - str_p += BLI_snprintf(str_p, sizeof(str), "Shrink/Fatten:"); + str_p += BLI_snprintf(str_p, sizeof(str), IFACE_("Shrink/Fatten:")); if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; outputNumInput(&(t->num), c); @@ -4099,8 +4104,8 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) str_p += WM_keymap_item_to_string(kmi, str_p, sizeof(str) - (str_p - str)); } } - str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " or Alt) Even Thickness %s", - (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF"); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_(" or Alt) Even Thickness %s"), + (t->flag & T_ALT_TRANSFORM) ? IFACE_("ON") : IFACE_("OFF")); /* done with header string */ @@ -4171,7 +4176,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Tilt: %s° %s", &c[0], t->proptext); + sprintf(str, IFACE_("Tilt: %s° %s"), &c[0], t->proptext); final = DEG2RADF(final); @@ -4179,7 +4184,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2])) t->values[0] = final; } else { - sprintf(str, "Tilt: %.2f° %s", RAD2DEGF(final), t->proptext); + sprintf(str, IFACE_("Tilt: %.2f° %s"), RAD2DEGF(final), t->proptext); } for (i = 0; i < t->total; i++, td++) { @@ -4243,10 +4248,10 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) char c[NUM_STR_REP_LEN]; outputNumInput(&(t->num), c); - sprintf(str, "Shrink/Fatten: %s", c); + sprintf(str, IFACE_("Shrink/Fatten: %s"), c); } else { - sprintf(str, "Shrink/Fatten: %3f", ratio); + sprintf(str, IFACE_("Shrink/Fatten: %3f"), ratio); } for (i = 0; i < t->total; i++, td++) { @@ -4311,10 +4316,10 @@ int MaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) char c[NUM_STR_REP_LEN]; outputNumInput(&(t->num), c); - sprintf(str, "Feather Shrink/Fatten: %s", c); + sprintf(str, IFACE_("Feather Shrink/Fatten: %s"), c); } else { - sprintf(str, "Feather Shrink/Fatten: %3f", ratio); + sprintf(str, IFACE_("Feather Shrink/Fatten: %3f"), ratio); } /* detect if no points have feather yet */ @@ -4399,11 +4404,11 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Push/Pull: %s%s %s", c, t->con.text, t->proptext); + sprintf(str, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext); } else { /* default header print */ - sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext); + sprintf(str, IFACE_("Push/Pull: %.4f%s %s"), distance, t->con.text, t->proptext); } t->values[0] = distance; @@ -4520,7 +4525,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2])) const char *mode; TransData *td = t->data; - mode = (G.editBMesh->options & BME_BEVEL_VERT) ? "verts only" : "normal"; + mode = (G.editBMesh->options & BME_BEVEL_VERT) ? IFACE_("verts only") : IFACE_("normal"); distance = t->values[0] / 4; /* 4 just seemed a nice value to me, nothing special */ distance = fabs(distance); @@ -4535,11 +4540,11 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Bevel - Dist: %s, Mode: %s (MMB to toggle))", c, mode); + sprintf(str, IFACE_("Bevel - Dist: %s, Mode: %s (MMB to toggle))"), c, mode); } else { /* default header print */ - sprintf(str, "Bevel - Dist: %.4f, Mode: %s (MMB to toggle))", distance, mode); + sprintf(str, IFACE_("Bevel - Dist: %.4f, Mode: %s (MMB to toggle))"), distance, mode); } if (distance < 0) distance = -distance; @@ -4603,16 +4608,16 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); if (weight >= 0.0f) - sprintf(str, "Bevel Weight: +%s %s", c, t->proptext); + sprintf(str, IFACE_("Bevel Weight: +%s %s"), c, t->proptext); else - sprintf(str, "Bevel Weight: %s %s", c, t->proptext); + sprintf(str, IFACE_("Bevel Weight: %s %s"), c, t->proptext); } else { /* default header print */ if (weight >= 0.0f) - sprintf(str, "Bevel Weight: +%.3f %s", weight, t->proptext); + sprintf(str, IFACE_("Bevel Weight: +%.3f %s"), weight, t->proptext); else - sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext); + sprintf(str, IFACE_("Bevel Weight: %.3f %s"), weight, t->proptext); } for (i = 0; i < t->total; i++, td++) { @@ -4676,16 +4681,16 @@ int Crease(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); if (crease >= 0.0f) - sprintf(str, "Crease: +%s %s", c, t->proptext); + sprintf(str, IFACE_("Crease: +%s %s"), c, t->proptext); else - sprintf(str, "Crease: %s %s", c, t->proptext); + sprintf(str, IFACE_("Crease: %s %s"), c, t->proptext); } else { /* default header print */ if (crease >= 0.0f) - sprintf(str, "Crease: +%.3f %s", crease, t->proptext); + sprintf(str, IFACE_("Crease: +%.3f %s"), crease, t->proptext); else - sprintf(str, "Crease: %.3f %s", crease, t->proptext); + sprintf(str, IFACE_("Crease: %.3f %s"), crease, t->proptext); } for (i = 0; i < t->total; i++, td++) { @@ -4744,14 +4749,14 @@ static void headerBoneSize(TransInfo *t, float vec[3], char *str) /* hmm... perhaps the y-axis values don't need to be shown? */ if (t->con.mode & CON_APPLY) { if (t->num.idx_max == 0) - sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext); + sprintf(str, IFACE_("ScaleB: %s%s %s"), &tvec[0], t->con.text, t->proptext); else - sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], - t->con.text, t->proptext); + sprintf(str, IFACE_("ScaleB: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], + &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext); } else { - sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], - t->con.text, t->proptext); + sprintf(str, IFACE_("ScaleB X: %s Y: %s Z: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], + &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext); } } @@ -4867,10 +4872,10 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) char c[NUM_STR_REP_LEN]; outputNumInput(&(t->num), c); - sprintf(str, "Envelope: %s", c); + sprintf(str, IFACE_("Envelope: %s"), c); } else { - sprintf(str, "Envelope: %3f", ratio); + sprintf(str, IFACE_("Envelope: %3f"), ratio); } for (i = 0; i < t->total; i++, td++) { @@ -5923,12 +5928,12 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - BLI_snprintf(str, sizeof(str), "Edge Slide: %s (E)ven: %s, (F)lipped: %s", - &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF"); + BLI_snprintf(str, sizeof(str), IFACE_("Edge Slide: %s (E)ven: %s, (F)lipped: %s"), + &c[0], !is_proportional ? IFACE_("ON") : IFACE_("OFF"), flipped ? IFACE_("ON") : IFACE_("OFF")); } else { - BLI_snprintf(str, sizeof(str), "Edge Slide: %.4f (E)ven: %s, (F)lipped: %s", - final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF"); + BLI_snprintf(str, sizeof(str), IFACE_("Edge Slide: %.4f (E)ven: %s, (F)lipped: %s"), + final, !is_proportional ? IFACE_("ON") : IFACE_("OFF"), flipped ? IFACE_("ON") : IFACE_("OFF")); } CLAMP(final, -1.0f, 1.0f); @@ -5939,7 +5944,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) if (t->customData) doEdgeSlide(t, final); else { - strcpy(str, "Invalid Edge Selection"); + strcpy(str, IFACE_("Invalid Edge Selection")); t->state = TRANS_CANCEL; } @@ -6428,7 +6433,7 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2])) /* header string */ str_p = str; - str_p += BLI_snprintf(str_p, sizeof(str), "Vert Slide: "); + str_p += BLI_snprintf(str_p, sizeof(str), IFACE_("Vert Slide: ")); if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; applyNumInput(&t->num, &final); @@ -6438,20 +6443,22 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2])) else { str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%.4f ", final); } - str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(E)ven: %s, ", !is_proportional ? "ON" : "OFF"); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("(E)ven: %s, "), + !is_proportional ? IFACE_("ON") : IFACE_("OFF")); if (!is_proportional) { - str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(F)lipped: %s, ", flipped ? "ON" : "OFF"); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("(F)lipped: %s, "), + flipped ? IFACE_("ON") : IFACE_("OFF")); } - str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "Alt or (C)lamp: %s", is_clamp ? "ON" : "OFF"); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("Alt or (C)lamp: %s"), + is_clamp ? IFACE_("ON") : IFACE_("OFF")); /* done with header string */ - /*do stuff here*/ if (t->customData) { doVertSlide(t, final); } else { - strcpy(str, "Invalid Vert Selection"); + strcpy(str, IFACE_("Invalid Vert Selection")); t->state = TRANS_CANCEL; } @@ -6502,12 +6509,12 @@ int BoneRoll(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Roll: %s", &c[0]); + sprintf(str, IFACE_("Roll: %s"), &c[0]); final = DEG2RADF(final); } else { - sprintf(str, "Roll: %.2f", RAD2DEGF(final)); + sprintf(str, IFACE_("Roll: %.2f"), RAD2DEGF(final)); } /* set roll values */ @@ -6573,16 +6580,16 @@ int BakeTime(TransInfo *t, const int mval[2]) outputNumInput(&(t->num), c); if (time >= 0.0f) - sprintf(str, "Time: +%s %s", c, t->proptext); + sprintf(str, IFACE_("Time: +%s %s"), c, t->proptext); else - sprintf(str, "Time: %s %s", c, t->proptext); + sprintf(str, IFACE_("Time: %s %s"), c, t->proptext); } else { /* default header print */ if (time >= 0.0f) - sprintf(str, "Time: +%.3f %s", time, t->proptext); + sprintf(str, IFACE_("Time: +%.3f %s"), time, t->proptext); else - sprintf(str, "Time: %.3f %s", time, t->proptext); + sprintf(str, IFACE_("Time: %.3f %s"), time, t->proptext); } for (i = 0; i < t->total; i++, td++) { @@ -6642,7 +6649,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) t->con.applySize(t, NULL, mat); } - sprintf(str, "Mirror%s", t->con.text); + sprintf(str, IFACE_("Mirror%s"), t->con.text); for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) @@ -6676,9 +6683,9 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) recalcData(t); if (t->flag & T_2D_EDIT) - ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)"); + ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y)")); else - ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)"); + ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y, Z)")); } return 1; @@ -6735,7 +6742,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2])) recalcData(t); - ED_area_headerprint(t->sa, "Align"); + ED_area_headerprint(t->sa, IFACE_("Align")); return 1; } @@ -6772,7 +6779,7 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len } str_p = str; - str_p += BLI_snprintf(str, str_len, "Sequence Slide: %s%s, (", &tvec[0], t->con.text); + str_p += BLI_snprintf(str, str_len, IFACE_("Sequence Slide: %s%s, ("), &tvec[0], t->con.text); { wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE); @@ -6780,8 +6787,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len str_p += WM_keymap_item_to_string(kmi, str_p, str_len - (str_p - str)); } } - str_p += BLI_snprintf(str_p, str_len - (str_p - str), " or Alt) Expand to fit %s", - (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF"); + str_p += BLI_snprintf(str_p, str_len - (str_p - str), IFACE_(" or Alt) Expand to fit %s"), + (t->flag & T_ALT_TRANSFORM) ? IFACE_("ON") : IFACE_("OFF")); } static void applySeqSlide(TransInfo *t, float val[2]) @@ -7046,7 +7053,7 @@ static void headerTimeTranslate(TransInfo *t, char *str) sprintf(&tvec[0], "%.4f", val); } - sprintf(str, "DeltaX: %s", &tvec[0]); + sprintf(str, IFACE_("DeltaX: %s"), &tvec[0]); } static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) @@ -7187,7 +7194,7 @@ static void headerTimeSlide(TransInfo *t, float sval, char *str) sprintf(&tvec[0], "%.4f", val); } - sprintf(str, "TimeSlide: %s", &tvec[0]); + sprintf(str, IFACE_("TimeSlide: %s"), &tvec[0]); } static void applyTimeSlide(TransInfo *t, float sval) @@ -7319,7 +7326,7 @@ static void headerTimeScale(TransInfo *t, char *str) else sprintf(&tvec[0], "%.4f", t->values[0]); - sprintf(str, "ScaleX: %s", &tvec[0]); + sprintf(str, IFACE_("ScaleX: %s"), &tvec[0]); } static void applyTimeScale(TransInfo *t) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 097e4592933..c4d61472f18 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -60,6 +60,8 @@ #include "BLI_utildefines.h" #include "BLI_string.h" +#include "BLF_translation.h" + #include "UI_resources.h" #include "transform.h" @@ -598,24 +600,24 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte case V3D_MANIP_GLOBAL: { float mtx[3][3] = MAT3_UNITY; - BLI_snprintf(text, sizeof(text), ftext, "global"); + BLI_snprintf(text, sizeof(text), ftext, IFACE_("global")); setConstraint(t, mtx, mode, text); } break; case V3D_MANIP_LOCAL: - BLI_snprintf(text, sizeof(text), ftext, "local"); + BLI_snprintf(text, sizeof(text), ftext, IFACE_("local")); setLocalConstraint(t, mode, text); break; case V3D_MANIP_NORMAL: - BLI_snprintf(text, sizeof(text), ftext, "normal"); + BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal")); setConstraint(t, t->spacemtx, mode, text); break; case V3D_MANIP_VIEW: - BLI_snprintf(text, sizeof(text), ftext, "view"); + BLI_snprintf(text, sizeof(text), ftext, IFACE_("view")); setConstraint(t, t->spacemtx, mode, text); break; case V3D_MANIP_GIMBAL: - BLI_snprintf(text, sizeof(text), ftext, "gimbal"); + BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal")); setConstraint(t, t->spacemtx, mode, text); break; default: /* V3D_MANIP_CUSTOM */ @@ -865,11 +867,11 @@ static void setNearestAxis2d(TransInfo *t) /* no correction needed... just use whichever one is lower */ if (abs(t->mval[0] - t->con.imval[0]) < abs(t->mval[1] - t->con.imval[1]) ) { t->con.mode |= CON_AXIS1; - BLI_snprintf(t->con.text, sizeof(t->con.text), " along Y axis"); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along Y axis")); } else { t->con.mode |= CON_AXIS0; - BLI_snprintf(t->con.text, sizeof(t->con.text), " along X axis"); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along X axis")); } } @@ -920,31 +922,31 @@ static void setNearestAxis3d(TransInfo *t) if (len[0] <= len[1] && len[0] <= len[2]) { if (t->modifiers & MOD_CONSTRAINT_PLANE) { t->con.mode |= (CON_AXIS1 | CON_AXIS2); - BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s X axis", t->spacename); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" locking %s X axis"), t->spacename); } else { t->con.mode |= CON_AXIS0; - BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s X axis", t->spacename); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along %s X axis"), t->spacename); } } else if (len[1] <= len[0] && len[1] <= len[2]) { if (t->modifiers & MOD_CONSTRAINT_PLANE) { t->con.mode |= (CON_AXIS0 | CON_AXIS2); - BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s Y axis", t->spacename); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" locking %s Y axis"), t->spacename); } else { t->con.mode |= CON_AXIS1; - BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s Y axis", t->spacename); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along %s Y axis"), t->spacename); } } else if (len[2] <= len[1] && len[2] <= len[0]) { if (t->modifiers & MOD_CONSTRAINT_PLANE) { t->con.mode |= (CON_AXIS0 | CON_AXIS1); - BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s Z axis", t->spacename); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" locking %s Z axis"), t->spacename); } else { t->con.mode |= CON_AXIS2; - BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s Z axis", t->spacename); + BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along %s Z axis"), t->spacename); } } } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 9ee1d11a036..c2a331f5249 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -56,6 +56,8 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "RNA_access.h" #include "BIF_gl.h" @@ -1768,25 +1770,25 @@ void calculatePropRatio(TransInfo *t) } switch (t->prop_mode) { case PROP_SHARP: - strcpy(t->proptext, "(Sharp)"); + strcpy(t->proptext, IFACE_("(Sharp)")); break; case PROP_SMOOTH: - strcpy(t->proptext, "(Smooth)"); + strcpy(t->proptext, IFACE_("(Smooth)")); break; case PROP_ROOT: - strcpy(t->proptext, "(Root)"); + strcpy(t->proptext, IFACE_("(Root)")); break; case PROP_LIN: - strcpy(t->proptext, "(Linear)"); + strcpy(t->proptext, IFACE_("(Linear)")); break; case PROP_CONST: - strcpy(t->proptext, "(Constant)"); + strcpy(t->proptext, IFACE_("(Constant)")); break; case PROP_SPHERE: - strcpy(t->proptext, "(Sphere)"); + strcpy(t->proptext, IFACE_("(Sphere)")); break; case PROP_RANDOM: - strcpy(t->proptext, "(Random)"); + strcpy(t->proptext, IFACE_("(Random)")); break; default: t->proptext[0] = '\0'; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 4bd6496e083..e507d062b0e 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -493,25 +493,25 @@ void initTransformOrientation(bContext *C, TransInfo *t) switch (t->current_orientation) { case V3D_MANIP_GLOBAL: unit_m3(t->spacemtx); - strcpy(t->spacename, "global"); + strcpy(t->spacename, IFACE_("global")); break; case V3D_MANIP_GIMBAL: unit_m3(t->spacemtx); if (gimbal_axis(ob, t->spacemtx)) { - strcpy(t->spacename, "gimbal"); + strcpy(t->spacename, IFACE_("gimbal")); break; } /* no gimbal fallthrough to normal */ case V3D_MANIP_NORMAL: if (obedit || (ob && ob->mode & OB_MODE_POSE)) { - strcpy(t->spacename, "normal"); + strcpy(t->spacename, IFACE_("normal")); ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE)); break; } /* no break we define 'normal' as 'local' in Object mode */ case V3D_MANIP_LOCAL: - strcpy(t->spacename, "local"); + strcpy(t->spacename, IFACE_("local")); if (ob) { copy_m3_m4(t->spacemtx, ob->obmat); @@ -528,7 +528,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) RegionView3D *rv3d = t->ar->regiondata; float mat[3][3]; - strcpy(t->spacename, "view"); + strcpy(t->spacename, IFACE_("view")); copy_m3_m4(mat, rv3d->viewinv); normalize_m3(mat); copy_m3_m3(t->spacemtx, mat); diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 1c69e569aa6..695a7cdd0f6 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -22,6 +22,7 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../blenfont ../../blenloader ../../bmesh ../../makesdna @@ -47,4 +48,8 @@ set(SRC uvedit_parametrizer.h ) +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/uvedit/SConscript b/source/blender/editors/uvedit/SConscript index 01316680d5d..dfa15d2de4f 100644 --- a/source/blender/editors/uvedit/SConscript +++ b/source/blender/editors/uvedit/SConscript @@ -27,10 +27,15 @@ Import ('env') +defs = [] + sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../bmesh ../../makesrna #/intern/opennl/extern ../../gpu ../../blenloader' -env.BlenderLib ( 'bf_editors_uvedit', sources, Split(incs), [], libtype=['core'], priority=[45] ) +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + +env.BlenderLib ( 'bf_editors_uvedit', sources, Split(incs), defs, libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c index 1c32c01b8f0..5c188628978 100644 --- a/source/blender/editors/uvedit/uvedit_buttons.c +++ b/source/blender/editors/uvedit/uvedit_buttons.c @@ -43,6 +43,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_mesh.h" @@ -152,8 +154,10 @@ static void uvedit_vertex_buttons(const bContext *C, uiBlock *block) } uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_UVEDIT_VERTEX, "X:", 10, 10, 145, 19, &uvedit_old_center[0], -10 * imx, 10.0 * imx, step, digits, ""); - uiDefButF(block, NUM, B_UVEDIT_VERTEX, "Y:", 165, 10, 145, 19, &uvedit_old_center[1], -10 * imy, 10.0 * imy, step, digits, ""); + uiDefButF(block, NUM, B_UVEDIT_VERTEX, IFACE_("X:"), 10, 10, 145, 19, &uvedit_old_center[0], + -10 * imx, 10.0 * imx, step, digits, ""); + uiDefButF(block, NUM, B_UVEDIT_VERTEX, IFACE_("Y:"), 165, 10, 145, 19, &uvedit_old_center[1], + -10 * imy, 10.0 * imy, step, digits, ""); uiBlockEndAlign(block); } } @@ -214,7 +218,7 @@ void ED_uvedit_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype image panel uv"); strcpy(pt->idname, "IMAGE_PT_uv"); - strcpy(pt->label, "UV Vertex"); + strcpy(pt->label, N_("UV Vertex")); /* XXX C panels are not available through RNA (bpy.types)! */ pt->draw = image_panel_uv; pt->poll = image_panel_uv_poll; BLI_addtail(&art->paneltypes, pt); -- cgit v1.2.3 From de26f5922022abb341b1a66b1d700ded259b9265 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 19 Feb 2013 15:47:30 +0000 Subject: Add CTX_wm_operator_poll_msg_set as auto-detected func for translations. --- release/scripts/modules/bl_i18n_utils/settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 232f54f5140..7e37dffbf10 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -227,7 +227,8 @@ PYGETTEXT_KEYWORDS = (() + for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) + tuple(("{}\\((?:[^\"',]+,){{1,2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) - for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf")) + + for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf", + "CTX_wm_operator_poll_msg_set")) + tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it) for it in ("BMO_error_raise",)) + -- cgit v1.2.3 From cd3b98c4faf7e4f7e54138bfbc2616aeeadc86af Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 15:56:49 +0000 Subject: step over unicode characters with autocomplete (correctly this time). --- source/blender/blenlib/BLI_string_utf8.h | 1 + source/blender/blenlib/intern/string_utf8.c | 16 +++++++++++ .../blender/editors/space_text/text_autocomplete.c | 32 +++++++++++++++------- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index ecbc4cb1cd4..30d5c28bf98 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -41,6 +41,7 @@ int BLI_str_utf8_size_safe(const char *p); /* copied from glib */ unsigned int BLI_str_utf8_as_unicode(const char *p); unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index); +unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index); unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index); size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf); diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 9e0f9197ca3..d802ad53e6a 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -433,6 +433,22 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t * return result; } +unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index) +{ + int i, mask = 0, len; + unsigned int result; + const unsigned char c = (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len, -1); + if (len == -1) { + *index += 1; + return c; + } + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + *index += len; + return result; +} + /* another variant that steps over the index, * note, currently this also falls back to latin1 for text drawing. */ unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index) diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 94977fc5f0f..0c16208c2a7 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -162,23 +162,29 @@ static GHash *text_autocomplete_build(Text *text) gh = BLI_ghash_str_new(__func__); for (linep = text->lines.first; linep; linep = linep->next) { - int i_start = 0; - int i_end = 0; + size_t i_start = 0; + size_t i_end = 0; + size_t i_pos = 0; while (i_start < linep->len) { /* seek identifier beginning */ - while (i_start < linep->len && !text_check_identifier_nodigit(linep->line[i_start])) { - i_start++; + i_pos = i_start; + while ((i_start < linep->len) && + (!text_check_identifier_nodigit(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_start], &i_pos)))) + { + i_start = i_pos; } - i_end = i_start; - while (i_end < linep->len && text_check_identifier(linep->line[i_end])) { - i_end++; + i_pos = i_end = i_start; + while ((i_end < linep->len) && + (text_check_identifier(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_end], &i_pos)))) + { + i_end = i_pos; } if ((i_start != i_end) && /* check we're at the beginning of a line or that the previous char is not an identifier - * this prevents digits from being added */ - ((i_start < 1) || !text_check_identifier(linep->line[i_start - 1]))) + * this prevents digits from being added */ + ((i_start < 1) || !text_check_identifier(BLI_str_utf8_as_unicode(&linep->line[i_start - 1])))) { char *str_sub = &linep->line[i_start]; const int choice_len = i_end - i_start; @@ -197,7 +203,13 @@ static GHash *text_autocomplete_build(Text *text) str_sub[choice_len] = str_sub_last; } } - i_start = i_end; + if (i_end != i_start) { + i_start = i_end; + } + else { + /* highly unlikely, but prevent eternal loop */ + i_start++; + } } } -- cgit v1.2.3 From 91a63e347d3a0909786bc0f39cb0ccf53da9d92d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 15:58:38 +0000 Subject: set unicode conversion errors as UNLIKELY --- source/blender/blenlib/intern/string_utf8.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index d802ad53e6a..26235de4dd2 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -369,7 +369,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__rest int BLI_str_utf8_size(const char *p) { int mask = 0, len; - unsigned char c = (unsigned char) *p; + const unsigned char c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len, -1); @@ -382,7 +382,7 @@ int BLI_str_utf8_size(const char *p) int BLI_str_utf8_size_safe(const char *p) { int mask = 0, len; - unsigned char c = (unsigned char) *p; + const unsigned char c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len, 1); @@ -408,10 +408,10 @@ unsigned int BLI_str_utf8_as_unicode(const char *p) { int i, mask = 0, len; unsigned int result; - unsigned char c = (unsigned char) *p; + const unsigned char c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len, -1); - if (len == -1) + if (UNLIKELY(len == -1)) return BLI_UTF8_ERR; UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); @@ -423,10 +423,10 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t * { int i, mask = 0, len; unsigned int result; - unsigned char c = (unsigned char) *p; + const unsigned char c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len, -1); - if (len == -1) + if (UNLIKELY(len == -1)) return BLI_UTF8_ERR; UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); *index += len; @@ -440,7 +440,7 @@ unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, siz const unsigned char c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len, -1); - if (len == -1) { + if (UNLIKELY(len == -1)) { *index += 1; return c; } @@ -461,7 +461,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__re c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len, -1); - if (len == -1) { + if (UNLIKELY(len == -1)) { /* when called with NULL end, result will never be NULL, * checks for a NULL character */ char *p_next = BLI_str_find_next_char_utf8(p, NULL); -- cgit v1.2.3 From 7f1ae2497b01dfc026564420605b492944d685a6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 16:13:41 +0000 Subject: fix [#34275] Text autocomplete cuts words with accents or special characters autocomplete is now unicode aware, using python api's checks for now. eventually we should have our own. --- source/blender/blenkernel/BKE_text.h | 4 ++++ source/blender/blenkernel/intern/text.c | 12 ++++++++++++ source/blender/editors/space_text/text_autocomplete.c | 6 +++--- source/blender/python/intern/bpy_interface.c | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 3e882a048eb..3d7b5d1c8e4 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -109,6 +109,10 @@ int text_check_identifier_nodigit(const char ch); int text_check_whitespace(const char ch); int text_find_identifier_start(const char *str, int i); +/* defined in bpy_interface.c */ +extern int text_check_identifier_unicode(const unsigned int ch); +extern int text_check_identifier_nodigit_unicode(const unsigned int ch); + enum { TXT_MOVE_LINE_UP = -1, TXT_MOVE_LINE_DOWN = 1 diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 86e7a152a4a..74c0a76f82d 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2938,6 +2938,18 @@ int text_check_identifier_nodigit(const char ch) return 0; } +#ifndef WITH_PYTHON +int text_check_identifier_unicode(const unsigned int ch) +{ + return (ch < 255 && text_check_identifier((char)ch)); +} + +int text_check_identifier_nodigit_unicode(const unsigned int ch) +{ + return (ch < 255 && text_check_identifier_nodigit((char)ch)); +} +#endif /* WITH_PYTHON */ + int text_check_whitespace(const char ch) { if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 0c16208c2a7..7c18b5c283a 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -170,13 +170,13 @@ static GHash *text_autocomplete_build(Text *text) /* seek identifier beginning */ i_pos = i_start; while ((i_start < linep->len) && - (!text_check_identifier_nodigit(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_start], &i_pos)))) + (!text_check_identifier_nodigit_unicode(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_start], &i_pos)))) { i_start = i_pos; } i_pos = i_end = i_start; while ((i_end < linep->len) && - (text_check_identifier(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_end], &i_pos)))) + (text_check_identifier_unicode(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_end], &i_pos)))) { i_end = i_pos; } @@ -184,7 +184,7 @@ static GHash *text_autocomplete_build(Text *text) if ((i_start != i_end) && /* check we're at the beginning of a line or that the previous char is not an identifier * this prevents digits from being added */ - ((i_start < 1) || !text_check_identifier(BLI_str_utf8_as_unicode(&linep->line[i_start - 1])))) + ((i_start < 1) || !text_check_identifier_unicode(BLI_str_utf8_as_unicode(&linep->line[i_start - 1])))) { char *str_sub = &linep->line[i_start]; const int choice_len = i_end - i_start; diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 632018f2bf0..90199a403dc 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -928,3 +928,20 @@ static void bpy_module_free(void *UNUSED(mod)) } #endif + + +/* EVIL, define text.c functions here... */ +extern int text_check_identifier_unicode(const unsigned int ch); +extern int text_check_identifier_nodigit_unicode(const unsigned int ch); +extern int text_check_identifier(const char ch); +extern int text_check_identifier_nodigit(const char ch); + +int text_check_identifier_unicode(const unsigned int ch) +{ + return (ch < 255 && text_check_identifier((char)ch)) || Py_UNICODE_ISALNUM(ch); +} + +int text_check_identifier_nodigit_unicode(const unsigned int ch) +{ + return (ch < 255 && text_check_identifier_nodigit((char)ch)) || Py_UNICODE_ISALPHA(ch); +} -- cgit v1.2.3 From 3d415325542730b610be0d1337c0f5ba13189e9c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Feb 2013 16:57:04 +0000 Subject: fix [#34244] Snap to face projection - Entire mesh is affected by projection when Proportional Editing mode is active, regardless of influence radius --- source/blender/editors/transform/transform_snap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 5577619901a..e95fc6d7bb9 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -303,6 +303,9 @@ void applyProject(TransInfo *t) if (td->flag & TD_SKIP) continue; + + if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f)) + continue; copy_v3_v3(iloc, td->loc); if (t->flag & (T_EDIT | T_POSE)) { @@ -325,7 +328,14 @@ void applyProject(TransInfo *t) mul_m3_v3(td->smtx, tvec); - add_v3_v3(td->loc, tvec); + if ((t->flag & T_PROP_EDIT) == 0) { + add_v3_v3(td->loc, tvec); + } + else { + add_v3_v3(tvec, td->loc); + interp_v3_v3v3(td->loc, td->loc, tvec, td->factor); + } + } } -- cgit v1.2.3 From 3e5f6293b6f73531d9765c0156ec762470a44fc2 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Tue, 19 Feb 2013 20:04:08 +0000 Subject: rigidbody: Don't run simulation if cache is baked In rare cases this would allow the simulation to run before being initialized (if cache is baked and reading cache fails after undo or loading a file). --- source/blender/blenkernel/intern/rigidbody.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 66edfe2fe15..caa344f862e 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1259,7 +1259,7 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) } /* advance simulation, we can only step one frame forward */ - if (ctime == rbw->ltime + 1) { + if (ctime == rbw->ltime + 1 && !(cache->flag & PTCACHE_BAKED)) { /* write cache for first frame when on second frame */ if (rbw->ltime == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) { BKE_ptcache_write(&pid, startframe); -- cgit v1.2.3 From 134537b65baf7fead290f37ae875801fe0784b34 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Wed, 20 Feb 2013 00:06:31 +0000 Subject: fix #34049: Collada importer doesn't import armature. Added support for 'rootless' armature similar to Maya. --- source/blender/collada/DocumentImporter.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index b1103d78394..1b726192079 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -252,8 +252,9 @@ void DocumentImporter::finish() for (std::vector::iterator it = vscenes.begin(); it != vscenes.end(); it++) { const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes(); - for (unsigned int i = 0; i < roots.getCount(); i++) + for (unsigned int i = 0; i < roots.getCount(); i++) { translate_anim_recursive(roots[i], NULL, NULL); + } } if (libnode_ob.size()) { @@ -312,13 +313,19 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW #endif unsigned int i; + //for (i = 0; i < 4; i++) // ob = anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); - COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (i = 0; i < children.getCount(); i++) { - translate_anim_recursive(children[i], node, NULL); + if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) { + translate_anim_recursive(node, node, parob); + } + else { + COLLADAFW::NodePointerArray &children = node->getChildNodes(); + for (i = 0; i < children.getCount(); i++) { + translate_anim_recursive(children[i], node, NULL); + } } } @@ -465,7 +472,18 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA name.c_str()); if (is_joint) { + if (parent_node == NULL) { + par = bc_add_object(sce, OB_ARMATURE, std::string("Armature").c_str()); + //anim_importer.read_node_transform(node, par); + objects_done->push_back(par); + object_map.insert(std::make_pair(node->getUniqueId(), par)); + node_map[node->getUniqueId()] = node; + } armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce); + + if (parent_node == NULL) { + return objects_done; + } } else { COLLADAFW::InstanceGeometryPointerArray &geom = node->getInstanceGeometries(); -- cgit v1.2.3 From 7337c2d4c2a84b7a0b3e212d76aa2e3b6fca8f9a Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Wed, 20 Feb 2013 00:13:34 +0000 Subject: fix #34049: Collada importer doesn't import armature. Added some comments to the program code for better understanding. --- source/blender/collada/DocumentImporter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 1b726192079..17a1c7f1e18 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -319,6 +319,9 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) { + // For Skeletons without root node we have to simulate the + // root node here and recursively enter the same function + // XXX: maybe this can be made more elegant. translate_anim_recursive(node, node, parob); } else { @@ -473,8 +476,9 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA if (is_joint) { if (parent_node == NULL) { + // A Joint on root level is a skeleton without root node. + // Here we add the armature "on the fly": par = bc_add_object(sce, OB_ARMATURE, std::string("Armature").c_str()); - //anim_importer.read_node_transform(node, par); objects_done->push_back(par); object_map.insert(std::make_pair(node->getUniqueId(), par)); node_map[node->getUniqueId()] = node; @@ -482,6 +486,8 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce); if (parent_node == NULL) { + // for skeletons without root node all has been done above. + // Skeletons with root node are handled further down. return objects_done; } } -- cgit v1.2.3 From 6adb526f31fb14d800861a85ea5e565932fae162 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Feb 2013 00:44:18 +0000 Subject: change to proportional editing suggested by Jeroen Hoolmans, don't interpolate projection, just project all points within the PET radius. --- source/blender/editors/transform/transform_snap.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index e95fc6d7bb9..2efd35327c7 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -328,14 +328,7 @@ void applyProject(TransInfo *t) mul_m3_v3(td->smtx, tvec); - if ((t->flag & T_PROP_EDIT) == 0) { - add_v3_v3(td->loc, tvec); - } - else { - add_v3_v3(tvec, td->loc); - interp_v3_v3v3(td->loc, td->loc, tvec, td->factor); - } - + add_v3_v3(td->loc, tvec); } } -- cgit v1.2.3 From 2f0eec488c7c634a843aaaa0abdd33a4e131422b Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Wed, 20 Feb 2013 00:45:53 +0000 Subject: rigidbody: Properly handle constrained objects not having rigid bodies This is a pretty rare case that can be triggered by switching rigid body and constraint groups before simulation was validated. Code checked for existing physics objects but was missing else block. --- source/blender/blenkernel/intern/rigidbody.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index caa344f862e..c2fd6a9f54a 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -635,6 +635,9 @@ void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, shor break; } } + else { /* can't create constraint without both rigid bodies */ + return; + } RB_constraint_set_enabled(rbc->physics_constraint, rbc->flag & RBC_FLAG_ENABLED); -- cgit v1.2.3 From c22e52f4090943e0149924b5d370cac863c8700a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Feb 2013 01:23:34 +0000 Subject: remove unneeded call to RNA_property_enum_get(), the icon was always overwritten after. --- source/blender/editors/interface/interface_templates.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a9227158a20..8e4d0289f78 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1581,7 +1581,8 @@ static uiBlock *icon_view_menu(bContext *C, ARegion *ar, void *arg_litem) /* arg_litem is malloced, can be freed by parent button */ cb = *((RNAUpdateCb *)arg_litem); - icon = RNA_property_enum_get(&cb.ptr, cb.prop); + /* unused */ + // icon = RNA_property_enum_get(&cb.ptr, cb.prop); block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW); -- cgit v1.2.3 From 7f8d597c7983ed9d196402fc441ba510414e0c0f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Feb 2013 01:36:35 +0000 Subject: fix [#32294] Navmesh crashed if on creation navmesh is also selected thanks to Sv. Lockal for investigating and providing the fix. --- source/blender/editors/mesh/editmesh_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index d62eba9728c..fd90246f791 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -136,8 +136,10 @@ void EDBM_mesh_clear(BMEditMesh *em) /* free tessellation data */ em->tottri = 0; - if (em->looptris) + if (em->looptris) { MEM_freeN(em->looptris); + em->looptris = NULL; + } } void EDBM_stats_update(BMEditMesh *em) -- cgit v1.2.3 From 5d04d06d76f0f48c0bc42c223b204b062938df04 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 20 Feb 2013 08:39:31 +0000 Subject: Fix drawing of translated strings (can't use _ascii version of BLF_draw in these cases, when WITH_INTERNATIONAL is defined we need unicode support). --- source/blender/editors/space_view3d/view3d_draw.c | 17 +++++++++++++++-- source/blender/editors/transform/transform.c | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a34b4c5157b..4aaa3332252 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -854,8 +854,13 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) { RegionView3D *rv3d = ar->regiondata; const char *name = view3d_get_name(v3d, rv3d); + /* XXX 24 may be a bit small for unicode languages (Chinese in utf-8...) */ +#ifdef WITH_INTERNATIONAL + char tmpstr[32]; +#else char tmpstr[24]; - +#endif + if (v3d->localvd) { BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name); name = tmpstr; @@ -863,7 +868,11 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) if (name) { UI_ThemeColor(TH_TEXT_HI); +#ifdef WITH_INTERNATIONAL + BLF_draw_default(U.widget_unit + rect->xmin, rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr)); +#else BLF_draw_default_ascii(U.widget_unit + rect->xmin, rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr)); +#endif } } @@ -2854,8 +2863,12 @@ static void draw_viewport_fps(Scene *scene, rcti *rect) UI_ThemeColor(TH_TEXT_HI); BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), (int)(fps + 0.5f)); } - + +#ifdef WITH_INTERNATIONAL + BLF_draw_default(rect->xmin + U.widget_unit, rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable)); +#else BLF_draw_default_ascii(rect->xmin + U.widget_unit, rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable)); +#endif } static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 1a7a425fbc9..ea82ebb9234 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1686,7 +1686,11 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) * - original color was red to match the icon, but that clashes badly with a less nasty border */ UI_ThemeColorShade(TH_TEXT_HI, -50); +#ifdef WITH_INTERNATIONAL + BLF_draw_default(xco, ar->winy - 17, 0.0f, printable, sizeof(printable)); +#else BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable)); +#endif /* autokey recording icon... */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -- cgit v1.2.3 From 1f88ee6213ed5e8b60597034d52188256448b104 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Feb 2013 11:29:43 +0000 Subject: Fix #34299: Motion Tracking 20x slower under Windows Root of the issue goes to SSBA library which didn't work properly when using optimization in MSVC. It was worked around by disabling optimization for libmv, which is in fact shame and shouldn't have been done. It seems after some changes optimization does not affect on SSBA code, but enabling optimization could be risky so close to release. For now solved by splitting SSBA to separate CMake/SCons library, disabling optimization only for this particular library and enabling optimization for rest of libmv. Tested on all files which used to fail with optimization enabled in SSBA and all of them works the same as before. Tracking speed is significantly higher now. After release we'll enable optimization for SSBA as well, so there'll be no crappy build setup. Later we'll replace old SSBA library with new BA code based on Ceres. Bundle script would be broken for until then, so better not to use it. --- extern/libmv/CMakeLists.txt | 21 +------- extern/libmv/SConscript | 21 +------- extern/libmv/third_party/CMakeLists.txt | 1 + extern/libmv/third_party/SConscript | 1 + extern/libmv/third_party/ssba/CMakeLists.txt | 61 ++++++++++++++++++++++++ extern/libmv/third_party/ssba/SConscript | 35 ++++++++++++++ source/blender/editors/space_clip/tracking_ops.c | 4 +- source/creator/CMakeLists.txt | 1 + 8 files changed, 104 insertions(+), 41 deletions(-) create mode 100644 extern/libmv/third_party/ssba/CMakeLists.txt create mode 100644 extern/libmv/third_party/ssba/SConscript diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index 6b5a9a3b67a..aabf2324372 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -26,8 +26,6 @@ # If you're doing changes in this file, please update template # in that script too -add_subdirectory(third_party) - set(INC . ../colamd/Include @@ -86,8 +84,6 @@ set(SRC third_party/gflags/gflags_completions.cc third_party/gflags/gflags_reporting.cc third_party/ldl/Source/ldl.c - third_party/ssba/Geometry/v3d_metricbundle.cpp - third_party/ssba/Math/v3d_optimization.cpp libmv-capi.h libmv/base/id_generator.h @@ -148,13 +144,6 @@ set(SRC third_party/ldl/Include/ldl.h third_party/msinttypes/inttypes.h third_party/msinttypes/stdint.h - third_party/ssba/Geometry/v3d_cameramatrix.h - third_party/ssba/Geometry/v3d_distortion.h - third_party/ssba/Geometry/v3d_metricbundle.h - third_party/ssba/Math/v3d_linear.h - third_party/ssba/Math/v3d_linear_utils.h - third_party/ssba/Math/v3d_mathutilities.h - third_party/ssba/Math/v3d_optimization.h ) if(WIN32) @@ -193,14 +182,6 @@ if(WIN32) third_party/msinttypes ) endif() - - if(MSVC) - set(MSVC_OFLAGS O1 O2 Ox) - foreach(FLAG ${MSVC_OFLAGS}) - string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") - endforeach() - endif() else() list(APPEND SRC third_party/glog/src/demangle.cc @@ -245,3 +226,5 @@ add_definitions( ) blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}") + +add_subdirectory(third_party) diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index b47086f3e91..5f790ab3ae6 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -11,10 +11,6 @@ Import('env') defs = [] -cflags_libmv = Split(env['CFLAGS']) -ccflags_libmv = Split(env['CCFLAGS']) -cxxflags_libmv = Split(env['CXXFLAGS']) - defs.append('V3DLIB_ENABLE_SUITESPARSE') defs.append('GOOGLE_GLOG_DLL_DECL=') @@ -27,8 +23,6 @@ src += env.Glob('libmv/tracking/*.cc') src += env.Glob('third_party/fast/*.c') src += env.Glob('third_party/gflags/*.cc') src += env.Glob('third_party/ldl/Source/*.c') -src += env.Glob('third_party/ssba/Geometry/*.cpp') -src += env.Glob('third_party/ssba/Math/*.cpp') incs = '. ../Eigen3 third_party/ceres/include' incs += ' ' + env['BF_PNG_INC'] @@ -41,19 +35,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', ' src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] src += ['./third_party/glog/src/windows/port.cc'] - - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cflags_libmv.append('/Od') - ccflags_libmv.append('/Od') - cxxflags_libmv.append('/Od') - - if not env['BF_DEBUG']: - defs.append('NDEBUG') - else: - if not env['BF_DEBUG']: - cflags_libmv += Split(env['REL_CFLAGS']) - ccflags_libmv += Split(env['REL_CCFLAGS']) - cxxflags_libmv += Split(env['REL_CXXFLAGS']) else: src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' @@ -64,6 +45,6 @@ else: incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include' -env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv ) +env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) SConscript(['third_party/SConscript']) diff --git a/extern/libmv/third_party/CMakeLists.txt b/extern/libmv/third_party/CMakeLists.txt index 6212fe480b1..7989d97345c 100644 --- a/extern/libmv/third_party/CMakeLists.txt +++ b/extern/libmv/third_party/CMakeLists.txt @@ -1,2 +1,3 @@ +add_subdirectory(ssba) add_subdirectory(ceres) diff --git a/extern/libmv/third_party/SConscript b/extern/libmv/third_party/SConscript index b05692e385f..2e30650f656 100644 --- a/extern/libmv/third_party/SConscript +++ b/extern/libmv/third_party/SConscript @@ -1,3 +1,4 @@ #!/usr/bin/python +SConscript(['ssba/SConscript']) SConscript(['ceres/SConscript']) diff --git a/extern/libmv/third_party/ssba/CMakeLists.txt b/extern/libmv/third_party/ssba/CMakeLists.txt new file mode 100644 index 00000000000..f73a6137d6f --- /dev/null +++ b/extern/libmv/third_party/ssba/CMakeLists.txt @@ -0,0 +1,61 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# The Original Code is Copyright (C) 2013, Blender Foundation +# All rights reserved. +# +# Contributor(s): Blender Foundation, +# Sergey Sharybin +# +# ***** END GPL LICENSE BLOCK ***** + +set(INC + . + ../ldl/Include + ../../../colamd/Include +) + +set(INC_SYS +) + +set(SRC + Geometry/v3d_metricbundle.cpp + Math/v3d_optimization.cpp + + Geometry/v3d_cameramatrix.h + Geometry/v3d_distortion.h + Geometry/v3d_metricbundle.h + Math/v3d_linear.h + Math/v3d_linear_utils.h + Math/v3d_mathutilities.h + Math/v3d_optimization.h +) + +if(WIN32) + if(MSVC) + set(MSVC_OFLAGS O1 O2 Ox) + foreach(FLAG ${MSVC_OFLAGS}) + string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + endforeach() + endif() +endif() + +add_definitions( + -DV3DLIB_ENABLE_SUITESPARSE +) + +blender_add_lib(extern_ssba "${SRC}" "${INC}" "${INC_SYS}") diff --git a/extern/libmv/third_party/ssba/SConscript b/extern/libmv/third_party/ssba/SConscript new file mode 100644 index 00000000000..598415d0039 --- /dev/null +++ b/extern/libmv/third_party/ssba/SConscript @@ -0,0 +1,35 @@ +#!/usr/bin/python + +import sys +import os + +Import('env') + +defs = [] + +cflags_ssba = Split(env['CFLAGS']) +ccflags_ssba = Split(env['CCFLAGS']) +cxxflags_ssba = Split(env['CXXFLAGS']) + +defs.append('V3DLIB_ENABLE_SUITESPARSE') + +src = env.Glob('Geometry/*.cpp') +src += env.Glob('Math/*.cpp') + +incs = '. ../ldl/Include ../../../colamd/Include' + +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + cflags_ssba.append('/Od') + ccflags_ssba.append('/Od') + cxxflags_ssba.append('/Od') + + if not env['BF_DEBUG']: + defs.append('NDEBUG') + else: + if not env['BF_DEBUG']: + cflags_ssba += Split(env['REL_CFLAGS']) + ccflags_ssba += Split(env['REL_CCFLAGS']) + cxxflags_ssba += Split(env['REL_CXXFLAGS']) + +env.BlenderLib ( libname = 'extern_ssba', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_ssba, cc_compileflags=ccflags_ssba, cxx_compileflags=cxxflags_ssba ) diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 56a890c714a..77ed197c1d7 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1105,7 +1105,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo { TrackMarkersJob *tmj = (TrackMarkersJob *)tmv; int framenr = tmj->sfra; - //double t = PIL_check_seconds_timer(); + // double t = PIL_check_seconds_timer(); while (framenr != tmj->efra) { if (tmj->delay > 0) { @@ -1141,7 +1141,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo break; } - //printf("Tracking time: %lf\n", PIL_check_seconds_timer()-t); + // printf("Tracking time: %lf\n", PIL_check_seconds_timer()-t); } static void track_markers_updatejob(void *tmv) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index bb5f34167bc..a5d7763487f 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -924,6 +924,7 @@ endif() if(WITH_LIBMV) list(APPEND BLENDER_SORTED_LIBS extern_libmv) list(APPEND BLENDER_SORTED_LIBS extern_ceres) + list(APPEND BLENDER_SORTED_LIBS extern_ssba) endif() if(WITH_MOD_CLOTH_ELTOPO) -- cgit v1.2.3 From 705d2ab417688976a50897d098ad25ab3ef3e6c8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Feb 2013 11:41:33 +0000 Subject: Correction to previous release -- scons on linux was broken --- extern/libmv/SConscript | 4 ---- 1 file changed, 4 deletions(-) diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index 5f790ab3ae6..42e96e230ea 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -38,10 +38,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', ' else: src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' - if not env['BF_DEBUG']: - cflags_libmv += Split(env['REL_CFLAGS']) - ccflags_libmv += Split(env['REL_CCFLAGS']) - cxxflags_libmv += Split(env['REL_CXXFLAGS']) incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include' -- cgit v1.2.3 From ea99b9a392bddec4ea58b816b1fb66f78c77ff6e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Feb 2013 12:07:27 +0000 Subject: Made ldl code a part of extern_ssba library, otherwise gcc fails to find ldl symbols because order of libraries seems to be critical for gcc linker. A bit stupid, but that's how linker works.. Both CMake and SCons shall work fine on linux now. --- extern/libmv/CMakeLists.txt | 3 --- extern/libmv/SConscript | 3 +-- extern/libmv/third_party/ssba/CMakeLists.txt | 3 +++ extern/libmv/third_party/ssba/SConscript | 1 + source/creator/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index aabf2324372..0cf2211fe88 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -35,7 +35,6 @@ set(INC set(INC_SYS ../Eigen3 third_party/ssba - third_party/ldl/Include ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ) @@ -83,7 +82,6 @@ set(SRC third_party/gflags/gflags.cc third_party/gflags/gflags_completions.cc third_party/gflags/gflags_reporting.cc - third_party/ldl/Source/ldl.c libmv-capi.h libmv/base/id_generator.h @@ -141,7 +139,6 @@ set(SRC third_party/gflags/gflags/gflags.h third_party/gflags/mutex.h third_party/gflags/util.h - third_party/ldl/Include/ldl.h third_party/msinttypes/inttypes.h third_party/msinttypes/stdint.h ) diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index 42e96e230ea..a0ab5bd61d7 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -22,7 +22,6 @@ src += env.Glob('libmv/simple_pipeline/*.cc') src += env.Glob('libmv/tracking/*.cc') src += env.Glob('third_party/fast/*.c') src += env.Glob('third_party/gflags/*.cc') -src += env.Glob('third_party/ldl/Source/*.c') incs = '. ../Eigen3 third_party/ceres/include' incs += ' ' + env['BF_PNG_INC'] @@ -39,7 +38,7 @@ else: src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' -incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include' +incs += ' ./third_party/ssba ../colamd/Include' env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) diff --git a/extern/libmv/third_party/ssba/CMakeLists.txt b/extern/libmv/third_party/ssba/CMakeLists.txt index f73a6137d6f..72379625396 100644 --- a/extern/libmv/third_party/ssba/CMakeLists.txt +++ b/extern/libmv/third_party/ssba/CMakeLists.txt @@ -42,6 +42,9 @@ set(SRC Math/v3d_linear_utils.h Math/v3d_mathutilities.h Math/v3d_optimization.h + + ../ldl/Source/ldl.c + ../ldl/Include/ldl.h ) if(WIN32) diff --git a/extern/libmv/third_party/ssba/SConscript b/extern/libmv/third_party/ssba/SConscript index 598415d0039..667b40f929b 100644 --- a/extern/libmv/third_party/ssba/SConscript +++ b/extern/libmv/third_party/ssba/SConscript @@ -15,6 +15,7 @@ defs.append('V3DLIB_ENABLE_SUITESPARSE') src = env.Glob('Geometry/*.cpp') src += env.Glob('Math/*.cpp') +src += env.Glob('../ldl/Source/*.c') incs = '. ../ldl/Include ../../../colamd/Include' diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index a5d7763487f..bb10bdd0bae 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -923,8 +923,8 @@ endif() if(WITH_LIBMV) list(APPEND BLENDER_SORTED_LIBS extern_libmv) - list(APPEND BLENDER_SORTED_LIBS extern_ceres) list(APPEND BLENDER_SORTED_LIBS extern_ssba) + list(APPEND BLENDER_SORTED_LIBS extern_ceres) endif() if(WITH_MOD_CLOTH_ELTOPO) -- cgit v1.2.3 From 4c287f1d4dcdef959368de4dca9b1e5d7244b5f7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 20 Feb 2013 12:10:05 +0000 Subject: Fix shadow pass issue with non-progressive render shadow pass with emitting meshes and world MIS. --- intern/cycles/render/light.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index ccc6c5142bd..47e9dd8e7f5 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -360,10 +360,10 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen /* bit of an ugly hack to compensate for emitting triangles influencing * amount of samples we get for this pass */ - if(scene->integrator->progressive && kintegrator->pdf_triangles != 0.0f) - kfilm->pass_shadow_scale = 0.5f; - else - kfilm->pass_shadow_scale = 1.0f; + kfilm->pass_shadow_scale = 1.0f; + + if(kintegrator->pdf_triangles != 0.0f) + kfilm->pass_shadow_scale *= 0.5f; if(num_background_lights < num_lights) kfilm->pass_shadow_scale *= (float)(num_lights - num_background_lights)/(float)num_lights; -- cgit v1.2.3 From e55848179aa7d79b0bbacf89e7f3737a857923cd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Feb 2013 13:03:14 +0000 Subject: Fix for blenderplayer build after recent motrack changes --- source/blenderplayer/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index fb06c5e4477..cd3edc11c46 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -167,6 +167,7 @@ endif() if(WITH_LIBMV) list(APPEND BLENDER_SORTED_LIBS extern_libmv) + list(APPEND BLENDER_SORTED_LIBS extern_ssba) list(APPEND BLENDER_SORTED_LIBS extern_ceres) endif() -- cgit v1.2.3 From d9d1f8e58febe60fdd5974ad46dc299c617f1782 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 20 Feb 2013 13:07:28 +0000 Subject: Raise a bit Header string fixed length, else some translations (e.g. Japanese) have not enough room! --- source/blender/editors/mesh/editmesh_knife.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 98fa9d10ab9..d7dbe3506b1 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -214,7 +214,7 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], static void knife_update_header(bContext *C, KnifeTool_OpData *kcd) { - #define HEADER_LENGTH 190 + #define HEADER_LENGTH 256 char header[HEADER_LENGTH]; BLI_snprintf(header, HEADER_LENGTH, IFACE_("LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, " -- cgit v1.2.3 From f844b79577961544d585750f15f6bc7bc88ab031 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 20 Feb 2013 13:41:29 +0000 Subject: Quick fix: translating header's string with some languages (complex scripts, like Japanese or Hindi) generates a very odd segfault! Have really no time to fix now, will try in a few hours, but safer to do this for now! --- source/blender/editors/space_info/info_stats.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 976769752f9..5a8a77f7350 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -367,9 +367,9 @@ static void stats_string(Scene *scene) mmap_in_use = MEM_get_mapped_memory_in_use(); /* get memory statistics */ - s = memstr + sprintf(memstr, IFACE_(" | Mem:%.2fM"), (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0); + s = memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0); if (mmap_in_use) - sprintf(s, IFACE_(" (%.2fM)"), (double)((mmap_in_use) >> 10) / 1024.0); + sprintf(s, " (%.2fM)", (double)((mmap_in_use) >> 10) / 1024.0); s = stats->infostr; @@ -377,32 +377,32 @@ static void stats_string(Scene *scene) if (scene->obedit) { if (BKE_keyblock_from_object(scene->obedit)) - s += sprintf(s, IFACE_("(Key) ")); + s += sprintf(s, "(Key) "); if (scene->obedit->type == OB_MESH) { - s += sprintf(s, IFACE_("Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d"), + s += sprintf(s, "Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d", stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface, stats->tottri); } else if (scene->obedit->type == OB_ARMATURE) { - s += sprintf(s, IFACE_("Verts:%d/%d | Bones:%d/%d"), stats->totvertsel, stats->totvert, stats->totbonesel, + s += sprintf(s, "Verts:%d/%d | Bones:%d/%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone); } else { - s += sprintf(s, IFACE_("Verts:%d/%d"), stats->totvertsel, stats->totvert); + s += sprintf(s, "Verts:%d/%d", stats->totvertsel, stats->totvert); } strcat(s, memstr); } else if (ob && (ob->mode & OB_MODE_POSE)) { - s += sprintf(s, IFACE_("Bones:%d/%d %s"), + s += sprintf(s, "Bones:%d/%d %s", stats->totbonesel, stats->totbone, memstr); } else if (stats_is_object_dynamic_topology_sculpt(ob)) { - s += sprintf(s, IFACE_("Verts:%d | Tris:%d"), stats->totvert, stats->tottri); + s += sprintf(s, "Verts:%d | Tris:%d", stats->totvert, stats->tottri); } else { - s += sprintf(s, IFACE_("Verts:%d | Faces:%d | Tris:%d | Objects:%d/%d | Lamps:%d/%d%s"), + s += sprintf(s, "Verts:%d | Faces:%d | Tris:%d | Objects:%d/%d | Lamps:%d/%d%s", stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel, stats->totlamp, memstr); } -- cgit v1.2.3 From a8ebc1b2de13c0f473b8cb22036f54dee8e1f393 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Feb 2013 14:22:36 +0000 Subject: edits to document uploading script so the latest release docs can always be found at: http://www.blender.org/documentation/blender_python_api Easier for linking wiki docs. --- doc/python_api/sphinx_doc_gen.py | 4 +++- doc/python_api/sphinx_doc_gen.sh | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 3170a2ef469..09e844adae3 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1483,7 +1483,9 @@ def write_sphinx_conf_py(basepath): def execfile(filepath): global_namespace = {"__file__": filepath, "__name__": "__main__"} - exec(compile(open(filepath).read(), filepath, 'exec'), global_namespace) + file_handle = open(filepath) + exec(compile(file_handle.read(), filepath, 'exec'), global_namespace) + file_handle.close() def write_rst_contents(basepath): diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 92461961920..14919f678be 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -32,8 +32,7 @@ blender_version_char=$(grep BLENDER_VERSION_CHAR $blender_srcdir/source/blender/ blender_version_cycle=$(grep BLENDER_VERSION_CYCLE $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}') blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}') -if [ "$blender_version_cycle" == "release" ] -then +if [ "$blender_version_cycle" == "release" ] ; then BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release" else BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion @@ -109,6 +108,11 @@ if $DO_UPLOAD ; then # better redirect ssh $SSH_USER@emo.blender.org 'echo "Redirecting...Redirecting..." > '$SSH_UPLOAD'/250PythonDoc/index.html' + # redirect for release only so wiki can point here + if [ "$blender_version_cycle" == "release" ] ; then + ssh $SSH_USER@emo.blender.org 'echo "Redirecting...Redirecting..." > '$SSH_UPLOAD'/blender_python_api/index.html' + fi + if $DO_OUT_PDF ; then # rename so local PDF has matching name. rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf -- cgit v1.2.3 From 7175549de618a88b8f08678b7003a2a6565b3370 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 20 Feb 2013 14:53:31 +0000 Subject: Fix DPI not taken into account for header text (e.g. during transform). --- source/blender/editors/screen/area.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8afe07b4689..63232b8c455 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -446,7 +446,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); UI_ThemeColor(TH_TEXT); - BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX); + BLF_draw_default(UI_UNIT_X, 0.4f*UI_UNIT_Y, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX); } else if (at->draw) { at->draw(C, ar); -- cgit v1.2.3 From b9333b304ca78cc7abccfd84222b022e214ada41 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 20 Feb 2013 15:06:13 +0000 Subject: Fix visible seams on normal map bake due to clear colour being black: This is a special case, tangent space normal maps should be cleared to 0.5, 0.5, 1.0. This is good practice but there's no reason why not to automate this (for artists whose bump map fu may be a bit shallow). Thanks to Morten Mikkelsen for reporting. --- source/blender/editors/object/object_bake.c | 25 +++++++++++++++++++++---- source/blender/render/intern/source/bake.c | 11 ++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 322ba99593e..a680230fb32 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -257,11 +257,18 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l return dm; } -static void clear_images(MTFace *mtface, int totface) +typedef enum ClearFlag { + CLEAR_NORMAL = 1 +} ClearFlag; + + +static void clear_images(MTFace *mtface, int totface, ClearFlag flag) { int a; const float vec_alpha[4] = {0.0f, 0.0f, 0.0f, 0.0f}; const float vec_solid[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + const float nor_alpha[4] = {0.5f, 0.5f, 1.0f, 0.0f}; + const float nor_solid[4] = {0.5f, 0.5f, 1.0f, 1.0f}; for (a = 0; a < totface; a++) mtface[a].tpage->id.flag &= ~LIB_DOIT; @@ -272,7 +279,11 @@ static void clear_images(MTFace *mtface, int totface) if ((ima->id.flag & LIB_DOIT) == 0) { ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); - IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid); + if (flag == CLEAR_NORMAL) + IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? nor_alpha : nor_solid); + else + IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid); + ima->id.flag |= LIB_DOIT; BKE_image_release_ibuf(ima, ibuf, NULL); @@ -300,7 +311,10 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op) ob = base->object; me = (Mesh *)ob->data; - clear_images(me->mtface, me->totface); + if (scene->r.bake_mode == RE_BAKE_NORMALS && scene->r.bake_normal_space == R_BAKE_SPACE_TANGENT) + clear_images(me->mtface, me->totface, CLEAR_NORMAL); + else + clear_images(me->mtface, me->totface, 0); } CTX_DATA_END; } @@ -395,7 +409,10 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa DerivedMesh *dm = data->lores_dm; MTFace *mtface = CustomData_get_layer(&dm->faceData, CD_MTFACE); - clear_images(mtface, dm->getNumTessFaces(dm)); + if (bkj->mode == RE_BAKE_NORMALS) + clear_images(mtface, dm->getNumTessFaces(dm), CLEAR_NORMAL); + else + clear_images(mtface, dm->getNumTessFaces(dm), 0); } } diff --git a/source/blender/render/intern/source/bake.c b/source/blender/render/intern/source/bake.c index cb6f9611bfd..7c5d6038e0a 100644 --- a/source/blender/render/intern/source/bake.c +++ b/source/blender/render/intern/source/bake.c @@ -648,6 +648,8 @@ static int get_next_bake_face(BakeShade *bs) ImBuf *ibuf = NULL; const float vec_alpha[4] = {0.0f, 0.0f, 0.0f, 0.0f}; const float vec_solid[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + const float nor_alpha[4] = {0.5f, 0.5f, 1.0f, 0.0f}; + const float nor_solid[4] = {0.5f, 0.5f, 1.0f, 1.0f}; tface = RE_vlakren_get_tface(obr, vlr, obr->bakemtface, NULL, 0); @@ -684,9 +686,12 @@ static int get_next_bake_face(BakeShade *bs) if (ibuf->rect_float) imb_freerectImBuf(ibuf); /* clear image */ - if (R.r.bake_flag & R_BAKE_CLEAR) - IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid); - + if (R.r.bake_flag & R_BAKE_CLEAR) { + if (R.r.bake_mode == RE_BAKE_NORMALS && R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) + IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? nor_alpha : nor_solid); + else + IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid); + } /* might be read by UI to set active image for display */ R.bakebuf = ima; } -- cgit v1.2.3 From f6f0ec6dfc56e201ae5490baecc7c913e9467a6f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Feb 2013 15:34:31 +0000 Subject: increase openmp limit for release so low poly meshes don't use openmp threads (which can be slow) --- source/blender/blenkernel/BKE_DerivedMesh.h | 2 +- source/blender/bmesh/bmesh_class.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 5f504df5628..486834f9540 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -95,7 +95,7 @@ struct BMEditMesh; struct ListBase; struct PBVH; -#define DM_OMP_LIMIT 0 /* setting zero so we can catch bugs in OpenMP/BMesh */ +#define DM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */ /* number of sub-elements each mesh element has (for interpolation) */ #define SUB_ELEMS_VERT 0 diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index e851a642b32..6dc0218da93 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -288,6 +288,6 @@ enum { * but should not error on valid cases */ #define BM_LOOP_RADIAL_MAX 10000 #define BM_NGON_MAX 100000 -#define BM_OMP_LIMIT 0 /* setting zero so we can catch bugs in OpenMP/BMesh */ +#define BM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */ #endif /* __BMESH_CLASS_H__ */ -- cgit v1.2.3 From 2605dd231f38cd07fb8029c74423528d42d23807 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 20 Feb 2013 16:05:29 +0000 Subject: Getting ready for the 2.66 release! - Version bump to 2.66 - Splash image by Lucas Falcao, selected by Jonathan Williamson, Andrew Price and Bart Veldhuizen. --- release/datafiles/splash.png | Bin 330539 -> 128911 bytes source/blender/blenkernel/BKE_blender.h | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png index 41284eff9c1..7affcab8a82 100644 Binary files a/release/datafiles/splash.png and b/release/datafiles/splash.png differ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 871e9918f6f..370a8c7c140 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -41,8 +41,8 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ -#define BLENDER_VERSION 265 -#define BLENDER_SUBVERSION 10 +#define BLENDER_VERSION 266 +#define BLENDER_SUBVERSION 0 /* 262 was the last editmesh release but it has compatibility code for bmesh data */ #define BLENDER_MINVERSION 262 @@ -50,9 +50,9 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR a +#define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE beta +#define BLENDER_VERSION_CYCLE release extern char versionstr[]; /* from blender.c */ -- cgit v1.2.3 From d2efd7233599b5a2c660166be113c93a684aa071 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:07:01 +0000 Subject: Blender 2.67 release cycles begin: * BCon1, alpha. New features, extensive breakage...the usual thing. :) --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 370a8c7c140..d66909449e4 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -52,7 +52,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE release +#define BLENDER_VERSION_CYCLE alpha extern char versionstr[]; /* from blender.c */ -- cgit v1.2.3 From 3df2b93c6d69601c75bc95ac5358957822cf4db9 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:08:13 +0000 Subject: Cycles Addon: * Code cleanup --- intern/cycles/blender/addon/__init__.py | 2 +- intern/cycles/blender/addon/ui.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index 16cfdca8977..526c5658b93 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "Cycles Render Engine", "author": "", - "blender": (2, 60, 5), + "blender": (2, 66, 0), "location": "Info header, render engine menu", "description": "Cycles Render Engine integration", "warning": "", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 0debb549b30..9d2555d3003 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1093,13 +1093,9 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel): layout.active = rd.use_simplify - split = layout.split() - - col = split.column() - col.prop(rd, "simplify_subdivision", text="Subdivision") - - col = split.column() - col.prop(rd, "simplify_child_particles", text="Child Particles") + row = layout.row() + row.prop(rd, "simplify_subdivision", text="Subdivision") + row.prop(rd, "simplify_child_particles", text="Child Particles") def draw_device(self, context): -- cgit v1.2.3 From a239700f439275df28136b846be032da70e18d70 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:10:14 +0000 Subject: Cycles: * Code cleanup, remove deprecated support_advanced_shading() functions. Left over from r43734. --- intern/cycles/device/device_cpu.cpp | 5 ----- intern/cycles/device/device_network.cpp | 7 ++----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index c2ba91faf69..47f3273fdfa 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -67,11 +67,6 @@ public: task_pool.stop(); } - bool support_advanced_shading() - { - return true; - } - void mem_alloc(device_memory& mem, MemoryType type) { mem.device_pointer = mem.data_pointer; diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index f5545c3dfdf..201f04bc5d8 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -222,11 +222,6 @@ public: RPCSend snd(socket, "task_cancel"); snd.write(); } - - bool support_advanced_shading() - { - return true; /* todo: get this info from device */ - } }; Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address) @@ -242,6 +237,8 @@ void device_network_info(vector& devices) info.description = "Network Device"; info.id = "NETWORK"; info.num = 0; + info.advanced_shading = true; /* todo: get this info from device */ + info.pack_images = false; devices.push_back(info); } -- cgit v1.2.3 From 9a86abd4406fa63ac44ff8e905a1b714d69a2206 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:10:27 +0000 Subject: code cleanup: remove unused runtime var - World.fastcol --- source/blender/makesdna/DNA_world_types.h | 3 --- source/blender/render/intern/source/convertblender.c | 10 +--------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 8a14564f8a4..02dc81ccd4d 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -59,10 +59,7 @@ typedef struct World { float horr, horg, horb; float zenr, zeng, zenb; float ambr, ambg, ambb; - float pad2; - unsigned int fastcol; - /** * Exposure= mult factor. unused now, but maybe back later. Kept in to be upward compat. * New is exp/range control. linfac & logfac are constants... don't belong in diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b161bb7d193..00a4da2e9c4 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4015,18 +4015,10 @@ static void set_renderlayer_lightgroups(Render *re, Scene *sce) void init_render_world(Render *re) { int a; - char *cp; if (re->scene && re->scene->world) { re->wrld= *(re->scene->world); - - cp= (char *)&re->wrld.fastcol; - - cp[0]= 255.0f*re->wrld.horr; - cp[1]= 255.0f*re->wrld.horg; - cp[2]= 255.0f*re->wrld.horb; - cp[3]= 1; - + copy_v3_v3(re->grvec, re->viewmat[2]); normalize_v3(re->grvec); copy_m3_m4(re->imat, re->viewinv); -- cgit v1.2.3 From 13670e1e06f969b39589607e117133ea81c83096 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:11:38 +0000 Subject: code cleanup: pass mval to ED_view3d_cursor3d_position() rather then event x/y --- source/blender/editors/include/ED_view3d.h | 2 +- source/blender/editors/object/object_add.c | 4 ++-- source/blender/editors/space_view3d/view3d_edit.c | 8 ++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index ac2c47216a6..46f4515e0ca 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -85,7 +85,7 @@ typedef struct ViewDepths { } ViewDepths; float *give_cursor(struct Scene *scene, struct View3D *v3d); -void ED_view3d_cursor3d_position(struct bContext *C, float *fp, int mx, int my); +void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]); void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist); void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index ffaa6f61cae..ab9cd55f99b 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -815,7 +815,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) if (0 == RNA_struct_property_is_set(op->ptr, "location")) { wmEvent *event = CTX_wm_window(C)->eventstate; ED_object_location_from_view(C, loc); - ED_view3d_cursor3d_position(C, loc, event->x, event->y); + ED_view3d_cursor3d_position(C, loc, event->mval); RNA_float_set_array(op->ptr, "location", loc); } } @@ -2040,7 +2040,7 @@ static int add_named_exec(bContext *C, wmOperator *op) if (event) { ED_object_location_from_view(C, basen->object->loc); - ED_view3d_cursor3d_position(C, basen->object->loc, event->x, event->y); + ED_view3d_cursor3d_position(C, basen->object->loc, event->mval); } ED_base_object_activate(C, basen); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8c0a2dc4b65..30ed7a57f9d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3858,18 +3858,14 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* cursor position in vec, result in vec, mval in region coords */ /* note: cannot use event->mval here (called by object_add() */ -void ED_view3d_cursor3d_position(bContext *C, float *fp, int mx, int my) +void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) { Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); float mval_fl[2]; - int mval[2]; int flip; - - mval[0] = mx - ar->winrct.xmin; - mval[1] = my - ar->winrct.ymin; flip = initgrabz(rv3d, fp[0], fp[1], fp[2]); @@ -3917,7 +3913,7 @@ static int view3d_cursor3d_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent * View3D *v3d = CTX_wm_view3d(C); float *fp = give_cursor(scene, v3d); - ED_view3d_cursor3d_position(C, fp, event->x, event->y); + ED_view3d_cursor3d_position(C, fp, event->mval); if (v3d && v3d->localvd) WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); -- cgit v1.2.3 From 6869ea8e7ee409d86528c656c30eed1a38835e59 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:12:08 +0000 Subject: code cleanup: no need to use list(range()), just use range() --- release/scripts/startup/bl_operators/rigidbody.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 652ad4bf784..420e7661789 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -109,7 +109,8 @@ class BakeToKeyframes(Operator): objects = [] scene = context.scene frame_orig = scene.frame_current - frames = list(range(self.frame_start, self.frame_end + 1, self.step)) + frames_step = range(self.frame_start, self.frame_end + 1, self.step) + frames_full = range(self.frame_start, self.frame_end + 1) # filter objects selection for obj in context.selected_objects: @@ -121,16 +122,16 @@ class BakeToKeyframes(Operator): if objects: # store transformation data # need to start at scene start frame so simulation is run from the beginning - for f in list(range(scene.frame_start, self.frame_end + 1)): + for f in frames_full: scene.frame_set(f) - if f in frames: + if f in frames_step: mat = {} for i, obj in enumerate(objects): mat[i] = obj.matrix_world.copy() bake.append(mat) # apply transformations as keyframes - for i, f in enumerate(frames): + for i, f in enumerate(frames_step): scene.frame_set(f) obj_prev = objects[0] for j, obj in enumerate(objects): -- cgit v1.2.3 From ac6e44887e596dfa448b341eec5777b777f49592 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:13:25 +0000 Subject: code cleanup: remove references to old bevel code (which has been removed for a while) --- source/blender/bmesh/intern/bmesh_opdefines.c | 12 -- source/blender/editors/mesh/editmesh_tools.c | 179 -------------------------- 2 files changed, 191 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index c5eeceb43a3..7e3ee9d249e 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1410,18 +1410,6 @@ static BMOpDefine bmo_bevel_def = { {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ {{'\0'}}, }, -/* old bevel*/ -// {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */ -// {"face_spans", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */ -// {"face_holes", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */ -// {"use_lengths", BMO_OP_SLOT_BOOL}, /* grab edge lengths from a PROP_FLT customdata layer */ -// {"use_even", BMO_OP_SLOT_BOOL}, /* corner vert placement: use shell/angle calculations */ -// {"use_dist", BMO_OP_SLOT_BOOL}, /* corner vert placement: evaluate percent as a distance, -// * modifier uses this. We could do this as another float setting */ -// {"lengthlayer", BMO_OP_SLOT_INT}, /* which PROP_FLT layer to us */ -// {"percent", BMO_OP_SLOT_FLT}, /* percentage to expand beveled edge */ -// {{'\0'}}, -// }, bmo_bevel_exec, BMO_OP_FLAG_UNTAN_MULTIRES diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 3dd9adc264b..ee1d19de7b0 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4653,15 +4653,9 @@ void MESH_OT_noise(wmOperatorType *ot) RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f); } -#define NEW_BEVEL 1 - typedef struct { BMEditMesh *em; BMBackup mesh_backup; -#ifndef NEW_BEVEL - float *weights; - int li; -#endif int mcenter[2]; float initial_length; float pixel_size; /* use when mouse input is interpreted as spatial distance */ @@ -4674,105 +4668,34 @@ typedef struct { static void edbm_bevel_update_header(wmOperator *op, bContext *C) { -#ifdef NEW_BEVEL const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RMB), Offset: %s, Segments: %d"); -#else - const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RMB), Factor: %s, Use Dist (D): %s, " - "Use Even (E): %s"); - BevelData *opdata = op->customdata; -#endif char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); if (sa) { -#ifdef NEW_BEVEL char offset_str[NUM_STR_REP_LEN]; BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset")); BLI_snprintf(msg, HEADER_LENGTH, str, offset_str, RNA_int_get(op->ptr, "segments") ); -#else - char factor_str[NUM_STR_REP_LEN]; - if (hasNumInput(&opdata->num_input)) - outputNumInput(&opdata->num_input, factor_str); - else - BLI_snprintf(factor_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "percent")); - BLI_snprintf(msg, HEADER_LENGTH, str, - factor_str, - RNA_boolean_get(op->ptr, "use_dist") ? IFACE_("On") : IFACE_("Off"), - RNA_boolean_get(op->ptr, "use_even") ? IFACE_("On") : IFACE_("Off") - ); -#endif ED_area_headerprint(sa, msg); } } -#ifndef NEW_BEVEL -static void edbm_bevel_recalc_weights(wmOperator *op) -{ - float df, s, ftot; - int i; - int recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */ - BevelData *opdata = op->customdata; - - if (opdata->weights) { - /* TODO should change to free only when new recursion is greater than old */ - MEM_freeN(opdata->weights); - } - opdata->weights = MEM_mallocN(sizeof(float) * recursion, "bevel weights"); - - /* ugh, stupid math depends somewhat on angles!*/ - /* dfac = 1.0/(float)(recursion + 1); */ /* UNUSED */ - df = 1.0; - for (i = 0, ftot = 0.0f; i < recursion; i++) { - s = powf(df, 1.25f); - - opdata->weights[i] = s; - ftot += s; - - df *= 2.0f; - } - - mul_vn_fl(opdata->weights, recursion, 1.0f / (float)ftot); -} -#endif - static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); -#ifdef NEW_BEVEL - BevelData *opdata; -#else - BMIter iter; - BMEdge *eed; BevelData *opdata; - int li; -#endif if (em == NULL) { return 0; } op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator"); - -#ifndef NEW_BEVEL - BM_data_layer_add(em->bm, &em->bm->edata, CD_PROP_FLT); - li = CustomData_number_of_layers(&em->bm->edata, CD_PROP_FLT) - 1; - - BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - float d = len_v3v3(eed->v1->co, eed->v2->co); - float *dv = CustomData_bmesh_get_n(&em->bm->edata, eed->head.data, CD_PROP_FLT, li); - - *dv = d; - } - - opdata->li = li; - opdata->weights = NULL; -#endif opdata->em = em; opdata->is_modal = is_modal; @@ -4784,9 +4707,6 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal) /* avoid the cost of allocating a bm copy */ if (is_modal) opdata->mesh_backup = EDBM_redo_state_store(em); -#ifndef NEW_BEVEL - edbm_bevel_recalc_weights(op); -#endif return 1; } @@ -4796,7 +4716,6 @@ static int edbm_bevel_calc(wmOperator *op) BevelData *opdata = op->customdata; BMEditMesh *em = opdata->em; BMOperator bmop; -#ifdef NEW_BEVEL float offset = RNA_float_get(op->ptr, "offset"); int segments = RNA_int_get(op->ptr, "segments"); int vertex_only = RNA_boolean_get(op->ptr, "vertex_only"); @@ -4825,35 +4744,6 @@ static int edbm_bevel_calc(wmOperator *op) /* no need to de-select existing geometry */ if (!EDBM_op_finish(em, &bmop, op, TRUE)) return 0; -#else - int i; - - float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */; - int recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */ - const int use_even = RNA_boolean_get(op->ptr, "use_even"); - const int use_dist = RNA_boolean_get(op->ptr, "use_dist"); - - /* revert to original mesh */ - if (opdata->is_modal) { - EDBM_redo_state_restore(opdata->mesh_backup, em, FALSE); - } - - for (i = 0; i < recursion; i++) { - float fac = opdata->weights[recursion - i - 1] * factor; - - - if (!EDBM_op_init(em, &bmop, op, - "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b", - BM_ELEM_SELECT, fac, opdata->li, TRUE, use_even, use_dist)) - { - return 0; - } - - BMO_op_exec(em->bm, &bmop); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) - return 0; - } -#endif EDBM_mesh_normals_update(opdata->em); @@ -4871,12 +4761,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op) if (sa) { ED_area_headerprint(sa, NULL); } -#ifndef NEW_BEVEL - BM_data_layer_free_n(opdata->em->bm, &opdata->em->bm->edata, CD_PROP_FLT, opdata->li); - if (opdata->weights) - MEM_freeN(opdata->weights); -#endif if (opdata->is_modal) { EDBM_redo_state_free(&opdata->mesh_backup, NULL, FALSE); } @@ -4957,11 +4842,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event) static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event) { BevelData *opdata = op->customdata; -#ifdef NEW_BEVEL int use_dist = TRUE; -#else - int use_dist = RNA_boolean_get(op->ptr, "use_dist"); -#endif float mdiff[2]; float factor; @@ -4979,11 +4860,7 @@ static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event) /* Fake shift-transform... */ if (event->shift) { if (opdata->shift_factor < 0.0f) { -#ifdef NEW_BEVEL opdata->shift_factor = RNA_float_get(op->ptr, "offset"); -#else - opdata->shift_factor = RNA_float_get(op->ptr, "factor"); -#endif } factor = (factor - opdata->shift_factor) * 0.1f + opdata->shift_factor; } @@ -5008,7 +4885,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { /* Try to handle numeric inputs... */ -#ifdef NEW_BEVEL if (handleNumInput(&opdata->num_input, event)) { float value = RNA_float_get(op->ptr, "offset"); @@ -5018,18 +4894,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) edbm_bevel_update_header(op, C); return OPERATOR_RUNNING_MODAL; } -#else - if (handleNumInput(&opdata->num_input, event)) { - float factor = RNA_float_get(op->ptr, "percent"); - applyNumInput(&opdata->num_input, &factor); - CLAMP(factor, 0.0f, 1.0f); - RNA_float_set(op->ptr, "percent", factor); - - edbm_bevel_calc(C, op); - edbm_bevel_update_header(op, C); - return OPERATOR_RUNNING_MODAL; - } -#endif } switch (event->type) { @@ -5041,11 +4905,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) case MOUSEMOVE: if (!hasNumInput(&opdata->num_input)) { const float factor = edbm_bevel_mval_factor(op, event); -#ifdef NEW_BEVEL RNA_float_set(op->ptr, "offset", factor); -#else - RNA_float_set(op->ptr, "percent", factor); -#endif edbm_bevel_calc(op); edbm_bevel_update_header(op, C); @@ -5059,7 +4919,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) edbm_bevel_exit(C, op); return OPERATOR_FINISHED; -#ifdef NEW_BEVEL case WHEELUPMOUSE: /* change number of segments */ case PAGEUPKEY: if (event->val == KM_RELEASE) @@ -5081,33 +4940,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) edbm_bevel_calc(op); edbm_bevel_update_header(op, C); break; - -#else - case EKEY: - if (event->val == KM_PRESS) { - int use_even = RNA_boolean_get(op->ptr, "use_even"); - RNA_boolean_set(op->ptr, "use_even", !use_even); - - edbm_bevel_calc(C, op); - edbm_bevel_update_header(op, C); - } - break; - - case DKEY: - if (event->val == KM_PRESS) { - int use_dist = RNA_boolean_get(op->ptr, "use_dist"); - RNA_boolean_set(op->ptr, "use_dist", !use_dist); - - { - const float factor = edbm_bevel_mval_factor(op, event); - RNA_float_set(op->ptr, "percent", factor); - } - - edbm_bevel_calc(C, op); - edbm_bevel_update_header(op, C); - } - break; -#endif } return OPERATOR_RUNNING_MODAL; @@ -5130,20 +4962,9 @@ void MESH_OT_bevel(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING; -#ifdef NEW_BEVEL RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f); RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8); RNA_def_boolean(ot->srna, "vertex_only", FALSE, "Vertex only", "Bevel only vertices"); -#else - /* take note, used as a factor _and_ a distance depending on 'use_dist' */ - RNA_def_float(ot->srna, "percent", 0.0f, -FLT_MAX, FLT_MAX, "Percentage", "", 0.0f, 1.0f); - /* XXX, disabled for 2.63 release, needs to work much better without overlap before we can give to users. */ -/* RNA_def_int(ot->srna, "recursion", 1, 1, 50, "Recursion Level", "Recursion Level", 1, 8); */ - - RNA_def_boolean(ot->srna, "use_even", FALSE, "Even", "Calculate evenly spaced bevel"); - RNA_def_boolean(ot->srna, "use_dist", FALSE, "Distance", "Interpret the percent in blender units"); -#endif - } static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) -- cgit v1.2.3 From dc90ce5b6da1ad3a52dd31edcf7a28428b8994c8 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:14:07 +0000 Subject: Cycles GPU rendering: * Deprecate computing capability 1.3 (sm_13) This commit disables auto build of sm_13 CUDA platform, which means that starting with Blender 2.67, we don't support sm_13 devices anymore. It has become difficult to support that and it was already feature incomplete (no render-passes, AO, Multi Closure etc). It's still possible to manually enable sm_13 for own tests, but building might break in the future. --- CMakeLists.txt | 2 +- build_files/buildbot/config/user-config-cuda-glibc211-i686.py | 2 +- build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py | 2 +- build_files/scons/config/darwin-config.py | 2 +- build_files/scons/config/linux-config.py | 2 +- build_files/scons/config/win32-mingw-config.py | 2 +- build_files/scons/config/win32-vc-config.py | 2 +- build_files/scons/config/win64-mingw-config.py | 2 +- build_files/scons/config/win64-vc-config.py | 2 +- intern/cycles/device/device_cuda.cpp | 8 ++++---- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d208d730e1d..d6a0fa4e016 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -250,7 +250,7 @@ option(WITH_CYCLES "Enable cycles Render Engine" ON) option(WITH_CYCLES_TEST "Build cycles test application" OFF) option(WITH_CYCLES_OSL "Build Cycles with OSL support" OFF) option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF) -set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for") +set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for") mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH) unset(PLATFORM_DEFAULT) diff --git a/build_files/buildbot/config/user-config-cuda-glibc211-i686.py b/build_files/buildbot/config/user-config-cuda-glibc211-i686.py index e72218e6615..0e56c4326f9 100644 --- a/build_files/buildbot/config/user-config-cuda-glibc211-i686.py +++ b/build_files/buildbot/config/user-config-cuda-glibc211-i686.py @@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686' BF_INSTALLDIR = '../blender-install/linux-glibc211-i686' BF_NUMJOBS = 1 -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] diff --git a/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py b/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py index 10738a11eaa..59725522e18 100644 --- a/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py +++ b/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py @@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-x86_64' BF_INSTALLDIR = '../blender-install/linux-glibc211-x86_64' BF_NUMJOBS = 1 -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 5c0e13a9443..267505bc449 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -315,7 +315,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' WITH_BF_CYCLES_CUDA_BINARIES = False BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc' -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] #Ray trace optimization if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'i386': diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index 068273e35ef..bef34727014 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -209,7 +209,7 @@ WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST WITH_BF_CYCLES_CUDA_BINARIES = False BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc' -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] WITH_BF_OPENMP = True diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index 391421609d2..b5bcbc92665 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -174,7 +174,7 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse'] #CUDA WITH_BF_CYCLES_CUDA_BINARIES = False #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] ## CC = 'gcc' diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 95352bda8a7..8d17c777b0f 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -189,7 +189,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' #CUDA WITH_BF_CYCLES_CUDA_BINARIES = False #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py index d00e7a3ffa7..0a604b0f861 100644 --- a/build_files/scons/config/win64-mingw-config.py +++ b/build_files/scons/config/win64-mingw-config.py @@ -146,7 +146,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' WITH_BF_CYCLES = True WITH_BF_CYCLES_CUDA_BINARIES = False BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] WITH_BF_OIIO = True BF_OIIO = LIBDIR + '/openimageio' diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 7597dd85beb..4e763343fe6 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -185,7 +185,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' #CUDA WITH_BF_CYCLES_CUDA_BINARIES = False #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 77082006169..173ac3d57df 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -209,8 +209,8 @@ public: int major, minor; cuDeviceComputeCapability(&major, &minor, cuDevId); - if(major <= 1 && minor <= 2) { - cuda_error_message(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor)); + if(major <= 1 && minor <= 3) { + cuda_error_message(string_printf("CUDA device supported only with compute capability 2.0 or up, found %d.%d.", major, minor)); return false; } } @@ -242,8 +242,8 @@ public: #ifdef _WIN32 if(cuHavePrecompiledKernels()) { - if(major <= 1 && minor <= 2) - cuda_error_message(string_printf("CUDA device requires compute capability 1.3 or up, found %d.%d. Your GPU is not supported.", major, minor)); + if(major <= 1 && minor <= 3) + cuda_error_message(string_printf("CUDA device requires compute capability 2.0 or up, found %d.%d. Your GPU is not supported.", major, minor)); else cuda_error_message(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor)); return ""; -- cgit v1.2.3 From 8dca5010453f4a5709af148bc7ebf144d52d058b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:14:27 +0000 Subject: code cleanup: remove ctrl option from FONT_OT_line_break (which in fact wasn't mapped to ctrl), it would add in a non printable character '1' / ascii-SOH, traced back to original commit and theres no comments about this or mentions as to what its supposed to do). --- source/blender/editors/curve/editfont.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 257dfca051f..af6b90a9958 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1070,21 +1070,13 @@ void FONT_OT_change_character(wmOperatorType *ot) /******************* line break operator ********************/ -static int line_break_exec(bContext *C, wmOperator *op) +static int line_break_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Curve *cu = obedit->data; - EditFont *ef = cu->editfont; - const int ctrl = RNA_boolean_get(op->ptr, "ctrl"); - if (ctrl) { - insert_into_textbuf(obedit, 1); - if (ef->textbuf[cu->pos] != '\n') - insert_into_textbuf(obedit, '\n'); - } - else - insert_into_textbuf(obedit, '\n'); + insert_into_textbuf(obedit, '\n'); cu->selstart = cu->selend = 0; @@ -1106,9 +1098,6 @@ void FONT_OT_line_break(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ - RNA_def_boolean(ot->srna, "ctrl", 0, "Ctrl", ""); // XXX what is this? } /******************* delete operator **********************/ -- cgit v1.2.3 From 60c1a7898a51608b62460c671663aed525791fe3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:15:19 +0000 Subject: use radians for BLF_rotation --- source/blender/blenfont/intern/blf.c | 4 ++-- source/blender/blenfont/intern/blf_internal_types.h | 2 +- source/blender/editors/interface/view2d.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 16756769675..c622f8c35a2 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -516,8 +516,8 @@ static void blf_draw__start(FontBLF *font, GLint *mode, GLint *param) if (font->flags & BLF_ASPECT) glScalef(font->aspect[0], font->aspect[1], font->aspect[2]); - if (font->flags & BLF_ROTATION) - glRotatef(font->angle, 0.0f, 0.0f, 1.0f); + if (font->flags & BLF_ROTATION) /* radians -> degrees */ + glRotatef(font->angle * (float)(180.0 / M_PI), 0.0f, 0.0f, 1.0f); if (font->shadow || font->blur) glGetFloatv(GL_CURRENT_COLOR, font->orig_col); diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 1acc3dad4cf..de6e70e4461 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -166,7 +166,7 @@ typedef struct FontBLF { /* initial position for draw the text. */ float pos[3]; - /* angle in degrees. */ + /* angle in radians. */ float angle; /* blur: 3 or 5 large kernel */ diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index ae89b25d5ea..4afcec73a8f 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1805,7 +1805,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v /* draw vertical steps */ if (dfac > 0.0f) { - BLF_rotation_default(90.0f); + BLF_rotation_default(M_PI / 2); BLF_enable_default(BLF_ROTATION); for (; fac < vert.ymax - 10; fac += dfac, val += grid->dy) { -- cgit v1.2.3 From 25fe5c20aa2f95a23a616c9f7fcbe61ef040684b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:15:55 +0000 Subject: code cleanup: rename ScanFillVert.h --> edge_tot, SF_VERT_UNKNOWN --> SF_VERT_AVAILABLE --- source/blender/blenlib/BLI_scanfill.h | 3 +- source/blender/blenlib/intern/scanfill.c | 94 ++++++++++++++++---------------- 2 files changed, 50 insertions(+), 47 deletions(-) diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 7830c0675b4..ce2c6a4252f 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -72,7 +72,8 @@ typedef struct ScanFillVert { float xy[2]; /* 2D copy of vertex location (using dominant axis) */ unsigned int keyindex; /* original index #, for restoring key information */ short poly_nr; - unsigned char f, h; + unsigned char edge_tot; /* number of edges using this vertex */ + unsigned char f; } ScanFillVert; typedef struct ScanFillEdge { diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 298e37137ce..4d42d71f490 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -95,7 +95,7 @@ typedef struct ScanFillVertLink { #define SF_EPSILON 0.00003f -#define SF_VERT_UNKNOWN 1 /* TODO, what is this for exactly? - need to document it! */ +#define SF_VERT_AVAILABLE 1 /* available - in an edge */ #define SF_VERT_ZERO_LEN 255 /* Optionally set ScanFillEdge f to this to mark original boundary edges. @@ -424,7 +424,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) ScanFillEdge *eed, *ed1; for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) { - if (eve->h == 1) { + if (eve->edge_tot == 1) { /* find the edge which has vertex eve, * note: we _know_ this will crash if 'ed1' becomes NULL * but this will never happen. */ @@ -444,14 +444,14 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) { if (compare_v3v3(eve->co, eed->v1->co, SF_EPSILON)) { ed1->v2 = eed->v1; - eed->v1->h++; - eve->h = 0; + eed->v1->edge_tot++; + eve->edge_tot = 0; break; } else if (compare_v3v3(eve->co, eed->v2->co, SF_EPSILON)) { ed1->v2 = eed->v2; - eed->v2->h++; - eve->h = 0; + eed->v2->edge_tot++; + eve->edge_tot = 0; break; } else { @@ -465,7 +465,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) ed1->f = 0; ed1->poly_nr = eed->poly_nr; eed->v1 = eve; - eve->h = 3; + eve->edge_tot = 3; break; } } @@ -646,14 +646,14 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) ed1 = sc->edge_first; while (ed1) { /* set connectflags */ nexted = ed1->next; - if (ed1->v1->h == 1 || ed1->v2->h == 1) { + if (ed1->v1->edge_tot == 1 || ed1->v2->edge_tot == 1) { BLI_remlink((ListBase *)&(sc->edge_first), ed1); BLI_addtail(&sf_ctx->filledgebase, ed1); - if (ed1->v1->h > 1) ed1->v1->h--; - if (ed1->v2->h > 1) ed1->v2->h--; + if (ed1->v1->edge_tot > 1) ed1->v1->edge_tot--; + if (ed1->v2->edge_tot > 1) ed1->v2->edge_tot--; } else { - ed1->v2->f = SF_VERT_UNKNOWN; + ed1->v2->f = SF_VERT_AVAILABLE; } ed1 = nexted; @@ -674,8 +674,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) /* printf("just 1 edge to vert\n"); */ BLI_addtail(&sf_ctx->filledgebase, ed1); ed1->v2->f = 0; - ed1->v1->h--; - ed1->v2->h--; + ed1->v1->edge_tot--; + ed1->v2->edge_tot--; } else { /* test rest of vertices */ @@ -742,10 +742,10 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) ed3 = BLI_scanfill_edge_add(sf_ctx, v2, best_sc->vert); BLI_remlink(&sf_ctx->filledgebase, ed3); BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3); - ed3->v2->f = SF_VERT_UNKNOWN; + ed3->v2->f = SF_VERT_AVAILABLE; ed3->f = SF_EDGE_UNKNOWN; - ed3->v1->h++; - ed3->v2->h++; + ed3->v1->edge_tot++; + ed3->v2->edge_tot++; } else { /* new triangle */ @@ -755,31 +755,31 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) BLI_remlink((ListBase *)&(sc->edge_first), ed1); BLI_addtail(&sf_ctx->filledgebase, ed1); ed1->v2->f = 0; - ed1->v1->h--; - ed1->v2->h--; + ed1->v1->edge_tot--; + ed1->v2->edge_tot--; /* ed2 can be removed when it's a boundary edge */ if ((ed2->f == 0 && twoconnected) || (ed2->f == SF_EDGE_BOUNDARY)) { BLI_remlink((ListBase *)&(sc->edge_first), ed2); BLI_addtail(&sf_ctx->filledgebase, ed2); ed2->v2->f = 0; - ed2->v1->h--; - ed2->v2->h--; + ed2->v1->edge_tot--; + ed2->v2->edge_tot--; } /* new edge */ ed3 = BLI_scanfill_edge_add(sf_ctx, v1, v3); BLI_remlink(&sf_ctx->filledgebase, ed3); ed3->f = SF_EDGE_UNKNOWN; - ed3->v1->h++; - ed3->v2->h++; + ed3->v1->edge_tot++; + ed3->v2->edge_tot++; /* printf("add new edge %x %x\n", v1, v3); */ sc1 = addedgetoscanlist(sf_ctx, ed3, verts); if (sc1) { /* ed3 already exists: remove if a boundary */ /* printf("Edge exists\n"); */ - ed3->v1->h--; - ed3->v2->h--; + ed3->v1->edge_tot--; + ed3->v2->edge_tot--; ed3 = sc1->edge_first; while (ed3) { @@ -787,8 +787,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) { BLI_remlink((ListBase *)&(sc1->edge_first), ed3); BLI_addtail(&sf_ctx->filledgebase, ed3); - ed3->v1->h--; - ed3->v2->h--; + ed3->v1->edge_tot--; + ed3->v2->edge_tot--; } break; } @@ -797,19 +797,21 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) } } } + /* test for loose edges */ ed1 = sc->edge_first; while (ed1) { nexted = ed1->next; - if (ed1->v1->h < 2 || ed1->v2->h < 2) { + if (ed1->v1->edge_tot < 2 || ed1->v2->edge_tot < 2) { BLI_remlink((ListBase *)&(sc->edge_first), ed1); BLI_addtail(&sf_ctx->filledgebase, ed1); - if (ed1->v1->h > 1) ed1->v1->h--; - if (ed1->v2->h > 1) ed1->v2->h--; + if (ed1->v1->edge_tot > 1) ed1->v1->edge_tot--; + if (ed1->v2->edge_tot > 1) ed1->v2->edge_tot--; } ed1 = nexted; } + /* done with loose edges */ } sc++; @@ -861,7 +863,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no while (eve) { eve->f = 0; eve->poly_nr = 0; - eve->h = 0; + eve->edge_tot = 0; eve = eve->next; a += 1; } @@ -899,15 +901,15 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no eed = sf_ctx->filledgebase.first; while (eed) { eed->poly_nr = 0; - eed->v1->f = SF_VERT_UNKNOWN; - eed->v2->f = SF_VERT_UNKNOWN; + eed->v1->f = SF_VERT_AVAILABLE; + eed->v2->f = SF_VERT_AVAILABLE; eed = eed->next; } eve = sf_ctx->fillvertbase.first; while (eve) { - if (eve->f & SF_VERT_UNKNOWN) { + if (eve->f & SF_VERT_AVAILABLE) { ok = 1; break; } @@ -1017,8 +1019,8 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no /* STEP 2: remove loose edges and strings of edges */ eed = sf_ctx->filledgebase.first; while (eed) { - if (eed->v1->h++ > 250) break; - if (eed->v2->h++ > 250) break; + if (eed->v1->edge_tot++ > 250) break; + if (eed->v2->edge_tot++ > 250) break; eed = eed->next; } if (eed) { @@ -1039,14 +1041,14 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no while (eed) { if (toggle & 1) nexted = eed->next; else nexted = eed->prev; - if (eed->v1->h == 1) { - eed->v2->h--; + if (eed->v1->edge_tot == 1) { + eed->v2->edge_tot--; BLI_remlink(&sf_ctx->fillvertbase, eed->v1); BLI_remlink(&sf_ctx->filledgebase, eed); ok = 1; } - else if (eed->v2->h == 1) { - eed->v1->h--; + else if (eed->v2->edge_tot == 1) { + eed->v1->edge_tot--; BLI_remlink(&sf_ctx->fillvertbase, eed->v2); BLI_remlink(&sf_ctx->filledgebase, eed); ok = 1; @@ -1061,13 +1063,13 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no /* CURRENT STATUS: - * - eve->f :1 = available in edges - * - eve->xs :polynumber - * - eve->h :amount of edges connected to vertex - * - eve->tmp.v :store! original vertex number + * - eve->f :1 = available in edges + * - eve->poly_nr :polynumber + * - eve->edge_tot :amount of edges connected to vertex + * - eve->tmp.v :store! original vertex number * - * - eed->f :1 = boundary edge (optionally set by caller) - * - eed->poly_nr :poly number + * - eed->f :1 = boundary edge (optionally set by caller) + * - eed->poly_nr :poly number */ @@ -1096,7 +1098,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no min_xy_p[1] = (min_xy_p[1]) < (eve->xy[1]) ? (min_xy_p[1]) : (eve->xy[1]); max_xy_p[0] = (max_xy_p[0]) > (eve->xy[0]) ? (max_xy_p[0]) : (eve->xy[0]); max_xy_p[1] = (max_xy_p[1]) > (eve->xy[1]) ? (max_xy_p[1]) : (eve->xy[1]); - if (eve->h > 2) pflist[eve->poly_nr - 1].f = 1; + if (eve->edge_tot > 2) pflist[eve->poly_nr - 1].f = 1; eve = eve->next; } -- cgit v1.2.3 From d4c97029efe314a024b5add89c8bd2b6a7f5f4c4 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:16:32 +0000 Subject: Cycles GPU Rendering: * Make Cycles aware of sm_35 (Tesla K20, GeForce GTX TITAN). The CUDA Toolkit 5.0 is needed for that and this is not officially used yet, but people with access to such cards can start testing. (just build sm_35 kernels). --- intern/cycles/util/util_cuda.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/intern/cycles/util/util_cuda.h b/intern/cycles/util/util_cuda.h index 69cf025de77..55feb3f84cb 100644 --- a/intern/cycles/util/util_cuda.h +++ b/intern/cycles/util/util_cuda.h @@ -206,7 +206,8 @@ typedef enum CUjit_target_enum CU_TARGET_COMPUTE_13, CU_TARGET_COMPUTE_20, CU_TARGET_COMPUTE_21, - CU_TARGET_COMPUTE_30 + CU_TARGET_COMPUTE_30, + CU_TARGET_COMPUTE_35 } CUjit_target; typedef enum CUjit_fallback_enum -- cgit v1.2.3 From c84e4da7ddae474a1eb3368844165f21866c5fe5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:16:51 +0000 Subject: code cleanup: move 2d bevel list into its own function. (as with 3d bevel) --- source/blender/blenkernel/intern/curve.c | 135 ++++++++++++++++--------------- 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 7d6212f8760..2da75ec64be 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2202,6 +2202,70 @@ static void make_bevel_list_segment_3D(BevList *bl) copy_qt_qt(bevp2->quat, bevp1->quat); } +/* only for 2 points */ +static void make_bevel_list_segment_2D(BevList *bl) +{ + BevPoint *bevp2 = (BevPoint *)(bl + 1); + BevPoint *bevp1 = bevp2 + 1; + + const float x1 = bevp1->vec[0] - bevp2->vec[0]; + const float y1 = bevp1->vec[1] - bevp2->vec[1]; + + calc_bevel_sin_cos(x1, y1, -x1, -y1, &(bevp1->sina), &(bevp1->cosa)); + bevp2->sina = bevp1->sina; + bevp2->cosa = bevp1->cosa; + + /* fill in dir & quat */ + make_bevel_list_segment_3D(bl); +} + +static void make_bevel_list_2D(BevList *bl) +{ + /* note: bevp->dir and bevp->quat are not needed for beveling but are + * used when making a path from a 2D curve, therefor they need to be set - Campbell */ + + BevPoint *bevp2 = (BevPoint *)(bl + 1); + BevPoint *bevp1 = bevp2 + (bl->nr - 1); + BevPoint *bevp0 = bevp1 - 1; + int nr; + + nr = bl->nr; + while (nr--) { + const float x1 = bevp1->vec[0] - bevp0->vec[0]; + const float x2 = bevp1->vec[0] - bevp2->vec[0]; + const float y1 = bevp1->vec[1] - bevp0->vec[1]; + const float y2 = bevp1->vec[1] - bevp2->vec[1]; + + calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa)); + + /* from: make_bevel_list_3D_zup, could call but avoid a second loop. + * no need for tricky tilt calculation as with 3D curves */ + bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec); + vec_to_quat(bevp1->quat, bevp1->dir, 5, 1); + /* done with inline make_bevel_list_3D_zup */ + + bevp0 = bevp1; + bevp1 = bevp2; + bevp2++; + } + + /* correct non-cyclic cases */ + if (bl->poly == -1) { + BevPoint *bevp = (BevPoint *)(bl + 1); + bevp1 = bevp + 1; + bevp->sina = bevp1->sina; + bevp->cosa = bevp1->cosa; + bevp = (BevPoint *)(bl + 1); + bevp += (bl->nr - 1); + bevp1 = bevp - 1; + bevp->sina = bevp1->sina; + bevp->cosa = bevp1->cosa; + + /* correct for the dir/quat, see above why its needed */ + bevel_list_cyclic_fix_3D(bl); + } +} + void BKE_curve_bevelList_make(Object *ob) { /* @@ -2216,7 +2280,7 @@ void BKE_curve_bevelList_make(Object *ob) BPoint *bp; BevList *bl, *blnew, *blnext; BevPoint *bevp, *bevp2, *bevp1 = NULL, *bevp0; - float min, inp, x1, x2, y1, y2; + float min, inp; struct bevelsort *sortdata, *sd, *sd1; int a, b, nr, poly, resolu = 0, len = 0; int do_tilt, do_radius, do_weight; @@ -2534,76 +2598,22 @@ void BKE_curve_bevelList_make(Object *ob) /* STEP 4: 2D-COSINES or 3D ORIENTATION */ if ((cu->flag & CU_3D) == 0) { - /* note: bevp->dir and bevp->quat are not needed for beveling but are - * used when making a path from a 2D curve, therefor they need to be set - Campbell */ - bl = cu->bev.first; - while (bl) { - + /* 2D Curves */ + for (bl = cu->bev.first; bl; bl = bl->next) { if (bl->nr < 2) { /* do nothing */ } else if (bl->nr == 2) { /* 2 pnt, treat separate */ - bevp2 = (BevPoint *)(bl + 1); - bevp1 = bevp2 + 1; - - x1 = bevp1->vec[0] - bevp2->vec[0]; - y1 = bevp1->vec[1] - bevp2->vec[1]; - - calc_bevel_sin_cos(x1, y1, -x1, -y1, &(bevp1->sina), &(bevp1->cosa)); - bevp2->sina = bevp1->sina; - bevp2->cosa = bevp1->cosa; - - /* fill in dir & quat */ - make_bevel_list_segment_3D(bl); + make_bevel_list_segment_2D(bl); } else { - bevp2 = (BevPoint *)(bl + 1); - bevp1 = bevp2 + (bl->nr - 1); - bevp0 = bevp1 - 1; - - nr = bl->nr; - while (nr--) { - x1 = bevp1->vec[0] - bevp0->vec[0]; - x2 = bevp1->vec[0] - bevp2->vec[0]; - y1 = bevp1->vec[1] - bevp0->vec[1]; - y2 = bevp1->vec[1] - bevp2->vec[1]; - - calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa)); - - /* from: make_bevel_list_3D_zup, could call but avoid a second loop. - * no need for tricky tilt calculation as with 3D curves */ - bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec); - vec_to_quat(bevp1->quat, bevp1->dir, 5, 1); - /* done with inline make_bevel_list_3D_zup */ - - bevp0 = bevp1; - bevp1 = bevp2; - bevp2++; - } - - /* correct non-cyclic cases */ - if (bl->poly == -1) { - bevp = (BevPoint *)(bl + 1); - bevp1 = bevp + 1; - bevp->sina = bevp1->sina; - bevp->cosa = bevp1->cosa; - bevp = (BevPoint *)(bl + 1); - bevp += (bl->nr - 1); - bevp1 = bevp - 1; - bevp->sina = bevp1->sina; - bevp->cosa = bevp1->cosa; - - /* correct for the dir/quat, see above why its needed */ - bevel_list_cyclic_fix_3D(bl); - } + make_bevel_list_2D(bl); } - bl = bl->next; } } - else { /* 3D Curves */ - bl = cu->bev.first; - while (bl) { - + else { + /* 3D Curves */ + for (bl = cu->bev.first; bl; bl = bl->next) { if (bl->nr < 2) { /* do nothing */ } @@ -2613,7 +2623,6 @@ void BKE_curve_bevelList_make(Object *ob) else { make_bevel_list_3D(bl, (int)(resolu * cu->twist_smooth), cu->twist_mode); } - bl = bl->next; } } } -- cgit v1.2.3 From 091d86b9cb769f535fa11d2c7b6274e5206476d3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Feb 2013 17:18:27 +0000 Subject: style cleanup: 'sizeof foo' --> 'sizeof(foo)', add check in style checking script. --- intern/ghost/intern/GHOST_DisplayManagerSDL.cpp | 2 +- source/blender/blenlib/intern/BLI_heap.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- .../blender/editors/uvedit/uvedit_parametrizer.c | 22 +++++++++++----------- source/blender/makesrna/intern/rna_nodetree.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp index 86f0380c8d6..0d077ebc204 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp @@ -39,7 +39,7 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system) GHOST_DisplayManager(), m_system(system) { - memset(&m_mode, 0, sizeof m_mode); + memset(&m_mode, 0, sizeof(m_mode)); } GHOST_TSuccess diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index dcc028630e2..aa54969b6f8 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -167,7 +167,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr) heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr); } else { - node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node); + node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof(*node)); } node->value = value; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1f8c06f6bf7..edeb66d9281 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5035,7 +5035,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps) ps->is_texbrush = false; } - /* sizeof ProjPixel, since we alloc this a _lot_ */ + /* sizeof(ProjPixel), since we alloc this a _lot_ */ ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool); BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel)); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 767003bdd84..bf5fc9a3021 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -709,7 +709,7 @@ static void p_face_restore_uvs(PFace *f) static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge *e) { - PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof *v); + PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v)); copy_v3_v3(v->co, co); v->u.key = key; v->edge = e; @@ -732,7 +732,7 @@ static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], PE static PVert *p_vert_copy(PChart *chart, PVert *v) { - PVert *nv = (PVert *)BLI_memarena_alloc(chart->handle->arena, sizeof *nv); + PVert *nv = (PVert *)BLI_memarena_alloc(chart->handle->arena, sizeof(*nv)); copy_v3_v3(nv->co, v->co); nv->uv[0] = v->uv[0]; @@ -786,7 +786,7 @@ static int p_face_exists(ParamHandle *phandle, ParamKey *pvkeys, int i1, int i2, static PChart *p_chart_new(PHandle *handle) { - PChart *chart = (PChart *)MEM_callocN(sizeof *chart, "PChart"); + PChart *chart = (PChart *)MEM_callocN(sizeof(*chart), "PChart"); chart->handle = handle; return chart; @@ -904,7 +904,7 @@ static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBoo static int p_connect_pairs(PHandle *handle, PBool impl) { - PEdge **stackbase = MEM_mallocN(sizeof *stackbase * phash_size(handle->hash_faces), "Pstackbase"); + PEdge **stackbase = MEM_mallocN(sizeof(*stackbase) * phash_size(handle->hash_faces), "Pstackbase"); PEdge **stack = stackbase; PFace *f, *first; PEdge *e, *e1, *e2; @@ -999,7 +999,7 @@ static void p_split_vert(PChart *chart, PEdge *e) static PChart **p_split_charts(PHandle *handle, PChart *chart, int ncharts) { - PChart **charts = MEM_mallocN(sizeof *charts * ncharts, "PCharts"), *nchart; + PChart **charts = MEM_mallocN(sizeof(*charts) * ncharts, "PCharts"), *nchart; PFace *f, *nextf; int i; @@ -1041,12 +1041,12 @@ static PFace *p_face_add(PHandle *handle) PEdge *e1, *e2, *e3; /* allocate */ - f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof *f); + f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof(*f)); f->flag = 0; /* init ! */ - e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e1); - e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e2); - e3 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e3); + e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof(*e1)); + e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof(*e2)); + e3 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof(*e3)); /* set up edges */ f->edge = e1; @@ -3674,7 +3674,7 @@ static PBool p_triangle_inside(SmoothTriangle *t, float co[2]) static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, float *bmin, float *bmax, int depth) { - SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node); + SmoothNode *node = BLI_memarena_alloc(arena, sizeof(*node)); int axis, i, t1size = 0, t2size = 0; float split, /* mi, */ /* UNUSED */ mx; SmoothTriangle **t1, **t2, *t; @@ -4114,7 +4114,7 @@ static void p_smooth(PChart *chart) ParamHandle *param_construct_begin(void) { - PHandle *handle = MEM_callocN(sizeof *handle, "PHandle"); + PHandle *handle = MEM_callocN(sizeof(*handle), "PHandle"); handle->construction_chart = p_chart_new(handle); handle->state = PHANDLE_STATE_ALLOCATED; handle->arena = BLI_memarena_new((1 << 16), "param construct arena"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 612802c46d1..1fff567f25c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1308,7 +1308,7 @@ static void reg_node(int ID, int category, const char *enum_name, const char *st static void init(void) { - memset(nodes, 0, sizeof nodes); + memset(nodes, 0, sizeof(nodes)); #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ reg_node(ID, Category_##Category, EnumName, STRINGIFY_ARG(Category##StructName), #Category, UIName, UIDesc); -- cgit v1.2.3 From 0a6e8a41b9d607e80f2fe375e9de6183844a8dea Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Thu, 21 Feb 2013 17:29:35 +0000 Subject: Enable new bevel tool code in bevel modifier. Now modifier takes a segments parameter. Bevel edge weights will multiply the overall amount. For vertex-only, you can give a vertex group name, and the weights in that will multiply the overall amount. --- .../startup/bl_ui/properties_data_modifier.py | 15 +++--- source/blender/blenkernel/BKE_bmesh.h | 3 +- source/blender/bmesh/operators/bmo_bevel.c | 2 +- source/blender/bmesh/tools/bmesh_bevel.c | 44 ++++++++++++++-- source/blender/bmesh/tools/bmesh_bevel.h | 6 ++- source/blender/makesrna/intern/rna_modifier.c | 32 ++++++++---- source/blender/modifiers/intern/MOD_bevel.c | 58 +++++++++++++++------- 7 files changed, 115 insertions(+), 45 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 7be00193fb4..05e189c86be 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -124,20 +124,17 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split.prop(md, "width") split.prop(md, "use_only_vertices") - # -- new modifier only, this may be reverted in favor of 2.62 mod. - ''' - split = layout.split() - split.prop(md, "use_even_offset") - split.prop(md, "use_distance_offset") - ''' - # -- end + layout.prop(md, "segments") layout.label(text="Limit Method:") layout.row().prop(md, "limit_method", expand=True) if md.limit_method == 'ANGLE': layout.prop(md, "angle_limit") - elif md.limit_method == 'WEIGHT': - layout.row().prop(md, "edge_weight_method", expand=True) + elif md.limit_method == 'VGROUP': + layout.label(text="Vertex Group:") + layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="") + # elif md.limit_method == 'WEIGHT': + # layout.row().prop(md, "edge_weight_method", expand=True) def BOOLEAN(self, layout, ob, md): split = layout.split() diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 8bfee836c0d..4bc21625cf3 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -38,7 +38,7 @@ /*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/ /* uncomment to use the new bevel operator as a modifier */ -// #define USE_BM_BEVEL_OP_AS_MOD +#define USE_BM_BEVEL_OP_AS_MOD /* bevel tool defines */ /* element flags */ @@ -53,6 +53,7 @@ #define BME_BEVEL_RADIUS (1 << 2) #define BME_BEVEL_ANGLE (1 << 3) #define BME_BEVEL_WEIGHT (1 << 4) +#define BME_BEVEL_VGROUP (1 << 5) //~ #define BME_BEVEL_EWEIGHT (1<<4) //~ #define BME_BEVEL_VWEIGHT (1<<5) #define BME_BEVEL_PERCENT (1 << 6) diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index c56af821a93..795531d6776 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -55,7 +55,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) } } - BM_mesh_bevel(bm, offset, seg, vonly); + BM_mesh_bevel(bm, offset, seg, vonly, false, NULL, -1); BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG); } diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 1e74354603b..5adef16de14 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -30,11 +30,15 @@ #include "MEM_guardedalloc.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" + #include "BLI_array.h" #include "BLI_math.h" #include "BLI_memarena.h" #include "BKE_customdata.h" +#include "BKE_deform.h" #include "bmesh.h" #include "./intern/bmesh_private.h" @@ -104,6 +108,7 @@ typedef struct BevVert { BMVert *v; /* original mesh vertex */ int edgecount; /* total number of edges around the vertex */ int selcount; /* number of selected edges around the vertex */ + float offset; /* offset for this vertex, if vertex_only bevel */ EdgeHalf *edges; /* array of size edgecount; CCW order from vertex normal side */ VMesh *vmesh; /* mesh structure for replacing vertex */ } BevVert; @@ -117,7 +122,10 @@ typedef struct BevelParams { float offset; /* blender units to offset each side of a beveled edge */ int seg; /* number of segments in beveled edge profile */ - int vertex_only; /* bevel vertices only */ + bool vertex_only; /* bevel vertices only */ + bool use_weights; /* bevel amount affected by weights on edges or verts */ + const struct MDeformVert *dvert; /* vertex group array, maybe set if vertex_only */ + int vertex_group; /* vertex group index, maybe set if vertex_only */ } BevelParams; // #pragma GCC diagnostic ignored "-Wpadded" @@ -665,7 +673,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv) return; } - lastd = bp->vertex_only ? bp->offset : e->offset; + lastd = bp->vertex_only? bv->offset : e->offset; vm->boundstart = NULL; do { if (e->is_bev) { @@ -1722,6 +1730,7 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v) BMFace *f; BMIter iter, iter2; EdgeHalf *e; + float weight; int i, found_shared_face, ccw_test_sum; int nsel = 0; int ntot = 0; @@ -1760,11 +1769,24 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v) bv->v = v; bv->edgecount = ntot; bv->selcount = nsel; + bv->offset = bp->offset; bv->edges = (EdgeHalf *)BLI_memarena_alloc(bp->mem_arena, ntot * sizeof(EdgeHalf)); bv->vmesh = (VMesh *)BLI_memarena_alloc(bp->mem_arena, sizeof(VMesh)); bv->vmesh->seg = bp->seg; BLI_ghash_insert(bp->vert_hash, v, bv); + if (bp->vertex_only) { + /* if weighted, modify offset by weight */ + if (bp->dvert != NULL && bp->vertex_group != -1) { + weight = defvert_find_weight(bp->dvert + BM_elem_index_get(v), bp->vertex_group); + if (weight <= 0.0f) { + BM_elem_flag_disable(v, BM_ELEM_TAG); + return; + } + bv->offset *= weight; + } + } + /* add edges to bv->edges in order that keeps adjacent edges sharing * a face, if possible */ i = 0; @@ -1815,7 +1837,16 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v) e->seg = 0; } e->is_rev = (bme->v2 == v); - e->offset = e->is_bev ? bp->offset : 0.0f; + if (e->is_bev) { + e->offset = bp->offset; + if (bp->use_weights) { + weight = BM_elem_float_data_get(&bm->edata, bme, CD_BWEIGHT); + e->offset *= weight; + } + } + else { + e->offset = 0.0f; + } } /* find wrap-around shared face */ BM_ITER_ELEM (f, &iter2, bme, BM_FACES_OF_EDGE) { @@ -2034,7 +2065,9 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme) * * \warning all tagged edges _must_ be manifold. */ -void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const int vertex_only) +void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, + const bool vertex_only, const bool use_weights, + const struct MDeformVert *dvert, const int vertex_group) { BMIter iter; BMVert *v; @@ -2044,6 +2077,9 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const in bp.offset = offset; bp.seg = segments; bp.vertex_only = vertex_only; + bp.use_weights = use_weights; + bp.dvert = dvert; + bp.vertex_group = vertex_group; if (bp.offset > 0) { /* primary alloc */ diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h index d56aa13c984..f214125fa1c 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.h +++ b/source/blender/bmesh/tools/bmesh_bevel.h @@ -27,6 +27,10 @@ * \ingroup bmesh */ -void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const int vertex_only); +struct MDeformVert; + +void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, + const bool vertex_only, const bool use_weights, + const struct MDeformVert *dvert, const int vertex_group); #endif /* __BMESH_BEVEL_H__ */ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 21ab11271c4..1eaf54a69aa 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -749,6 +749,12 @@ static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value) md->bevel_angle = (int)value; } +static void rna_BevelModifier_defgrp_name_set(PointerRNA *ptr, const char *value) +{ + BevelModifierData *md = (BevelModifierData *)ptr->data; + rna_object_vgroup_name_set(ptr, value, md->defgrp_name, sizeof(md->defgrp_name)); +} + static void rna_UVWarpModifier_vgroup_set(PointerRNA *ptr, const char *value) { UVWarpModifierData *umd = (UVWarpModifierData *)ptr->data; @@ -2291,11 +2297,13 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"}, {BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"}, {BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight", - "Use bevel weights to determine how much bevel is applied; " - "apply them separately in vert/edge select mode"}, + "Use bevel weights to determine how much bevel is applied in edge mode"}, + {BME_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group", + "Use vertex group weights to determine how much bevel is applied in vertex mode"}, {0, NULL, 0, NULL, NULL} }; + /* TO BE DEPRECATED */ static EnumPropertyItem prop_edge_weight_method_items[] = { {0, "AVERAGE", 0, "Average", ""}, {BME_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""}, @@ -2315,6 +2323,12 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Width", "Bevel value/amount"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "res"); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_VERT); RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges"); @@ -2326,6 +2340,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Limit Method", ""); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + /* TO BE DEPRECATED */ prop = RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "e_flags"); RNA_def_property_enum_items(prop, prop_edge_weight_method_items); @@ -2348,15 +2363,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); #ifdef USE_BM_BEVEL_OP_AS_MOD - prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */ - RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN); - RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop = RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST); - RNA_def_property_ui_text(prop, "Distance", - "Use the width as a distance in rather then a factor of the face size"); + prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "defgrp_name"); + RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); #endif diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 776adb57c13..1942fe12a54 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -31,19 +31,22 @@ /** \file blender/modifiers/intern/MOD_bevel.c * \ingroup modifiers */ + +#include "DNA_object_types.h" #include "BLI_utildefines.h" #include "BLI_math.h" #include "BLI_string.h" #include "BKE_cdderivedmesh.h" +#include "BKE_deform.h" #include "BKE_modifier.h" #include "BKE_mesh.h" #include "BKE_bmesh.h" /* only for defines */ -#include "bmesh.h" +#include "MOD_util.h" -#include "DNA_object_types.h" +#include "bmesh.h" #include "MEM_guardedalloc.h" @@ -88,21 +91,12 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -// #define USE_BM_BEVEL_OP_AS_MOD - #ifdef USE_BM_BEVEL_OP_AS_MOD -/* BMESH_TODO - * - * this bevel calls the new bevel code (added since 2.64) - * which is missing many of the options which the bevel modifier from 2.4x has. - * - no vertex bevel - * - no weight bevel - * - * These will need to be added to the bmesh operator. - * - campbell +/* + * This calls the new bevel code (added since 2.64) */ -static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob), +static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { @@ -110,13 +104,33 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob), BMesh *bm; BMIter iter; BMEdge *e; + BMVert *v; + float weight; + int vgroup = -1; + MDeformVert *dvert = NULL; BevelModifierData *bmd = (BevelModifierData *) md; const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f); - const int segments = 16; /* XXX */ + const bool vertex_only = bmd->flags & BME_BEVEL_VERT; bm = DM_to_bmesh(dm); - if (bmd->lim_flags & BME_BEVEL_ANGLE) { + if (vertex_only) { + if ((bmd->lim_flags & BME_BEVEL_VGROUP) && bmd->defgrp_name[0]) { + modifier_get_vgroup(ob, dm, bmd->defgrp_name, &dvert, &vgroup); + } + BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) { + if (!BM_vert_is_manifold(v)) + continue; + if (vgroup != -1) { + /* Is it safe to assume bmesh indices and dvert array line up?? */ + weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(v), vgroup); + if (weight <= 0.0f) + continue; + } + BM_elem_flag_enable(v, BM_ELEM_TAG); + } + } + else if (bmd->lim_flags & BME_BEVEL_ANGLE) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { /* check for 1 edge having 2 face users */ BMLoop *l_a, *l_b; @@ -133,6 +147,11 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob), /* crummy, is there a way just to operator on all? - campbell */ BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BM_edge_is_manifold(e)) { + if (bmd->lim_flags & BME_BEVEL_WEIGHT) { + weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT); + if (weight == 0.0f) + continue; + } BM_elem_flag_enable(e, BM_ELEM_TAG); BM_elem_flag_enable(e->v1, BM_ELEM_TAG); BM_elem_flag_enable(e->v2, BM_ELEM_TAG); @@ -140,11 +159,14 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob), } } - BM_mesh_bevel(bm, bmd->value, segments, bmd->flags & BME_BEVEL_VERT); + BM_mesh_bevel(bm, bmd->value, bmd->res, + vertex_only, bmd->lim_flags & BME_BEVEL_WEIGHT, dvert, vgroup); result = CDDM_from_bmesh(bm, TRUE); - BLI_assert(bm->toolflagpool == NULL); /* make sure we never alloc'd this */ + BLI_assert(bm->vtoolflagpool == NULL && + bm->etoolflagpool == NULL && + bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */ BM_mesh_free(bm); CDDM_calc_normals(result); -- cgit v1.2.3 From a31a93ca3f479739fe07173b65dc042ca4b7aa64 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:39:48 +0000 Subject: Compile fixes for recent code cleanups: * M_PI was not declared for MSVC. --- source/blender/blenfont/intern/blf.c | 2 ++ source/blender/editors/interface/view2d.c | 1 + 2 files changed, 3 insertions(+) diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index c622f8c35a2..061e8e28607 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -43,6 +43,8 @@ #include "DNA_listBase.h" #include "DNA_vec_types.h" +#include "BLI_math.h" + #include "BIF_gl.h" #include "BLF_api.h" diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 4afcec73a8f..ad6428c7e80 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -39,6 +39,7 @@ #include "DNA_userdef_types.h" #include "BLI_blenlib.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "BKE_context.h" -- cgit v1.2.3 From b25ba60afe6484bc454555bcccaf06b8256d324d Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:46:26 +0000 Subject: Code cleanup: * Removed "rotfrom" from particle RNA/DNA, was not used anywhere. --- source/blender/makesdna/DNA_particle_types.h | 8 ++------ source/blender/makesrna/intern/rna_particle.c | 17 ----------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 1cf16fb52b3..ec2a724ac82 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -173,7 +173,8 @@ typedef struct ParticleSettings { /* adaptive path rendering */ short adapt_angle, adapt_pix; - short disp, omat, interpolation, rotfrom, integrator; + short disp, omat, interpolation, integrator; + short rotfrom DNA_DEPRECATED; short kink, kink_axis; /* billboards */ @@ -359,11 +360,6 @@ typedef struct ParticleSystem { #define PART_SELF_EFFECT (1<<22) -/* part->rotfrom */ -#define PART_ROT_KEYS 0 /* interpolate directly from keys */ -#define PART_ROT_ZINCR 1 /* same as zdir but done incrementally from previous position */ -#define PART_ROT_IINCR 2 /* same as idir but done incrementally from previous position */ - /* part->from */ #define PART_FROM_VERT 0 #define PART_FROM_FACE 1 diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index dbf80f01335..f90389146aa 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1937,14 +1937,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) }; /*TODO: names, tooltips */ -#if 0 - static EnumPropertyItem rot_from_items[] = { - {PART_ROT_KEYS, "KEYS", 0, "keys", ""}, - {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""}, - {PART_ROT_IINCR, "IINCR", 0, "iincr", ""}, - {0, NULL, 0, NULL, NULL} - }; -#endif static EnumPropertyItem integrator_type_items[] = { {PART_INT_EULER, "EULER", 0, "Euler", ""}, {PART_INT_VERLET, "VERLET", 0, "Verlet", ""}, @@ -2346,15 +2338,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Material", "Material used for the particles"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); - - /* not used anywhere, why is this in DNA??? */ -#if 0 - prop = RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "rotfrom"); - RNA_def_property_enum_items(prop, rot_from_items); - RNA_def_property_ui_text(prop, "Rotate From", ""); -#endif - prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, integrator_type_items); RNA_def_property_ui_text(prop, "Integration", -- cgit v1.2.3 From 127c2bbf86773e7c6f5350094474259f9276a726 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 17:52:07 +0000 Subject: Code cleanup: * Remove some old RNA code for physics engines other than Bullet. --- source/blender/makesrna/intern/rna_scene.c | 4 ---- source/blender/makesrna/intern/rna_world.c | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 833d8e6addb..b3c977809fb 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2441,10 +2441,6 @@ static void rna_def_scene_game_data(BlenderRNA *brna) static EnumPropertyItem physics_engine_items[] = { {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"}, - /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */ - /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */ - /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */ - /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */ {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 7a94566c6ee..02a04d36c23 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -494,18 +494,6 @@ void RNA_def_world(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; -#if 0 - static EnumPropertyItem physics_engine_items[] = { - {WOPHY_NONE, "NONE", 0, "None", ""}, - /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */ - /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */ - /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */ - /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */ - {WOPHY_BULLET, "BULLET", 0, "Bullet", ""}, - {0, NULL, 0, NULL, NULL} - }; -#endif - srna = RNA_def_struct(brna, "World", "ID"); RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene"); -- cgit v1.2.3 From ebc456fbb527637a81df28f5e67aa45b2c97544b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Feb 2013 18:07:56 +0000 Subject: Increase maximum render resolution from 10000 to 65536. --- source/blender/makesdna/DNA_scene_types.h | 13 ++++++++----- source/blender/makesrna/intern/rna_image.c | 4 ++-- source/blender/makesrna/intern/rna_scene.c | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index b35323def29..644ab9286c5 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -389,15 +389,19 @@ typedef struct RenderData { short filtertype; /* filter is box, tent, gauss, mitch, etc */ short size, maximsize; /* size in %, max in Kb */ + + short pad6; + /* from buttons: */ /** * The desired number of pixels in the x direction */ - short xsch; + int xsch; /** * The desired number of pixels in the y direction */ - short ysch; + int ysch; + /** * The number of part to use in the x direction */ @@ -410,7 +414,7 @@ typedef struct RenderData { /** * render tile dimensions */ - short tilex, tiley; + int tilex, tiley; short planes DNA_DEPRECATED, imtype DNA_DEPRECATED, subimtype DNA_DEPRECATED, quality DNA_DEPRECATED; /*deprecated!*/ @@ -418,6 +422,7 @@ typedef struct RenderData { * Render to image editor, fullscreen or to new window. */ short displaymode; + short pad7; /** * Flags for render settings. Use bit-masking to access the settings. @@ -458,8 +463,6 @@ typedef struct RenderData { short frs_sec, edgeint; - int pad; - /* safety, border and display rect */ rctf safety, border; diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 72e27ba9240..be462e20ee7 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -584,14 +584,14 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gen_x"); - RNA_def_property_range(prop, 1, 16384); + RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Width", "Generated image width"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gen_y"); - RNA_def_property_range(prop, 1, 16384); + RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Height", "Generated image height"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b3c977809fb..7718dc2376d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3454,14 +3454,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "xsch"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 4, 10000); + RNA_def_property_range(prop, 4, 65536); RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update"); prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ysch"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 4, 10000); + RNA_def_property_range(prop, 4, 65536); RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update"); @@ -3475,13 +3475,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tilex"); - RNA_def_property_range(prop, 8, 10000); + RNA_def_property_range(prop, 8, 65536); RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tiley"); - RNA_def_property_range(prop, 8, 10000); + RNA_def_property_range(prop, 8, 65536); RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); -- cgit v1.2.3 From 2f69029db6962967acb2143de858e87521f15977 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Feb 2013 18:07:59 +0000 Subject: bf-members.txt encoding changed from Mac Roman to UTF-8 so it displays properly cross platform, patch by Lawrence D'Oliveiro. --- doc/license/bf-members.txt | 100 ++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/doc/license/bf-members.txt b/doc/license/bf-members.txt index 41aad8b7264..d2f71a56ad5 100644 --- a/doc/license/bf-members.txt +++ b/doc/license/bf-members.txt @@ -35,7 +35,7 @@ Eric Van Hensbergen Christian Reichlin brian moore Anthony Walker -Carsten Hšfer +Carsten Höfer Raymond Fordham David Megginson Jason Schmidt @@ -78,7 +78,7 @@ Ken Payne DEBEUX Sylvain Douglas Philips Lai Che Hung -Johan Bolmsjš +Johan Bolmsjö Aaron Mitchell Teinye Horsfall Martin Marbach @@ -98,7 +98,7 @@ lukas schroeder Dan Lyke Mark Thorpe A.D. Arul Nirai Selvan -Herbert Pštzl +Herbert Pötzl Andy Payne LAFFITTE Benoit (KenjForce) James Ertle @@ -148,7 +148,7 @@ Kendall Dugger Brice Due Simon Vogl Bernd Koestler -clŽment CORDIER +clément CORDIER CreationAnimation.com Pete Carss HERSEN Antoine @@ -197,9 +197,9 @@ cadic jean-yves Ralf Pietersz KAZY serge Jadot -HervŽ LOUINET +Hervé LOUINET Tom Houtman -Magnus Kššhler +Magnus Kööhler Martin Sinnaeve Kevin Yank Tomoichi Iriyama @@ -221,12 +221,12 @@ Gianluigi Belli Naoki Abe NOTTE Jean-Pierre Jack Way -Bjšrn Westlin +Björn Westlin Mitch Magee wizoptic Jake Edge David Hoover -Xabier Go–i +Xabier Goñi Daniel Fort Erik Noteboom Pavel Vostatek @@ -234,7 +234,7 @@ Javier Belanche Alonso Jeffrey Blank Nathan Ryan Peter Wrangell -Josef Sie§ +Josef Sieß Timm Krumnack Steve Martin Shigeru Matsumoto @@ -261,7 +261,7 @@ Colin Foster Sascha Adler Stuart Duncan Brendon Smith -SŽbastien COLLETTE +Sébastien COLLETTE Clemens Auer Kay Fricke Fabian Fagerholm @@ -282,7 +282,7 @@ STEMax Jeff Cox Trevor Ratliff Matt Henley -Franois VALETTE +François VALETTE Rob Saunders Mike Luethi Rami Aubourg-Kaires @@ -290,9 +290,9 @@ Matthew Thomas Allan Jacobsen Adam Lowe David Hostetler -Lo•c Vigneras +Loïc Vigneras Dan Reiland -Pedro D’az del Arco +Pedro Díaz del Arco Pierre Beyssac Chris Davey YOSHIAKI Nishino @@ -385,7 +385,7 @@ Kiernan Holland Holger Malessa Masanori Okuda Andrea Maracci -Kai-Peter BŠckman +Kai-Peter Bäckman Gregg Patton Luis M Ibarra Julian Green @@ -394,7 +394,7 @@ Mark Winkelman Ebbe L. Nielsen Carlos Orozco magnetHead -KrŸckel Oliver +Krückel Oliver Thomas Ingham Wes Devauld Uwe Steinmann @@ -417,7 +417,7 @@ Steve Mackay NDNWarrior Christopher Gray Darius Clarke (Socinian) -Jean-SŽbastien SEVESTRE +Jean-Sébastien SEVESTRE Douglas Fellows Craig Symons Quincin Gonjon @@ -447,7 +447,7 @@ Markus Q. Roberts Christoher Bartak Peter Truog Eric Dynowski -Philipp GŸhring +Philipp Gühring Pierre-Yves RANNO Jason Nollan (Cluh) Launay Jean-Claude @@ -465,7 +465,7 @@ TROJANI Cedric David Polston Patrick Mullen Tetsuya Okuno -Bodo JŠger +Bodo Jäger Leon Brooks Cedric Adjih Michael L. Fisher @@ -521,7 +521,7 @@ Vincent Stoessel Adrian Virnig Chris Dixon Travis Cole -MŒrten MŒrtensson +MÃ¥rten MÃ¥rtensson Evan Scott Mark Coletti Ken Burke @@ -541,7 +541,7 @@ Iain Russell Thomas Bleicher Anthony Zishka Jefferson Dubrule -Esa PiirilŠ +Esa Piirilä Bill Thiede William Anderson Alexander Kittel @@ -561,7 +561,7 @@ John DiLauro John Miller Frederic Crozat Matt Welland -Paul CalcŽ +Paul Calcé Joe Prochilo Justin Shafer Joe Croft @@ -571,7 +571,7 @@ Alain Gallo Phuoc Ngo Krabat Derek Harmison -SŽbastien Devine +Sébastien Devine Kenneth P. Stox Wade Felde Kai Groshert @@ -603,7 +603,7 @@ Martin Forisch Guillermina Manon Randal D. Adams Kevin Reagh (kevin3D) -Wolfgang KŸhn +Wolfgang Kühn BEAUSOLEIL Arnaud Stan Jakubek Klaus Brand @@ -628,7 +628,7 @@ Samuel Seay Mike Schaudies Robert Sherwood Fernando Villalon Panzano -Jšrg Roschke +Jörg Roschke Carl Symons Peter Pichler Alan Heckart @@ -714,7 +714,7 @@ Rau, Bernhard Stephen Uithoven Ken Beyer Matjaz Jakopec -Eckhard M. JŠger +Eckhard M. Jäger Mike Siebach John Harger Justin W. Carper @@ -747,7 +747,7 @@ Karl Bartel Ralph Howes Matthew J. Stott Omar Priego -ke Westerstršm +Ã…ke Westerström Imago Viva James E Hill Rune Myrland @@ -785,7 +785,7 @@ Claude Bilat Mario Palomo Neipi Grethus Bode -Jan MŸller +Jan Müller Mark Pearson Stanislav Osicka DataCare Solutions AG @@ -804,9 +804,9 @@ Aaron Bredon Hideki Suzuki josef radinger Robert Friemer -Jšrg Zastrau +Jörg Zastrau Burton Bicksler -Kimmo Mšsš +Kimmo Mösö Robert F Johnson Mark Johnson Avi Bercovich @@ -821,21 +821,21 @@ Duffaud Marco Ardito Simon Suter Tobias Huelsdau -Winfried EnglŠnder +Winfried Engländer Stephen Groundwater Joel Ray Holveck Mag. Tibor Rudas Hartmut Wolf Douglas Jones brett hartshorn -Beat MŠgert +Beat Mägert Javon Prince bri James Klicman Harvey Fong jeroen v.d. Meulen Wim Vandersmissen -Carlos Moreno Rodr’guez +Carlos Moreno Rodríguez Trausti Kristjansson Larry Snyder olivier @@ -887,7 +887,7 @@ Fred Roberts Njin-Zu Chen GUILLON Marc Felix Klock -Ernesto Salas Rodr’guez +Ernesto Salas Rodríguez Pavel Roskin Jaap Stefan Maass @@ -911,7 +911,7 @@ delerue Dirk Behrens Doc Holiday Wouter Kerkhoven -Andreas BŸttner +Andreas Büttner James Black Nicholas Ward David Oberbeck @@ -940,7 +940,7 @@ Ian Whitworth Ruud H.G. van Tol Pierre Lo Cicero Srinivas Digumarty -digitalvelocity¨ +digitalvelocity® Alan J Booth Tony OBrien Douglas Toltzman @@ -957,12 +957,12 @@ Craig Spitzer Jeffrey Van Ness Lucas Vergnettes Wolfgang Michaelis -Luis JimŽnez Linares +Luis Jiménez Linares Julian Eden Ms Lilo von Hanffstengel Kurt B. Kaiser Mark Ping -CombŽe +Combée Diego Matho MELIN Philippe Damian Sobieralski @@ -1028,7 +1028,7 @@ evolutie Stephane Portha Robert Gentner David B. Camhy -RenŽ Foucart +René Foucart Coyok Drio Mark Ng klein michael @@ -1094,14 +1094,14 @@ Stuart MacKinnon Dietrich Dietz - the IMaGiNation project (IMGN) Tina Hirsch John R Thorp -FrŽdŽric Bouvier +Frédéric Bouvier LINETTE Felix Rabe Chay Adamou nick harron stephen john ford Kino -Daniel Sjšlie +Daniel Sjölie Matthias Derer Alain VALLETON Kervin Pierre @@ -1142,13 +1142,13 @@ Satoshi Yamasaki Rolf-Dieter Klein J. Deetman Helge Walter -Roland StrŒlberg +Roland StrÃ¥lberg Nicolas Morenas (Caronte) Simon Clarke Maigrot Michel Rod Robinson Kevin Cozens -Germ‡n Alonso (taz) +Germán Alonso (taz) Martin Stegeman Henrik Jordfald Olsen Mitchell Skinner @@ -1157,7 +1157,7 @@ Spiridon G. Kontarakis Bas Denissen Loic Dachary Michael Rutter -Thorsten SchlŸter +Thorsten Schlüter hijothema Andreas Hauser Holger Haase @@ -1232,9 +1232,9 @@ Starr Kline John Lullie Chiffi Cosimo Morgan McMillian -Stefan HŸbner +Stefan Hübner Loic de MONTAIGNAC -AndrŽs Castillo +Andrés Castillo Francesco Anselmo Ingo Guenther James C. Davis, Jr. @@ -1314,7 +1314,7 @@ Luke Titley marinus meijers Henry Kaminski Alistair Riddoch -Daniel NŸmm +Daniel Nümm Matthew Meadows Bjoern Paschen Paul Fredrickson @@ -1325,7 +1325,7 @@ Thomas Muldowney Cheyenne Cloud, LLC Helmut A. Goettl Martin A. Boegelund -Beno”t Cousson +Benoît Cousson Scott Brooks Ferlet Patrice Aaron Porterfield @@ -1335,13 +1335,13 @@ Rui Paulo Sanguinheira Diogo Jason Saville Active-Websight GbR Bryon Roche -Gustavo Mu–oz +Gustavo Muñoz Christopher Gillanders Phil Frost Tate Gilles Gonon Kay James C. Franklin -Luis Enrique Caama–o Navas +Luis Enrique Caamaño Navas Alexander "estartu" Felder Marc Ledermann vrijschrift.org @@ -1371,7 +1371,7 @@ Maurizio Sibaud Ron Bolger Nathan Parton Andrew Fry -VINCENT StŽphane +VINCENT Stéphane Yan Yan Justin L Graham Wade Beasley -- cgit v1.2.3 From b19168f4b161a01480c1279e30ecf95bbf7a4000 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Feb 2013 18:08:01 +0000 Subject: Remove orthographic camera Scale hard min/max and make them soft limits instead, based on patch by Alexander Trum. --- source/blender/makesrna/intern/rna_camera.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 0b1e1c215c4..5f11663c057 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -208,7 +208,8 @@ void RNA_def_camera(BlenderRNA *brna) prop = RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ortho_scale"); - RNA_def_property_range(prop, 0.01f, 4000.0f); + RNA_def_property_range(prop, FLT_MIN, FLT_MAX); + RNA_def_property_ui_range(prop, 0.001f, 10000.0f, 10, 3); RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); -- cgit v1.2.3 From 7a6919a74eb08caaf21030c17fe7c2723394a3d6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Feb 2013 18:08:04 +0000 Subject: Object Select Similar tool now has a Pass Index option. Patch by Jesse Werner. --- source/blender/editors/object/object_select.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 07eca749a74..775a2897513 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -527,6 +527,7 @@ static EnumPropertyItem prop_select_grouped_types[] = { {11, "PROPERTIES", 0, "Properties", "Game Properties"}, {12, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"}, {13, "LAMP_TYPE", 0, "Lamp Type", "Matching lamp types"}, + {14, "PASS_INDEX", 0, "Pass Index", "Matching object pass index"}, {0, NULL, 0, NULL, NULL} }; @@ -677,6 +678,20 @@ static short select_similar_lamps(bContext *C, Object *ob) CTX_DATA_END; return changed; } +static short select_similar_pass_index(bContext *C, Object *ob) +{ + char changed = 0; + + CTX_DATA_BEGIN (C, Base *, base, selectable_bases) + { + if ((base->object->index == ob->index) && !(base->flag & SELECT)) { + ED_base_object_select(base, BA_SELECT); + changed = 1; + } + } + CTX_DATA_END; + return changed; +} static short select_grouped_type(bContext *C, Object *ob) { short changed = 0; @@ -842,7 +857,8 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) else if (nr == 11) changed |= select_grouped_gameprops(C, ob); else if (nr == 12) changed |= select_grouped_keyingset(C, ob); else if (nr == 13) changed |= select_similar_lamps(C, ob); - + else if (nr == 14) changed |= select_similar_pass_index(C, ob); + if (changed) { WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); return OPERATOR_FINISHED; -- cgit v1.2.3 From 6b600d079351fa5490d74d5661c47346196e57f3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Feb 2013 18:08:07 +0000 Subject: Blender Internal: optimization to remove sleep() calls from the render threading code. This gives a speedup up to a couple of seconds based only on the image resolution and tile size. For complex renders a second or two is not so noticeable but for quick ones it's nice to save some time. On the default cube this gives me about half a second speedup. Patch by Johan Walles, based on the render branch implementation by me. --- source/blender/render/intern/source/pipeline.c | 174 ++++++++++++++++--------- 1 file changed, 112 insertions(+), 62 deletions(-) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index e1024163953..1d04d5a117b 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -673,6 +673,10 @@ static void *do_part_thread(void *pa_v) else zbufshade_tile(pa); + /* we do actually write pixels, but don't allocate/deallocate anything, + * so it is safe with other threads reading at the same time */ + BLI_rw_mutex_lock(&R.resultmutex, THREAD_LOCK_READ); + /* merge too on break! */ if (R.result->do_exr_tile) { render_result_exr_file_merge(R.result, pa->result); @@ -686,6 +690,8 @@ static void *do_part_thread(void *pa_v) render_result_merge(R.result, pa->result); } } + + BLI_rw_mutex_unlock(&R.resultmutex); } pa->status = PART_STATUS_READY; @@ -719,24 +725,33 @@ float panorama_pixel_rot(Render *re) return phi; } -/* call when all parts stopped rendering, to find the next Y slice */ -/* if slice found, it rotates the dbase */ -static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane) +/* for panorama, we render per Y slice, and update + * camera parameters when we go the next slice */ +static bool find_next_pano_slice(Render *re, int *slice, int *minx, rctf *viewplane) { RenderPart *pa, *best = NULL; + bool found = false; *minx = re->winx; + if (!(re->r.mode & R_PANORAMA)) { + /* for regular render, just one 'slice' */ + found = (*slice == 0); + (*slice)++; + return found; + } + /* most left part of the non-rendering parts */ for (pa = re->parts.first; pa; pa = pa->next) { if (pa->status == PART_STATUS_NONE && pa->nr == 0) { if (pa->disprect.xmin < *minx) { + found = true; best = pa; *minx = pa->disprect.xmin; } } } - + if (best) { float phi = panorama_pixel_rot(re); @@ -754,7 +769,10 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane) R.panosi = sin(R.panodxp * phi); R.panoco = cos(R.panodxp * phi); } - return best; + + (*slice)++; + + return found; } static RenderPart *find_next_part(Render *re, int minx) @@ -809,26 +827,53 @@ static void print_part_stats(Render *re, RenderPart *pa) re->i.infostr = NULL; } +typedef struct RenderThread { + ThreadQueue *workqueue; + ThreadQueue *donequeue; + + int number; +} RenderThread; + +static void *do_render_thread(void *thread_v) +{ + RenderThread *thread = thread_v; + RenderPart *pa; + + while ((pa = BLI_thread_queue_pop(thread->workqueue))) { + pa->thread = thread->number; + do_part_thread(pa); + BLI_thread_queue_push(thread->donequeue, pa); + + if(R.test_break(R.tbh)) + break; + } + + return NULL; +} + static void threaded_tile_processor(Render *re) { + RenderThread thread[BLENDER_MAX_THREADS]; + ThreadQueue *workqueue, *donequeue; ListBase threads; - RenderPart *pa, *nextpa; + RenderPart *pa; rctf viewplane = re->viewplane; - int rendering = 1, counter = 1, drawtimer = 0, hasdrawn, minx = 0; + double lastdraw, elapsed, redrawtime = 1.0f; + int totpart = 0, minx = 0, slice = 0, a, wait; BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); /* first step; free the entire render result, make new, and/or prepare exr buffer saving */ if (re->result == NULL || !(re->r.scemode & R_PREVIEWBUTS)) { render_result_free(re->result); - + if (re->sss_points && render_display_draw_enabled(re)) re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS); else if (re->r.scemode & R_FULL_SAMPLE) re->result = render_result_new_full_sample(re, &re->fullresult, &re->disprect, 0, RR_USE_EXR); else re->result = render_result_new(re, &re->disprect, 0, - (re->r.scemode & R_EXR_TILE_FILE) ? RR_USE_EXR : RR_USE_MEM, RR_ALL_LAYERS); + (re->r.scemode & R_EXR_TILE_FILE) ? RR_USE_EXR : RR_USE_MEM, RR_ALL_LAYERS); } BLI_rw_mutex_unlock(&re->resultmutex); @@ -843,53 +888,46 @@ static void threaded_tile_processor(Render *re) if (re->result->do_exr_tile) render_result_exr_file_begin(re); - BLI_init_threads(&threads, do_part_thread, re->r.threads); - /* assuming no new data gets added to dbase... */ R = *re; /* set threadsafe break */ R.test_break = thread_break; - /* timer loop demands to sleep when no parts are left, so we enter loop with a part */ - if (re->r.mode & R_PANORAMA) - nextpa = find_next_pano_slice(re, &minx, &viewplane); - else - nextpa = find_next_part(re, 0); - - while (rendering) { - - if (re->test_break(re->tbh)) - PIL_sleep_ms(50); - else if (nextpa && BLI_available_threads(&threads)) { - drawtimer = 0; - nextpa->nr = counter++; /* for nicest part, and for stats */ - nextpa->thread = BLI_available_thread_index(&threads); /* sample index */ - BLI_insert_thread(&threads, nextpa); - - nextpa = find_next_part(re, minx); - } - else if (re->r.mode & R_PANORAMA) { - if (nextpa == NULL && BLI_available_threads(&threads) == re->r.threads) - nextpa = find_next_pano_slice(re, &minx, &viewplane); - else { - PIL_sleep_ms(50); - drawtimer++; - } + /* create and fill work queue */ + workqueue = BLI_thread_queue_init(); + donequeue = BLI_thread_queue_init(); + + /* for panorama we loop over slices */ + while (find_next_pano_slice(re, &slice, &minx, &viewplane)) { + /* gather parts into queue */ + while ((pa = find_next_part(re, minx))) { + pa->nr = totpart + 1; /* for nicest part, and for stats */ + totpart++; + BLI_thread_queue_push(workqueue, pa); } - else { - PIL_sleep_ms(50); - drawtimer++; + + BLI_thread_queue_nowait(workqueue); + + /* start all threads */ + BLI_init_threads(&threads, do_render_thread, re->r.threads); + + for (a = 0; a < re->r.threads; a++) { + thread[a].workqueue = workqueue; + thread[a].donequeue = donequeue; + thread[a].number = a; + BLI_insert_thread(&threads, &thread[a]); } - /* check for ready ones to display, and if we need to continue */ - rendering = 0; - hasdrawn = 0; - for (pa = re->parts.first; pa; pa = pa->next) { - if (pa->status == PART_STATUS_READY) { - - BLI_remove_thread(&threads, pa); - + /* wait for results to come back */ + lastdraw = PIL_check_seconds_timer(); + + while (1) { + elapsed = PIL_check_seconds_timer() - lastdraw; + wait = (redrawtime - elapsed)*1000; + + /* handle finished part */ + if ((pa=BLI_thread_queue_pop_timeout(donequeue, wait))) { if (pa->result) { if (render_display_draw_enabled(re)) re->display_draw(re->ddh, pa->result, NULL); @@ -899,27 +937,40 @@ static void threaded_tile_processor(Render *re) pa->result = NULL; re->i.partsdone++; re->progress(re->prh, re->i.partsdone / (float)re->i.totpart); - hasdrawn = 1; } + + totpart--; } - else { - rendering = 1; - if (pa->nr && pa->result && drawtimer > 20) { - if (render_display_draw_enabled(re)) - re->display_draw(re->ddh, pa->result, &pa->result->renrect); - hasdrawn = 1; - } + + /* check for render cancel */ + if ((g_break=re->test_break(re->tbh))) + break; + + /* or done with parts */ + if (totpart == 0) + break; + + /* redraw in progress parts */ + elapsed = PIL_check_seconds_timer() - lastdraw; + if (elapsed > redrawtime) { + if (render_display_draw_enabled(re)) + for (pa = re->parts.first; pa; pa = pa->next) + if ((pa->status == PART_STATUS_IN_PROGRESS) && pa->nr && pa->result) + re->display_draw(re->ddh, pa->result, &pa->result->renrect); + + lastdraw = PIL_check_seconds_timer(); } } - if (hasdrawn) - drawtimer = 0; - - /* on break, wait for all slots to get freed */ - if ( (g_break = re->test_break(re->tbh)) && BLI_available_threads(&threads) == re->r.threads) - rendering = 0; + BLI_end_threads(&threads); + + if ((g_break=re->test_break(re->tbh))) + break; } + BLI_thread_queue_free(donequeue); + BLI_thread_queue_free(workqueue); + if (re->result->do_exr_tile) { BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); render_result_exr_file_end(re); @@ -929,7 +980,6 @@ static void threaded_tile_processor(Render *re) /* unset threadsafety */ g_break = 0; - BLI_end_threads(&threads); RE_parts_free(re); re->viewplane = viewplane; /* restore viewplane, modified by pano render */ } -- cgit v1.2.3 From 815e00917dcb4137f9687ab602f527920fa8c41d Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 21 Feb 2013 18:30:11 +0000 Subject: BGE cleanup: Removing the PHY__Vector classes and replacing them with MT_Vectors. The PHY__Vectors didn't offer anything (not even any real abstraction) and they required annoying MT_Vector <-> PHY_Vector conversions all over the place. No functional changes. --- source/gameengine/Converter/KX_ConvertSensors.cpp | 7 +-- source/gameengine/Ketsji/KX_CharacterWrapper.cpp | 11 +--- source/gameengine/Ketsji/KX_RayCast.cpp | 6 +- source/gameengine/Ketsji/KX_Scene.cpp | 8 +-- source/gameengine/Ketsji/KX_VehicleWrapper.cpp | 15 ++--- source/gameengine/Ketsji/KX_VehicleWrapper.h | 1 - .../Physics/Bullet/CcdGraphicController.cpp | 2 +- .../Physics/Bullet/CcdGraphicController.h | 2 +- .../Physics/Bullet/CcdPhysicsController.cpp | 2 +- .../Physics/Bullet/CcdPhysicsController.h | 2 +- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 22 +++---- .../Physics/Bullet/CcdPhysicsEnvironment.h | 6 +- source/gameengine/Physics/Dummy/CMakeLists.txt | 1 + .../Physics/Dummy/DummyPhysicsEnvironment.cpp | 2 +- .../Physics/Dummy/DummyPhysicsEnvironment.h | 6 +- source/gameengine/Physics/common/CMakeLists.txt | 1 + .../gameengine/Physics/common/PHY_DynamicTypes.h | 71 ++-------------------- source/gameengine/Physics/common/PHY_ICharacter.h | 4 +- .../Physics/common/PHY_IGraphicController.h | 2 +- .../Physics/common/PHY_IPhysicsController.h | 4 +- .../Physics/common/PHY_IPhysicsEnvironment.h | 16 ++--- source/gameengine/Physics/common/PHY_IVehicle.h | 6 +- 22 files changed, 56 insertions(+), 141 deletions(-) diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index 538f9e2c833..acaf911c26e 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -260,14 +260,9 @@ void BL_ConvertSensors(struct Object* blenderobject, // this sumoObject is not deleted by a gameobj, so delete it ourself // later (memleaks)! float radius = blendernearsensor->dist; - PHY__Vector3 pos; const MT_Vector3& wpos = gameobj->NodeGetWorldPosition(); - pos[0] = (float)wpos[0]; - pos[1] = (float)wpos[1]; - pos[2] = (float)wpos[2]; - pos[3] = 0.f; bool bFindMaterial = false; - PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,pos); + PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,wpos); //will be done in KX_TouchEventManager::RegisterSensor() //if (isInActiveLayer) diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp index a669bdd2586..3fbddef89be 100644 --- a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp +++ b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp @@ -113,10 +113,8 @@ PyObject *KX_CharacterWrapper::pyattr_get_jump_count(void *self_v, const KX_PYAT PyObject *KX_CharacterWrapper::pyattr_get_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_CharacterWrapper* self = static_cast(self_v); - PHY__Vector3 vec = self->m_character->GetWalkDirection(); - MT_Vector3 retval = MT_Vector3(vec[0], vec[1], vec[2]); - return PyObjectFrom(retval); + return PyObjectFrom(self->m_character->GetWalkDirection()); } int KX_CharacterWrapper::pyattr_set_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) @@ -128,12 +126,7 @@ int KX_CharacterWrapper::pyattr_set_walk_dir(void *self_v, const KX_PYATTRIBUTE_ return PY_SET_ATTR_FAIL; } - PHY__Vector3 vec; - vec[0] = dir[0]; - vec[1] = dir[1]; - vec[2] = dir[2]; - - self->m_character->SetWalkDirection(vec); + self->m_character->SetWalkDirection(dir); return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp index 2a6b7d122b5..878f9d267dc 100644 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ b/source/gameengine/Ketsji/KX_RayCast.cpp @@ -51,10 +51,10 @@ KX_RayCast::KX_RayCast(KX_IPhysicsController* ignoreController, bool faceNormal, void KX_RayCast::reportHit(PHY_RayCastResult* result) { m_hitFound = true; - m_hitPoint.setValue((const float*)result->m_hitPoint); - m_hitNormal.setValue((const float*)result->m_hitNormal); + m_hitPoint = MT_Vector3(result->m_hitPoint); + m_hitNormal = MT_Vector3(result->m_hitNormal); m_hitUVOK = result->m_hitUVOK; - m_hitUV.setValue((const float*)result->m_hitUV); + m_hitUV = MT_Vector2(result->m_hitUV); m_hitMesh = result->m_meshObject; m_hitPolygon = result->m_polygon; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index bb2f9a8354a..fec275322e9 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1490,7 +1490,7 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int if (m_dbvt_culling) { // test culling through Bullet - PHY__Vector4 planes[6]; + MT_Vector4 planes[6]; // get the clip planes MT_Vector4* cplanes = cam->GetNormalizedClipPlanes(); // and convert @@ -1711,13 +1711,11 @@ void KX_Scene::SetGravity(const MT_Vector3& gravity) MT_Vector3 KX_Scene::GetGravity() { - PHY__Vector3 gravity; - MT_Vector3 vec; + MT_Vector3 gravity; GetPhysicsEnvironment()->getGravity(gravity); - vec = gravity.m_vec; - return vec; + return gravity; } void KX_Scene::SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter) diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp index 9cc91a33886..f189891bf02 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp @@ -59,19 +59,12 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args) PyVecTo(pylistPos,attachPos); PyVecTo(pylistDir,attachDir); PyVecTo(pylistAxleDir,attachAxle); - PHY__Vector3 aPos,aDir,aAxle; - aPos[0] = attachPos[0]; - aPos[1] = attachPos[1]; - aPos[2] = attachPos[2]; - aDir[0] = attachDir[0]; - aDir[1] = attachDir[1]; - aDir[2] = attachDir[2]; - aAxle[0] = -attachAxle[0];//someone reverse some conventions inside Bullet (axle winding) - aAxle[1] = -attachAxle[1]; - aAxle[2] = -attachAxle[2]; + + //someone reverse some conventions inside Bullet (axle winding) + attachAxle = -attachAxle; printf("attempt for addWheel: suspensionRestLength%f wheelRadius %f, hasSteering:%d\n",suspensionRestLength,wheelRadius,hasSteering); - m_vehicle->AddWheel(motionState,aPos,aDir,aAxle,suspensionRestLength,wheelRadius,hasSteering); + m_vehicle->AddWheel(motionState,attachPos,attachDir,attachAxle,suspensionRestLength,wheelRadius,hasSteering); } } else { diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h index ccd666e84f3..c38f57d8b9f 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.h +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.h @@ -7,7 +7,6 @@ #define __KX_VEHICLEWRAPPER_H__ #include "Value.h" -#include "PHY_DynamicTypes.h" class PHY_IVehicle; class PHY_IMotionState; diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp index 36e7b0d482f..3cb80e53e12 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp @@ -55,7 +55,7 @@ void CcdGraphicController::setLocalAabb(const MT_Point3& aabbMin,const MT_Point3 SetGraphicTransform(); } -void CcdGraphicController::setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax) +void CcdGraphicController::setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax) { m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]); m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]); diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h index 72eb699ce5b..064f86040f6 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.h +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h @@ -42,7 +42,7 @@ public: void setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax); void setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax); - virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax); + virtual void setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax); virtual void setLocalAabb(const float aabbMin[3],const float aabbMax[3]); PHY_IMotionState* GetMotionState() { return m_motionState; } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 0de21e33eff..ef43e094e6d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -1092,7 +1092,7 @@ void CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvel { } -void CcdPhysicsController::getPosition(PHY__Vector3& pos) const +void CcdPhysicsController::getPosition(MT_Vector3& pos) const { const btTransform& xform = m_object->getWorldTransform(); pos[0] = xform.getOrigin().x(); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index b271b9c424f..f1f0ca31419 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -524,7 +524,7 @@ protected: virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal); virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal); virtual void setPosition(float posX,float posY,float posZ); - virtual void getPosition(PHY__Vector3& pos) const; + virtual void getPosition(MT_Vector3& pos) const; virtual void setScaling(float scaleX,float scaleY,float scaleZ); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 254624cd8a0..702452bc77e 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -97,9 +97,9 @@ public: virtual void AddWheel( PHY_IMotionState* motionState, - PHY__Vector3 connectionPoint, - PHY__Vector3 downDirection, - PHY__Vector3 axleDirection, + MT_Vector3 connectionPoint, + MT_Vector3 downDirection, + MT_Vector3 axleDirection, float suspensionRestLength, float wheelRadius, bool hasSteering @@ -311,20 +311,16 @@ public: return m_controller->getJumpCount(); } - virtual void SetWalkDirection(PHY__Vector3 dir) + virtual void SetWalkDirection(const MT_Vector3& dir) { btVector3 vec = btVector3(dir[0], dir[1], dir[2]); m_controller->setWalkDirection(vec); } - virtual PHY__Vector3 GetWalkDirection() + virtual MT_Vector3 GetWalkDirection() { btVector3 vec = m_controller->getWalkDirection(); - PHY__Vector3 retval; - retval[0] = vec[0]; - retval[1] = vec[1]; - retval[2] = vec[2]; - return retval; + return MT_Vector3(vec[0], vec[1], vec[2]); } }; @@ -951,7 +947,7 @@ void CcdPhysicsEnvironment::setSolverType(int solverType) -void CcdPhysicsEnvironment::getGravity(PHY__Vector3& grav) +void CcdPhysicsEnvironment::getGravity(MT_Vector3& grav) { const btVector3& gravity = m_dynamicsWorld->getGravity(); grav[0] = gravity.getX(); @@ -1851,7 +1847,7 @@ struct DbvtCullingCallback : btDbvt::ICollide }; static OcclusionBuffer gOcb; -bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) +bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { if (!m_cullingTree) return false; @@ -2362,7 +2358,7 @@ int numController = 0; -PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const PHY__Vector3& position) +PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const MT_Vector3& position) { CcdConstructionInfo cinfo; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index 18ce0550498..8cf88526969 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -140,7 +140,7 @@ protected: virtual void setDebugMode(int debugMode); virtual void setGravity(float x,float y,float z); - virtual void getGravity(PHY__Vector3& grav); + virtual void getGravity(MT_Vector3& grav); virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, @@ -190,7 +190,7 @@ protected: btTypedConstraint* getConstraintById(int constraintId); virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ); - virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]); + virtual bool cullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]); //Methods for gamelogic collision/physics callbacks @@ -200,7 +200,7 @@ protected: virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl); virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl); //These two methods are used *solely* to create controllers for Near/Radar sensor! Don't use for anything else - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position); + virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position); virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight); diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt index 6a21fc6fcb7..529a75b2a62 100644 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ b/source/gameengine/Physics/Dummy/CMakeLists.txt @@ -26,6 +26,7 @@ set(INC . ../common + ../../../../intern/moto/include ) set(INC_SYS diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp index d1fabba18f9..72450e4307c 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp @@ -85,7 +85,7 @@ void DummyPhysicsEnvironment::setGravity(float x,float y,float z) { } -void DummyPhysicsEnvironment::getGravity(PHY__Vector3& grav) +void DummyPhysicsEnvironment::getGravity(class MT_Vector3& grav) { } diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h index 5ce34bdf7cf..9f6bc85fced 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h @@ -56,7 +56,7 @@ public: virtual float getFixedTimeStep(); virtual void setGravity(float x,float y,float z); - virtual void getGravity(PHY__Vector3& grav); + virtual void getGravity(class MT_Vector3& grav); virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, float pivotX,float pivotY,float pivotZ, @@ -80,7 +80,7 @@ public: } virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ); - virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; } + virtual bool cullingTest(PHY_CullingCallback callback, void* userData, class MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; } //gamelogic callbacks @@ -91,7 +91,7 @@ public: } virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl) { return false; } virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl) { return false;} - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) {return 0;} + virtual PHY_IPhysicsController* CreateSphereController(float radius,const class MT_Vector3& position) {return 0;} virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight) { return 0;} virtual void setConstraintParam(int constraintId,int param,float value,float value1) diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt index 400e475f8a2..5e0e5964ca0 100644 --- a/source/gameengine/Physics/common/CMakeLists.txt +++ b/source/gameengine/Physics/common/CMakeLists.txt @@ -26,6 +26,7 @@ set(INC . ../Dummy + ../../../../intern/moto/include ) set(INC_SYS diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h index 0fe2533cf93..d10f48ad7a4 100644 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h @@ -20,69 +20,9 @@ subject to the following restrictions: #ifndef __PHY_DYNAMICTYPES_H__ #define __PHY_DYNAMICTYPES_H__ - +#include "MT_Vector3.h" struct KX_ClientObjectInfo; -class PHY_Shape; - -struct PHY__Vector2 -{ - float m_vec[2]; - - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; - -struct PHY__Vector3 -{ - float m_vec[4]; - - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; - -struct PHY__Vector4 -{ - float m_vec[4]; - PHY__Vector4() {} - void setValue(const float *value) - { - m_vec[0] = *value++; - m_vec[1] = *value++; - m_vec[2] = *value++; - m_vec[3] = *value++; - } - void setValue(const double *value) - { - m_vec[0] = (float)(*value++); - m_vec[1] = (float)(*value++); - m_vec[2] = (float)(*value++); - m_vec[3] = (float)(*value++); - } - - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; - -//typedef float PHY__Vector3[4]; enum { @@ -97,9 +37,9 @@ enum }; typedef struct PHY_CollData { - PHY__Vector3 m_point1; /* Point in object1 in world coordinates */ - PHY__Vector3 m_point2; /* Point in object2 in world coordinates */ - PHY__Vector3 m_normal; /* point2 - point1 */ + MT_Vector3 m_point1; /* Point in object1 in world coordinates */ + MT_Vector3 m_point2; /* Point in object2 in world coordinates */ + MT_Vector3 m_normal; /* point2 - point1 */ } PHY_CollData; @@ -148,7 +88,4 @@ typedef enum PHY_ShapeType { PHY_SHAPE_PROXY } PHY_ShapeType; - -typedef float PHY_Vector3[3]; - #endif /* __PHY_DYNAMICTYPES_H__ */ diff --git a/source/gameengine/Physics/common/PHY_ICharacter.h b/source/gameengine/Physics/common/PHY_ICharacter.h index 8a599452816..a3d3000a143 100644 --- a/source/gameengine/Physics/common/PHY_ICharacter.h +++ b/source/gameengine/Physics/common/PHY_ICharacter.h @@ -28,8 +28,8 @@ public: virtual int GetJumpCount()= 0; - virtual void SetWalkDirection(PHY__Vector3 dir)=0; - virtual PHY__Vector3 GetWalkDirection()=0; + virtual void SetWalkDirection(const class MT_Vector3& dir)=0; + virtual MT_Vector3 GetWalkDirection()=0; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_ICharacter") diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h index fb36481ddbc..8c38eebe283 100644 --- a/source/gameengine/Physics/common/PHY_IGraphicController.h +++ b/source/gameengine/Physics/common/PHY_IGraphicController.h @@ -48,7 +48,7 @@ class PHY_IGraphicController : public PHY_IController */ virtual bool SetGraphicTransform()=0; virtual void Activate(bool active=true)=0; - virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax)=0; + virtual void setLocalAabb(const class MT_Vector3& aabbMin,const class MT_Vector3& aabbMax)=0; virtual void setLocalAabb(const float* aabbMin,const float* aabbMax)=0; virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate) {return 0;} diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h index 871edeec752..e6f26bc5b1b 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h @@ -66,7 +66,7 @@ class PHY_IPhysicsController : public PHY_IController virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0; virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0; virtual void setPosition(float posX,float posY,float posZ)=0; - virtual void getPosition(PHY__Vector3& pos) const=0; + virtual void getPosition(class MT_Vector3& pos) const=0; virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0; // physics methods @@ -100,7 +100,7 @@ class PHY_IPhysicsController : public PHY_IController virtual float GetLinVelocityMax() const=0; virtual void SetLinVelocityMax(float val) = 0; - PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos); + class MT_Vector3 GetWorldPosition(class MT_Vector3& localpos); #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 6a76745c7ca..e7560ea02cc 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -32,8 +32,10 @@ #ifndef __PHY_IPHYSICSENVIRONMENT_H__ #define __PHY_IPHYSICSENVIRONMENT_H__ -#include #include "PHY_DynamicTypes.h" +#include "MT_Vector2.h" +#include "MT_Vector3.h" +#include "MT_Vector4.h" #ifdef WITH_CXX_GUARDEDALLOC #include "MEM_guardedalloc.h" @@ -50,13 +52,13 @@ class PHY_IPhysicsController; struct PHY_RayCastResult { PHY_IPhysicsController* m_controller; - PHY__Vector3 m_hitPoint; - PHY__Vector3 m_hitNormal; + MT_Vector3 m_hitPoint; + MT_Vector3 m_hitNormal; const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers) int m_polygon; // index of the polygon hit by the ray, // only if m_meshObject != NULL int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid - PHY__Vector2 m_hitUV; // UV coordinates of hit point + MT_Vector2 m_hitUV; // UV coordinates of hit point }; /** @@ -144,7 +146,7 @@ class PHY_IPhysicsEnvironment virtual void setUseEpa(bool epa) {} virtual void setGravity(float x,float y,float z)=0; - virtual void getGravity(PHY__Vector3& grav) = 0; + virtual void getGravity(MT_Vector3& grav) = 0; virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, float pivotX,float pivotY,float pivotZ, @@ -167,7 +169,7 @@ class PHY_IPhysicsEnvironment //culling based on physical broad phase // the plane number must be set as follow: near, far, left, right, top, botton // the near plane must be the first one and must always be present, it is used to get the direction of the view - virtual bool cullingTest(PHY_CullingCallback callback, void *userData, PHY__Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0; + virtual bool cullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0; //Methods for gamelogic collision/physics callbacks //todo: @@ -177,7 +179,7 @@ class PHY_IPhysicsEnvironment virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl)=0; virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl)=0; //These two methods are *solely* used to create controllers for sensor! Don't use for anything else - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) =0; + virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position) =0; virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0; virtual void setConstraintParam(int constraintId,int param,float value,float value1) = 0; diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h index ecf7a87c40f..624f435c9f0 100644 --- a/source/gameengine/Physics/common/PHY_IVehicle.h +++ b/source/gameengine/Physics/common/PHY_IVehicle.h @@ -22,9 +22,9 @@ public: virtual void AddWheel( PHY_IMotionState* motionState, - PHY__Vector3 connectionPoint, - PHY__Vector3 downDirection, - PHY__Vector3 axleDirection, + MT_Vector3 connectionPoint, + MT_Vector3 downDirection, + MT_Vector3 axleDirection, float suspensionRestLength, float wheelRadius, bool hasSteering -- cgit v1.2.3 From 822a06920b40eb9597115b959b3aeb26642cfce3 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Thu, 21 Feb 2013 19:04:34 +0000 Subject: rigidbody: Move "Enabled" checkbox out of rigid body panel header Rename it to "Dynamic" to make it more obvious that it switches between static and dynamic state. Also don't show it for passive rigid bodies since it's redundant in that case. --- release/scripts/startup/bl_ui/properties_physics_rigidbody.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py index 922eee66ddc..d7ed7bb4d1a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py @@ -36,12 +36,6 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel): return (obj and obj.rigid_body and (not context.scene.render.use_game_engine)) - def draw_header(self, context): - obj = context.object - rbo = obj.rigid_body - if rbo is not None: - self.layout.prop(rbo, "enabled", text="") - def draw(self, context): layout = self.layout @@ -50,7 +44,10 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel): if rbo is not None: layout.prop(rbo, "type", text="Type") - layout.prop(rbo, "kinematic", text="Animated") + row = layout.row() + if rbo.type == 'ACTIVE': + row.prop(rbo, "enabled", text="Dynamic") + row.prop(rbo, "kinematic", text="Animated") if rbo.type == 'ACTIVE': layout.prop(rbo, "mass") -- cgit v1.2.3 From 9c08d1c6493793b4032ea3d3ce791f1c268687d2 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Thu, 21 Feb 2013 19:04:36 +0000 Subject: rigidbody: code cleanup Use bpy.data.objects.new() instead of the object.add() operator. --- release/scripts/startup/bl_operators/rigidbody.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 420e7661789..9ff786a7b9d 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -146,7 +146,7 @@ class BakeToKeyframes(Operator): # this is a little roundabout but there's no better way right now aa = mat.to_quaternion().to_axis_angle() obj.rotation_axis_angle = (aa[1], ) + aa[0][:] - else: # euler + else: # euler # make sure euler rotation is compatible to previous frame obj.rotation_euler = mat.to_euler(rot_mode, obj_prev.rotation_euler) @@ -235,11 +235,13 @@ class ConnectRigidBodies(Operator): loc = obj.location else: loc = (obj_act.location + obj.location) / 2.0 - # TODO: use bpy.data.objects.new(...) - bpy.ops.object.add(type='EMPTY', - view_align=False, - enter_editmode=False, - location=loc) + + ob = bpy.data.objects.new("Constraint", object_data=None) + ob.location = loc + context.scene.objects.link(ob) + context.scene.objects.active = ob + ob.select = True + bpy.ops.rigidbody.constraint_add() con_obj = context.active_object con_obj.empty_draw_type = 'ARROWS' -- cgit v1.2.3 From 09b124fbd358c18ee826d7e1df4c553452835754 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Thu, 21 Feb 2013 19:04:39 +0000 Subject: rigidbody: Add option to create chanis for the connect operator Connects objects based on distance. Based on a patch by Brandon Hechinger (jaggz), thanks! --- release/scripts/startup/bl_operators/rigidbody.py | 83 +++++++++++++++-------- 1 file changed, 56 insertions(+), 27 deletions(-) diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 9ff786a7b9d..bfb23c3249b 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -192,8 +192,7 @@ class BakeToKeyframes(Operator): class ConnectRigidBodies(Operator): - """Create rigid body constraints between """ \ - """selected and active rigid bodies""" + '''Create rigid body constraints between selected rigid bodies''' bl_idname = "rigidbody.connect" bl_label = "Connect Rigid Bodies" bl_options = {'REGISTER', 'UNDO'} @@ -214,42 +213,72 @@ class ConnectRigidBodies(Operator): ('SELECTED', "Selected", "Pivot location is at the selected object position")), default='CENTER',) + connection_pattern = EnumProperty( + name="Connection Pattern", + description="Pattern used to connect objects", + items=(('SELECTED_TO_ACTIVE', "Selected to Active", "Connects selected objects to the active object"), + ('CHAIN_DISTANCE', "Chain by Distance", "Connects objects as a chain based on distance, starting at the active object")), + default='SELECTED_TO_ACTIVE',) + @classmethod def poll(cls, context): obj = context.object return (obj and obj.rigid_body) - def execute(self, context): + def _add_constraint(self, context, object1, object2): + if object1 == object2: + return False + + if self.pivot_type == 'ACTIVE': + loc = object1.location + elif self.pivot_type == 'SELECTED': + loc = object2.location + else: + loc = (object1.location + object2.location) / 2.0 + + ob = bpy.data.objects.new("Constraint", object_data=None) + ob.location = loc + context.scene.objects.link(ob) + context.scene.objects.active = ob + ob.select = True + + bpy.ops.rigidbody.constraint_add() + con_obj = context.active_object + con_obj.empty_draw_type = 'ARROWS' + con = con_obj.rigid_body_constraint + con.type = self.con_type + + con.object1 = object1 + con.object2 = object2 + return True + + def execute(self, context): scene = context.scene objects = context.selected_objects obj_act = context.active_object change = False - for obj in objects: - if obj == obj_act: - continue - if self.pivot_type == 'ACTIVE': - loc = obj_act.location - elif self.pivot_type == 'SELECTED': - loc = obj.location - else: - loc = (obj_act.location + obj.location) / 2.0 - - ob = bpy.data.objects.new("Constraint", object_data=None) - ob.location = loc - context.scene.objects.link(ob) - context.scene.objects.active = ob - ob.select = True - - bpy.ops.rigidbody.constraint_add() - con_obj = context.active_object - con_obj.empty_draw_type = 'ARROWS' - con = con_obj.rigid_body_constraint - con.type = self.con_type - con.object1 = obj_act - con.object2 = obj - change = True + if self.connection_pattern == 'CHAIN_DISTANCE': + objs_sorted = [obj_act] + objects_tmp = context.selected_objects + if obj_act.select: + objects_tmp.remove(obj_act) + objects_tmp.sort(key=lambda o: (obj_act.location - o.location).length) + last_obj = obj_act + + while (len(objects_tmp)): + objects_tmp.sort(key=lambda o: (last_obj.location - o.location).length) + objs_sorted.append(objects_tmp[0]) + last_obj = objects_tmp[0] + objects_tmp.remove(objects_tmp[0]) + + for i in range(1, len(objs_sorted)): + change = self._add_constraint(context, objs_sorted[i-1], objs_sorted[i]) + + else: # SELECTED_TO_ACTIVE + for obj in objects: + change = self._add_constraint(context, obj_act, obj) if change: # restore selection -- cgit v1.2.3 From 074565330db93ceb2304247f9bf6499b05cb3b80 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Thu, 21 Feb 2013 19:23:41 +0000 Subject: Fix scons compile --- source/gameengine/Physics/Dummy/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/Physics/Dummy/SConscript b/source/gameengine/Physics/Dummy/SConscript index 95b777b61be..15a68ad4e85 100644 --- a/source/gameengine/Physics/Dummy/SConscript +++ b/source/gameengine/Physics/Dummy/SConscript @@ -29,7 +29,7 @@ Import ('env') sources = 'DummyPhysicsEnvironment.cpp' -incs = '. ../common' +incs = '. ../common ../../../../intern/moto/include' defs = [] -- cgit v1.2.3 From 20220d47e38c4ad22ad89481fd40b804cc2fd1ef Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Feb 2013 19:33:04 +0000 Subject: Dependency Graph: some refactoring which should have no user visible impact besides performance in some cases. * DAG_scene_sort is now removed and replaced by DAG_relations_tag_update in most cases. This will clear the dependency graph, and only rebuild it right before it's needed again when the scene is re-evaluated. This is done because DAG_scene_sort is slow when called many times from python operators. Further the scene argument is not needed because most operations can potentially affect more than the current scene. * DAG_scene_relations_update will now rebuild the dependency graph if it's not there yet, and DAG_scene_relations_rebuild will force a rebuild for the rare cases that need it. * Remove various places where ob->recalc was set manually. This should go through DAG_id_tag_update() in nearly all cases instead since this is now a fast operation. Also removed DAG_ids_flush_update that goes along with such manual tagging of ob->recalc. --- source/blender/blenkernel/BKE_depsgraph.h | 15 +++-- source/blender/blenkernel/intern/anim.c | 2 +- source/blender/blenkernel/intern/blender.c | 3 +- source/blender/blenkernel/intern/constraint.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 57 +++++++++++------ source/blender/blenkernel/intern/object.c | 35 +++++----- source/blender/blenkernel/intern/particle.c | 6 +- source/blender/blenkernel/intern/scene.c | 19 +++--- source/blender/blenloader/intern/readfile.c | 6 +- source/blender/collada/AnimationImporter.cpp | 6 +- source/blender/collada/ArmatureExporter.h | 1 - source/blender/collada/DocumentImporter.cpp | 14 ++-- source/blender/collada/SkinInfo.cpp | 5 +- source/blender/collada/collada_utils.cpp | 12 ++-- source/blender/editors/animation/drivers.c | 4 -- source/blender/editors/animation/keyframing.c | 26 +------- source/blender/editors/animation/keyingsets.c | 7 +- source/blender/editors/armature/editarmature.c | 4 +- source/blender/editors/curve/editcurve.c | 4 +- .../editors/interface/interface_templates.c | 3 +- source/blender/editors/mesh/editmesh_tools.c | 6 +- source/blender/editors/mesh/meshtools.c | 2 +- source/blender/editors/object/object_add.c | 38 +++++------ source/blender/editors/object/object_constraint.c | 17 ++--- source/blender/editors/object/object_edit.c | 24 ++++--- source/blender/editors/object/object_group.c | 10 +-- source/blender/editors/object/object_hook.c | 2 +- source/blender/editors/object/object_modifier.c | 18 ++---- source/blender/editors/object/object_relations.c | 74 ++++++++-------------- source/blender/editors/object/object_transform.c | 7 -- source/blender/editors/physics/dynamicpaint_ops.c | 2 +- source/blender/editors/physics/particle_boids.c | 6 +- source/blender/editors/physics/particle_object.c | 9 +-- .../blender/editors/physics/rigidbody_constraint.c | 6 +- source/blender/editors/physics/rigidbody_object.c | 8 --- source/blender/editors/space_graph/graph_buttons.c | 5 +- .../blender/editors/space_outliner/outliner_edit.c | 14 ++-- .../editors/space_outliner/outliner_tools.c | 14 +--- source/blender/editors/space_view3d/view3d_snap.c | 12 ++-- .../editors/transform/transform_conversions.c | 2 + source/blender/makesdna/DNA_scene_types.h | 5 +- source/blender/makesrna/intern/rna_boid.c | 4 +- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_dynamicpaint.c | 2 +- source/blender/makesrna/intern/rna_fcurve.c | 2 +- source/blender/makesrna/intern/rna_modifier.c | 2 +- source/blender/makesrna/intern/rna_object.c | 8 +-- source/blender/makesrna/intern/rna_object_force.c | 6 +- source/blender/makesrna/intern/rna_particle.c | 6 +- source/blender/makesrna/intern/rna_pose.c | 4 +- source/blender/makesrna/intern/rna_scene.c | 8 +-- source/blender/makesrna/intern/rna_smoke.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 3 +- 53 files changed, 234 insertions(+), 327 deletions(-) diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 49dc1bfd732..eaf19f8dd08 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -99,8 +99,16 @@ int is_acyclic(struct DagForest *dag); /* ********** API *************** */ /* Note that the DAG never executes changes in Objects, only sets flags in Objects */ -/* (re)-create dependency graph for scene */ -void DAG_scene_sort(struct Main *bmain, struct Scene *sce); +/* clear all dependency graphs, call this when changing relations between objects. + * the dependency graphs will be rebuilt just before they are used to avoid them + * getting rebuild many times during operators */ +void DAG_relations_tag_update(struct Main *bmain); + +/* (re)-create the dependency graph before using it */ +void DAG_scene_relations_update(struct Main *bmain, struct Scene *sce); + +/* force an immediate rebuild of the dependency graph, only needed in rare cases */ +void DAG_scene_relations_rebuild(struct Main *bmain, struct Scene *scene); /* flag all objects that need recalc because they're animated */ void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time); @@ -109,9 +117,6 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned i /* tag objects for update on file load */ void DAG_on_visible_update(struct Main *bmain, const short do_time); -/* when setting manual RECALC flags, call this afterwards */ -void DAG_ids_flush_update(struct Main *bmain, int time); - /* tag datablock to get updated for the next redraw */ void DAG_id_tag_update(struct ID *id, short flag); /* flush all tagged updates */ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index a6b3008e00a..50fe1f7a433 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -320,7 +320,7 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) } /* "brew me a list that's sorted a bit faster now depsy" */ - DAG_scene_sort(G.main, scene); + DAG_scene_relations_rebuild(G.main, scene); } /* update scene for current frame */ diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index fb2d1a3aaf7..be316197078 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -1000,8 +1000,7 @@ int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports) flag_all_listbases_ids(LIB_PRE_EXISTING, 0); /* recreate dependency graph to include new objects */ - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); BLO_blendhandle_close(bh); /* remove library... */ diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 1a25def3829..48ad3f51389 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -4261,7 +4261,7 @@ static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isRe /* Free data of a specific constraint if it has any info. * be sure to run BIK_clear_data() when freeing an IK constraint, - * unless DAG_scene_sort is called. + * unless DAG_relations_tag_update is called. */ void BKE_free_constraint_data(bConstraint *con) { diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 99d0c5ed964..56600069aa0 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -837,7 +837,6 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask) DagAdjList *itA; dag = sce->theDag; - sce->dagisvalid = 1; if (dag) free_forest(dag); else { @@ -1846,8 +1845,18 @@ static void scene_sort_groups(Main *bmain, Scene *sce) } } +/* free the depency graph */ +static void dag_scene_free(Scene *sce) +{ + if (sce->theDag) { + free_forest(sce->theDag); + MEM_freeN(sce->theDag); + sce->theDag = NULL; + } +} + /* sort the base list on dependency order */ -void DAG_scene_sort(Main *bmain, Scene *sce) +static void dag_scene_build(Main *bmain, Scene *sce) { DagNode *node, *rootnode; DagNodeQueue *nqueue; @@ -1856,7 +1865,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce) int skip = 0; ListBase tempbase; Base *base; - + tempbase.first = tempbase.last = NULL; build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA); @@ -1936,10 +1945,34 @@ void DAG_scene_sort(Main *bmain, Scene *sce) printf(" %s\n", base->object->id.name); } } + /* temporal...? */ sce->recalc |= SCE_PRV_CHANGED; /* test for 3d preview */ } +/* clear all dependency graphs */ +void DAG_relations_tag_update(Main *bmain) +{ + Scene *sce; + + for (sce = bmain->scene.first; sce; sce = sce->id.next) + dag_scene_free(sce); +} + +/* rebuild dependency graph only for a given scene */ +void DAG_scene_relations_rebuild(Main *bmain, Scene *sce) +{ + dag_scene_free(sce); + DAG_scene_relations_update(bmain, sce); +} + +/* create dependency graph if it was cleared or didn't exist yet */ +void DAG_scene_relations_update(Main *bmain, Scene *sce) +{ + if (!sce->theDag) + dag_scene_build(bmain, sce); +} + static void lib_id_recalc_tag(Main *bmain, ID *id) { id->flag |= LIB_ID_RECALC; @@ -2177,7 +2210,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho if (sce->theDag == NULL) { printf("DAG zero... not allowed to happen!\n"); - DAG_scene_sort(bmain, sce); + DAG_scene_relations_update(bmain, sce); } firstnode = sce->theDag->DagNode.first; /* always scene node */ @@ -2545,20 +2578,6 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb) } } -void DAG_ids_flush_update(Main *bmain, int time) -{ - ListBase listbase; - DagSceneLayer *dsl; - - /* get list of visible scenes and layers */ - dag_current_scene_layers(bmain, &listbase); - - for (dsl = listbase.first; dsl; dsl = dsl->next) - DAG_scene_flush_update(bmain, dsl->scene, dsl->layer, time); - - BLI_freelistN(&listbase); -} - void DAG_on_visible_update(Main *bmain, const short do_time) { ListBase listbase; @@ -3169,7 +3188,7 @@ void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob) } else { printf("\nDEPENDENCY RELATIONS for %s\n\n", scene->id.name + 2); - DAG_scene_sort(bmain, scene); + DAG_scene_relations_rebuild(bmain, scene); } dag_print_dependencies = 0; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 58b47398a7d..95b1809bbae 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -74,6 +74,7 @@ #include "BKE_bullet.h" #include "BKE_colortools.h" #include "BKE_deform.h" +#include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_animsys.h" #include "BKE_anim.h" @@ -406,7 +407,8 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec if (*obpoin == unlinkOb) { *obpoin = NULL; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; // XXX: should this just be OB_RECALC_DATA? + // XXX: should this just be OB_RECALC_DATA? + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } } @@ -440,14 +442,14 @@ void BKE_object_unlink(Object *ob) obt->proxy = NULL; if (obt->proxy_from == ob) { obt->proxy_from = NULL; - obt->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&obt->id, OB_RECALC_OB); } if (obt->proxy_group == ob) obt->proxy_group = NULL; if (obt->parent == ob) { obt->parent = NULL; - obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob); @@ -457,15 +459,15 @@ void BKE_object_unlink(Object *ob) if (cu->bevobj == ob) { cu->bevobj = NULL; - obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } if (cu->taperobj == ob) { cu->taperobj = NULL; - obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } if (cu->textoncurve == ob) { cu->textoncurve = NULL; - obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } } else if (obt->type == OB_ARMATURE && obt->pose) { @@ -483,7 +485,7 @@ void BKE_object_unlink(Object *ob) if (ct->tar == ob) { ct->tar = NULL; ct->subtarget[0] = '\0'; - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); } } @@ -497,7 +499,7 @@ void BKE_object_unlink(Object *ob) } else if (ELEM(OB_MBALL, ob->type, obt->type)) { if (BKE_mball_is_basis_for(obt, ob)) - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); } sca_remove_ob_poin(obt, ob); @@ -514,7 +516,7 @@ void BKE_object_unlink(Object *ob) if (ct->tar == ob) { ct->tar = NULL; ct->subtarget[0] = '\0'; - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); } } @@ -526,12 +528,12 @@ void BKE_object_unlink(Object *ob) /* object is deflector or field */ if (ob->pd) { if (obt->soft) - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); /* cloth */ for (md = obt->modifiers.first; md; md = md->next) if (md->type == eModifierType_Cloth) - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); } /* strips */ @@ -560,14 +562,14 @@ void BKE_object_unlink(Object *ob) for (; pt; pt = pt->next) { if (pt->ob == ob) { pt->ob = NULL; - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); break; } } if (tpsys->target_ob == ob) { tpsys->target_ob = NULL; - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); } if (tpsys->part->dup_ob == ob) @@ -602,7 +604,7 @@ void BKE_object_unlink(Object *ob) } } if (ob->pd) - obt->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obt->id, OB_RECALC_DATA); } obt = obt->id.next; @@ -970,7 +972,7 @@ Object *BKE_object_add(struct Scene *scene, int type) base = BKE_scene_base_add(scene, ob); BKE_scene_base_deselect_all(scene); BKE_scene_base_select(scene, base); - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); return ob; } @@ -1480,7 +1482,8 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob) ob->proxy_group = gob; id_lib_extern(&target->id); - ob->recalc = target->recalc = OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DAG_id_tag_update(&target->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* copy transform * - gob means this proxy comes from a group, just apply the matrix diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index c01ea4e518d..f90fde983aa 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3509,12 +3509,12 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->flag = PSYS_ENABLED | PSYS_CURRENT; psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1); - DAG_scene_sort(G.main, scene); + DAG_relations_tag_update(G.main); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); return md; } -void object_remove_particle_system(Scene *scene, Object *ob) +void object_remove_particle_system(Scene *UNUSED(scene), Object *ob) { ParticleSystem *psys = psys_get_current(ob); ParticleSystemModifierData *psmd; @@ -3552,7 +3552,7 @@ void object_remove_particle_system(Scene *scene, Object *ob) else ob->mode &= ~OB_MODE_PARTICLE_EDIT; - DAG_scene_sort(G.main, scene); + DAG_relations_tag_update(G.main); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } static void default_particle_settings(ParticleSettings *part) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 279c321d371..9a1a146c271 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -649,12 +649,11 @@ void BKE_scene_set_background(Main *bmain, Scene *scene) } /* sort baselist */ - DAG_scene_sort(bmain, scene); + DAG_scene_relations_rebuild(bmain, scene); /* ensure dags are built for sets */ - for (sce = scene->set; sce; sce = sce->set) - if (sce->theDag == NULL) - DAG_scene_sort(bmain, sce); + for (sce = scene; sce; sce = sce->set) + DAG_scene_relations_update(bmain, sce); /* copy layers and flags from bases to objects */ for (base = scene->base.first; base; base = base->next) { @@ -1150,9 +1149,15 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* this is called in main loop, doing tagged updates before redraw */ void BKE_scene_update_tagged(Main *bmain, Scene *scene) { + Scene *sce_iter; + /* keep this first */ BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); + /* (re-)build dependency graph if needed */ + for (sce_iter = scene; sce_iter; sce_iter = sce_iter->set) + DAG_scene_relations_update(bmain, sce_iter); + /* flush recalc flags to dependencies */ DAG_ids_flush_tagged(bmain); @@ -1203,10 +1208,8 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* clear animation overrides */ /* XXX TODO... */ - for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set) { - if (sce_iter->theDag == NULL) - DAG_scene_sort(bmain, sce_iter); - } + for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set) + DAG_scene_relations_update(bmain, sce_iter); /* flush recalc flags to dependencies, if we were only changing a frame * this would not be necessary, but if a user or a script has modified diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4471e45be1d..0e799b3d951 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -117,6 +117,7 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_deform.h" +#include "BKE_depsgraph.h" #include "BKE_effect.h" #include "BKE_fcurve.h" #include "BKE_global.h" // for G @@ -2754,7 +2755,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) } if (rebuild) { - ob->recalc = (OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); pose->flag |= POSE_RECALC; } } @@ -5115,7 +5116,6 @@ static void direct_link_scene(FileData *fd, Scene *sce) RigidBodyWorld *rbw; sce->theDag = NULL; - sce->dagisvalid = 0; sce->obedit = NULL; sce->stats = NULL; sce->fps_info = NULL; @@ -10114,7 +10114,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene) base = BKE_scene_base_add(scene, ob); base->flag |= SELECT; base->object->flag= base->flag; - ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); scene->basact = base; /* assign the group */ diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 943c4fb574d..60188071832 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -1888,7 +1888,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No job->lay = BKE_scene_base_find(scene, job)->lay = 2; mul_v3_fl(job->size, 0.5f); - job->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&job->id, OB_RECALC_OB); verify_adt_action((ID *)&job->id, 1); @@ -1909,14 +1909,14 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No if (par_job) { job->parent = par_job; - par_job->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&par_job->id, OB_RECALC_OB); job->parsubstr[0] = 0; } BKE_object_where_is_calc(scene, job); // after parenting and layer change - DAG_scene_sort(CTX_data_main(C), scene); + DAG_relations_tag_update(CTX_data_main(C)); joint_objects[node->getUniqueId()] = job; } diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index 6222496a9f7..931cc5d2988 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -70,7 +70,6 @@ public: //void operator()(Object *ob); private: - Scene *scene; UnitConverter converter; const ExportSettings *export_settings; diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 17a1c7f1e18..2b906fa9ac2 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -230,8 +230,7 @@ void DocumentImporter::finish() } // update scene - DAG_scene_sort(bmain, sce); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL); } @@ -242,8 +241,7 @@ void DocumentImporter::finish() armature_importer.set_tags_map(this->uid_tags_map); armature_importer.make_armatures(mContext); armature_importer.make_shape_keys(); - DAG_scene_sort(bmain, sce); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); #if 0 armature_importer.fix_animation(); @@ -277,8 +275,7 @@ void DocumentImporter::finish() } libnode_ob.clear(); - DAG_scene_sort(bmain, sce); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); } } @@ -389,7 +386,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod fprintf(stderr, "create under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL); Object *obn = BKE_object_copy(source_ob); - obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); BKE_scene_base_add(sce, obn); if (instance_node) { @@ -416,8 +413,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod anim_importer.read_node_transform(source_node, obn); } - /*DAG_scene_sort(CTX_data_main(mContext), sce); - DAG_ids_flush_update(CTX_data_main(mContext), 0);*/ + /*DAG_relations_tag_update(CTX_data_main(mContext));*/ COLLADAFW::NodePointerArray &children = source_node->getChildNodes(); if (children.getCount()) { diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index 470f663f716..15320a8f221 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -237,10 +237,9 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::mapparentinv, workob.obmat); - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; + DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA); - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); #endif diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 45db8510cbb..f43878943c1 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -85,7 +85,6 @@ int bc_test_parent_loop(Object *par, Object *ob) int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) { Object workob; - Main *bmain = CTX_data_main(C); Scene *sce = CTX_data_scene(C); if (!par || bc_test_parent_loop(par, ob)) @@ -113,12 +112,11 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) BKE_object_workob_calc_parent(sce, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; - par->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); + DAG_id_tag_update(&par->id, OB_RECALC_OB); /** done once after import - DAG_scene_sort(bmain, sce); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); */ @@ -132,7 +130,7 @@ Object *bc_add_object(Scene *scene, int type, const char *name) ob->data = BKE_object_obdata_add_from_type(type); ob->lay = scene->lay; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); BKE_scene_base_select(scene, BKE_scene_base_add(scene, ob)); @@ -367,4 +365,4 @@ void bc_match_scale(std::vector *objects_done, BKE_object_apply_mat4(ob, ob->obmat, 0, 0); } -} \ No newline at end of file +} diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 25833c13925..cd5e873f40d 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -489,8 +489,6 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) /* send updates */ uiContextAnimUpdate(C); - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } @@ -541,8 +539,6 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) /* send updates */ uiContextAnimUpdate(C); - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index c99f939300e..6d1e6eab26b 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1215,7 +1215,6 @@ static int modify_key_op_poll(bContext *C) static int insert_key_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks = NULL; int type = RNA_enum_get(op->ptr, "type"); @@ -1261,9 +1260,6 @@ static int insert_key_exec(bContext *C, wmOperator *op) else BKE_report(op->reports, RPT_WARNING, "Keying set failed to insert any keyframes"); - /* send updates */ - DAG_ids_flush_update(bmain, 0); - return OPERATOR_FINISHED; } @@ -1371,7 +1367,6 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot) static int delete_key_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks = NULL; int type = RNA_enum_get(op->ptr, "type"); @@ -1417,9 +1412,6 @@ static int delete_key_exec(bContext *C, wmOperator *op) else BKE_report(op->reports, RPT_WARNING, "Keying set failed to remove any keyframes"); - /* send updates */ - DAG_ids_flush_update(bmain, 0); - return OPERATOR_FINISHED; } @@ -1459,8 +1451,6 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot) static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); - CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { /* just those in active action... */ @@ -1505,12 +1495,11 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op)) } /* update... */ - ob->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; /* send updates */ - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL); return OPERATOR_FINISHED; @@ -1536,7 +1525,6 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot) static int delete_key_v3d_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); float cfra = (float)CFRA; @@ -1563,12 +1551,11 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op) /* report success (or failure) */ BKE_reportf(op->reports, RPT_INFO, "Object '%s' successfully had %d keyframes removed", id->name + 2, success); - ob->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; /* send updates */ - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL); return OPERATOR_FINISHED; @@ -1596,7 +1583,6 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot) static int insert_key_button_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = {{NULL}}; PropertyRNA *prop = NULL; @@ -1655,8 +1641,6 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) /* send updates */ uiContextAnimUpdate(C); - DAG_ids_flush_update(bmain, 0); - /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } @@ -1686,7 +1670,6 @@ void ANIM_OT_keyframe_insert_button(wmOperatorType *ot) static int delete_key_button_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = {{NULL}}; PropertyRNA *prop = NULL; @@ -1728,8 +1711,6 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) /* send updates */ uiContextAnimUpdate(C); - DAG_ids_flush_update(bmain, 0); - /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } @@ -1760,7 +1741,6 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot) static int clear_key_button_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); PointerRNA ptr = {{NULL}}; PropertyRNA *prop = NULL; char *path; @@ -1800,8 +1780,6 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) /* send updates */ uiContextAnimUpdate(C); - DAG_ids_flush_update(bmain, 0); - /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 28db7bf572d..4e8d7bdafe5 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -289,7 +289,6 @@ void ANIM_OT_keying_set_path_remove(wmOperatorType *ot) static int add_keyingset_button_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop = NULL; @@ -360,7 +359,6 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL); /* show notification/report header, so that users notice that something changed */ @@ -392,7 +390,6 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot) static int remove_keyingset_button_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop = NULL; @@ -442,7 +439,6 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL); /* show warning */ @@ -1006,7 +1002,8 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe { Object *ob = (Object *)ksp->id; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; // XXX: only object transforms only? + // XXX: only object transforms? + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } break; } diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 06e00cd02c1..2eac6ba87ee 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1004,7 +1004,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); /* because we removed object(s) */ + DAG_relations_tag_update(bmain); /* because we removed object(s) */ ED_armature_from_edit(ob); ED_armature_edit_free(ob); @@ -1217,7 +1217,7 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op)) /* 2) duplicate base */ newbase = ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); newob = newbase->object; newbase->flag &= ~SELECT; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index e736c494add..b5aa55dbda9 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1395,7 +1395,7 @@ static int separate_exec(bContext *C, wmOperator *op) /* 1. duplicate the object and data */ newbase = ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); ED_base_object_select(newbase, BA_DESELECT); newob = newbase->object; @@ -6218,7 +6218,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) cu = ob->data; BLI_movelisttolist(&cu->nurb, &tempbase); - DAG_scene_sort(bmain, scene); // because we removed object(s), call before editmode! + DAG_relations_tag_update(bmain); // because we removed object(s), call before editmode! ED_object_enter_editmode(C, EM_WAITCURSOR); ED_object_exit_editmode(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8e4d0289f78..adc40288777 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1048,9 +1048,8 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event) case B_CONSTRAINT_CHANGETARGET: { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); if (ob->pose) ob->pose->flag |= POSE_RECALC; /* checks & sorts pose channels */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); break; } #endif diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index ee1d19de7b0..1448b53d997 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2389,7 +2389,7 @@ static void shape_propagate(BMEditMesh *em, wmOperator *op) //TAG Mesh Objects that share this data for (base = scene->base.first; base; base = base->next) { if (base->object && base->object->data == me) { - base->object->recalc = OB_RECALC_DATA; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } } #endif @@ -3042,7 +3042,7 @@ static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE); base_new = ED_object_add_duplicate(bmain, scene, base_old, USER_DUP_MESH); - /* DAG_scene_sort(bmain, scene); */ /* normally would call directly after but in this case delay recalc */ + /* DAG_relations_tag_update(bmain); */ /* normally would call directly after but in this case delay recalc */ assign_matarar(base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */ ED_base_object_select(base_new, BA_SELECT); @@ -3276,7 +3276,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) if (retval) { /* delay depsgraph recalc until all objects are duplicated */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index cb69faa5b51..f983a43f573 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -559,7 +559,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) } - DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call + DAG_relations_tag_update(bmain); // removed objects, need to rebuild dag #if 0 ED_object_enter_editmode(C, EM_WAITCURSOR); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index ab9cd55f99b..bc577f6ee29 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -381,7 +381,7 @@ Object *ED_object_add_type(bContext *C, int type, const float loc[3], const floa ED_object_base_init_transform(C, BASACT, loc, rot); DAG_id_type_tag(bmain, ID_OB); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); if (ob->data) { ED_render_id_flush_update(bmain, ob->data); } @@ -469,7 +469,7 @@ static int effector_add_exec(bContext *C, wmOperator *op) ob->pd = object_add_collision_fields(type); - DAG_scene_sort(CTX_data_main(C), CTX_data_scene(C)); + DAG_relations_tag_update(CTX_data_main(C)); return OPERATOR_FINISHED; } @@ -835,9 +835,9 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) id_lib_extern(&group->id); /* works without this except if you try render right after, see: 22027 */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); - WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); return OPERATOR_FINISHED; } @@ -993,13 +993,12 @@ static int object_delete_exec(bContext *C, wmOperator *op) if (scene->id.flag & LIB_DOIT) { scene->id.flag &= ~LIB_DOIT; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); } } - DAG_ids_flush_update(bmain, 0); return OPERATOR_FINISHED; } @@ -1260,8 +1259,7 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE, scene); WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); @@ -1325,7 +1323,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob) } obn = BKE_object_copy(ob); - obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); basen = MEM_mallocN(sizeof(Base), "duplibase"); *basen = *base; @@ -1427,7 +1425,7 @@ static int convert_exec(bContext *C, wmOperator *op) } else { newob = ob; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } /* make new mesh data from the original copy */ @@ -1492,7 +1490,7 @@ static int convert_exec(bContext *C, wmOperator *op) for (ob1 = bmain->object.first; ob1; ob1 = ob1->id.next) { if (ob1->data == ob->data) { ob1->type = OB_CURVE; - ob1->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob1->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } } } @@ -1623,7 +1621,7 @@ static int convert_exec(bContext *C, wmOperator *op) } /* delete object should renew depsgraph */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } // XXX ED_object_enter_editmode(C, 0); @@ -1639,7 +1637,7 @@ static int convert_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_DATA, BASACT->object); } - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -1691,7 +1689,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base } else { obn = BKE_object_copy(ob); - obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); basen = MEM_mallocN(sizeof(Base), "duplibase"); *basen = *base; @@ -1816,7 +1814,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base } break; case OB_ARMATURE: - obn->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&obn->id, OB_RECALC_DATA); if (obn->pose) obn->pose->flag |= POSE_RECALC; if (dupflag & USER_DUP_ARM) { @@ -1906,7 +1904,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ /* leaves selection of base/object unaltered. * note: don't call this within a loop since clear_* funcs loop over the entire database. - * note: caller must do DAG_scene_sort(bmain, scene); + * note: caller must do DAG_relations_tag_update(bmain); * this is not done automatic since we may duplicate many objects in a batch */ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag) { @@ -1927,7 +1925,7 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag BKE_object_relink(ob); set_sca_new_poins_ob(ob); - /* DAG_scene_sort(bmain, scene); */ /* caller must do */ + /* DAG_relations_tag_update(bmain); */ /* caller must do */ if (ob->data) { ED_render_id_flush_update(bmain, ob->data); @@ -1971,8 +1969,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) copy_object_set_idnew(C, dupflag); - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -2047,8 +2044,7 @@ static int add_named_exec(bContext *C, wmOperator *op) copy_object_set_idnew(C, dupflag); - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); MEM_freeN(base); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 7746329c17f..72a9e328a02 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1151,7 +1151,7 @@ void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *o ED_object_constraint_update(ob); if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static int constraint_poll(bContext *C) @@ -1310,7 +1310,6 @@ void CONSTRAINT_OT_move_up(wmOperatorType *ot) static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); /* free constraints for all selected bones */ @@ -1322,7 +1321,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(bmain, scene); /* sort order of objects */ + DAG_relations_tag_update(bmain); /* note, calling BIK_clear_data() isn't needed here */ @@ -1349,7 +1348,6 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); /* do freeing */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) @@ -1360,7 +1358,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(bmain, scene); /* sort order of objects */ + DAG_relations_tag_update(bmain); /* do updates */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL); @@ -1385,7 +1383,6 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot) static int pose_constraint_copy_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); bPoseChannel *pchan = CTX_data_active_pose_bone(C); /* don't do anything if bone doesn't exist or doesn't have any constraints */ @@ -1407,7 +1404,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(bmain, scene); /* sort order of objects/bones */ + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL); @@ -1432,7 +1429,6 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); Object *obact = ED_object_active_context(C); /* copy all constraints from active object to all selected objects */ @@ -1447,7 +1443,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(bmain, scene); /* sort order of objects */ + DAG_relations_tag_update(bmain); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, NULL); @@ -1615,7 +1611,6 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); bPoseChannel *pchan; bConstraint *con; @@ -1709,7 +1704,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(bmain, scene); /* sort order of objects */ + DAG_relations_tag_update(bmain); if ((ob->type == OB_ARMATURE) && (pchan)) { ob->pose->flag |= POSE_RECALC; /* sort pose channels */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a13c0509824..b94c9e940dc 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -150,7 +150,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) } if (changed) { DAG_id_type_tag(bmain, ID_OB); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } @@ -207,7 +207,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) if (changed) { DAG_id_type_tag(bmain, ID_OB); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); @@ -771,7 +771,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) Base *base; Curve *cu, *cu1; Nurb *nu; - int do_scene_sort = FALSE; + bool do_depgraph_update = false; if (scene->id.lib) return; @@ -798,7 +798,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) for (base = FIRSTBASE; base; base = base->next) { if (base != BASACT) { if (TESTBASELIB(v3d, base)) { - base->object->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); if (event == 1) { /* loc */ copy_v3_v3(base->object->loc, ob->loc); @@ -897,7 +897,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family)); - base->object->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } } else if (event == 19) { /* bevel settings */ @@ -913,7 +913,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) cu1->ext1 = cu->ext1; cu1->ext2 = cu->ext2; - base->object->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } } else if (event == 25) { /* curve resolution */ @@ -932,7 +932,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) nu = nu->next; } - base->object->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } } else if (event == 21) { @@ -948,7 +948,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) } modifier_copyData(md, tmd); - base->object->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } } } @@ -956,7 +956,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) /* Copy the constraint channels over */ BKE_copy_constraints(&base->object->constraints, &ob->constraints, TRUE); - do_scene_sort = TRUE; + do_depgraph_update = true; } else if (event == 23) { base->object->softflag = ob->softflag; @@ -1008,10 +1008,8 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) } } - if (do_scene_sort) - DAG_scene_sort(bmain, scene); - - DAG_ids_flush_update(bmain, 0); + if (do_depgraph_update) + DAG_relations_tag_update(bmain); } static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D * v3d) diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index 9b683a1ba98..3112bb21091 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -137,7 +137,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected"); } - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -197,7 +197,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) if (!ok) BKE_report(op->reports, RPT_ERROR, "Active object contains no groups"); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -229,7 +229,7 @@ static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op)) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -269,7 +269,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -319,7 +319,7 @@ static int group_create_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index b1612a2b9d3..43736909c40 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -516,7 +516,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL, NULL, NULL, NULL, NULL, NULL); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); return TRUE; } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 00082b03781..b5faa5bdc4e 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -151,10 +151,10 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc ob->pd = object_add_collision_fields(0); ob->pd->deflect = 1; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } else if (type == eModifierType_Surface) - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); else if (type == eModifierType_Multires) { /* set totlvl from existing MDISPS layer if object already had it */ multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob); @@ -343,10 +343,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - - /* sorting has to be done after the update so that dynamic systems can react properly */ - if (sort_depsgraph) - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); return 1; } @@ -370,10 +367,7 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob) } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - - /* sorting has to be done after the update so that dynamic systems can react properly */ - if (sort_depsgraph) - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md) @@ -522,7 +516,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene * } } - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); return 1; } @@ -1831,7 +1825,7 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op) arm_md->object = arm_ob; arm_md->deformflag = ARM_DEF_VGROUP | ARM_DEF_QUATERNION; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 629dba465bc..c5e8310e9fb 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -223,7 +223,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { if (ob != obedit) { - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); par = obedit->parent; while (par) { @@ -260,7 +260,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT, NULL); @@ -364,7 +364,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op) BKE_object_make_proxy(newob, ob, gob); /* depsgraph flushes are needed for the new data */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&newob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, newob); } @@ -512,14 +512,13 @@ void ED_object_parent_clear(Object *ob, int type) break; } - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } /* note, poll should check for editable scene */ static int parent_clear_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); int type = RNA_enum_get(op->ptr, "type"); CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) @@ -528,8 +527,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL); return OPERATOR_FINISHED; @@ -597,7 +595,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object bPoseChannel *pchan = NULL; int pararm = ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO); - par->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&par->id, OB_RECALC_OB); /* preconditions */ if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) { @@ -762,7 +760,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object invert_m4_m4(ob->parentinv, workob.obmat); } - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); } } @@ -791,8 +789,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) if (!ok) return OPERATOR_CANCELLED; - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL); @@ -903,7 +900,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Object *par = ED_object_active_context(C); - par->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&par->id, OB_RECALC_OB); /* context iterator */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) @@ -918,7 +915,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) memset(ob->loc, 0, 3 * sizeof(float)); /* set recalc flags */ - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); /* set parenting type for object - object only... */ ob->parent = par; @@ -928,8 +925,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(bmain, CTX_data_scene(C)); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -955,7 +951,6 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) @@ -965,13 +960,12 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) ob->partype -= PARSLOW; BKE_object_where_is_calc(scene, ob); ob->partype |= PARSLOW; - ob->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } } CTX_DATA_END; - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -998,7 +992,6 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) @@ -1006,12 +999,11 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->parent) ob->partype |= PARSLOW; - ob->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -1046,7 +1038,6 @@ static EnumPropertyItem prop_clear_track_types[] = { static int object_track_clear_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); int type = RNA_enum_get(op->ptr, "type"); if (CTX_data_edit_object(C)) { @@ -1059,7 +1050,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) /* remove track-object for old track */ ob->track = NULL; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* also remove all tracking constraints */ for (con = ob->constraints.last; con; con = pcon) { @@ -1073,8 +1064,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(bmain, 0); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -1111,7 +1101,6 @@ static EnumPropertyItem prop_make_track_types[] = { static int track_set_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); Object *obact = ED_object_active_context(C); int type = RNA_enum_get(op->ptr, "type"); @@ -1127,7 +1116,7 @@ static int track_set_exec(bContext *C, wmOperator *op) data = con->data; data->tar = obact; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* Lamp, Camera and Speaker track differently by default */ if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) @@ -1147,7 +1136,7 @@ static int track_set_exec(bContext *C, wmOperator *op) data = con->data; data->tar = obact; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* Lamp, Camera and Speaker track differently by default */ if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) { @@ -1169,7 +1158,7 @@ static int track_set_exec(bContext *C, wmOperator *op) data = con->data; data->tar = obact; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* Lamp, Camera and Speaker track differently by default */ if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) { @@ -1181,8 +1170,7 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -1297,7 +1285,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene); WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); return OPERATOR_FINISHED; } @@ -1360,7 +1348,6 @@ Base *ED_object_scene_link(Scene *scene, Object *ob) static int make_links_scene_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if (scene_to == NULL) { @@ -1384,8 +1371,6 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(bmain, 0); - /* redraw the 3D view because the object center points are colored differently */ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); @@ -1476,7 +1461,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) /* if amount of material indices changed: */ test_object_materials(ob_dst->data); - ob_dst->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); break; case MAKE_LINKS_MATERIALS: /* new approach, using functions from kernel */ @@ -1515,7 +1500,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) break; case MAKE_LINKS_MODIFIERS: BKE_object_link_modifiers(ob_dst, ob_src); - ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); break; case MAKE_LINKS_FONTS: { @@ -1535,7 +1520,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) cu_dst->vfontbi = cu_src->vfontbi; id_us_plus((ID *)cu_dst->vfontbi); - ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); break; } } @@ -1554,10 +1539,9 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } } - DAG_scene_sort(bmain, scene); - - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + return OPERATOR_FINISHED; } @@ -1706,7 +1690,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) id = ob->data; if (id && id->us > 1 && id->lib == NULL) { - ob->recalc = OB_RECALC_DATA; + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); BKE_copy_animdata_id_action(id); @@ -1742,7 +1726,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) ob->data = BKE_lattice_copy(ob->data); break; case OB_ARMATURE: - ob->recalc |= OB_RECALC_DATA; + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); ob->data = BKE_armature_copy(ob->data); BKE_pose_rebuild(ob, ob->data); break; @@ -1778,7 +1762,7 @@ static void single_object_action_users(Scene *scene, int flag) for (base = FIRSTBASE; base; base = base->next) { ob = base->object; if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) { - ob->recalc = OB_RECALC_DATA; + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); BKE_copy_animdata_id_action(&ob->id); } } @@ -2148,7 +2132,6 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event) { - Main *bmain = CTX_data_main(C); Base *base = ED_view3d_give_base_under_cursor(C, event->mval); Material *ma; char name[MAX_ID_NAME - 2]; @@ -2160,7 +2143,6 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF); - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 13523154d62..01dcac2d1b4 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -213,7 +213,6 @@ static void object_clear_scale(Object *ob) static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, void (*clear_func)(Object *), const char default_ksName[]) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks; @@ -244,8 +243,6 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -318,7 +315,6 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot) static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); float *v1, *v3; float mat[3][3]; @@ -338,8 +334,6 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) } CTX_DATA_END; - DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -991,7 +985,6 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA); if (tot_change) { - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); } diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index ecc7ea4ae00..48316cfccb7 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -172,8 +172,8 @@ static int type_toggle_exec(bContext *C, wmOperator *op) /* update dependency */ DAG_id_tag_update(&cObject->id, OB_RECALC_DATA); + DAG_relations_tag_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject); - DAG_scene_sort(CTX_data_main(C), scene); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index dc309ec3c31..154daf0eb72 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -100,7 +100,6 @@ void BOID_OT_rule_add(wmOperatorType *ot) static int rule_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings); ParticleSettings *part = ptr.data; BoidRule *rule; @@ -123,7 +122,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op)) if (rule) rule->flag |= BOIDRULE_CURRENT; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); return OPERATOR_FINISHED; @@ -254,7 +253,6 @@ void BOID_OT_state_add(wmOperatorType *ot) static int state_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings); ParticleSettings *part = ptr.data; BoidState *state; @@ -280,7 +278,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op)) state->flag |= BOIDSTATE_CURRENT; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); return OPERATOR_FINISHED; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 23069ab8a08..8cae0140b5a 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -151,7 +151,6 @@ static int psys_poll(bContext *C) static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); Main *bmain= CTX_data_main(C); ParticleSystem *psys; ParticleSettings *part = NULL; @@ -177,7 +176,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) psys_check_boid_data(psys); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -205,7 +204,6 @@ void PARTICLE_OT_new(wmOperatorType *ot) static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; Object *ob = ptr.id.data; @@ -226,7 +224,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) BLI_addtail(&psys->targets, pt); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -251,7 +249,6 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; Object *ob = ptr.id.data; @@ -275,7 +272,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) if (pt) pt->flag |= PTARGET_CURRENT; - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c index a72a409f277..b3f92d3de46 100644 --- a/source/blender/editors/physics/rigidbody_constraint.c +++ b/source/blender/editors/physics/rigidbody_constraint.c @@ -96,6 +96,8 @@ void ED_rigidbody_con_add(wmOperator *op, Scene *scene, Object *ob, int type) /* add constraint to rigid body constraint group */ add_to_group(rbw->constraints, ob, scene, NULL); + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } void ED_rigidbody_con_remove(Scene *scene, Object *ob) @@ -130,8 +132,6 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op) ED_rigidbody_con_add(op, scene, ob, type); /* send updates */ - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); /* done */ @@ -177,8 +177,6 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op) } /* send updates */ - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); /* done */ diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index 2bf962f4f4a..6bcdf6e07aa 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -151,8 +151,6 @@ static int rigidbody_ob_add_exec(bContext *C, wmOperator *op) ED_rigidbody_ob_add(op, scene, ob, type); /* send updates */ - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); /* done */ @@ -197,8 +195,6 @@ static int rigidbody_ob_remove_exec(bContext *C, wmOperator *op) ED_rigidbody_ob_remove(scene, ob); /* send updates */ - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); /* done */ @@ -242,8 +238,6 @@ static int rigidbody_obs_add_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* send updates */ - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL); @@ -289,8 +283,6 @@ static int rigidbody_obs_remove_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_END; /* send updates */ - DAG_ids_flush_update(CTX_data_main(C), 0); - WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL); /* done */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 483348db18e..ab16a9d55e6 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -383,10 +383,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int e case B_IPO_DEPCHANGE: { /* rebuild depsgraph for the new deps */ - DAG_scene_sort(bmain, scene); - - /* force an update of depsgraph */ - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); } break; } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index ab660b9cd4a..9a1b3628196 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1432,8 +1432,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op) ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE, FALSE); - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL); @@ -1522,8 +1521,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) { if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE, FALSE)) { - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL); } @@ -1706,8 +1704,7 @@ static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even ED_object_parent_clear(ob, RNA_enum_get(op->ptr, "type")); - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL); return OPERATOR_FINISHED; @@ -1795,8 +1792,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_base_object_select(base, BA_SELECT); } - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(bmain); WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene); @@ -1828,7 +1824,6 @@ void OUTLINER_OT_scene_drop(wmOperatorType *ot) static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) { - Main *bmain = CTX_data_main(C); Material *ma = NULL; Object *ob = NULL; SpaceOops *soops = CTX_wm_space_outliner(C); @@ -1860,7 +1855,6 @@ static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) assign_material(ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b2070cc2f1c..303782f3fbd 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -619,7 +619,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) * cleanup tree here to prevent such cases. */ outliner_cleanup_tree(soops); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); str = "Delete Objects"; WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); } @@ -712,10 +712,8 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) if (event == 3) { /* instance */ - Main *bmain = CTX_data_main(C); - /* works without this except if you try render right after, see: 22027 */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(CTX_data_main(C)); } ED_undo_push(C, prop_group_op_types[event].name); @@ -1110,14 +1108,8 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) /* update dependencies */ if (updateDeps) { - Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); - /* rebuild depsgraph for the new deps */ - DAG_scene_sort(bmain, scene); - - /* force an update of depsgraph */ - DAG_ids_flush_update(bmain, 0); + DAG_relations_tag_update(CTX_data_main(C)); } return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index f570ec38ae3..6edcf980d58 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -532,7 +532,6 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); RegionView3D *rv3d = CTX_wm_region_data(C); @@ -623,8 +622,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { - ob->recalc |= OB_RECALC_OB; - vec[0] = -ob->obmat[3][0] + gridf * floorf(0.5f + ob->obmat[3][0] / gridf); vec[1] = -ob->obmat[3][1] + gridf * floorf(0.5f + ob->obmat[3][1] / gridf); vec[2] = -ob->obmat[3][2] + gridf * floorf(0.5f + ob->obmat[3][2] / gridf); @@ -644,12 +641,13 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) /* auto-keyframing */ ED_autokeyframe_object(C, scene, ob, ks); + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; } - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -674,7 +672,6 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -748,8 +745,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { - ob->recalc |= OB_RECALC_OB; - vec[0] = -ob->obmat[3][0] + curs[0]; vec[1] = -ob->obmat[3][1] + curs[1]; vec[2] = -ob->obmat[3][2] + curs[2]; @@ -769,12 +764,13 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) /* auto-keyframing */ ED_autokeyframe_object(C, scene, ob, ks); + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; } - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 32ceaf97331..5be06188e4e 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4743,6 +4743,7 @@ static void set_trans_object_base_flags(TransInfo *t) } /* all recalc flags get flushed to all layers, so a layer flip later on works fine */ + DAG_scene_relations_update(G.main, t->scene); DAG_scene_flush_update(G.main, t->scene, -1, 0); /* and we store them temporal in base (only used for transform code) */ @@ -4820,6 +4821,7 @@ static int count_proportional_objects(TransInfo *t) /* all recalc flags get flushed to all layers, so a layer flip later on works fine */ + DAG_scene_relations_update(G.main, t->scene); DAG_scene_flush_update(G.main, t->scene, -1, 0); /* and we store them temporal in base (only used for transform code) */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 644ab9286c5..952854735f8 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1140,12 +1140,9 @@ typedef struct Scene { /* none of the dependency graph vars is mean to be saved */ struct DagForest *theDag; - short dagisvalid, dagflags; + short dagflags; short recalc; /* recalc = counterpart of ob->recalc */ - short pad6; - int pad5; - /* User-Defined KeyingSets */ int active_keyingset; /* index of the active KeyingSet. first KeyingSet has index 1, 'none' active is 0, 'add new' is -1 */ ListBase keyingsets; /* KeyingSets for this scene */ diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 3da718afd1c..63f4e480468 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -100,7 +100,7 @@ static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); } -static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Boids_reset_deps(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (ptr->type == &RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem *)ptr->data; @@ -112,7 +112,7 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) else DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 8f8136b0a28..b7ef76eeaf3 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -304,7 +304,7 @@ static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); rna_Curve_update_data(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 99d2f6dbbda..a505ae0dec2 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -152,7 +152,7 @@ static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, Poi static void rna_DynamicPaint_resetDependancy(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_DynamicPaintSurface_reset(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 82e2cb3b0ea..a91832268e2 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -116,7 +116,7 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA driver->flag &= ~DRIVER_FLAG_INVALID; /* TODO: this really needs an update guard... */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA); WM_main_add_notifier(NC_SCENE | ND_FRAME, scene); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 1eaf54a69aa..810999033a4 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -267,7 +267,7 @@ static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Modifier_update(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 47b775801f6..3e7567e0eda 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -293,12 +293,10 @@ static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA rna_Object_internal_update_data(bmain, scene, ptr); } -static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { DAG_id_tag_update(ptr->id.data, OB_RECALC_OB); - if (scene) { - DAG_scene_sort(bmain, scene); - } + DAG_relations_tag_update(bmain); WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data); } @@ -332,7 +330,7 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b /* pass */ } else { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } DAG_id_type_tag(bmain, ID_OB); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index dcb288a6f32..434f767ccad 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -547,7 +547,7 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point rna_FieldSettings_shape_update(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); @@ -590,9 +590,9 @@ static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene), WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } -static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update((ID *)ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f90389146aa..d6f3f594395 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -622,7 +622,7 @@ static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); rna_Particle_redo(bmain, scene, ptr); } @@ -659,7 +659,7 @@ static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget return NULL; } -static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (ptr->type == &RNA_ParticleTarget) { Object *ob = (Object *)ptr->id.data; @@ -687,7 +687,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr psys->recalc = PSYS_RECALC_RESET; DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 23f61282b78..1ed675962f3 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -187,13 +187,13 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value) } } -static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { Object *ob = ptr->id.data; bPose *pose = ptr->data; pose->flag |= POSE_RECALC; /* checks & sorts pose channels */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); BKE_pose_update_constraint_flags(pose); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7718dc2376d..afee72ff873 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -381,10 +381,10 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report if (scene == scene_act) ob->lay = base->lay; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* slows down importers too much, run scene.update() */ - /* DAG_scene_sort(G.main, scene); */ + /* DAG_srelations_tag_update(G.main); */ WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); @@ -412,8 +412,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o ob->id.us--; /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */ - DAG_scene_sort(G.main, scene); - DAG_ids_flush_update(G.main, 0); + DAG_relations_tag_update(G.main); WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); } @@ -1260,7 +1259,6 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi for (SETLOOPER(sce, sce_iter, base)) object_simplify_update(base->object); - DAG_ids_flush_update(bmain, 0); WM_main_add_notifier(NC_GEOM | ND_DATA, NULL); } diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index bdcda79583e..86b97b93437 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -62,7 +62,7 @@ static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Smoke_update(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static void rna_Smoke_resetCache(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9562f6d698f..79257479529 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2174,8 +2174,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) flag_all_listbases_ids(LIB_PRE_EXISTING, 0); /* recreate dependency graph to include new objects */ - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); + DAG_scene_relations_rebuild(bmain, scene); BLO_blendhandle_close(bh); -- cgit v1.2.3 From 51f22e639e95b81d32562973559a23e20272412b Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 21 Feb 2013 21:05:31 +0000 Subject: Code cleanup: * Cycles: Removed leftover include of "kernel_qbvh.h", which was removed in r51352. --- intern/cycles/kernel/kernel_path.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 9b13f4d2a42..865ba7ca676 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -28,11 +28,7 @@ #include "kernel_curve.h" #include "kernel_primitive.h" #include "kernel_projection.h" -#ifdef __QBVH__ -#include "kernel_qbvh.h" -#else #include "kernel_bvh.h" -#endif #include "kernel_accumulate.h" #include "kernel_camera.h" #include "kernel_shader.h" -- cgit v1.2.3 From 2c084e280d178aab6eae711bff147273bef2a34d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 00:51:58 +0000 Subject: code cleanup: remove unused arg --- source/blender/editors/include/ED_object.h | 6 +++--- source/blender/editors/object/object_constraint.c | 2 +- source/blender/editors/object/object_modifier.c | 6 +++--- source/blender/editors/screen/area.c | 2 +- source/blender/makesrna/intern/rna_constraint.c | 4 ++-- source/blender/makesrna/intern/rna_object.c | 4 ++-- source/blender/makesrna/intern/rna_object_force.c | 4 ++-- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index e212f2cc17d..2c43f6e4f25 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -161,7 +161,7 @@ void object_test_constraints(struct Object *ob); void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con); void ED_object_constraint_update(struct Object *ob); -void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob); +void ED_object_constraint_dependency_update(struct Main *bmain, struct Object *ob); /* object_lattice.c */ int mouse_lattice(struct bContext *C, const int mval[2], int extend, int deselect, int toggle); @@ -179,9 +179,9 @@ enum { struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type); -int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, +int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Object *ob, struct ModifierData *md); -void ED_object_modifier_clear(struct Main *bmain, struct Scene *scene, struct Object *ob); +void ED_object_modifier_clear(struct Main *bmain, struct Object *ob); int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene, diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 72a9e328a02..84b989e2f59 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1146,7 +1146,7 @@ void ED_object_constraint_update(Object *ob) DAG_id_tag_update(&ob->id, OB_RECALC_OB); } -void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *ob) +void ED_object_constraint_dependency_update(Main *bmain, Object *ob) { ED_object_constraint_update(ob); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index b5faa5bdc4e..7c74fa24893 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -330,7 +330,7 @@ static int object_modifier_remove(Main *bmain, Object *ob, ModifierData *md, return 1; } -int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_remove(ReportList *reports, Main *bmain, Object *ob, ModifierData *md) { int sort_depsgraph = 0; int ok; @@ -348,7 +348,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob return 1; } -void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob) +void ED_object_modifier_clear(Main *bmain, Object *ob) { ModifierData *md = ob->modifiers.first; int sort_depsgraph = 0; @@ -878,7 +878,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) ModifierData *md = edit_modifier_property_get(op, ob, 0); int mode_orig = ob ? ob->mode : 0; - if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) + if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, ob, md)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 63232b8c455..023a1bbbb1c 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -446,7 +446,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); UI_ThemeColor(TH_TEXT); - BLF_draw_default(UI_UNIT_X, 0.4f*UI_UNIT_Y, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX); + BLF_draw_default(UI_UNIT_X, 0.4f * UI_UNIT_Y, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX); } else if (at->draw) { at->draw(C, ar); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 0c8fb3d6a36..956483890f5 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -244,9 +244,9 @@ static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi ED_object_constraint_update(ptr->id.data); } -static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Constraint_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - ED_object_constraint_dependency_update(bmain, scene, ptr->id.data); + ED_object_constraint_dependency_update(bmain, ptr->id.data); } static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3e7567e0eda..2c736df1ed2 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1311,7 +1311,7 @@ static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, Report static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr) { ModifierData *md = md_ptr->data; - if (ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md) == FALSE) { + if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == FALSE) { /* error is already set */ return; } @@ -1323,7 +1323,7 @@ static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList * static void rna_Object_modifier_clear(Object *object, bContext *C) { - ED_object_modifier_clear(CTX_data_main(C), CTX_data_scene(C), object); + ED_object_modifier_clear(CTX_data_main(C), object); WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 434f767ccad..ec974df54d5 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -521,7 +521,7 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA } else { if (!pd || pd->shape != PFIELD_SHAPE_SURFACE) - ED_object_modifier_remove(NULL, bmain, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, ob, md); } WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); @@ -669,7 +669,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P if (ob->pd->deflect && !md) ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); else if (!ob->pd->deflect && md) - ED_object_modifier_remove(NULL, bmain, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, ob, md); WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); } diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 36068b01133..3bc1cb9bc94 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -321,7 +321,7 @@ void ED_screen_animation_playing(struct wmWindowManager *wm) {} void ED_base_object_select(struct Base *base, short mode) {} int ED_object_modifier_remove(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md) {return 0;} int ED_object_modifier_add(struct ReportList *reports, struct Scene *scene, struct Object *ob, char *name, int type) {return 0;} -void ED_object_modifier_clear(struct Scene *scene, struct Object *ob) {} +void ED_object_modifier_clear(struct Main *bmain, struct Object *ob) {} void ED_object_enter_editmode(struct bContext *C, int flag) {} void ED_object_exit_editmode(struct bContext *C, int flag) {} int uiLayoutGetActive(struct uiLayout *layout) {return 0;} -- cgit v1.2.3 From 2ecf27f56fd50dca4c09eacacb11e743b1005b17 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 22 Feb 2013 01:48:53 +0000 Subject: BGE projection code fix: old patch #28893 (to fix #28753) committed in rev.41131 changed the clipping for ortho camera from -far +far to +near +far. But also introduced this -far +far when using 3dviewport camera (which shouldn't). --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 176dc33d057..e78b996391e 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -438,7 +438,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat)); if (rv3d->persp == RV3D_ORTHO) { - ketsjiengine->SetCameraOverrideClipping(-v3d->far, v3d->far); + ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); } else { -- cgit v1.2.3 From 0215911a9bd141d0cdc0b2476d4e459c4e48209d Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 22 Feb 2013 01:49:51 +0000 Subject: Animation Editors: Operators to Group/Ungroup Selected F-Curves This commit introduces operators to customise the grouping of F-Curves. As groups are only available in Actions, these grouping operators only work in the Dopesheet, Action Editor, and Graph Editor (Animation) modes. To Use: * Ctrl-G = Group selected F-Curves * Alt-G = Ungroup selected F-Curves * or find these tools from the Channels menu Notes: * When invoking the grouping operator from the Channels menu, the name popup won't show up. Instead, the group(s) created will be created with the default name. To fix, you can either use the F6 operator properties edit OR manually edit the names (Ctrl-LMB on the relevant channel) --- release/scripts/startup/bl_ui/space_dopesheet.py | 4 + release/scripts/startup/bl_ui/space_graph.py | 4 + .../blender/editors/animation/anim_channels_edit.c | 231 ++++++++++++++++++++- source/blender/editors/animation/anim_filter.c | 4 + 4 files changed, 237 insertions(+), 6 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 094fa4a7c6d..adeae9da790 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -240,6 +240,10 @@ class DOPESHEET_MT_channel(Menu): layout.operator("anim.channels_delete") + layout.separator() + layout.operator("anim.channels_group") + layout.operator("anim.channels_ungroup") + layout.separator() layout.operator_menu_enum("anim.channels_setting_toggle", "type") layout.operator_menu_enum("anim.channels_setting_enable", "type") diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index 4cb6538458f..2d0b1c93d13 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -160,6 +160,10 @@ class GRAPH_MT_channel(Menu): layout.operator("anim.channels_delete") + layout.separator() + layout.operator("anim.channels_group") + layout.operator("anim.channels_ungroup") + layout.separator() layout.operator_menu_enum("anim.channels_setting_toggle", "type") layout.operator_menu_enum("anim.channels_setting_enable", "type") diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 458054c9d7f..68ded3ef36a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1147,6 +1147,218 @@ static void ANIM_OT_channels_move(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", ""); } +/* ******************** Group Channel Operator ************************ */ + +static int animchannels_grouping_poll(bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + SpaceLink *sl; + + /* channels region test */ + /* TODO: could enhance with actually testing if channels region? */ + if (ELEM(NULL, sa, CTX_wm_region(C))) + return 0; + + /* animation editor test - must be suitable modes only */ + sl = CTX_wm_space_data(C); + + switch (sa->spacetype) { + /* supported... */ + case SPACE_ACTION: + { + SpaceAction *saction = (SpaceAction *)sl; + + /* dopesheet and action only - all others are for other datatypes or have no groups */ + if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_DOPESHEET) == 0) + return 0; + } + break; + + case SPACE_IPO: + { + SpaceIpo *sipo = (SpaceIpo *)sl; + + /* drivers can't have groups... */ + if (sipo->mode != SIPO_MODE_ANIMATION) + return 0; + } + break; + + /* unsupported... */ + default: + return 0; + } + + return 1; +} + +/* ----------------------------------------------------------- */ + +static void animchannels_group_channels(bAnimContext *ac, bAnimListElem *adt_ref, const char name[]) +{ + AnimData *adt = adt_ref->adt; + bAction *act = adt->action; + + if (act) { + ListBase anim_data = {NULL, NULL}; + int filter; + + /* find selected F-Curves to re-group */ + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL); + ANIM_animdata_filter(ac, &anim_data, filter, adt_ref, ANIMCONT_CHANNEL); + + if (anim_data.first) { + bActionGroup *agrp; + bAnimListElem *ale; + + /* create new group, which should now be part of the action */ + agrp = action_groups_add_new(act, name); + BLI_assert(agrp != NULL); + + /* transfer selected F-Curves across to new group */ + for (ale = anim_data.first; ale; ale = ale->next) { + FCurve *fcu = (FCurve *)ale->data; + bActionGroup *grp = fcu->grp; + + /* remove F-Curve from group, then group too if it is now empty */ + action_groups_remove_channel(act, fcu); + + if ((grp) && (grp->channels.first == NULL)) { + BLI_freelinkN(&act->groups, grp); + } + + /* add F-Curve to group */ + action_groups_add_channel(act, agrp, fcu); + } + } + + /* cleanup */ + BLI_freelistN(&anim_data); + } +} + +static int animchannels_group_exec(bContext *C, wmOperator *op) +{ + bAnimContext ac; + char name[MAX_NAME]; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* get name for new group */ + RNA_string_get(op->ptr, "name", name); + + /* XXX: name for group should never be empty... */ + if (name[0]) { + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + /* handle each animdata block separately, so that the regrouping doesn't flow into blocks */ + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_NODUPLIS); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + for (ale = anim_data.first; ale; ale = ale->next) { + animchannels_group_channels(&ac, ale, name); + } + + /* free temp data */ + BLI_freelistN(&anim_data); + + /* updatss */ + WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); + } + + return OPERATOR_FINISHED; +} + +static void ANIM_OT_channels_group(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Group Channels"; + ot->idname = "ANIM_OT_channels_group"; + ot->description = "Add selected F-Curves to a new group"; + + /* callbacks */ + ot->invoke = WM_operator_props_popup; + ot->exec = animchannels_group_exec; + ot->poll = animchannels_grouping_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* props */ + ot->prop = RNA_def_string(ot->srna, "name", "New Group", + sizeof(((bActionGroup *)NULL)->name), + "Name", "Name of newly created group"); + /* RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE); */ /* XXX: still not too sure about this - keeping same text is confusing... */ +} + +/* ----------------------------------------------------------- */ + +static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op)) +{ + bAnimContext ac; + + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* just selected F-Curves... */ + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + for (ale = anim_data.first; ale; ale = ale->next) { + /* find action for this F-Curve... */ + if (ale->adt && ale->adt->action) { + FCurve *fcu = (FCurve *)ale->data; + bAction *act = ale->adt->action; + + /* only proceed to remove if F-Curve is in a group... */ + if (fcu->grp) { + bActionGroup *agrp = fcu->grp; + + /* remove F-Curve from group and add at tail (ungrouped) */ + action_groups_remove_channel(act, fcu); + BLI_addtail(&act->curves, fcu); + + /* delete group if it is now empty */ + if (agrp->channels.first == NULL) { + BLI_freelinkN(&act->groups, agrp); + } + } + } + } + + /* cleanup */ + BLI_freelistN(&anim_data); + + /* updates */ + WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); + + return OPERATOR_FINISHED; +} + +static void ANIM_OT_channels_ungroup(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Ungroup Channels"; + ot->idname = "ANIM_OT_channels_ungroup"; + ot->description = "Remove selected F-Curves from their current groups"; + + /* callbacks */ + ot->exec = animchannels_ungroup_exec; + ot->poll = animchannels_grouping_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + /* ******************** Delete Channel Operator *********************** */ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) @@ -1233,13 +1445,13 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) BLI_freelinkN(&gpd->layers, gpl); } break; - + case ANIMTYPE_MASKLAYER: { /* Mask layer */ Mask *mask = (Mask *)ale->id; MaskLayer *masklay = (MaskLayer *)ale->data; - + /* try to delete the layer's data and the layer itself */ BKE_mask_layer_remove(mask, masklay); } @@ -1330,10 +1542,10 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op)) /* TODO: find out why this is the case, and fix that */ if (ale->type == ANIMTYPE_OBJECT) continue; - + /* enable the setting */ ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD); - + /* now, also flush selection status up/down as appropriate */ ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, 1); } @@ -1407,10 +1619,10 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o /* TODO: find out why this is the case, and fix that */ if (ale->type == ANIMTYPE_OBJECT) continue; - + /* change the setting */ ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, vis); - + /* now, also flush selection status up/down as appropriate */ ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, (vis == ACHANNEL_SETFLAG_ADD)); } @@ -2480,6 +2692,9 @@ void ED_operatortypes_animchannels(void) WM_operatortype_append(ANIM_OT_channels_visibility_set); WM_operatortype_append(ANIM_OT_channels_fcurves_enable); + + WM_operatortype_append(ANIM_OT_channels_group); + WM_operatortype_append(ANIM_OT_channels_ungroup); } // TODO: check on a poll callback for this, to get hotkeys into menus @@ -2533,6 +2748,10 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_TOP); RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_BOTTOM); + /* grouping */ + WM_keymap_add_item(keymap, "ANIM_OT_channels_group", GKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ANIM_OT_channels_ungroup", GKEY, KM_PRESS, KM_ALT, 0); + /* Graph Editor only */ WM_keymap_add_item(keymap, "ANIM_OT_channels_visibility_set", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ANIM_OT_channels_visibility_toggle", VKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 655ab2bfb15..ec6172d5041 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2316,6 +2316,10 @@ static size_t animdata_filter_animchan(bAnimContext *ac, ListBase *anim_data, bD items += animdata_filter_dopesheet_ob(ac, anim_data, ads, channel->data, filter_mode); break; + case ANIMTYPE_ANIMDATA: + items += animfilter_block_data(ac, anim_data, ads, channel->id, filter_mode); + break; + default: printf("ERROR: Unsupported channel type (%d) in animdata_filter_animchan()\n", channel->type); break; -- cgit v1.2.3 From de7b39c9da5a3c58bd2bc960a749f930ce617ee8 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 22 Feb 2013 02:09:54 +0000 Subject: Whitespace fixes --- source/blender/editors/animation/anim_channels_defines.c | 3 +-- source/blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/animation/anim_ipo_utils.c | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index f5c9bfb4cf5..da253ea6d2d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -2936,8 +2936,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float else offset = 0; - /* calculate appropriate y-coordinates for icon buttons - */ + /* calculate appropriate y-coordinates for icon buttons */ y = (ymaxc - yminc) / 2 + yminc; ymid = y - 0.5f * ICON_WIDTH; /* y-coordinates for text is only 4 down from middle */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 68ded3ef36a..d218cc537da 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2440,7 +2440,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); - } + } break; case ANIMTYPE_GROUP: diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index d8e3349e998..b6d24e21057 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -143,7 +143,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) /* no array index */ arrayname = ""; } - + /* putting this all together into the buffer */ /* XXX we need to check for invalid names... * XXX the name length limit needs to be passed in or as some define */ @@ -151,7 +151,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) BLI_snprintf(name, 256, "%s%s (%s)", arrayname, propname, structname); else BLI_snprintf(name, 256, "%s%s", arrayname, propname); - + /* free temp name if nameprop is set */ if (free_structname) MEM_freeN((void *)structname); @@ -170,11 +170,11 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) else { /* invalid path */ BLI_snprintf(name, 256, "\"%s[%d]\"", fcu->rna_path, fcu->array_index); - + /* icon for this should be the icon for the base ID */ /* TODO: or should we just use the error icon? */ icon = RNA_struct_ui_icon(id_ptr.type); - + /* tag F-Curve as disabled - as not usable path */ fcu->flag |= FCURVE_DISABLED; } -- cgit v1.2.3 From e663f249780389da25d0250907af332dd991daea Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 22 Feb 2013 02:10:41 +0000 Subject: Expose a few more operators for curves on the toolbar. Some of these were previously not available anywhere. --- release/scripts/startup/bl_ui/space_view3d_toolbar.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index d64920625f7..cba3cf05191 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -264,6 +264,8 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel): col.operator("curve.cyclic_toggle") col.operator("curve.switch_direction") col.operator("curve.spline_type_set") + col.operator("curve.radius_set") + col.operator("curve.smooth_radius") col = layout.column(align=True) col.label(text="Handles:") @@ -278,6 +280,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel): col.label(text="Modeling:") col.operator("curve.extrude_move", text="Extrude") col.operator("curve.subdivide") + col.operator("curve.smooth") draw_repeat_tools(context, layout) -- cgit v1.2.3 From 6bac47f8544a6bdc66d439d1d61b4a850d4ad20a Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 22 Feb 2013 02:31:46 +0000 Subject: BGE: Fix for bug #34349 "Character walkDirection ADD mode -#INF error" reported by Angus Hollands (agoose77). If the walk directions canceled each other out, the actuator would try to normalize a zero vector, which caused the error. --- source/gameengine/Ketsji/KX_ObjectActuator.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 9355ad0adfd..b4ee339568c 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -221,10 +221,14 @@ bool KX_ObjectActuator::Update() if (m_bitLocalFlag.AddOrSetCharLoc) { MT_Vector3 old_dir = parent->GetPhysicsController()->GetWalkDirection(); - MT_Scalar mag = old_dir.length(); - if (mag < MT_EPSILON) - mag = dir.length(); - dir = (dir + old_dir).normalized() * mag; + + if (!old_dir.fuzzyZero()) { + MT_Scalar mag = old_dir.length(); + + dir = dir + old_dir; + if (!dir.fuzzyZero()) + dir = dir.normalized() * mag; + } } // We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character -- cgit v1.2.3 From b00c3b801bf07a67b98b604ee834e2d93dff0f39 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 04:09:04 +0000 Subject: new weight paint draw option to display unweighted vertices with the option to check on the active group or all groups. notes: - vertices with zero weights are considered the same as vertices outside of a group. - currently these show black but this can be made a theme color. - multi-paint overrides this option (noted in description) --- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 5 ++++ source/blender/blenkernel/BKE_deform.h | 1 + source/blender/blenkernel/intern/DerivedMesh.c | 35 ++++++++++++++++++---- source/blender/blenkernel/intern/deform.c | 21 +++++++++++-- source/blender/makesdna/DNA_scene_types.h | 10 ++++++- source/blender/makesrna/intern/rna_scene.c | 14 +++++++++ 6 files changed, 77 insertions(+), 9 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index cba3cf05191..c79c59e6a9b 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1057,6 +1057,11 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel): col.prop(wpaint, "input_samples") + col.label("Show Zero Weights:") + rowsub = col.row() + rowsub.active = (not tool_settings.use_multipaint) + rowsub.prop(tool_settings, "vertex_group_user", text="Show Group Use", expand=True) + self.unified_paint_settings(col, context) # Commented out because the Apply button isn't an operator yet, making these settings useless diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 0fa7356b64e..b209e8bf667 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -55,6 +55,7 @@ void defvert_add_index_notest(struct MDeformVert *dv, int de void defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw); void defvert_clear(struct MDeformVert *dvert); int defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b); +bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot); void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert); void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 8e740075bc6..aa3d52ce9ce 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1017,8 +1017,12 @@ void weight_to_rgb(float r_rgb[3], const float weight) /* draw_flag's for calc_weightpaint_vert_color */ enum { - CALC_WP_MULTIPAINT = (1 << 0), - CALC_WP_AUTO_NORMALIZE = (1 << 1) + /* only one of these should be set, keep first (for easy bit-shifting) */ + CALC_WP_GROUP_USER_ACTIVE = (1 << 1), + CALC_WP_GROUP_USER_ALL = (1 << 2), + + CALC_WP_MULTIPAINT = (1 << 3), + CALC_WP_AUTO_NORMALIZE = (1 << 4) }; static void weightpaint_color(unsigned char r_col[4], ColorBand *coba, const float input) @@ -1050,7 +1054,7 @@ static void calc_weightpaint_vert_color( { float input = 0.0f; - int make_black = FALSE; + bool make_black = false; if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) { int was_a_nonzero = FALSE; @@ -1072,7 +1076,7 @@ static void calc_weightpaint_vert_color( /* make it black if the selected groups have no weight on a vertex */ if (was_a_nonzero == FALSE) { - make_black = TRUE; + make_black = true; } else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) { input /= defbase_sel_tot; /* get the average */ @@ -1081,6 +1085,17 @@ static void calc_weightpaint_vert_color( else { /* default, non tricky behavior */ input = defvert_find_weight(dv, defbase_act); + + if (draw_flag & CALC_WP_GROUP_USER_ACTIVE) { + if (input == 0.0f) { + make_black = true; + } + } + else if (draw_flag & CALC_WP_GROUP_USER_ALL) { + if (input == 0.0f) { + make_black = defvert_is_weight_zero(dv, defbase_tot); + } + } } if (make_black) { /* TODO, theme color */ @@ -1138,7 +1153,12 @@ static unsigned char *calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, i } else { int col_i; - weightpaint_color((unsigned char *)&col_i, coba, 0.0f); + if (draw_flag & (CALC_WP_GROUP_USER_ACTIVE | CALC_WP_GROUP_USER_ALL)) { + col_i = 0; + } + else { + weightpaint_color((unsigned char *)&col_i, coba, 0.0f); + } fill_vn_i((int *)wtcol_v, numVerts, col_i); } @@ -1354,8 +1374,11 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt; int sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm); - const int draw_flag = ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) | + const int draw_flag = ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : + /* CALC_WP_GROUP_USER_ACTIVE or CALC_WP_GROUP_USER_ALL*/ + (1 << scene->toolsettings->weightuser)) | (scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0)); + /* Generic preview only in object mode! */ const int do_mod_mcol = (ob->mode == OB_MODE_OBJECT); #if 0 /* XXX Will re-enable this when we have global mod stack options. */ diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index de15100de0b..439180e8d76 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -41,14 +41,13 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "BKE_deform.h" - #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BKE_deform.h" /* own include */ void defgroup_copy_list(ListBase *outbase, ListBase *inbase) { @@ -787,6 +786,24 @@ int defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b) return -1; } +/** + * return true if has no weights + */ +bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot) +{ + MDeformWeight *dw = dvert->dw; + unsigned int i; + for (i = dvert->totweight; i != 0; i--, dw++) { + if (dw->weight != 0.0f) { + /* check the group is in-range, happens on rare situations */ + if (LIKELY(dw->def_nr < defgroup_tot)) { + return false; + } + } + } + return true; +} + /* -------------------------------------------------------------------- */ /* Defvert Array functions */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 952854735f8..a6c838eb485 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1036,10 +1036,11 @@ typedef struct ToolSettings { short proportional, prop_mode; char proportional_objects; /* proportional edit, object mode */ char proportional_mask; /* proportional edit, object mode */ - char pad4[2]; + char pad4[1]; char auto_normalize; /*auto normalizing mode in wpaint*/ char multipaint; /* paint multiple bones in wpaint */ + char weightuser; /* UV painting */ int use_uv_sculpt; @@ -1445,6 +1446,13 @@ typedef struct Scene { #define PROP_EDIT_ON 1 #define PROP_EDIT_CONNECTED 2 +/* toolsettings->weightuser */ +enum { + OB_DRAW_GROUPUSER_NONE = 0, + OB_DRAW_GROUPUSER_ACTIVE = 1, + OB_DRAW_GROUPUSER_ALL = 2 +}; + /* sce->flag */ #define SCE_DS_SELECTED (1<<0) #define SCE_DS_COLLAPSED (1<<1) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index afee72ff873..a9d1f6e0f34 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1528,6 +1528,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem draw_groupuser_items[] = { + {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""}, + {OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the actuve group"}, + {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in the any group"}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "ToolSettings", NULL); RNA_def_struct_path_func(srna, "rna_ToolSettings_path"); RNA_def_struct_ui_text(srna, "Tool Settings", ""); @@ -1550,6 +1557,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) "weight painting"); RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); + prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "weightuser"); + RNA_def_property_enum_items(prop, draw_groupuser_items); + RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices (multi-paint overrides)"); + RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); + + prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "vpaint"); RNA_def_property_ui_text(prop, "Vertex Paint", ""); -- cgit v1.2.3 From a9e25ac43320a253f557d945a8e83245e414a2ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 05:56:20 +0000 Subject: Toggle-Drag UI Feature Dragging on toggle buttons can now be used to press multiple buttons at once, especially useful for layer and outliner buttons. notes: - automatically enabled for all toggle buttons (may change this if it becomes a problem). - only buttons of the same type are pressed (helps avoid annoyances eg; dragging past layer buttons onto other 3d header buttons and pressing by accident). - automatic axis locking - dragging will lock to X/Y depending on the initial drag direction, makes swipe motions work better, especially with the outliner. implementation details: - may re-implement as a region handler (currently its a modal operator). - checking buttons in-between cursor motion events could be more efficient (but currently works ok). - button execution needs to be improved (currently executing a button thats not under the mouse needed a workaround for passing uiHandleButtonData), requires further changes to UI code, will do next. --- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 2 +- source/blender/editors/include/UI_interface.h | 3 + source/blender/editors/interface/interface.c | 18 ++ .../blender/editors/interface/interface_handlers.c | 71 ++++++- .../blender/editors/interface/interface_intern.h | 2 + source/blender/editors/interface/interface_ops.c | 223 +++++++++++++++++++++ 6 files changed, 309 insertions(+), 10 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index c79c59e6a9b..05c1793b29f 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1060,7 +1060,7 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel): col.label("Show Zero Weights:") rowsub = col.row() rowsub.active = (not tool_settings.use_multipaint) - rowsub.prop(tool_settings, "vertex_group_user", text="Show Group Use", expand=True) + rowsub.prop(tool_settings, "vertex_group_user", expand=True) self.unified_paint_settings(col, context) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 648f8bfd8dd..78689c078c6 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -437,6 +437,7 @@ void uiButSetDragValue(uiBut *but); void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale); int UI_but_active_drop_name(struct bContext *C); +struct uiBut *ui_but_find_mouse_over(struct ARegion *ar, int x, int y); void uiButSetFlag(uiBut *but, int flag); void uiButClearFlag(uiBut *but, int flag); @@ -447,6 +448,8 @@ void uiButClearDrawFlag(uiBut *but, int flag); /* special button case, only draw it when used actively, for outliner etc */ int uiButActiveOnly(const struct bContext *C, uiBlock *block, uiBut *but); +void uiButExecute(const struct bContext *C, uiBut *but); + /* Buttons * diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index d245349f2c4..e10d588c19f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -713,6 +713,12 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) return 1; } +/* simulate button click */ +void uiButExecute(const bContext *C, uiBut *but) +{ + ui_button_execute_do((bContext *)C, CTX_wm_region(C), but); +} + /* use to check if we need to disable undo, but don't make any changes * returns FALSE if undo needs to be disabled. */ static int ui_but_is_rna_undo(uiBut *but) @@ -1394,6 +1400,18 @@ int ui_is_but_float(uiBut *but) return 0; } +int ui_is_but_bool(uiBut *but) +{ + if (ELEM5(but->type, TOG, TOGN, TOGR, ICONTOG, ICONTOGN)) + return 1; + + if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN) + return 1; + + return 0; +} + + int ui_is_but_unit(uiBut *but) { UnitSettings *unit = but->block->unit; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 017ab559911..532f9b50725 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -85,6 +85,7 @@ /* proto */ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to); static void ui_add_link(bContext *C, uiBut *from, uiBut *to); +static int ui_do_but_EXIT(bContext *C, uiBut *but, struct uiHandleButtonData *data, const wmEvent *event); /***************** structs and defines ****************/ @@ -761,14 +762,27 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, WM_gestures_remove(C); if (ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold) { - wmDrag *drag; - + button_activate_state(C, but, BUTTON_STATE_EXIT); data->cancel = TRUE; - drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but)); - if (but->imb) - WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)); + if (ui_is_but_bool(but)) { + const bool is_set = (ui_get_but_val(but) != 0.0); + PointerRNA ptr; + WM_operator_properties_create(&ptr, "UI_OT_drag_toggle"); + RNA_boolean_set(&ptr, "state", !is_set); + RNA_int_set(&ptr, "last_x", data->dragstartx); + RNA_int_set(&ptr, "last_y", data->dragstarty); + WM_operator_name_call(C, "UI_OT_drag_toggle", WM_OP_INVOKE_DEFAULT, &ptr); + WM_operator_properties_free(&ptr); + } + else { + wmDrag *drag; + + drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but)); + if (but->imb) + WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)); + } return 1; } @@ -2472,13 +2486,24 @@ static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHa static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS && ui_is_but_bool(but)) { + button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); + data->dragstartx = event->x; + data->dragstarty = event->y; + return WM_UI_HANDLER_CONTINUE; + } + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { data->togdual = event->ctrl; data->togonly = !event->shift; button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; + return WM_UI_HANDLER_CONTINUE; } } + else if (data->state == BUTTON_STATE_WAIT_DRAG) { + /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into its own function */ + return ui_do_but_EXIT(C, but, data, event); + } return WM_UI_HANDLER_CONTINUE; } @@ -2499,6 +2524,12 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con return WM_UI_HANDLER_CONTINUE; } } + if (event->type == LEFTMOUSE && ui_is_but_bool(but)) { + button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); + data->dragstartx = event->x; + data->dragstarty = event->y; + return WM_UI_HANDLER_CONTINUE; + } if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { int ret = WM_UI_HANDLER_BREAK; @@ -3215,6 +3246,12 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co return WM_UI_HANDLER_BREAK; } } + if (event->type == LEFTMOUSE && ui_is_but_bool(but)) { + button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); + data->dragstartx = event->x; + data->dragstarty = event->y; + return WM_UI_HANDLER_BREAK; + } /* regular open menu */ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { @@ -5415,7 +5452,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) return 1; } -static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) +uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but, *butover = NULL; @@ -5784,8 +5821,10 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b ED_region_tag_redraw(data->region); /* clean up button */ - MEM_freeN(but->active); - but->active = NULL; + if (but->active) { + MEM_freeN(but->active); + but->active = NULL; + } but->flag &= ~(UI_ACTIVE | UI_SELECT); but->flag |= UI_BUT_LAST_ACTIVE; if (!onfree) @@ -6034,6 +6073,20 @@ void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) ui_do_button(C, but->block, but, &event); } +void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut *but) +{ + /* note: ideally we would not have to change 'but->active' howevwer + * some functions we call don't use data (as they should be doing) */ + void *active_back = but->active; + uiHandleButtonData *data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData_Fake"); + but->active = data; + data->region = ar; + ui_apply_button(C, but->block, but, data, true); + /* use onfree event so undo is handled by caller and apply is already done above */ + button_activate_exit((bContext *)C, data, but, false, true); + but->active = active_back; +} + static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type) { uiBut *oldbut; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index b1e8b7b001e..f0e59f1f935 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -406,6 +406,7 @@ extern void ui_set_but_soft_range(uiBut *but, double value); extern void ui_check_but(uiBut *but); extern int ui_is_but_float(uiBut *but); +extern int ui_is_but_bool(uiBut *but); extern int ui_is_but_unit(uiBut *but); extern int ui_is_but_rna_valid(uiBut *but); extern int ui_is_but_utf8(uiBut *but); @@ -509,6 +510,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wc /* interface_handlers.c */ extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut *but); extern void ui_button_active_free(const struct bContext *C, uiBut *but); extern int ui_button_is_active(struct ARegion *ar); extern int ui_button_open_menu_direction(uiBut *but); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index e03a171da18..368ecdefe2c 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1071,6 +1071,228 @@ static void UI_OT_reloadtranslation(wmOperatorType *ot) ot->exec = reloadtranslation_exec; } + +/* -------------------------------------------------------------------- */ +/* Toggle Drag Operator */ + +typedef struct DragOpInfo { + bool xy_lock[2]; + float but_cent_start[2]; + eButType but_type_start; +} DragOpInfo; + +typedef struct DragOpPlotData { + bContext *C; + ARegion *ar; + bool is_set; + eButType but_type_start; + bool do_draw; + const uiBut *but_prev; +} DragOpPlotData; + +static const uiBut *ui_but_set_xy(bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start, + const int xy[2], const uiBut *but_prev) +{ + uiBut *but = ui_but_find_mouse_over(ar, xy[0], xy[1]); + + if (but_prev == but) { + return but_prev; + } + + if (but && ui_is_but_bool(but) && but->type == but_type_start) { + /* is it pressed? */ + bool is_set_but = (ui_get_but_val(but) != 0.0); + BLI_assert(ui_is_but_bool(but) == true); + if (is_set_but != is_set) { + uiButExecute(C, but); + return but; + } + } + + return but_prev; +} + +static int ui_but_set_cb(int x, int y, void *data_v) +{ + DragOpPlotData *data = data_v; + int xy[2] = {x, y}; + data->but_prev = ui_but_set_xy(data->C, data->ar, data->is_set, data->but_type_start, xy, data->but_prev); + return 1; /* keep going */ +} + +/* operates on buttons between 2 mouse-points */ +static bool ui_but_set_xy_xy(bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start, + const int xy_src[2], const int xy_dst[2]) +{ + DragOpPlotData data; + data.C = C; + data.ar = ar; + data.is_set = is_set; + data.but_type_start = but_type_start; + data.do_draw = false; + data.but_prev = NULL; + + + /* prevent dragging too fast loosing buttons */ + plot_line_v2v2i(xy_src, xy_dst, ui_but_set_cb, &data); + + return data.do_draw; +} + +static void ui_drag_but_set(bContext *C, wmOperator *op, const int xy_input[2]) +{ + ARegion *ar = CTX_wm_region(C); + DragOpInfo *drag_info = op->customdata; + bool do_draw = false; + + const bool is_set = RNA_boolean_get(op->ptr, "state"); + const int xy_last[2] = {RNA_int_get(op->ptr, "last_x"), + RNA_int_get(op->ptr, "last_y")}; + + int xy[2]; + + /** + * Initialize Locking: + * + * Check if we need to initialize the lock axis by finding if the first + * button we mouse over is X or Y aligned, then lock the mouse to that axis after. + */ + if (drag_info->xy_lock[0] == false && drag_info->xy_lock[1] == false) { + ARegion *ar = CTX_wm_region(C); + + /* first store the buttons original coords */ + uiBut *but = ui_but_find_mouse_over(ar, xy_input[0], xy_input[1]); + if (but) { + const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect), + BLI_rctf_cent_y(&but->rect)}; + + /* check if this is a different button, chances are high the button wont move about :) */ + if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) { + if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) < + fabsf(drag_info->but_cent_start[1] - but_cent_new[1])) + { + drag_info->xy_lock[0] = true; + } + else { + drag_info->xy_lock[1] = true; + } + } + } + } + /* done with axis locking */ + + + xy[0] = (drag_info->xy_lock[0] == false) ? xy_input[0] : xy_last[0]; + xy[1] = (drag_info->xy_lock[1] == false) ? xy_input[1] : xy_last[1]; + + + /* touch all buttons between last mouse coord and this one */ + do_draw = ui_but_set_xy_xy(C, ar, is_set, drag_info->but_type_start, xy_last, xy); + + if (do_draw) { + ED_region_tag_redraw(ar); + } + + RNA_int_set(op->ptr, "last_x", xy[0]); + RNA_int_set(op->ptr, "last_y", xy[1]); +} + +static int ui_drag_toggle_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + int xy_last[2] = {RNA_int_get(op->ptr, "last_x"), + RNA_int_get(op->ptr, "last_y")}; + + float but_cent_start[2]; + eButType but_type_start; + DragOpInfo *drag_info; + + { + /* find the button where we started dragging */ + ARegion *ar = CTX_wm_region(C); + uiBut *but = ui_but_find_mouse_over(ar, xy_last[0], xy_last[1]); + if (but) { + but_cent_start[0] = BLI_rctf_cent_x(&but->rect); + but_cent_start[1] = BLI_rctf_cent_y(&but->rect); + but_type_start = but->type; + } + else { + return OPERATOR_CANCELLED; + } + } + + drag_info = op->customdata = MEM_callocN(sizeof(DragOpInfo), __func__); + copy_v2_v2(drag_info->but_cent_start, but_cent_start); + drag_info->but_type_start = but_type_start; + + /* set the initial button */ + ui_drag_but_set(C, op, xy_last); + ui_drag_but_set(C, op, &event->x); + + WM_event_add_modal_handler(C, op); + return OPERATOR_RUNNING_MODAL; +} + +static int ui_drag_toggle_modal(bContext *C, wmOperator *op, wmEvent *event) +{ + bool done = false; + + switch (event->type) { + case LEFTMOUSE: + { + if (event->val != KM_PRESS) { + done = true; + } + break; + } + case MOUSEMOVE: + { + ARegion *ar = CTX_wm_region(C); + if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) { + done = true; + } + else { + ui_drag_but_set(C, op, &event->x); + } + break; + } + } + + if (done) { + MEM_freeN(op->customdata); + return OPERATOR_FINISHED; + } + else { + return OPERATOR_RUNNING_MODAL; + } +} + +static int ui_drag_toggle_cancel(bContext *UNUSED(C), wmOperator *op) +{ + MEM_freeN(op->customdata); + return OPERATOR_CANCELLED; +} + +static void UI_OT_drag_toggle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Button Drag Toggle"; + ot->description = ""; + ot->idname = "UI_OT_drag_toggle"; + + /* api callbacks */ + ot->invoke = ui_drag_toggle_invoke; + ot->modal = ui_drag_toggle_modal; + ot->cancel = ui_drag_toggle_cancel; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; + + /* properties */ + RNA_def_boolean(ot->srna, "state", true, "State", ""); + RNA_def_int(ot->srna, "last_x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); + RNA_def_int(ot->srna, "last_y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX); +} + /* ********************************************************* */ /* Registration */ @@ -1088,5 +1310,6 @@ void UI_buttons_operatortypes(void) WM_operatortype_append(UI_OT_edittranslation_init); #endif WM_operatortype_append(UI_OT_reloadtranslation); + WM_operatortype_append(UI_OT_drag_toggle); } -- cgit v1.2.3 From c12eeb4ec60ba1bef945612180c72d81871781a2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 06:02:52 +0000 Subject: code cleanup: switch argument order for button_activate_exit() but/data args were flipped compared to other functions. --- source/blender/editors/interface/interface_handlers.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 532f9b50725..5e078c0a599 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5766,7 +5766,8 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH); } -static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove, int onfree) +static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *data, + const bool mousemove, const bool onfree) { uiBlock *block = but->block; uiBut *bt; @@ -5847,7 +5848,7 @@ void ui_button_active_free(const bContext *C, uiBut *but) if (but->active) { data = but->active; data->cancel = TRUE; - button_activate_exit((bContext *)C, data, but, 0, 1); + button_activate_exit((bContext *)C, but, data, false, true); } } @@ -6083,7 +6084,7 @@ void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut *but) data->region = ar; ui_apply_button(C, but->block, but, data, true); /* use onfree event so undo is handled by caller and apply is already done above */ - button_activate_exit((bContext *)C, data, but, false, true); + button_activate_exit((bContext *)C, but, data, false, true); but->active = active_back; } @@ -6096,7 +6097,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu if (oldbut) { data = oldbut->active; data->cancel = TRUE; - button_activate_exit(C, data, oldbut, 0, 0); + button_activate_exit(C, oldbut, data, false, false); } button_activate_init(C, ar, but, type); @@ -6268,7 +6269,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) postbut = data->postbut; posttype = data->posttype; - button_activate_exit(C, data, but, (postbut == NULL), 0); + button_activate_exit(C, but, data, (postbut == NULL), false); /* for jumping to the next button with tab while text editing */ if (postbut) @@ -6397,7 +6398,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u if (menu->menuretval != UI_RETURN_OK) data->cancel = TRUE; - button_activate_exit(C, data, but, 1, 0); + button_activate_exit(C, but, data, true, false); } else if (menu->menuretval & UI_RETURN_OUT) { if (event->type == MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) { @@ -6411,7 +6412,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u } else { data->cancel = TRUE; - button_activate_exit(C, data, but, 1, 0); + button_activate_exit(C, but, data, true, false); } } } -- cgit v1.2.3 From 4aea4c2cb3a48580ff821efea92d5503e24594d7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 07:28:45 +0000 Subject: change to drag-toggle don't exit when the mouse is outside the region - its annoying for setting layers in the 3d header. --- source/blender/editors/interface/interface_ops.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 368ecdefe2c..3b770e117b6 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1246,13 +1246,7 @@ static int ui_drag_toggle_modal(bContext *C, wmOperator *op, wmEvent *event) } case MOUSEMOVE: { - ARegion *ar = CTX_wm_region(C); - if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) { - done = true; - } - else { - ui_drag_but_set(C, op, &event->x); - } + ui_drag_but_set(C, op, &event->x); break; } } -- cgit v1.2.3 From 1cdaf1e3293b6bf641a9b9117a8bcef9364b7d85 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 22 Feb 2013 07:37:17 +0000 Subject: bge bugfix: [#18967] alpha value is never available in the color buffer by Campbell Barton (X11) and me (Win32) This is and old patch (June, 2009). The reason it never made into trunk it's that we (me at least) thought that it should be optional, as a ui or command-line option. However, it seems that OSX always have the OpenGL context with alpha enabled. So I think it's consistent to have the other OSs to follow. The main usage of this is the BGE (or more specifically people using BGE for TV broadcasting) but I think pydevs can have their share of fun with it in Blender as well. --- intern/ghost/intern/GHOST_WindowWin32.cpp | 4 ++++ intern/ghost/intern/GHOST_WindowX11.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index bf429527199..93f9ccbf1eb 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -712,6 +712,7 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd) WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, WGL_COLOR_BITS_ARB, pfd.cColorBits, WGL_DEPTH_BITS_ARB, pfd.cDepthBits, + WGL_ALPHA_BITS_ART, pfd.cAlphaBits, WGL_STENCIL_BITS_ARB, pfd.cStencilBits, WGL_DOUBLE_BUFFER_ARB, GL_TRUE, WGL_SAMPLE_BUFFERS_ARB, GL_TRUE, @@ -1321,6 +1322,9 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) weight += pfd.cColorBits - 8; + if (pdf.cAlphaBits > 0) + weight ++; + /* want swap copy capability -- it matters a lot */ if (pfd.dwFlags & PFD_SWAP_COPY) weight += 16; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 50520b7eda5..8184475b610 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -213,6 +213,7 @@ GHOST_WindowX11( attributes[i++] = GLX_BLUE_SIZE; attributes[i++] = 1; attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1; attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1; + attributes[i++] = GLX_ALPHA_SIZE; attributes[i++] = 1; /* GLX >= 1.4 required for multi-sample */ if (samples && (glxVersionMajor >= 1) && (glxVersionMinor >= 4)) { attributes[i++] = GLX_SAMPLE_BUFFERS; attributes[i++] = 1; -- cgit v1.2.3 From 08d356a7e0a5ca8c840285772ec04c56c6b3421e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 22 Feb 2013 09:20:22 +0000 Subject: Fix #34359: 2.66 crashes when using output node 16bit PNG and Jpeg2K exporters were not aware of the simple fact that float buffer could have only 3 or 1 channels. --- source/blender/imbuf/intern/jp2.c | 219 ++++++++++++++++++++++++++++++-------- source/blender/imbuf/intern/png.c | 94 ++++++++++++---- 2 files changed, 250 insertions(+), 63 deletions(-) diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index ff0aeb068e2..3d04b8ee184 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -108,6 +108,13 @@ static void info_callback(const char *msg, void *client_data) i++, _rect += 4) \ { \ +# define PIXEL_LOOPER_BEGIN_CHANNELS(_rect, _channels) \ + for (y = h - 1; y != (unsigned int)(-1); y--) { \ + for (i = y * w, i_next = (y + 1) * w; \ + i < i_next; \ + i++, _rect += _channels) \ + { \ + # define PIXEL_LOOPER_END \ } \ } (void)0 \ @@ -663,76 +670,198 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) } if (rect_float) { + int channels_in_float = ibuf->channels ? ibuf->channels : 4; + switch (prec) { case 8: /* Convert blenders float color channels to 8, 12 or 16bit ints */ if (numcomps == 4) { - PIXEL_LOOPER_BEGIN(rect_float) - { - premul_to_straight_v4_v4(from_straight, rect_float); - r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2])); - a[i] = DOWNSAMPLE_FLOAT_TO_8BIT(from_straight[3]); + if (channels_in_float == 4) { + PIXEL_LOOPER_BEGIN(rect_float) + { + premul_to_straight_v4_v4(from_straight, rect_float); + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2])); + a[i] = DOWNSAMPLE_FLOAT_TO_8BIT(from_straight[3]); + } + PIXEL_LOOPER_END; + } + else if (channels_in_float == 3) { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3) + { + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[2])); + a[i] = 255; + } + PIXEL_LOOPER_END; + } + else { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1) + { + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = b[i] = r[i]; + a[i] = 255; + } + PIXEL_LOOPER_END; } - PIXEL_LOOPER_END; } else { - PIXEL_LOOPER_BEGIN(rect_float) - { - premul_to_straight_v4_v4(from_straight, rect_float); - r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2])); + if (channels_in_float == 4) { + PIXEL_LOOPER_BEGIN(rect_float) + { + premul_to_straight_v4_v4(from_straight, rect_float); + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2])); + } + PIXEL_LOOPER_END; + } + else if (channels_in_float == 3) { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3) + { + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[2])); + } + PIXEL_LOOPER_END; + } + else { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1) + { + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = b[i] = r[i]; + } + PIXEL_LOOPER_END; } - PIXEL_LOOPER_END; } break; case 12: if (numcomps == 4) { - PIXEL_LOOPER_BEGIN(rect_float) - { - premul_to_straight_v4_v4(from_straight, rect_float); - r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2])); - a[i] = DOWNSAMPLE_FLOAT_TO_12BIT(from_straight[3]); + if (channels_in_float == 4) { + PIXEL_LOOPER_BEGIN(rect_float) + { + premul_to_straight_v4_v4(from_straight, rect_float); + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2])); + a[i] = DOWNSAMPLE_FLOAT_TO_12BIT(from_straight[3]); + } + PIXEL_LOOPER_END; + } + else if (channels_in_float == 3) { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3) + { + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[2])); + a[i] = 4095; + } + PIXEL_LOOPER_END; + } + else { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1) + { + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = b[i] = r[i]; + a[i] = 4095; + } + PIXEL_LOOPER_END; } - PIXEL_LOOPER_END; } else { - PIXEL_LOOPER_BEGIN(rect_float) - { - premul_to_straight_v4_v4(from_straight, rect_float); - r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2])); + if (channels_in_float == 4) { + PIXEL_LOOPER_BEGIN(rect_float) + { + premul_to_straight_v4_v4(from_straight, rect_float); + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2])); + } + PIXEL_LOOPER_END; + } + else if (channels_in_float == 3) { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3) + { + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[2])); + } + PIXEL_LOOPER_END; + } + else { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1) + { + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = b[i] = r[i]; + } + PIXEL_LOOPER_END; } - PIXEL_LOOPER_END; } break; case 16: if (numcomps == 4) { - PIXEL_LOOPER_BEGIN(rect_float) - { - premul_to_straight_v4_v4(from_straight, rect_float); - r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2])); - a[i] = DOWNSAMPLE_FLOAT_TO_16BIT(from_straight[3]); + if (channels_in_float == 4){ + PIXEL_LOOPER_BEGIN(rect_float) + { + premul_to_straight_v4_v4(from_straight, rect_float); + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2])); + a[i] = DOWNSAMPLE_FLOAT_TO_16BIT(from_straight[3]); + } + PIXEL_LOOPER_END; + } + else if (channels_in_float == 3) { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3) + { + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[2])); + a[i] = 65535; + } + PIXEL_LOOPER_END; + } + else { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1) + { + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = b[i] = r[i]; + a[i] = 65535; + } + PIXEL_LOOPER_END; } - PIXEL_LOOPER_END; } else { - PIXEL_LOOPER_BEGIN(rect_float) - { - premul_to_straight_v4_v4(from_straight, rect_float); - r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2])); + if (channels_in_float == 4) { + PIXEL_LOOPER_BEGIN(rect_float) + { + premul_to_straight_v4_v4(from_straight, rect_float); + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2])); + } + PIXEL_LOOPER_END; + } + else if (channels_in_float == 3) { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3) + { + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[2])); + } + PIXEL_LOOPER_END; + } + else { + PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1) + { + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = b[i] = r[i]; + } + PIXEL_LOOPER_END; } - PIXEL_LOOPER_END; } break; } diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index cc73f688e70..68385f22a7a 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -133,6 +133,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) bool is_16bit = (ibuf->ftype & PNG_16BIT); bool has_float = (ibuf->rect_float != NULL); + int channels_in_float = ibuf->channels ? ibuf->channels : 4; float (*chanel_colormanage_cb)(float); @@ -156,7 +157,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) bytesperpixel = (ibuf->planes + 7) >> 3; if ((bytesperpixel > 4) || (bytesperpixel == 2)) { - printf("imb_savepng: Cunsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, name); + printf("imb_savepng: Unsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, name); return (0); } @@ -203,13 +204,32 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) color_type = PNG_COLOR_TYPE_RGBA; if (is_16bit) { if (has_float) { - for (i = ibuf->x * ibuf->y; i > 0; i--) { - premul_to_straight_v4_v4(from_straight, from_float); - to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0])); - to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1])); - to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2])); - to16[3] = ftoshort(chanel_colormanage_cb(from_straight[3])); - to16 += 4; from_float += 4; + if (channels_in_float == 4) { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + premul_to_straight_v4_v4(from_straight, from_float); + to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0])); + to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1])); + to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2])); + to16[3] = ftoshort(chanel_colormanage_cb(from_straight[3])); + to16 += 4; from_float += 4; + } + } + else if (channels_in_float == 3) { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + to16[0] = ftoshort(chanel_colormanage_cb(from_float[0])); + to16[1] = ftoshort(chanel_colormanage_cb(from_float[1])); + to16[2] = ftoshort(chanel_colormanage_cb(from_float[2])); + to16[3] = 65535; + to16 += 4; from_float += 3; + } + } + else { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + to16[0] = ftoshort(chanel_colormanage_cb(from_float[0])); + to16[2] = to16[1] = to16[0]; + to16[3] = 65535; + to16 += 4; from_float++; + } } } else { @@ -236,12 +256,29 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) color_type = PNG_COLOR_TYPE_RGB; if (is_16bit) { if (has_float) { - for (i = ibuf->x * ibuf->y; i > 0; i--) { - premul_to_straight_v4_v4(from_straight, from_float); - to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0])); - to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1])); - to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2])); - to16 += 3; from_float += 4; + if (channels_in_float == 4) { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + premul_to_straight_v4_v4(from_straight, from_float); + to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0])); + to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1])); + to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2])); + to16 += 3; from_float += 4; + } + } + else if (channels_in_float == 3) { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + to16[0] = ftoshort(chanel_colormanage_cb(from_float[0])); + to16[1] = ftoshort(chanel_colormanage_cb(from_float[1])); + to16[2] = ftoshort(chanel_colormanage_cb(from_float[2])); + to16 += 3; from_float += 3; + } + } + else { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + to16[0] = ftoshort(chanel_colormanage_cb(from_float[0])); + to16[2] = to16[1] = to16[0]; + to16 += 3; from_float++; + } } } else { @@ -266,10 +303,31 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) color_type = PNG_COLOR_TYPE_GRAY; if (is_16bit) { if (has_float) { - for (i = ibuf->x * ibuf->y; i > 0; i--) { - premul_to_straight_v4_v4(from_straight, from_float); - to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0])); - to16++; from_float += 4; + float rgb[3]; + if (channels_in_float == 4) { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + premul_to_straight_v4_v4(from_straight, from_float); + rgb[0] = chanel_colormanage_cb(from_straight[0]); + rgb[1] = chanel_colormanage_cb(from_straight[1]); + rgb[2] = chanel_colormanage_cb(from_straight[2]); + to16[0] = ftoshort(rgb_to_bw(rgb)); + to16++; from_float += 4; + } + } + else if (channels_in_float == 3) { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + rgb[0] = chanel_colormanage_cb(from_float[0]); + rgb[1] = chanel_colormanage_cb(from_float[1]); + rgb[2] = chanel_colormanage_cb(from_float[2]); + to16[0] = ftoshort(rgb_to_bw(rgb)); + to16++; from_float += 3; + } + } + else { + for (i = ibuf->x * ibuf->y; i > 0; i--) { + to16[0] = ftoshort(chanel_colormanage_cb(from_float[0])); + to16++; from_float++; + } } } else { -- cgit v1.2.3 From b30bdd5cb65bf13c2bfb0bc9d78b1d5393a43c8f Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Fri, 22 Feb 2013 09:31:42 +0000 Subject: Fixing typos --- intern/ghost/intern/GHOST_WindowWin32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 93f9ccbf1eb..89fece50caa 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -712,7 +712,7 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd) WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, WGL_COLOR_BITS_ARB, pfd.cColorBits, WGL_DEPTH_BITS_ARB, pfd.cDepthBits, - WGL_ALPHA_BITS_ART, pfd.cAlphaBits, + WGL_ALPHA_BITS_ARB, pfd.cAlphaBits, WGL_STENCIL_BITS_ARB, pfd.cStencilBits, WGL_DOUBLE_BUFFER_ARB, GL_TRUE, WGL_SAMPLE_BUFFERS_ARB, GL_TRUE, @@ -1322,7 +1322,7 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) weight += pfd.cColorBits - 8; - if (pdf.cAlphaBits > 0) + if (pfd.cAlphaBits > 0) weight ++; /* want swap copy capability -- it matters a lot */ -- cgit v1.2.3 From 9b5b9e7a09d984f0b058a49f39cb5c6fe9d37cc6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 22 Feb 2013 09:57:10 +0000 Subject: Fix #34351: Displacement map Bake margin does not work --- source/blender/render/intern/source/multires_bake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c index ea42049989b..e81359e8fca 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/source/multires_bake.c @@ -1258,13 +1258,13 @@ static void finish_images(MultiresBakeRender *bkr, MultiresBakeResult *result) if (ibuf->x <= 0 || ibuf->y <= 0) continue; - RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, bkr->bake_filter); - if (use_displacement_buffer) { RE_bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer, result->height_min, result->height_max); } + RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, bkr->bake_filter); + ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID; if (ibuf->rect_float) -- cgit v1.2.3 From 4cf9034f6d59840f8312094c184b9708a251fe0a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 22 Feb 2013 10:06:54 +0000 Subject: Remove extern_ssba workaround SSBA seemed to be working OK last time i've checked it with MSVC and optimization enabled. Also, we'll likely replace it with own BA soon, which works fine with MSVC anyway. --- extern/libmv/CMakeLists.txt | 12 ++++++ extern/libmv/SConscript | 5 ++- extern/libmv/bundle.sh | 33 +------------- extern/libmv/third_party/CMakeLists.txt | 1 - extern/libmv/third_party/SConscript | 1 - extern/libmv/third_party/ssba/CMakeLists.txt | 64 ---------------------------- extern/libmv/third_party/ssba/SConscript | 36 ---------------- source/blenderplayer/CMakeLists.txt | 1 - source/creator/CMakeLists.txt | 1 - 9 files changed, 17 insertions(+), 137 deletions(-) delete mode 100644 extern/libmv/third_party/ssba/CMakeLists.txt delete mode 100644 extern/libmv/third_party/ssba/SConscript diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index 0cf2211fe88..0fc90fdd9b9 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -35,6 +35,7 @@ set(INC set(INC_SYS ../Eigen3 third_party/ssba + third_party/ldl/Include ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ) @@ -82,6 +83,9 @@ set(SRC third_party/gflags/gflags.cc third_party/gflags/gflags_completions.cc third_party/gflags/gflags_reporting.cc + third_party/ldl/Source/ldl.c + third_party/ssba/Geometry/v3d_metricbundle.cpp + third_party/ssba/Math/v3d_optimization.cpp libmv-capi.h libmv/base/id_generator.h @@ -139,8 +143,16 @@ set(SRC third_party/gflags/gflags/gflags.h third_party/gflags/mutex.h third_party/gflags/util.h + third_party/ldl/Include/ldl.h third_party/msinttypes/inttypes.h third_party/msinttypes/stdint.h + third_party/ssba/Geometry/v3d_cameramatrix.h + third_party/ssba/Geometry/v3d_distortion.h + third_party/ssba/Geometry/v3d_metricbundle.h + third_party/ssba/Math/v3d_linear.h + third_party/ssba/Math/v3d_linear_utils.h + third_party/ssba/Math/v3d_mathutilities.h + third_party/ssba/Math/v3d_optimization.h ) if(WIN32) diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index a0ab5bd61d7..8fd8c566e4d 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -22,6 +22,9 @@ src += env.Glob('libmv/simple_pipeline/*.cc') src += env.Glob('libmv/tracking/*.cc') src += env.Glob('third_party/fast/*.c') src += env.Glob('third_party/gflags/*.cc') +src += env.Glob('third_party/ldl/Source/*.c') +src += env.Glob('third_party/ssba/Geometry/*.cpp') +src += env.Glob('third_party/ssba/Math/*.cpp') incs = '. ../Eigen3 third_party/ceres/include' incs += ' ' + env['BF_PNG_INC'] @@ -38,7 +41,7 @@ else: src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' -incs += ' ./third_party/ssba ../colamd/Include' +incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include' env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh index 27f964ad5b3..53487cf020e 100755 --- a/extern/libmv/bundle.sh +++ b/extern/libmv/bundle.sh @@ -122,8 +122,6 @@ cat > CMakeLists.txt << EOF # If you're doing changes in this file, please update template # in that script too -add_subdirectory(third_party) - set(INC . ../colamd/Include @@ -186,14 +184,6 @@ if(WIN32) third_party/msinttypes ) endif() - - if(MSVC) - set(MSVC_OFLAGS O1 O2 Ox) - foreach(FLAG \${MSVC_OFLAGS}) - string(REPLACE "\${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "\${CMAKE_CXX_FLAGS_RELEASE}") - string(REPLACE "\${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "\${CMAKE_C_FLAGS_RELWITHDEBINFO}") - endforeach() - endif() else() list(APPEND SRC ${third_glog_sources} @@ -230,10 +220,6 @@ Import('env') defs = [] -cflags_libmv = Split(env['CFLAGS']) -ccflags_libmv = Split(env['CCFLAGS']) -cxxflags_libmv = Split(env['CXXFLAGS']) - defs.append('V3DLIB_ENABLE_SUITESPARSE') defs.append('GOOGLE_GLOG_DLL_DECL=') @@ -251,30 +237,13 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', ' ${win_src} src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] src += ['./third_party/glog/src/windows/port.cc'] - - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cflags_libmv.append('/Od') - ccflags_libmv.append('/Od') - cxxflags_libmv.append('/Od') - - if not env['BF_DEBUG']: - defs.append('NDEBUG') - else: - if not env['BF_DEBUG']: - cflags_libmv += Split(env['REL_CFLAGS']) - ccflags_libmv += Split(env['REL_CCFLAGS']) - cxxflags_libmv += Split(env['REL_CXXFLAGS']) else: src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' - if not env['BF_DEBUG']: - cflags_libmv += Split(env['REL_CFLAGS']) - ccflags_libmv += Split(env['REL_CCFLAGS']) - cxxflags_libmv += Split(env['REL_CXXFLAGS']) incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include' -env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv ) +env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) SConscript(['third_party/SConscript']) EOF diff --git a/extern/libmv/third_party/CMakeLists.txt b/extern/libmv/third_party/CMakeLists.txt index 7989d97345c..6212fe480b1 100644 --- a/extern/libmv/third_party/CMakeLists.txt +++ b/extern/libmv/third_party/CMakeLists.txt @@ -1,3 +1,2 @@ -add_subdirectory(ssba) add_subdirectory(ceres) diff --git a/extern/libmv/third_party/SConscript b/extern/libmv/third_party/SConscript index 2e30650f656..b05692e385f 100644 --- a/extern/libmv/third_party/SConscript +++ b/extern/libmv/third_party/SConscript @@ -1,4 +1,3 @@ #!/usr/bin/python -SConscript(['ssba/SConscript']) SConscript(['ceres/SConscript']) diff --git a/extern/libmv/third_party/ssba/CMakeLists.txt b/extern/libmv/third_party/ssba/CMakeLists.txt deleted file mode 100644 index 72379625396..00000000000 --- a/extern/libmv/third_party/ssba/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2013, Blender Foundation -# All rights reserved. -# -# Contributor(s): Blender Foundation, -# Sergey Sharybin -# -# ***** END GPL LICENSE BLOCK ***** - -set(INC - . - ../ldl/Include - ../../../colamd/Include -) - -set(INC_SYS -) - -set(SRC - Geometry/v3d_metricbundle.cpp - Math/v3d_optimization.cpp - - Geometry/v3d_cameramatrix.h - Geometry/v3d_distortion.h - Geometry/v3d_metricbundle.h - Math/v3d_linear.h - Math/v3d_linear_utils.h - Math/v3d_mathutilities.h - Math/v3d_optimization.h - - ../ldl/Source/ldl.c - ../ldl/Include/ldl.h -) - -if(WIN32) - if(MSVC) - set(MSVC_OFLAGS O1 O2 Ox) - foreach(FLAG ${MSVC_OFLAGS}) - string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") - endforeach() - endif() -endif() - -add_definitions( - -DV3DLIB_ENABLE_SUITESPARSE -) - -blender_add_lib(extern_ssba "${SRC}" "${INC}" "${INC_SYS}") diff --git a/extern/libmv/third_party/ssba/SConscript b/extern/libmv/third_party/ssba/SConscript deleted file mode 100644 index 667b40f929b..00000000000 --- a/extern/libmv/third_party/ssba/SConscript +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python - -import sys -import os - -Import('env') - -defs = [] - -cflags_ssba = Split(env['CFLAGS']) -ccflags_ssba = Split(env['CCFLAGS']) -cxxflags_ssba = Split(env['CXXFLAGS']) - -defs.append('V3DLIB_ENABLE_SUITESPARSE') - -src = env.Glob('Geometry/*.cpp') -src += env.Glob('Math/*.cpp') -src += env.Glob('../ldl/Source/*.c') - -incs = '. ../ldl/Include ../../../colamd/Include' - -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cflags_ssba.append('/Od') - ccflags_ssba.append('/Od') - cxxflags_ssba.append('/Od') - - if not env['BF_DEBUG']: - defs.append('NDEBUG') - else: - if not env['BF_DEBUG']: - cflags_ssba += Split(env['REL_CFLAGS']) - ccflags_ssba += Split(env['REL_CCFLAGS']) - cxxflags_ssba += Split(env['REL_CXXFLAGS']) - -env.BlenderLib ( libname = 'extern_ssba', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_ssba, cc_compileflags=ccflags_ssba, cxx_compileflags=cxxflags_ssba ) diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index cd3edc11c46..fb06c5e4477 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -167,7 +167,6 @@ endif() if(WITH_LIBMV) list(APPEND BLENDER_SORTED_LIBS extern_libmv) - list(APPEND BLENDER_SORTED_LIBS extern_ssba) list(APPEND BLENDER_SORTED_LIBS extern_ceres) endif() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index bb10bdd0bae..bb5f34167bc 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -923,7 +923,6 @@ endif() if(WITH_LIBMV) list(APPEND BLENDER_SORTED_LIBS extern_libmv) - list(APPEND BLENDER_SORTED_LIBS extern_ssba) list(APPEND BLENDER_SORTED_LIBS extern_ceres) endif() -- cgit v1.2.3 From ca689e88aac0e33bf0fd9701f5c6174b5ff5f3fd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 22 Feb 2013 10:13:15 +0000 Subject: Motion tracking dopesheet Highlight background depending on number of tracks existing on frame. This is not so much mathematically accurate displaying where things shall be improved, but it's nice feedback about which frames better be reviewed. Bad frames are tracks < 8, highlighted with red. OK-ish frame are 8 <= tracks < 16, highlighted with yellow. Could be some artifacts with color region start/end, this is a bit unclear what exactly expected to be highlighted -- frames are displayed as dots, but in fact they're quite noticeable segments. --- svn merge -r54572:54573 ^/branches/soc-2011-tomato --- source/blender/blenkernel/intern/tracking.c | 88 ++++++++++++++++++++++ source/blender/blenloader/intern/readfile.c | 1 + .../editors/space_clip/clip_dopesheet_draw.c | 27 +++++++ source/blender/makesdna/DNA_tracking_types.h | 24 +++++- 4 files changed, 139 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index a6519f8005c..1a7458f531c 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -141,8 +141,10 @@ static void tracking_dopesheet_free(MovieTrackingDopesheet *dopesheet) } BLI_freelistN(&dopesheet->channels); + BLI_freelistN(&dopesheet->coverage_segments); dopesheet->channels.first = dopesheet->channels.last = NULL; + dopesheet->coverage_segments.first = dopesheet->coverage_segments.last = NULL; dopesheet->tot_channel = 0; } @@ -3784,6 +3786,88 @@ static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, in } } +static int coverage_from_count(int count) +{ + if (count < 8) + return TRACKING_COVERAGE_BAD; + else if (count < 16) + return TRACKING_COVERAGE_ACCEPTABLE; + return TRACKING_COVERAGE_OK; +} + +static void tracking_dopesheet_calc_coverage(MovieTracking *tracking) +{ + MovieTrackingDopesheet *dopesheet = &tracking->dopesheet; + MovieTrackingObject *object = BKE_tracking_object_get_active(tracking); + ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object); + MovieTrackingTrack *track; + int frames, start_frame = INT_MAX, end_frame = -INT_MAX; + int *per_frame_counter; + int prev_coverage, last_segment_frame; + int i; + + /* find frame boundaries */ + for (track = tracksbase->first; track; track = track->next) { + start_frame = min_ii(start_frame, track->markers[0].framenr); + end_frame = max_ii(end_frame, track->markers[track->markersnr - 1].framenr); + } + + frames = end_frame - start_frame + 1; + + /* this is a per-frame counter of markers (how many markers belongs to the same frame) */ + per_frame_counter = MEM_callocN(sizeof(int) * frames, "per frame track counter"); + + /* find per-frame markers count */ + for (track = tracksbase->first; track; track = track->next) { + int i; + + for (i = 0; i < track->markersnr; i++) { + MovieTrackingMarker *marker = &track->markers[i]; + + /* TODO: perhaps we need to add check for non-single-frame track here */ + if ((marker->flag & MARKER_DISABLED) == 0) + per_frame_counter[marker->framenr - start_frame]++; + } + } + + /* convert markers count to coverage and detect segments with the same coverage */ + prev_coverage = coverage_from_count(per_frame_counter[0]); + last_segment_frame = start_frame; + + /* means only disabled tracks in the beginning, could be ignored */ + if (!per_frame_counter[0]) + prev_coverage = TRACKING_COVERAGE_OK; + + for (i = 1; i < frames; i++) { + int coverage = coverage_from_count(per_frame_counter[i]); + + /* means only disabled tracks in the end, could be ignored */ + if (i == frames - 1 && !per_frame_counter[i]) + coverage = TRACKING_COVERAGE_OK; + + if (coverage != prev_coverage || i == frames - 1) { + MovieTrackingDopesheetCoverageSegment *coverage_segment; + int end_segment_frame = i - 1 + start_frame; + + if (end_segment_frame == last_segment_frame) + end_segment_frame++; + + coverage_segment = MEM_callocN(sizeof(MovieTrackingDopesheetCoverageSegment), "tracking coverage segment"); + coverage_segment->coverage = prev_coverage; + coverage_segment->start_frame = last_segment_frame; + coverage_segment->end_frame = end_segment_frame; + + BLI_addtail(&dopesheet->coverage_segments, coverage_segment); + + last_segment_frame = end_segment_frame; + } + + prev_coverage = coverage; + } + + MEM_freeN(per_frame_counter); +} + void BKE_tracking_dopesheet_tag_update(MovieTracking *tracking) { MovieTrackingDopesheet *dopesheet = &tracking->dopesheet; @@ -3811,6 +3895,7 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking) reconstruction = BKE_tracking_object_get_reconstruction(tracking, object); + /* channels */ for (track = tracksbase->first; track; track = track->next) { MovieTrackingDopesheetChannel *channel; @@ -3838,5 +3923,8 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking) tracking_dopesheet_sort(tracking, sort_method, inverse); + /* frame coverage */ + tracking_dopesheet_calc_coverage(tracking); + dopesheet->ok = TRUE; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0e799b3d951..f3dd4e5d54a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6450,6 +6450,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) clip->tracking.dopesheet.ok = 0; clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL; + clip->tracking.dopesheet.coverage_segments.first = clip->tracking.dopesheet.coverage_segments.last = NULL; link_list(fd, &tracking->objects); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 09d97c36436..b1be9217819 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -145,6 +145,31 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh glPopMatrix(); } +static void clip_draw_dopesheet_background(ARegion *ar, MovieClip *clip) +{ + View2D *v2d = &ar->v2d; + MovieTracking *tracking = &clip->tracking; + MovieTrackingDopesheet *dopesheet = &tracking->dopesheet; + MovieTrackingDopesheetCoverageSegment *coverage_segment; + + for (coverage_segment = dopesheet->coverage_segments.first; + coverage_segment; + coverage_segment = coverage_segment->next) + { + if (coverage_segment->coverage < TRACKING_COVERAGE_OK) { + int start_frame = BKE_movieclip_remap_clip_to_scene_frame(clip, coverage_segment->start_frame); + int end_frame = BKE_movieclip_remap_clip_to_scene_frame(clip, coverage_segment->end_frame); + + if (coverage_segment->coverage == TRACKING_COVERAGE_BAD) + glColor4f(1.0f, 0.0f, 0.0f, 0.07f); + else + glColor4f(1.0f, 1.0f, 0.0f, 0.07f); + + glRectf(start_frame, v2d->cur.ymin, end_frame, v2d->cur.ymax); + } + } +} + void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) { MovieClip *clip = ED_space_clip_get_clip(sc); @@ -179,6 +204,8 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) glEnable(GL_BLEND); + clip_draw_dopesheet_background(ar, clip); + for (channel = dopesheet->channels.first; channel; channel = channel->next) { float yminc = (float) (y - CHANNEL_HEIGHT_HALF); float ymaxc = (float) (y + CHANNEL_HEIGHT_HALF); diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index b258fbaa668..8789a17a7f7 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -248,13 +248,28 @@ typedef struct MovieTrackingDopesheetChannel { int max_segment, total_frames; /* longest segment length and total number of tracked frames */ } MovieTrackingDopesheetChannel; +typedef struct MovieTrackingDopesheetCoverageSegment { + struct MovieTrackingDopesheetCoverageSegment *next, *prev; + + int coverage; + int start_frame; + int end_frame; + + int pad; +} MovieTrackingDopesheetCoverageSegment; + typedef struct MovieTrackingDopesheet { int ok; /* flag if dopesheet information is still relevant */ short sort_method; /* method to be used to sort tracks */ short flag; /* dopesheet building flag such as inverted order of sort */ - /* runtime stuff */ + /* ** runtime stuff ** */ + + /* summary */ + ListBase coverage_segments; + + /* detailed */ ListBase channels; int tot_channel; @@ -409,4 +424,11 @@ enum { TRACKING_DOPE_SHOW_HIDDEN = (1 << 2) }; +/* MovieTrackingDopesheetCoverageSegment->trackness */ +enum { + TRACKING_COVERAGE_BAD = 0, + TRACKING_COVERAGE_ACCEPTABLE = 1, + TRACKING_COVERAGE_OK = 2 +}; + #endif -- cgit v1.2.3 From 6f0cbba0d31b6b9b104df9f63652b40c40583cb3 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Fri, 22 Feb 2013 10:46:27 +0000 Subject: =?UTF-8?q?Simple=20preset=20function=20for=20setting=20common=20n?= =?UTF-8?q?ode=20sizes=20based=20on=20enum=20instead=20of=20explicit=20num?= =?UTF-8?q?bers.=20Most=20nodes=20use=20the=20default=20size=20now=20and?= =?UTF-8?q?=20don't=20need=20explicit=20function=20calls.=20Most=20remaini?= =?UTF-8?q?ng=20nodes=20can=20also=20use=20the=20preset=20variant=20instea?= =?UTF-8?q?d=20of=20explicit=20size=20values,=20these=20are=20only=20neede?= =?UTF-8?q?d=20for=20a=20few=20special=20nodes.=20Thanks=20to=20Sebastian?= =?UTF-8?q?=20K=C3=B6nig=20for=20suggesting=20this=20and=20doing=20the=20m?= =?UTF-8?q?onkey=20work=20of=20changing=20node=20definitions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/blenkernel/BKE_node.h | 7 +++++++ source/blender/blenkernel/intern/node.c | 20 +++++++++++++++++--- .../nodes/composite/nodes/node_composite_alphaOver.c | 1 - .../composite/nodes/node_composite_bilateralblur.c | 1 - .../nodes/composite/nodes/node_composite_blur.c | 1 - .../nodes/composite/nodes/node_composite_bokehblur.c | 1 - .../composite/nodes/node_composite_bokehimage.c | 1 - .../nodes/composite/nodes/node_composite_boxmask.c | 1 - .../composite/nodes/node_composite_brightness.c | 1 - .../composite/nodes/node_composite_channelMatte.c | 1 - .../composite/nodes/node_composite_chromaMatte.c | 1 - .../composite/nodes/node_composite_colorMatte.c | 1 - .../composite/nodes/node_composite_colorSpill.c | 1 - .../composite/nodes/node_composite_colorcorrection.c | 2 +- .../nodes/composite/nodes/node_composite_composite.c | 1 - .../nodes/composite/nodes/node_composite_crop.c | 1 - .../nodes/composite/nodes/node_composite_defocus.c | 1 - .../nodes/composite/nodes/node_composite_despeckle.c | 1 - .../nodes/composite/nodes/node_composite_diffMatte.c | 1 - .../nodes/composite/nodes/node_composite_dilate.c | 1 - .../composite/nodes/node_composite_directionalblur.c | 1 - .../nodes/composite/nodes/node_composite_displace.c | 1 - .../composite/nodes/node_composite_distanceMatte.c | 1 - .../composite/nodes/node_composite_doubleEdgeMask.c | 1 - .../composite/nodes/node_composite_ellipsemask.c | 2 +- .../nodes/composite/nodes/node_composite_filter.c | 1 - .../nodes/composite/nodes/node_composite_flip.c | 1 - .../nodes/composite/nodes/node_composite_gamma.c | 1 - .../nodes/composite/nodes/node_composite_glare.c | 1 - .../nodes/composite/nodes/node_composite_hueSatVal.c | 1 - .../composite/nodes/node_composite_huecorrect.c | 2 +- .../nodes/composite/nodes/node_composite_idMask.c | 1 - .../nodes/composite/nodes/node_composite_image.c | 2 -- .../nodes/composite/nodes/node_composite_inpaint.c | 1 - .../nodes/composite/nodes/node_composite_invert.c | 1 - .../nodes/composite/nodes/node_composite_keying.c | 1 - .../composite/nodes/node_composite_keyingscreen.c | 1 - .../nodes/composite/nodes/node_composite_lensdist.c | 1 - .../nodes/composite/nodes/node_composite_levels.c | 1 - .../composite/nodes/node_composite_lummaMatte.c | 1 - .../nodes/composite/nodes/node_composite_mapRange.c | 1 - .../nodes/composite/nodes/node_composite_mapUV.c | 1 - .../nodes/composite/nodes/node_composite_mapValue.c | 1 - .../nodes/composite/nodes/node_composite_mask.c | 1 - .../nodes/composite/nodes/node_composite_math.c | 1 - .../nodes/composite/nodes/node_composite_mixrgb.c | 1 - .../nodes/composite/nodes/node_composite_movieclip.c | 1 - .../composite/nodes/node_composite_moviedistortion.c | 1 - .../nodes/composite/nodes/node_composite_normal.c | 1 - .../nodes/composite/nodes/node_composite_normalize.c | 1 - .../composite/nodes/node_composite_outputFile.c | 1 - .../nodes/composite/nodes/node_composite_pixelate.c | 1 - .../nodes/composite/nodes/node_composite_premulkey.c | 1 - .../nodes/composite/nodes/node_composite_rgb.c | 2 +- .../nodes/composite/nodes/node_composite_rotate.c | 1 - .../nodes/composite/nodes/node_composite_scale.c | 1 - .../composite/nodes/node_composite_sepcombHSVA.c | 2 -- .../composite/nodes/node_composite_sepcombRGBA.c | 2 -- .../composite/nodes/node_composite_sepcombYCCA.c | 2 -- .../composite/nodes/node_composite_sepcombYUVA.c | 2 -- .../nodes/composite/nodes/node_composite_setalpha.c | 1 - .../composite/nodes/node_composite_splitViewer.c | 1 - .../composite/nodes/node_composite_stabilize2d.c | 1 - .../nodes/composite/nodes/node_composite_switch.c | 2 +- .../nodes/composite/nodes/node_composite_texture.c | 1 - .../nodes/composite/nodes/node_composite_tonemap.c | 1 - .../nodes/composite/nodes/node_composite_trackpos.c | 1 - .../nodes/composite/nodes/node_composite_transform.c | 1 - .../nodes/composite/nodes/node_composite_translate.c | 1 - .../nodes/composite/nodes/node_composite_valToRgb.c | 4 ++-- .../nodes/composite/nodes/node_composite_value.c | 2 +- .../nodes/composite/nodes/node_composite_vecBlur.c | 1 - .../nodes/composite/nodes/node_composite_viewer.c | 1 - .../nodes/composite/nodes/node_composite_zcombine.c | 1 - 74 files changed, 32 insertions(+), 81 deletions(-) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 5024b3636c5..19fe621ade9 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -261,6 +261,12 @@ typedef struct bNodeType { #define SOCK_IN 1 #define SOCK_OUT 2 +typedef enum eNodeSizePreset { + NODE_SIZE_DEFAULT, + NODE_SIZE_SMALL, + NODE_SIZE_LARGE +} eNodeSizePreset; + struct bNodeTreeExec; typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree); @@ -419,6 +425,7 @@ void node_type_base(struct bNodeTreeType *ttype, struct bNodeType *nt const char *name, short nclass, short flag); void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs); void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth); +void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size); void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp)); void node_type_valid(struct bNodeType *ntype, int (*validfunc)(struct bNodeTree *ntree, struct bNodeTemplate *ntemp)); void node_type_storage(struct bNodeType *ntype, diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 97bee320ecb..86fe47268d6 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2028,9 +2028,8 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char ntype->update_internal_links = ttype->update_internal_links; /* default size values */ - ntype->width = 140; - ntype->minwidth = 100; - ntype->maxwidth = 320; + node_type_size_preset(ntype, NODE_SIZE_DEFAULT); + ntype->height = 100; ntype->minheight = 30; ntype->maxheight = FLT_MAX; @@ -2062,6 +2061,21 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid ntype->maxwidth = maxwidth; } +void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size) +{ + switch (size) { + case NODE_SIZE_DEFAULT: + node_type_size(ntype, 140, 100, 320); + break; + case NODE_SIZE_SMALL: + node_type_size(ntype, 100, 80, 320); + break; + case NODE_SIZE_LARGE: + node_type_size(ntype, 140, 120, 500); + break; + } +} + void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *)) { if (storagename) diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c index 3722ad179d0..217670621a8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c @@ -54,7 +54,6 @@ void register_node_type_cmp_alphaover(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out); - node_type_size(&ntype, 80, 40, 160); node_type_init(&ntype, node_alphaover_init); node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index 34cc9a90615..b8bf379b14b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -57,7 +57,6 @@ void register_node_type_cmp_bilateralblur(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out); - node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_bilateralblur); node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 9d19f9667bc..20fce05a40e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -57,7 +57,6 @@ void register_node_type_cmp_blur(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW | NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out); - node_type_size(&ntype, 120, 80, 200); node_type_init(&ntype, node_composit_init_blur); node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c index 222ac7a5cdf..ea3162a9e55 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c @@ -61,7 +61,6 @@ void register_node_type_cmp_bokehblur(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out); - node_type_size(&ntype, 120, 80, 200); node_type_init(&ntype, node_composit_init_bokehblur); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c index fa21e122ebf..b006280ca8a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c @@ -58,7 +58,6 @@ void register_node_type_cmp_bokehimage(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_bokehimage_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_bokehimage); node_type_storage(&ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c index d3c6b2ccef0..eb2c58894f3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c @@ -61,7 +61,6 @@ void register_node_type_cmp_boxmask(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out); - node_type_size(&ntype, 260, 110, 300); node_type_init(&ntype, node_composit_init_boxmask); node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c index 719423edcf8..025f5c03c7c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c @@ -54,7 +54,6 @@ void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index bfeeb7ddc99..acb0566be7c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -66,7 +66,6 @@ void register_node_type_cmp_channel_matte(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out); - node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_channel_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 83c8bbc9a1e..29782c3bc51 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -62,7 +62,6 @@ void register_node_type_cmp_chroma_matte(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out); - node_type_size(&ntype, 200, 80, 300); node_type_init(&ntype, node_composit_init_chroma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index 1642d9283c3..9905a2446b8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -62,7 +62,6 @@ void register_node_type_cmp_color_matte(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out); - node_type_size(&ntype, 200, 80, 300); node_type_init(&ntype, node_composit_init_color_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index 3679a65b238..32fa446790e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -60,7 +60,6 @@ void register_node_type_cmp_color_spill(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out); - node_type_size(&ntype, 140, 80, 200); node_type_init(&ntype, node_composit_init_color_spill); node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c index 526f8472992..19f2fad2e42 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c @@ -81,7 +81,7 @@ void register_node_type_cmp_colorcorrection(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_colorcorrection_in, cmp_node_colorcorrection_out); - node_type_size(&ntype, 400, 200, 500); + node_type_size(&ntype, 400, 200, 600); node_type_init(&ntype, node_composit_init_colorcorrection); node_type_storage(&ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 6cff4039767..ea281a3f556 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -45,7 +45,6 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_composite_in, NULL); - node_type_size(&ntype, 80, 60, 200); /* Do not allow muting for this node. */ node_type_internal_links(&ntype, NULL); diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c index 90d48a543ad..10af55480cd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.c +++ b/source/blender/nodes/composite/nodes/node_composite_crop.c @@ -59,7 +59,6 @@ void register_node_type_cmp_crop(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_crop); node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 88787cc869e..c05f1d6fcff 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -67,7 +67,6 @@ void register_node_type_cmp_defocus(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); - node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_defocus); node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c index 8fc97ef6a86..816a1803e47 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c @@ -54,7 +54,6 @@ void register_node_type_cmp_despeckle(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out); - node_type_size(&ntype, 80, 40, 120); node_type_init(&ntype, node_composit_init_despeckle); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index bcfd9dd768b..29712d54e32 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -59,7 +59,6 @@ void register_node_type_cmp_diff_matte(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out); - node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_diff_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c index 0238914a9d1..fabc54f61b3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c @@ -57,7 +57,6 @@ void register_node_type_cmp_dilateerode(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out); - node_type_size(&ntype, 130, 100, 320); node_type_init(&ntype, node_composit_init_dilateerode); node_type_storage(&ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index ca32f37a32e..6197d78563c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -56,7 +56,6 @@ void register_node_type_cmp_dblur(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out); - node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_dblur); node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index 595596765a9..251345d8a28 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -53,7 +53,6 @@ void register_node_type_cmp_displace(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index fffb85cca8e..26f8055e7f2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -60,7 +60,6 @@ void register_node_type_cmp_distance_matte(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out); - node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_distance_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c index 4f42c40ee13..d5dd63a4042 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c @@ -48,7 +48,6 @@ void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); - node_type_size(&ntype, 210, 210, 210); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c index 761b0b13f11..c2e34dc07a0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c @@ -61,7 +61,7 @@ void register_node_type_cmp_ellipsemask(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_ellipsemask_in, cmp_node_ellipsemask_out); - node_type_size(&ntype, 260, 110, 300); + node_type_size(&ntype, 260, 110, 320); node_type_init(&ntype, node_composit_init_ellipsemask); node_type_storage(&ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 338bfc0326d..3ecc7282632 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -49,7 +49,6 @@ void register_node_type_cmp_filter(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out); - node_type_size(&ntype, 80, 40, 120); node_type_label(&ntype, node_filter_label); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c index de41c7274fe..f56805809c5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.c +++ b/source/blender/nodes/composite/nodes/node_composite_flip.c @@ -49,7 +49,6 @@ void register_node_type_cmp_flip(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 8a9966a2420..6da56165979 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -51,7 +51,6 @@ void register_node_type_cmp_gamma(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index 5fdb262de97..dde056de807 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -63,7 +63,6 @@ void register_node_type_cmp_glare(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out); - node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_glare); node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index be748199bc5..64ba24e082d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -59,7 +59,6 @@ void register_node_type_cmp_hue_sat(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out); - node_type_size(&ntype, 150, 80, 250); node_type_init(&ntype, node_composit_init_hue_sat); node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index 45002b0aa0b..738f2f511f7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -65,7 +65,7 @@ void register_node_type_cmp_huecorrect(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out); - node_type_size(&ntype, 320, 140, 400); + node_type_size(&ntype, 320, 140, 500); node_type_init(&ntype, node_composit_init_huecorrect); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c index 8aa08386ae9..89ef4ad3d01 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c @@ -50,7 +50,6 @@ void register_node_type_cmp_idmask(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 66a141b8b6e..563ad2b74b2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -324,7 +324,6 @@ void register_node_type_cmp_image(bNodeTreeType *ttype) static bNodeType ntype; node_type_base(ttype, &ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); - node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, node_composit_init_image); node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image); node_type_update(&ntype, cmp_node_image_update, NULL); @@ -341,7 +340,6 @@ void register_node_type_cmp_rlayers(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out); - node_type_size(&ntype, 150, 100, 300); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.c b/source/blender/nodes/composite/nodes/node_composite_inpaint.c index 95e5834456c..4844b35fb62 100644 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.c +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.c @@ -50,7 +50,6 @@ void register_node_type_cmp_inpaint(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_inpaint_in, cmp_node_inpaint_out); - node_type_size(&ntype, 130, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index 05bccf84d58..0bfbe42868b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -55,7 +55,6 @@ void register_node_type_cmp_invert(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out); - node_type_size(&ntype, 120, 120, 140); node_type_init(&ntype, node_composit_init_invert); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c index 5e285095a4e..51e0e9a8e39 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.c +++ b/source/blender/nodes/composite/nodes/node_composite_keying.c @@ -84,7 +84,6 @@ void register_node_type_cmp_keying(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_keying_in, cmp_node_keying_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_keying); node_type_storage(&ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c index 5db7f8fc991..1974087e8e7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c @@ -65,7 +65,6 @@ void register_node_type_cmp_keyingscreen(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_keyingscreen_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_keyingscreen); node_type_storage(&ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c index e454022de3d..15d10e07946 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c @@ -57,7 +57,6 @@ void register_node_type_cmp_lensdist(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out); - node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_lensdist); node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 5f9797d9123..f50a8838d74 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -56,7 +56,6 @@ void register_node_type_cmp_view_levels(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_view_levels); node_type_storage(&ntype, "ImageUser", NULL, NULL); diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index 6e0c877fe1c..60a7f3014de 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -59,7 +59,6 @@ void register_node_type_cmp_luma_matte(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out); - node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_luma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c index f96e133b19f..07f34e79bd1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapRange.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.c @@ -52,7 +52,6 @@ void register_node_type_cmp_map_range(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out); - node_type_size(&ntype, 120, 60, 150); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index 8fd49cd206b..fa4c8d7022c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -50,7 +50,6 @@ void register_node_type_cmp_mapuv(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c index 62db0be5411..046eeaf4fc8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c @@ -53,7 +53,6 @@ void register_node_type_cmp_map_value(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out); - node_type_size(&ntype, 100, 60, 150); node_type_init(&ntype, node_composit_init_map_value); node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c index 8be6ecd27fd..27534698422 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.c +++ b/source/blender/nodes/composite/nodes/node_composite_mask.c @@ -61,7 +61,6 @@ void register_node_type_cmp_mask(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_mask_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_mask); node_type_storage(&ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index 5bf555cd605..5f5369ce03a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -51,7 +51,6 @@ void register_node_type_cmp_math(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); - node_type_size(&ntype, 120, 110, 160); node_type_label(&ntype, node_math_label); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c index fed73e13c92..23e4fc90457 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c @@ -50,7 +50,6 @@ void register_node_type_cmp_mix_rgb(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); - node_type_size(&ntype, 110, 60, 120); node_type_label(&ntype, node_blend_label); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c index 85745d2ff40..39d46e053bf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c @@ -56,7 +56,6 @@ void register_node_type_cmp_movieclip(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_movieclip_out); - node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, init); node_type_storage(&ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c index 4817c59bbbd..198ffbb2857 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c @@ -72,7 +72,6 @@ void register_node_type_cmp_moviedistortion(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); - node_type_size(&ntype, 140, 100, 320); node_type_label(&ntype, label); node_type_storage(&ntype, NULL, storage_free, storage_copy); diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c index 1497757bbf4..88db5d36810 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.c +++ b/source/blender/nodes/composite/nodes/node_composite_normal.c @@ -62,7 +62,6 @@ void register_node_type_cmp_normal(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out); node_type_init(&ntype, init); - node_type_size(&ntype, 100, 60, 200); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c index f90a5cdba74..db811666900 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.c +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c @@ -49,7 +49,6 @@ void register_node_type_cmp_normalize(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out); - node_type_size(&ntype, 100, 60, 150); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index e8a650682c2..dff09b93845 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -231,7 +231,6 @@ void register_node_type_cmp_output_file(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_socket_templates(&ntype, NULL, NULL); - node_type_size(&ntype, 140, 80, 300); node_type_init(&ntype, init_output_file); node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file); node_type_update(&ntype, update_output_file, NULL); diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c index 5eac4867a23..3b65a2cdbd5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.c +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.c @@ -51,7 +51,6 @@ void register_node_type_cmp_pixelate(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_pixelate_in, cmp_node_pixelate_out); - node_type_size(&ntype, 130, 100, 130); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c index 88f583b402e..01eb3607760 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c @@ -50,7 +50,6 @@ void register_node_type_cmp_premulkey(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c index ad06d7a9a7e..30b23a4c146 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c @@ -57,7 +57,7 @@ void register_node_type_cmp_rgb(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out); node_type_init(&ntype, node_composit_init_rgb); - node_type_size(&ntype, 140, 80, 140); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 4eb869e5444..6b5521ea4d2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -55,7 +55,6 @@ void register_node_type_cmp_rotate(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_rotate); nodeRegisterType(ttype, &ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index 5136aec112d..6c2c6c37cb7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -51,7 +51,6 @@ void register_node_type_cmp_scale(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c index 83b9d5d3fcd..d463f35a07a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c @@ -52,7 +52,6 @@ void register_node_type_cmp_sephsva(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } @@ -77,7 +76,6 @@ void register_node_type_cmp_combhsva(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c index 8508087da0f..03b43f5073f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c @@ -51,7 +51,6 @@ void register_node_type_cmp_seprgba(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } @@ -77,7 +76,6 @@ void register_node_type_cmp_combrgba(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index a7cc7367c67..16aba1ba408 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -53,7 +53,6 @@ void register_node_type_cmp_sepycca(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } @@ -79,7 +78,6 @@ void register_node_type_cmp_combycca(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c index 88edf7ec6b0..7d7ec166fd4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c @@ -53,7 +53,6 @@ void register_node_type_cmp_sepyuva(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } @@ -79,7 +78,6 @@ void register_node_type_cmp_combyuva(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out); - node_type_size(&ntype, 80, 40, 140); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c index 0cec19b15af..d36acc6c054 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c @@ -49,7 +49,6 @@ void register_node_type_cmp_setalpha(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out); - node_type_size(&ntype, 120, 40, 140); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index 3f4c3d67e2c..38a6981613a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -55,7 +55,6 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_splitviewer_in, NULL); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c index 964e54eb862..6b345b4c15c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c @@ -51,7 +51,6 @@ void register_node_type_cmp_stabilize2d(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c index 7f9127c969f..49fa61a8397 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.c +++ b/source/blender/nodes/composite/nodes/node_composite_switch.c @@ -52,7 +52,7 @@ void register_node_type_cmp_switch(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_switch_in, cmp_node_switch_out); - node_type_size(&ntype, 110, 60, 120); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c index 17b5720c7ad..515093fc3e1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_texture.c +++ b/source/blender/nodes/composite/nodes/node_composite_texture.c @@ -50,7 +50,6 @@ void register_node_type_cmp_texture(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out); - node_type_size(&ntype, 120, 80, 240); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c index 94492431c9f..fd3a217b150 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c @@ -63,7 +63,6 @@ void register_node_type_cmp_tonemap(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out); - node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_tonemap); node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c index 41dc5633ee5..8014e879894 100644 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c @@ -52,7 +52,6 @@ void register_node_type_cmp_trackpos(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_trackpos_out); - node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, init); node_type_storage(&ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c index f51e49328ab..3ed8bdb9995 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.c +++ b/source/blender/nodes/composite/nodes/node_composite_transform.c @@ -54,7 +54,6 @@ void register_node_type_cmp_transform(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out); - node_type_size(&ntype, 140, 100, 320); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c index 60b32563569..5d555cdcda9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.c +++ b/source/blender/nodes/composite/nodes/node_composite_translate.c @@ -58,7 +58,6 @@ void register_node_type_cmp_translate(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out); - node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_translate); node_type_storage(&ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c index c40880cc421..5a23507bcc7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c @@ -55,7 +55,7 @@ void register_node_type_cmp_valtorgb(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_valtorgb_in, cmp_node_valtorgb_out); - node_type_size(&ntype, 240, 200, 300); + node_type_size(&ntype, 240, 200, 320); node_type_init(&ntype, node_composit_init_valtorgb); node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); @@ -80,7 +80,7 @@ void register_node_type_cmp_rgbtobw(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out); - node_type_size(&ntype, 80, 40, 120); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c index 05e79efa196..306170baf93 100644 --- a/source/blender/nodes/composite/nodes/node_composite_value.c +++ b/source/blender/nodes/composite/nodes/node_composite_value.c @@ -56,7 +56,7 @@ void register_node_type_cmp_value(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_value_out); node_type_init(&ntype, node_composit_init_value); - node_type_size(&ntype, 80, 40, 120); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c index ff4fe8d8da5..35fb4a944db 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c @@ -60,7 +60,6 @@ void register_node_type_cmp_vecblur(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out); - node_type_size(&ntype, 120, 80, 200); node_type_init(&ntype, node_composit_init_vecblur); node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index 233a0627a7a..211ebe54eb0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -58,7 +58,6 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_viewer_in, NULL); - node_type_size(&ntype, 80, 60, 200); node_type_init(&ntype, node_composit_init_viewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c index 89d0cccd183..ba81174e103 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c @@ -54,7 +54,6 @@ void register_node_type_cmp_zcombine(bNodeTreeType *ttype) node_type_base(ttype, &ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out); - node_type_size(&ntype, 80, 40, 120); nodeRegisterType(ttype, &ntype); } -- cgit v1.2.3 From 5f09090cade763f9ec388b122bd9d5802f7c6b67 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 11:06:25 +0000 Subject: remove 'register' from drag-toggle operator (so it doesn't show in the redo panel). update credits script. --- source/blender/editors/interface/interface_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 3b770e117b6..d48d699d881 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1279,7 +1279,7 @@ static void UI_OT_drag_toggle(wmOperatorType *ot) ot->cancel = ui_drag_toggle_cancel; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; + ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL; /* properties */ RNA_def_boolean(ot->srna, "state", true, "State", ""); -- cgit v1.2.3 From 109b37e2c5e9733673f5c1e35bd54565475c183b Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 22 Feb 2013 12:24:08 +0000 Subject: Fix for [#34356] Inputs list in file output doesn't appear properly. * This made File Output Node more or less useless in the 2.66 release, as the list did not appear. Issue caused in r53355. Should be back ported to "a" release. --- source/blender/editors/space_node/drawnode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index f303bba9886..b211bca4c0a 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2163,12 +2163,12 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C active_index = RNA_int_get(ptr, "active_input_index"); /* using different collection properties if multilayer format is enabled */ if (multilayer) { - uiTemplateList(col, C, "UI_UL_list", "", ptr, "layer_slots", ptr, "active_input_index", 0, 0, 0); + uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "layer_slots", ptr, "active_input_index", 0, 0, 0); RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr); } else { - uiTemplateList(col, C, "UI_UL_list", "", ptr, "file_slots", ptr, "active_input_index", 0, 0, 0); + uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "file_slots", ptr, "active_input_index", 0, 0, 0); RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"), active_index, &active_input_ptr); } -- cgit v1.2.3 From 7ad0790189c77c1f910578928e69be48cc7aad37 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 13:35:32 +0000 Subject: patch [#34103] Add explanatory comments to dna_genfile.[ch] from Lawrence D'Oliveiro (ldo) --- source/blender/blenloader/intern/readfile.c | 13 +- source/blender/blenloader/intern/writefile.c | 4 +- source/blender/makesdna/DNA_genfile.h | 10 +- source/blender/makesdna/intern/dna_genfile.c | 391 +++++++++++++++++++-------- source/blender/makesrna/intern/rna_define.c | 3 +- 5 files changed, 293 insertions(+), 128 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f3dd4e5d54a..9b896c12d10 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -41,6 +41,7 @@ #include // for fabs #include /* for va_start/end */ +#include "BLI_utildefines.h" #ifndef WIN32 # include // for read close #else @@ -829,7 +830,7 @@ static int read_file_dna(FileData *fd) for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (bhead->code == DNA1) { - int do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) ? 1 : 0; + const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0; fd->filesdna = DNA_sdna_from_data(&bhead[1], bhead->len, do_endian_swap); if (fd->filesdna) { @@ -952,11 +953,11 @@ static FileData *filedata_new(void) fd->filedes = -1; fd->gzfiledes = NULL; - /* XXX, this doesn't need to be done all the time, - * but it keeps us re-entrant, remove once we have - * a lib that provides a nice lock. - zr - */ - fd->memsdna = DNA_sdna_from_data(DNAstr, DNAlen, 0); + /* XXX, this doesn't need to be done all the time, + * but it keeps us re-entrant, remove once we have + * a lib that provides a nice lock. - zr + */ + fd->memsdna = DNA_sdna_from_data(DNAstr, DNAlen, false); fd->datamap = oldnewmap_new(); fd->globmap = oldnewmap_new(); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e7a53670849..ca186455224 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -89,6 +89,8 @@ # include "BLI_winstuff.h" #endif +#include "BLI_utildefines.h" + /* allow writefile to use deprecated functionality (for forward compatibility code) */ #define DNA_DEPRECATED_ALLOW @@ -198,7 +200,7 @@ static WriteData *writedata_new(int file) if (wd == NULL) return NULL; - wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, 0); + wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, false); wd->file= file; diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index 2d1549ff487..ac75b03c742 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -35,9 +35,13 @@ struct SDNA; -extern const unsigned char DNAstr[]; /* DNA.c */ -extern const int DNAlen; +/* DNAstr contains the prebuilt SDNA structure defining the layouts of the types + * used by this version of Blender. It is defined in a file dna.c, which is + * generated by the makesdna program during the build process (see makesdna.c). */ +extern const unsigned char DNAstr[]; +extern const int DNAlen; /* length of DNAstr */ +/* primitive (non-struct, non-pointer/function/array) types--do not change ordering! */ typedef enum eSDNA_Type { SDNA_TYPE_CHAR = 0, SDNA_TYPE_UCHAR = 1, @@ -56,7 +60,7 @@ typedef enum eSDNA_Type { /* define so switch statements don't complain */ #define SDNA_TYPE_VOID 9 -struct SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap); +struct SDNA *DNA_sdna_from_data(const void *data, const int datalen, bool do_endian_swap); void DNA_sdna_free(struct SDNA *sdna); int DNA_struct_find_nr(struct SDNA *sdna, const char *str); diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 10c3b0bbee4..27520a746be 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -29,7 +29,10 @@ /** \file blender/makesdna/intern/dna_genfile.c * \ingroup DNA * - * Functions for struct-dna, the genetic file dot c! + * Lowest-level functions for decoding the parts of a saved .blend + * file, including interpretation of its SDNA block and conversion of + * contents of other parts according to the differences between that + * SDNA and the SDNA of the current (running) version of Blender. */ @@ -134,12 +137,11 @@ typedef long long __int64; * */ -/* local */ -static int le_int(int temp); -static short le_short(short temp); - /* ************************* ENDIAN STUFF ********************** */ +/** + * converts a short between big/little endian. + */ static short le_short(short temp) { short new; @@ -151,7 +153,9 @@ static short le_short(short temp) return new; } - +/** + * converts an int between big/little endian. + */ static int le_int(int temp) { int new; @@ -169,6 +173,10 @@ static int le_int(int temp) /* ************************* MAKE DNA ********************** */ /* allowed duplicate code from makesdna.c */ + +/** + * parses the "[n]" on the end of an array name and returns the number of array elements n. + */ int DNA_elem_array_size(const char *astr, int len) { int a, mul = 1; @@ -207,14 +215,23 @@ void DNA_sdna_free(SDNA *sdna) MEM_freeN(sdna); } -static int ispointer(const char *name) +/** + * Return true if the name indicates a pointer of some kind. + */ +static bool ispointer(const char *name) { /* check if pointer or function pointer */ return (name[0] == '*' || (name[0] == '(' && name[1] == '*')); } -static int elementsize(SDNA *sdna, short type, short name) -/* call with numbers from struct-array */ +/** + * Returns the size of struct fields of the specified type and name. + * + * \param type Index into sdna->types/typelens + * \param name Index into sdna->names, + * needed to extract possible pointer/array information. + */ +static int elementsize(const SDNA *sdna, short type, short name) { int mul, namelen, len; const char *cp; @@ -225,16 +242,20 @@ static int elementsize(SDNA *sdna, short type, short name) namelen = strlen(cp); /* is it a pointer or function pointer? */ if (ispointer(cp)) { - /* has the naam an extra length? (array) */ + /* has the name an extra length? (array) */ mul = 1; - if (cp[namelen - 1] == ']') mul = DNA_elem_array_size(cp, namelen); + if (cp[namelen - 1] == ']') { + mul = DNA_elem_array_size(cp, namelen); + } len = sdna->pointerlen * mul; } else if (sdna->typelens[type]) { - /* has the naam an extra length? (array) */ + /* has the name an extra length? (array) */ mul = 1; - if (cp[namelen - 1] == ']') mul = DNA_elem_array_size(cp, namelen); + if (cp[namelen - 1] == ']') { + mul = DNA_elem_array_size(cp, namelen); + } len = mul * sdna->typelens[type]; @@ -262,6 +283,9 @@ static void printstruct(SDNA *sdna, short strnr) } #endif +/** + * Returns a pointer to the start of the struct info for the struct with the specified name. + */ static short *findstruct_name(SDNA *sdna, const char *str) { int a; @@ -272,19 +296,26 @@ static short *findstruct_name(SDNA *sdna, const char *str) sp = sdna->structs[a]; - if (strcmp(sdna->types[sp[0]], str) == 0) return sp; + if (strcmp(sdna->types[sp[0]], str) == 0) { + return sp; + } } return NULL; } +/** + * Returns the index of the struct info for the struct with the specified name. + */ int DNA_struct_find_nr(SDNA *sdna, const char *str) { short *sp = NULL; if (sdna->lastfind < sdna->nr_structs) { sp = sdna->structs[sdna->lastfind]; - if (strcmp(sdna->types[sp[0]], str) == 0) return sdna->lastfind; + if (strcmp(sdna->types[sp[0]], str) == 0) { + return sdna->lastfind; + } } #ifdef WITH_DNA_GHASH @@ -311,8 +342,10 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str) /* ************************* READ DNA ********************** */ -static void init_structDNA(SDNA *sdna, int do_endian_swap) -/* in sdna->data the data, now we convert that to something understandable */ +/** + * In sdna->data the data, now we convert that to something understandable + */ +static void init_structDNA(SDNA *sdna, bool do_endian_swap) { int *data, *verg, gravity_fix = -1; intptr_t nr; @@ -481,7 +514,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) if (sp[1] != 2 || (sdna->pointerlen != 4 && sdna->pointerlen != 8)) { printf("ListBase struct error! Needs it to calculate pointerize.\n"); - exit(0); + exit(1); /* well, at least sizeof(ListBase) is error proof! (ton) */ } @@ -506,7 +539,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) } } -SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap) +/** + * Constructs and returns a decoded SDNA structure from the given encoded SDNA data block. + */ +SDNA *DNA_sdna_from_data(const void *data, const int datalen, bool do_endian_swap) { SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna"); @@ -525,7 +561,11 @@ SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap /* ******************* HANDLE DNA ***************** */ -static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr) +/** + * Used by #DNA_struct_get_compareflags (below) to recursively mark all structs + * containing a field of type structnr as changed between old and current SDNAs. + */ +static void recurs_test_compflags(const SDNA *sdna, char *compflags, int structnr) { int a, b, typenr, elems; short *sp; @@ -554,75 +594,70 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr) } -/* Unsure of exact function - compares the sdna argument to - * newsdna and sets up the information necessary to convert - * data written with a dna of oldsdna to in-memory data with a - * structure defined by the newsdna sdna (I think). -zr - */ -/* well, the function below is just a lookup table to speed - * up reading files. doh! -ton +/** + * Constructs and returns an array of byte flags with one element for each struct in oldsdna, + * indicating how it compares to newsdna: + * + * flag value: + * - 0 Struct has disappeared (values of this struct type will not be loaded by the current Blender) + * - 1 Struct is the same (can be loaded with straight memory copy after any necessary endian conversion) + * - 2 Struct is different in some way (needs to be copied/converted field by field) */ - - -char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) +char *DNA_struct_get_compareflags(SDNA *oldsdna, SDNA *newsdna) { - /* flag: 0: doesn't exist anymore (or not yet) - * 1: is equal - * 2: is different - */ int a, b; - short *spold, *spcur; + const short *sp_old, *sp_new; const char *str1, *str2; char *compflags; - if (sdna->nr_structs == 0) { + if (oldsdna->nr_structs == 0) { printf("error: file without SDNA\n"); return NULL; } - - compflags = MEM_callocN(sdna->nr_structs, "compflags"); - /* we check all structs in 'sdna' and compare them with + compflags = MEM_callocN(oldsdna->nr_structs, "compflags"); + + /* we check all structs in 'oldsdna' and compare them with * the structs in 'newsdna' */ - for (a = 0; a < sdna->nr_structs; a++) { - spold = sdna->structs[a]; + for (a = 0; a < oldsdna->nr_structs; a++) { + sp_old = oldsdna->structs[a]; /* search for type in cur */ - spcur = findstruct_name(newsdna, sdna->types[spold[0]]); + sp_new = findstruct_name(newsdna, oldsdna->types[sp_old[0]]); - if (spcur) { - compflags[a] = 2; + if (sp_new) { + compflags[a] = 2; /* initial assumption */ /* compare length and amount of elems */ - if (spcur[1] == spold[1]) { - if (newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]]) { + if (sp_new[1] == sp_old[1]) { + if (newsdna->typelens[sp_new[0]] == oldsdna->typelens[sp_old[0]]) { /* same length, same amount of elems, now per type and name */ - b = spold[1]; - spold += 2; - spcur += 2; + b = sp_old[1]; + sp_old += 2; + sp_new += 2; while (b > 0) { - str1 = newsdna->types[spcur[0]]; - str2 = sdna->types[spold[0]]; + str1 = newsdna->types[sp_new[0]]; + str2 = oldsdna->types[sp_old[0]]; if (strcmp(str1, str2) != 0) break; - str1 = newsdna->names[spcur[1]]; - str2 = sdna->names[spold[1]]; + str1 = newsdna->names[sp_new[1]]; + str2 = oldsdna->names[sp_old[1]]; if (strcmp(str1, str2) != 0) break; /* same type and same name, now pointersize */ if (ispointer(str1)) { - if (sdna->pointerlen != newsdna->pointerlen) break; + if (oldsdna->pointerlen != newsdna->pointerlen) break; } b--; - spold += 2; - spcur += 2; + sp_old += 2; + sp_new += 2; } - if (b == 0) compflags[a] = 1; + if (b == 0) compflags[a] = 1; /* no differences found */ } } @@ -638,15 +673,15 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) /* Because structs can be inside structs, we recursively * set flags when a struct is altered */ - for (a = 0; a < sdna->nr_structs; a++) { - if (compflags[a] == 2) recurs_test_compflags(sdna, compflags, a); + for (a = 0; a < oldsdna->nr_structs; a++) { + if (compflags[a] == 2) recurs_test_compflags(oldsdna, compflags, a); } #if 0 - for (a = 0; a < sdna->nr_structs; a++) { + for (a = 0; a < oldsdna->nr_structs; a++) { if (compflags[a] == 2) { - spold = sdna->structs[a]; - printf("changed: %s\n", sdna->types[spold[0]]); + spold = oldsdna->structs[a]; + printf("changed: %s\n", oldsdna->types[spold[0]]); } } #endif @@ -654,6 +689,9 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) return compflags; } +/** + * Converts the name of a primitive type to its enumeration code. + */ static eSDNA_Type sdna_type_nr(const char *dna_type) { if ((strcmp(dna_type, "char") == 0) || (strcmp(dna_type, "const char") == 0)) return SDNA_TYPE_CHAR; @@ -670,7 +708,20 @@ static eSDNA_Type sdna_type_nr(const char *dna_type) else return -1; /* invalid! */ } -static void cast_elem(const char *ctype, const char *otype, const char *name, char *curdata, char *olddata) +/** + * Converts a value of one primitive type to another. + * Note there is no optimization for the case where otype and ctype are the same: + * assumption is that caller will handle this case. + * + * \param ctype Name of type to convert to + * \param otype Name of type to convert from + * \param name Field name to extract array-size information + * \param curdata Where to put converted data + * \param olddata Data of type otype to convert + */ +static void cast_elem( + const char *ctype, const char *otype, const char *name, + char *curdata, const char *olddata) { double val = 0.0; int arrlen, curlen = 1, oldlen = 1; @@ -748,7 +799,18 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch } } -static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata, char *olddata) +/** + * Converts pointer values between different sizes. These are only used + * as lookup keys to identify data blocks in the saved .blend file, not + * as actual in-memory pointers. + * + * \param curlen Pointer length to conver to + * \param oldlen Length of pointers in olddata + * \param name Field name to extract array-size information + * \param curdata Where to put converted data + * \param olddata Data to convert + */ +static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata, const char *olddata) { #ifdef WIN32 __int64 lval; @@ -770,7 +832,10 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata #else lval = *( (long long *)olddata); #endif - *((int *)curdata) = lval >> 3; /* is of course gambling! */ + /* WARNING: 32-bit Blender trying to load file saved by 64-bit Blender, + * pointers may lose uniqueness on truncation! (Hopefully this wont + * happen unless/until we ever get to multi-gigabyte .blend files...) */ + *((int *)curdata) = lval >> 3; } else if (curlen == 8 && oldlen == 4) { #ifdef WIN32 @@ -791,22 +856,42 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata } } +/** + * Equality test on name and oname excluding any array-size suffix. + */ static int elem_strcmp(const char *name, const char *oname) { int a = 0; - /* strcmp without array part */ - while (1) { if (name[a] != oname[a]) return 1; - if (name[a] == '[') break; - if (name[a] == 0) break; + if (name[a] == '[' || oname[a] == '[') break; + if (name[a] == 0 || oname[a] == 0) break; a++; } return 0; } -static char *find_elem(SDNA *sdna, const char *type, const char *name, short *old, char *olddata, short **sppo) +/** + * Returns the address of the data for the specified field within olddata + * according to the struct format pointed to by old, or NULL if no such + * field can be found. + * + * \param sdna Old SDNA + * \param type Current field type name + * \param name Current field name + * \param old Pointer to struct information in sdna + * \param olddata Struct data + * \param sppo Optional place to return pointer to field info in sdna + * \return Data address. + */ +static char *find_elem( + const SDNA *sdna, + const char *type, + const char *name, + const short *old, + char *olddata, + const short **sppo) { int a, elemcount, len; const char *otype, *oname; @@ -823,8 +908,8 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol len = elementsize(sdna, old[0], old[1]); - if (elem_strcmp(name, oname) == 0) { /* naam equal */ - if (strcmp(type, otype) == 0) { /* type equal */ + if (elem_strcmp(name, oname) == 0) { /* name equal */ + if (strcmp(type, otype) == 0) { /* type equal */ if (sppo) *sppo = old; return olddata; } @@ -837,8 +922,26 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol return NULL; } -static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, - char *type, const char *name, char *curdata, short *old, char *olddata) +/** + * Converts the contents of a single field of a struct, of a non-struct type, + * from oldsdna to newsdna format. + * + * \param newsdna SDNA of current Blender + * \param oldsdna SDNA of Blender that saved file + * \param type current field type name + * \param name current field name + * \param curdata put field data converted to newsdna here + * \param old pointer to struct info in oldsdna + * \param olddata struct contents laid out according to oldsdna + */ +static void reconstruct_elem( + const SDNA *newsdna, + const SDNA *oldsdna, + const char *type, + const char *name, + char *curdata, + const short *old, + const char *olddata) { /* rules: test for NAME: * - name equal: @@ -849,17 +952,16 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, * (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where * can I force this?) */ - int a, elemcount, len, array, oldsize, cursize, mul; - char *otype; - const char *oname, *cp; + int a, elemcount, len, countpos, oldsize, cursize, mul; + const char *otype, *oname, *cp; /* is 'name' an array? */ cp = name; - array = 0; + countpos = 0; while (*cp && *cp != '[') { - cp++; array++; + cp++; countpos++; } - if (*cp != '[') array = 0; + if (*cp != '[') countpos = 0; /* in old is the old struct */ elemcount = old[1]; @@ -877,33 +979,38 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, else if (strcmp(type, otype) == 0) { /* type equal */ memcpy(curdata, olddata, len); } - else cast_elem(type, otype, name, curdata, olddata); + else { + cast_elem(type, otype, name, curdata, olddata); + } return; } - else if (array) { /* name is an array */ + else if (countpos != 0) { /* name is an array */ - if (oname[array] == '[' && strncmp(name, oname, array) == 0) { /* basis equal */ + if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */ cursize = DNA_elem_array_size(name, strlen(name)); oldsize = DNA_elem_array_size(oname, strlen(oname)); - if (ispointer(name)) { /* handle pointer or functionpointer */ - if (cursize > oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata); - else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); + if (ispointer(name)) { /* handle pointer or functionpointer */ + cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, + cursize > oldsize ? oname : name, + curdata, olddata); } - else if (name[0] == '*' || strcmp(type, otype) == 0) { /* type equal */ - mul = len / oldsize; - mul *= (cursize < oldsize) ? cursize : oldsize; + else if (strcmp(type, otype) == 0) { /* type equal */ + mul = len / oldsize; /* size of single old array element */ + mul *= (cursize < oldsize) ? cursize : oldsize; /* smaller of sizes of old and new arrays */ memcpy(curdata, olddata, mul); - /* terminate strings */ - if (oldsize > cursize && strcmp(type, "char") == 0) - curdata[mul - 1] = 0; + if (oldsize > cursize && strcmp(type, "char") == 0) { + /* string had to be truncated, ensure it's still null-terminated */ + curdata[mul - 1] = '\0'; + } } else { - if (cursize > oldsize) cast_elem(type, otype, oname, curdata, olddata); - else cast_elem(type, otype, name, curdata, olddata); + cast_elem(type, otype, + cursize > oldsize ? oname : name, + curdata, olddata); } return; } @@ -912,16 +1019,37 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, } } -static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, - char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur) +/** + * Converts the contents of an entire struct from oldsdna to newsdna format. + * + * \param newsdna SDNA of current Blender + * \param oldsdna SDNA of Blender that saved file + * \param compflags + * + * Result from DNA_struct_get_compareflags to avoid needless conversions. + * \param oldSDNAnr Index of old struct definition in oldsdna + * \param data Struct contents laid out according to oldsdna + * \param curSDNAnr Index of current struct definition in newsdna + * \param cur Where to put converted struct contents + */ +static void reconstruct_struct( + SDNA *newsdna, + SDNA *oldsdna, + const char *compflags, + + int oldSDNAnr, + char *data, + int curSDNAnr, + char *cur) { /* Recursive! * Per element from cur_struct, read data from old_struct. * If element is a struct, call recursive. */ int a, elemcount, elen, eleno, mul, mulo, firststructtypenr; - short *spo, *spc, *sppo; - char *type, *cpo, *cpc; + const short *spo, *spc, *sppo; + const char *type; + char *cpo, *cpc; const char *name, *nameo; if (oldSDNAnr == -1) return; @@ -945,7 +1073,7 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, spc += 2; cpc = cur; - for (a = 0; a < elemcount; a++, spc += 2) { + for (a = 0; a < elemcount; a++, spc += 2) { /* convert each field */ type = newsdna->types[spc[0]]; name = newsdna->names[spc[1]]; @@ -953,7 +1081,7 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, /* test: is type a struct? */ if (spc[0] >= firststructtypenr && !ispointer(name)) { - + /* struct field type */ /* where does the old struct data start (and is there an old one?) */ cpo = find_elem(oldsdna, type, name, spo, data, &sppo); @@ -981,26 +1109,34 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, if (mulo <= 0) break; } } - else cpc += elen; + else { + cpc += elen; /* skip field no longer present */ + } } else { - + /* non-struct field type */ reconstruct_elem(newsdna, oldsdna, type, name, cpc, spo, data); cpc += elen; - } } } +/** + * Does endian swapping on the fields of a struct value. + * + * \param oldsdna SDNA of Blender that saved file + * \param oldSDNAnr Index of struct info within oldsdna + * \param data Struct data + */ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) { /* Recursive! * If element is a struct, call recursive. */ int a, mul, elemcount, elen, elena, firststructtypenr; - short *spo, *spc, skip; - char *type, *cpo, *cur, cval; - const char *name; + const short *spo, *spc; + char *cpo, *cur, cval; + const char *type, *name; if (oldSDNAnr == -1) return; firststructtypenr = *(oldsdna->structs[0]); @@ -1021,6 +1157,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) /* test: is type a struct? */ if (spc[0] >= firststructtypenr && !ispointer(name)) { + /* struct field type */ /* where does the old data start (is there one?) */ cpo = find_elem(oldsdna, type, name, spo, data, NULL); if (cpo) { @@ -1036,7 +1173,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } } else { - + /* non-struct field type */ if (ispointer(name)) { if (oldsdna->pointerlen == 8) { @@ -1060,15 +1197,15 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) { /* exception: variable called blocktype/ipowin: derived from ID_ */ - skip = 0; + bool skip = false; if (name[0] == 'b' && name[1] == 'l') { - if (strcmp(name, "blocktype") == 0) skip = 1; + if (strcmp(name, "blocktype") == 0) skip = true; } else if (name[0] == 'i' && name[1] == 'p') { - if (strcmp(name, "ipowin") == 0) skip = 1; + if (strcmp(name, "ipowin") == 0) skip = true; } - if (skip == 0) { + if (skip == false) { mul = DNA_elem_array_size(name, strlen(name)); cpo = cur; while (mul--) { @@ -1111,17 +1248,30 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) cpo += 8; } } + /* FIXME: no conversion for SDNA_TYPE_DOUBLE? */ } } cur += elen; } } +/** + * \param newsdna SDNA of current Blender + * \param oldsdna SDNA of Blender that saved file + * \param compflags + * + * Result from DNA_struct_get_compareflags to avoid needless conversions + * \param oldSDNAnr Index of struct info within oldsdna + * \param blocks The number of array elements + * \param data Array of struct data + * \return An allocated reconstructed struct + */ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, int blocks, void *data) { int a, curSDNAnr, curlen = 0, oldlen; - short *spo, *spc; - char *cur, *type, *cpc, *cpo; + const short *spo, *spc; + char *cur, *cpc, *cpo; + const char *type; /* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */ spo = oldsdna->structs[oldSDNAnr]; @@ -1150,18 +1300,25 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int return cur; } +/** + * Returns the offset of the field with the specified name and type within the specified + * struct type in sdna. + */ int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const char *name) { - int SDNAnr = DNA_struct_find_nr(sdna, stype); - short *spo = sdna->structs[SDNAnr]; - char *cp = find_elem(sdna, vartype, name, spo, NULL, NULL); + const int SDNAnr = DNA_struct_find_nr(sdna, stype); + const short * const spo = sdna->structs[SDNAnr]; + char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL); return (int)((intptr_t)cp); } +/** + * Returns the size in bytes of a primitive type. + */ int DNA_elem_type_size(const eSDNA_Type elem_nr) { - /* should containt all enum types */ + /* should contain all enum types */ switch (elem_nr) { case SDNA_TYPE_CHAR: case SDNA_TYPE_UCHAR: diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 97ef4dfd0a8..c92777af8fd 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -33,6 +33,7 @@ #include #include +#include "BLI_utildefines.h" #include "MEM_guardedalloc.h" #include "DNA_genfile.h" @@ -465,7 +466,7 @@ BlenderRNA *RNA_create(void) brna = MEM_callocN(sizeof(BlenderRNA), "BlenderRNA"); - DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, 0); + DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, false); DefRNA.structs.first = DefRNA.structs.last = NULL; DefRNA.error = 0; DefRNA.preprocess = 1; -- cgit v1.2.3 From 4df5b943edeb7bb65a5b19c6130e1959966c2878 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 14:12:55 +0000 Subject: patch [#34103] - listbase.patch, insertlinkbefore.patch from Lawrence D'Oliveiro (ldo) notes from tracker: use bool for return type from BLI_remlink_safe, necessitating including BLI_utildefines.h in BLI_listbase.h get rid of duplicate BLI_insertlink, use BLI_insertlinkafter instead. A few places which were using BLI_insertlinkafter (actually BLI_insertlink), when it would be simpler to use BLI_insertlinkbefore instead. --- source/blender/blenkernel/intern/idprop.c | 6 +- source/blender/blenkernel/intern/key.c | 2 +- source/blender/blenkernel/intern/sca.c | 6 +- source/blender/blenlib/BLI_listbase.h | 4 +- source/blender/blenlib/intern/listbase.c | 140 +++++++++++++-------- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/object/object_modifier.c | 6 +- source/blender/editors/physics/particle_boids.c | 8 +- source/blender/editors/physics/particle_object.c | 8 +- .../editors/space_sequencer/sequencer_modifier.c | 4 +- source/blender/makesdna/DNA_listBase.h | 7 +- source/blender/makesrna/intern/rna_action.c | 2 +- 12 files changed, 119 insertions(+), 76 deletions(-) diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 9fdf51ceba9..19ef1e3971d 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -454,7 +454,7 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src) if (strcmp(loop->name, prop->name) == 0) { IDProperty *copy = IDP_CopyProperty(prop); - BLI_insertlink(&dest->data.group, loop, copy); + BLI_insertlinkafter(&dest->data.group, loop, copy); BLI_remlink(&dest->data.group, loop); IDP_FreeProperty(loop); @@ -479,7 +479,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) { IDProperty *loop; if ((loop = IDP_GetPropertyFromGroup(group, prop->name))) { - BLI_insertlink(&group->data.group, loop, prop); + BLI_insertlinkafter(&group->data.group, loop, prop); BLI_remlink(&group->data.group, loop); IDP_FreeProperty(loop); @@ -532,7 +532,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew) { if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) { group->len++; - BLI_insertlink(&group->data.group, previous, pnew); + BLI_insertlinkafter(&group->data.group, previous, pnew); return 1; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index cb0a11a16e0..f3dc391738e 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -246,7 +246,7 @@ void BKE_key_sort(Key *key) /* find the right location and insert before */ for (kb2 = key->block.first; kb2; kb2 = kb2->next) { if (kb2->pos > kb->pos) { - BLI_insertlink(&key->block, kb2->prev, kb); + BLI_insertlinkafter(&key->block, kb2->prev, kb); break; } } diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index eb4e0d9c679..6433b73fda0 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -734,7 +734,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up) } if (tmp) { BLI_remlink(&ob->sensors, sens); - BLI_insertlink(&ob->sensors, tmp, sens); + BLI_insertlinkafter(&ob->sensors, tmp, sens); } } } @@ -778,7 +778,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up) tmp = tmp->next; } BLI_remlink(&ob->controllers, cont); - BLI_insertlink(&ob->controllers, tmp, cont); + BLI_insertlinkafter(&ob->controllers, tmp, cont); } } @@ -818,7 +818,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up) } if (tmp) { BLI_remlink(&ob->actuators, act); - BLI_insertlink(&ob->actuators, tmp, act); + BLI_insertlinkafter(&ob->actuators, tmp, act); } } } diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index d06956e39de..54cd687eeac 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -32,6 +32,7 @@ * \ingroup bli */ +#include "BLI_utildefines.h" #include "DNA_listBase.h" //struct ListBase; //struct LinkData; @@ -40,7 +41,6 @@ extern "C" { #endif -void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink); int BLI_findindex(const struct ListBase *listbase, const void *vlink); int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset); @@ -59,7 +59,7 @@ void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, const int o void BLI_freelistN(struct ListBase *listbase); void BLI_addtail(struct ListBase *listbase, void *vlink); void BLI_remlink(struct ListBase *listbase, void *vlink); -int BLI_remlink_safe(struct ListBase *listbase, void *vlink); +bool BLI_remlink_safe(struct ListBase *listbase, void *vlink); void BLI_addhead(struct ListBase *listbase, void *vlink); void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink); diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index c60a9ae6bfc..348efaf40a9 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -28,9 +28,10 @@ /** \file blender/blenlib/intern/listbase.c * \ingroup bli + * + * Manipulations on ListBase structs */ - #include #include @@ -41,10 +42,11 @@ #include "BLI_listbase.h" - /* implementation */ -/* Ripped this from blender.c */ +/** + * moves the entire contents of \a src onto the end of \a dst. + */ void BLI_movelisttolist(ListBase *dst, ListBase *src) { if (src->first == NULL) return; @@ -61,6 +63,9 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src) src->first = src->last = NULL; } +/** + * Prepends \a vlink (assumed to begin with a Link) onto listbase. + */ void BLI_addhead(ListBase *listbase, void *vlink) { Link *link = vlink; @@ -77,6 +82,9 @@ void BLI_addhead(ListBase *listbase, void *vlink) } +/** + * Appends \a vlink (assumed to begin with a Link) onto listbase. + */ void BLI_addtail(ListBase *listbase, void *vlink) { Link *link = vlink; @@ -93,6 +101,9 @@ void BLI_addtail(ListBase *listbase, void *vlink) } +/** + * Removes \a vlink from \a listbase. Assumes it is linked into there! + */ void BLI_remlink(ListBase *listbase, void *vlink) { Link *link = vlink; @@ -107,18 +118,24 @@ void BLI_remlink(ListBase *listbase, void *vlink) if (listbase->first == link) listbase->first = link->next; } -int BLI_remlink_safe(ListBase *listbase, void *vlink) +/** + * Checks that \a vlink is linked into listbase, removing it from there if so. + */ +bool BLI_remlink_safe(ListBase *listbase, void *vlink) { if (BLI_findindex(listbase, vlink) != -1) { BLI_remlink(listbase, vlink); - return 1; + return true; } else { - return 0; + return false; } } +/** + * Removes \a vlink from listbase and disposes of it. Assumes it is linked into there! + */ void BLI_freelinkN(ListBase *listbase, void *vlink) { Link *link = vlink; @@ -131,43 +148,11 @@ void BLI_freelinkN(ListBase *listbase, void *vlink) } -void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink) -{ - Link *prevlink = vprevlink; - Link *newlink = vnewlink; - - /* newlink comes after prevlink */ - if (newlink == NULL) return; - if (listbase == NULL) return; - - /* empty list */ - if (listbase->first == NULL) { - - listbase->first = newlink; - listbase->last = newlink; - return; - } - - /* insert before first element */ - if (prevlink == NULL) { - newlink->next = listbase->first; - newlink->prev = NULL; - newlink->next->prev = newlink; - listbase->first = newlink; - return; - } - - /* at end of list */ - if (listbase->last == prevlink) - listbase->last = newlink; - - newlink->next = prevlink->next; - prevlink->next = newlink; - if (newlink->next) newlink->next->prev = newlink; - newlink->prev = prevlink; -} - -/* This uses insertion sort, so NOT ok for large list */ +/** + * Sorts the elements of listbase into the order defined by cmp + * (which should return 1 iff its first arg should come after its second arg). + * This uses insertion sort, so NOT ok for large list. + */ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *)) { Link *current = NULL; @@ -193,6 +178,10 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *)) } } +/** + * Inserts \a vnewlink immediately following \a vprevlink in \a listbase. + * Or, if \a vprevlink is NULL, puts \a vnewlink at the front of the list. + */ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) { Link *prevlink = vprevlink; @@ -213,21 +202,28 @@ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) if (prevlink == NULL) { newlink->prev = NULL; newlink->next = listbase->first; - ((Link *)listbase->first)->prev = newlink; + newlink->next->prev = newlink; listbase->first = newlink; return; } /* at end of list */ - if (listbase->last == prevlink) + if (listbase->last == prevlink) { listbase->last = newlink; + } newlink->next = prevlink->next; newlink->prev = prevlink; prevlink->next = newlink; - if (newlink->next) newlink->next->prev = newlink; + if (newlink->next) { + newlink->next->prev = newlink; + } } +/** + * Inserts \a vnewlink immediately preceding \a vnextlink in listbase. + * Or, if \a vnextlink is NULL, puts \a vnewlink at the end of the list. + */ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) { Link *nextlink = vnextlink; @@ -254,16 +250,22 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) } /* at beginning of list */ - if (listbase->first == nextlink) + if (listbase->first == nextlink) { listbase->first = newlink; + } newlink->next = nextlink; newlink->prev = nextlink->prev; nextlink->prev = newlink; - if (newlink->prev) newlink->prev->next = newlink; + if (newlink->prev) { + newlink->prev->next = newlink; + } } +/** + * Removes and disposes of the entire contents of listbase using direct free(3). + */ void BLI_freelist(ListBase *listbase) { Link *link, *next; @@ -282,6 +284,9 @@ void BLI_freelist(ListBase *listbase) listbase->last = NULL; } +/** + * Removes and disposes of the entire contents of \a listbase using guardedalloc. + */ void BLI_freelistN(ListBase *listbase) { Link *link, *next; @@ -300,6 +305,9 @@ void BLI_freelistN(ListBase *listbase) } +/** + * Returns the number of elements in \a listbase. + */ int BLI_countlist(const ListBase *listbase) { Link *link; @@ -315,6 +323,9 @@ int BLI_countlist(const ListBase *listbase) return count; } +/** + * Returns the nth element of \a listbase, numbering from 1. + */ void *BLI_findlink(const ListBase *listbase, int number) { Link *link = NULL; @@ -330,6 +341,9 @@ void *BLI_findlink(const ListBase *listbase, int number) return link; } +/** + * Returns the nth-last element of \a listbase, numbering from 1. + */ void *BLI_rfindlink(const ListBase *listbase, int number) { Link *link = NULL; @@ -345,6 +359,9 @@ void *BLI_rfindlink(const ListBase *listbase, int number) return link; } +/** + * Returns the position of \a vlink within \a listbase, numbering from 1, or -1 if not found. + */ int BLI_findindex(const ListBase *listbase, const void *vlink) { Link *link = NULL; @@ -365,6 +382,10 @@ int BLI_findindex(const ListBase *listbase, const void *vlink) return -1; } +/** + * Finds the first element of \a listbase which contains the null-terminated + * string \a id at the specified offset, returning NULL if not found. + */ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset) { Link *link = NULL; @@ -383,6 +404,10 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset) return NULL; } /* same as above but find reverse */ +/** + * Finds the last element of \a listbase which contains the + * null-terminated string \a id at the specified offset, returning NULL if not found. + */ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset) { Link *link = NULL; @@ -401,6 +426,10 @@ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset return NULL; } +/** + * Finds the first element of \a listbase which contains a pointer to the + * null-terminated string \a id at the specified offset, returning NULL if not found. + */ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int offset) { Link *link = NULL; @@ -420,6 +449,10 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off return NULL; } /* same as above but find reverse */ +/** + * Finds the last element of \a listbase which contains a pointer to the + * null-terminated string \a id at the specified offset, returning NULL if not found. + */ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int offset) { Link *link = NULL; @@ -440,6 +473,8 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of } void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset) +/* finds the first element of listbase which contains the specified pointer value +at the specified offset, returning NULL if not found. */ { Link *link = NULL; const void *ptr_iter; @@ -448,7 +483,7 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset) for (link = listbase->first; link; link = link->next) { /* exact copy of BLI_findstring(), except for this line */ - ptr_iter = *((const char **)(((const char *)link) + offset)); + ptr_iter = *((const void **)(((const char *)link) + offset)); if (ptr == ptr_iter) { return link; @@ -459,6 +494,8 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset) } /* same as above but find reverse */ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset) +/* finds the last element of listbase which contains the specified pointer value +at the specified offset, returning NULL if not found. */ { Link *link = NULL; const void *ptr_iter; @@ -467,7 +504,7 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset) for (link = listbase->last; link; link = link->prev) { /* exact copy of BLI_rfindstring(), except for this line */ - ptr_iter = *((const char **)(((const char *)link) + offset)); + ptr_iter = *((const void **)(((const char *)link) + offset)); if (ptr == ptr_iter) { return link; @@ -478,6 +515,8 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset) } int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset) +/* returns the 1-based index of the first element of listbase which contains the specified +null-terminated string at the specified offset, or -1 if not found. */ { Link *link = NULL; const char *id_iter; @@ -499,6 +538,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs } void BLI_duplicatelist(ListBase *dst, const ListBase *src) +/* sets dst to a duplicate of the entire contents of src. dst may be the same as src. */ { struct Link *dst_link, *src_link; diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e10d588c19f..37249896e34 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -636,7 +636,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut /* move button over from oldblock to new block */ BLI_remlink(&oldblock->buttons, oldbut); - BLI_insertlink(&block->buttons, but, oldbut); + BLI_insertlinkafter(&block->buttons, but, oldbut); oldbut->block = block; *butpp = oldbut; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 7c74fa24893..8d29813e2ac 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -385,7 +385,7 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md } BLI_remlink(&ob->modifiers, md); - BLI_insertlink(&ob->modifiers, md->prev->prev, md); + BLI_insertlinkbefore(&ob->modifiers, md->prev, md); } return 1; @@ -406,7 +406,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * } BLI_remlink(&ob->modifiers, md); - BLI_insertlink(&ob->modifiers, md->next, md); + BLI_insertlinkafter(&ob->modifiers, md->next, md); } return 1; @@ -722,7 +722,7 @@ int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierDat nmd = modifier_new(md->type); modifier_copyData(md, nmd); - BLI_insertlink(&ob->modifiers, md, nmd); + BLI_insertlinkafter(&ob->modifiers, md, nmd); modifier_unique_name(&ob->modifiers, nmd); return 1; diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index 154daf0eb72..8a5f623c533 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -157,7 +157,7 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op)) for (rule = state->rules.first; rule; rule=rule->next) { if (rule->flag & BOIDRULE_CURRENT && rule->prev) { BLI_remlink(&state->rules, rule); - BLI_insertlink(&state->rules, rule->prev->prev, rule); + BLI_insertlinkbefore(&state->rules, rule->prev, rule); DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); break; @@ -193,7 +193,7 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op)) for (rule = state->rules.first; rule; rule=rule->next) { if (rule->flag & BOIDRULE_CURRENT && rule->next) { BLI_remlink(&state->rules, rule); - BLI_insertlink(&state->rules, rule->next, rule); + BLI_insertlinkafter(&state->rules, rule->next, rule); DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); break; @@ -314,7 +314,7 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op)) for (state = boids->states.first; state; state=state->next) { if (state->flag & BOIDSTATE_CURRENT && state->prev) { BLI_remlink(&boids->states, state); - BLI_insertlink(&boids->states, state->prev->prev, state); + BLI_insertlinkbefore(&boids->states, state->prev, state); break; } } @@ -349,7 +349,7 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op)) for (state = boids->states.first; state; state=state->next) { if (state->flag & BOIDSTATE_CURRENT && state->next) { BLI_remlink(&boids->states, state); - BLI_insertlink(&boids->states, state->next, state); + BLI_insertlinkafter(&boids->states, state->next, state); DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); break; } diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 8cae0140b5a..5fd2a0806e9 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -310,7 +310,7 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op)) for (; pt; pt=pt->next) { if (pt->flag & PTARGET_CURRENT && pt->prev) { BLI_remlink(&psys->targets, pt); - BLI_insertlink(&psys->targets, pt->prev->prev, pt); + BLI_insertlinkbefore(&psys->targets, pt->prev, pt); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -348,7 +348,7 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op)) for (; pt; pt=pt->next) { if (pt->flag & PTARGET_CURRENT && pt->next) { BLI_remlink(&psys->targets, pt); - BLI_insertlink(&psys->targets, pt->next, pt); + BLI_insertlinkafter(&psys->targets, pt->next, pt); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -387,7 +387,7 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op)) for (dw=part->dupliweights.first; dw; dw=dw->next) { if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) { BLI_remlink(&part->dupliweights, dw); - BLI_insertlink(&part->dupliweights, dw->prev->prev, dw); + BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL); break; @@ -509,7 +509,7 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op)) for (dw=part->dupliweights.first; dw; dw=dw->next) { if (dw->flag & PART_DUPLIW_CURRENT && dw->next) { BLI_remlink(&part->dupliweights, dw); - BLI_insertlink(&part->dupliweights, dw->next, dw); + BLI_insertlinkafter(&part->dupliweights, dw->next, dw); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL); break; diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index a4a485b34c6..51df21e509a 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -180,13 +180,13 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op) if (direction == SEQ_MODIFIER_MOVE_UP) { if (smd->prev) { BLI_remlink(&seq->modifiers, smd); - BLI_insertlink(&seq->modifiers, smd->prev->prev, smd); + BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd); } } else if (direction == SEQ_MODIFIER_MOVE_DOWN) { if (smd->next) { BLI_remlink(&seq->modifiers, smd); - BLI_insertlink(&seq->modifiers, smd->next, smd); + BLI_insertlinkafter(&seq->modifiers, smd->next, smd); } } diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h index 333e414278d..f6035cd6653 100644 --- a/source/blender/makesdna/DNA_listBase.h +++ b/source/blender/makesdna/DNA_listBase.h @@ -31,6 +31,9 @@ * \ingroup DNA * \brief These structs are the foundation for all linked lists in the * library system. + * + * Doubly-linked lists start from a ListBase and contain elements beginning + * with Link. */ #ifndef __DNA_LISTBASE_H__ @@ -40,13 +43,13 @@ extern "C" { #endif -/* generic - all structs which are used in linked-lists used this */ +/* generic - all structs which are put into linked lists begin with this */ typedef struct Link { struct Link *next, *prev; } Link; -/* use this when it is not worth defining a custom one... */ +/* simple subclass of Link--use this when it is not worth defining a custom one... */ typedef struct LinkData { struct LinkData *next, *prev; void *data; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index bf6faa3f2cc..7de1f84acdd 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -159,7 +159,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[]) static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, PointerRNA *marker_ptr) { TimeMarker *marker = marker_ptr->data; - if (BLI_remlink_safe(&act->markers, marker) == FALSE) { + if (!BLI_remlink_safe(&act->markers, marker)) { BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in action '%s'", marker->name, act->id.name + 2); return; } -- cgit v1.2.3 From c586159438c036d6117016b49f3d727862d54662 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Fri, 22 Feb 2013 14:47:11 +0000 Subject: game engine: Revert to using regular gimpact for mesh shapes This reverts part of r53019. While the compound shape trick works well in some cases, overall it's much slower and even causes crashes under certain conditions. We could make this and option and fix the crashes, but it's better to implement convex decomposition anyway so just reverting for now. Fixes [#34353] Ray cast on Triangle mesh bounded Rigid Body Object causes blender crash to desktop without error. --- source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index ef43e094e6d..81b9bd0d5cc 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -24,7 +24,6 @@ subject to the following restrictions: #include "btBulletDynamicsCommon.h" #include "BulletCollision/CollisionDispatch/btGhostObject.h" #include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h" -#include "BulletCollision/Gimpact/btCompoundFromGimpact.h" #include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h" #include "PHY_IMotionState.h" @@ -37,7 +36,6 @@ subject to the following restrictions: #include "BulletSoftBody/btSoftBodyHelpers.h" #include "LinearMath/btConvexHull.h" #include "BulletCollision/Gimpact/btGImpactShape.h" -#include "BulletCollision/Gimpact/btGImpactShape.h" #include "BulletSoftBody/btSoftRigidDynamicsWorld.h" @@ -2232,13 +2230,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b btGImpactMeshShape* gimpactShape = new btGImpactMeshShape(indexVertexArrays); gimpactShape->setMargin(margin); gimpactShape->updateBound(); - - //the depth value is how far along the triangle normal, the centroid is moved inwards - //to create surface tetrahedra for the btCompoundShape - //would be nice to expose this in the Blender user interfaceb - btScalar depth=btScalar(0.2); - collisionShape = btCreateCompoundFromGimpactShape(gimpactShape,depth); - delete gimpactShape; + collisionShape = gimpactShape; } else -- cgit v1.2.3 From 2c2a42a4e8f691f0f407dc709e20c7257c960aaa Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Fri, 22 Feb 2013 15:54:10 +0000 Subject: Fix for building without python. --- source/gameengine/Converter/KX_LibLoadStatus.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/gameengine/Converter/KX_LibLoadStatus.cpp b/source/gameengine/Converter/KX_LibLoadStatus.cpp index fb36f232f30..2a38e062f89 100644 --- a/source/gameengine/Converter/KX_LibLoadStatus.cpp +++ b/source/gameengine/Converter/KX_LibLoadStatus.cpp @@ -36,8 +36,9 @@ KX_LibLoadStatus::KX_LibLoadStatus(class KX_BlenderSceneConverter* kx_converter, m_mergescene(merge_scene), m_data(NULL), m_libname(path), - m_progress(0.f), + m_progress(0.f) #ifdef WITH_PYTHON + , m_finish_cb(NULL), m_progress_cb(NULL) #endif -- cgit v1.2.3 From 7ae17e9ed4748e2f11abc044e2616f3d3bf03e99 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Fri, 22 Feb 2013 15:57:50 +0000 Subject: Fix for windows size on win32 --- intern/ghost/intern/GHOST_WindowWin32.cpp | 46 ++++++++++--------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 89fece50caa..7566e7fe71c 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -470,38 +470,22 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const { RECT rect; - GHOST_TWindowState state = this->getState(); - LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE); - int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME); - ::GetWindowRect(m_hWnd, &rect); + POINT coord; + ::GetClientRect(m_hWnd, &rect); - if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) { - if (state == GHOST_kWindowStateMaximized) { - // in maximized state we don't have borders on the window - bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2; - bounds.m_l = rect.left + sm_cysizeframe; - bounds.m_r = rect.right - sm_cysizeframe; - bounds.m_t = rect.top; - } - else if (state == GHOST_kWindowStateEmbedded) { - bounds.m_b = rect.bottom; - bounds.m_l = rect.left; - bounds.m_r = rect.right; - bounds.m_t = rect.top; - } - else { - bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2; - bounds.m_l = rect.left; - bounds.m_r = rect.right - sm_cysizeframe * 2; - bounds.m_t = rect.top; - } - } - else { - bounds.m_b = rect.bottom; - bounds.m_l = rect.left; - bounds.m_r = rect.right; - bounds.m_t = rect.top; - } + coord.x = rect.left; + coord.y = rect.top; + ::ClientToScreen(m_hWnd, &coord); + + bounds.m_l = coord.x; + bounds.m_t = coord.y; + + coord.x = rect.right; + coord.y = rect.bottom; + ::ClientToScreen(m_hWnd, &coord); + + bounds.m_r = coord.x; + bounds.m_b = coord.y; } -- cgit v1.2.3 From ce54cc111deb974c75a60cdc565ef3148249bbd8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 22 Feb 2013 16:11:27 +0000 Subject: Fix #34357: image editor scope and clip editor track preview did not resize properly with different DPI settings. --- source/blender/editors/interface/interface_handlers.c | 8 ++++---- source/blender/editors/interface/interface_templates.c | 6 +++--- source/blender/editors/space_clip/clip_buttons.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5e078c0a599..5cff61f4239 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4253,7 +4253,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize histogram widget itself */ - hist->height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); + hist->height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC; } else { /* scale histogram values (dy / 10 for better control) */ @@ -4337,7 +4337,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx, if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize waveform widget itself */ - scopes->wavefrm_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); + scopes->wavefrm_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC; } else { /* scale waveform values */ @@ -4419,7 +4419,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize vectorscope widget itself */ - scopes->vecscope_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); + scopes->vecscope_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC; } data->draglastx = mx; @@ -4622,7 +4622,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize preview widget itself */ - scopes->track_preview_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); + scopes->track_preview_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC; } else { if (!scopes->track_locked) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index adc40288777..bddd7f0c821 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1679,7 +1679,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname hist = (Histogram *)cptr.data; - hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height; + hist->height = (hist->height <= 20) ? 20 : hist->height; bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * hist->height, hist, 0, 0, 0, 0, ""); @@ -1718,7 +1718,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname) block = uiLayoutAbsoluteBlock(layout); - scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height; + scopes->wavefrm_height = (scopes->wavefrm_height <= 20) ? 20 : scopes->wavefrm_height; bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); @@ -1756,7 +1756,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna block = uiLayoutAbsoluteBlock(layout); - scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height; + scopes->vecscope_height = (scopes->vecscope_height <= 20) ? 20 : scopes->vecscope_height; bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index e442de2ba66..b2d31ececa5 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -169,16 +169,16 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) scopesptr = RNA_property_pointer_get(ptr, prop); scopes = (MovieClipScopes *)scopesptr.data; - rect.xmin = 0; rect.xmax = 200; - rect.ymin = 0; rect.ymax = 120; + rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X; + rect.ymin = 0; rect.ymax = 6.0f * UI_UNIT_Y; block = uiLayoutAbsoluteBlock(layout); scopes->track_preview_height = - (scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height; + (scopes->track_preview_height <= 20) ? 20 : scopes->track_preview_height; uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), - scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); + scopes->track_preview_height * UI_DPI_FAC, scopes, 0, 0, 0, 0, ""); } /********************* Marker Template ************************/ @@ -393,7 +393,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P else tip = TIP_("Marker is enabled at current frame"); - bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, + bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y, &cb->marker_flag, 0, 0, 1, 0, tip); uiButSetNFunc(bt, marker_update_cb, cb, NULL); } @@ -407,7 +407,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P if (track->flag & TRACK_LOCKED) { uiLayoutSetActive(layout, FALSE); block = uiLayoutAbsoluteBlock(layout); - uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, 300, 19, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, UI_UNIT_X*15.0f, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); return; } -- cgit v1.2.3 From 5f830a0863e085c3e37d3a5682e86ebbe1e06801 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Fri, 22 Feb 2013 16:42:19 +0000 Subject: Applying patch #33709 for dead keys on windows. Thanks Harley Acheson! --- intern/ghost/intern/GHOST_SystemWin32.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 138109ce48b..3005930d30c 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -296,6 +296,9 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) // Process all the events waiting for us while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE) != 0) { + // TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data. + // Needed for MapVirtualKey or if we ever need to get chars from wm_ime_char or similar. + ::TranslateMessage(&msg); ::DispatchMessageW(&msg); anyProcessed = true; } @@ -729,13 +732,17 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP int r; GetKeyboardState((PBYTE)state); - if ((r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))) { - if ((r > 0 && r < 3)) { - utf16[r] = 0; - conv_utf_16_to_8(utf16, utf8_char, 6); - } - else if (r == -1) { - utf8_char[0] = '\0'; + // don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical composition. + if (MapVirtualKeyW(vk,2) != 0) { + // todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). Could be up to 24 utf8 bytes. + if ((r = ToUnicodeEx(vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) { + if ((r > 0 && r < 3)) { + utf16[r] = 0; + conv_utf_16_to_8(utf16, utf8_char, 6); + } + else if (r == -1) { + utf8_char[0] = '\0'; + } } } -- cgit v1.2.3 From 9f764e3aa7281af4f6f241ac452dd1e6ebb08c96 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 22 Feb 2013 17:35:53 +0000 Subject: Workaround for compilation error introduced in r54755 Scons used to fail because of couple of reasons: - CMake does have WITH_DNA_GHASH enabled, Scons not Which is a good question why?! - This makes Cmake including BLI_utildefines in dna_genfile.c, but scons missed this include - This damn "bool" thing requires BLI_utildefines And last question here is why would we want to use bool here =\ It's just always ends up in headache without any visible benefit of using it. Well, at least now svn shall be compilable again.. --- source/blender/makesdna/SConscript | 2 +- source/blender/makesdna/intern/dna_genfile.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/makesdna/SConscript b/source/blender/makesdna/SConscript index a6520a6c03e..701ad12f2b8 100644 --- a/source/blender/makesdna/SConscript +++ b/source/blender/makesdna/SConscript @@ -32,6 +32,6 @@ objs = [] o = SConscript('intern/SConscript') objs += o -incs = '#/intern/guardedalloc .' +incs = '#/intern/guardedalloc . ../blenlib' env.BlenderLib ( 'bf_dna', objs, Split(incs), [], libtype=['core','player'], priority = [215,200] ) diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 27520a746be..86014c4e80e 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -42,8 +42,9 @@ #include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN +#include "BLI_utildefines.h" + #ifdef WITH_DNA_GHASH -# include "BLI_utildefines.h" # include "BLI_ghash.h" #endif -- cgit v1.2.3 From 0945c3b43bc27e98693b1b37e16e1a5e16763572 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 22 Feb 2013 17:45:04 +0000 Subject: fixing typo in include (report and patch by Jochen Schmitt) --- source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 81b9bd0d5cc..08ea9706eba 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -32,7 +32,7 @@ subject to the following restrictions: #include "KX_GameObject.h" #include "BulletSoftBody/btSoftBody.h" -#include "BulletSoftBody//btSoftBodyInternals.h" +#include "BulletSoftBody/btSoftBodyInternals.h" #include "BulletSoftBody/btSoftBodyHelpers.h" #include "LinearMath/btConvexHull.h" #include "BulletCollision/Gimpact/btGImpactShape.h" -- cgit v1.2.3 From b3c08969674ea7be7929fc519508814f2705cf5b Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 22 Feb 2013 20:37:14 +0000 Subject: BGE: Fix for bug #34219 "Webcam support under Linux in Standalone broken" reported by Thomas Achtner (offtools). No one bothered to update the player for ffmpeg changes made in August 2012. This meant the player was no longer calling avdevice_register_all(), and ffmpeg would fail to open web cam streams. --- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 5b2cfddd141..77275ce5506 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -449,6 +449,10 @@ int main(int argc, char** argv) IMB_init(); BKE_images_init(); +#ifdef WITH_FFMPEG + IMB_ffmpeg_init(); +#endif + // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c) BLF_init(11, U.dpi); BLF_lang_init(); -- cgit v1.2.3 From 3d9dc6a2e488cd47eafb716b65f479831c4bcd9f Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 22 Feb 2013 22:24:38 +0000 Subject: WITH_PYTHON_FRAMEWORK cmake option for OSX This option allow Blender to be linked against the Framework python It's useful if you want to have blenderplayer and bpy in the same application and need to avoid PyThread problems. patch reviewed by Jens Verwiebe before 2.66. He may want to change something though. (also small: I changed: /Library/Frameworks/Python.framework/Versions//python by /Library/Frameworks/Python.framework/Versions//Python as the latter seems to be the norm) --- CMakeLists.txt | 21 ++++++++++++--------- source/creator/CMakeLists.txt | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6a0fa4e016..8b225af07e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,10 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF) option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF) +if (APPLE) + option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF) +endif() + option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON) option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON) option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON) @@ -1457,11 +1461,10 @@ elseif(APPLE) endif() if(WITH_PYTHON) - if(NOT WITH_PYTHON_MODULE) - # we use precompiled libraries for py 3.3 and up by default - + # we use precompiled libraries for py 3.3 and up by default + set(PYTHON_VERSION 3.3) + if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK) # normally cached but not since we include them with blender - set(PYTHON_VERSION 3.3) set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m") # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet set(PYTHON_LIBRARY python${PYTHON_VERSION}m) @@ -1469,9 +1472,6 @@ elseif(APPLE) # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled else() # module must be compiled against Python framework - - # normally cached but not since we include them with blender - set(PYTHON_VERSION 3.3) set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m") set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}") #set(PYTHON_LIBRARY python${PYTHON_VERSION}) @@ -1573,8 +1573,8 @@ elseif(APPLE) set(WITH_INPUT_NDOF OFF) # unsupported endif() - if(WITH_PYTHON_MODULE) - set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework + if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK) + set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")# force cmake to link right framework endif() if(WITH_OPENCOLLADA) @@ -2182,6 +2182,9 @@ if(FIRST_RUN) info_cfg_option(WITH_PYTHON_INSTALL_NUMPY) info_cfg_option(WITH_PYTHON_MODULE) info_cfg_option(WITH_PYTHON_SAFETY) + if(APPLE) + info_cfg_option(WITH_PYTHON_FRAMEWORK) + endif() info_cfg_text("Modifiers:") info_cfg_option(WITH_MOD_BOOLEAN) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index bb5f34167bc..69bad2b8cce 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -689,7 +689,7 @@ elseif(APPLE) ) # python - if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE) + if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK) # the python zip is first extract as part of the build process, # and then later installed as part of make install. this is much # quicker, and means we can easily exclude files on copy @@ -742,7 +742,7 @@ elseif(APPLE) ) # python - if(WITH_PYTHON) + if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ -- cgit v1.2.3 From d05cb9bca5654a621a9daf7547fa031ab467ef85 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 22 Feb 2013 23:55:06 +0000 Subject: BGE: (partial?) fix for #34330 "Action Actuator "caching" the previous ran actions" reported by Dalai. The test file now works if all of the actions are using the same layer, but multiple layers can still cause problems. However, I am unsure as to what the "correct" behavior should be with multiple layers. They should probably blend somehow... --- source/gameengine/Converter/KX_IpoConvert.cpp | 38 ++++++++++++++++++--------- source/gameengine/Converter/KX_IpoConvert.h | 4 ++- source/gameengine/Ketsji/BL_Action.cpp | 8 ++++++ 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index a81d52f6698..0b0ee132a42 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -162,23 +162,29 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B } } - { - KX_ObColorIpoSGController* ipocontr_obcol=NULL; - - for (int i=0; i<4; i++) { - if ((interp = adtList->GetScalarInterpolator("color", i))) { - if (!ipocontr_obcol) { - ipocontr_obcol = new KX_ObColorIpoSGController(); - gameobj->GetSGNode()->AddSGController(ipocontr_obcol); - ipocontr_obcol->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr_obcol->m_rgba[i], interp); - ipocontr_obcol->AddInterpolator(interpolator); + + return ipocontr; +} + + +SG_Controller *BL_CreateObColorIPO(struct bAction *action, KX_GameObject* gameobj, KX_BlenderSceneConverter *converter) +{ + KX_ObColorIpoSGController* ipocontr_obcol=NULL; + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; + BL_InterpolatorList *adtList= GetAdtList(action, converter); + + for (int i=0; i<4; i++) { + if ((interp = adtList->GetScalarInterpolator("color", i))) { + if (!ipocontr_obcol) { + ipocontr_obcol = new KX_ObColorIpoSGController(); } + interpolator= new KX_ScalarInterpolator(&ipocontr_obcol->m_rgba[i], interp); + ipocontr_obcol->AddInterpolator(interpolator); } } - return ipocontr; + return ipocontr_obcol; } void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_BlenderSceneConverter *converter) @@ -187,6 +193,12 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend SG_Controller *ipocontr = BL_CreateIPO(blenderobject->adt->action, gameobj, converter); gameobj->GetSGNode()->AddSGController(ipocontr); ipocontr->SetObject(gameobj->GetSGNode()); + + SG_Controller *ipocontr_obcol = BL_CreateObColorIPO(blenderobject->adt->action, gameobj, converter); + if (ipocontr_obcol) { + gameobj->GetSGNode()->AddSGController(ipocontr_obcol); + ipocontr_obcol->SetObject(gameobj->GetSGNode()); + } } } diff --git a/source/gameengine/Converter/KX_IpoConvert.h b/source/gameengine/Converter/KX_IpoConvert.h index 861a2ba66f2..044993a31e6 100644 --- a/source/gameengine/Converter/KX_IpoConvert.h +++ b/source/gameengine/Converter/KX_IpoConvert.h @@ -37,7 +37,9 @@ struct Object; class SG_Controller *BL_CreateIPO(struct bAction *action, class KX_GameObject* gameobj, class KX_BlenderSceneConverter *converter); - +class SG_Controller *BL_CreateObColorIPO(struct bAction *action, + class KX_GameObject* gameobj, + class KX_BlenderSceneConverter *converter); void BL_ConvertIpos(struct Object* blenderobject, class KX_GameObject* gameobj, class KX_BlenderSceneConverter *converter); diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 5b7a2313f43..089a4050023 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -162,6 +162,14 @@ bool BL_Action::Play(const char* name, m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); + // Try obcolor + sg_contr = BL_CreateObColorIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + if (sg_contr) { + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + } + // Extra controllers if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) { -- cgit v1.2.3 From eab8a25e038a0068ddc3dd78c07268bcb84a6ade Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 23 Feb 2013 00:28:25 +0000 Subject: BGE: For BL_Action, use the object's scene rather than the "active" scene, which can potentially cause problems with multiple scenes. --- source/gameengine/Ketsji/BL_Action.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 089a4050023..eb5d8844b6c 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -36,7 +36,6 @@ // These three are for getting the action from the logic manager #include "KX_Scene.h" -#include "KX_PythonInit.h" #include "SCA_LogicManager.h" extern "C" { @@ -132,8 +131,10 @@ bool BL_Action::Play(const char* name, m_priority = priority; bAction* prev_action = m_action; + KX_Scene* kxscene = m_obj->GetScene(); + // First try to load the action - m_action = (bAction*)KX_GetActiveScene()->GetLogicManager()->GetActionByName(name); + m_action = (bAction*)kxscene->GetLogicManager()->GetActionByName(name); if (!m_action) { printf("Failed to load action: %s\n", name); @@ -157,13 +158,13 @@ bool BL_Action::Play(const char* name, ClearControllerList(); // Create an SG_Controller - SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter()); m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); // Try obcolor - sg_contr = BL_CreateObColorIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter()); if (sg_contr) { m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); @@ -173,14 +174,14 @@ bool BL_Action::Play(const char* name, // Extra controllers if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) { - sg_contr = BL_CreateLampIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + sg_contr = BL_CreateLampIPO(m_action, m_obj, kxscene->GetSceneConverter()); m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); } else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA) { - sg_contr = BL_CreateCameraIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + sg_contr = BL_CreateCameraIPO(m_action, m_obj, kxscene->GetSceneConverter()); m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); -- cgit v1.2.3 From bd8f4cc4d6de396c902ee47261baba11bdd8f0a1 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 23 Feb 2013 00:46:58 +0000 Subject: BGE: Second fix for #34330 "Action Actuator "caching" the previous ran actions" reported by Dalai. Now the multiple layers should also be working. When doing fcurve/IPO animations, the controllers are cleared as soon as the action is done and must be setup again every time the action is played. --- source/gameengine/Ketsji/BL_Action.cpp | 58 +++++++++++++++++----------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index eb5d8844b6c..f55d1120a50 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -152,40 +152,37 @@ bool BL_Action::Play(const char* name, && m_priority == priority && m_speed == playback_speed) return false; - if (prev_action != m_action) - { - // First get rid of any old controllers - ClearControllerList(); + // First get rid of any old controllers + ClearControllerList(); - // Create an SG_Controller - SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter()); + // Create an SG_Controller + SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter()); + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + + // Try obcolor + sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter()); + if (sg_contr) { m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); + } - // Try obcolor - sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter()); - if (sg_contr) { - m_sg_contr_list.push_back(sg_contr); - m_obj->GetSGNode()->AddSGController(sg_contr); - sg_contr->SetObject(m_obj->GetSGNode()); - } - - // Extra controllers - if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) - { - sg_contr = BL_CreateLampIPO(m_action, m_obj, kxscene->GetSceneConverter()); - m_sg_contr_list.push_back(sg_contr); - m_obj->GetSGNode()->AddSGController(sg_contr); - sg_contr->SetObject(m_obj->GetSGNode()); - } - else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA) - { - sg_contr = BL_CreateCameraIPO(m_action, m_obj, kxscene->GetSceneConverter()); - m_sg_contr_list.push_back(sg_contr); - m_obj->GetSGNode()->AddSGController(sg_contr); - sg_contr->SetObject(m_obj->GetSGNode()); - } + // Extra controllers + if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) + { + sg_contr = BL_CreateLampIPO(m_action, m_obj, kxscene->GetSceneConverter()); + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + } + else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA) + { + sg_contr = BL_CreateCameraIPO(m_action, m_obj, kxscene->GetSceneConverter()); + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); } m_ipo_flags = ipo_flags; @@ -467,4 +464,7 @@ void BL_Action::Update(float curtime) m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD); } + + if (m_done) + ClearControllerList(); } -- cgit v1.2.3 From 31e6af92c81a9e45f9fbf0667d242fe1493f3e13 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 23 Feb 2013 00:52:59 +0000 Subject: Install_deps script: * Use OIIO 1.1.7, this removes the need for the ugly patch. * Use official OSL 1.3.0 repo * Print OSL path for scons Tested on Ubuntu 12.10 x64. --- build_files/build_environment/install_deps.sh | 31 ++++++--------------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 97bd94f55b2..5815158f4f5 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -188,7 +188,7 @@ OCIO_VERSION_MIN="1.0" OCIO_FORCE_REBUILD=false OCIO_SKIP=false -OIIO_VERSION="1.1.1" +OIIO_VERSION="1.1.7" OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION" OIIO_VERSION_MIN="1.1" OIIO_FORCE_REBUILD=false @@ -203,8 +203,8 @@ LLVM_FORCE_REBUILD=false LLVM_SKIP=false # OSL needs to be compiled for now! -OSL_VERSION="1.2.0" -OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz" +OSL_VERSION="1.3.0" +OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage/archive/Release-1.3.0.tar.gz" OSL_FORCE_REBUILD=false OSL_SKIP=false @@ -780,27 +780,6 @@ compile_OIIO() { tar -C $SRC --transform "s,(.*/?)OpenImageIO-oiio[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \ -xf $_src.tar.gz - cd $_src - - # XXX Ugly patching hack! - cat << EOF | patch -p1 -diff --git a/src/libutil/SHA1.cpp b/src/libutil/SHA1.cpp -index b9e6c8b..c761185 100644 ---- a/src/libutil/SHA1.cpp -+++ b/src/libutil/SHA1.cpp -@@ -8,9 +8,9 @@ - - // If compiling with MFC, you might want to add #include "StdAfx.h" - -+#include "SHA1.h" - #include "hash.h" - #include "dassert.h" --#include "SHA1.h" - - #ifdef SHA1_UTILITY_FUNCTIONS - #define SHA1_MAX_FILE_BUFFER 8000 -EOF - cd $CWD fi @@ -2054,6 +2033,10 @@ print_info() { INFO "BF_OIIO = '$INST/oiio'" fi + if [ -d $INST/osl ]; then + INFO "BF_OSL = '$INST/osl'" + fi + if [ -d $INST/boost ]; then INFO "BF_BOOST = '$INST/boost'" INFO "WITH_BF_BOOST = True" -- cgit v1.2.3 From c00191dbe3cbc3667948b7108068d4c8984f6d3c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 23 Feb 2013 01:17:01 +0000 Subject: BGE: Object color channels can now be animated separately without zeroing out the other channels. Problem reported by Dalai via IRC. --- source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp index f7e3194ee78..7f81f221c07 100644 --- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp +++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp @@ -45,10 +45,10 @@ bool KX_ObColorIpoSGController::Update(double currentTime) { if (m_modified) { - m_rgba[0]=0; - m_rgba[1]=0; - m_rgba[2]=0; - m_rgba[3]=0; + SG_Spatial* ob = (SG_Spatial*)m_pObject; + KX_GameObject* kxgameobj= (KX_GameObject*) ob->GetSGClientObject(); + + m_rgba = kxgameobj->GetObjectColor(); T_InterpolatorList::iterator i; for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { @@ -56,9 +56,6 @@ bool KX_ObColorIpoSGController::Update(double currentTime) } - SG_Spatial* ob = (SG_Spatial*)m_pObject; - KX_GameObject* kxgameobj= (KX_GameObject*) ob->GetSGClientObject(); - kxgameobj->SetObjectColor(m_rgba); -- cgit v1.2.3 From 9ef5d2d90598ce97b8ec773bb00f97825dbe0e1b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 01:33:47 +0000 Subject: fix for error in the blenderplayer caused by r54727 (can't assume G.main is valid on load). --- source/blender/blenkernel/BKE_depsgraph.h | 1 + source/blender/blenkernel/intern/depsgraph.c | 11 +++++++---- source/blender/blenloader/intern/readfile.c | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index eaf19f8dd08..4cdfc1cba95 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -118,6 +118,7 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned i void DAG_on_visible_update(struct Main *bmain, const short do_time); /* tag datablock to get updated for the next redraw */ +void DAG_id_tag_update_ex(struct Main *bmain, struct ID *id, short flag); void DAG_id_tag_update(struct ID *id, short flag); /* flush all tagged updates */ void DAG_ids_flush_tagged(struct Main *bmain); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 56600069aa0..8c55ad02dc6 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2914,12 +2914,10 @@ void DAG_ids_clear_recalc(Main *bmain) memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update)); } -void DAG_id_tag_update(ID *id, short flag) +void DAG_id_tag_update_ex(Main *bmain, ID *id, short flag) { - Main *bmain = G.main; - if (id == NULL) return; - + /* tag ID for update */ if (flag) { if (flag & OB_RECALC_OB) @@ -2974,6 +2972,11 @@ void DAG_id_tag_update(ID *id, short flag) } } +void DAG_id_tag_update(ID *id, short flag) +{ + DAG_id_tag_update_ex(G.main, id, flag); +} + void DAG_id_type_tag(Main *bmain, short idtype) { if (idtype == ID_NT) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9b896c12d10..4bae406fd09 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2712,7 +2712,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) } } -static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) +static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) { bPoseChannel *pchan; bArmature *arm = ob->data; @@ -2756,7 +2756,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) } if (rebuild) { - DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DAG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); pose->flag |= POSE_RECALC; } } @@ -4221,7 +4221,7 @@ static void lib_link_object(FileData *fd, Main *main) /* if id.us==0 a new base will be created later on */ /* WARNING! Also check expand_object(), should reflect the stuff below. */ - lib_link_pose(fd, ob, ob->pose); + lib_link_pose(fd, main, ob, ob->pose); lib_link_constraints(fd, &ob->id, &ob->constraints); // XXX deprecated - old animation system <<< -- cgit v1.2.3 From a528cb9905c3786bad6f1f2163ed5f5620959566 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 01:57:56 +0000 Subject: code cleanup: bge - was converting float[] to MT_Vector's just to compare. use BLI_math instead. --- source/gameengine/Rasterizer/CMakeLists.txt | 1 + source/gameengine/Rasterizer/RAS_TexVert.cpp | 54 ++++++++++++++-------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index ddc72c08ea1..3ea26c3be9d 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -29,6 +29,7 @@ set(INC ../Ketsji ../SceneGraph ../../blender/makesdna + ../../blender/blenlib ../../blender/blenkernel ../../../intern/container ../../../intern/guardedalloc diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp index 0a90054275b..aaaf70728fe 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.cpp +++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp @@ -32,20 +32,21 @@ #include "RAS_TexVert.h" #include "MT_Matrix4x4.h" +#include "BLI_math.h" RAS_TexVert::RAS_TexVert(const MT_Point3& xyz, - const MT_Point2 uvs[MAX_UNIT], - const MT_Vector4& tangent, - const unsigned int rgba, - const MT_Vector3& normal, - const bool flat, - const unsigned int origindex) + const MT_Point2 uvs[MAX_UNIT], + const MT_Vector4& tangent, + const unsigned int rgba, + const MT_Vector3& normal, + const bool flat, + const unsigned int origindex) { xyz.getValue(m_localxyz); SetRGBA(rgba); SetNormal(normal); tangent.getValue(m_tangent); - m_flag = (flat)? FLAT: 0; + m_flag = (flat) ? FLAT: 0; m_origindex = origindex; m_unit = 2; m_softBodyIndex = -1; @@ -79,7 +80,7 @@ void RAS_TexVert::SetXYZ(const MT_Point3& xyz) void RAS_TexVert::SetXYZ(const float xyz[3]) { - m_localxyz[0] = xyz[0]; m_localxyz[1] = xyz[1]; m_localxyz[2] = xyz[2]; + copy_v3_v3(m_localxyz, xyz); } void RAS_TexVert::SetUV(int index, const MT_Point2& uv) @@ -89,8 +90,7 @@ void RAS_TexVert::SetUV(int index, const MT_Point2& uv) void RAS_TexVert::SetUV(int index, const float uv[2]) { - m_uvs[index][0] = uv[0]; - m_uvs[index][1] = uv[1]; + copy_v2_v2(m_uvs[index], uv); } void RAS_TexVert::SetRGBA(const unsigned int rgba) @@ -106,7 +106,7 @@ void RAS_TexVert::SetFlag(const short flag) void RAS_TexVert::SetUnit(const unsigned int u) { - m_unit = u <= (unsigned int) MAX_UNIT ? u: (unsigned int)MAX_UNIT; + m_unit = (u <= (unsigned int) MAX_UNIT) ? u: (unsigned int)MAX_UNIT; } void RAS_TexVert::SetNormal(const MT_Vector3& normal) @@ -123,19 +123,21 @@ void RAS_TexVert::SetTangent(const MT_Vector3& tangent) // compare two vertices, and return TRUE if both are almost identical (they can be shared) bool RAS_TexVert::closeTo(const RAS_TexVert* other) { - bool uv_match = true; - for (int i=0; im_uvs[i])); + const float eps = FLT_EPSILON; + for (int i = 0; i < MAX_UNIT; i++) { + if (!compare_v2v2(m_uvs[i], other->m_uvs[i], eps)) { + return false; + } + } - return ( - /* m_flag == other->m_flag && */ - /* at the moment the face only stores the smooth/flat setting so don't bother comparing it */ - m_rgba == other->m_rgba && - MT_fuzzyEqual(MT_Vector3(m_normal), MT_Vector3(other->m_normal)) && - MT_fuzzyEqual(MT_Vector3(m_tangent), MT_Vector3(other->m_tangent)) && - uv_match /* && - MT_fuzzyEqual(MT_Vector3(m_localxyz), MT_Vector3(other->m_localxyz))*/); - /* don't bother comparing m_localxyz since we know there from the same vert */ + return (/* m_flag == other->m_flag && */ + /* at the moment the face only stores the smooth/flat setting so don't bother comparing it */ + (m_rgba == other->m_rgba) && + compare_v3v3(m_normal, other->m_normal, eps) && + compare_v3v3(m_tangent, other->m_tangent, eps) + /* don't bother comparing m_localxyz since we know there from the same vert */ + /* && compare_v3v3(m_localxyz, other->m_localxyz, eps))*/ + ); } short RAS_TexVert::getFlag() const @@ -151,9 +153,9 @@ unsigned int RAS_TexVert::getUnit() const void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat) { - SetXYZ((mat*MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0)).getValue()); - SetNormal((nmat*MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0)).getValue()); - SetTangent((nmat*MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue()); + SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0)).getValue()); + SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0)).getValue()); + SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue()); } void RAS_TexVert::TransformUV(int index, const MT_Matrix4x4& mat) -- cgit v1.2.3 From 6c0b8ec0649b28aa21f86aaa45afcdc5ad9c8d74 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 02:03:53 +0000 Subject: add include for scons. --- source/gameengine/Rasterizer/SConscript | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript index 438e95391bb..4ff79d9ce24 100644 --- a/source/gameengine/Rasterizer/SConscript +++ b/source/gameengine/Rasterizer/SConscript @@ -29,16 +29,31 @@ Import ('env') sources = env.Glob('*.cpp') - -incs = '. #intern/guardedalloc #intern/string #intern/moto/include #intern/container #source/gameengine/BlenderRoutines #extern/glew/include #source/gameengine/Expressions #source/gameengine/SceneGraph #source/blender/blenkernel #source/blender/makesdna' - -defs = [ 'GLEW_STATIC' ] +incs = [ + '.', + '#intern/guardedalloc', + '#intern/string', + '#intern/moto/include', + '#intern/container', + '#source/gameengine/BlenderRoutines', + '#extern/glew/include', + '#source/gameengine/Expressions', + '#source/gameengine/SceneGraph', + '#source/blender/blenlib', + '#source/blender/blenkernel', + '#source/blender/makesdna', + ] + +defs = ['GLEW_STATIC'] if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs.append(env['BF_PYTHON_INC']) defs.append('WITH_PYTHON') if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') -env.BlenderLib ( 'ge_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS']) +env.BlenderLib('ge_rasterizer', sources, + includes=incs, defines=defs, + libtype=['core', 'player'], priority=[350, 70], + cxx_compileflags=env['BGE_CXXFLAGS']) -- cgit v1.2.3 From f924750463b40aa10caf5070543937d326f5605f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 02:45:12 +0000 Subject: fix for error using uninitialized draw mode with 'm_failsafe_storage' in the BGE. --- .../Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 8c46618ee36..0186e99f78a 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -364,6 +364,9 @@ void RAS_OpenGLRasterizer::SetDrawingMode(int drawingmode) glDisable(GL_CULL_FACE); m_storage->SetDrawingMode(drawingmode); + if (m_failsafe_storage && m_failsafe_storage != m_storage) { + m_failsafe_storage->SetDrawingMode(drawingmode); + } } int RAS_OpenGLRasterizer::GetDrawingMode() -- cgit v1.2.3 From e4febef1fb659199b4ab73e3c6ef93edf54243dc Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 23 Feb 2013 02:47:22 +0000 Subject: BGE: Finally moving material IPOs to the 2.60 BGE animation system (BL_Action). It was kind of a fluke that they worked before. --- .../Converter/BL_BlenderDataConversion.cpp | 2 - source/gameengine/Converter/CMakeLists.txt | 2 - source/gameengine/Converter/KX_IpoConvert.cpp | 496 --------------------- source/gameengine/Converter/KX_IpoConvert.h | 71 --- source/gameengine/Ketsji/BL_Action.cpp | 29 ++ source/gameengine/Ketsji/CMakeLists.txt | 2 + source/gameengine/Ketsji/KX_IpoConvert.cpp | 413 +++++++++++++++++ source/gameengine/Ketsji/KX_IpoConvert.h | 68 +++ 8 files changed, 512 insertions(+), 571 deletions(-) delete mode 100644 source/gameengine/Converter/KX_IpoConvert.cpp delete mode 100644 source/gameengine/Converter/KX_IpoConvert.h create mode 100644 source/gameengine/Ketsji/KX_IpoConvert.cpp create mode 100644 source/gameengine/Ketsji/KX_IpoConvert.h diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index f7726ebaf78..1c160097e2c 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2233,8 +2233,6 @@ static void bl_ConvertBlenderObject_Single( gameobj->NodeSetLocalScale(scale); gameobj->NodeUpdateGS(0); - BL_ConvertMaterialIpos(blenderobject, gameobj, converter); - sumolist->Add(gameobj->AddRef()); BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer); diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index 38c0d71d24d..f18646c1de0 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -82,7 +82,6 @@ set(SRC KX_ConvertControllers.cpp KX_ConvertProperties.cpp KX_ConvertSensors.cpp - KX_IpoConvert.cpp KX_LibLoadStatus.cpp KX_SoftBodyDeformer.cpp @@ -105,7 +104,6 @@ set(SRC KX_ConvertControllers.h KX_ConvertProperties.h KX_ConvertSensors.h - KX_IpoConvert.h KX_LibLoadStatus.h KX_SoftBodyDeformer.h ) diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp deleted file mode 100644 index 0b0ee132a42..00000000000 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/Converter/KX_IpoConvert.cpp - * \ingroup bgeconv - */ - -#ifdef _MSC_VER - /* don't show stl-warnings */ -# pragma warning (disable:4786) -#endif - -#include "BKE_material.h" /* give_current_material */ - -#include "KX_GameObject.h" -#include "KX_IpoConvert.h" -#include "KX_IInterpolator.h" -#include "KX_ScalarInterpolator.h" - -#include "KX_BlenderScalarInterpolator.h" -#include "KX_BlenderSceneConverter.h" - - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -#include "DNA_object_types.h" -#include "DNA_action_types.h" -#include "DNA_anim_types.h" -#include "DNA_ipo_types.h" -#include "DNA_lamp_types.h" -#include "DNA_world_types.h" -#include "DNA_camera_types.h" -#include "DNA_material_types.h" -/* end of blender include block */ - -#include "KX_IPO_SGController.h" -#include "KX_LightIpoSGController.h" -#include "KX_CameraIpoSGController.h" -#include "KX_WorldIpoController.h" -#include "KX_ObColorIpoSGController.h" -#include "KX_MaterialIpoController.h" - -#include "SG_Node.h" - -#include "STR_HashedString.h" - -static BL_InterpolatorList *GetAdtList(struct bAction *for_act, KX_BlenderSceneConverter *converter) -{ - BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_act); - - if (!adtList) { - adtList = new BL_InterpolatorList(for_act); - converter->RegisterInterpolatorList(adtList, for_act); - } - - return adtList; -} - -SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_BlenderSceneConverter *converter) -{ - KX_IpoSGController* ipocontr = new KX_IpoSGController(); - ipocontr->SetGameObject(gameobj); - - Object* blenderobject = gameobj->GetBlenderObject(); - - ipocontr->GetIPOTransform().SetPosition(MT_Point3(blenderobject->loc)); - ipocontr->GetIPOTransform().SetEulerAngles(MT_Vector3(blenderobject->rot)); - ipocontr->GetIPOTransform().SetScaling(MT_Vector3(blenderobject->size)); - - const char *rotmode, *drotmode; - - switch (blenderobject->rotmode) { - case ROT_MODE_AXISANGLE: - rotmode = "rotation_axis_angle"; - drotmode = "delta_rotation_axis_angle"; - break; - case ROT_MODE_QUAT: /* XXX, this isn't working, currently only eulers are supported [#28853] */ - rotmode = "rotation_quaternion"; - drotmode = "delta_rotation_quaternion"; - break; - default: - rotmode = "rotation_euler"; - drotmode = "delta_rotation_euler"; - break; - } - - BL_InterpolatorList *adtList= GetAdtList(action, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("location", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_LOC_X+i, true); - } - } - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("delta_location", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaPosition()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_DLOC_X+i, true); - } - } - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator(rotmode, i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_ROT_X+i, true); - } - } - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator(drotmode, i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_DROT_X+i, true); - } - } - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("scale", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetScaling()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_SIZE_X+i, true); - } - } - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("delta_scale", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaScaling()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_DSIZE_X+i, true); - } - } - - - return ipocontr; -} - - -SG_Controller *BL_CreateObColorIPO(struct bAction *action, KX_GameObject* gameobj, KX_BlenderSceneConverter *converter) -{ - KX_ObColorIpoSGController* ipocontr_obcol=NULL; - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - BL_InterpolatorList *adtList= GetAdtList(action, converter); - - for (int i=0; i<4; i++) { - if ((interp = adtList->GetScalarInterpolator("color", i))) { - if (!ipocontr_obcol) { - ipocontr_obcol = new KX_ObColorIpoSGController(); - } - interpolator= new KX_ScalarInterpolator(&ipocontr_obcol->m_rgba[i], interp); - ipocontr_obcol->AddInterpolator(interpolator); - } - } - - return ipocontr_obcol; -} - -void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_BlenderSceneConverter *converter) -{ - if (blenderobject->adt) { - SG_Controller *ipocontr = BL_CreateIPO(blenderobject->adt->action, gameobj, converter); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - - SG_Controller *ipocontr_obcol = BL_CreateObColorIPO(blenderobject->adt->action, gameobj, converter); - if (ipocontr_obcol) { - gameobj->GetSGNode()->AddSGController(ipocontr_obcol); - ipocontr_obcol->SetObject(gameobj->GetSGNode()); - } - } -} - -SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj, KX_BlenderSceneConverter *converter) -{ - KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController(); - - Lamp *blenderlamp = (Lamp*)lightobj->GetBlenderObject()->data; - - ipocontr->m_energy = blenderlamp->energy; - ipocontr->m_col_rgb[0] = blenderlamp->r; - ipocontr->m_col_rgb[1] = blenderlamp->g; - ipocontr->m_col_rgb[2] = blenderlamp->b; - ipocontr->m_dist = blenderlamp->dist; - - BL_InterpolatorList *adtList= GetAdtList(action, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - if ((interp= adtList->GetScalarInterpolator("energy", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyEnergy(true); - } - - if ((interp = adtList->GetScalarInterpolator("distance", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyDist(true); - } - - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("color", i))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyColor(true); - } - } - - return ipocontr; -} - -void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_BlenderSceneConverter *converter) -{ - - if (blenderlamp->adt) { - - SG_Controller* ipocontr = BL_CreateLampIPO(blenderlamp->adt->action, lightobj, converter); - lightobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(lightobj->GetSGNode()); - - - } -} - -SG_Controller *BL_CreateCameraIPO(struct bAction *action, KX_GameObject* cameraobj, KX_BlenderSceneConverter *converter) -{ - KX_CameraIpoSGController* ipocontr = new KX_CameraIpoSGController(); - - Camera *blendercamera = (Camera*)cameraobj->GetBlenderObject()->data; - - ipocontr->m_lens = blendercamera->lens; - ipocontr->m_clipstart = blendercamera->clipsta; - ipocontr->m_clipend = blendercamera->clipend; - - BL_InterpolatorList *adtList= GetAdtList(action, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - if ((interp = adtList->GetScalarInterpolator("lens", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_lens, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyLens(true); - } - - if ((interp = adtList->GetScalarInterpolator("clip_start", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipstart, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyClipStart(true); - } - - if ((interp = adtList->GetScalarInterpolator("clip_end", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipend, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyClipEnd(true); - } - - return ipocontr; -} - -void BL_ConvertCameraIpos(struct Camera* blendercamera, KX_GameObject *cameraobj,KX_BlenderSceneConverter *converter) -{ - - if (blendercamera->adt) { - SG_Controller* ipocontr = BL_CreateCameraIPO(blendercamera->adt->action, cameraobj, converter); - cameraobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(cameraobj->GetSGNode()); - } -} - - -void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *converter) -{ - - if (blenderworld->adt) { - - KX_WorldIpoController* ipocontr = new KX_WorldIpoController(); - -// Erwin, hook up the world ipo controller here -// Gino: hook it up to what ? -// is there a userinterface element for that ? -// for now, we have some new python hooks to access the data, for a work-around - - ipocontr->m_mist_start = blenderworld->miststa; - ipocontr->m_mist_dist = blenderworld->mistdist; - ipocontr->m_mist_rgb[0] = blenderworld->horr; - ipocontr->m_mist_rgb[1] = blenderworld->horg; - ipocontr->m_mist_rgb[2] = blenderworld->horb; - - BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt->action, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - for (int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("horizon_color", i))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_rgb[i], interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyMistColor(true); - } - } - - if ((interp = adtList->GetScalarInterpolator("mist.depth", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_dist, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyMistDist(true); - } - - if ((interp = adtList->GetScalarInterpolator("mist.start", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_start, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyMistStart(true); - } - } -} - -static void ConvertMaterialIpos( - Material* blendermaterial, - dword matname_hash, - KX_GameObject* gameobj, - KX_BlenderSceneConverter *converter - ) -{ - if (blendermaterial->adt) { - KX_MaterialIpoController* ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - - BL_InterpolatorList *adtList= GetAdtList(blendermaterial->adt->action, converter); - - - ipocontr->m_rgba[0] = blendermaterial->r; - ipocontr->m_rgba[1] = blendermaterial->g; - ipocontr->m_rgba[2] = blendermaterial->b; - ipocontr->m_rgba[3] = blendermaterial->alpha; - - ipocontr->m_specrgb[0] = blendermaterial->specr; - ipocontr->m_specrgb[1] = blendermaterial->specg; - ipocontr->m_specrgb[2] = blendermaterial->specb; - - ipocontr->m_hard = blendermaterial->har; - ipocontr->m_spec = blendermaterial->spec; - ipocontr->m_ref = blendermaterial->ref; - ipocontr->m_emit = blendermaterial->emit; - ipocontr->m_alpha = blendermaterial->alpha; - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *sinterp; - - // -- - for (int i=0; i<3; i++) { - if ((sinterp = adtList->GetScalarInterpolator("diffuse_color", i))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_rgba[i], sinterp); - ipocontr->AddInterpolator(interpolator); - } - } - - if ((sinterp = adtList->GetScalarInterpolator("alpha", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_rgba[3], sinterp); - ipocontr->AddInterpolator(interpolator); - } - - for (int i=0; i<3; i++) { - if ((sinterp = adtList->GetScalarInterpolator("specular_color", i))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_specrgb[i], sinterp); - ipocontr->AddInterpolator(interpolator); - } - } - - if ((sinterp = adtList->GetScalarInterpolator("specular_hardness", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_hard, sinterp); - ipocontr->AddInterpolator(interpolator); - } - - if ((sinterp = adtList->GetScalarInterpolator("specularity", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_spec, sinterp); - ipocontr->AddInterpolator(interpolator); - } - - if ((sinterp = adtList->GetScalarInterpolator("diffuse_reflection", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_ref, sinterp); - ipocontr->AddInterpolator(interpolator); - } - - if ((sinterp = adtList->GetScalarInterpolator("emit", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_emit, sinterp); - ipocontr->AddInterpolator(interpolator); - } - } -} - -void BL_ConvertMaterialIpos( - struct Object* blenderobject, - KX_GameObject* gameobj, - KX_BlenderSceneConverter *converter - ) -{ - if (blenderobject->totcol==1) - { - Material *mat = give_current_material(blenderobject, 1); - // if there is only one material attached to the mesh then set material_index in BL_ConvertMaterialIpos to NULL - // --> this makes the UpdateMaterialData function in KX_GameObject.cpp use the old hack of using SetObjectColor - // because this yields a better performance as not all the vertex colors need to be edited - if (mat) ConvertMaterialIpos(mat, 0, gameobj, converter); - } - else - { - for (int material_index=1; material_index <= blenderobject->totcol; material_index++) - { - Material *mat = give_current_material(blenderobject, material_index); - STR_HashedString matname; - if (mat) { - matname= mat->id.name; // who is using this name? can we remove the MA here? - ConvertMaterialIpos(mat, matname.hash(), gameobj, converter); - } - } - } -} - diff --git a/source/gameengine/Converter/KX_IpoConvert.h b/source/gameengine/Converter/KX_IpoConvert.h deleted file mode 100644 index 044993a31e6..00000000000 --- a/source/gameengine/Converter/KX_IpoConvert.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file KX_IpoConvert.h - * \ingroup bgeconv - */ - -#ifndef __KX_IPOCONVERT_H__ -#define __KX_IPOCONVERT_H__ - -struct Object; - -class SG_Controller *BL_CreateIPO(struct bAction *action, - class KX_GameObject* gameobj, - class KX_BlenderSceneConverter *converter); -class SG_Controller *BL_CreateObColorIPO(struct bAction *action, - class KX_GameObject* gameobj, - class KX_BlenderSceneConverter *converter); -void BL_ConvertIpos(struct Object* blenderobject, - class KX_GameObject* gameobj, - class KX_BlenderSceneConverter *converter); - -class SG_Controller *BL_CreateLampIPO(struct bAction *action, - class KX_GameObject* lightobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertLampIpos(struct Lamp* blenderlight, - class KX_GameObject* lightobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertWorldIpos(struct World* blenderworld, - class KX_BlenderSceneConverter *converter); - -class SG_Controller *BL_CreateCameraIPO(struct bAction *action, - class KX_GameObject* cameraobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertCameraIpos(struct Camera* blendercamera, - class KX_GameObject* cameraobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertMaterialIpos(struct Object* blenderobject, - class KX_GameObject* materialobj, - class KX_BlenderSceneConverter *converter); - - -#endif /* __KX_IPOCONVERT_H__ */ diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index f55d1120a50..ff1f800a626 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -43,6 +43,10 @@ extern "C" { #include "BKE_action.h" #include "RNA_access.h" #include "RNA_define.h" + +// Needed for material IPOs +#include "BKE_material.h" +#include "DNA_material_types.h" } BL_Action::BL_Action(class KX_GameObject* gameobj) @@ -169,6 +173,31 @@ bool BL_Action::Play(const char* name, sg_contr->SetObject(m_obj->GetSGNode()); } + // Now try materials + if (m_obj->GetBlenderObject()->totcol==1) { + Material *mat = give_current_material(m_obj->GetBlenderObject(), 1); + sg_contr = BL_CreateMaterialIpo(m_action, mat, 0, m_obj, kxscene->GetSceneConverter()); + if (sg_contr) { + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + } + } else { + Material *mat; + STR_HashedString matname; + + for (int matidx = 1; matidx <= m_obj->GetBlenderObject()->totcol; ++matidx) { + mat = give_current_material(m_obj->GetBlenderObject(), matidx); + matname = mat->id.name; + sg_contr = BL_CreateMaterialIpo(m_action, mat, matname.hash(), m_obj, kxscene->GetSceneConverter()); + if (sg_contr) { + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + } + } + } + // Extra controllers if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) { diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index fc322d80cd0..7f748013648 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -84,6 +84,7 @@ set(SRC KX_FontObject.cpp KX_GameActuator.cpp KX_GameObject.cpp + KX_IpoConvert.cpp KX_IPO_SGController.cpp KX_IPhysicsController.cpp KX_IpoActuator.cpp @@ -161,6 +162,7 @@ set(SRC KX_GameActuator.h KX_GameObject.h KX_IInterpolator.h + KX_IpoConvert.h KX_IPOTransform.h KX_IPO_SGController.h KX_IPhysicsController.h diff --git a/source/gameengine/Ketsji/KX_IpoConvert.cpp b/source/gameengine/Ketsji/KX_IpoConvert.cpp new file mode 100644 index 00000000000..9ec354ec840 --- /dev/null +++ b/source/gameengine/Ketsji/KX_IpoConvert.cpp @@ -0,0 +1,413 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file gameengine/Converter/KX_IpoConvert.cpp + * \ingroup bgeconv + */ + +#ifdef _MSC_VER + /* don't show stl-warnings */ +# pragma warning (disable:4786) +#endif + +#include "BKE_material.h" /* give_current_material */ + +#include "KX_GameObject.h" +#include "KX_IpoConvert.h" +#include "KX_IInterpolator.h" +#include "KX_ScalarInterpolator.h" + +#include "KX_BlenderScalarInterpolator.h" +#include "KX_BlenderSceneConverter.h" + + +/* This little block needed for linking to Blender... */ +#ifdef WIN32 +#include "BLI_winstuff.h" +#endif + +#include "DNA_object_types.h" +#include "DNA_action_types.h" +#include "DNA_anim_types.h" +#include "DNA_ipo_types.h" +#include "DNA_lamp_types.h" +#include "DNA_world_types.h" +#include "DNA_camera_types.h" +#include "DNA_material_types.h" +/* end of blender include block */ + +#include "KX_IPO_SGController.h" +#include "KX_LightIpoSGController.h" +#include "KX_CameraIpoSGController.h" +#include "KX_WorldIpoController.h" +#include "KX_ObColorIpoSGController.h" +#include "KX_MaterialIpoController.h" + +#include "SG_Node.h" + +#include "STR_HashedString.h" + +static BL_InterpolatorList *GetAdtList(struct bAction *for_act, KX_BlenderSceneConverter *converter) +{ + BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_act); + + if (!adtList) { + adtList = new BL_InterpolatorList(for_act); + converter->RegisterInterpolatorList(adtList, for_act); + } + + return adtList; +} + +SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_BlenderSceneConverter *converter) +{ + KX_IpoSGController* ipocontr = new KX_IpoSGController(); + ipocontr->SetGameObject(gameobj); + + Object* blenderobject = gameobj->GetBlenderObject(); + + ipocontr->GetIPOTransform().SetPosition(MT_Point3(blenderobject->loc)); + ipocontr->GetIPOTransform().SetEulerAngles(MT_Vector3(blenderobject->rot)); + ipocontr->GetIPOTransform().SetScaling(MT_Vector3(blenderobject->size)); + + const char *rotmode, *drotmode; + + switch (blenderobject->rotmode) { + case ROT_MODE_AXISANGLE: + rotmode = "rotation_axis_angle"; + drotmode = "delta_rotation_axis_angle"; + break; + case ROT_MODE_QUAT: /* XXX, this isn't working, currently only eulers are supported [#28853] */ + rotmode = "rotation_quaternion"; + drotmode = "delta_rotation_quaternion"; + break; + default: + rotmode = "rotation_euler"; + drotmode = "delta_rotation_euler"; + break; + } + + BL_InterpolatorList *adtList= GetAdtList(action, converter); + + // For each active channel in the adtList add an + // interpolator to the game object. + + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; + + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("location", i))) { + interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetIPOChannelActive(OB_LOC_X+i, true); + } + } + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("delta_location", i))) { + interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaPosition()[i]), interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetIPOChannelActive(OB_DLOC_X+i, true); + } + } + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator(rotmode, i))) { + interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetIPOChannelActive(OB_ROT_X+i, true); + } + } + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator(drotmode, i))) { + interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetIPOChannelActive(OB_DROT_X+i, true); + } + } + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("scale", i))) { + interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetScaling()[i]), interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetIPOChannelActive(OB_SIZE_X+i, true); + } + } + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("delta_scale", i))) { + interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaScaling()[i]), interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetIPOChannelActive(OB_DSIZE_X+i, true); + } + } + + + return ipocontr; +} + + +SG_Controller *BL_CreateObColorIPO(struct bAction *action, KX_GameObject* gameobj, KX_BlenderSceneConverter *converter) +{ + KX_ObColorIpoSGController* ipocontr_obcol=NULL; + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; + BL_InterpolatorList *adtList= GetAdtList(action, converter); + + for (int i=0; i<4; i++) { + if ((interp = adtList->GetScalarInterpolator("color", i))) { + if (!ipocontr_obcol) { + ipocontr_obcol = new KX_ObColorIpoSGController(); + } + interpolator= new KX_ScalarInterpolator(&ipocontr_obcol->m_rgba[i], interp); + ipocontr_obcol->AddInterpolator(interpolator); + } + } + + return ipocontr_obcol; +} + +SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj, KX_BlenderSceneConverter *converter) +{ + KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController(); + + Lamp *blenderlamp = (Lamp*)lightobj->GetBlenderObject()->data; + + ipocontr->m_energy = blenderlamp->energy; + ipocontr->m_col_rgb[0] = blenderlamp->r; + ipocontr->m_col_rgb[1] = blenderlamp->g; + ipocontr->m_col_rgb[2] = blenderlamp->b; + ipocontr->m_dist = blenderlamp->dist; + + BL_InterpolatorList *adtList= GetAdtList(action, converter); + + // For each active channel in the adtList add an + // interpolator to the game object. + + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; + + if ((interp= adtList->GetScalarInterpolator("energy", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyEnergy(true); + } + + if ((interp = adtList->GetScalarInterpolator("distance", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyDist(true); + } + + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("color", i))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyColor(true); + } + } + + return ipocontr; +} + +SG_Controller *BL_CreateCameraIPO(struct bAction *action, KX_GameObject* cameraobj, KX_BlenderSceneConverter *converter) +{ + KX_CameraIpoSGController* ipocontr = new KX_CameraIpoSGController(); + + Camera *blendercamera = (Camera*)cameraobj->GetBlenderObject()->data; + + ipocontr->m_lens = blendercamera->lens; + ipocontr->m_clipstart = blendercamera->clipsta; + ipocontr->m_clipend = blendercamera->clipend; + + BL_InterpolatorList *adtList= GetAdtList(action, converter); + + // For each active channel in the adtList add an + // interpolator to the game object. + + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; + + if ((interp = adtList->GetScalarInterpolator("lens", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_lens, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyLens(true); + } + + if ((interp = adtList->GetScalarInterpolator("clip_start", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipstart, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyClipStart(true); + } + + if ((interp = adtList->GetScalarInterpolator("clip_end", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipend, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyClipEnd(true); + } + + return ipocontr; +} + +void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *converter) +{ + + if (blenderworld->adt) { + + KX_WorldIpoController* ipocontr = new KX_WorldIpoController(); + +// Erwin, hook up the world ipo controller here +// Gino: hook it up to what ? +// is there a userinterface element for that ? +// for now, we have some new python hooks to access the data, for a work-around + + ipocontr->m_mist_start = blenderworld->miststa; + ipocontr->m_mist_dist = blenderworld->mistdist; + ipocontr->m_mist_rgb[0] = blenderworld->horr; + ipocontr->m_mist_rgb[1] = blenderworld->horg; + ipocontr->m_mist_rgb[2] = blenderworld->horb; + + BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt->action, converter); + + // For each active channel in the adtList add an + // interpolator to the game object. + + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; + + for (int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("horizon_color", i))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_rgb[i], interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyMistColor(true); + } + } + + if ((interp = adtList->GetScalarInterpolator("mist.depth", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_dist, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyMistDist(true); + } + + if ((interp = adtList->GetScalarInterpolator("mist.start", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_start, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyMistStart(true); + } + } +} + +SG_Controller *BL_CreateMaterialIpo( + struct bAction *action, + Material* blendermaterial, + dword matname_hash, + KX_GameObject* gameobj, + KX_BlenderSceneConverter *converter + ) +{ + KX_MaterialIpoController* ipocontr = NULL; + + BL_InterpolatorList *adtList= GetAdtList(action, converter); + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *sinterp; + + // -- + for (int i=0; i<3; i++) { + if ((sinterp = adtList->GetScalarInterpolator("diffuse_color", i))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_rgba[i], sinterp); + ipocontr->AddInterpolator(interpolator); + } + } + + if ((sinterp = adtList->GetScalarInterpolator("alpha", 0))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_rgba[3], sinterp); + ipocontr->AddInterpolator(interpolator); + } + + for (int i=0; i<3; i++) { + if ((sinterp = adtList->GetScalarInterpolator("specular_color", i))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_specrgb[i], sinterp); + ipocontr->AddInterpolator(interpolator); + } + } + + if ((sinterp = adtList->GetScalarInterpolator("specular_hardness", 0))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_hard, sinterp); + ipocontr->AddInterpolator(interpolator); + } + + if ((sinterp = adtList->GetScalarInterpolator("specularity", 0))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_spec, sinterp); + ipocontr->AddInterpolator(interpolator); + } + + if ((sinterp = adtList->GetScalarInterpolator("diffuse_reflection", 0))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_ref, sinterp); + ipocontr->AddInterpolator(interpolator); + } + + if ((sinterp = adtList->GetScalarInterpolator("emit", 0))) { + if (!ipocontr) { + ipocontr = new KX_MaterialIpoController(matname_hash); + } + interpolator= new KX_ScalarInterpolator(&ipocontr->m_emit, sinterp); + ipocontr->AddInterpolator(interpolator); + } + + if (ipocontr) { + ipocontr->m_rgba[0] = blendermaterial->r; + ipocontr->m_rgba[1] = blendermaterial->g; + ipocontr->m_rgba[2] = blendermaterial->b; + ipocontr->m_rgba[3] = blendermaterial->alpha; + + ipocontr->m_specrgb[0] = blendermaterial->specr; + ipocontr->m_specrgb[1] = blendermaterial->specg; + ipocontr->m_specrgb[2] = blendermaterial->specb; + + ipocontr->m_hard = blendermaterial->har; + ipocontr->m_spec = blendermaterial->spec; + ipocontr->m_ref = blendermaterial->ref; + ipocontr->m_emit = blendermaterial->emit; + ipocontr->m_alpha = blendermaterial->alpha; + } + + return ipocontr; +} diff --git a/source/gameengine/Ketsji/KX_IpoConvert.h b/source/gameengine/Ketsji/KX_IpoConvert.h new file mode 100644 index 00000000000..1f4e1bea96d --- /dev/null +++ b/source/gameengine/Ketsji/KX_IpoConvert.h @@ -0,0 +1,68 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file KX_IpoConvert.h + * \ingroup bgeconv + */ + +#ifndef __KX_IPOCONVERT_H__ +#define __KX_IPOCONVERT_H__ + +struct Object; +struct bAction; +class SG_Controller; +class KX_GameObject; +class KX_BlenderSceneConverter; + +SG_Controller *BL_CreateIPO(bAction *action, + KX_GameObject* gameobj, + KX_BlenderSceneConverter *converter); + +SG_Controller *BL_CreateObColorIPO(bAction *action, + KX_GameObject* gameobj, + KX_BlenderSceneConverter *converter); + +SG_Controller *BL_CreateLampIPO(bAction *action, + KX_GameObject* lightobj, + KX_BlenderSceneConverter *converter); + +void BL_ConvertWorldIpos(struct World* blenderworld, + KX_BlenderSceneConverter *converter); + +SG_Controller *BL_CreateCameraIPO(bAction *action, + KX_GameObject* cameraobj, + KX_BlenderSceneConverter *converter); + +SG_Controller *BL_CreateMaterialIpo( + bAction *action, + class Material* blendermaterial, + dword matname_hash, + KX_GameObject* gameobj, + KX_BlenderSceneConverter *converter); + + +#endif /* __KX_IPOCONVERT_H__ */ -- cgit v1.2.3 From 87ab62246333171ee11b43e348eab5f5b764f52f Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 23 Feb 2013 04:15:47 +0000 Subject: BGE: Fix for bug #34377 "Multi UV mesh's materials not backwards compatible and Odd UV Coord behavior" reported by Alex Mairs (ctbm). The problem was the unused texture slot was still trying to be used. Now unused texture slots' mappings are set to DISABLE so they don't mess up the rest of the conversion process. --- .../Converter/BL_BlenderDataConversion.cpp | 75 ++++++++++++---------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 1c160097e2c..7387092391d 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -691,44 +691,49 @@ static bool ConvertMaterial( #endif /// -------------------------------- // mapping methods - material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; - - if (mttmp->texco & TEXCO_OBJECT) { - material->mapping[i].mapping |= USEOBJ; - if (mttmp->object) - material->mapping[i].objconame = mttmp->object->id.name; - } - else if (mttmp->texco &TEXCO_REFL) - material->mapping[i].mapping |= USEREFL; - else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) - material->mapping[i].mapping |= USEORCO; - else if (mttmp->texco &TEXCO_UV) - { - STR_String uvName = mttmp->uvname; + if (mat->septex & (1 << i)) { + // If this texture slot isn't in use, set it to disabled to prevent multi-uv problems + material->mapping[i].mapping = DISABLE; + } else { + material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; + + if (mttmp->texco & TEXCO_OBJECT) { + material->mapping[i].mapping |= USEOBJ; + if (mttmp->object) + material->mapping[i].objconame = mttmp->object->id.name; + } + else if (mttmp->texco &TEXCO_REFL) + material->mapping[i].mapping |= USEREFL; + else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) + material->mapping[i].mapping |= USEORCO; + else if (mttmp->texco &TEXCO_UV) + { + STR_String uvName = mttmp->uvname; - if (!uvName.IsEmpty()) - material->mapping[i].uvCoName = mttmp->uvname; + if (!uvName.IsEmpty()) + material->mapping[i].uvCoName = mttmp->uvname; + else + material->mapping[i].uvCoName = ""; + material->mapping[i].mapping |= USEUV; + } + else if (mttmp->texco &TEXCO_NORM) + material->mapping[i].mapping |= USENORM; + else if (mttmp->texco &TEXCO_TANGENT) + material->mapping[i].mapping |= USETANG; else - material->mapping[i].uvCoName = ""; - material->mapping[i].mapping |= USEUV; + material->mapping[i].mapping |= DISABLE; + + material->mapping[i].scale[0] = mttmp->size[0]; + material->mapping[i].scale[1] = mttmp->size[1]; + material->mapping[i].scale[2] = mttmp->size[2]; + material->mapping[i].offsets[0] = mttmp->ofs[0]; + material->mapping[i].offsets[1] = mttmp->ofs[1]; + material->mapping[i].offsets[2] = mttmp->ofs[2]; + + material->mapping[i].projplane[0] = mttmp->projx; + material->mapping[i].projplane[1] = mttmp->projy; + material->mapping[i].projplane[2] = mttmp->projz; } - else if (mttmp->texco &TEXCO_NORM) - material->mapping[i].mapping |= USENORM; - else if (mttmp->texco &TEXCO_TANGENT) - material->mapping[i].mapping |= USETANG; - else - material->mapping[i].mapping |= DISABLE; - - material->mapping[i].scale[0] = mttmp->size[0]; - material->mapping[i].scale[1] = mttmp->size[1]; - material->mapping[i].scale[2] = mttmp->size[2]; - material->mapping[i].offsets[0] = mttmp->ofs[0]; - material->mapping[i].offsets[1] = mttmp->ofs[1]; - material->mapping[i].offsets[2] = mttmp->ofs[2]; - - material->mapping[i].projplane[0] = mttmp->projx; - material->mapping[i].projplane[1] = mttmp->projy; - material->mapping[i].projplane[2] = mttmp->projz; /// -------------------------------- switch (mttmp->blendtype) { -- cgit v1.2.3 From e42e570ff41eb348dc7e496567038265b8468925 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 04:49:46 +0000 Subject: BGE: fix for uninitialized tangents --- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 7387092391d..a4c7e8b0fa7 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1129,6 +1129,16 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, MT_Vector3 no[4]; MT_Vector4 tan[4]; + /* ugh, if there is a less annoying way to do this please use that. + * since these are converted from floats to floats, theres no real + * advantage to use MT_ types - campbell */ + for (unsigned int i = 0; i < 4; i++) { + const float zero_vec[4] = {0.0f}; + pt[i].setValue(zero_vec); + no[i].setValue(zero_vec); + tan[i].setValue(zero_vec); + } + for (int f=0;f Date: Sat, 23 Feb 2013 05:36:15 +0000 Subject: code cleanup: make editmode PASSATTRIB into static functions. --- source/blender/blenkernel/intern/editderivedmesh.c | 139 +++++++++++---------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index d652b97e2fa..35d66c3a72e 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -997,6 +997,31 @@ static void emDM_drawMappedFacesTex(DerivedMesh *dm, emDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData); } +static void emdm_draw_attrib_vertex_glsl(DMVertexAttribs *attribs, BMesh *bm, BMLoop *loop, BMVert *eve, int vert) +{ + int i; + if (attribs->totorco) { + float *orco = attribs->orco.array[BM_elem_index_get(eve)]; + glVertexAttrib3fvARB(attribs->orco.gl_index, orco); + } + for (i = 0; i < attribs->tottface; i++) { + MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, + CD_MLOOPUV, i); + glVertexAttrib2fvARB(attribs->tface[i].gl_index, _luv->uv); + } + for (i = 0; i < attribs->totmcol; i++) { + MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, + CD_MLOOPCOL, i); + GLubyte _col[4]; + _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; + glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, _col); + } + if (attribs->tottang) { + float *tang = attribs->tang.array[i * 4 + vert]; + glVertexAttrib3fvARB(attribs->tang.gl_index, tang); + } +} + static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, DMSetMaterial setMaterial, DMSetDrawOptions setDrawOptions, @@ -1012,7 +1037,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, DMVertexAttribs attribs; GPUVertexAttribs gattribs; - int i, b, matnr, new_matnr, do_draw; + int i, matnr, new_matnr, do_draw; do_draw = FALSE; matnr = -1; @@ -1023,30 +1048,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glShadeModel(GL_SMOOTH); BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); -#define PASSATTRIB(loop, eve, vert) { \ - if (attribs.totorco) { \ - float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \ - glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \ - } \ - for (b = 0; b < attribs.tottface; b++) { \ - MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \ - CD_MLOOPUV, b); \ - glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \ - } \ - for (b = 0; b < attribs.totmcol; b++) { \ - MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \ - CD_MLOOPCOL, b); \ - GLubyte _col[4]; \ - _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; \ - glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \ - } \ - if (attribs.tottang) { \ - float *tang = attribs.tang.array[i * 4 + vert]; \ - glVertexAttrib3fvARB(attribs.tang.gl_index, tang); \ - } \ - } (void)0 - - for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) { int drawSmooth; @@ -1069,20 +1070,20 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]); else glNormal3fv(efa->no); - PASSATTRIB(ltri[0], ltri[0]->v, 0); + emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[0], ltri[0]->v, 0); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); else glVertex3fv(ltri[0]->v->co); - PASSATTRIB(ltri[1], ltri[1]->v, 1); + emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[1], ltri[1]->v, 1); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); else glVertex3fv(ltri[1]->v->co); - PASSATTRIB(ltri[2], ltri[2]->v, 2); + emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[2], ltri[2]->v, 2); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); else glVertex3fv(ltri[2]->v->co); } else { - PASSATTRIB(ltri[0], ltri[0]->v, 0); + emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[0], ltri[0]->v, 0); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); @@ -1092,7 +1093,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glVertex3fv(ltri[0]->v->co); } - PASSATTRIB(ltri[1], ltri[1]->v, 1); + emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[1], ltri[1]->v, 1); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); @@ -1102,7 +1103,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glVertex3fv(ltri[1]->v->co); } - PASSATTRIB(ltri[2], ltri[2]->v, 2); + emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[2], ltri[2]->v, 2); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); @@ -1115,7 +1116,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glEnd(); } } -#undef PASSATTRIB } static void emDM_drawFacesGLSL(DerivedMesh *dm, @@ -1124,6 +1124,37 @@ static void emDM_drawFacesGLSL(DerivedMesh *dm, dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL); } +static void emdm_draw_attrib_vertex_mat(DMVertexAttribs *attribs, BMesh *bm, BMLoop *loop, BMVert *eve, int vert) +{ + int i; + if (attribs->totorco) { + float *orco = attribs->orco.array[BM_elem_index_get(eve)]; + if (attribs->orco.gl_texco) + glTexCoord3fv(orco); + else + glVertexAttrib3fvARB(attribs->orco.gl_index, orco); + } + for (i = 0; i < attribs->tottface; i++) { + MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, + CD_MLOOPUV, i); + if (attribs->tface[i].gl_texco) + glTexCoord2fv(_luv->uv); + else + glVertexAttrib2fvARB(attribs->tface[i].gl_index, _luv->uv); + } + for (i = 0; i < attribs->totmcol; i++) { + MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, + CD_MLOOPCOL, i); + GLubyte _col[4]; + _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; + glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, _col); + } + if (attribs->tottang) { + float *tang = attribs->tang.array[i * 4 + vert]; + glVertexAttrib4fvARB(attribs->tang.gl_index, tang); + } +} + static void emDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData) @@ -1137,7 +1168,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, BMLoop **ltri; DMVertexAttribs attribs = {{{0}}}; GPUVertexAttribs gattribs; - int i, b, matnr, new_matnr; + int i, matnr, new_matnr; matnr = -1; @@ -1146,35 +1177,6 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); -#define PASSATTRIB(loop, eve, vert) { \ - if (attribs.totorco) { \ - float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \ - if (attribs.orco.gl_texco) \ - glTexCoord3fv(orco); \ - else \ - glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \ - } \ - for (b = 0; b < attribs.tottface; b++) { \ - MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \ - CD_MLOOPUV, b); \ - if (attribs.tface[b].gl_texco) \ - glTexCoord2fv(_luv->uv); \ - else \ - glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \ - } \ - for (b = 0; b < attribs.totmcol; b++) { \ - MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \ - CD_MLOOPCOL, b); \ - GLubyte _col[4]; \ - _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; \ - glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \ - } \ - if (attribs.tottang) { \ - float *tang = attribs.tang.array[i * 4 + vert]; \ - glVertexAttrib4fvARB(attribs.tang.gl_index, tang); \ - } \ - } (void)0 - for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) { int drawSmooth; @@ -1198,21 +1200,21 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]); else glNormal3fv(efa->no); - PASSATTRIB(ltri[0], ltri[0]->v, 0); + emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[0], ltri[0]->v, 0); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); else glVertex3fv(ltri[0]->v->co); - PASSATTRIB(ltri[1], ltri[1]->v, 1); + emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[1], ltri[1]->v, 1); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); else glVertex3fv(ltri[1]->v->co); - PASSATTRIB(ltri[2], ltri[2]->v, 2); + emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[2], ltri[2]->v, 2); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); else glVertex3fv(ltri[2]->v->co); } else { - PASSATTRIB(ltri[0], ltri[0]->v, 0); + emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[0], ltri[0]->v, 0); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); @@ -1222,7 +1224,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, glVertex3fv(ltri[0]->v->co); } - PASSATTRIB(ltri[1], ltri[1]->v, 1); + emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[1], ltri[1]->v, 1); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); @@ -1232,7 +1234,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, glVertex3fv(ltri[1]->v->co); } - PASSATTRIB(ltri[2], ltri[2]->v, 2); + emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[2], ltri[2]->v, 2); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); @@ -1244,7 +1246,6 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, } glEnd(); } -#undef PASSATTRIB } static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) -- cgit v1.2.3 From 375c0144c89a386d732868fd679005551f9fec98 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 06:56:10 +0000 Subject: fix [#34378] GLSL materials using multiple UV layers fail in editmode regression since BMesh merge. --- source/blender/blenkernel/intern/DerivedMesh.c | 6 +- source/blender/blenkernel/intern/editderivedmesh.c | 81 +++++++++++++--------- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index aa3d52ce9ce..6b3c95a5cd3 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2743,7 +2743,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, a = attribs->tottface++; attribs->tface[a].array = tfdata->layers[layer].data; - attribs->tface[a].em_offset = tfdata->layers[layer].offset; + attribs->tface[a].em_offset = ldata->layers[layer].offset; attribs->tface[a].gl_index = gattribs->layer[b].glindex; attribs->tface[a].gl_texco = gattribs->layer[b].gltexco; } @@ -2780,7 +2780,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, a = attribs->totmcol++; attribs->mcol[a].array = tfdata->layers[layer].data; - attribs->mcol[a].em_offset = tfdata->layers[layer].offset; + /* odd, store the offset for a different layer type here, but editmode draw code expects it */ + attribs->mcol[a].em_offset = ldata->layers[layer].offset; attribs->mcol[a].gl_index = gattribs->layer[b].glindex; } } @@ -2796,6 +2797,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, a = attribs->totmcol++; attribs->mcol[a].array = tfdata->layers[layer].data; + /* odd, store the offset for a different layer type here, but editmode draw code expects it */ attribs->mcol[a].em_offset = tfdata->layers[layer].offset; attribs->mcol[a].gl_index = gattribs->layer[b].glindex; } diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 35d66c3a72e..11c05772962 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -997,27 +997,39 @@ static void emDM_drawMappedFacesTex(DerivedMesh *dm, emDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData); } -static void emdm_draw_attrib_vertex_glsl(DMVertexAttribs *attribs, BMesh *bm, BMLoop *loop, BMVert *eve, int vert) +/** + * \note + * + * For UV's: + * const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset); + * + * This is intentionally different to calling: + * CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, i); + * + * ... because the material may use layer names to select different UV's + * see: [#34378] + */ +static void emdm_pass_attrib_vertex_glsl(DMVertexAttribs *attribs, BMLoop *loop, int index_in_face) { + BMVert *eve = loop->v; int i; + if (attribs->totorco) { - float *orco = attribs->orco.array[BM_elem_index_get(eve)]; + const float *orco = attribs->orco.array[BM_elem_index_get(eve)]; glVertexAttrib3fvARB(attribs->orco.gl_index, orco); } for (i = 0; i < attribs->tottface; i++) { - MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, - CD_MLOOPUV, i); - glVertexAttrib2fvARB(attribs->tface[i].gl_index, _luv->uv); + const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset); + glVertexAttrib2fvARB(attribs->tface[i].gl_index, luv->uv); } for (i = 0; i < attribs->totmcol; i++) { - MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, - CD_MLOOPCOL, i); - GLubyte _col[4]; - _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; - glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, _col); + const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset); + GLubyte col[4]; + col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a; + glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, col); } if (attribs->tottang) { - float *tang = attribs->tang.array[i * 4 + vert]; + const float *tang = attribs->tang.array[i * 4 + index_in_face]; glVertexAttrib3fvARB(attribs->tang.gl_index, tang); } } @@ -1070,20 +1082,20 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]); else glNormal3fv(efa->no); - emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[0], ltri[0]->v, 0); + emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); else glVertex3fv(ltri[0]->v->co); - emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[1], ltri[1]->v, 1); + emdm_pass_attrib_vertex_glsl(&attribs, ltri[1], 1); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); else glVertex3fv(ltri[1]->v->co); - emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[2], ltri[2]->v, 2); + emdm_pass_attrib_vertex_glsl(&attribs, ltri[2], 2); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); else glVertex3fv(ltri[2]->v->co); } else { - emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[0], ltri[0]->v, 0); + emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); @@ -1093,7 +1105,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glVertex3fv(ltri[0]->v->co); } - emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[1], ltri[1]->v, 1); + emdm_pass_attrib_vertex_glsl(&attribs, ltri[1], 1); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); @@ -1103,7 +1115,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glVertex3fv(ltri[1]->v->co); } - emdm_draw_attrib_vertex_glsl(&attribs, bm, ltri[2], ltri[2]->v, 2); + emdm_pass_attrib_vertex_glsl(&attribs, ltri[2], 2); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); @@ -1124,9 +1136,12 @@ static void emDM_drawFacesGLSL(DerivedMesh *dm, dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL); } -static void emdm_draw_attrib_vertex_mat(DMVertexAttribs *attribs, BMesh *bm, BMLoop *loop, BMVert *eve, int vert) +/* emdm_pass_attrib_vertex_glsl's note about em_offset use applies here */ +static void emdm_pass_attrib_vertex_mat(DMVertexAttribs *attribs, BMLoop *loop, int index_in_face) { + BMVert *eve = loop->v; int i; + if (attribs->totorco) { float *orco = attribs->orco.array[BM_elem_index_get(eve)]; if (attribs->orco.gl_texco) @@ -1135,22 +1150,20 @@ static void emdm_draw_attrib_vertex_mat(DMVertexAttribs *attribs, BMesh *bm, BML glVertexAttrib3fvARB(attribs->orco.gl_index, orco); } for (i = 0; i < attribs->tottface; i++) { - MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, - CD_MLOOPUV, i); + const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset); if (attribs->tface[i].gl_texco) - glTexCoord2fv(_luv->uv); + glTexCoord2fv(luv->uv); else - glVertexAttrib2fvARB(attribs->tface[i].gl_index, _luv->uv); + glVertexAttrib2fvARB(attribs->tface[i].gl_index, luv->uv); } for (i = 0; i < attribs->totmcol; i++) { - MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, - CD_MLOOPCOL, i); - GLubyte _col[4]; - _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; - glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, _col); + const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset); + GLubyte col[4]; + col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a; + glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, col); } if (attribs->tottang) { - float *tang = attribs->tang.array[i * 4 + vert]; + float *tang = attribs->tang.array[i * 4 + index_in_face]; glVertexAttrib4fvARB(attribs->tang.gl_index, tang); } } @@ -1200,21 +1213,21 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]); else glNormal3fv(efa->no); - emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[0], ltri[0]->v, 0); + emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); else glVertex3fv(ltri[0]->v->co); - emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[1], ltri[1]->v, 1); + emdm_pass_attrib_vertex_mat(&attribs, ltri[1], 1); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); else glVertex3fv(ltri[1]->v->co); - emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[2], ltri[2]->v, 2); + emdm_pass_attrib_vertex_mat(&attribs, ltri[2], 2); if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); else glVertex3fv(ltri[2]->v->co); } else { - emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[0], ltri[0]->v, 0); + emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]); @@ -1224,7 +1237,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, glVertex3fv(ltri[0]->v->co); } - emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[1], ltri[1]->v, 1); + emdm_pass_attrib_vertex_mat(&attribs, ltri[1], 1); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]); @@ -1234,7 +1247,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, glVertex3fv(ltri[1]->v->co); } - emdm_draw_attrib_vertex_mat(&attribs, bm, ltri[2], ltri[2]->v, 2); + emdm_pass_attrib_vertex_mat(&attribs, ltri[2], 2); if (vertexCos) { glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]); -- cgit v1.2.3 From dddee08f27dd98c8638e911779d48bc14568bada Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 07:15:37 +0000 Subject: code cleanup: bge material conversion was creating STR_String just to check for empty string for no reason (empty string was assigned irrespective). --- .../Converter/BL_BlenderDataConversion.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index a4c7e8b0fa7..07f37d5a6e2 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -618,14 +618,9 @@ static bool ConvertMaterial( else { mttmp = getImageFromMaterial( mat, i ); - if (mttmp && mttmp->texco &TEXCO_UV) - { - STR_String uvName = mttmp->uvname; - - if (!uvName.IsEmpty()) - material->mapping[i].uvCoName = mttmp->uvname; - else - material->mapping[i].uvCoName = ""; + if (mttmp && (mttmp->texco & TEXCO_UV)) { + /* string may be "" but thats detected as empty after */ + material->mapping[i].uvCoName = mttmp->uvname; } material->mapping[i].mapping |= USEUV; } @@ -706,14 +701,9 @@ static bool ConvertMaterial( material->mapping[i].mapping |= USEREFL; else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) material->mapping[i].mapping |= USEORCO; - else if (mttmp->texco &TEXCO_UV) - { - STR_String uvName = mttmp->uvname; - - if (!uvName.IsEmpty()) - material->mapping[i].uvCoName = mttmp->uvname; - else - material->mapping[i].uvCoName = ""; + else if (mttmp->texco & TEXCO_UV) { + /* string may be "" but thats detected as empty after */ + material->mapping[i].uvCoName = mttmp->uvname; material->mapping[i].mapping |= USEUV; } else if (mttmp->texco &TEXCO_NORM) -- cgit v1.2.3 From 166de48ca4c7a035723be50c10568ff0e2e7ed84 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 07:36:40 +0000 Subject: code cleanup: confusingly written and named function for BGE materuial conversion: getImageFromMaterial() --> getMTexFromMaterial() --- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 14 +++++++------- source/gameengine/Ketsji/BL_Material.cpp | 14 +++++++------- source/gameengine/Ketsji/BL_Material.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 07f37d5a6e2..f861b105ba3 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -613,11 +613,11 @@ static bool ConvertMaterial( material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ALPHA )?USEALPHA:0; material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ADD )?CALCALPHA:0; - if (material->img[i]->flag & IMA_REFLECT) + if (material->img[i]->flag & IMA_REFLECT) { material->mapping[i].mapping |= USEREFL; - else - { - mttmp = getImageFromMaterial( mat, i ); + } + else { + mttmp = getMTexFromMaterial(mat, i); if (mttmp && (mttmp->texco & TEXCO_UV)) { /* string may be "" but thats detected as empty after */ material->mapping[i].uvCoName = mttmp->uvname; @@ -634,9 +634,9 @@ static bool ConvertMaterial( continue; } - mttmp = getImageFromMaterial( mat, i ); - if ( mttmp ) { - if ( mttmp->tex ) { + mttmp = getMTexFromMaterial(mat, i); + if (mttmp) { + if (mttmp->tex) { if ( mttmp->tex->type == TEX_IMAGE ) { material->mtexname[i] = mttmp->tex->id.name; material->img[i] = mttmp->tex->ima; diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp index 461a8c51a52..393d00223e0 100644 --- a/source/gameengine/Ketsji/BL_Material.cpp +++ b/source/gameengine/Ketsji/BL_Material.cpp @@ -10,14 +10,14 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" -MTex* getImageFromMaterial(Material *mat, int index) +MTex* getMTexFromMaterial(Material *mat, int index) { - if (!mat) return 0; - - if (!(index >=0 && index < MAX_MTEX) ) return 0; - - MTex *m = mat->mtex[index]; - return m?m:0; + if (mat && (index >= 0) && (index < MAX_MTEX)) { + return mat->mtex[index]; + } + else { + return NULL; + } } BL_Material::BL_Material() diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index 0383c0891b6..be66e2ec84d 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -174,7 +174,7 @@ enum BL_MappingProj // ------------------------------------ //extern void initBL_Material(BL_Material* mat); -extern MTex* getImageFromMaterial(Material *mat, int index); +extern MTex* getMTexFromMaterial(Material *mat, int index); // ------------------------------------ #endif -- cgit v1.2.3 From 7d81fd82310f90124b50986459d77f3599f25476 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 23 Feb 2013 11:51:10 +0000 Subject: Bugfix #34374 Fixed tooltip for checker-select, it works on the active item, not selected ones. --- source/blender/editors/mesh/editmesh_select.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index e85649831f2..85aeb713f05 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2654,7 +2654,7 @@ void MESH_OT_select_nth(wmOperatorType *ot) /* identifiers */ ot->name = "Checker Deselect"; ot->idname = "MESH_OT_select_nth"; - ot->description = "Deselect every Nth element starting from a selected vertex, edge or face"; + ot->description = "Deselect every Nth element starting from the active vertex, edge or face"; /* api callbacks */ ot->exec = edbm_select_nth_exec; -- cgit v1.2.3 From 6a55cd889c4b439d8e0b4d6777babd5f7d46ed5a Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sat, 23 Feb 2013 12:55:19 +0000 Subject: Missed instance of ThemeGeneric.back -> ThemeGradient.gradients.high_gradient --- release/scripts/templates_py/operator_modal_timer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/templates_py/operator_modal_timer.py b/release/scripts/templates_py/operator_modal_timer.py index 72c153df9d2..3088d59fbcf 100644 --- a/release/scripts/templates_py/operator_modal_timer.py +++ b/release/scripts/templates_py/operator_modal_timer.py @@ -14,7 +14,7 @@ class ModalTimerOperator(bpy.types.Operator): if event.type == 'TIMER': # change theme color, silly! - color = context.user_preferences.themes[0].view_3d.space.back + color = context.user_preferences.themes[0].view_3d.space.gradients.high_gradient color.s = 1.0 color.h += 0.01 -- cgit v1.2.3 From 89e0de3c355e3d44640d3180599611cbb88a8835 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 23 Feb 2013 14:31:46 +0000 Subject: Bug fix #34347 If you move (with F5) the properties and tools region in 3d viewport to the same side, the mini-axis and text overlays were drawing in wrong place. --- source/blender/editors/screen/area.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 023a1bbbb1c..46f726e45c6 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1965,11 +1965,13 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect) for (; arn; arn = arn->next) { if (ar != arn && arn->overlap) { if (BLI_rcti_isect(rect, &arn->winrct, NULL)) { - /* overlap left */ - if (rect->xmin == arn->winrct.xmin) + + /* overlap left, also check 1 pixel offset (2 regions on one side) */ + if ( ABS(rect->xmin - arn->winrct.xmin) < 2) rect->xmin = arn->winrct.xmax; + /* overlap right */ - if (rect->xmax == arn->winrct.xmax) + if ( ABS(rect->xmax - arn->winrct.xmax) < 2) rect->xmax = arn->winrct.xmin; } } -- cgit v1.2.3 From 5de307122c0a2a80fa3e253fe037497b02c2dd26 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 23 Feb 2013 14:52:40 +0000 Subject: Bug fix in 2.66 release, irc submitted. File with packed images crashes on load. Do-versions now is copying Images, because texture "use alpha" has been removed... However, it then also copied packaged images, which crashes for some reason. For now I skip packed image copy, which keeps blender work. This versioning code needs more checking though. --- source/blender/blenloader/intern/readfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4bae406fd09..1aedfb329e4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8714,7 +8714,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima)) break; - if (otex) { + /* no duplication for packed files */ + if (otex && image->packedfile == NULL) { /* copy image datablock */ nimage = BKE_image_copy(main, image); nimage->flag |= IMA_IGNORE_ALPHA|IMA_DONE_TAG; -- cgit v1.2.3 From 3862e757d05a74af1584396d118d33451fcbe5a8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 23 Feb 2013 20:23:59 +0000 Subject: Fix #34358: shrinkwrap modifier project along normal did not work correctly after other modifiers. It needs normals and those were not calculated. --- source/blender/modifiers/intern/MOD_shrinkwrap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index d3a03614d7c..7a55f9a5b48 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -161,6 +161,15 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Shrinkwrap Modifier"); } +static int dependsOnNormals(ModifierData *md) +{ + ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md; + + if (smd->target && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) + return (smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL); + + return false; +} ModifierTypeInfo modifierType_Shrinkwrap = { /* name */ "Shrinkwrap", @@ -185,7 +194,7 @@ ModifierTypeInfo modifierType_Shrinkwrap = { /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, -- cgit v1.2.3 From e8f6caa384e3d60d6a860c99fb35a0a083e1ef29 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 23 Feb 2013 20:24:02 +0000 Subject: Fix for image alpha version patch with library linked files where the image datablock is in a different library than the texture datablock. Adjusted the fix in 54790 to check for this case specifically so it keeps working on other files that have packed images. The problem is that blo_do_versions_newlibadr will not return a valid datablock in some cases with linked libraries. This function is used in various places in the version patching code and would likely cause problems there as well, needs to be investigated further. --- source/blender/blenloader/intern/readfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1aedfb329e4..426d15c82e3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8714,8 +8714,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima)) break; - /* no duplication for packed files */ - if (otex && image->packedfile == NULL) { + /* no duplication if the texture and image datablock are not + * from the same .blend file, the image datablock may not have + * been loaded from a library file otherwise */ + if (otex && (tex->id.lib == image->id.lib)) { /* copy image datablock */ nimage = BKE_image_copy(main, image); nimage->flag |= IMA_IGNORE_ALPHA|IMA_DONE_TAG; -- cgit v1.2.3 From 92189ab35331a238aee946b2cd2e542de26f0474 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 23 Feb 2013 20:42:15 +0000 Subject: Rename CMake's Boost_USE_ICU to WITH_BOOST_ICU (update your CMake conf if you make static builds!), and add it as CMake option. Patch by gdh (Gavin Howard), many thanks! --- CMakeLists.txt | 6 +++++- build_files/build_environment/install_deps.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b225af07e5..b174fa2ac34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,6 +243,10 @@ option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the rayt if(UNIX AND NOT APPLE) option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON) option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF) + if(WITH_STATIC_LIBS) + option(WITH_BOOST_ICU "Boost uses ICU library (required for linking with static Boost built with libicu)." OFF) + mark_as_advanced(WITH_BOOST_ICU) + endif() endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON) @@ -683,7 +687,7 @@ if(UNIX AND NOT APPLE) list(APPEND __boost_packages locale) endif() find_package(Boost 1.48 COMPONENTS ${__boost_packages}) - if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU) + if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU) find_package(IcuLinux) endif() mark_as_advanced(Boost_DIR) # why doesnt boost do this? diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 5815158f4f5..5175eb9a4f6 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -1970,7 +1970,7 @@ print_info() { INFO " $_2" _buildargs="$_buildargs $_1 $_2" elif $ALL_STATIC; then - _1="-D Boost_USE_ICU=ON" + _1="-D WITH_BOOST_ICU=ON" INFO " $_1" _buildargs="$_buildargs $_1" fi -- cgit v1.2.3 From 233b69f0bd0251d8b3a78398d67844b45fcf77b2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 22:48:16 +0000 Subject: GHOST/X11 support for frequency, from SDL's mode switching. also free the modes when done. --- intern/ghost/intern/GHOST_DisplayManagerX11.cpp | 105 +++++++++++++++--------- 1 file changed, 65 insertions(+), 40 deletions(-) diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp index 754218191a5..8d5ac9d77eb 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp @@ -40,7 +40,6 @@ #include "GHOST_SystemX11.h" - GHOST_DisplayManagerX11:: GHOST_DisplayManagerX11( GHOST_SystemX11 *system @@ -95,6 +94,17 @@ getNumDisplaySettings( return GHOST_kSuccess; } +/* from SDL2 */ +#ifdef WITH_X11_XF86VMODE +static int +calculate_rate(XF86VidModeModeInfo *info) +{ + return (info->htotal + && info->vtotal) ? (1000 * info->dotclock / (info->htotal * + info->vtotal)) : 0; +} +#endif + GHOST_TSuccess GHOST_DisplayManagerX11:: getDisplaySetting( @@ -128,6 +138,7 @@ getDisplaySetting( setting.xPixels = vidmodes[index]->hdisplay; setting.yPixels = vidmodes[index]->vdisplay; setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy)); + setting.frequency = (float)calculate_rate(vidmodes[index]); #else GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); @@ -142,11 +153,9 @@ getDisplaySetting( setting.xPixels = DisplayWidth(x_display, DefaultScreen(x_display)); setting.yPixels = DisplayHeight(x_display, DefaultScreen(x_display)); setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display)); + setting.frequency = 60.0f; #endif - /* Don't think it's possible to get this value from X! - * So let's guess!! */ - setting.frequency = 60; return GHOST_kSuccess; } @@ -179,7 +188,6 @@ setCurrentDisplaySetting( XF86VidModeModeInfo **vidmodes; Display *dpy = m_system->getXDisplay(); int scrnum, num_vidmodes; - int best_fit, best_dist, dist, x, y; if (dpy == NULL) return GHOST_kFailure; @@ -197,41 +205,62 @@ setCurrentDisplaySetting( majorVersion, minorVersion); # endif - /* The X11 man page says vidmodes needs to be freed, but doing so causes a - * segfault. - z0r */ - XF86VidModeGetAllModeLines(dpy, scrnum, &num_vidmodes, &vidmodes); - - best_dist = 9999999; - best_fit = -1; - - for (int i = 0; i < num_vidmodes; i++) { - if (setting.xPixels > vidmodes[i]->hdisplay || - setting.yPixels > vidmodes[i]->vdisplay) - continue; - - x = setting.xPixels - vidmodes[i]->hdisplay; - y = setting.yPixels - vidmodes[i]->vdisplay; - dist = (x * x) + (y * y); - if (dist < best_dist) { - best_dist = dist; - best_fit = i; + if (XF86VidModeGetAllModeLines(dpy, scrnum, &num_vidmodes, &vidmodes)) { + int best_fit = -1; + + for (int i = 0; i < num_vidmodes; i++) { + if (vidmodes[i]->hdisplay < setting.xPixels || + vidmodes[i]->vdisplay < setting.yPixels) + { + continue; + } + + if (best_fit == -1 || + (vidmodes[i]->hdisplay < vidmodes[best_fit]->hdisplay) || + (vidmodes[i]->hdisplay == vidmodes[best_fit]->hdisplay && + vidmodes[i]->vdisplay < vidmodes[best_fit]->vdisplay)) + { + best_fit = i; + continue; + } + + if ((vidmodes[i]->hdisplay == vidmodes[best_fit]->hdisplay) && + (vidmodes[i]->vdisplay == vidmodes[best_fit]->vdisplay)) + { + if (!setting.frequency) { + /* Higher is better, right? */ + if (calculate_rate(vidmodes[i]) > + calculate_rate(vidmodes[best_fit])) + { + best_fit = i; + } + } + else { + if (abs(calculate_rate(vidmodes[i]) - (int)setting.frequency) < + abs(calculate_rate(vidmodes[best_fit]) - (int)setting.frequency)) + { + best_fit = i; + } + } + } } - } - if (best_fit != -1) { -# ifdef _DEBUG - int actualWidth, actualHeight; - actualWidth = vidmodes[best_fit]->hdisplay; - actualHeight = vidmodes[best_fit]->vdisplay; - printf("Switching to video mode %dx%d\n", - actualWidth, actualHeight); -# endif + if (best_fit != -1) { + # ifdef _DEBUG + printf("Switching to video mode %dx%d %dx%d %d\n", + vidmodes[best_fit]->hdisplay, vidmodes[best_fit]->vdisplay, + vidmodes[best_fit]->htotal, vidmodes[best_fit]->vtotal, + calculate_rate(vidmodes[best_fit])); + # endif - /* change to the mode */ - XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]); + /* change to the mode */ + XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]); + + /* Move the viewport to top left */ + XF86VidModeSetViewPort(dpy, scrnum, 0, 0); + } - /* Move the viewport to top left */ - XF86VidModeSetViewPort(dpy, scrnum, 0, 0); + XFree(vidmodes); } else { return GHOST_kFailure; @@ -245,7 +274,3 @@ setCurrentDisplaySetting( return GHOST_kSuccess; #endif } - - - - -- cgit v1.2.3 From 47bd908e014412b4339ca4bca0a3556d9bd7fcd2 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sat, 23 Feb 2013 23:04:03 +0000 Subject: rigidbody: Code cleanup Clean up DNA comments. --- source/blender/makesdna/DNA_rigidbody_types.h | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h index 1636f2f4e4b..01a680e558a 100644 --- a/source/blender/makesdna/DNA_rigidbody_types.h +++ b/source/blender/makesdna/DNA_rigidbody_types.h @@ -196,24 +196,27 @@ typedef struct RigidBodyCon { float pad; /* limits */ - float limit_lin_x_lower; /* lower limit for x axis translation */ - float limit_lin_x_upper; /* upper limit for x axis translation */ - float limit_lin_y_lower; /* lower limit for y axis translation */ - float limit_lin_y_upper; /* upper limit for y axis translation */ - float limit_lin_z_lower; /* lower limit for z axis translation */ - float limit_lin_z_upper; /* upper limit for z axis translation */ - float limit_ang_x_lower; /* lower limit for x axis rotation */ - float limit_ang_x_upper; /* upper limit for x axis rotation */ - float limit_ang_y_lower; /* lower limit for y axis rotation */ - float limit_ang_y_upper; /* upper limit for y axis rotation */ - float limit_ang_z_lower; /* lower limit for z axis rotation */ - float limit_ang_z_upper; /* upper limit for z axis rotation */ + /* translation limits */ + float limit_lin_x_lower; + float limit_lin_x_upper; + float limit_lin_y_lower; + float limit_lin_y_upper; + float limit_lin_z_lower; + float limit_lin_z_upper; + /* rotation limits */ + float limit_ang_x_lower; + float limit_ang_x_upper; + float limit_ang_y_lower; + float limit_ang_y_upper; + float limit_ang_z_lower; + float limit_ang_z_upper; /* spring settings */ - /* RB_TODO document spring properties */ + /* resistance to deformation */ float spring_stiffness_x; float spring_stiffness_y; float spring_stiffness_z; + /* amount of velocity lost over time */ float spring_damping_x; float spring_damping_y; float spring_damping_z; -- cgit v1.2.3 From c82213359aa8bc2a762dc0a76c813d46c159a291 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sat, 23 Feb 2013 23:04:07 +0000 Subject: rigidbody: Add motor constraint It's implemented as a separate constraint instead of adding properties to the existing constraints. Motors only apply linear and angular impulses and don't limit the movement of rigid bodies, so it's best to use them in conjunction with other constraints to limit the degrees of freedom. Thanks to Markus Kasten (markus111) for the initial patch. --- intern/rigidbody/RBI_api.h | 6 + intern/rigidbody/rb_bullet_api.cpp | 45 ++++++++ .../properties_physics_rigidbody_constraint.py | 35 +++++- source/blender/blenkernel/intern/rigidbody.c | 12 ++ source/blender/makesdna/DNA_rigidbody_types.h | 15 ++- source/blender/makesrna/intern/rna_rigidbody.c | 128 +++++++++++++++++++++ 6 files changed, 234 insertions(+), 7 deletions(-) diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h index 9dde2cc3049..e7c88d96873 100644 --- a/intern/rigidbody/RBI_api.h +++ b/intern/rigidbody/RBI_api.h @@ -257,6 +257,7 @@ extern rbConstraint *RB_constraint_new_slider(float pivot[3], float orn[4], rbRi extern rbConstraint *RB_constraint_new_piston(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2); extern rbConstraint *RB_constraint_new_6dof(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2); extern rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2); +extern rbConstraint *RB_constraint_new_motor(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2); /* ............ */ @@ -292,6 +293,11 @@ extern void RB_constraint_set_damping_6dof_spring(rbConstraint *con, int axis, f extern void RB_constraint_set_spring_6dof_spring(rbConstraint *con, int axis, int enable); extern void RB_constraint_set_equilibrium_6dof_spring(rbConstraint *con); +/* motors */ +extern void RB_constraint_set_enable_motor(rbConstraint *con, int enable_lin, int enable_ang); +extern void RB_constraint_set_max_impulse_motor(rbConstraint *con, float max_impulse_lin, float max_impulse_ang); +extern void RB_constraint_set_target_velocity_motor(rbConstraint *con, float velocity_lin, float velocity_ang); + /* Set number of constraint solver iterations made per step, this overrided world setting * To use default set it to -1 */ extern void RB_constraint_set_solver_iterations(rbConstraint *con, int num_solver_iterations); diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp index 58345d4e08c..a628c35218c 100644 --- a/intern/rigidbody/rb_bullet_api.cpp +++ b/intern/rigidbody/rb_bullet_api.cpp @@ -850,6 +850,27 @@ rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigi return (rbConstraint *)con; } +rbConstraint *RB_constraint_new_motor(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) +{ + btRigidBody *body1 = rb1->body; + btRigidBody *body2 = rb2->body; + btTransform transform1; + btTransform transform2; + + make_constraint_transforms(transform1, transform2, body1, body2, pivot, orn); + + btGeneric6DofConstraint *con = new btGeneric6DofConstraint(*body1, *body2, transform1, transform2, true); + + /* unlock constraint axes */ + for (int i = 0; i < 6; i++) { + con->setLimit(i, 0.0f, -1.0f); + } + /* unlock motor axes */ + con->getTranslationalLimitMotor()->m_upperLimit.setValue(-1.0f, -1.0f, -1.0f); + + return (rbConstraint*)con; +} + /* Cleanup ----------------------------- */ void RB_constraint_delete(rbConstraint *con) @@ -947,4 +968,28 @@ void RB_constraint_set_breaking_threshold(rbConstraint *con, float threshold) constraint->setBreakingImpulseThreshold(threshold); } +void RB_constraint_set_enable_motor(rbConstraint *con, int enable_lin, int enable_ang) +{ + btGeneric6DofConstraint *constraint = reinterpret_cast(con); + + constraint->getTranslationalLimitMotor()->m_enableMotor[0] = enable_lin; + constraint->getRotationalLimitMotor(0)->m_enableMotor = enable_ang; +} + +void RB_constraint_set_max_impulse_motor(rbConstraint *con, float max_impulse_lin, float max_impulse_ang) +{ + btGeneric6DofConstraint *constraint = reinterpret_cast(con); + + constraint->getTranslationalLimitMotor()->m_maxMotorForce.setX(max_impulse_lin); + constraint->getRotationalLimitMotor(0)->m_maxMotorForce = max_impulse_ang; +} + +void RB_constraint_set_target_velocity_motor(rbConstraint *con, float velocity_lin, float velocity_ang) +{ + btGeneric6DofConstraint *constraint = reinterpret_cast(con); + + constraint->getTranslationalLimitMotor()->m_targetVelocity.setX(velocity_lin); + constraint->getRotationalLimitMotor(0)->m_targetVelocity = velocity_ang; +} + /* ********************************** */ diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py index e4e5b94407d..a49c6d623ca 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py @@ -51,11 +51,12 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa layout.prop(rbc, "object1") layout.prop(rbc, "object2") - row = layout.row() - row.prop(rbc, "use_breaking") - sub = row.row() - sub.active = rbc.use_breaking - sub.prop(rbc, "breaking_threshold", text="Threshold") + if rbc.type != 'MOTOR': + row = layout.row() + row.prop(rbc, "use_breaking") + sub = row.row() + sub.active = rbc.use_breaking + sub.prop(rbc, "breaking_threshold", text="Threshold") row = layout.row() row.prop(rbc, "override_solver_iterations", text="Override Iterations") @@ -113,6 +114,30 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa sub.prop(rbc, "limit_ang_x_lower", text="Lower") sub.prop(rbc, "limit_ang_x_upper", text="Upper") + elif rbc.type == 'MOTOR': + col = layout.column(align=True) + col.label("Linear motor:") + + row = col.row() + sub = row.row() + sub.scale_x = 0.5 + sub.prop(rbc, "use_motor_lin", toggle=True, text="Enable") + sub = row.row() + sub.active = rbc.use_motor_lin + sub.prop(rbc, "motor_lin_target_velocity", text="Target Velocity") + sub.prop(rbc, "motor_lin_max_impulse", text="Max Impulse") + + col.label("Angular motor:") + + row = col.row() + sub = row.row() + sub.scale_x = 0.5 + sub.prop(rbc, "use_motor_ang", toggle=True, text="Enable") + sub = row.row() + sub.active = rbc.use_motor_ang + sub.prop(rbc, "motor_ang_target_velocity", text="Target Velocity") + sub.prop(rbc, "motor_ang_max_impulse", text="Max Impulse") + elif rbc.type in {'GENERIC', 'GENERIC_SPRING'}: col = layout.column(align=True) col.label("Limits:") diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index c2fd6a9f54a..4c6bae122cd 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -633,6 +633,13 @@ void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, shor else RB_constraint_set_limits_6dof(rbc->physics_constraint, RB_LIMIT_ANG_Z, 0.0f, -1.0f); break; + case RBC_TYPE_MOTOR: + rbc->physics_constraint = RB_constraint_new_motor(loc, rot, rb1, rb2); + + RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG); + RB_constraint_set_max_impulse_motor(rbc->physics_constraint, rbc->motor_lin_max_impulse, rbc->motor_ang_max_impulse); + RB_constraint_set_target_velocity_motor(rbc->physics_constraint, rbc->motor_lin_target_velocity, rbc->motor_ang_target_velocity); + break; } } else { /* can't create constraint without both rigid bodies */ @@ -816,6 +823,11 @@ RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, short ty rbc->spring_stiffness_y = 10.0f; rbc->spring_stiffness_z = 10.0f; + rbc->motor_lin_max_impulse = 1.0f; + rbc->motor_lin_target_velocity = 1.0f; + rbc->motor_ang_max_impulse = 1.0f; + rbc->motor_ang_target_velocity = 1.0f; + /* flag cache as outdated */ BKE_rigidbody_cache_reset(rbw); diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h index 01a680e558a..c144bc4e588 100644 --- a/source/blender/makesdna/DNA_rigidbody_types.h +++ b/source/blender/makesdna/DNA_rigidbody_types.h @@ -221,6 +221,12 @@ typedef struct RigidBodyCon { float spring_damping_y; float spring_damping_z; + /* motor settings */ + float motor_lin_target_velocity; /* linear velocity the motor tries to hold */ + float motor_ang_target_velocity; /* angular velocity the motor tries to hold */ + float motor_lin_max_impulse; /* maximum force used to reach linear target velocity */ + float motor_ang_max_impulse; /* maximum force used to reach angular target velocity */ + /* References to Physics Sim object. Exist at runtime only */ void *physics_constraint; /* Physics object representation (i.e. btTypedConstraint) */ } RigidBodyCon; @@ -249,7 +255,9 @@ typedef enum eRigidBodyCon_Type { /* similar to slider but also allows rotation around slider axis */ RBC_TYPE_PISTON, /* Simplified spring constraint with only once axis that's automatically placed between the connected bodies */ - RBC_TYPE_SPRING + RBC_TYPE_SPRING, + /* dirves bodies by applying linear and angular forces */ + RBC_TYPE_MOTOR } eRigidBodyCon_Type; /* Flags for RigidBodyCon */ @@ -274,7 +282,10 @@ typedef enum eRigidBodyCon_Flag { /* springs */ RBC_FLAG_USE_SPRING_X = (1 << 11), RBC_FLAG_USE_SPRING_Y = (1 << 12), - RBC_FLAG_USE_SPRING_Z = (1 << 13) + RBC_FLAG_USE_SPRING_Z = (1 << 13), + /* motors */ + RBC_FLAG_USE_MOTOR_LIN = (1 << 14), + RBC_FLAG_USE_MOTOR_ANG = (1 << 15) } eRigidBodyCon_Flag; /* ******************************** */ diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 7270ccadb81..f5cf247b5a1 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -72,6 +72,7 @@ EnumPropertyItem rigidbody_con_type_items[] = { {RBC_TYPE_6DOF, "GENERIC", ICON_NONE, "Generic", "Restrict translation and rotation to specified axes"}, {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_NONE, "Generic Spring", "Restrict translation and rotation to specified axes with springs"}, + {RBC_TYPE_MOTOR, "MOTOR", ICON_NONE, "Motor", "Drive rigid body around or along an axis"}, {0, NULL, 0, NULL, NULL}}; @@ -501,6 +502,85 @@ static void rna_RigidBodyCon_spring_damping_z_set(PointerRNA *ptr, float value) #endif } +static void rna_RigidBodyCon_motor_lin_max_impulse_set(PointerRNA *ptr, float value) +{ + RigidBodyCon *rbc = (RigidBodyCon *)ptr->data; + + rbc->motor_lin_max_impulse = value; + +#ifdef WITH_BULLET + if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) { + RB_constraint_set_max_impulse_motor(rbc->physics_constraint, value, rbc->motor_ang_max_impulse); + } +#endif +} + +static void rna_RigidBodyCon_use_motor_lin_set(PointerRNA *ptr, int value) +{ + RigidBodyCon *rbc = (RigidBodyCon *)ptr->data; + + RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN); + +#ifdef WITH_BULLET + if (rbc->physics_constraint) { + RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG); + } +#endif +} + +static void rna_RigidBodyCon_use_motor_ang_set(PointerRNA *ptr, int value) +{ + RigidBodyCon *rbc = (RigidBodyCon *)ptr->data; + + RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG); + +#ifdef WITH_BULLET + if (rbc->physics_constraint) { + RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG); + } +#endif +} + +static void rna_RigidBodyCon_motor_lin_target_velocity_set(PointerRNA *ptr, float value) +{ + RigidBodyCon *rbc = (RigidBodyCon *)ptr->data; + + rbc->motor_lin_target_velocity = value; + +#ifdef WITH_BULLET + if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) { + RB_constraint_set_target_velocity_motor(rbc->physics_constraint, value, rbc->motor_ang_target_velocity); + } +#endif +} + +static void rna_RigidBodyCon_motor_ang_max_impulse_set(PointerRNA *ptr, float value) +{ + RigidBodyCon *rbc = (RigidBodyCon *)ptr->data; + + rbc->motor_ang_max_impulse = value; + +#ifdef WITH_BULLET + if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) { + RB_constraint_set_max_impulse_motor(rbc->physics_constraint, rbc->motor_lin_max_impulse, value); + } +#endif +} + +static void rna_RigidBodyCon_motor_ang_target_velocity_set(PointerRNA *ptr, float value) +{ + RigidBodyCon *rbc = (RigidBodyCon *)ptr->data; + + rbc->motor_ang_target_velocity = value; + +#ifdef WITH_BULLET + if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) { + RB_constraint_set_target_velocity_motor(rbc->physics_constraint, rbc->motor_lin_target_velocity, value); + } +#endif +} + + #else static void rna_def_rigidbody_world(BlenderRNA *brna) @@ -866,6 +946,18 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis"); RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + prop = RNA_def_property(srna, "use_motor_lin", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_LIN); + RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_lin_set"); + RNA_def_property_ui_text(prop, "Linear Motor", "Enables linear motor"); + RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + + prop = RNA_def_property(srna, "use_motor_ang", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_ANG); + RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_ang_set"); + RNA_def_property_ui_text(prop, "Angular Motor", "Enables angular motor"); + RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower"); RNA_def_property_float_default(prop, -1.0f); @@ -994,6 +1086,42 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL); RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis"); RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + + prop = RNA_def_property(srna, "motor_lin_target_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY); + RNA_def_property_float_sdna(prop, NULL, "motor_lin_target_velocity"); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_target_velocity_set", NULL); + RNA_def_property_ui_text(prop, "Target Velocity", "Target linear motor velocity"); + RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + + prop = RNA_def_property(srna, "motor_lin_max_impulse", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "motor_lin_max_impulse"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_max_impulse_set", NULL); + RNA_def_property_ui_text(prop, "Max Impulse", "Maximum linear motor impulse"); + RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + + prop = RNA_def_property(srna, "motor_ang_target_velocity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "motor_ang_target_velocity"); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_target_velocity_set", NULL); + RNA_def_property_ui_text(prop, "Target Velocity", "Target angular motor velocity"); + RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); + + prop = RNA_def_property(srna, "motor_ang_max_impulse", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "motor_ang_max_impulse"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_max_impulse_set", NULL); + RNA_def_property_ui_text(prop, "Max Impulse", "Maximum angular motor impulse"); + RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); } void RNA_def_rigidbody(BlenderRNA *brna) -- cgit v1.2.3 From 92f9db662834a479436793f71a9dac0ee4311c77 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sat, 23 Feb 2013 23:04:10 +0000 Subject: rigidbody: Fix motion paths calculation being incorrect for rigid bodies For the simulation to work properly the limited update the motion paths calculation did wasn't enough so you got different results for for motion paths than for the actual simulation. Now do full frame update if rigid body sim is active. TODO investigate if we can still limit this. --- source/blender/blenkernel/intern/anim.c | 62 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 50fe1f7a433..4eb26e81ae2 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -69,7 +69,6 @@ #include "BKE_depsgraph.h" #include "BKE_anim.h" #include "BKE_report.h" -#include "BKE_rigidbody.h" // XXX bad level call... @@ -327,39 +326,38 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) static void motionpaths_calc_update_scene(Scene *scene) { #if 1 // 'production' optimizations always on - Base *base, *last = NULL; - float ctime = BKE_scene_frame_get(scene); - - /* only stuff that moves or needs display still */ - DAG_scene_update_flags(G.main, scene, scene->lay, TRUE); - - /* find the last object with the tag - * - all those afterwards are assumed to not be relevant for our calculations - */ - /* optimize further by moving out... */ - for (base = scene->base.first; base; base = base->next) { - if (base->object->flag & BA_TEMP_TAG) - last = base; + + /* rigid body simulation needs complete update to work correctly for now */ + /* RB_TODO investigate if we could avoid updating everything */ + if (BKE_scene_check_rigidbody_active(scene)) { + BKE_scene_update_for_newframe(G.main, scene, scene->lay); } - - /* run rigidbody sim - * NOTE: keep in sync with BKE_scene_update_for_newframe() in scene.c - */ - // XXX: this position may still change, objects not being updated correctly before simulation is run - // NOTE: current position is so that rigidbody sim affects other objects - if (BKE_scene_check_rigidbody_active(scene)) - BKE_rigidbody_do_simulation(scene, ctime); - - /* perform updates for tagged objects */ - /* XXX: this will break if rigs depend on scene or other data that - * is animated but not attached to/updatable from objects */ - for (base = scene->base.first; base; base = base->next) { - /* update this object */ - BKE_object_handle_update(scene, base->object); + else { /* otherwise we can optimize by restricting updates */ + Base *base, *last = NULL; + + /* only stuff that moves or needs display still */ + DAG_scene_update_flags(G.main, scene, scene->lay, TRUE); - /* if this is the last one we need to update, let's stop to save some time */ - if (base == last) - break; + /* find the last object with the tag + * - all those afterwards are assumed to not be relevant for our calculations + */ + /* optimize further by moving out... */ + for (base = scene->base.first; base; base = base->next) { + if (base->object->flag & BA_TEMP_TAG) + last = base; + } + + /* perform updates for tagged objects */ + /* XXX: this will break if rigs depend on scene or other data that + * is animated but not attached to/updatable from objects */ + for (base = scene->base.first; base; base = base->next) { + /* update this object */ + BKE_object_handle_update(scene, base->object); + + /* if this is the last one we need to update, let's stop to save some time */ + if (base == last) + break; + } } #else // original, 'always correct' version /* do all updates -- cgit v1.2.3 From c42b51ed9615e4f963153a580246d8df87b0b00d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Feb 2013 23:15:38 +0000 Subject: GHOST/X11 - free memory allocated by XF86VidModeGetAllModeLines(), Comment from Zr says this crashes but looks like this was because there was no check if the function failed to allocate to begin with. --- intern/ghost/intern/GHOST_DisplayManagerX11.cpp | 67 +++++++-------- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 105 ++++++++++------------- 2 files changed, 74 insertions(+), 98 deletions(-) diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp index 8d5ac9d77eb..7830f42cbb7 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp @@ -81,9 +81,9 @@ getNumDisplaySettings( return GHOST_kFailure; } - /* The X11 man page says vidmodes needs to be freed, but doing so causes a - * segfault. - z0r */ - XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes); + if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes)) { + XFree(vidmodes); + } #else /* We only have one X11 setting at the moment. */ @@ -112,50 +112,46 @@ getDisplaySetting( GHOST_TInt32 index, GHOST_DisplaySetting& setting) const { + Display *dpy = m_system->getXDisplay(); + + if (dpy == NULL) + return GHOST_kFailure; #ifdef WITH_X11_XF86VMODE int majorVersion, minorVersion; - XF86VidModeModeInfo **vidmodes; - Display *dpy = m_system->getXDisplay(); - int numSettings; GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); - if (dpy == NULL) - return GHOST_kFailure; - majorVersion = minorVersion = 0; - if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) { - fprintf(stderr, "Error: XF86VidMode extension missing!\n"); - return GHOST_kFailure; - } + if (XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) { + XF86VidModeModeInfo **vidmodes; + int numSettings; - /* The X11 man page says vidmodes needs to be freed, but doing so causes a - * segfault. - z0r */ - XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes); - GHOST_ASSERT(index < numSettings, "Requested setting outside of valid range.\n"); + if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes)) { + GHOST_ASSERT(index < numSettings, "Requested setting outside of valid range.\n"); - setting.xPixels = vidmodes[index]->hdisplay; - setting.yPixels = vidmodes[index]->vdisplay; - setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy)); - setting.frequency = (float)calculate_rate(vidmodes[index]); + setting.xPixels = vidmodes[index]->hdisplay; + setting.yPixels = vidmodes[index]->vdisplay; + setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy)); + setting.frequency = calculate_rate(vidmodes[index]); + XFree(vidmodes); + + return GHOST_kSuccess; + } + } + else { + fprintf(stderr, "Warning: XF86VidMode extension missing!\n"); + /* fallback to non xf86vmode below */ + } +#endif /* WITH_X11_XF86VMODE */ -#else GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n"); - - Display *x_display = m_system->getXDisplay(); - - if (x_display == NULL) { - return GHOST_kFailure; - } - setting.xPixels = DisplayWidth(x_display, DefaultScreen(x_display)); - setting.yPixels = DisplayHeight(x_display, DefaultScreen(x_display)); - setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display)); + setting.xPixels = DisplayWidth(dpy, DefaultScreen(dpy)); + setting.yPixels = DisplayHeight(dpy, DefaultScreen(dpy)); + setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy)); setting.frequency = 60.0f; -#endif - return GHOST_kSuccess; } @@ -180,9 +176,8 @@ setCurrentDisplaySetting( const GHOST_DisplaySetting& setting) { #ifdef WITH_X11_XF86VMODE - /* Mode switching code ported from Quake 2: - * ftp: ftp.idsoftware.com/idstuff/source/q2source-3.21.zip - * See linux/gl_glx.c:GLimp_SetMode + /* Mode switching code ported from SDL: + * See: src/video/x11/SDL_x11modes.c:set_best_resolution */ int majorVersion, minorVersion; XF86VidModeModeInfo **vidmodes; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 77275ce5506..c1f43306eba 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -612,7 +612,7 @@ int main(int argc, char** argv) case 'i': i++; if ( (i + 1) <= validArguments ) - parentWindow = atoi(argv[i++]); + parentWindow = atoi(argv[i++]); else { error = true; printf("error: too few options for parent window argument.\n"); @@ -645,10 +645,10 @@ int main(int argc, char** argv) stereomode = (RAS_IRasterizer::StereoMode) atoi(argv[i]); if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO) stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; - + if (!strcmp(argv[i], "nostereo")) // ok, redundant but clear stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; - + // only the hardware pageflip method needs a stereo window else if (!strcmp(argv[i], "hwpageflip")) { stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED; @@ -656,22 +656,22 @@ int main(int argc, char** argv) } else if (!strcmp(argv[i], "syncdoubling")) stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; - + else if (!strcmp(argv[i], "anaglyph")) stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; - + else if (!strcmp(argv[i], "sidebyside")) stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE; - + else if (!strcmp(argv[i], "vinterlace")) stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE; - + #if 0 - // future stuff - else if (!strcmp(argv[i], "stencil") - stereomode = RAS_STEREO_STENCIL; +// // future stuff +// else if (!strcmp(argv[i], "stencil") +// stereomode = RAS_STEREO_STENCIL; #endif - + i++; stereoParFound = true; stereoFlag = STEREO_ENABLED; @@ -733,7 +733,7 @@ int main(int argc, char** argv) i++; } } - + if ((windowWidth < kMinWindowWidth) || (windowHeight < kMinWindowHeight)) { error = true; @@ -756,8 +756,7 @@ int main(int argc, char** argv) //fullScreen = false; // Can't use full screen #endif - if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) - { + if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) { GPU_set_mipmap(0); } @@ -765,15 +764,14 @@ int main(int argc, char** argv) GPU_set_gpu_mipmapping(U.use_gpu_mipmap); // Create the system - if (GHOST_ISystem::createSystem() == GHOST_kSuccess) - { + if (GHOST_ISystem::createSystem() == GHOST_kSuccess) { GHOST_ISystem* system = GHOST_ISystem::getSystem(); assertd(system); if (!fullScreenWidth || !fullScreenHeight) system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight); // process first batch of events. If the user - // drops a file on top off the blenderplayer icon, we + // drops a file on top off the blenderplayer icon, we // receive an event with the filename system->processEvents(0); @@ -798,8 +796,7 @@ int main(int argc, char** argv) // those may change during the game and persist after using Game Actuator GlobalSettings gs; - do - { + do { // Read the Blender file BlendFileData *bfd; @@ -814,19 +811,17 @@ int main(int argc, char** argv) bfd = load_game_data(basedpath); - if (!bfd) - { + if (!bfd) { // just add "//" in front of it char temppath[242]; strcpy(temppath, "//"); strcat(temppath, basedpath); - + BLI_path_abs(temppath, pathname); bfd = load_game_data(temppath); } } - else - { + else { bfd = load_game_data(BLI_program_path(), filename[0]? filename: NULL); } @@ -836,13 +831,11 @@ int main(int argc, char** argv) usage(argv[0], isBlenderPlayer); error = true; exitcode = KX_EXIT_REQUEST_QUIT_GAME; - } - else - { + } + else { #ifdef WIN32 #if !defined(DEBUG) - if (closeConsole) - { + if (closeConsole) { system->toggleConsole(0); // Close a console window } #endif // !defined(DEBUG) @@ -864,8 +857,7 @@ int main(int argc, char** argv) titlename = maggie->name; // Check whether the game should be displayed full-screen - if ((!fullScreenParFound) && (!windowParFound)) - { + if ((!fullScreenParFound) && (!windowParFound)) { // Only use file settings when command line did not override if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) { //printf("fullscreen option found in Blender file\n"); @@ -885,16 +877,16 @@ int main(int argc, char** argv) // Check whether the game should be displayed in stereo - if (!stereoParFound) - { + if (!stereoParFound) { if (scene->gm.stereoflag == STEREO_ENABLED) { stereomode = (RAS_IRasterizer::StereoMode) scene->gm.stereomode; if (stereomode == RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) stereoWindow = true; } } - else + else { scene->gm.stereoflag = STEREO_ENABLED; + } if (!samplesParFound) aasamples = scene->gm.aasamples; @@ -908,8 +900,7 @@ int main(int argc, char** argv) scene->gm.dome.tilt = domeTilt; if (domeMode > 0) scene->gm.dome.mode = domeMode; - if (domeWarp) - { + if (domeWarp) { //XXX to do: convert relative to absolute path domeText= BKE_text_load(G.main, domeWarp, ""); if (!domeText) @@ -928,23 +919,21 @@ int main(int argc, char** argv) #ifdef WITH_PYTHON setGamePythonPath(G.main->name); #endif - if (firstTimeRunning) - { + if (firstTimeRunning) { firstTimeRunning = false; - if (fullScreen) - { + if (fullScreen) { #ifdef WIN32 if (scr_saver_mode == SCREEN_SAVER_MODE_SAVER) { app.startScreenSaverFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode, aasamples); + stereoWindow, stereomode, aasamples); } else #endif { app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode, aasamples, (scene->gm.playerflag & GAME_PLAYER_DESKTOP_RESOLUTION)); + stereoWindow, stereomode, aasamples, (scene->gm.playerflag & GAME_PLAYER_DESKTOP_RESOLUTION)); } } else @@ -968,8 +957,7 @@ int main(int argc, char** argv) vector parts = path.Explode('\\'); #endif // WIN32 STR_String title; - if (parts.size()) - { + if (parts.size()) { title = parts[parts.size()-1]; parts = title.Explode('.'); if (parts.size() > 1) @@ -977,8 +965,7 @@ int main(int argc, char** argv) title = parts[0]; } } - else - { + else { title = "blenderplayer"; } #ifdef WIN32 @@ -989,16 +976,15 @@ int main(int argc, char** argv) else #endif { - if (parentWindow != 0) + if (parentWindow != 0) app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode, aasamples); else app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight, - stereoWindow, stereomode, aasamples); + stereoWindow, stereomode, aasamples); } } } - else - { + else { app.StartGameEngine(stereomode); exitcode = KX_EXIT_REQUEST_NO_REQUEST; } @@ -1014,11 +1000,9 @@ int main(int argc, char** argv) #ifdef WITH_PYTHON python_main = KX_GetPythonMain(scene); #endif // WITH_PYTHON - if (python_main) - { + if (python_main) { char *python_code = KX_GetPythonCode(maggie, python_main); - if (python_code) - { + if (python_code) { #ifdef WITH_PYTHON gpg_nextframestate.system = system; gpg_nextframestate.app = &app; @@ -1036,16 +1020,14 @@ int main(int argc, char** argv) fprintf(stderr, "ERROR: cannot yield control to Python: no Python text data block named '%s'\n", python_main); } } - else - { - while (run) - { + else { + while (run) { run = GPG_NextFrame(system, &app, exitcode, exitstring, &gs); } } app.StopGameEngine(); - /* 'app' is freed automatic when out of scope. + /* 'app' is freed automatic when out of scope. * removal is needed else the system will free an already freed value */ system->removeEventConsumer(&app); @@ -1060,7 +1042,8 @@ int main(int argc, char** argv) // Dispose the system GHOST_ISystem::disposeSystem(); - } else { + } + else { error = true; printf("error: couldn't create a system.\n"); } @@ -1090,5 +1073,3 @@ int main(int argc, char** argv) return error ? -1 : 0; } - - -- cgit v1.2.3 From 93c3593d825aafe30aaf051182e50bde4c6084dd Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Sat, 23 Feb 2013 23:40:51 +0000 Subject: rigidbody: Don't abort connect operator if last selected object is active Was silly logic error. --- release/scripts/startup/bl_operators/rigidbody.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index bfb23c3249b..2a19e222796 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -227,7 +227,7 @@ class ConnectRigidBodies(Operator): def _add_constraint(self, context, object1, object2): if object1 == object2: - return False + return if self.pivot_type == 'ACTIVE': loc = object1.location @@ -251,8 +251,6 @@ class ConnectRigidBodies(Operator): con.object1 = object1 con.object2 = object2 - return True - def execute(self, context): scene = context.scene objects = context.selected_objects @@ -274,11 +272,13 @@ class ConnectRigidBodies(Operator): objects_tmp.remove(objects_tmp[0]) for i in range(1, len(objs_sorted)): - change = self._add_constraint(context, objs_sorted[i-1], objs_sorted[i]) + self._add_constraint(context, objs_sorted[i-1], objs_sorted[i]) + change = True else: # SELECTED_TO_ACTIVE for obj in objects: - change = self._add_constraint(context, obj_act, obj) + self._add_constraint(context, obj_act, obj) + change = True; if change: # restore selection -- cgit v1.2.3