From aa09c5750e71602ef661ce588d63aae4ca6efcfe Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 11:19:39 +0000 Subject: [PATCH 01/31] add spacebar to confirm knife cut, space confirms - enter isnt so handy, This is consistent with fly mode and grab. --- source/blender/editors/mesh/editmesh_knife.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 11c19af4914..13425ad8b9c 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2918,6 +2918,7 @@ wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, KNF_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM); WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, SPACEKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM); WM_modalkeymap_add_item(keymap, EKEY, KM_PRESS, 0, 0, KNF_MODAL_NEW_CUT); WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_MIDPOINT_ON); From f665c3cb00ed39b4cb1a50dd32f8facaf647039e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 11:36:40 +0000 Subject: [PATCH 02/31] py/rna api: remove selection and pin variable for texture faces - this is now stored in the loops. --- source/blender/makesrna/intern/rna_mesh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d5e79ab971c..0ecfa311913 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1692,6 +1692,8 @@ static void rna_def_mtface(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); + /* these are for editing only, access at loops now */ +#if 0 prop = RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); RNA_def_property_array(prop, 4); @@ -1703,6 +1705,7 @@ static void rna_def_mtface(BlenderRNA *brna) RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "UV Pinned", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); +#endif prop = RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 2); @@ -1801,13 +1804,13 @@ static void rna_def_mtexpoly(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); +#if 0 /* moved to MeshUVLoopLayer */ prop = RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "UV Selected", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); -#if 0 /* moved to MeshUVLoopLayer */ prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "unwrap", TF_PIN1); RNA_def_property_array(prop, 4); From 4c873fec536bcb9c520b77265772281f939e27ba Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 14:52:28 +0000 Subject: [PATCH 03/31] bmesh py api: functions to add/renmove customdata layers, eg. bm.loops.layers.color.new("Testing") --- source/blender/editors/mesh/editmesh_tools.c | 2 +- .../python/bmesh/bmesh_py_types_customdata.c | 86 +++++++++++++++++-- 2 files changed, 80 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 67f387946d5..005947ce49b 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4266,7 +4266,7 @@ void MESH_OT_inset(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundries"); + RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries"); RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness"); RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry"); diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 5d9c07269e8..28252a98cf6 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -216,6 +216,82 @@ static PyGetSetDef bpy_bmlayeritem_getseters[] = { /* BMLayerCollection * ----------------- */ + +PyDoc_STRVAR(bpy_bmlayercollection_new_doc, +".. method:: new(name)\n" +"\n" +" Create a new layer\n" +"\n" +" :arg name: Optional name argument (will be made unique).\n" +" :type name: string\n" +" :return: The newly created layer.\n" +" :rtype: :class:`BMLayerItem`\n" +); +static PyObject *bpy_bmlayercollection_new(BPy_BMLayerCollection *self, PyObject *args) +{ + const char *name = NULL; + int index; + CustomData *data; + + BPY_BM_CHECK_OBJ(self); + + if (!PyArg_ParseTuple(args, "|s:new", &name)) { + return NULL; + } + + data = bpy_bm_customdata_get(self->bm, self->htype); + + if (name) { + BM_data_layer_add_named(self->bm, data, self->type, name); + } + else { + BM_data_layer_add(self->bm, data, self->type); + } + + index = CustomData_number_of_layers(data, self->type) - 1; + BLI_assert(index >= 0); + + return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index); +} + +PyDoc_STRVAR(bpy_bmlayercollection_remove_doc, +".. method:: remove(layer)\n" +"\n" +" Remove a layer\n" +"\n" +" :arg layer: The layer to remove.\n" +" :type layer: :class:`BMLayerItem`\n" +); +static PyObject *bpy_bmlayercollection_remove(BPy_BMLayerCollection *self, BPy_BMLayerItem *value) +{ + CustomData *data; + + BPY_BM_CHECK_OBJ(self); + + if (!BPy_BMLayerItem_Check(value)) { + PyErr_Format(PyExc_TypeError, + "layers.remove(x): expected BMLayerItem, not '%.200s'", + Py_TYPE(value)->tp_name); + return NULL; + } + + BPY_BM_CHECK_OBJ(value); + + if ((self->bm != value->bm) || + (self->type != value->type) || + (self->htype != value->htype)) + { + PyErr_SetString(PyExc_ValueError, + "layers.remove(x): x not in layers"); + } + + data = bpy_bm_customdata_get(self->bm, self->htype); + BM_data_layer_free_n(self->bm, data, self->type, value->index); + + Py_RETURN_NONE; +} + + PyDoc_STRVAR(bpy_bmlayercollection_keys_doc, ".. method:: keys()\n" "\n" @@ -361,17 +437,13 @@ static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject } static struct PyMethodDef bpy_bmelemseq_methods[] = { + {"new", (PyCFunction)bpy_bmlayercollection_new, METH_VARARGS, bpy_bmlayercollection_new_doc}, + {"remove", (PyCFunction)bpy_bmlayercollection_remove, METH_O, bpy_bmlayercollection_remove_doc}, + {"keys", (PyCFunction)bpy_bmlayercollection_keys, METH_NOARGS, bpy_bmlayercollection_keys_doc}, {"values", (PyCFunction)bpy_bmlayercollection_values, METH_NOARGS, bpy_bmlayercollection_values_doc}, {"items", (PyCFunction)bpy_bmlayercollection_items, METH_NOARGS, bpy_bmlayercollection_items_doc}, {"get", (PyCFunction)bpy_bmlayercollection_get, METH_VARARGS, bpy_bmlayercollection_get_doc}, - - /* for later! */ -#if 0 - - {"new", (PyCFunction)bpy_bmlayercollection_new, METH_O, bpy_bmlayercollection_new_doc}, - {"remove", (PyCFunction)bpy_bmlayercollection_new, METH_O, bpy_bmlayercollection_remove_doc}, -#endif {NULL, NULL, 0, NULL} }; From cb91c5d7b264bb96f3772e83cccd58c0fa7319f1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 14:57:47 +0000 Subject: [PATCH 04/31] rip was incorrectly giving an error when ripping a vertex from a face fan (own mistake). --- source/blender/editors/mesh/editmesh_rip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 42857bd7270..84e9b0658ed 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -726,7 +726,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) EDBM_selectmode_flush(em); - if (totedge_orig == bm->totedge) { + if ((singlesel == FALSE) && (totedge_orig == bm->totedge)) { BKE_report(op->reports, RPT_ERROR, "No edges could be ripped"); return OPERATOR_CANCELLED; } From eff325a98c0765ca9045766cbf790ecdffdf0451 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 15:18:12 +0000 Subject: [PATCH 05/31] minor changes to rip internals - check if vertex ripping has no effect. - no need to flush selection for vertex rip. --- source/blender/editors/mesh/editmesh_rip.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 84e9b0658ed..2380efc818b 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -372,6 +372,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) BMLoop *l; BMEdge *e, *e2; BMVert *v, *ripvert = NULL; + const int totvert_orig = bm->totvert; int i; float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]}; float dist = FLT_MAX; @@ -573,6 +574,11 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) } } + if (totvert_orig == bm->totvert) { + BKE_report(op->reports, RPT_ERROR, "No vertices could be ripped"); + return OPERATOR_CANCELLED; + } + return OPERATOR_FINISHED; } @@ -590,6 +596,7 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event) BMLoop *l; BMEdge *e, *e2; BMVert *v; + const int totedge_orig = bm->totedge; int i; float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]}; @@ -671,6 +678,12 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event) ar, projectMat, fmval); MEM_freeN(eloop_pairs); + if (totedge_orig == bm->totedge) { + BKE_report(op->reports, RPT_ERROR, "No edges could be ripped"); + return OPERATOR_CANCELLED; + } + + EDBM_selectmode_flush(em); return OPERATOR_FINISHED; } @@ -684,7 +697,6 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) BMIter iter; BMEdge *e; int singlesel = (bm->totvertsel == 1 && bm->totedgesel == 0 && bm->totfacesel == 0); - const int totedge_orig = bm->totedge; int ret; /* running in face mode hardly makes sense, so convert to region loop and rip */ @@ -724,13 +736,6 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED; } - EDBM_selectmode_flush(em); - - if ((singlesel == FALSE) && (totedge_orig == bm->totedge)) { - BKE_report(op->reports, RPT_ERROR, "No edges could be ripped"); - return OPERATOR_CANCELLED; - } - BLI_assert(singlesel ? (bm->totvertsel > 0) : (bm->totedgesel > 0)); if (bm->totvertsel == 0) { From cccd4b72e5ca172035a87d24ca6809c828a5e49b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 15:26:06 +0000 Subject: [PATCH 06/31] fix memory leak in rip tool (again own fault). --- source/blender/editors/mesh/editmesh_rip.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 2380efc818b..caf44987f54 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -433,9 +433,13 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) int vout_len; BM_vert_select_set(bm, v, FALSE); - bmesh_vert_separate(bm, v, &vout, &vout_len); - if (vout_len < 2) { + if (bmesh_vert_separate(bm, v, &vout, &vout_len) == FALSE) { + BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces"); + return OPERATOR_CANCELLED; + } + else if (vout_len < 2) { + MEM_freeN(vout); /* set selection back to avoid active-unselected vertex */ BM_vert_select_set(bm, v, TRUE); /* should never happen */ From f7a59fd1cf8cc732ad86ab2502dbe152cde1675d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 15:35:07 +0000 Subject: [PATCH 07/31] rip tool again (this in infact an old bug), when selecting an edge to extend the splitting to, dont step over manifold edges. - would result in duplicate edges. --- source/blender/editors/mesh/editmesh_rip.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index caf44987f54..15e77458e5e 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -652,11 +652,15 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event) edbm_rip_edge_side_measure(e2, l_b, ar, projectMat, fmval)) ? l_a : l_b; l = BM_face_other_edge_loop(l->f, e2, v); - l = l->radial_next; - l = BM_face_other_edge_loop(l->f, l->e, v); + /* important edge is manifold else we can be attempting to split off a fan that don't budge, + * not crashing but adds duplicate edge. */ + if (BM_edge_is_manifold(l->e)) { + l = l->radial_next; + l = BM_face_other_edge_loop(l->f, l->e, v); - if (l) { - BM_elem_flag_enable(l->e, BM_ELEM_TAG); + if (l) { + BM_elem_flag_enable(l->e, BM_ELEM_TAG); + } } } else { From 9d40c3046b12096dfcc2c98b9972b6e7fb51eb57 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 23 Apr 2012 15:51:25 +0000 Subject: [PATCH 08/31] Fix #31072: Making texture single user was modifying textures of original material --- source/blender/editors/object/object_relations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index be26007e25a..a666f04034b 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1569,7 +1569,7 @@ static void single_mat_users(Scene *scene, int flag, int do_textures) tex->id.us--; tex= copy_texture(tex); BKE_copy_animdata_id_action(&tex->id); - ma->mtex[b]->tex= tex; + man->mtex[b]->tex= tex; } } } From bfcdd452455f5075cd3150623f513bb9f70e4876 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 15:54:43 +0000 Subject: [PATCH 09/31] corrections from an article about using PVS-Studio static checker with blender - http://www.viva64.com/en/b/0145/ --- source/blender/editors/interface/interface_layout.c | 2 +- source/blender/editors/render/render_preview.c | 2 +- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/python/bmesh/bmesh_py_types_customdata.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e772d98f860..67e295503c2 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2414,7 +2414,7 @@ float uiLayoutGetScaleX(uiLayout *layout) float uiLayoutGetScaleY(uiLayout *layout) { - return layout->scale[0]; + return layout->scale[1]; } /********************** Layout *******************/ diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 230917519e3..9899f39de75 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -358,7 +358,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) { /* don't use assign_material, it changed mat->id.us, which shows in the UI */ Material ***matar = give_matarar(base->object); - int actcol = MAX2(base->object->actcol > 0, 1) - 1; + int actcol = MAX2(base->object->actcol - 1, 0); if (matar && actcol < base->object->totcol) (*matar)[actcol] = mat; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 12d31b0a115..bd024ba90be 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -603,7 +603,7 @@ void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *res static int rna_Object_active_material_index_get(PointerRNA *ptr) { Object *ob = (Object*)ptr->id.data; - return MAX2(ob->actcol-1, 0); + return MAX2(ob->actcol - 1, 0); } static void rna_Object_active_material_index_set(PointerRNA *ptr, int value) diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 28252a98cf6..91104fb23f5 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -511,8 +511,8 @@ static PyObject *bpy_bmlayercollection_subscript_slice(BPy_BMLayerCollection *se BPY_BM_CHECK_OBJ(self); - if (start >= start) start = len - 1; - if (stop >= stop) stop = len - 1; + if (start >= len) start = len - 1; + if (stop >= len) stop = len - 1; tuple = PyTuple_New(stop - start); From b8c4c54ff0a0d2315b711612238192ca4c4562f5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 16:29:13 +0000 Subject: [PATCH 10/31] corrected more issues from [#31069] Analyzing the Blender project with PVS-Studio --- .../blender/blenkernel/intern/dynamicpaint.c | 6 ++--- source/blender/blenkernel/intern/ipo.c | 24 +++++++++---------- .../editors/space_view3d/view3d_draw.c | 2 +- .../render/intern/source/convertblender.c | 5 ++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 943c8a20990..9ce4d68eeed 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1577,14 +1577,14 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) { - DynamicPaintSurface *surface = pmd->canvas->surfaces.first; + DynamicPaintSurface *surface; int update_normals = 0; /* loop through surfaces */ - for (; surface; surface=surface->next) { + for (surface = pmd->canvas->surfaces.first; surface; surface=surface->next) { PaintSurfaceData *sData = surface->data; - if (surface && surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && sData) { + if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && sData) { if (!(surface->flags & (MOD_DPAINT_ACTIVE))) continue; /* process vertex surface previews */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index c1b5d07de4a..2fd1d291363 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1105,20 +1105,18 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c /* get the group to use */ agrp= action_groups_find_named(&tmp_act, grpname); + /* no matching group, so add one */ if (agrp == NULL) { - /* no matching group, so add one */ - if (agrp == NULL) { - /* Add a new group, and make it active */ - agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup"); - - agrp->flag = AGRP_SELECTED; - if (muteipo) agrp->flag |= AGRP_MUTED; - - BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); - - BLI_addtail(&tmp_act.groups, agrp); - BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); - } + /* Add a new group, and make it active */ + agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup"); + + agrp->flag = AGRP_SELECTED; + if (muteipo) agrp->flag |= AGRP_MUTED; + + BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); + + BLI_addtail(&tmp_act.groups, agrp); + BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); } /* add F-Curve to group */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 95a9d58c36e..ec383e1dbdb 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -98,7 +98,7 @@ static void star_stuff_init_func(void) { - cpack(-1); + cpack(0xFFFFFF); glPointSize(1.0); glBegin(GL_POINTS); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index ba8fd40db61..66ed0bd85a9 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1782,9 +1782,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem hasize = ma->hasize; + /* XXX 'tpsys' is alwyas NULL, this code won't run! */ /* get orco */ - if (tpsys && part->phystype==PART_PHYS_NO) { - tpa=tpsys->particles+pa->num; + if (tpsys && part->phystype == PART_PHYS_NO) { + tpa = tpsys->particles + pa->num; psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,sd.orco,0); } else From fb6ee37aa2c4419901e5a9b52393a4edfa4735be Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Mon, 23 Apr 2012 17:33:12 +0000 Subject: [PATCH 11/31] corrected more issues from [#31069] Analyzing the Blender project with PVS-Studio. Remark: I think that "!(nbored & CFBnd)" would be correct but it introduced other bugs so, I just quiet compiler warnings leaving the running system untouched. --- intern/elbeem/intern/ntl_geometrymodel.cpp | 2 +- intern/elbeem/intern/solver_relax.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/elbeem/intern/ntl_geometrymodel.cpp b/intern/elbeem/intern/ntl_geometrymodel.cpp index c20bc34c794..13220736b8e 100644 --- a/intern/elbeem/intern/ntl_geometrymodel.cpp +++ b/intern/elbeem/intern/ntl_geometrymodel.cpp @@ -174,7 +174,7 @@ int ntlGeometryObjModel::initModel(int numVertices, float *vertices, int numTria anitimes.clear(); for(int frame=0; frame Date: Mon, 23 Apr 2012 18:15:38 +0000 Subject: [PATCH 12/31] Fix #31065: cycles render crash with large node groups, increased the stack size now, this seems to work well after some testing. Fix: material override not working on objects without a material assigned. --- intern/cycles/blender/blender_mesh.cpp | 3 +++ intern/cycles/kernel/svm/svm_types.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 7c8d36ab574..7caa6b3d511 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -227,6 +227,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated) /* test if we can instance or if the object is modified */ BL::ID b_ob_data = b_ob.data(); BL::ID key = (object_is_modified(b_ob) || holdout)? b_ob: b_ob_data; + BL::Material material_override = render_layer.material_override; /* find shader indices */ vector used_shaders; @@ -246,6 +247,8 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated) if(used_shaders.size() == 0) { if(holdout) used_shaders.push_back(scene->default_holdout); + else if(material_override) + find_shader(material_override, used_shaders, scene->default_surface); else used_shaders.push_back(scene->default_surface); } diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index 13d72307765..68eb39bdd29 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN /* Stack */ /* SVM stack has a fixed size */ -#define SVM_STACK_SIZE 64 +#define SVM_STACK_SIZE 255 /* SVM stack offsets with this value indicate that it's not on the stack */ #define SVM_STACK_INVALID 255 From 8b476d0275be15fbe18c9a0589e81a996e952496 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 23 Apr 2012 20:09:59 +0000 Subject: [PATCH 13/31] First MinGW-w64 support for cmake has been added. To test I recommend this build: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/ray_linn/GCC-4.7.0-with-ada/mingw-w64-gcc-4.7.0-runtime-2.0.1-static-ada-20120330.7z/download Other builds may also work but due to the constantly changing nature of the compiler this cannot be guaranteed. I often had to change compilers while building the libraries and this one is the one that did the job for most of them. This first support is experimental and considered "advanced". To enable pass -DWITH_MINGW64 during cmake configuration. Also make sure to extract the compiler on C:/MinGW and that MinGW/bin is in your path. To build check out lib/mingw64. Initially the support is lacking until I get every library compiled correctly. For now you should disable WITH_CYCLES(sorry, I know some people are dying to do benchmarks, but still a few libs to go), WITH_IMAGE_OPENEXR, WITH_OPENCOLLADA, WITH_LIBMV and WITH_CODEC_FFMPEG(links but hangs on startup). Still the tools are working, the memory limit is increased and due to the experimental nature of the setup, full optimization with SSE2 is available, which makes the build quite fast. Also the compiler and especially, the linker are way faster than regular MinGW. The wiki docs have also updated. Happy testing! --- CMakeLists.txt | 53 +++++++++++++++---- intern/ghost/intern/GHOST_SystemWin32.cpp | 5 +- intern/guardedalloc/MEM_sys_types.h | 2 + source/blender/blenkernel/BKE_armature.h | 2 +- source/blender/blenlib/BLI_winstuff.h | 2 + source/blender/blenlib/intern/fileops.c | 2 +- source/blender/blenloader/BLO_sys_types.h | 2 + source/creator/CMakeLists.txt | 26 +++++---- .../gameengine/Expressions/KX_HashedPtr.cpp | 2 +- source/gameengine/Ketsji/KX_GameObject.cpp | 2 +- .../gameengine/Ketsji/KX_IPO_SGController.cpp | 2 +- 11 files changed, 72 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1595e78ea4c..b5f7d171890 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,6 +233,8 @@ if(UNIX AND NOT APPLE) option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON) endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) +option(WITH_MINGW64 "Use the 64-bit version of MinGW" OFF) +mark_as_advanced(WITH_MINGW64) # Cycles option(WITH_CYCLES "Enable cycles Render Engine" ON) @@ -370,6 +372,10 @@ if(MINGW) "because it is currently unsupported, remove this " "line if youre a developer who wants to add support.") endif() + + if((WITH_MINGW64) AND (WITH_IMAGE_OPENEXR OR WITH_CYCLES OR WITH_OPENCOLLADA OR WITH_LIBMV OR WITH_CODEC_FFMPEG)) + message(FATAL_ERROR "MINGW64 still doesn't support: WITH_CYCLES/WITH_IMAGE_OPENEXR/WITH_OPENCOLLADA/WITH_LIBMV/WITH_CODEC_FFMPEG") + endif() endif() TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG) @@ -737,6 +743,12 @@ elseif(WIN32) if(CMAKE_COMPILER_IS_GNUCC) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32) + + # Setup 64bit and 64bit windows systems + if(WITH_MINGW64) + message("Set 64 bit compiler for MinGW.") + set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64) + endif() else() set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows) @@ -995,12 +1007,19 @@ elseif(WIN32) set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib") elseif(CMAKE_COMPILER_IS_GNUCC) - # keep GCC specific stuff here - set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32) - + # keep GCC specific stuff here set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi") set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing") + if(WITH_MINGW64) + #Yes, the point for MinGW64 is moar optimization by default :) + set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") + set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lsetupapi -lpthread") + + add_definitions(-DFREE_WINDOWS64 -DMS_WIN64) + endif() + add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE) @@ -1017,7 +1036,11 @@ elseif(WIN32) set(PNG_INCLUDE_DIR "${PNG}/include") set(PNG_LIBPATH ${PNG}/lib) # not cmake defined - set(JPEG_LIBRARIES libjpeg) + if(WITH_MINGW64) + set(JPEG_LIBRARIES jpeg) + else() + set(JPEG_LIBRARIES libjpeg) + endif() set(PNG_LIBRARIES png) set(ZLIB ${LIBDIR}/zlib) @@ -1025,11 +1048,14 @@ elseif(WIN32) set(ZLIB_LIBPATH ${ZLIB}/lib) set(ZLIB_LIBRARIES z) - set(PTHREADS ${LIBDIR}/pthreads) - set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include) - set(PTHREADS_LIBPATH ${PTHREADS}/lib) - set(PTHREADS_LIBRARIES pthreadGC2) - + #comes with own pthread library + if(NOT WITH_MINGW64) + set(PTHREADS ${LIBDIR}/pthreads) + set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include) + set(PTHREADS_LIBPATH ${PTHREADS}/lib) + set(PTHREADS_LIBRARIES pthreadGC2) + endif() + set(FREETYPE ${LIBDIR}/freetype) set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2) set(FREETYPE_LIBPATH ${FREETYPE}/lib) @@ -1101,8 +1127,13 @@ elseif(WIN32) if(WITH_BOOST) set(BOOST ${LIBDIR}/boost) set(BOOST_INCLUDE_DIR ${BOOST}/include) - set(BOOST_POSTFIX "mgw46-mt-s-1_47") - set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_47") + if(WITH_MINGW64) + set(BOOST_POSTFIX "mgw47-mt-s-1_49") + set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49") + else() + set(BOOST_POSTFIX "mgw46-mt-s-1_47") + set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_47") + endif() set(BOOST_LIBRARIES optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX} boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX} diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index e6ac48fa6c8..2d8cf13ac4f 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -815,9 +815,10 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw) // send motion. Mark as 'sent' so motion will always get dispatched. eventSent = true; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(FREE_WINDOWS64) // using Microsoft compiler & header files - // they invented the RawInput API, so this version is (probably) correct + // they invented the RawInput API, so this version is (probably) correct. + // MinGW64 also works fine with this BYTE const* data = raw.data.hid.bRawData; // struct RAWHID { // DWORD dwSizeHid; diff --git a/intern/guardedalloc/MEM_sys_types.h b/intern/guardedalloc/MEM_sys_types.h index b7e17154df0..3d43733c569 100644 --- a/intern/guardedalloc/MEM_sys_types.h +++ b/intern/guardedalloc/MEM_sys_types.h @@ -108,8 +108,10 @@ typedef uint64_t u_int64_t; #include #elif defined(FREE_WINDOWS) +#ifndef FREE_WINDOWS64 /* define htoln here, there must be a syntax error in winsock2.h in MinGW */ unsigned long __attribute__((__stdcall__)) htonl(unsigned long); +#endif #include #else diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 1334528c035..dfe3fde17eb 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -89,7 +89,7 @@ int bone_autoside_name (char name[64], int strip_number, short axis, float head, struct Bone *get_named_bone (struct bArmature *arm, const char *name); -float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float rad1, float rad2, float rdist); +float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist); void where_is_armature (struct bArmature *arm); void where_is_armature_bone(struct Bone *bone, struct Bone *prevbone); diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 33ca7d235fa..a0ab88e8baf 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -113,7 +113,9 @@ typedef unsigned int mode_t; /* python uses HAVE_SSIZE_T */ # ifndef HAVE_SSIZE_T # define HAVE_SSIZE_T 1 +# ifndef FREE_WINDOWS64 typedef long ssize_t; +# endif # endif #endif diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 5bbfd596ba7..4b5ea44e97c 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -209,7 +209,7 @@ FILE *BLI_fopen(const char *filename, const char *mode) return ufopen(filename, mode); } -gzFile BLI_gzopen(const char *filename, const char *mode) +void *BLI_gzopen(const char *filename, const char *mode) { gzFile gzfile; diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h index 7dbd4df1056..41e33eb2a05 100644 --- a/source/blender/blenloader/BLO_sys_types.h +++ b/source/blender/blenloader/BLO_sys_types.h @@ -100,8 +100,10 @@ typedef uint64_t u_int64_t; #include #elif defined(FREE_WINDOWS) +#ifndef FREE_WINDOWS64 /* define htoln here, there must be a syntax error in winsock2.h in MinGW */ unsigned long __attribute__((__stdcall__)) htonl(unsigned long); +#endif #include #else diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 83804ab1a7f..3e1b7772d17 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -448,7 +448,7 @@ elseif(WIN32) DESTINATION ${TARGETDIR} ) - if(WITH_INTERNATIONAL) + if(WITH_INTERNATIONAL AND (NOT WITH_MINGW64)) install( FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll DESTINATION ${TARGETDIR} @@ -523,11 +523,14 @@ elseif(WIN32) DESTINATION ${TARGETDIR} ) else() - install( - FILES - ${LIBDIR}/zlib/lib/zlib.dll - DESTINATION ${TARGETDIR} - ) + #not needed since we link statically, maybe also unneeded for MinGW? + if(NOT WITH_MINGW64) + install( + FILES + ${LIBDIR}/zlib/lib/zlib.dll + DESTINATION ${TARGETDIR} + ) + endif() endif() if(MSVC) @@ -536,10 +539,13 @@ elseif(WIN32) DESTINATION ${TARGETDIR} ) else() - install( - FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll - DESTINATION ${TARGETDIR} - ) + #MinGW64 comes with own version. For portable builds it will probaly have to be copied to work + if(NOT WITH_MINGW64) + install( + FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll + DESTINATION ${TARGETDIR} + ) + endif() endif() if(WITH_CODEC_FFMPEG) diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index 988b78b8810..51550d52636 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -34,7 +34,7 @@ unsigned int KX_Hash(void * inDWord) { -#if defined(_WIN64) +#if defined(_WIN64) && !defined(FREE_WINDOWS64) unsigned __int64 key = (unsigned __int64)inDWord; #else unsigned long key = (unsigned long)inDWord; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 74f028849cc..c5145ef2171 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -31,7 +31,7 @@ */ -#if defined(_WIN64) +#if defined(_WIN64) && !defined(FREE_WINDOWS64) typedef unsigned __int64 uint_ptr; #else typedef unsigned long uint_ptr; diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index 728d0fb8561..950e3c88a9e 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -31,7 +31,7 @@ */ -#if defined(_WIN64) +#if defined(_WIN64) && !defined(FREE_WINDOWS64) typedef unsigned __int64 uint_ptr; #else typedef unsigned long uint_ptr; From 7cc4353dffb11aa1b323887e0550eccf1de2ca37 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 23 Apr 2012 21:04:26 +0000 Subject: [PATCH 14/31] Update knife tool header to reflect that spacebar can be used for confirm too. --- source/blender/editors/mesh/editmesh_knife.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 13425ad8b9c..0ace06b1a1a 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -205,10 +205,10 @@ static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2], static void knife_update_header(bContext *C, KnifeTool_OpData *kcd) { - #define HEADER_LENGTH 180 + #define HEADER_LENGTH 190 char header[HEADER_LENGTH]; - BLI_snprintf(header, HEADER_LENGTH, "LMB: define cut lines, Return: confirm, Esc or RMB: cancel, E: new cut, Ctrl: midpoint snap (%s), " + 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", From 68595376795ce7cc9bf01fb5851a2bc76a97a01c Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 23 Apr 2012 22:56:34 +0000 Subject: [PATCH 15/31] Enable support for OpenEXR on cmake for MinGW64 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5f7d171890..72bdb898ced 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -373,7 +373,7 @@ if(MINGW) "line if youre a developer who wants to add support.") endif() - if((WITH_MINGW64) AND (WITH_IMAGE_OPENEXR OR WITH_CYCLES OR WITH_OPENCOLLADA OR WITH_LIBMV OR WITH_CODEC_FFMPEG)) + if((WITH_MINGW64) AND (WITH_CYCLES OR WITH_OPENCOLLADA OR WITH_LIBMV OR WITH_CODEC_FFMPEG)) message(FATAL_ERROR "MINGW64 still doesn't support: WITH_CYCLES/WITH_IMAGE_OPENEXR/WITH_OPENCOLLADA/WITH_LIBMV/WITH_CODEC_FFMPEG") endif() endif() From 03f451f2f18cccd80d0d56391c4836da34641a60 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 23:01:03 +0000 Subject: [PATCH 16/31] fix own error with subdivision (broke icosphere), also noticed icosphere vanished at subd-5 which didnt happen before bmesh. --- source/blender/bmesh/intern/bmesh_mesh_conv.c | 6 ++++-- source/blender/bmesh/operators/bmo_subdivide.c | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index e247a69f1e9..f72efe8ab5f 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -484,12 +484,14 @@ static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey) BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e) { /* this is a cheap way to set the edge draw, its not precise and will - * pick the first 2 faces an edge uses */ + * pick the first 2 faces an edge uses. + * The dot comparison is a little arbitrary, but set so that a 5 subd + * IcoSphere won't vanish but subd 6 will (as with pre-bmesh blender) */ if ( /* (med->flag & ME_EDGEDRAW) && */ /* assume to be true */ (e->l && (e->l != e->l->radial_next)) && - (dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.998f)) + (dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.9995f)) { med->flag &= ~ME_EDGEDRAW; } diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index d5f46ebfc85..7da02a594d5 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -109,7 +109,11 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar copy_v3_v3(co, v->co); copy_v3_v3(prev_co, co); - if (params->use_smooth) { + if (UNLIKELY(params->use_sphere)) { /* subdivide sphere */ + normalize_v3(co); + mul_v3_fl(co, params->smooth); + } + else if (params->use_smooth) { /* we calculate an offset vector vec1[], to be added to *co */ float len, nor[3], nor1[3], nor2[3], smooth = params->smooth; @@ -134,10 +138,6 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar add_v3_v3(co, tvec); } - else if (params->use_sphere) { /* subdivide sphere */ - normalize_v3(co); - mul_v3_fl(co, params->smooth); - } if (params->use_fractal) { float len = len_v3v3(vsta->co, vend->co); From c1c022342cd2fb526f1dfb79ab1d7f5324e90d4e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 23:57:17 +0000 Subject: [PATCH 17/31] fix for invalid use of memset when loading tiff images - memset(..., 1.0); // isnt valid - memset(pointer, sizeof(pointer)) // was using the sizeof the pointer, not the size of the array, since this was to fill in alpha values it was obviously wrong. --- source/blender/blenlib/BLI_math_vector.h | 1 + source/blender/blenlib/intern/math_vector.c | 9 +++++++++ source/blender/imbuf/intern/tiff.c | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 54c06616110..af3df9c9ed2 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -228,6 +228,7 @@ void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_ void sub_vn_vn(float *array_tar, const float *array_src, const int size); void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); void fill_vn_i(int *array_tar, const int size, const int val); +void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val); void fill_vn_fl(float *array_tar, const int size, const float val); #ifdef __cplusplus diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 4b3ba7244d4..f734e01943f 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -561,6 +561,15 @@ void fill_vn_i(int *array_tar, const int size, const int val) } } +void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val) +{ + unsigned short *tar = array_tar + (size - 1); + int i = size; + while (i--) { + *(tar--) = val; + } +} + void fill_vn_fl(float *array_tar, const int size, const float val) { float *tar = array_tar + (size - 1); diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index f81fb740ff0..08b2e608c8e 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -439,7 +439,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) if (bitspersample == 32) { if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ - memset(fbuf, 1.0, sizeof(fbuf)); + fill_vn_fl(fbuf, ibuf->x, 1.0f); else success |= TIFFReadScanline(image, fbuf, row, chan); scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan); @@ -447,7 +447,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) } else if (bitspersample == 16) { if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ - memset(sbuf, 65535, sizeof(sbuf)); + fill_vn_ushort(sbuf, ibuf->x, 65535); else success |= TIFFReadScanline(image, sbuf, row, chan); scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan); From 6f1019e8698ad4f62795dc13439e38f80abd5f96 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 01:04:37 +0000 Subject: [PATCH 18/31] add inset and bridge to mesh specials menu (along side bevel) + typo fix. --- release/scripts/startup/bl_ui/space_view3d.py | 2 ++ source/blender/makesdna/DNA_sequence_types.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6c152c7cd43..31ef6b79be3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1607,7 +1607,9 @@ class VIEW3D_MT_edit_mesh_specials(Menu): layout.operator("mesh.select_all", text="Select Inverse").action = 'INVERT' layout.operator("mesh.flip_normals") layout.operator("mesh.vertices_smooth", text="Smooth") + layout.operator("mesh.inset") layout.operator("mesh.bevel", text="Bevel") + layout.operator("mesh.bridge_edge_loops") layout.operator("mesh.faces_shade_smooth") layout.operator("mesh.faces_shade_flat") layout.operator("mesh.blend_from_shape") diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 3168e5b765a..0a516c90aa1 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -133,7 +133,7 @@ typedef struct Sequence { char name[64]; /* SEQ_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths */ int flag, type; /*flags bitmap (see below) and the type of sequence*/ - int len; /* the length of the contense of this strip - before handles are applied */ + int len; /* the length of the contents of this strip - before handles are applied */ int start, startofs, endofs; int startstill, endstill; int machine, depth; /*machine - the strip channel, depth - the depth in the sequence when dealing with metastrips */ From b374d9b20fc7b5e320da4c00ba7e21976da6b0d3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 01:52:59 +0000 Subject: [PATCH 19/31] fix for CcdPhysicsController::RelativeRotate reading 2 values past the input. note: this function isn't used but may as well fix. --- source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 9a85471fb9a..6c1e2998bdb 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -863,9 +863,9 @@ void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local) return; } - btMatrix3x3 drotmat( rotval[0],rotval[4],rotval[8], - rotval[1],rotval[5],rotval[9], - rotval[2],rotval[6],rotval[10]); + btMatrix3x3 drotmat(rotval[0], rotval[3], rotval[6], + rotval[1], rotval[4], rotval[7], + rotval[2], rotval[5], rotval[8]); btMatrix3x3 currentOrn; From 4ff038c4119327f3b0c472b71356d5e0cf2e0ed6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 02:01:23 +0000 Subject: [PATCH 20/31] screenshot operator now adds file extension in the file selector and has its own save options rather then using the render options (works like image save a copy). --- source/blender/blenkernel/BKE_image.h | 2 + source/blender/blenkernel/intern/image.c | 9 +++ source/blender/editors/screen/screendump.c | 65 +++++++++++++++---- .../blender/editors/space_image/image_ops.c | 14 +--- source/blender/makesdna/DNA_scene_types.h | 2 +- source/blender/windowmanager/WM_api.h | 1 + .../windowmanager/intern/wm_operators.c | 17 +++++ 7 files changed, 83 insertions(+), 27 deletions(-) diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index f5437645551..c2112d1e169 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -68,6 +68,8 @@ char BKE_imtype_valid_depths(const char imtype); char BKE_imtype_from_arg(const char *arg); +void BKE_imformat_defaults(struct ImageFormatData *im_format); + struct anim *openanim(const char *name, int flags, int streamindex); void image_de_interlace(struct Image *ima, int odd); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 27779ef8107..6e0330f5316 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1163,6 +1163,15 @@ int BKE_add_image_extension(char *string, const char imtype) } } +void BKE_imformat_defaults(ImageFormatData *im_format) +{ + memset(im_format, 0, sizeof(*im_format)); + im_format->planes = R_IMF_PLANES_RGB; + im_format->imtype = R_IMF_IMTYPE_PNG; + im_format->quality = 90; + im_format->compress = 90; +} + /* could allow access externally - 512 is for long names, 64 is for id names */ typedef struct StampData { char file[512]; diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index e12e6b0ef82..22a1770412f 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -56,6 +56,8 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "UI_interface.h" + #include "WM_types.h" #include "WM_api.h" @@ -69,6 +71,8 @@ typedef struct ScreenshotData { unsigned int *dumprect; int dumpsx, dumpsy; rcti crop; + + ImageFormatData im_format; } ScreenshotData; /* get shot from frontbuffer */ @@ -113,9 +117,13 @@ static int screenshot_data_create(bContext *C, wmOperator *op) scd->dumpsx= dumpsx; scd->dumpsy= dumpsy; scd->dumprect= dumprect; - if (sa) + if (sa) { scd->crop= sa->totrct; - op->customdata= scd; + } + + BKE_imformat_defaults(&scd->im_format); + + op->customdata = scd; return TRUE; } @@ -164,20 +172,13 @@ static int screenshot_exec(bContext *C, wmOperator *op) if (scd) { if (scd->dumprect) { - Scene *scene= CTX_data_scene(C); ImBuf *ibuf; char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - - BLI_strncpy(G.ima, path, sizeof(G.ima)); BLI_path_abs(path, G.main->name); - /* BKE_add_image_extension() checks for if extension was already set */ - if (scene->r.scemode & R_EXTENSION) - if (strlen(path)r.im_format.imtype); - + /* operator ensures the extension */ ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); ibuf->rect= scd->dumprect; @@ -185,7 +186,11 @@ static int screenshot_exec(bContext *C, wmOperator *op) if (!RNA_boolean_get(op->ptr, "full")) screenshot_crop(ibuf, scd->crop); - BKE_write_ibuf(ibuf, path, &scene->r.im_format); + if (scd->im_format.planes == R_IMF_PLANES_BW) { + /* bw screenshot? - users will notice if it fails! */ + IMB_color_to_bw(ibuf); + } + BKE_write_ibuf(ibuf, path, &scd->im_format); IMB_freeImBuf(ibuf); } @@ -200,8 +205,9 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) if (screenshot_data_create(C, op)) { if (RNA_struct_property_is_set(op->ptr, "filepath")) return screenshot_exec(C, op); - - RNA_string_set(op->ptr, "filepath", G.ima); + + /* extension is added by 'screenshot_check' after */ + RNA_string_set(op->ptr, "filepath", G.relbase_valid ? G.main->name : "//screen"); WM_event_add_fileselect(C, op); @@ -210,21 +216,52 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) return OPERATOR_CANCELLED; } +static int screenshot_check(bContext *UNUSED(C), wmOperator *op) +{ + ScreenshotData *scd = op->customdata; + return WM_operator_filesel_ensure_ext_imtype(op, scd->im_format.imtype); +} + static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op) { screenshot_data_free(op); return OPERATOR_CANCELLED; } +static int screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) +{ + const char *prop_id = RNA_property_identifier(prop); + + return !(strcmp(prop_id, "filepath") == 0); +} + +static void screenshot_draw(bContext *UNUSED(C), wmOperator *op) +{ + uiLayout *layout = op->layout; + ScreenshotData *scd = op->customdata; + PointerRNA ptr; + + /* image template */ + RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &scd->im_format, &ptr); + uiTemplateImageSettings(layout, &ptr); + + /* main draw call */ + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); + uiDefAutoButsRNA(layout, &ptr, screenshot_draw_check_prop, '\0'); +} + + void SCREEN_OT_screenshot(wmOperatorType *ot) { ot->name = "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */ ot->idname = "SCREEN_OT_screenshot"; ot->invoke = screenshot_invoke; + ot->check = screenshot_check; ot->exec = screenshot_exec; - ot->poll = WM_operator_winactive; ot->cancel = screenshot_cancel; + ot->ui = screenshot_draw; + ot->poll = WM_operator_winactive; ot->flag = 0; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 8b1ff4136b9..2c688990a8f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1001,11 +1001,7 @@ typedef struct { static void save_image_options_defaults(SaveImageOptions *simopts) { - memset(&simopts->im_format, 0, sizeof(simopts->im_format)); - simopts->im_format.planes = R_IMF_PLANES_RGB; - simopts->im_format.imtype = R_IMF_IMTYPE_PNG; - simopts->im_format.quality = 90; - simopts->im_format.compress = 90; + BKE_imformat_defaults(&simopts->im_format); simopts->filepath[0] = '\0'; } @@ -1246,13 +1242,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op) static int image_save_as_check(bContext *UNUSED(C), wmOperator *op) { ImageFormatData *imf = op->customdata; - char filepath[FILE_MAX]; - RNA_string_get(op->ptr, "filepath", filepath); - if (BKE_add_image_extension(filepath, imf->imtype)) { - RNA_string_set(op->ptr, "filepath", filepath); - return TRUE; - } - return FALSE; + return WM_operator_filesel_ensure_ext_imtype(op, imf->imtype); } static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index e21ca52ecb3..d2df799bc94 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -249,7 +249,7 @@ typedef struct ImageFormatData { char depth; /* bits per channel, R_IMF_CHAN_DEPTH_8 -> 32, * not a flag, only set 1 at a time */ - char planes ; /* - R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA */ + char planes; /* - R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA */ char flag; /* generic options for all image types, alpha zbuffer */ char quality; /* (0 - 100), eg: jpeg quality */ diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index a794cf10a86..4c81a0a8654 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -166,6 +166,7 @@ int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wm int WM_operator_confirm (struct bContext *C, struct wmOperator *op, struct wmEvent *event); /* invoke callback, file selector "filepath" unset + exec */ int WM_operator_filesel (struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imtype); /* poll callback, context checks */ int WM_operator_winactive (struct bContext *C); /* invoke callback, exec + redo popup */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index c9306f6dcf7..514c159c87b 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -65,6 +65,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" +#include "BKE_image.h" #include "BKE_library.h" #include "BKE_global.h" #include "BKE_main.h" @@ -808,6 +809,22 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) } } +int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imtype) +{ + PropertyRNA *prop; + char filepath[FILE_MAX]; + /* dont NULL check prop, this can only run on ops with a 'filepath' */ + prop = RNA_struct_find_property(op->ptr, "filepath"); + RNA_property_string_get(op->ptr, prop, filepath); + if (BKE_add_image_extension(filepath, imtype)) { + RNA_property_string_set(op->ptr, prop, filepath); + /* note, we could check for and update 'filename' here, + * but so far nothing needs this. */ + return TRUE; + } + return FALSE; +} + /* default properties for fileselect */ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display) { From 077cbaddf00015d44fba7d52f194406d8891724b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 04:44:51 +0000 Subject: [PATCH 21/31] - remove unneeded len_v3v3 in bevel code - remove dead assignments from vgroup-blend --- source/blender/bmesh/tools/BME_bevel.c | 6 ++---- source/blender/editors/object/object_vgroup.c | 7 ++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 925bd48026a..0a38b50afae 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -360,8 +360,7 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, is_edge = BME_bevel_get_vec(vec1, v, v1, td); /* get the vector we will be projecting onto */ BME_bevel_get_vec(vec2, v, v2, td); /* get the vector we will be projecting parallel to */ - len = len_v3(vec1); - normalize_v3(vec1); + len = normalize_v3(vec1); vtd = BME_get_transdata(td, sv); vtd1 = BME_get_transdata(td, v); @@ -399,8 +398,7 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, } madd_v3_v3v3fl(sv->co, v->co, vec1, dis); sub_v3_v3v3(vec1, sv->co, vtd1->org); - dis = len_v3(vec1); - normalize_v3(vec1); + dis = normalize_v3(vec1); BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max); return sv; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index eb380700a61..b5c34f1c750 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1264,7 +1264,6 @@ static void vgroup_blend(Object *ob, const float fac) if (BLI_findlink(&ob->defbase, def_nr)) { const float ifac = 1.0f - fac; - int i1, i2; BMEditMesh *em = BMEdit_FromObject(ob); BMesh *bm = em ? em->bm : NULL; @@ -1301,14 +1300,15 @@ static void vgroup_blend(Object *ob, const float fac) sel2 = BM_elem_flag_test(eed->v2, BM_ELEM_SELECT); if (sel1 != sel2) { + int i1 /* , i2 */; /* i1 is always the selected one */ if (sel1) { i1= BM_elem_index_get(eed->v1); - i2= BM_elem_index_get(eed->v2); + /* i2= BM_elem_index_get(eed->v2); */ /* UNUSED */ eve= eed->v2; } else { - i2= BM_elem_index_get(eed->v1); + /* i2= BM_elem_index_get(eed->v1); */ /* UNUSED */ i1= BM_elem_index_get(eed->v2); eve= eed->v1; } @@ -1342,6 +1342,7 @@ static void vgroup_blend(Object *ob, const float fac) sel2 = me->mvert[ed->v2].flag & SELECT; if (sel1 != sel2) { + int i1, i2; /* i1 is always the selected one */ if (sel1) { i1 = ed->v1; From f02694f5a480c2c0f9cd695075da4eacebd18666 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 05:02:53 +0000 Subject: [PATCH 22/31] workaround for vertex bevel modifier failing since the BMesh update. --- source/blender/bmesh/tools/BME_bevel.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 0a38b50afae..0f3cb7c90f7 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -62,6 +62,9 @@ * so I need to decide what to do in these cases. */ +/* BMESH_TODO - resolve this */ +#define BMESH_263_VERT_BEVEL_WORKAROUND + /* ------- Bevel code starts here -------- */ BME_TransData_Head *BME_init_transdata(int bufsize) @@ -660,10 +663,15 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM /* find a good normal for this face (there's better ways, I'm sure) */ BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { +#ifdef BMESH_263_VERT_BEVEL_WORKAROUND + add_newell_cross_v3_v3v3(up_vec, l->prev->v->co, l->v->co); +#else BME_bevel_get_vec(vec1, l->v, l->next->v, td); BME_bevel_get_vec(vec2, l->prev->v, l->v, td); cross_v3_v3v3(vec3, vec2, vec1); add_v3_v3(up_vec, vec3); + +#endif } normalize_v3(up_vec); From 782cf3f844e99988298a401e9295cdcdb55fc95f Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Tue, 24 Apr 2012 05:28:19 +0000 Subject: [PATCH 23/31] Peer pressure :) Fix some very public (but probably harmless) errors in extern/bullet2, it will propagate to the Bullet soon from here: https://www.assembla.com/code/bullet3/subversion/nodes Thanks to Campbell for letting me know Fixed described by Sean here: http://stackoverflow.com/questions/818535/how-can-i-set-all-bits-to-1-in-a-binary-number-of-an-unknown-size --- .../src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h | 4 +++- .../src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h index aa30d43a025..51b27afe686 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h @@ -78,8 +78,10 @@ ATTRIBUTE_ALIGNED16 (struct) btQuantizedBvhNode int getTriangleIndex() const { btAssert(isLeafNode()); + unsigned int x=0; + unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS); // Get only the lower bits where the triangle index is stored - return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS))); + return (m_escapeIndexOrTriangleIndex&~(y)); } int getPartId() const { diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h b/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h index a6ea33717bc..f311419d4a8 100644 --- a/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h +++ b/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h @@ -45,7 +45,9 @@ struct btTriIndex int getTriangleIndex() const { // Get only the lower bits where the triangle index is stored - return (m_PartIdTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS))); + unsigned int x = 0; + unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS); + return (m_PartIdTriangleIndex&~(y)); } int getPartId() const { From a667492d0e0d27a2b52a95ffc7cf2ce74f5c45ec Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 05:38:11 +0000 Subject: [PATCH 24/31] fix [#30997] Bevel angle option is broken (bevel vertex only) --- source/blender/bmesh/tools/BME_bevel.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 0f3cb7c90f7..6a91d6f9d00 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -785,28 +785,32 @@ static float BME_bevel_get_angle(BMEdge *e, BMVert *v) return dot_v3v3(vec3, vec4); } -static float UNUSED_FUNCTION(BME_bevel_get_angle_vert)(BMVert *v) +static float BME_bevel_get_angle_vert(BMVert *v) { BMIter iter; BMLoop *l; float n[3]; float n_tmp[3]; float angle_diff = 0.0f; + float tot_angle = 0.0f; BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { + const float angle = BM_loop_calc_face_angle(l); + tot_angle += angle; BM_loop_calc_face_normal(l, n_tmp); - madd_v3_v3fl(n, n_tmp, BM_loop_calc_face_angle(l)); + madd_v3_v3fl(n, n_tmp, angle); } normalize_v3(n); BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { /* could cache from before */ BM_loop_calc_face_normal(l, n_tmp); - angle_diff += angle_normalized_v3v3(n, n_tmp) * (BM_loop_calc_face_angle(l) * (float)(M_PI * 0.5)); + angle_diff += angle_normalized_v3v3(n, n_tmp) * BM_loop_calc_face_angle(l); } - return angle_diff; + /* return cosf(angle_diff + 0.001f); */ /* compare with dot product */ + return (angle_diff / tot_angle) * (M_PI / 2); } static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options) @@ -851,8 +855,7 @@ static void bevel_init_verts(BMesh *bm, int options, float angle, BME_TransData_ BMVert *v; BMIter iter; float weight; -// const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; - (void)angle; + /* const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; */ /* UNUSED */ BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { weight = 0.0f; @@ -867,14 +870,12 @@ static void bevel_init_verts(BMesh *bm, int options, float angle, BME_TransData_ else if (options & BME_BEVEL_WEIGHT) { weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT); } -#if 0 // not working well else if (options & BME_BEVEL_ANGLE) { /* dont set weight_v1/weight_v2 here, add direct */ - if (BME_bevel_get_angle_vert(bm, v) < threshold) { + if (BME_bevel_get_angle_vert(v) > angle) { weight = 1.0f; } } -#endif else { weight = 1.0f; } From 9204f11052697dba84a961f9358219a803e46a66 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 09:45:56 +0000 Subject: [PATCH 25/31] fix for possible error building with debian --- source/blender/imbuf/intern/jp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 749d46d3a98..6abfbdb4aa1 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -331,7 +331,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres) static void cinema_parameters(opj_cparameters_t *parameters) { - parameters->tile_size_on = FALSE; + parameters->tile_size_on = 0; /* FALSE */ parameters->cp_tdx=1; parameters->cp_tdy=1; From b84cdafbb5e927407aec138dd96adb8fe556cbb3 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 24 Apr 2012 09:58:03 +0000 Subject: [PATCH 26/31] Add cycles support for MinGW-w64 --- CMakeLists.txt | 4 ++-- source/creator/CMakeLists.txt | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72bdb898ced..e949859772b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -373,8 +373,8 @@ if(MINGW) "line if youre a developer who wants to add support.") endif() - if((WITH_MINGW64) AND (WITH_CYCLES OR WITH_OPENCOLLADA OR WITH_LIBMV OR WITH_CODEC_FFMPEG)) - message(FATAL_ERROR "MINGW64 still doesn't support: WITH_CYCLES/WITH_IMAGE_OPENEXR/WITH_OPENCOLLADA/WITH_LIBMV/WITH_CODEC_FFMPEG") + if((WITH_MINGW64) AND (WITH_OPENCOLLADA OR WITH_LIBMV OR WITH_CODEC_FFMPEG)) + message(FATAL_ERROR "MINGW64 still doesn't support: WITH_OPENCOLLADA/WITH_LIBMV/WITH_CODEC_FFMPEG") endif() endif() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 3e1b7772d17..0168c06b7da 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -599,12 +599,14 @@ elseif(WIN32) ) if(WITH_OPENIMAGEIO) - set_lib_path(OIIOBIN "openimageio/bin") - install( - FILES - ${OIIOBIN}/OpenImageIO.dll - DESTINATION ${TARGETDIR} - ) + if(NOT MINGW) + set_lib_path(OIIOBIN "openimageio/bin") + install( + FILES + ${OIIOBIN}/OpenImageIO.dll + DESTINATION ${TARGETDIR} + ) + endif() endif() elseif(APPLE) From e06e338e205934af91ead0869dbc9ffa29787988 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 10:25:12 +0000 Subject: [PATCH 27/31] fix [#31079] Revision 45893 crashes when I try to open a certain file created in it. nasty bug going from 2.63 --> 2.62 --> 2.63, could have incorrect/corrupt data. fix checks for this case and clears the customdata layer. --- source/blender/blenloader/intern/readfile.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b3d586fd78d..d2f6100517a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3810,6 +3810,14 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count) int i = 0; data->layers= newdataadr(fd, data->layers); + + /* annoying workaround for bug [#31079] loading legacy files with + * no polygons _but_ have stale customdata */ + if (UNLIKELY(count == 0 && data->layers == NULL && data->totlayer != 0)) { + memset(data, 0, sizeof(*data)); + return; + } + data->external= newdataadr(fd, data->external); while (i < data->totlayer) { From bde288d6568fb300892ba15ee3e79bdd35df3b99 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 24 Apr 2012 12:27:38 +0000 Subject: [PATCH 28/31] crash fix for brush select when no object is active --- .../blender/editors/sculpt_paint/paint_ops.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 3bc3c7a9224..b5d6f20aa79 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -254,12 +254,18 @@ static int brush_select_exec(bContext *C, wmOperator *op) size_t tool_offset; if (paint_mode == OB_MODE_ACTIVE) { - /* select current paint mode */ - paint_mode = CTX_data_active_object(C)->mode & - (OB_MODE_SCULPT | - OB_MODE_VERTEX_PAINT | - OB_MODE_WEIGHT_PAINT | - OB_MODE_TEXTURE_PAINT); + Object *ob = CTX_data_active_object(C); + if (ob) { + /* select current paint mode */ + paint_mode = ob->mode & + (OB_MODE_SCULPT | + OB_MODE_VERTEX_PAINT | + OB_MODE_WEIGHT_PAINT | + OB_MODE_TEXTURE_PAINT); + } + else { + return OPERATOR_CANCELLED; + } } switch (paint_mode) { From 4782522379b708f15bd5b045ca4193637c465979 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 24 Apr 2012 12:57:58 +0000 Subject: [PATCH 29/31] Add libMV and Scons support for MinGW-w64, patches by Caleb Joseph with slight modifications. Thanks! --- CMakeLists.txt | 13 +- SConstruct | 30 ++- .../scons/config/win64-mingw-config.py | 207 ++++++++++++++++++ build_files/scons/tools/Blender.py | 14 +- build_files/scons/tools/btools.py | 4 +- extern/bullet2/patches/mingw64_scons.patch | 13 ++ extern/bullet2/src/SConscript | 2 +- extern/carve/SConscript | 2 +- extern/carve/bundle.sh | 2 +- extern/carve/patches/mingw_w64.patch | 13 ++ extern/libmv/SConscript | 2 +- extern/libmv/bundle.sh | 2 +- extern/libmv/libmv/numeric/numeric.h | 2 +- extern/libmv/patches/mingw_w64_support.patch | 58 +++++ .../third_party/glog/src/windows/port.cc | 3 + .../libmv/third_party/glog/src/windows/port.h | 2 + intern/SConscript | 2 +- intern/audaspace/SConscript | 2 +- intern/boolop/SConscript | 4 +- intern/cycles/SConscript | 2 +- intern/ghost/SConscript | 6 +- intern/opennl/SConscript | 2 +- intern/utfconv/SConscript | 2 +- source/SConscript | 2 +- source/blender/blenkernel/SConscript | 2 +- source/blender/blenlib/SConscript | 2 +- source/blender/blenpluginapi/SConscript | 2 +- source/blender/editors/armature/SConscript | 2 +- source/blender/editors/mesh/SConscript | 2 +- source/blender/editors/object/SConscript | 2 +- source/blender/editors/physics/SConscript | 2 +- source/blender/editors/render/SConscript | 2 +- source/blender/editors/screen/SConscript | 2 +- .../blender/editors/sculpt_paint/SConscript | 2 +- source/blender/editors/space_file/SConscript | 4 +- source/blender/editors/space_image/SConscript | 2 +- source/blender/editors/space_node/SConscript | 2 +- .../editors/space_sequencer/SConscript | 2 +- .../blender/editors/space_view3d/SConscript | 2 +- source/blender/gpu/SConscript | 2 +- source/blender/imbuf/SConscript | 2 +- source/blender/makesdna/intern/SConscript | 2 +- source/blender/makesrna/SConscript | 2 +- source/blender/makesrna/intern/SConscript | 4 +- source/blender/nodes/SConscript | 2 +- source/blender/python/SConscript | 4 +- source/blender/render/SConscript | 4 +- source/blender/windowmanager/SConscript | 2 +- source/gameengine/Converter/SConscript | 2 +- source/gameengine/Ketsji/SConscript | 2 +- source/gameengine/VideoTexture/SConscript | 2 +- 51 files changed, 386 insertions(+), 67 deletions(-) create mode 100644 build_files/scons/config/win64-mingw-config.py create mode 100644 extern/bullet2/patches/mingw64_scons.patch create mode 100644 extern/carve/patches/mingw_w64.patch create mode 100644 extern/libmv/patches/mingw_w64_support.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index e949859772b..a2926182c5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,12 +194,7 @@ option(WITH_IMAGE_REDCODE "Enable RedCode Image Support" OFF) option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON) # Audio/Video format support -if(MINGW) - set(PLATFORM_DEFAULT ON) -else() - set(PLATFORM_DEFAULT OFF) -endif() -option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" ${PLATFORM_DEFAULT}) +option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF) unset(PLATFORM_DEFAULT) option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF) @@ -373,8 +368,8 @@ if(MINGW) "line if youre a developer who wants to add support.") endif() - if((WITH_MINGW64) AND (WITH_OPENCOLLADA OR WITH_LIBMV OR WITH_CODEC_FFMPEG)) - message(FATAL_ERROR "MINGW64 still doesn't support: WITH_OPENCOLLADA/WITH_LIBMV/WITH_CODEC_FFMPEG") + if((WITH_MINGW64) AND (WITH_OPENCOLLADA OR WITH_CODEC_FFMPEG)) + message(FATAL_ERROR "MINGW64 still doesn't support: WITH_OPENCOLLADA/WITH_CODEC_FFMPEG") endif() endif() @@ -1015,7 +1010,7 @@ elseif(WIN32) #Yes, the point for MinGW64 is moar optimization by default :) set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -O3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") - set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lsetupapi -lpthread") + set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread") add_definitions(-DFREE_WINDOWS64 -DMS_WIN64) endif() diff --git a/SConstruct b/SConstruct index e73d654a0c8..96d27ae76b0 100644 --- a/SConstruct +++ b/SConstruct @@ -170,7 +170,7 @@ if sys.platform=='win32': if env['CC'] in ['cl', 'cl.exe']: platform = 'win64-vc' if bitness == 64 else 'win32-vc' elif env['CC'] in ['gcc']: - platform = 'win32-mingw' + platform = 'win64-mingw' if bitness == 64 else 'win32-mingw' env.SConscriptChdir(0) @@ -782,6 +782,34 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources) allinstall += windlls +if env['OURPLATFORM'] == 'win64-mingw': + dllsources = [] + + if env['WITH_BF_PYTHON']: + if env['BF_DEBUG']: + dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll') + else: + dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll') + + if env['WITH_BF_FFMPEG']: + dllsources += env['BF_FFMPEG_DLL'].split() + + if env['WITH_BF_OPENAL']: + dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll') + dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll') + + if env['WITH_BF_SNDFILE']: + dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll') + + if env['WITH_BF_SDL']: + dllsources.append('${LCGDIR}/sdl/lib/SDL.dll') + + dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll') + dllsources.append('#source/icons/blender.exe.manifest') + + windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources) + allinstall += windlls + installtarget = env.Alias('install', allinstall) bininstalltarget = env.Alias('install-bin', blenderinstall) diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py new file mode 100644 index 00000000000..0379ea48088 --- /dev/null +++ b/build_files/scons/config/win64-mingw-config.py @@ -0,0 +1,207 @@ +LCGDIR = '#../lib/mingw64' +LIBDIR = "${LCGDIR}" + +BF_PYTHON = LIBDIR + '/python' +BF_PYTHON_VERSION = '3.2' +WITH_BF_STATICPYTHON = False +BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' +BF_PYTHON_BINARY = 'python' +BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw' +BF_PYTHON_DLL = 'python32' +BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib' + +WITH_BF_OPENAL = True +BF_OPENAL = LIBDIR + '/openal' +BF_OPENAL_INC = '${BF_OPENAL}/include' +BF_OPENAL_LIB = 'wrap_oal' +BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib' + +WITH_BF_FFMPEG = False # TODO: FFmpeg gives linking errors, need to compile with MinGW-w64? +BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2' +BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib' +BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include' +BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll' + +WITH_BF_JACK = False +BF_JACK = LIBDIR + '/jack' +BF_JACK_INC = '${BF_JACK}/include' +BF_JACK_LIB = 'libjack' +BF_JACK_LIBPATH = '${BF_JACK}/lib' + +WITH_BF_SNDFILE = False +BF_SNDFILE = LIBDIR + '/sndfile' +BF_SNDFILE_INC = '${BF_SNDFILE}/include' +BF_SNDFILE_LIB = 'libsndfile-1' +BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib' + +WITH_BF_SDL = True +BF_SDL = LIBDIR + '/sdl' +BF_SDL_INC = '${BF_SDL}/include' +BF_SDL_LIB = 'SDL' +BF_SDL_LIBPATH = '${BF_SDL}/lib' + +BF_PTHREADS = '' # Part of MinGW-w64 +BF_PTHREADS_INC = '' +BF_PTHREADS_LIB = '' +BF_PTHREADS_LIBPATH = '' + +WITH_BF_OPENEXR = True +WITH_BF_STATICOPENEXR = False +BF_OPENEXR = LIBDIR + '/openexr' +BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR' +BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex' +BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib' + +WITH_BF_DDS = True + +WITH_BF_JPEG = True +BF_JPEG = LIBDIR + '/jpeg' +BF_JPEG_INC = '${BF_JPEG}/include' +BF_JPEG_LIB = 'jpeg' +BF_JPEG_LIBPATH = '${BF_JPEG}/lib' + +WITH_BF_PNG = True +BF_PNG = LIBDIR + '/png' +BF_PNG_INC = '${BF_PNG}/include' +BF_PNG_LIB = 'png' +BF_PNG_LIBPATH = '${BF_PNG}/lib' + +WITH_BF_TIFF = True +BF_TIFF = LIBDIR + '/tiff' +BF_TIFF_INC = '${BF_TIFF}/include' +BF_TIFF_LIB = 'tiff' +BF_TIFF_LIBPATH = '${BF_TIFF}/lib' + +WITH_BF_ZLIB = True +BF_ZLIB = LIBDIR + '/zlib' +BF_ZLIB_INC = '${BF_ZLIB}/include' +BF_ZLIB_LIB = 'z' +BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib' + +WITH_BF_INTERNATIONAL = True + +BF_GETTEXT = LIBDIR + '/gettext' +BF_GETTEXT_INC = '${BF_GETTEXT}/include' +BF_GETTEXT_LIB = 'intl' +BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' + +WITH_BF_OPENJPEG = True +BF_OPENJPEG = '#extern/libopenjpeg' +BF_OPENJPEG_LIB = '' +BF_OPENJPEG_INC = '${BF_OPENJPEG}' +BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib' + +WITH_BF_FFTW3 = True +BF_FFTW3 = LIBDIR + '/fftw3' +BF_FFTW3_INC = '${BF_FFTW3}/include' +BF_FFTW3_LIB = 'fftw3' +BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib' + +WITH_BF_GAMEENGINE = True +WITH_BF_OCEANSIM = True +WITH_BF_PLAYER = True +WITH_BF_LIBMV = True + +WITH_BF_BULLET = True +BF_BULLET = '#extern/bullet2/src' +BF_BULLET_INC = '${BF_BULLET}' +BF_BULLET_LIB = 'extern_bullet' + +BF_WINTAB = LIBDIR + '/wintab' +BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE' + +# enable freetype2 support for text objects +BF_FREETYPE = LIBDIR + '/freetype' +BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2/' +BF_FREETYPE_LIB = 'freetype' +BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib' + +WITH_BF_QUICKTIME = False + +WITH_BF_ICONV = True +BF_ICONV = LIBDIR + "/iconv" +BF_ICONV_INC = '${BF_ICONV}/include' +BF_ICONV_LIB = 'iconv' +BF_ICONV_LIBPATH = '${BF_ICONV}/lib' + +WITH_BF_REDCODE = False +BF_REDCODE_INC = '#extern' + +# Mesa Libs should go here if your using them as well.... +WITH_BF_STATICOPENGL = False +BF_OPENGL = 'C:\\MingW' +BF_OPENGL_INC = '${BF_OPENGL}/include' +BF_OPENGL_LIBINC = '${BF_OPENGL}/lib' +BF_OPENGL_LIB = 'opengl32 glu32' +BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a', + '${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a', + '${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ] + +WITH_BF_COLLADA = False # TODO: Compile Collada with MinGW-w64 +BF_COLLADA = '#source/blender/collada' +BF_COLLADA_INC = '${BF_COLLADA}' +BF_COLLADA_LIB = 'bf_collada' + +BF_OPENCOLLADA = LIBDIR + '/opencollada' +BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include' +BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa' +BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' + +#Cycles +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'] + +WITH_BF_OIIO = True +BF_OIIO = LIBDIR + '/openimageio' +BF_OIIO_INC = '${BF_OIIO}/include' +BF_OIIO_LIB = 'OpenImageIO' +BF_OIIO_LIBPATH = '${BF_OIIO}/lib' + +WITH_BF_BOOST = True +BF_BOOST = LIBDIR + '/boost' +BF_BOOST_INC = BF_BOOST + '/include' +BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49 boost_filesystem-mgw47-mt-s-1_49 boost_filesystem-mgw47-mt-sd-1_49 boost_regex-mgw47-mt-s-1_49 boost_regex-mgw47-mt-sd-1_49 boost_system-mgw47-mt-s-1_49 boost_system-mgw47-mt-sd-1_49 boost_thread-mgw47-mt-s-1_49 boost_thread-mgw47-mt-sd-1_49' +BF_BOOST_LIBPATH = BF_BOOST + '/lib' + +#Ray trace optimization +WITH_BF_RAYOPTIMIZATION = True +BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2', '-ftree-vectorize'] + +WITH_BF_OPENMP = True + +## +CC = 'gcc' +CXX = 'g++' + +CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] +CXXFLAGS = [ '-fpermissive' ] + +CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-D_SSIZE_T_'] +REL_CFLAGS = ['-O3', '-mmmx', '-msse', '-msse2'] +REL_CXXFLAGS = ['-O3', '-mmmx', '-msse', '-msse2'] +REL_CCFLAGS = ['-DNDEBUG', '-O3', '-mmmx', '-msse', '-msse2'] + +C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes'] + +CC_WARN = [ '-Wall' ] + +LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread'] + +PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152'] + +## DISABLED, causes linking errors! +## for re-distrobution, so users dont need mingw installed +# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"] + +BF_DEBUG = False +BF_DEBUG_CCFLAGS= ['-g', '-D_DEBUG'] + +BF_PROFILE_CCFLAGS = ['-pg', '-g'] +BF_PROFILE_LINKFLAGS = ['-pg'] +BF_PROFILE_FLAGS = BF_PROFILE_CCFLAGS +BF_PROFILE = False + +BF_BUILDDIR = '..\\build\\win64-mingw' +BF_INSTALLDIR='..\\install\\win64-mingw' diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index ec7b6a0ce4c..5a066470225 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -182,12 +182,12 @@ def setup_staticlibs(lenv): if lenv['WITH_BF_SNDFILE'] and lenv['WITH_BF_STATICSNDFILE']: statlibs += Split(lenv['BF_SNDFILE_LIB_STATIC']) - if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): + if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): libincs += Split(lenv['BF_PTHREADS_LIBPATH']) if lenv['WITH_BF_COLLADA']: libincs += Split(lenv['BF_OPENCOLLADA_LIBPATH']) - if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): + if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): libincs += Split(lenv['BF_PCRE_LIBPATH']) libincs += Split(lenv['BF_EXPAT_LIBPATH']) @@ -206,7 +206,7 @@ def setup_staticlibs(lenv): statlibs += Split(lenv['BF_BOOST_LIB_STATIC']) # setting this last so any overriding of manually libs could be handled - if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): + if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'): libincs.append('/usr/lib') if lenv['WITH_BF_JEMALLOC']: @@ -228,7 +228,7 @@ def setup_syslibs(lenv): if not lenv['WITH_BF_FREETYPE_STATIC']: syslibs += Split(lenv['BF_FREETYPE_LIB']) if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']: - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): + if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'): syslibs.append(lenv['BF_PYTHON_LIB']+'_d') else: syslibs.append(lenv['BF_PYTHON_LIB']) @@ -268,7 +268,7 @@ def setup_syslibs(lenv): syslibs += Split(lenv['BF_SDL_LIB']) if not lenv['WITH_BF_STATICOPENGL']: syslibs += Split(lenv['BF_OPENGL_LIB']) - if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'): + if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'): syslibs += Split(lenv['BF_PTHREADS_LIB']) if lenv['WITH_BF_COLLADA']: syslibs.append(lenv['BF_PCRE_LIB']) @@ -341,7 +341,7 @@ def creator(env): if env['BF_DEBUG']: defs.append('_DEBUG') - if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs.append(env['BF_PTHREADS_INC']) incs.append('#/intern/utfconv') @@ -731,7 +731,7 @@ class BlenderEnvironment(SConsEnvironment): if not self or not libname or not source: print bc.FAIL+'Cannot continue. Missing argument for BlenderRes '+libname+bc.ENDC self.Exit() - if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc'): + if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'): print bc.FAIL+'BlenderRes is for windows only!'+bc.END self.Exit() diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 544f7f066ce..ca0ac2dd8da 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -617,7 +617,7 @@ def buildslave(target=None, source=None, env=None): Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only. """ - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin'): + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin', 'win64-mingw'): extension = '.zip' else: extension = '.tar.bz2' @@ -662,7 +662,7 @@ def NSIS_print(target, source, env): def NSIS_Installer(target=None, source=None, env=None): print "="*35 - if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc'): + if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'win64-mingw'): print "NSIS installer is only available on Windows." Exit() if env['OURPLATFORM'] == 'win32-vc': diff --git a/extern/bullet2/patches/mingw64_scons.patch b/extern/bullet2/patches/mingw64_scons.patch new file mode 100644 index 00000000000..e63dee3c48c --- /dev/null +++ b/extern/bullet2/patches/mingw64_scons.patch @@ -0,0 +1,13 @@ +Index: SConscript +=================================================================== +--- SConscript (revision 45919) ++++ SConscript (working copy) +@@ -11,7 +11,7 @@ + defs += ' WIN32 NDEBUG _WINDOWS' + #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op'] + cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs'] +-elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'): ++elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross', 'win64-mingw'): + defs += ' NDEBUG' + cflags += ['-O2'] + elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'): diff --git a/extern/bullet2/src/SConscript b/extern/bullet2/src/SConscript index fa00ad7bc2e..f59bcba9fa6 100644 --- a/extern/bullet2/src/SConscript +++ b/extern/bullet2/src/SConscript @@ -11,7 +11,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): defs += ' WIN32 NDEBUG _WINDOWS' #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op'] cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs'] -elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'): +elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross', 'win64-mingw'): defs += ' NDEBUG' cflags += ['-O2'] elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'): diff --git a/extern/carve/SConscript b/extern/carve/SConscript index e2f3c814e2e..1ba67e51327 100644 --- a/extern/carve/SConscript +++ b/extern/carve/SConscript @@ -14,7 +14,7 @@ incs = ['include'] if env['WITH_BF_BOOST']: if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'): # Boost is setting as preferred collections library in the Carve code when using MSVC compiler - if env['OURPLATFORM'] != 'win32-mingw': + if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'): defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS') defs.append('CARVE_SYSTEM_BOOST') diff --git a/extern/carve/bundle.sh b/extern/carve/bundle.sh index e68b2c7e90e..881367fe687 100755 --- a/extern/carve/bundle.sh +++ b/extern/carve/bundle.sh @@ -114,7 +114,7 @@ incs = ['include'] if env['WITH_BF_BOOST']: if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'): # Boost is setting as preferred collections library in the Carve code when using MSVC compiler - if env['OURPLATFORM'] != 'win32-mingw': + if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'): defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS') defs.append('CARVE_SYSTEM_BOOST') diff --git a/extern/carve/patches/mingw_w64.patch b/extern/carve/patches/mingw_w64.patch new file mode 100644 index 00000000000..26a30be84c3 --- /dev/null +++ b/extern/carve/patches/mingw_w64.patch @@ -0,0 +1,13 @@ +Index: bundle.sh +=================================================================== +--- bundle.sh (revision 45912) ++++ bundle.sh (working copy) +@@ -114,7 +114,7 @@ + if env['WITH_BF_BOOST']: + if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'): + # Boost is setting as preferred collections library in the Carve code when using MSVC compiler +- if env['OURPLATFORM'] != 'win32-mingw': ++ if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'): + defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS') + + defs.append('CARVE_SYSTEM_BOOST') diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index fbcd92503d8..fbb6ee36f85 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -34,7 +34,7 @@ incs = '. ../Eigen3' incs += ' ' + env['BF_PNG_INC'] incs += ' ' + env['BF_ZLIB_INC'] -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): incs += ' ./third_party/msinttypes' diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh index a34e45a38b0..30d08cd680a 100755 --- a/extern/libmv/bundle.sh +++ b/extern/libmv/bundle.sh @@ -248,7 +248,7 @@ incs = '. ../Eigen3' incs += ' ' + env['BF_PNG_INC'] incs += ' ' + env['BF_ZLIB_INC'] -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): incs += ' ./third_party/msinttypes' diff --git a/extern/libmv/libmv/numeric/numeric.h b/extern/libmv/libmv/numeric/numeric.h index ad707fb76f2..d2cadf4b579 100644 --- a/extern/libmv/libmv/numeric/numeric.h +++ b/extern/libmv/libmv/numeric/numeric.h @@ -33,7 +33,7 @@ #include #include -#if _WIN32 || __APPLE__ || __FreeBSD__ +#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__) void static sincos (double x, double *sinx, double *cosx) { *sinx = sin(x); *cosx = cos(x); diff --git a/extern/libmv/patches/mingw_w64_support.patch b/extern/libmv/patches/mingw_w64_support.patch new file mode 100644 index 00000000000..360287e81c2 --- /dev/null +++ b/extern/libmv/patches/mingw_w64_support.patch @@ -0,0 +1,58 @@ +Index: bundle.sh +=================================================================== +--- bundle.sh (revision 45912) ++++ bundle.sh (working copy) +@@ -248,7 +248,7 @@ + incs += ' ' + env['BF_PNG_INC'] + incs += ' ' + env['BF_ZLIB_INC'] + +-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): ++if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + incs += ' ./third_party/msinttypes' +Index: libmv/numeric/numeric.h +=================================================================== +--- libmv/numeric/numeric.h (revision 45912) ++++ libmv/numeric/numeric.h (working copy) +@@ -33,7 +33,7 @@ + #include + #include + +-#if _WIN32 || __APPLE__ || __FreeBSD__ ++#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__) + void static sincos (double x, double *sinx, double *cosx) { + *sinx = sin(x); + *cosx = cos(x); +Index: third_party/glog/src/windows/port.cc +=================================================================== +--- third_party/glog/src/windows/port.cc (revision 45912) ++++ third_party/glog/src/windows/port.cc (working copy) +@@ -55,6 +55,8 @@ + return _vsnprintf(str, size-1, format, ap); + } + ++// MinGW64 defines ++#ifndef __MINGW64__ + int snprintf(char *str, size_t size, const char *format, ...) { + va_list ap; + va_start(ap, format); +@@ -62,3 +64,4 @@ + va_end(ap); + return r; + } ++#endif +Index: third_party/glog/src/windows/port.h +=================================================================== +--- third_party/glog/src/windows/port.h (revision 45912) ++++ third_party/glog/src/windows/port.h (working copy) +@@ -120,7 +120,9 @@ + #define DEFAULT_TEMPLATE_ROOTDIR ".." + + // ----------------------------------- SYSTEM/PROCESS ++#ifndef __MINGW64__ + typedef int pid_t; ++#endif + #define getpid _getpid + + // ----------------------------------- THREADS diff --git a/extern/libmv/third_party/glog/src/windows/port.cc b/extern/libmv/third_party/glog/src/windows/port.cc index bfa6e70afbb..58e28b026c0 100644 --- a/extern/libmv/third_party/glog/src/windows/port.cc +++ b/extern/libmv/third_party/glog/src/windows/port.cc @@ -55,6 +55,8 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { return _vsnprintf(str, size-1, format, ap); } +// MinGW64 defines +#ifndef __MINGW64__ int snprintf(char *str, size_t size, const char *format, ...) { va_list ap; va_start(ap, format); @@ -62,3 +64,4 @@ int snprintf(char *str, size_t size, const char *format, ...) { va_end(ap); return r; } +#endif diff --git a/extern/libmv/third_party/glog/src/windows/port.h b/extern/libmv/third_party/glog/src/windows/port.h index abfcf65384c..72e3906f82f 100644 --- a/extern/libmv/third_party/glog/src/windows/port.h +++ b/extern/libmv/third_party/glog/src/windows/port.h @@ -120,7 +120,9 @@ extern int safe_vsnprintf(char *str, size_t size, #define DEFAULT_TEMPLATE_ROOTDIR ".." // ----------------------------------- SYSTEM/PROCESS +#ifndef __MINGW64__ typedef int pid_t; +#endif #define getpid _getpid // ----------------------------------- THREADS diff --git a/intern/SConscript b/intern/SConscript index d7c3715349b..b6305f7dbab 100644 --- a/intern/SConscript +++ b/intern/SConscript @@ -36,5 +36,5 @@ if NEW_CSG == 'false': else: SConscript(['csg/SConscript']) -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'): SConscript(['utfconv/SConscript']) diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript index b8d5a56a625..50c81db46dd 100644 --- a/intern/audaspace/SConscript +++ b/intern/audaspace/SConscript @@ -41,7 +41,7 @@ if env['WITH_BF_PYTHON']: incs += ' Python ' + env['BF_PYTHON_INC'] defs.append('WITH_PYTHON') -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ('bf_intern_audaspace', sources, Split(incs), defs, libtype=['intern','player'], priority = [25,215] ) diff --git a/intern/boolop/SConscript b/intern/boolop/SConscript index 1c8c912614d..f630d1d58e0 100644 --- a/intern/boolop/SConscript +++ b/intern/boolop/SConscript @@ -18,13 +18,13 @@ else: if env['WITH_BF_BOOST']: if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'): # Boost is setting as preferred collections library in the Carve code when using MSVC compiler - if env['OURPLATFORM'] != 'win32-mingw': + if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'): defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS') defs.append('CARVE_SYSTEM_BOOST') incs += ' ' + env['BF_BOOST_INC'] -if (env['OURPLATFORM'] == 'win32-mingw'): +if (env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw')): env.BlenderLib ('bf_intern_bop', sources, Split(incs) , [], libtype='intern', priority = 5 ) else: env.BlenderLib ('bf_intern_bop', sources, Split(incs) , defs, libtype='intern', priority = 5 ) diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index 2ea224f052d..34c6e8df2fd 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -39,7 +39,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): else: cxxflags.append('-ffast-math'.split()) -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs.append(env['BF_PTHREADS_INC']) # optimized kernel diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript index 2265daa8fff..44882a64286 100644 --- a/intern/ghost/SConscript +++ b/intern/ghost/SConscript @@ -49,7 +49,7 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f else: sources.remove('intern' + os.sep + 'GHOST_DropTargetX11.cpp') -elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'): +elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'): for f in pf: try: sources.remove('intern' + os.sep + f + 'X11.cpp') @@ -98,7 +98,7 @@ if env['WITH_BF_3DMOUSE']: else: sources.remove('intern' + os.sep + 'GHOST_NDOFManager.cpp') try: - if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'): + if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'): sources.remove('intern' + os.sep + 'GHOST_NDOFManagerWin32.cpp') elif window_system=='darwin': sources.remove('intern' + os.sep + 'GHOST_NDOFManagerCocoa.mm') @@ -108,7 +108,7 @@ else: pass -if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'): +if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'): incs = env['BF_WINTAB_INC'] + ' ' + incs incs += ' ../utfconv' diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript index 502df1891d5..711955cbfeb 100644 --- a/intern/opennl/SConscript +++ b/intern/opennl/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c') incs = 'extern superlu ../../extern/colamd/Include' -if (env['OURPLATFORM'] == 'win32-mingw'): +if (env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw')): env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] ) else: env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core'], priority=[55] ) diff --git a/intern/utfconv/SConscript b/intern/utfconv/SConscript index 010fcf9aa7c..19a698b6a0b 100644 --- a/intern/utfconv/SConscript +++ b/intern/utfconv/SConscript @@ -9,7 +9,7 @@ defs = '' # This is odd but leave it for now... # Why have win32 check here? - this is only used for windows. # ... because one day we might want to use it on other platforms. -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'): sources += ['utf_winfunc.c'] env.BlenderLib('bf_utfconv', sources, Split(incs), Split(defs), libtype=['intern','player'], priority=[0,0]) diff --git a/source/SConscript b/source/SConscript index 0002cb4cf0b..cfb204cd52a 100644 --- a/source/SConscript +++ b/source/SConscript @@ -9,5 +9,5 @@ if env['WITH_BF_GAMEENGINE']: if env['WITH_BF_PLAYER']: SConscript (['blenderplayer/bad_level_call_stubs/SConscript']) -if env['OURPLATFORM'] in ('win64-vc', 'win32-vc', 'win32-mingw', 'linuxcross'): +if env['OURPLATFORM'] in ('win64-vc', 'win32-vc', 'win32-mingw', 'linuxcross', 'win64-mingw'): SConscript (['icons/SConscript']) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 00c2cf1696e..ee9e6bc7739 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -114,7 +114,7 @@ if env['WITH_BF_FFTW3']: if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript index ea51e5b6ab5..e53f622a5c4 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -16,7 +16,7 @@ if env['WITH_BF_BINRELOC']: incs += ' ../../../extern/binreloc/include' defs.append('WITH_BINRELOC') -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] incs += ' ../../../intern/utfconv' diff --git a/source/blender/blenpluginapi/SConscript b/source/blender/blenpluginapi/SConscript index a5e7f479cfb..fe37091bb95 100644 --- a/source/blender/blenpluginapi/SConscript +++ b/source/blender/blenpluginapi/SConscript @@ -17,7 +17,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ( libname = 'bf_blenpluginapi', sources = sources, includes = Split(incs), defines = defs, libtype=['core'], priority = [170] ) diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript index e5c96d3530f..ba375f30093 100644 --- a/source/blender/editors/armature/SConscript +++ b/source/blender/editors/armature/SConscript @@ -14,7 +14,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 8142faf67a1..b3aba977b21 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -15,7 +15,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_GAMEENGINE']: diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index 883d0ca20ae..b53ea549853 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -15,7 +15,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_PYTHON']: diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index a478b2afb1c..9fe6cff4349 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -14,7 +14,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript index 1f93db653f5..0b19ecdab8e 100644 --- a/source/blender/editors/render/SConscript +++ b/source/blender/editors/render/SConscript @@ -13,7 +13,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript index 038a86328a3..0e894a13d28 100644 --- a/source/blender/editors/screen/SConscript +++ b/source/blender/editors/screen/SConscript @@ -14,7 +14,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript index 8669ea6c695..21439e6c6b2 100644 --- a/source/blender/editors/sculpt_paint/SConscript +++ b/source/blender/editors/sculpt_paint/SConscript @@ -18,7 +18,7 @@ if env['OURPLATFORM'] == 'linuxcross': if env['WITH_BF_OPENMP']: incs += ' ' + env['BF_OPENMP_INC'] -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ( 'bf_editors_sculpt_paint', sources, Split(incs), defines=defs, libtype=['core'], priority=[40] ) diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript index ad8bcba39d6..b387d489805 100644 --- a/source/blender/editors/space_file/SConscript +++ b/source/blender/editors/space_file/SConscript @@ -26,7 +26,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] - + env.BlenderLib ( 'bf_editors_space_file', sources, Split(incs), defs, libtype=['core'], priority=[115] ) diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index cdd2133d0f5..759d4592992 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -18,7 +18,7 @@ if env['WITH_BF_TIFF']: if env['WITH_BF_CINEON']: defs.append('WITH_CINEON') -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ( 'bf_editors_space_image', sources, Split(incs), defs, libtype=['core'], priority=[40] ) diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript index 58fae203cf5..2dee750f8c0 100644 --- a/source/blender/editors/space_node/SConscript +++ b/source/blender/editors/space_node/SConscript @@ -19,7 +19,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript index 3430c10b766..65aadfa1c8a 100644 --- a/source/blender/editors/space_sequencer/SConscript +++ b/source/blender/editors/space_sequencer/SConscript @@ -8,7 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../../blenloader' incs += ' #/intern/audaspace/intern' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), [], libtype=['core'], priority=[100] ) diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript index e412927f8ca..ffe35019960 100644 --- a/source/blender/editors/space_view3d/SConscript +++ b/source/blender/editors/space_view3d/SConscript @@ -13,7 +13,7 @@ incs += ' #source/gameengine/BlenderRoutines' if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript index 181af6bb1d4..11b0ee5f9fa 100644 --- a/source/blender/gpu/SConscript +++ b/source/blender/gpu/SConscript @@ -8,7 +8,7 @@ defs = [ 'GLEW_STATIC' ] incs = '../blenlib ../blenkernel ../makesdna ../makesrna ../include ../blenloader ../nodes ../nodes/intern' incs += ' #/extern/glew/include #intern/guardedalloc #intern/smoke/extern ../imbuf .' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript index b2b526ca17d..a1030112f4b 100644 --- a/source/blender/imbuf/SConscript +++ b/source/blender/imbuf/SConscript @@ -15,7 +15,7 @@ incs += ' ' + env['BF_ZLIB_INC'] defs = [] -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] incs += ' ../../../intern/utfconv' diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript index a819d827788..c1e6eb5281d 100644 --- a/source/blender/makesdna/intern/SConscript +++ b/source/blender/makesdna/intern/SConscript @@ -57,7 +57,7 @@ dna.Depends ('dna.c', makesdna) dna.Depends ('dna.c', header_files) if env['OURPLATFORM'] != 'linuxcross': - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'): dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET") else: dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET") diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index d4ee86b281c..2bafc586a58 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -68,7 +68,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index c8d7e0ae421..99fab18b4bf 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -96,7 +96,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: @@ -160,7 +160,7 @@ rna.Depends (generated_files, makesrna) build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep if env['OURPLATFORM'] != 'linuxcross': - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'): rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \"" + build_dir ) else: rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna\" \"" + build_dir + '"' ) diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index fcf00bdef78..c8b13e24533 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -33,7 +33,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [190,105] ) diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 08b3fc8e643..a79138f9eb5 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -9,7 +9,7 @@ incs += ' ../imbuf ../blenloader ../bmesh ../gpu ../render/extern/include ../win incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include #intern/cycles/blender' incs += ' #intern/audaspace/intern ' + env['BF_PYTHON_INC'] -is_debug = (env['OURPLATFORM'] in ('win32-mingw', 'win32-vc','win64-vc') and env['BF_DEBUG']) +is_debug = (env['OURPLATFORM'] in ('win32-mingw', 'win32-vc','win64-vc', 'win64-mingw') and env['BF_DEBUG']) # bmesh defs = [] @@ -56,7 +56,7 @@ if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') incs += ' ' + env['BF_FFMPEG_INC'] -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] sources = env.Glob('intern/*.c') diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript index db35764a31c..8a044b19a79 100644 --- a/source/blender/render/SConscript +++ b/source/blender/render/SConscript @@ -29,7 +29,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] cxxflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] -if env['OURPLATFORM'] == 'win32-mingw': +if env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw'): if env['WITH_BF_RAYOPTIMIZATION']: cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] cxxflags_raytrace = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] @@ -60,7 +60,7 @@ if env['WITH_BF_OPENEXR']: if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] # diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index ddb61d721cc..57d632c7d04 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -30,7 +30,7 @@ if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] incs += ' ../../intern/utfconv' diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index 5d8e2bc93b6..4e2adbdc021 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -26,7 +26,7 @@ incs += ' #extern/Eigen3' incs += ' ' + env['BF_BULLET_INC'] if env['BF_DEBUG']: - if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc'): + if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc', 'win64-mingw'): defs.append('_DEBUG') if env['WITH_BF_PYTHON']: diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 064f09df9f3..2943acd546d 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -36,7 +36,7 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): +if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'): if env['BF_DEBUG']: defs.append('_DEBUG') # for Python diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index b39a59e4504..1e3f232a919 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -16,7 +16,7 @@ incs += ' #intern/guardedalloc #intern/container #extern/glew/include' incs += ' #intern/ffmpeg' defs = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'): +if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw', 'win64-mingw'): if env['BF_DEBUG']: defs.append('_DEBUG') From 0db3c5f74300980d35b3114992c299f072b913b1 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 24 Apr 2012 14:33:44 +0000 Subject: [PATCH 30/31] Remove mingw-w64 errors from loss of precision by converting 64bit pointers to ints. All cases found were harmless and the error behaviour could be turned off by the -fpermissive flag but I'd rather keep that off to detect any real problems should they arise. --- CMakeLists.txt | 5 ++- .../scons/config/win64-mingw-config.py | 2 +- .../patches/MinGW64-nopermissive.patch | 39 +++++++++++++++++++ extern/bullet2/src/LinearMath/btSerializer.h | 13 +++++-- intern/audaspace/intern/AUD_Buffer.cpp | 11 +++++- .../patches/mingw64-nopermissive.patch | 23 +++++++++++ intern/elbeem/intern/ntl_geometrymodel.cpp | 11 +++++- .../elbeem/patches/mingw64_nopermissive.patch | 29 ++++++++++++++ .../gameengine/Expressions/KX_HashedPtr.cpp | 6 ++- source/gameengine/Ketsji/KX_GameObject.cpp | 5 ++- .../gameengine/Ketsji/KX_IPO_SGController.cpp | 5 ++- 11 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 extern/bullet2/patches/MinGW64-nopermissive.patch create mode 100644 intern/audaspace/patches/mingw64-nopermissive.patch create mode 100644 intern/elbeem/patches/mingw64_nopermissive.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index a2926182c5a..9250dae9ad8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1008,8 +1008,9 @@ elseif(WIN32) if(WITH_MINGW64) #Yes, the point for MinGW64 is moar optimization by default :) - set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -O3") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") + set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2") + set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread") add_definitions(-DFREE_WINDOWS64 -DMS_WIN64) diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py index 0379ea48088..98d45ae2054 100644 --- a/build_files/scons/config/win64-mingw-config.py +++ b/build_files/scons/config/win64-mingw-config.py @@ -176,7 +176,7 @@ CC = 'gcc' CXX = 'g++' CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -CXXFLAGS = [ '-fpermissive' ] +#CXXFLAGS = [ '-fpermissive' ] CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-D_SSIZE_T_'] REL_CFLAGS = ['-O3', '-mmmx', '-msse', '-msse2'] diff --git a/extern/bullet2/patches/MinGW64-nopermissive.patch b/extern/bullet2/patches/MinGW64-nopermissive.patch new file mode 100644 index 00000000000..915f232f6d7 --- /dev/null +++ b/extern/bullet2/patches/MinGW64-nopermissive.patch @@ -0,0 +1,39 @@ +Index: LinearMath/btSerializer.h +=================================================================== +--- LinearMath/btSerializer.h (revision 45919) ++++ LinearMath/btSerializer.h (working copy) +@@ -25,8 +25,15 @@ + #endif + #include + ++#if defined(_WIN64) ++# ifdef __MINGW64__ ++# include ++# endif ++typedef __int64 int_ptr; ++#else ++typedef long int_ptr; ++#endif + +- + ///only the 32bit versions for now + extern unsigned char sBulletDNAstr[]; + extern int sBulletDNAlen; +@@ -247,7 +254,7 @@ + cp++; + } + { +- nr= (long)cp; ++ nr= (int_ptr)cp; + // long mask=3; + nr= ((nr+3)&~3)-nr; + while (nr--) +@@ -282,7 +289,7 @@ + } + + { +- nr= (long)cp; ++ nr= (int_ptr)cp; + // long mask=3; + nr= ((nr+3)&~3)-nr; + while (nr--) diff --git a/extern/bullet2/src/LinearMath/btSerializer.h b/extern/bullet2/src/LinearMath/btSerializer.h index 8a89374c612..a1e766c95ce 100644 --- a/extern/bullet2/src/LinearMath/btSerializer.h +++ b/extern/bullet2/src/LinearMath/btSerializer.h @@ -25,7 +25,14 @@ subject to the following restrictions: #endif #include - +#if defined(_WIN64) +# ifdef __MINGW64__ +# include +# endif +typedef __int64 int_ptr; +#else +typedef long int_ptr; +#endif ///only the 32bit versions for now extern unsigned char sBulletDNAstr[]; @@ -247,7 +254,7 @@ protected: cp++; } { - nr= (long)cp; + nr= (int_ptr)cp; // long mask=3; nr= ((nr+3)&~3)-nr; while (nr--) @@ -282,7 +289,7 @@ protected: } { - nr= (long)cp; + nr= (int_ptr)cp; // long mask=3; nr= ((nr+3)&~3)-nr; while (nr--) diff --git a/intern/audaspace/intern/AUD_Buffer.cpp b/intern/audaspace/intern/AUD_Buffer.cpp index b7157f672b4..624a4d0b2c8 100644 --- a/intern/audaspace/intern/AUD_Buffer.cpp +++ b/intern/audaspace/intern/AUD_Buffer.cpp @@ -33,7 +33,16 @@ #include #include -#define AUD_ALIGN(a) (a + 16 - ((long)a & 15)) +#if defined(_WIN64) +# ifdef __MINGW64__ +# include +# endif +typedef unsigned __int64 uint_ptr; +#else +typedef unsigned long uint_ptr; +#endif + +#define AUD_ALIGN(a) (a + 16 - ((uint_ptr)a & 15)) AUD_Buffer::AUD_Buffer(int size) { diff --git a/intern/audaspace/patches/mingw64-nopermissive.patch b/intern/audaspace/patches/mingw64-nopermissive.patch new file mode 100644 index 00000000000..64420d240f3 --- /dev/null +++ b/intern/audaspace/patches/mingw64-nopermissive.patch @@ -0,0 +1,23 @@ +Index: intern/AUD_Buffer.cpp +=================================================================== +--- intern/AUD_Buffer.cpp (revision 45919) ++++ intern/AUD_Buffer.cpp (working copy) +@@ -33,8 +33,17 @@ + #include + #include + +-#define AUD_ALIGN(a) (a + 16 - ((long)a & 15)) ++#if defined(_WIN64) ++# ifdef __MINGW64__ ++# include ++# endif ++typedef unsigned __int64 uint_ptr; ++#else ++typedef unsigned long uint_ptr; ++#endif + ++#define AUD_ALIGN(a) (a + 16 - ((uint_ptr)a & 15)) ++ + AUD_Buffer::AUD_Buffer(int size) + { + m_size = size; diff --git a/intern/elbeem/intern/ntl_geometrymodel.cpp b/intern/elbeem/intern/ntl_geometrymodel.cpp index 13220736b8e..b518416b639 100644 --- a/intern/elbeem/intern/ntl_geometrymodel.cpp +++ b/intern/elbeem/intern/ntl_geometrymodel.cpp @@ -21,7 +21,14 @@ #endif #endif // WIN32 - +#if defined(_WIN64) +# ifdef __MINGW64__ +# include +# endif +typedef __int64 int_ptr; +#else +typedef long int_ptr; +#endif /****************************************************************************** * Default Constructor *****************************************************************************/ @@ -164,7 +171,7 @@ int ntlGeometryObjModel::initModel(int numVertices, float *vertices, int numTria } //fprintf(stderr,"initModel DEBUG %d \n",channelSize); - debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<0)) { vector aniverts; vector aninorms; diff --git a/intern/elbeem/patches/mingw64_nopermissive.patch b/intern/elbeem/patches/mingw64_nopermissive.patch new file mode 100644 index 00000000000..a01e65d43e4 --- /dev/null +++ b/intern/elbeem/patches/mingw64_nopermissive.patch @@ -0,0 +1,29 @@ +Index: intern/ntl_geometrymodel.cpp +=================================================================== +--- intern/ntl_geometrymodel.cpp (revision 45919) ++++ intern/ntl_geometrymodel.cpp (working copy) +@@ -21,7 +21,14 @@ + #endif + #endif // WIN32 + +- ++#if defined(_WIN64) ++# ifdef __MINGW64__ ++# include ++# endif ++typedef __int64 int_ptr; ++#else ++typedef long int_ptr; ++#endif + /****************************************************************************** + * Default Constructor + *****************************************************************************/ +@@ -164,7 +171,7 @@ + } + + //fprintf(stderr,"initModel DEBUG %d \n",channelSize); +- debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<0)) { + vector aniverts; + vector aninorms; diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index 51550d52636..84488e3641d 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -28,13 +28,15 @@ /** \file gameengine/Expressions/KX_HashedPtr.cpp * \ingroup expressions */ - +#ifdef __MINGW64__ +#include +#endif #include "KX_HashedPtr.h" unsigned int KX_Hash(void * inDWord) { -#if defined(_WIN64) && !defined(FREE_WINDOWS64) +#ifdef _WIN64 unsigned __int64 key = (unsigned __int64)inDWord; #else unsigned long key = (unsigned long)inDWord; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index c5145ef2171..bdb586b2474 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -31,7 +31,10 @@ */ -#if defined(_WIN64) && !defined(FREE_WINDOWS64) +#if defined(_WIN64) +# ifdef __MINGW64__ +# include +# endif typedef unsigned __int64 uint_ptr; #else typedef unsigned long uint_ptr; diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index 950e3c88a9e..b8872f5ddc3 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -31,7 +31,10 @@ */ -#if defined(_WIN64) && !defined(FREE_WINDOWS64) +#if defined(_WIN64) +# ifdef __MINGW64__ +# include +# endif typedef unsigned __int64 uint_ptr; #else typedef unsigned long uint_ptr; From 749d284b498fb1cde7996d712497ce478c978f3a Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 24 Apr 2012 14:51:23 +0000 Subject: [PATCH 31/31] MinGW-w64 enable full optimization for C++ too --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9250dae9ad8..ad3a293b937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1010,6 +1010,7 @@ elseif(WIN32) #Yes, the point for MinGW64 is moar optimization by default :) set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2") set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")