From f0e427e558d7597f92c6187369451ad1621c8720 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Tue, 1 May 2012 08:19:11 +0000 Subject: [PATCH 01/55] Fix for bug #31169. Don't force the release-confirm setting in node transform operators when using the select-mouse tweak event. Instead the release confirm setting in user preferences is used in that case. For the alternative action-mouse tweak event the behavior remains the same. --- source/blender/editors/space_node/node_ops.c | 5 +++++ source/blender/editors/transform/transform_ops.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index e1493b5b1a5..25940787b60 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -130,6 +130,11 @@ void ED_operatormacros_node(void) ot = WM_operatortype_append_macro("NODE_OT_move_detach_links", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Move a node to detach links"; WM_operatortype_macro_define(ot, "NODE_OT_links_detach"); + WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); + + ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER); + ot->description = "Move a node to detach links"; + WM_operatortype_macro_define(ot, "NODE_OT_links_detach"); mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_boolean_set(mot->ptr, "release_confirm", TRUE); } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 83d4a5dfa6e..ccd794d0101 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -926,7 +926,6 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0); RNA_boolean_set(kmi->ptr, "release_confirm", TRUE); kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0); - RNA_boolean_set(kmi->ptr, "release_confirm", TRUE); WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0); @@ -936,7 +935,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", DKEY, KM_PRESS, KM_ALT, 0); /* XXX release_confirm is set in the macro operator definition */ - WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_A, KM_ANY, KM_ALT, 0); + WM_keymap_add_item(keymap, "NODE_OT_move_detach_links_release", EVT_TWEAK_A, KM_ANY, KM_ALT, 0); WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0); break; case SPACE_SEQ: From f9663b744e72af4384faa36290a8e75a46424e93 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 1 May 2012 09:38:29 +0000 Subject: [PATCH 02/55] Do not stick normal length slider in 3d viewport properties to display normals buttons --- release/scripts/startup/bl_ui/space_view3d.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b1b9742e16a..ca6da539884 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2379,9 +2379,10 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): col.separator() col.label(text="Normals:") - row = col.row(align=True) - row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL') - row.prop(mesh, "show_normal_face", text="", icon='FACESEL') + row = col.row() + sub = row.row(align=True) + sub.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL') + sub.prop(mesh, "show_normal_face", text="", icon='FACESEL') row.prop(context.scene.tool_settings, "normal_size", text="Size") col.separator() From a2d08304165028f20818772eeb0ea59f6ee1d878 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 May 2012 10:18:10 +0000 Subject: [PATCH 03/55] Fix #31195: subsurf modifier draws wrong vertex colors. --- source/blender/blenkernel/intern/subsurf_ccg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index c3f864a8b2a..ddc605eb3e0 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2102,7 +2102,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } } else { - glShadeModel(GL_FLAT); + glShadeModel((cp)? GL_SMOOTH: GL_FLAT); glBegin(GL_QUADS); for (y = 0; y < gridFaces; y++) { for (x = 0; x < gridFaces; x++) { From 3ee136910d1c6b70e7c99ebb40798d1706c13d9e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 May 2012 10:28:50 +0000 Subject: [PATCH 04/55] Fix #31147: uv unwrap not scaling islands properly to match relative size. --- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 2a9d472c204..4583a888e30 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1142,6 +1142,7 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) param_lscm_solve(handle); param_lscm_end(handle); + param_average(handle); param_pack(handle, scene->toolsettings->uvcalc_margin); param_flush(handle); From 6527f42b6bd1b918c5e7b0c865024c14806ac1ae Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 1 May 2012 11:01:24 +0000 Subject: [PATCH 05/55] Fix #31193: Normals don't have any Z component Issue was caused by heavily non-uniform scale applied on object. Run scale correction on face and vertex normals draw if there's non-uniform scale. --- source/blender/blenlib/BLI_math_matrix.h | 2 + source/blender/blenlib/intern/math_matrix.c | 29 +++++++ .../blender/editors/space_view3d/drawobject.c | 77 +++++++++++++++---- 3 files changed, 94 insertions(+), 14 deletions(-) diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 00a751f9da3..1d99fd4fa27 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -126,6 +126,8 @@ int is_orthogonal_m4(float mat[4][4]); int is_orthonormal_m3(float mat[3][3]); int is_orthonormal_m4(float mat[4][4]); +int is_uniform_scaled_m3(float mat[3][3]); + void adjoint_m3_m3(float R[3][3], float A[3][3]); void adjoint_m4_m4(float R[4][4], float A[4][4]); diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index bb0b8897b15..b3b58dca1a6 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -866,6 +866,35 @@ int is_orthonormal_m4(float m[][4]) return 0; } +int is_uniform_scaled_m3(float m[][3]) +{ + const float eps = 1e-7; + float t[3][3]; + float l1, l2, l3, l4, l5, l6; + + copy_m3_m3(t, m); + transpose_m3(t); + + l1 = len_squared_v3(m[0]); + l2 = len_squared_v3(m[1]); + l3 = len_squared_v3(m[2]); + + l4 = len_squared_v3(t[0]); + l5 = len_squared_v3(t[1]); + l6 = len_squared_v3(t[2]); + + if (fabsf(l2 - l1) <= eps && + fabsf(l3 - l1) <= eps && + fabsf(l4 - l1) <= eps && + fabsf(l5 - l1) <= eps && + fabsf(l6 - l1) <= eps) + { + return 1; + } + + return 0; +} + void normalize_m3(float mat[][3]) { normalize_v3(mat[0]); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1f431122929..e94379e6600 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -164,7 +164,10 @@ typedef struct drawDMFacesSel_userData { typedef struct drawDMNormal_userData { BMEditMesh *em; + int uniform_scale; float normalsize; + float tmat[3][3]; + float imat[3][3]; } drawDMNormal_userData; typedef struct bbsObmodeMeshVerts_userData { @@ -2269,25 +2272,56 @@ void nurbs_foreachScreenVert( * logic!!! */ +static void calcDrawDMNormalScale(Object *ob, drawDMNormal_userData *data) +{ + float obmat[3][3]; + + copy_m3_m4(obmat, ob->obmat); + + data->uniform_scale = is_uniform_scaled_m3(obmat); + + if (!data->uniform_scale) { + /* inverted matrix */ + invert_m3_m3(data->imat, obmat); + + /* transposed inverted matrix */ + copy_m3_m3(data->tmat, data->imat); + transpose_m3(data->tmat); + } +} + static void draw_dm_face_normals__mapFunc(void *userData, int index, const float cent[3], const float no[3]) { drawDMNormal_userData *data = userData; BMFace *efa = EDBM_face_at_index(data->em, index); + float n[3]; if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { + if (!data->uniform_scale) { + mul_v3_m3v3(n, data->tmat, (float *) no); + normalize_v3(n); + mul_m3_v3(data->imat, n); + } + else { + copy_v3_v3(n, no); + } + glVertex3fv(cent); - glVertex3f(cent[0] + no[0] * data->normalsize, - cent[1] + no[1] * data->normalsize, - cent[2] + no[2] * data->normalsize); + glVertex3f(cent[0] + n[0] * data->normalsize, + cent[1] + n[1] * data->normalsize, + cent[2] + n[2] * data->normalsize); } } -static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm) + +static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm) { drawDMNormal_userData data; data.em = em; data.normalsize = scene->toolsettings->normalsize; + calcDrawDMNormalScale(ob, &data); + glBegin(GL_LINES); dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data); glEnd(); @@ -2317,27 +2351,42 @@ static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float BMVert *eve = EDBM_vert_at_index(data->em, index); if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { - glVertex3fv(co); + float no[3], n[3]; if (no_f) { - glVertex3f(co[0] + no_f[0] * data->normalsize, - co[1] + no_f[1] * data->normalsize, - co[2] + no_f[2] * data->normalsize); + copy_v3_v3(no, no_f); } else { - glVertex3f(co[0] + no_s[0] * (data->normalsize / 32767.0f), - co[1] + no_s[1] * (data->normalsize / 32767.0f), - co[2] + no_s[2] * (data->normalsize / 32767.0f)); + no[0] = no_s[0] / 32767.0f; + no[1] = no_s[1] / 32767.0f; + no[2] = no_s[2] / 32767.0f; } + + if (!data->uniform_scale) { + mul_v3_m3v3(n, data->tmat, (float *) no); + normalize_v3(n); + mul_m3_v3(data->imat, n); + } + else { + copy_v3_v3(n, no); + } + + glVertex3fv(co); + glVertex3f(co[0] + n[0] * data->normalsize, + co[1] + n[1] * data->normalsize, + co[2] + n[2] * data->normalsize); } } -static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm) + +static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm) { drawDMNormal_userData data; data.em = em; data.normalsize = scene->toolsettings->normalsize; + calcDrawDMNormalScale(ob, &data); + glBegin(GL_LINES); dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data); glEnd(); @@ -3167,11 +3216,11 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, if (me->drawflag & ME_DRAWNORMALS) { UI_ThemeColor(TH_NORMAL); - draw_dm_face_normals(em, scene, cageDM); + draw_dm_face_normals(em, scene, ob, cageDM); } if (me->drawflag & ME_DRAW_VNORMALS) { UI_ThemeColor(TH_VNORMAL); - draw_dm_vert_normals(em, scene, cageDM); + draw_dm_vert_normals(em, scene, ob, cageDM); } if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN | ME_DRAWEXTRA_FACEAREA | ME_DRAWEXTRA_FACEANG)) && From 95f4f243f9a5eab9ce739f9e9a46cec38a769417 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Tue, 1 May 2012 11:09:05 +0000 Subject: [PATCH 06/55] Python UI Files: * Panels only dedicated to the Game Engine, belong into properties_game.py. --- .../startup/bl_ui/properties_data_lamp.py | 51 ---------------- .../scripts/startup/bl_ui/properties_game.py | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+), 51 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py index 567833c4988..25b85591873 100644 --- a/release/scripts/startup/bl_ui/properties_data_lamp.py +++ b/release/scripts/startup/bl_ui/properties_data_lamp.py @@ -186,58 +186,7 @@ class DATA_PT_sunsky(DataButtonsPanel, Panel): sub = col.column(align=True) sub.prop(lamp, "atmosphere_inscattering", slider=True, text="Inscattering") sub.prop(lamp, "atmosphere_extinction", slider=True, text="Extinction") - -class DATA_PT_shadow_game(DataButtonsPanel, bpy.types.Panel): - bl_label = "Shadow" - COMPAT_ENGINES = {'BLENDER_GAME'} - @classmethod - def poll(cls, context): - COMPAT_LIGHTS = {'SPOT', 'SUN'} - lamp = context.lamp - engine = context.scene.render.engine - return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES) - - def draw_header(self, context): - lamp = context.lamp - - self.layout.prop(lamp, "use_shadow", text="") - - def draw(self, context): - layout = self.layout - - lamp = context.lamp - - split = layout.split() - - col = split.column() - col.prop(lamp, "shadow_color", text="") - - col = split.column() - col.prop(lamp, "use_shadow_layer", text="This Layer Only") - col.prop(lamp, "use_only_shadow") - - col = layout.column() - col.label("Buffer Type:") - col.prop(lamp, "ge_shadow_buffer_type", text="", toggle=True) - col.label("Quality:") - col = layout.column(align=True) - col.prop(lamp, "shadow_buffer_size", text="Size") - col.prop(lamp, "shadow_buffer_bias", text="Bias") - col.prop(lamp, "shadow_buffer_bleed_bias", text="Bleed Bias") - - - row = layout.row() - row.label("Clipping:") - row = layout.row(align=True) - row.prop(lamp, "shadow_buffer_clip_start", text="Clip Start") - row.prop(lamp, "shadow_buffer_clip_end", text="Clip End") - - if lamp.type == 'SUN': - row = layout.row() - row.prop(lamp, "shadow_frustum_size", text="Frustum Size") - - layout.active = lamp.use_shadow class DATA_PT_shadow(DataButtonsPanel, Panel): bl_label = "Shadow" diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index c3f1c42d8a8..9a4091b4de1 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -652,6 +652,64 @@ class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, Panel): if gs.obstacle_simulation != 'NONE': layout.prop(gs, "level_height") layout.prop(gs, "show_obstacle_simulation") + +class DataButtonsPanel(): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + +class DATA_PT_shadow_game(DataButtonsPanel, bpy.types.Panel): + bl_label = "Shadow" + COMPAT_ENGINES = {'BLENDER_GAME'} + + @classmethod + def poll(cls, context): + COMPAT_LIGHTS = {'SPOT', 'SUN'} + lamp = context.lamp + engine = context.scene.render.engine + return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + lamp = context.lamp + + self.layout.prop(lamp, "use_shadow", text="") + + def draw(self, context): + layout = self.layout + + lamp = context.lamp + + layout.active = lamp.use_shadow + + split = layout.split() + + col = split.column() + col.prop(lamp, "shadow_color", text="") + + col = split.column() + col.prop(lamp, "use_shadow_layer", text="This Layer Only") + col.prop(lamp, "use_only_shadow") + + col = layout.column() + col.label("Buffer Type:") + col.prop(lamp, "ge_shadow_buffer_type", text="", toggle=True) + col.label("Quality:") + col = layout.column(align=True) + col.prop(lamp, "shadow_buffer_size", text="Size") + col.prop(lamp, "shadow_buffer_bias", text="Bias") + col.prop(lamp, "shadow_buffer_bleed_bias", text="Bleed Bias") + + row = layout.row() + row.label("Clipping:") + row = layout.row(align=True) + row.prop(lamp, "shadow_buffer_clip_start", text="Clip Start") + row.prop(lamp, "shadow_buffer_clip_end", text="Clip End") + + if lamp.type == 'SUN': + row = layout.row() + row.prop(lamp, "shadow_frustum_size", text="Frustum Size") + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) From 2f38f09c38277f024ddbd821c5407866c9bd35ab Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 1 May 2012 11:16:34 +0000 Subject: [PATCH 07/55] Add stubs to get blenderplayer compiling --- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index a036e8a8212..55124ab227c 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -499,6 +499,8 @@ float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime) {retur void BPY_DECREF(void *pyob_ptr) {} void BPY_pyconstraint_exec(struct bPythonConstraint *con, struct bConstraintOb *cob, struct ListBase *targets) {} void macro_wrapper(struct wmOperatorType *ot, void *userdata) {} +int pyrna_id_FromPyObject(struct PyObject *obj, struct ID **id){ return 0; } +struct PyObject *pyrna_id_CreatePyObject(struct ID *id) {return NULL; } /* intern/dualcon */ struct DualConMesh; From 8bd5648ce5fcae13b7dccfd50ae51ff49dffc637 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 1 May 2012 12:14:44 +0000 Subject: [PATCH 08/55] Fox #31185: Cannot sculpt shape keys Was related on sculpting on locked keys. Issue was caused by building PBVH from base mesh which is now doesn't have shape key loaded into it as it was in 2.62. Fixed by loading coordinates from deformed mesh into PBVH like it happens for on-locked shape keys. --- source/blender/blenkernel/intern/cdderivedmesh.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 6ff612e3367..2bf199cb47f 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -267,6 +267,8 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) if (!cddm->pbvh && ob->type == OB_MESH) { SculptSession *ss= ob->sculpt; Mesh *me= ob->data; + int deformed = 0; + cddm->pbvh = BLI_pbvh_new(); cddm->pbvh_draw = can_pbvh_draw(ob, dm); @@ -275,7 +277,9 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert, me->totface, me->totvert); - if (ss->modifiers_active && ob->derivedDeform) { + deformed = ss->modifiers_active || me->key; + + if (deformed && ob->derivedDeform) { DerivedMesh *deformdm= ob->derivedDeform; float (*vertCos)[3]; int totvert; From 7dce43da21df186d66f00d7b20547b5447eb6fe7 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 1 May 2012 12:38:26 +0000 Subject: [PATCH 09/55] Fix a potential memory leak in recent vertex xsort/randomize code. --- source/blender/editors/mesh/editmesh_tools.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 8fe0a364ad3..79e18f18f51 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3683,8 +3683,11 @@ static void xsortvert_flag(bContext *C, int flag) } } /* printf("%d verts: %d to be sorted, %d unchanged…\n", totvert, sorted, unchanged);*/ - if (sorted == 0) + if (sorted == 0) { + MEM_freeN(sortblock); + MEM_freeN(unchangedblock); return; + } ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF); @@ -3942,8 +3945,11 @@ static void hashvert_flag(BMEditMesh *em, int flag, unsigned int seed) } /* protected = totvert - randomized;*/ /* printf("%d verts: %d to be randomized, %d protected…\n", totvert, randomized, protected);*/ - if (randomized == 0) + if (randomized == 0) { + MEM_freeN(block); + MEM_freeN(randblock); return; + } /* Randomize non-protected vertices indices, and create an array mapping old idx to new From cb99062ebcc60969930464df7b7a4031542ab6e8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 1 May 2012 12:51:17 +0000 Subject: [PATCH 10/55] Style cleanup: spaces around operator --- .../blender/blenkernel/intern/cdderivedmesh.c | 169 +++++++++--------- 1 file changed, 85 insertions(+), 84 deletions(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 2bf199cb47f..19e66b957eb 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -176,7 +176,7 @@ static void cdDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) int i; if (dm->numVertData) { - for (i=0; inumVertData; i++) { + for (i = 0; i < dm->numVertData; i++) { DO_MINMAX(cddm->mvert[i].co, min_r, max_r); } } @@ -226,18 +226,18 @@ static const MeshElemMap *cdDM_getPolyMap(Object *ob, DerivedMesh *dm) static int can_pbvh_draw(Object *ob, DerivedMesh *dm) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; - Mesh *me= ob->data; - int deformed= 0; + Mesh *me = ob->data; + int deformed = 0; /* active modifiers means extra deformation, which can't be handled correct * on birth of PBVH and sculpt "layer" levels, so use PBVH only for internal brush * stuff and show final DerivedMesh so user would see actual object shape */ - deformed|= ob->sculpt->modifiers_active; + deformed |= ob->sculpt->modifiers_active; /* as in case with modifiers, we can't synchronize deformation made against * PBVH and non-locked keyblock, so also use PBVH only for brushes and * final DM to give final result to user */ - deformed|= ob->sculpt->kb && (ob->shapeflag&OB_SHAPE_LOCK) == 0; + deformed |= ob->sculpt->kb && (ob->shapeflag & OB_SHAPE_LOCK) == 0; if (deformed) return 0; @@ -256,6 +256,7 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) if (!ob->sculpt) return NULL; + if (ob->sculpt->pbvh) { cddm->pbvh= ob->sculpt->pbvh; cddm->pbvh_draw = can_pbvh_draw(ob, dm); @@ -265,8 +266,8 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) * this derivedmesh is just original mesh. it's the multires subsurf dm * that this is actually for, to support a pbvh on a modified mesh */ if (!cddm->pbvh && ob->type == OB_MESH) { - SculptSession *ss= ob->sculpt; - Mesh *me= ob->data; + SculptSession *ss = ob->sculpt; + Mesh *me = ob->data; int deformed = 0; cddm->pbvh = BLI_pbvh_new(); @@ -280,12 +281,12 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) deformed = ss->modifiers_active || me->key; if (deformed && ob->derivedDeform) { - DerivedMesh *deformdm= ob->derivedDeform; + DerivedMesh *deformdm = ob->derivedDeform; float (*vertCos)[3]; int totvert; - totvert= deformdm->getNumVerts(deformdm); - vertCos= MEM_callocN(3*totvert*sizeof(float), "cdDM_getPBVH vertCos"); + totvert = deformdm->getNumVerts(deformdm); + vertCos = MEM_callocN(3*totvert*sizeof(float), "cdDM_getPBVH vertCos"); deformdm->getVertCos(deformdm, vertCos); BLI_pbvh_apply_vertCos(cddm->pbvh, vertCos); MEM_freeN(vertCos); @@ -316,7 +317,7 @@ static void cdDM_drawVerts(DerivedMesh *dm) MVert *mv = cddm->mvert; int i; - if ( GPU_buffer_legacy(dm) ) { + if (GPU_buffer_legacy(dm)) { glBegin(GL_POINTS); for (i = 0; i < dm->numVertData; i++, mv++) glVertex3fv(mv->co); @@ -324,7 +325,7 @@ static void cdDM_drawVerts(DerivedMesh *dm) } else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */ GPU_vertex_setup(dm); - if ( !GPU_buffer_legacy(dm) ) { + if (!GPU_buffer_legacy(dm)) { if (dm->drawObject->tot_triangle_point) glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_triangle_point); else @@ -342,7 +343,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm) int i; if (mf) { - if ( GPU_buffer_legacy(dm) ) { + if (GPU_buffer_legacy(dm)) { glBegin(GL_LINES); for (i = 0; i < dm->numTessFaceData; i++, mf++, tf++) { if (!(mf->flag&ME_HIDE)) { @@ -374,7 +375,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm) int curpos = 0; GPU_uvedge_setup(dm); - if ( !GPU_buffer_legacy(dm) ) { + if (!GPU_buffer_legacy(dm)) { for (i = 0; i < dm->numTessFaceData; i++, mf++) { if (!(mf->flag&ME_HIDE)) { draw = 1; @@ -412,7 +413,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges MEdge *medge = cddm->medge; int i; - if ( GPU_buffer_legacy(dm) ) { + if (GPU_buffer_legacy(dm)) { DEBUG_VBO("Using legacy code. cdDM_drawEdges\n"); glBegin(GL_LINES); for (i = 0; i < dm->numEdgeData; i++, medge++) { @@ -464,7 +465,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) MEdge *medge = cddm->medge; int i; - if ( GPU_buffer_legacy(dm) ) { + if (GPU_buffer_legacy(dm)) { DEBUG_VBO("Using legacy code. cdDM_drawLooseEdges\n"); glBegin(GL_LINES); for (i = 0; i < dm->numEdgeData; i++, medge++) { @@ -481,7 +482,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) int draw = 1; GPU_edge_setup(dm); - if ( !GPU_buffer_legacy(dm) ) { + if (!GPU_buffer_legacy(dm)) { for (i = 0; i < dm->numEdgeData; i++, medge++) { if (medge->flag&ME_LOOSEEDGE) { draw = 1; @@ -534,7 +535,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, return; } - if ( GPU_buffer_legacy(dm) ) { + if (GPU_buffer_legacy(dm)) { DEBUG_VBO("Using legacy code. cdDM_drawFacesSolid\n"); glBegin(glmode = GL_QUADS); for (a = 0; a < dm->numTessFaceData; a++, mface++) { @@ -586,7 +587,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */ GPU_vertex_setup(dm); GPU_normal_setup(dm); - if ( !GPU_buffer_legacy(dm) ) { + if (!GPU_buffer_legacy(dm)) { glShadeModel(GL_SMOOTH); for (a = 0; a < dm->drawObject->totmaterial; a++) { if (setMaterial(dm->drawObject->materials[a].mat_nr + 1, NULL)) { @@ -622,7 +623,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, cdDM_update_normals_from_pbvh(dm); - if ( GPU_buffer_legacy(dm) ) { + if (GPU_buffer_legacy(dm)) { DEBUG_VBO("Using legacy code. cdDM_drawFacesTex_common\n"); for (i = 0; i < dm->numTessFaceData; i++, mf++) { MVert *mvert; @@ -646,7 +647,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, if (draw_option != DM_DRAW_OPTION_SKIP) { if (draw_option != DM_DRAW_OPTION_NO_MCOL && mcol) - cp= (unsigned char*) &mcol[i*4]; + cp = (unsigned char*) &mcol[i*4]; if (!(mf->flag&ME_SMOOTH)) { if (nors) { @@ -706,19 +707,19 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, GPU_uv_setup(dm); if ( col != NULL ) { #if 0 - if ( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) { + if (realcol && dm->drawObject->colType == CD_TEXTURE_MCOL) { col = 0; } - else if ( mcol && dm->drawObject->colType == CD_MCOL ) { + else if (mcol && dm->drawObject->colType == CD_MCOL) { col = 0; } - if ( col != 0 ) + if (col != 0) #endif { unsigned char *colors = MEM_mallocN(dm->getNumTessFaces(dm)*4*3*sizeof(unsigned char), "cdDM_drawFacesTex_common"); - for ( i=0; i < dm->getNumTessFaces(dm); i++ ) { - for ( j=0; j < 4; j++ ) { + for (i = 0; i < dm->getNumTessFaces(dm); i++) { + for (j = 0; j < 4; j++) { /* bgr -> rgb is intentional (and stupid), but how its stored internally */ colors[i*12+j*3] = col[i*4+j].b; colors[i*12+j*3+1] = col[i*4+j].g; @@ -735,9 +736,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, GPU_color_setup(dm); } - if ( !GPU_buffer_legacy(dm) ) { + if (!GPU_buffer_legacy(dm)) { int tottri = dm->drawObject->tot_triangle_point/3; - int next_actualFace= dm->drawObject->triangle_to_mface[0]; + int next_actualFace = dm->drawObject->triangle_to_mface[0]; glShadeModel(GL_SMOOTH); /* lastFlag = 0; */ /* UNUSED */ @@ -765,7 +766,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, } /* flush buffer if current triangle isn't drawable or it's last triangle */ - flush= (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1); + flush = (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1); if (!flush && compareDrawOptions) { /* also compare draw options and flush buffer if they're different @@ -774,9 +775,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, } if (flush) { - int first= startFace*3; + int first = startFace*3; /* Add one to the length if we're drawing at the end of the array */ - int count= (i-startFace+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3; + int count = (i-startFace+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3; if (count) { if (col) @@ -829,13 +830,13 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, /* back-buffer always uses legacy since VBO's would need the * color array temporarily overwritten for drawing, then reset. */ - if ( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) { + if (GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) { DEBUG_VBO("Using legacy code. cdDM_drawMappedFaces\n"); for (i = 0; i < dm->numTessFaceData; i++, mf++) { int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mf->flag & ME_SMOOTH); - DMDrawOption draw_option= DM_DRAW_OPTION_NORMAL; + DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL; - orig= (index==NULL) ? i : *index++; + orig = (index==NULL) ? i : *index++; if (orig == ORIGINDEX_NONE) draw_option= setMaterial(mf->mat_nr + 1, NULL); @@ -908,7 +909,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, GPU_normal_setup(dm); if ( useColors && mc ) GPU_color_setup(dm); - if ( !GPU_buffer_legacy(dm) ) { + if (!GPU_buffer_legacy(dm)) { int tottri = dm->drawObject->tot_triangle_point/3; glShadeModel(GL_SMOOTH); @@ -921,12 +922,12 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, } else { /* we need to check if the next material changes */ - int next_actualFace= dm->drawObject->triangle_to_mface[0]; + int next_actualFace = dm->drawObject->triangle_to_mface[0]; - for ( i = 0; i < tottri; i++ ) { + for (i = 0; i < tottri; i++) { //int actualFace = dm->drawObject->triangle_to_mface[i]; int actualFace = next_actualFace; - MFace *mface= mf + actualFace; + MFace *mface = mf + actualFace; /*int drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */ DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL; int flush = 0; @@ -934,7 +935,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, if (i != tottri-1) next_actualFace= dm->drawObject->triangle_to_mface[i+1]; - orig= (index==NULL) ? actualFace : index[actualFace]; + orig = (index==NULL) ? actualFace : index[actualFace]; if (orig == ORIGINDEX_NONE) draw_option= setMaterial(mface->mat_nr + 1, NULL); @@ -946,19 +947,19 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, * invisible triangle or at the end of the array */ /* flush buffer if current triangle isn't drawable or it's last triangle... */ - flush= (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1); + flush = (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1); /* ... or when material setting is dissferent */ - flush|= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr; + flush |= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr; if (!flush && compareDrawOptions) { - flush|= compareDrawOptions(userData, actualFace, next_actualFace) == 0; + flush |= compareDrawOptions(userData, actualFace, next_actualFace) == 0; } if (flush) { - int first= prevstart*3; + int first = prevstart*3; /* Add one to the length if we're drawing at the end of the array */ - int count= (i-prevstart+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3; + int count = (i-prevstart+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3; if (count) glDrawArrays(GL_TRIANGLES, first, count); @@ -1126,21 +1127,21 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, GPU_vertex_setup(dm); GPU_normal_setup(dm); - if ( !GPU_buffer_legacy(dm) ) { - for ( i = 0; i < dm->drawObject->tot_triangle_point/3; i++ ) { + if (!GPU_buffer_legacy(dm)) { + for (i = 0; i < dm->drawObject->tot_triangle_point/3; i++) { a = dm->drawObject->triangle_to_mface[i]; mface = mf + a; new_matnr = mface->mat_nr + 1; - if (new_matnr != matnr ) { + if (new_matnr != matnr) { numfaces = curface - start; - if ( numfaces > 0 ) { + if (numfaces > 0) { - if ( dodraw ) { + if (dodraw) { - if ( numdata != 0 ) { + if (numdata != 0) { GPU_buffer_unlock(buffer); @@ -1149,7 +1150,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, glDrawArrays(GL_TRIANGLES, start*3, numfaces*3); - if ( numdata != 0 ) { + if (numdata != 0) { GPU_buffer_free(buffer); @@ -1189,16 +1190,16 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, datatypes[numdata].type = GL_FLOAT; numdata++; } - if ( numdata != 0 ) { + if (numdata != 0) { elementsize = GPU_attrib_element_size(datatypes, numdata); buffer = GPU_buffer_alloc(elementsize * dm->drawObject->tot_triangle_point); - if ( buffer == NULL ) { + if (buffer == NULL) { GPU_buffer_unbind(); dm->drawObject->legacy = 1; return; } varray = GPU_buffer_lock_stream(buffer); - if ( varray == NULL ) { + if (varray == NULL) { GPU_buffer_unbind(); GPU_buffer_free(buffer); dm->drawObject->legacy = 1; @@ -1209,7 +1210,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, /* if the buffer was set, don't use it again. * prevdraw was assumed true but didnt run so set to false - [#21036] */ /* prevdraw= 0; */ /* UNUSED */ - buffer= NULL; + buffer = NULL; } } } @@ -1300,9 +1301,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, } } numfaces = curface - start; - if ( numfaces > 0 ) { - if ( dodraw ) { - if ( numdata != 0 ) { + if (numfaces > 0) { + if (dodraw) { + if (numdata != 0) { GPU_buffer_unlock(buffer); GPU_interleaved_attrib_setup(buffer, datatypes, numdata); } @@ -1761,23 +1762,23 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata, MLoopUV *mloopuv; int i, j, hasPCol = CustomData_has_layer(&bm->ldata, CD_PREVIEW_MLOOPCOL); - for (i=0; i < numTex; i++) { + for (i = 0; i < numTex; i++) { texface = CustomData_get_n(facedata, CD_MTFACE, cdindex, i); texpoly = CustomData_bmesh_get_n(&bm->pdata, f->head.data, CD_MTEXPOLY, i); ME_MTEXFACE_CPY(texface, texpoly); - for (j=0; j<3; j++) { + for (j = 0 ; j < 3; j++) { l = l3[j]; mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); copy_v2_v2(texface->uv[j], mloopuv->uv); } } - for (i=0; i < numCol; i++) { + for (i = 0; i < numCol; i++) { mcol = CustomData_get_n(facedata, CD_MCOL, cdindex, i); - for (j=0; j<3; j++) { + for (j = 0; j < 3; j++) { l = l3[j]; mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i); MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]); @@ -1787,7 +1788,7 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata, if (hasPCol) { mcol = CustomData_get(facedata, cdindex, CD_PREVIEW_MCOL); - for (j=0; j<3; j++) { + for (j = 0; j < 3; j++) { l = l3[j]; mloopcol = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_PREVIEW_MLOOPCOL); MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]); @@ -1853,7 +1854,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis index = dm->getVertDataArray(dm, CD_ORIGINDEX); eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (i=0; eve; eve=BM_iter_step(&iter), i++, index++) { + for (i = 0; eve; eve = BM_iter_step(&iter), i++, index++) { MVert *mv = &mvert[i]; copy_v3_v3(mv->co, eve->co); @@ -1875,7 +1876,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis index = dm->getEdgeDataArray(dm, CD_ORIGINDEX); eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); - for (i=0; eed; eed=BM_iter_step(&iter), i++, index++) { + for (i = 0; eed; eed = BM_iter_step(&iter), i++, index++) { MEdge *med = &medge[i]; BM_elem_index_set(eed, i); /* set_inline */ @@ -1926,7 +1927,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX); j = 0; efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); - for (i=0; efa; i++, efa=BM_iter_step(&iter), index++) { + for (i = 0; efa; i++, efa = BM_iter_step(&iter), index++) { BMLoop *l; MPoly *mp = &mpoly[i]; @@ -2214,7 +2215,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) /*fill newl with destination vertex indices*/ mv = cddm->mvert; c = 0; - for (i=0; inumVertData; i++, mv++) { + for (i = 0; i < dm->numVertData; i++, mv++) { if (vtargetmap[i] == -1) { BLI_array_append(oldv, i); newv[i] = c++; @@ -2223,7 +2224,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) } /*now link target vertices to destination indices*/ - for (i=0; inumVertData; i++) { + for (i = 0; i < dm->numVertData; i++) { if (vtargetmap[i] != -1) { newv[i] = newv[vtargetmap[i]]; } @@ -2231,7 +2232,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) /*find-replace merged vertices with target vertices*/ ml = cddm->mloop; - for (i=0; iv] != -1) { ml->v = vtargetmap[ml->v]; } @@ -2240,7 +2241,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) /*now go through and fix edges and faces*/ med = cddm->medge; c = 0; - for (i=0; inumEdgeData; i++, med++) { + for (i = 0; i < dm->numEdgeData; i++, med++) { if (LIKELY(med->v1 != med->v2)) { const unsigned int v1 = (vtargetmap[med->v1] != -1) ? vtargetmap[med->v1] : med->v1; @@ -2264,13 +2265,13 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) } mp = cddm->mpoly; - for (i=0; imloop + mp->loopstart; c = 0; - for (j=0; jtotloop; j++, ml++) { + for (j = 0; j < mp->totloop; j++, ml++) { med = cddm->medge + ml->e; if (LIKELY(med->v1 != med->v2)) { newl[j+mp->loopstart] = BLI_array_count(mloop); @@ -2296,7 +2297,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) /*update edge indices and copy customdata*/ med = medge; - for (i=0; idm.numEdgeData; i++, med++) { + for (i = 0; i < cddm2->dm.numEdgeData; i++, med++) { if (newv[med->v1] != -1) med->v1 = newv[med->v1]; if (newv[med->v2] != -1) @@ -2307,7 +2308,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) /*update loop indices and copy customdata*/ ml = mloop; - for (i=0; idm.numLoopData; i++, ml++) { + for (i = 0; i < cddm2->dm.numLoopData; i++, ml++) { if (newe[ml->e] != -1) ml->e = newe[ml->e]; if (newv[ml->v] != -1) @@ -2318,13 +2319,13 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) /*copy vertex customdata*/ mv = mvert; - for (i=0; idm.numVertData; i++, mv++) { + for (i = 0; i < cddm2->dm.numVertData; i++, mv++) { CustomData_copy_data(&dm->vertData, &cddm2->dm.vertData, oldv[i], i, 1); } /*copy poly customdata*/ mp = mpoly; - for (i=0; idm.numPolyData; i++, mp++) { + for (i = 0; i < cddm2->dm.numPolyData; i++, mp++) { CustomData_copy_data(&dm->polyData, &cddm2->dm.polyData, oldp[i], i, 1); } @@ -2435,14 +2436,14 @@ void CDDM_calc_edges(DerivedMesh *dm) med = cddm->medge; if (med) { - for (i=0; i < numEdges; i++, med++) { + for (i = 0; i < numEdges; i++, med++) { BLI_edgehash_insert(eh, med->v1, med->v2, SET_INT_IN_POINTER(i+1)); } } - for (i=0; i < maxFaces; i++, mp++) { + for (i = 0; i < maxFaces; i++, mp++) { ml = cddm->mloop + mp->loopstart; - for (j=0; jtotloop; j++, ml++) { + for (j = 0; j < mp->totloop; j++, ml++) { v1 = ml->v; v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v; if (!BLI_edgehash_haskey(eh, v1, v2)) { @@ -2481,9 +2482,9 @@ void CDDM_calc_edges(DerivedMesh *dm) cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE); mp = cddm->mpoly; - for (i=0; i < maxFaces; i++, mp++) { + for (i = 0; i < maxFaces; i++, mp++) { ml = cddm->mloop + mp->loopstart; - for (j=0; jtotloop; j++, ml++) { + for (j = 0; j < mp->totloop; j++, ml++) { v1 = ml->v; v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, v1, v2)); @@ -2605,13 +2606,13 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm) /*build edge hash*/ me = cddm->medge; - for (i=0; idm.numEdgeData; i++, me++) { + for (i = 0; i < cddm->dm.numEdgeData; i++, me++) { BLI_edgehash_insert(eh, me->v1, me->v2, SET_INT_IN_POINTER(i)); } mf = cddm->mface; totloop = 0; - for (i=0; idm.numTessFaceData; i++, mf++) { + for (i = 0; i < cddm->dm.numTessFaceData; i++, mf++) { totloop += mf->v4 ? 4 : 3; } @@ -2640,7 +2641,7 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm) mp = cddm->mpoly; ml = cddm->mloop; l = 0; - for (i=0; idm.numTessFaceData; i++, mf++, mp++, polyindex++) { + for (i = 0; i < cddm->dm.numTessFaceData; i++, mf++, mp++, polyindex++) { mp->flag = mf->flag; mp->loopstart = l; mp->mat_nr = mf->mat_nr; From 7a87b89a6040a9d1c7f29a679972da89af96b50a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 1 May 2012 13:10:36 +0000 Subject: [PATCH 11/55] Bugfix [#30097] Motion paths range not correct - Part B (Recalculating existing paths with new ranges) If an object/bone already had a motion path, it was not possible to recalculate it over a different frame range without firstly clearing these paths. This was both a confusing and troublesome workflow, and has since been removed. --- source/blender/blenkernel/intern/anim.c | 29 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 7afcd828573..ce66d828a98 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -144,9 +144,11 @@ void animviz_free_motionpath(bMotionPath *mpath) /* ------------------- */ /* Setup motion paths for the given data - * - scene: current scene (for frame ranges, etc.) - * - ob: object to add paths for (must be provided) - * - pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed) + * - Only used when explicitly calculating paths on bones which may/may not be consider already + * + * < scene: current scene (for frame ranges, etc.) + * < ob: object to add paths for (must be provided) + * < pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed) */ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan) { @@ -180,14 +182,27 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec } /* if there is already a motionpath, just return that, - * but provided it's settings are ok + * provided it's settings are ok (saves extra free+alloc) */ if (*dst != NULL) { + int expected_length = avs->path_ef - avs->path_sf; + mpath= *dst; - /* if range is not invalid, and/or length is set ok, just return */ - if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) - return mpath; + /* path is "valid" if length is valid, but must also be of the same length as is being requested */ + if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) { + /* outer check ensures that we have some curve data for this path */ + if (mpath->length == expected_length) { + /* return/use this as it is already valid length */ + return mpath; + } + else { + /* clear the existing path (as the range has changed), and reallocate below */ + if (mpath->points) + MEM_freeN(mpath->points); + mpath->points = NULL; + } + } } else { /* create a new motionpath, and assign it */ From 2691483e35a157d6d8cba017a06dcc91a7b532b8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 13:32:55 +0000 Subject: [PATCH 12/55] stule cleanup: pep8 --- .../startup/bl_ui/properties_data_modifier.py | 4 ++-- .../scripts/startup/bl_ui/properties_game.py | 19 ++++++++++--------- .../startup/bl_ui/properties_physics_smoke.py | 3 +-- release/scripts/startup/bl_ui/space_info.py | 15 ++++++++------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 9c4e79c4c34..b46f0fc8923 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -441,11 +441,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.separator() split = layout.split() - + col = split.column() col.prop(md, "time") col.prop(md, "resolution") - + col = split.column() col.prop(md, "spatial_size") col.prop(md, "depth") diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 9a4091b4de1..2aff07bd98e 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -652,14 +652,15 @@ class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, Panel): if gs.obstacle_simulation != 'NONE': layout.prop(gs, "level_height") layout.prop(gs, "show_obstacle_simulation") - + + class DataButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "data" - - -class DATA_PT_shadow_game(DataButtonsPanel, bpy.types.Panel): + + +class DATA_PT_shadow_game(DataButtonsPanel, Panel): bl_label = "Shadow" COMPAT_ENGINES = {'BLENDER_GAME'} @@ -669,19 +670,19 @@ class DATA_PT_shadow_game(DataButtonsPanel, bpy.types.Panel): lamp = context.lamp engine = context.scene.render.engine return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES) - + def draw_header(self, context): lamp = context.lamp - + self.layout.prop(lamp, "use_shadow", text="") def draw(self, context): layout = self.layout lamp = context.lamp - + layout.active = lamp.use_shadow - + split = layout.split() col = split.column() @@ -690,7 +691,7 @@ class DATA_PT_shadow_game(DataButtonsPanel, bpy.types.Panel): col = split.column() col.prop(lamp, "use_shadow_layer", text="This Layer Only") col.prop(lamp, "use_only_shadow") - + col = layout.column() col.label("Buffer Type:") col.prop(lamp, "ge_shadow_buffer_type", text="", toggle=True) diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index d3ab616a793..012aefebb6e 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -100,7 +100,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): sub.prop(flow, "use_absolute") sub.prop(flow, "density") sub.prop(flow, "temperature") - + elif md.smoke_type == 'COLLISION': coll = md.coll_settings @@ -108,7 +108,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): col = split.column() col.prop(coll, "collision_type") - class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 778e66bffcc..0c38829b54f 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -348,21 +348,22 @@ class INFO_MT_render(Menu): layout.operator("render.view_show") layout.operator("render.play_rendered_anim") - -class INFO_MT_window(bpy.types.Menu): + + +class INFO_MT_window(Menu): bl_label = "Window" - + def draw(self, context): import sys - + layout = self.layout - + layout.operator("wm.window_duplicate") layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER') if sys.platform[:3] == "win": layout.separator() layout.operator("wm.console_toggle", icon='CONSOLE') - + class INFO_MT_help(Menu): bl_label = "Help" @@ -389,7 +390,7 @@ class INFO_MT_help(Menu): layout.operator("anim.update_data_paths", text="FCurve/Driver Version fix", icon='HELP') layout.operator("logic.texface_convert", text="TexFace to Material Convert", icon='GAME') layout.separator() - + layout.operator("wm.splash", icon='BLENDER') if __name__ == "__main__": # only for live edit. From 75a468f61eb9cd8523768a0d1b49af97ef55e196 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 1 May 2012 13:51:50 +0000 Subject: [PATCH 13/55] Comment fixes - code for Object Motion Paths still referred to Bones --- source/blender/editors/object/object_edit.c | 23 ++++++++----------- .../editors/space_view3d/drawanimviz.c | 9 ++++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8e5ab3fc9e8..8ab1d1372b7 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1102,7 +1102,7 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot) /* ********************************************** */ /* Motion Paths */ -/* For the object with pose/action: update paths for those that have got them +/* For the objects with animation: update paths for those that have got them * This should selectively update paths that exist... * * To be called from various tools that do incremental updates @@ -1114,7 +1114,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) /* loop over objects in scene */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { - /* set flag to force recalc, then grab the relevant bones to target */ + /* set flag to force recalc, then grab path(s) from object */ ob->avs.recalc |= ANIMVIZ_RECALC_PATHS; animviz_get_object_motionpaths(ob, &targets); } @@ -1125,9 +1125,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) BLI_freelistN(&targets); } -/* For the object with pose/action: create path curves for selected bones - * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range - */ +/* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */ static int object_calculate_paths_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1135,17 +1133,16 @@ static int object_calculate_paths_exec(bContext *C, wmOperator *op) /* set up path data for bones being calculated */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { - /* verify makes sure that the selected bone has a bone with the appropriate settings */ + /* verify that the selected object has the appropriate settings */ animviz_verify_motionpaths(op->reports, scene, ob, NULL); } CTX_DATA_END; - /* calculate the bones that now have motionpaths... */ - // TODO: only make for the selected bones? + /* calculate the paths for objects that have them (and are tagged to get refreshed) */ ED_objects_recalculate_paths(C, scene); /* notifiers for updates */ - WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -1155,7 +1152,7 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) /* identifiers */ ot->name = "Calculate Object Paths"; ot->idname = "OBJECT_OT_paths_calculate"; - ot->description = "Calculate paths for the selected bones"; + ot->description = "Calculate motion paths for the selected objects"; /* api callbacks */ ot->exec = object_calculate_paths_exec; @@ -1167,7 +1164,7 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) /* --------- */ -/* for the object with pose/action: clear path curves for selected bones only */ +/* Clear motion paths for selected objects only */ void ED_objects_clear_paths(bContext *C) { /* loop over objects in scene */ @@ -1189,7 +1186,7 @@ static int object_clear_paths_exec(bContext *C, wmOperator *UNUSED(op)) ED_objects_clear_paths(C); /* notifiers for updates */ - WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -1199,7 +1196,7 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Object Paths"; ot->idname = "OBJECT_OT_paths_clear"; - ot->description = "Clear path caches for selected bones"; + ot->description = "Clear path caches for selected objects"; /* api callbacks */ ot->exec = object_clear_paths_exec; diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index d0e344ef0d5..ca5b21012aa 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -193,8 +193,9 @@ void draw_motion_path_instance(Scene *scene, glVertex3fv(mpv->co); glEnd(); - /* Draw big green dot where the current frame is */ - // NOTE: only do this when drawing keyframes for now... + /* Draw big green dot where the current frame is + * NOTE: this is only done when keyframes are shown, since this adds similar types of clutter + */ if ((avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) && (sfra < CFRA) && (CFRA <= efra)) { @@ -245,7 +246,7 @@ void draw_motion_path_instance(Scene *scene, /* Keyframes - dots and numbers */ if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) { unsigned char col[4]; - + AnimData *adt = BKE_animdata_from_id(&ob->id); DLRBT_Tree keys; @@ -273,7 +274,7 @@ void draw_motion_path_instance(Scene *scene, /* Draw slightly-larger yellow dots at each keyframe */ UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col); col[3] = 255; - + glPointSize(4.0f); // XXX perhaps a bit too big glColor3ubv(col); From b09ac48d0f95c42848fb25973f23efba9bba6417 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 1 May 2012 14:13:14 +0000 Subject: [PATCH 14/55] =?UTF-8?q?Fix=20own=20error=20in=20BM=5Fmesh=5Frema?= =?UTF-8?q?p(),=20forgot=20to=20remap=20edge=20pointers=20in=20disk=5Flink?= =?UTF-8?q?s=20of=20edges,=20so=20wasn=E2=80=99t=20working=20at=20all=20wi?= =?UTF-8?q?th=20edges=20remapping!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/bmesh/intern/bmesh_mesh.c | 31 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index bd6eb7ae149..cb66486cd9e 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -672,8 +672,8 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) BMEdge *new_edp = edges_pool[*new_idx]; *new_edp = *ed; BLI_ghash_insert(eptr_map, (void *)*edp, (void *)new_edp); +/* printf("mapping edge from %d to %d (%p/%p to %p)\n", i, *new_idx, *edp, edges_pool[i], new_edp);*/ } - bm->elem_index_dirty |= BM_EDGE; MEM_freeN(edges_pool); @@ -722,13 +722,30 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) } } - /* Edges' pointers, only vert pointers (as we don't mess with loops!)... */ - if (vptr_map) { + /* Edges' pointers, only vert pointers (as we don't mess with loops!), and - ack! - edge pointers, + * as we have to handle disklinks... */ + if (vptr_map || eptr_map) { BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { -/* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/ -/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/ - ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1); - ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2); + if (vptr_map) { +/* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/ +/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/ + ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1); + ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2); + } + if (eptr_map) { +/* printf("Edge v1_disk_link prev: %p -> %p\n", ed->v1_disk_link.prev,*/ +/* BLI_ghash_lookup(eptr_map, (const void*)ed->v1_disk_link.prev));*/ +/* printf("Edge v1_disk_link next: %p -> %p\n", ed->v1_disk_link.next,*/ +/* BLI_ghash_lookup(eptr_map, (const void*)ed->v1_disk_link.next));*/ +/* printf("Edge v2_disk_link prev: %p -> %p\n", ed->v2_disk_link.prev,*/ +/* BLI_ghash_lookup(eptr_map, (const void*)ed->v2_disk_link.prev));*/ +/* printf("Edge v2_disk_link next: %p -> %p\n", ed->v2_disk_link.next,*/ +/* BLI_ghash_lookup(eptr_map, (const void*)ed->v2_disk_link.next));*/ + ed->v1_disk_link.prev = BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.prev); + ed->v1_disk_link.next = BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.next); + ed->v2_disk_link.prev = BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.prev); + ed->v2_disk_link.next = BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.next); + } } } From 3f82dcb2df77cbac825c400405d63dc663d00928 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 May 2012 15:21:29 +0000 Subject: [PATCH 15/55] Fix #31110: selected to active baking did not properly check to see if the object was actually selected, so e.g. baking shadows cast from non-selected objects did not work. --- source/blender/render/intern/raytrace/rayobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index a2773ba218d..ac29d9e78ee 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -127,7 +127,7 @@ MALWAYS_INLINE int vlr_check_intersect_solid(Isect *UNUSED(is), ObjectInstanceRe MALWAYS_INLINE int vlr_check_bake(Isect *is, ObjectInstanceRen* obi, VlakRen *UNUSED(vlr)) { - return (obi->obr->ob != is->userdata); + return (obi->obr->ob != is->userdata) && (obi->obr->ob->flag & SELECT); } /* Ray Triangle/Quad Intersection */ From fcb84663cd42dfdbb15204a6d65cec82d5ef110d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 1 May 2012 15:59:28 +0000 Subject: [PATCH 16/55] Fix #31162: Applying textures to rigged models causes crash and no textures in appear in edit mode Issue was caused by doing stuff like binding textures from glBegin/glEnd block. --- source/blender/blenkernel/intern/editderivedmesh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 884e4e15c8b..5e3f886c762 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -815,7 +815,6 @@ static void emDM_drawFacesTex_common( if (vertexCos) { BM_mesh_elem_index_ensure(bm, BM_VERT); - glBegin(GL_TRIANGLES); for (i=0; itottri; i++) { BMLoop **ls = em->looptris[i]; MTexPoly *tp= has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL; @@ -839,6 +838,7 @@ static void emDM_drawFacesTex_common( if (draw_option != DM_DRAW_OPTION_SKIP) { + glBegin(GL_TRIANGLES); if (!drawSmooth) { glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]); @@ -880,9 +880,9 @@ static void emDM_drawFacesTex_common( glNormal3fv(vertexNos[BM_elem_index_get(ls[2]->v)]); glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]); } + glEnd(); } } - glEnd(); } else { BM_mesh_elem_index_ensure(bm, BM_VERT); From ffc9fcb1a1d58bb03b5cb60dc40f0fd91c3e8f3c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 1 May 2012 16:19:13 +0000 Subject: [PATCH 17/55] Motion Paths GUI Cleanup This commit refactors the way that the Motion Paths GUI works. The key problems this tries to address are: 1) Mode error - Confusion about whether we're dealing with the Object or Pose level Motion Paths panel 2) Display settings vs Baking Settings In line with the original design intentions for the 2.5/6 Properties Editor, I've now split out the actual baking-related settings away from the Properties Editor: * Now, when clicking "Calculate Paths" from the toolbar, you'll be prompted with a dialog to select the start/end frames (and for bones, whether to bake from heads or tails). This is less confusing than relying on firstly setting the range via the display range settings (and baking using that), since many people apparently only used the "around current" mode, and were confused why things weren't working * Added a display of the frame ranges of the current baked Motion Path on the active Object/Bone. This makes it clearer/easier to debug if the path suddenly starts disappearing after a certain frame. * Replaced Calculate/Clear Paths in the panels with a single "Update" button if there's already a baked Motion Path. Hopefully these changes (in combination with some of the other bugfixes) will make it more obvious how everything works. --- .../startup/bl_ui/properties_animviz.py | 52 +++++++++++--- .../startup/bl_ui/properties_data_armature.py | 14 ++-- .../startup/bl_ui/properties_object.py | 12 ++-- source/blender/blenkernel/intern/anim.c | 4 +- source/blender/editors/armature/poseobject.c | 72 ++++++++++++++----- source/blender/editors/object/object_edit.c | 36 ++++++++++ source/blender/makesrna/RNA_enum_types.h | 2 + source/blender/makesrna/intern/rna_animviz.c | 14 ++-- 8 files changed, 152 insertions(+), 54 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index 93feb8adc7a..3f25006766e 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -31,16 +31,18 @@ class MotionPathButtonsPanel(): bl_label = "Motion Paths" bl_options = {'DEFAULT_CLOSED'} - def draw_settings(self, context, avs, bones=False): + def draw_settings(self, context, avs, mpath, bones=False): layout = self.layout mps = avs.motion_path - + + # Display Range layout.prop(mps, "type", expand=True) split = layout.split() col = split.column() + col.label(text="Display Range:") sub = col.column(align=True) if (mps.type == 'CURRENT_FRAME'): sub.prop(mps, "frame_before", text="Before") @@ -48,18 +50,46 @@ class MotionPathButtonsPanel(): elif (mps.type == 'RANGE'): sub.prop(mps, "frame_start", text="Start") sub.prop(mps, "frame_end", text="End") - + sub.prop(mps, "frame_step", text="Step") - if bones: - col.row().prop(mps, "bake_location", expand=True) - + col = split.column() - col.label(text="Display:") - col.prop(mps, "show_frame_numbers", text="Frame Numbers") - col.prop(mps, "show_keyframe_highlight", text="Keyframes") if bones: - col.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes") - col.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers") + col.label(text="Cache for Bone:") + else: + col.label(text="Cache:") + + if mpath: + sub = col.column(align=True) + sub.enabled = False + sub.prop(mpath, "frame_start", text="From") + sub.prop(mpath, "frame_end", text="To") + + sub = col.column() # align=True + sub.operator_context = 'EXEC_DEFAULT' + if bones: + col.operator("pose.paths_calculate", text="Update", icon='BONE_DATA') + else: + col.operator("object.paths_calculate", text="Update", icon='OBJECT_DATA') + else: + col.label(text="Not available yet...", icon='ERROR') + col.label(text="Calculate Paths first", icon='INFO') + + + # Display Settings + split = layout.split() + + col = split.column() + col.label(text="Show:") + col.prop(mps, "show_frame_numbers", text="Frame Numbers") + + col = split.column() + col.prop(mps, "show_keyframe_highlight", text="Keyframes") + sub = col.column() + sub.enabled = mps.show_keyframe_highlight + if bones: + sub.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes") + sub.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers") # FIXME: this panel still needs to be ported so that it will work correctly with animviz diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 08529a0423d..63dc64190bb 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -308,14 +308,12 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel): layout = self.layout ob = context.object - - self.draw_settings(context, ob.pose.animation_visualisation, bones=True) - - layout.separator() - - split = layout.split() - split.operator("pose.paths_calculate", text="Calculate Paths") - split.operator("pose.paths_clear", text="Clear Paths") + avs = ob.pose.animation_visualisation + + pchan = context.active_pose_bone + mpath = pchan.motion_path if pchan else None + + self.draw_settings(context, avs, mpath, bones=True) class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index d7b4b1a2b44..cdef7e703e5 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -299,14 +299,10 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel): layout = self.layout ob = context.object - - self.draw_settings(context, ob.animation_visualisation) - - layout.separator() - - row = layout.row() - row.operator("object.paths_calculate", text="Calculate Paths") - row.operator("object.paths_clear", text="Clear Paths") + avs = ob.animation_visualisation + mpath = ob.motion_path + + self.draw_settings(context, avs, mpath) class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index ce66d828a98..afa4723bc6d 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -198,9 +198,7 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec } else { /* clear the existing path (as the range has changed), and reallocate below */ - if (mpath->points) - MEM_freeN(mpath->points); - mpath->points = NULL; + animviz_free_motionpath_cache(mpath); } } } diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 1bc6bc0bf07..e0dba30e0b2 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -197,24 +197,54 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob) BLI_freelistN(&targets); } +/* show popup to determine settings */ +static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt) +{ + Object *ob = object_pose_armature_get(CTX_data_active_object(C)); + + if (ELEM(NULL, ob, ob->pose)) + return OPERATOR_CANCELLED; + + /* set default settings from existing/stored settings */ + { + bAnimVizSettings *avs = &ob->pose->avs; + PointerRNA avs_ptr; + + RNA_int_set(op->ptr, "start_frame", avs->path_sf); + RNA_int_set(op->ptr, "end_frame", avs->path_ef); + + RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr); + RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location")); + } + + /* show popup dialog to allow editing of range... */ + // FIXME: hardcoded dimensions here are just arbitrary + return WM_operator_props_dialog_popup(C, op, 200, 200); +} + /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int pose_calculate_paths_exec (bContext *C, wmOperator *op) +static int pose_calculate_paths_exec(bContext *C, wmOperator *op) { - ScrArea *sa= CTX_wm_area(C); + Object *ob = object_pose_armature_get(CTX_data_active_object(C)); Scene *scene= CTX_data_scene(C); - Object *ob; - /* since this call may also be used from the buttons window, we need to check for where to get the object */ - if (sa->spacetype == SPACE_BUTS) - ob= ED_object_context(C); - else - ob= object_pose_armature_get(CTX_data_active_object(C)); - if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; + /* grab baking settings from operator settings */ + { + bAnimVizSettings *avs = &ob->pose->avs; + PointerRNA avs_ptr; + + avs->path_sf = RNA_int_get(op->ptr, "start_frame"); + avs->path_ef = RNA_int_get(op->ptr, "end_frame"); + + RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr); + RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location")); + } + /* set up path data for bones being calculated */ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) { @@ -228,7 +258,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op) ED_pose_recalculate_paths(scene, ob); /* notifiers for updates */ - WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); return OPERATOR_FINISHED; } @@ -241,11 +271,22 @@ void POSE_OT_paths_calculate(wmOperatorType *ot) ot->description = "Calculate paths for the selected bones"; /* api callbacks */ + ot->invoke = pose_calculate_paths_invoke; ot->exec = pose_calculate_paths_exec; ot->poll = ED_operator_posemode; /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start", + "First frame to calculate bone paths on", MINFRAME, MAXFRAME/2.0); + RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End", + "Last frame to calculate bone paths on", MINFRAME, MAXFRAME/2.0); + + RNA_def_enum(ot->srna, "bake_location", motionpath_bake_location_items, 0, + "Bake Location", + "Which point on the bones is used when calculating paths"); } /* --------- */ @@ -279,14 +320,7 @@ static void ED_pose_clear_paths(Object *ob) /* operator callback for this */ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) { - ScrArea *sa= CTX_wm_area(C); - Object *ob; - - /* since this call may also be used from the buttons window, we need to check for where to get the object */ - if (sa->spacetype == SPACE_BUTS) - ob= ED_object_context(C); - else - ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob = object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object */ if (ELEM(NULL, ob, ob->pose)) @@ -296,7 +330,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) ED_pose_clear_paths(ob); /* notifiers for updates */ - WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8ab1d1372b7..9561a5972ff 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1125,14 +1125,43 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) BLI_freelistN(&targets); } +/* show popup to determine settings */ +static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt) +{ + Object *ob = CTX_data_active_object(C); + + if (ob == NULL) + return OPERATOR_CANCELLED; + + /* set default settings from existing/stored settings */ + { + bAnimVizSettings *avs = &ob->avs; + + RNA_int_set(op->ptr, "start_frame", avs->path_sf); + RNA_int_set(op->ptr, "end_frame", avs->path_ef); + } + + /* show popup dialog to allow editing of range... */ + // FIXME: hardcoded dimensions here are just arbitrary + return WM_operator_props_dialog_popup(C, op, 200, 200); +} + /* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */ static int object_calculate_paths_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + int start = RNA_int_get(op->ptr, "start_frame"); + int end = RNA_int_get(op->ptr, "end_frame"); /* set up path data for bones being calculated */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + bAnimVizSettings *avs = &ob->avs; + + /* grab baking settings from operator settings */ + avs->path_sf = start; + avs->path_ef = end; + /* verify that the selected object has the appropriate settings */ animviz_verify_motionpaths(op->reports, scene, ob, NULL); } @@ -1155,11 +1184,18 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) ot->description = "Calculate motion paths for the selected objects"; /* api callbacks */ + ot->invoke = object_calculate_paths_invoke; ot->exec = object_calculate_paths_exec; ot->poll = ED_operator_object_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start", + "First frame to calculate object paths on", MINFRAME, MAXFRAME/2.0); + RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End", + "Last frame to calculate object paths on", MINFRAME, MAXFRAME/2.0); } /* --------- */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index afa6a6e9608..1b8772ffbcd 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -70,6 +70,8 @@ extern EnumPropertyItem fmodifier_type_items[]; extern EnumPropertyItem nla_mode_extend_items[]; extern EnumPropertyItem nla_mode_blend_items[]; +extern EnumPropertyItem motionpath_bake_location_items[]; + extern EnumPropertyItem event_value_items[]; extern EnumPropertyItem event_type_items[]; extern EnumPropertyItem operator_return_items[]; diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index f7065307d87..167eb23c023 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -39,6 +39,14 @@ #include "WM_types.h" +/* Which part of bone(s) get baked */ +// TODO: icons? +EnumPropertyItem motionpath_bake_location_items[] = { + {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"}, + {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"}, + //{MOTIONPATH_BAKE_CENTERS, "CENTROID", 0, "Centers", "Calculate bone paths from center of mass"}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME static PointerRNA rna_AnimViz_onion_skinning_get(PointerRNA *ptr) @@ -241,10 +249,6 @@ static void rna_def_animviz_paths(BlenderRNA *brna) "Display Paths of poses within a fixed number of frames around the current frame"}, {MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"}, {0, NULL, 0, NULL, NULL}}; - static const EnumPropertyItem prop_location_items[] = { - {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"}, - {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"}, - {0, NULL, 0, NULL, NULL}}; srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL); RNA_def_struct_sdna(srna, "bAnimVizSettings"); @@ -260,7 +264,7 @@ static void rna_def_animviz_paths(BlenderRNA *brna) prop = RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "path_bakeflag"); - RNA_def_property_enum_items(prop, prop_location_items); + RNA_def_property_enum_items(prop, motionpath_bake_location_items); RNA_def_property_ui_text(prop, "Bake Location", "When calculating Bone Paths, use Head or Tips"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */ From af51b735046c40d7a6c9d6c453bf4bf7c546f8ea Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 May 2012 17:17:17 +0000 Subject: [PATCH 18/55] Fix #31202: cycles crash in new BVH builder on Windows, when compiling with debug info. --- intern/cycles/bvh/bvh_build.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index c5b4f1d01ae..d865426304a 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -175,7 +175,7 @@ BVHNode* BVHBuild::run() } else { /* multithreaded binning build */ - BVHObjectBinning rootbin(root, &references[0]); + BVHObjectBinning rootbin(root, (references.size())? &references[0]: NULL); rootnode = build_node(rootbin, 0); task_pool.wait(); } From f2ff1da6d70609d6b741038349aafba7f141ebc7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 May 2012 17:44:00 +0000 Subject: [PATCH 19/55] Related to #31213: rename Delete > Edges & Faces to Only Edges & Faces, to try to make it more clear that this keeps vertices. --- source/blender/editors/mesh/editmesh_tools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 79e18f18f51..e8c1a034dc9 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -896,7 +896,7 @@ static EnumPropertyItem prop_mesh_delete_types[] = { {0, "VERT", 0, "Vertices", ""}, {1, "EDGE", 0, "Edges", ""}, {2, "FACE", 0, "Faces", ""}, - {3, "EDGE_FACE", 0, "Edges & Faces", ""}, + {3, "EDGE_FACE", 0, "Only Edges & Faces", ""}, {4, "ONLY_FACE", 0, "Only Faces", ""}, {0, NULL, 0, NULL, NULL} }; From 933b3166fc212f8fc47e7dba9ac0e6b26d85653c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 17:51:03 +0000 Subject: [PATCH 20/55] style cleanup: guys - set your editors to tabs! --- source/blender/avi/AVI_avi.h | 177 +++++++++--------- source/blender/blenkernel/BKE_ocean.h | 10 +- source/blender/blenkernel/intern/customdata.c | 2 +- source/blender/blenkernel/intern/softbody.c | 36 ++-- source/blender/blenlib/intern/pbvh.c | 18 +- source/blender/blenlib/intern/winstuff.c | 8 +- source/blender/bmesh/intern/bmesh_private.h | 14 +- source/blender/bmesh/operators/bmo_hull.c | 4 +- source/blender/editors/interface/interface.c | 6 +- source/blender/editors/space_node/drawnode.c | 2 +- .../space_sequencer/sequencer_scopes.c | 2 +- .../blender/editors/space_view3d/drawobject.c | 24 +-- .../editors/uvedit/uvedit_unwrap_ops.c | 9 +- source/blender/imbuf/intern/dds/ColorBlock.h | 6 +- .../imbuf/intern/dds/DirectDrawSurface.h | 18 +- source/blender/imbuf/intern/indexer.c | 24 +-- source/blender/makesrna/intern/rna_nodetree.c | 30 +-- source/blender/makesrna/intern/rna_test.c | 4 +- source/blender/modifiers/intern/MOD_explode.c | 4 +- .../blender/modifiers/intern/MOD_meshdeform.c | 6 +- .../nodes/node_composite_colorMatte.c | 2 +- .../nodes/node_composite_colorSpill.c | 4 +- .../composite/nodes/node_composite_image.c | 2 +- .../nodes/node_composite_sepcombHSVA.c | 16 +- .../nodes/shader/nodes/node_shader_valToRgb.c | 8 +- source/blender/python/bmesh/bmesh_py_types.h | 4 +- .../render/intern/source/convertblender.c | 16 +- .../blender/windowmanager/intern/wm_keymap.c | 20 +- .../Converter/KX_ConvertProperties.h | 8 +- source/gameengine/Ketsji/KX_PythonSeq.h | 2 +- 30 files changed, 243 insertions(+), 243 deletions(-) diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h index 5f4bdf88879..76e11ebad08 100644 --- a/source/blender/avi/AVI_avi.h +++ b/source/blender/avi/AVI_avi.h @@ -57,124 +57,124 @@ #include /* for FILE */ typedef struct _AviChunk { - int fcc; - int size; + int fcc; + int size; } AviChunk; typedef struct _AviList { - int fcc; - int size; - int ids; + int fcc; + int size; + int ids; } AviList; typedef struct _AviMainHeader { - int fcc; - int size; - int MicroSecPerFrame; /* MicroSecPerFrame - timing between frames */ - int MaxBytesPerSec; /* MaxBytesPerSec - approx bps system must handle */ - int PaddingGranularity; - int Flags; + int fcc; + int size; + int MicroSecPerFrame; /* MicroSecPerFrame - timing between frames */ + int MaxBytesPerSec; /* MaxBytesPerSec - approx bps system must handle */ + int PaddingGranularity; + int Flags; #define AVIF_HASINDEX 0x00000010 /* had idx1 chunk */ #define AVIF_MUSTUSEINDEX 0x00000020 /* must use idx1 chunk to determine order */ #define AVIF_ISINTERLEAVED 0x00000100 /* AVI file is interleaved */ #define AVIF_TRUSTCKTYPE 0x00000800 #define AVIF_WASCAPTUREFILE 0x00010000 /* specially allocated used for capturing real time video */ #define AVIF_COPYRIGHTED 0x00020000 /* contains copyrighted data */ - - int TotalFrames; - int InitialFrames; /* InitialFrames - initial frame before interleaving */ - int Streams; - int SuggestedBufferSize; - int Width; - int Height; - int Reserved[4]; + + int TotalFrames; + int InitialFrames; /* InitialFrames - initial frame before interleaving */ + int Streams; + int SuggestedBufferSize; + int Width; + int Height; + int Reserved[4]; } AviMainHeader; typedef struct _AviStreamHeader { - int fcc; - int size; - int Type; + int fcc; + int size; + int Type; #define AVIST_VIDEO FCC("vids") #define AVIST_AUDIO FCC("auds") #define AVIST_MIDI FCC("mids") #define AVIST_TEXT FCC("txts") - - int Handler; - int Flags; + + int Handler; + int Flags; #define AVISF_DISABLED 0x00000001 #define AVISF_VIDEO_PALCHANGES 0x00010000 - - short Priority; - short Language; - int InitialFrames; - int Scale; - int Rate; - int Start; - int Length; - int SuggestedBufferSize; - int Quality; - int SampleSize; - short left; - short top; - short right; - short bottom; + + short Priority; + short Language; + int InitialFrames; + int Scale; + int Rate; + int Start; + int Length; + int SuggestedBufferSize; + int Quality; + int SampleSize; + short left; + short top; + short right; + short bottom; } AviStreamHeader; typedef struct _AviBitmapInfoHeader { - int fcc; - int size; - int Size; - int Width; - int Height; - short Planes; - short BitCount; - int Compression; - int SizeImage; - int XPelsPerMeter; - int YPelsPerMeter; - int ClrUsed; - int ClrImportant; + int fcc; + int size; + int Size; + int Width; + int Height; + short Planes; + short BitCount; + int Compression; + int SizeImage; + int XPelsPerMeter; + int YPelsPerMeter; + int ClrUsed; + int ClrImportant; } AviBitmapInfoHeader; typedef struct _AviMJPEGUnknown { - int a; - int b; - int c; - int d; - int e; - int f; - int g; + int a; + int b; + int c; + int d; + int e; + int f; + int g; } AviMJPEGUnknown; typedef struct _AviIndexEntry { - int ChunkId; - int Flags; + int ChunkId; + int Flags; #define AVIIF_LIST 0x00000001 #define AVIIF_KEYFRAME 0x00000010 #define AVIIF_NO_TIME 0x00000100 #define AVIIF_COMPRESSOR 0x0FFF0000 - int Offset; - int Size; + int Offset; + int Size; } AviIndexEntry; typedef struct _AviIndex { - int fcc; - int size; - AviIndexEntry *entrys; + int fcc; + int size; + AviIndexEntry *entrys; } AviIndex; typedef enum { - AVI_FORMAT_RGB24, /* The most basic of forms, 3 bytes per pixel, 1 per r, g, b */ - AVI_FORMAT_RGB32, /* The second most basic of forms, 4 bytes per pixel, 1 per r, g, b, alpha */ - AVI_FORMAT_AVI_RGB, /* Same as above, but is in the weird AVI order (bottom to top, left to right) */ - AVI_FORMAT_MJPEG /* Motion-JPEG */ + AVI_FORMAT_RGB24, /* The most basic of forms, 3 bytes per pixel, 1 per r, g, b */ + AVI_FORMAT_RGB32, /* The second most basic of forms, 4 bytes per pixel, 1 per r, g, b, alpha */ + AVI_FORMAT_AVI_RGB, /* Same as above, but is in the weird AVI order (bottom to top, left to right) */ + AVI_FORMAT_MJPEG /* Motion-JPEG */ } AviFormat; typedef struct _AviStreamRec { - AviStreamHeader sh; - void *sf; - int sf_size; - AviFormat format; + AviStreamHeader sh; + void *sf; + int sf_size; + AviFormat format; } AviStreamRec; typedef struct _AviMovie { @@ -201,23 +201,23 @@ typedef struct _AviMovie { } AviMovie; typedef enum { - AVI_ERROR_NONE=0, - AVI_ERROR_COMPRESSION, - AVI_ERROR_OPEN, - AVI_ERROR_READING, - AVI_ERROR_WRITING, - AVI_ERROR_FORMAT, - AVI_ERROR_ALLOC, - AVI_ERROR_FOUND, - AVI_ERROR_OPTION + AVI_ERROR_NONE=0, + AVI_ERROR_COMPRESSION, + AVI_ERROR_OPEN, + AVI_ERROR_READING, + AVI_ERROR_WRITING, + AVI_ERROR_FORMAT, + AVI_ERROR_ALLOC, + AVI_ERROR_FOUND, + AVI_ERROR_OPTION } AviError; /* belongs to the option-setting function. */ typedef enum { - AVI_OPTION_WIDTH=0, - AVI_OPTION_HEIGHT, - AVI_OPTION_QUALITY, - AVI_OPTION_FRAMERATE + AVI_OPTION_WIDTH=0, + AVI_OPTION_HEIGHT, + AVI_OPTION_QUALITY, + AVI_OPTION_FRAMERATE } AviOption; /* The offsets that will always stay the same in AVI files we @@ -306,4 +306,3 @@ AviError AVI_print_error(AviError error); void AVI_set_debug(int mode); #endif /* __AVI_AVI_H__ */ - diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h index 5f7f7740a9f..1c659b61d7d 100644 --- a/source/blender/blenkernel/BKE_ocean.h +++ b/source/blender/blenkernel/BKE_ocean.h @@ -32,17 +32,16 @@ extern "C" { typedef struct OceanResult { float disp[3]; - float normal[3]; + float normal[3]; float foam; /* raw eigenvalues/vectors */ float Jminus; - float Jplus; + float Jplus; float Eminus[3]; - float Eplus[3]; + float Eplus[3]; } OceanResult; - - + typedef struct OceanCache { struct ImBuf **ibufs_disp; struct ImBuf **ibufs_foam; @@ -74,7 +73,6 @@ typedef struct OceanCache { #define OCEAN_CACHING 1 #define OCEAN_CACHED 2 - struct Ocean *BKE_add_ocean(void); void BKE_free_ocean_data(struct Ocean *oc); void BKE_free_ocean(struct Ocean *oc); diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 4cf48ff6005..5855cc67719 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1046,7 +1046,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { {sizeof(float), "", 0, "BevelWeight", NULL, NULL, layerInterp_bweight}, /* 30: CD_CREASE */ {sizeof(float), "", 0, "SubSurfCrease", NULL, NULL, layerInterp_bweight}, - /* 31: CD_ORIGSPACE_MLOOP */ + /* 31: CD_ORIGSPACE_MLOOP */ {sizeof(OrigSpaceLoop), "OrigSpaceLoop", 1, "OS Loop", NULL, NULL, layerInterp_mloop_origspace, NULL, NULL, layerEqual_mloop_origspace, layerMultiply_mloop_origspace, layerInitMinMax_mloop_origspace, layerAdd_mloop_origspace, layerDoMinMax_mloop_origspace, layerCopyValue_mloop_origspace}, diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index c41c8d1f50f..690b6c83870 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -150,8 +150,8 @@ typedef struct SB_thread_context { #define SOFTGOALSNAP 0.999f /* if bp-> goal is above make it a *forced follow original* and skip all ODE stuff for this bp - removes *unnecessary* stiffnes from ODE system -*/ + * removes *unnecessary* stiffnes from ODE system + */ #define HEUNWARNLIMIT 1 /* 500 would be fine i think for detecting severe *stiff* stuff */ @@ -179,16 +179,16 @@ static void Vec3PlusStVec(float *v, float s, float *v1); static float sb_grav_force_scale(Object *UNUSED(ob)) /* since unit of g is [m/sec^2] and F = mass * g we rescale unit mass of node to 1 gramm - put it to a function here, so we can add user options later without touching simulation code -*/ + * put it to a function here, so we can add user options later without touching simulation code + */ { return (0.001f); } static float sb_fric_force_scale(Object *UNUSED(ob)) /* rescaling unit of drag [1 / sec] to somehow reasonable - put it to a function here, so we can add user options later without touching simulation code -*/ + * put it to a function here, so we can add user options later without touching simulation code + */ { return (0.01f); } @@ -216,12 +216,12 @@ static float sb_time_scale(Object *ob) /* helper functions for everything is animatable jow_go_for2_5 +++++++*/ /* introducing them here, because i know: steps in properties ( at frame timing ) - will cause unwanted responses of the softbody system (which does inter frame calculations ) - so first 'cure' would be: interpolate linear in time .. - Q: why do i write this? - A: because it happend once, that some eger coder 'streamlined' code to fail. - We DO linear interpolation for goals .. and i think we should do on animated properties as well -*/ + * will cause unwanted responses of the softbody system (which does inter frame calculations ) + * so first 'cure' would be: interpolate linear in time .. + * Q: why do i write this? + * A: because it happend once, that some eger coder 'streamlined' code to fail. + * We DO linear interpolation for goals .. and i think we should do on animated properties as well + */ /* animate sb->maxgoal, sb->mingoal */ static float _final_goal(Object *ob, BodyPoint *bp)/*jow_go_for2_5 */ @@ -2984,10 +2984,10 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * maxerrpos = MAX2(maxerrpos, ABS(dx[1] - bp->prevdx[1])); maxerrpos = MAX2(maxerrpos, ABS(dx[2] - bp->prevdx[2])); -/* bp->choke is set when we need to pull a vertex or edge out of the collider. - the collider object signals to get out by pushing hard. on the other hand - we don't want to end up in deep space so we add some - to balance that out */ + /* bp->choke is set when we need to pull a vertex or edge out of the collider. + * the collider object signals to get out by pushing hard. on the other hand + * we don't want to end up in deep space so we add some + * to balance that out */ if (bp->choke2 > 0.0f) { mul_v3_fl(bp->vec, (1.0f - bp->choke2)); } @@ -3268,7 +3268,9 @@ static void mesh_to_softbody(Scene *scene, Object *ob) BodyPoint *bp; BodySpring *bs; int a, totedge; - BKE_mesh_tessface_ensure(me); + + BKE_mesh_tessface_ensure(me); + if (ob->softflag & OB_SB_EDGES) totedge= me->totedge; else totedge= 0; diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index f4481c37f2d..8ab55f9ac85 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -1012,15 +1012,15 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes, * we have to store for each vertex which node it is in */ vnor= MEM_callocN(sizeof(float)*3*bvh->totvert, "bvh temp vnors"); - /* subtle assumptions: - * - We know that for all edited vertices, the nodes with faces - * adjacent to these vertices have been marked with PBVH_UpdateNormals. - * This is true because if the vertex is inside the brush radius, the - * bounding box of it's adjacent faces will be as well. - * - However this is only true for the vertices that have actually been - * edited, not for all vertices in the nodes marked for update, so we - * can only update vertices marked with ME_VERT_PBVH_UPDATE. - */ + /* subtle assumptions: + * - We know that for all edited vertices, the nodes with faces + * adjacent to these vertices have been marked with PBVH_UpdateNormals. + * This is true because if the vertex is inside the brush radius, the + * bounding box of it's adjacent faces will be as well. + * - However this is only true for the vertices that have actually been + * edited, not for all vertices in the nodes marked for update, so we + * can only update vertices marked with ME_VERT_PBVH_UPDATE. + */ #pragma omp parallel for private(n) schedule(static) for (n = 0; n < totnode; n++) { diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 0731213d607..d853e398adc 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -90,7 +90,7 @@ void RegisterBlendExtension(void) char BlPath[MAX_PATH]; char InstallDir[FILE_MAXDIR]; char SysDir[FILE_MAXDIR]; - const char *ThumbHandlerDLL; + const char *ThumbHandlerDLL; char RegCmd[MAX_PATH*2]; char MBox[256]; BOOL IsWOW64; @@ -173,7 +173,7 @@ void RegisterBlendExtension(void) DIR *opendir (const char *path) { - wchar_t *path_16 = alloc_utf16_from_8(path, 0); + wchar_t *path_16 = alloc_utf16_from_8(path, 0); if (GetFileAttributesW(path_16) & FILE_ATTRIBUTE_DIRECTORY) { DIR *newd= MEM_mallocN(sizeof(DIR), "opendir"); @@ -198,7 +198,7 @@ DIR *opendir (const char *path) static char *BLI_alloc_utf_8_from_16(wchar_t *in16, size_t add) { size_t bsize = count_utf_8_from_16(in16); - char *out8 = NULL; + char *out8 = NULL; if (!bsize) return NULL; out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add), "UTF-8 String"); conv_utf_16_to_8(in16, out8, bsize); @@ -208,7 +208,7 @@ static char *BLI_alloc_utf_8_from_16(wchar_t *in16, size_t add) static wchar_t *UNUSED_FUNCTION(BLI_alloc_utf16_from_8)(char *in8, size_t add) { size_t bsize = count_utf_16_from_8(in8); - wchar_t *out16 = NULL; + wchar_t *out16 = NULL; if (!bsize) return NULL; out16 =(wchar_t*) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String"); conv_utf_8_to_16(in8, out16, bsize); diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index 6297e20d9d2..23d0a1e3906 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -40,18 +40,18 @@ int bmesh_elem_check(void *element, const char htype); #define BM_CHECK_ELEMENT(el) \ - if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \ - printf("check_element failure, with code %i on line %i in file\n" \ - " \"%s\"\n\n", \ - bmesh_elem_check(el, ((BMHeader *)el)->htype), \ - __LINE__, __FILE__); \ - } + if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \ + printf("check_element failure, with code %i on line %i in file\n" \ + " \"%s\"\n\n", \ + bmesh_elem_check(el, ((BMHeader *)el)->htype), \ + __LINE__, __FILE__); \ + } #define BM_DISK_EDGE_LINK_GET(e, v) ( \ ((v) == ((BMEdge *)(e))->v1) ? \ &((e)->v1_disk_link) : \ &((e)->v2_disk_link) \ - ) + ) int bmesh_radial_length(BMLoop *l); int bmesh_disk_count(BMVert *v); diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 106c629841b..f2ef777c952 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -32,7 +32,7 @@ #include "BLI_utildefines.h" /* XXX: using 128 for totelem and pchunk of mempool, no idea what good - values would be though */ + * values would be though */ #include "BLI_mempool.h" #include "bmesh.h" @@ -77,7 +77,7 @@ static int edge_match(BMVert *e1_0, BMVert *e1_1, BMVert *e2[2]) } /* Returns true if the edge (e1, e2) is already in edges; that edge is - deleted here as well. if not found just returns 0 */ + * deleted here as well. if not found just returns 0 */ static int check_for_dup(ListBase *edges, BLI_mempool *pool, BMVert *e1, BMVert *e2) { diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 302d5cc8a77..9e12c8f94b7 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2644,9 +2644,9 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, */ #define UI_DEF_BUT_RNA_DISABLE(but) \ - but->flag |= UI_BUT_DISABLED; \ - but->lock = 1; \ - but->lockstr = "" + but->flag |= UI_BUT_DISABLED; \ + but->lock = 1; \ + but->lockstr = "" static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip) diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index bd17c821567..f8ed6c20657 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1639,7 +1639,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED col = uiLayoutColumn(layout, 1); - uiItemL(layout, "Color Space:", ICON_NONE); + uiItemL(layout, "Color Space:", ICON_NONE); row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE); diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 6b71591c471..2f5dff961fe 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -87,7 +87,7 @@ static void wform_put_line(int w, } static void wform_put_line_single( - int w, unsigned char *last_pos, unsigned char *new_pos, int col) + int w, unsigned char *last_pos, unsigned char *new_pos, int col) { if (last_pos > new_pos) { unsigned char *temp = new_pos; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e94379e6600..740947d2fb8 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2054,9 +2054,9 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenVert( - ViewContext *vc, - void (*func)(void *userData, BMVert *eve, int x, int y, int index), - void *userData, eV3DClipTest clipVerts) + ViewContext *vc, + void (*func)(void *userData, BMVert *eve, int x, int y, int index), + void *userData, eV3DClipTest clipVerts) { foreachScreenVert_userData data; DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); @@ -2140,9 +2140,9 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenEdge( - ViewContext *vc, - void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index), - void *userData, eV3DClipTest clipVerts) + ViewContext *vc, + void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index), + void *userData, eV3DClipTest clipVerts) { foreachScreenEdge_userData data; DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); @@ -2187,9 +2187,9 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenFace( - ViewContext *vc, - void (*func)(void *userData, BMFace *efa, int x, int y, int index), - void *userData) + ViewContext *vc, + void (*func)(void *userData, BMFace *efa, int x, int y, int index), + void *userData) { foreachScreenFace_userData data; DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); @@ -2209,9 +2209,9 @@ void mesh_foreachScreenFace( } void nurbs_foreachScreenVert( - ViewContext *vc, - void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y), - void *userData) + ViewContext *vc, + void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y), + void *userData) { Curve *cu = vc->obedit->data; short s[2] = {IS_CLIPPED, 0}; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 4583a888e30..743869e82cc 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -837,10 +837,11 @@ void ED_uvedit_live_unwrap(Scene *scene, Object *obedit) { BMEditMesh *em = BMEdit_FromObject(obedit); - if (scene->toolsettings->edge_mode_live_unwrap && - CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) { - ED_unwrap_lscm(scene, obedit, FALSE); /* unwrap all not just sel */ - } + if (scene->toolsettings->edge_mode_live_unwrap && + CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) + { + ED_unwrap_lscm(scene, obedit, FALSE); /* unwrap all not just sel */ + } } /*************** UV Map Common Transforms *****************/ diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h index e72b6253035..2bf362f2780 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.h +++ b/source/blender/imbuf/intern/dds/ColorBlock.h @@ -49,12 +49,12 @@ struct ColorBlock ColorBlock(const Image * img, uint x, uint y); void init(const Image * img, uint x, uint y); - void init(uint w, uint h, const uint * data, uint x, uint y); - void init(uint w, uint h, const float * data, uint x, uint y); + void init(uint w, uint h, const uint * data, uint x, uint y); + void init(uint w, uint h, const float * data, uint x, uint y); void swizzle(uint x, uint y, uint z, uint w); // 0=r, 1=g, 2=b, 3=a, 4=0xFF, 5=0 - bool isSingleColor(Color32 mask = Color32(0xFF, 0xFF, 0xFF, 0x00)) const; + bool isSingleColor(Color32 mask = Color32(0xFF, 0xFF, 0xFF, 0x00)) const; bool hasAlpha() const; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h index 23c8bbf2de3..ddae8826620 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h @@ -129,20 +129,20 @@ struct DDSHeader void setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask); void setDX10Format(uint format); void setNormalFlag(bool b); - void setSrgbFlag(bool b); + void setSrgbFlag(bool b); void setHasAlphaFlag(bool b); - void setUserVersion(int version); + void setUserVersion(int version); /*void swapBytes();*/ bool hasDX10Header() const; - uint signature() const; - uint toolVersion() const; - uint userVersion() const; - bool isNormalMap() const; - bool isSrgb() const; - bool hasAlpha() const; - uint d3d9Format() const; + uint signature() const; + uint toolVersion() const; + uint userVersion() const; + bool isNormalMap() const; + bool isSrgb() const; + bool hasAlpha() const; + uint d3d9Format() const; }; /// DirectDraw Surface. (DDS) diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index c38599028f8..3095f5639fe 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -62,8 +62,8 @@ static int tc_types[] = { IMB_TC_RECORD_RUN, #define INDEX_FILE_VERSION 1 /* ---------------------------------------------------------------------- - - time code index functions - ---------------------------------------------------------------------- */ + * - time code index functions + * ---------------------------------------------------------------------- */ anim_index_builder * IMB_index_builder_create(const char * name) { @@ -354,8 +354,8 @@ int IMB_timecode_to_array_index(IMB_Timecode_Type tc) /* ---------------------------------------------------------------------- - - rebuild helper functions - ---------------------------------------------------------------------- */ + * - rebuild helper functions + * ---------------------------------------------------------------------- */ static void get_index_dir(struct anim * anim, char * index_dir) { @@ -427,8 +427,8 @@ static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc, } /* ---------------------------------------------------------------------- - - common rebuilder structures - ---------------------------------------------------------------------- */ + * - common rebuilder structures + * ---------------------------------------------------------------------- */ typedef struct IndexBuildContext { int anim_type; @@ -436,8 +436,8 @@ typedef struct IndexBuildContext { /* ---------------------------------------------------------------------- - - ffmpeg rebuilder - ---------------------------------------------------------------------- */ + * - ffmpeg rebuilder + * ---------------------------------------------------------------------- */ #ifdef WITH_FFMPEG @@ -952,8 +952,8 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, #endif /* ---------------------------------------------------------------------- - - internal AVI (fallback) rebuilder - ---------------------------------------------------------------------- */ + * - internal AVI (fallback) rebuilder + * ---------------------------------------------------------------------- */ typedef struct FallbackIndexBuilderContext { int anim_type; @@ -1116,8 +1116,8 @@ static void index_rebuild_fallback(FallbackIndexBuilderContext *context, } /* ---------------------------------------------------------------------- - - public API - ---------------------------------------------------------------------- */ + * - public API + * ---------------------------------------------------------------------- */ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecode_Type tcs_in_use, IMB_Proxy_Size proxy_sizes_in_use, int quality) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 58fd936819b..5173d927e83 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -330,34 +330,34 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value) static void rna_distance_matte_t1_set(PointerRNA *ptr, float value) { - bNode *node = (bNode*)ptr->data; - NodeChroma *chroma = node->storage; + bNode *node = (bNode*)ptr->data; + NodeChroma *chroma = node->storage; - chroma->t1 = value; + chroma->t1 = value; } static void rna_distance_matte_t2_set(PointerRNA *ptr, float value) { - bNode *node = (bNode*)ptr->data; - NodeChroma *chroma = node->storage; + bNode *node = (bNode*)ptr->data; + NodeChroma *chroma = node->storage; - chroma->t2 = value; + chroma->t2 = value; } static void rna_difference_matte_t1_set(PointerRNA *ptr, float value) { - bNode *node = (bNode*)ptr->data; - NodeChroma *chroma = node->storage; + bNode *node = (bNode*)ptr->data; + NodeChroma *chroma = node->storage; - chroma->t1 = value; + chroma->t1 = value; } static void rna_difference_matte_t2_set(PointerRNA *ptr, float value) { - bNode *node = (bNode*)ptr->data; - NodeChroma *chroma = node->storage; + bNode *node = (bNode*)ptr->data; + NodeChroma *chroma = node->storage; - chroma->t2 = value; + chroma->t2 = value; } @@ -1966,14 +1966,14 @@ static void def_cmp_distance_matte(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem color_space_items[] = { + static EnumPropertyItem color_space_items[] = { {1, "RGB", 0, "RGB", "RGB color space"}, {2, "YCC", 0, "YCC", "YCbCr Suppression"}, {0, NULL, 0, NULL, NULL}}; - RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); + RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); - prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "channel"); RNA_def_property_enum_items(prop, color_space_items); RNA_def_property_ui_text(prop, "Channel", ""); diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c index 8bc545f34b7..1f5a4ff7f92 100644 --- a/source/blender/makesrna/intern/rna_test.c +++ b/source/blender/makesrna/intern/rna_test.c @@ -57,7 +57,7 @@ (void)0 #define DEF_GET_SET(type, arr) \ - void rna_Test_ ## arr ## _get(PointerRNA * ptr, type * values) \ + void rna_Test_ ## arr ## _get(PointerRNA * ptr, type * values) \ { \ memcpy(values, arr, sizeof(arr)); \ } \ @@ -69,7 +69,7 @@ (void)0 #define DEF_GET_SET_LEN(arr, max) \ - static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr) \ + static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr) \ { \ return arr ## _len; \ } \ diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 14acf6a0cbd..4270659d851 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -782,8 +782,8 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) return splitdm; } static DerivedMesh * explodeMesh(ExplodeModifierData *emd, - ParticleSystemModifierData *psmd, Scene *scene, Object *ob, - DerivedMesh *to_explode) + ParticleSystemModifierData *psmd, Scene *scene, Object *ob, + DerivedMesh *to_explode) { DerivedMesh *explode, *dm=to_explode; MFace *mf= NULL, *mface; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 08626e55231..aee8dd21903 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -104,9 +104,9 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) } static void foreachObjectLink( - ModifierData *md, Object *ob, - void (*walk)(void *userData, Object *ob, Object **obpoin), - void *userData) + ModifierData *md, Object *ob, + void (*walk)(void *userData, Object *ob, Object **obpoin), + void *userData) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index aa74e5c71a0..d9f0c741738 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -92,7 +92,7 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack * /*convert rgbbuf to hsv*/ composit1_pixel_processor(node, colorbuf, cbuf, in[0]->vec, do_rgba_to_hsva, CB_RGBA); - /*convert key to hsv*/ + /*convert key to hsv*/ do_rgba_to_hsva(node, c->key, in[1]->vec); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index 15c10d0242e..81693c31d87 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -161,7 +161,7 @@ static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *m out[0]=in[0]+(ncs->uspillr*map[0]); out[1]=in[1]-(ncs->uspillg*map[0]); out[2]=in[2]+(ncs->uspillb*map[0]); - } + } else { out[0]=in[0]; out[1]=in[1]; @@ -177,7 +177,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma out[0]=in[0]+(ncs->uspillr*map[0]); out[1]=in[1]+(ncs->uspillg*map[0]); out[2]=in[2]-(ncs->uspillb*map[0]); - } + } else { out[0]=in[0]; out[1]=in[1]; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 62179cfa471..1789710b096 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -313,7 +313,7 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc) } /* note: this function is used for multilayer too, to ensure uniform - handling with BKE_image_get_ibuf() */ + * handling with BKE_image_get_ibuf() */ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *iuser) { ImBuf *ibuf; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c index c0e11fe54e3..a30342ee28d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c @@ -113,16 +113,16 @@ void register_node_type_cmp_sephsva(bNodeTreeType *ttype) /* **************** COMBINE HSVA ******************** */ -static bNodeSocketTemplate cmp_node_combhsva_in[]= { - { SOCK_FLOAT, 1, "H", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, "S", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } +static bNodeSocketTemplate cmp_node_combhsva_in[] = { + { SOCK_FLOAT, 1, "H", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, "S", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_combhsva_out[]= { - { SOCK_RGBA, 0, "Image"}, - { -1, 0, "" } + { SOCK_RGBA, 0, "Image"}, + { -1, 0, "" } }; static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index 7e513135203..0e58fed4357 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -90,12 +90,12 @@ void register_node_type_sh_valtorgb(bNodeTreeType *ttype) /* **************** RGBTOBW ******************** */ static bNodeSocketTemplate sh_node_rgbtobw_in[]= { - { SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f}, + { -1, 0, "" } }; static bNodeSocketTemplate sh_node_rgbtobw_out[]= { - { SOCK_FLOAT, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { SOCK_FLOAT, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + { -1, 0, "" } }; diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h index a69091cb7ec..85bbd5d7b09 100644 --- a/source/blender/python/bmesh/bmesh_py_types.h +++ b/source/blender/python/bmesh/bmesh_py_types.h @@ -138,8 +138,8 @@ void BPy_BM_init_types(void); PyObject *BPyInit_bmesh_types(void); enum { - BPY_BMFLAG_NOP = 0, /* do nothing */ - BPY_BMFLAG_IS_WRAPPED = 1 /* the mesh is owned by editmode */ + BPY_BMFLAG_NOP = 0, /* do nothing */ + BPY_BMFLAG_IS_WRAPPED = 1 /* the mesh is owned by editmode */ }; PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 22629764cbe..f6030c8c0b5 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5691,14 +5691,14 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned /* setup for shaded view or bake, so only lamps and materials are initialized */ /* type: - RE_BAKE_LIGHT: for shaded view, only add lamps - RE_BAKE_ALL: for baking, all lamps and objects - RE_BAKE_NORMALS:for baking, no lamps and only selected objects - RE_BAKE_AO: for baking, no lamps, but all objects - RE_BAKE_TEXTURE:for baking, no lamps, only selected objects - RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects - RE_BAKE_SHADOW: for baking, only shadows, but all objects -*/ + * RE_BAKE_LIGHT: for shaded view, only add lamps + * RE_BAKE_ALL: for baking, all lamps and objects + * RE_BAKE_NORMALS:for baking, no lamps and only selected objects + * RE_BAKE_AO: for baking, no lamps, but all objects + * RE_BAKE_TEXTURE:for baking, no lamps, only selected objects + * RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects + * RE_BAKE_SHADOW: for baking, only shadows, but all objects + */ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, const int type, Object *actob) { Object *camera; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index cd7a8a93975..22d1cbe5e11 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -815,8 +815,8 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) } static wmKeyMapItem *wm_keymap_item_find_handlers( - const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), - IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) + const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), + IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) { wmWindowManager *wm = CTX_wm_manager(C); wmEventHandler *handler; @@ -856,8 +856,8 @@ static wmKeyMapItem *wm_keymap_item_find_handlers( } static wmKeyMapItem *wm_keymap_item_find_props( - const bContext *C, const char *opname, int opcontext, - IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) + const bContext *C, const char *opname, int opcontext, + IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); @@ -906,8 +906,8 @@ static wmKeyMapItem *wm_keymap_item_find_props( } static wmKeyMapItem *wm_keymap_item_find( - const bContext *C, const char *opname, int opcontext, - IDProperty *properties, const short hotkey, const short sloppy, wmKeyMap **keymap_r) + const bContext *C, const char *opname, int opcontext, + IDProperty *properties, const short hotkey, const short sloppy, wmKeyMap **keymap_r) { wmKeyMapItem *found = wm_keymap_item_find_props(C, opname, opcontext, properties, 1, hotkey, keymap_r); @@ -918,8 +918,8 @@ static wmKeyMapItem *wm_keymap_item_find( } char *WM_key_event_operator_string( - const bContext *C, const char *opname, int opcontext, - IDProperty *properties, const short sloppy, char *str, int len) + const bContext *C, const char *opname, int opcontext, + IDProperty *properties, const short sloppy, char *str, int len) { wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL); @@ -932,8 +932,8 @@ char *WM_key_event_operator_string( } int WM_key_event_operator_id( - const bContext *C, const char *opname, int opcontext, - IDProperty *properties, int hotkey, wmKeyMap **keymap_r) + const bContext *C, const char *opname, int opcontext, + IDProperty *properties, int hotkey, wmKeyMap **keymap_r) { wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r); diff --git a/source/gameengine/Converter/KX_ConvertProperties.h b/source/gameengine/Converter/KX_ConvertProperties.h index 5bfe202a539..345af3bfa74 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.h +++ b/source/gameengine/Converter/KX_ConvertProperties.h @@ -33,10 +33,10 @@ #define __KX_CONVERTPROPERTIES_H__ void BL_ConvertProperties(struct Object* object, - class KX_GameObject* gameobj, - class SCA_TimeEventManager* timemgr, - class SCA_IScene* scene, - bool isInActiveLayer); + class KX_GameObject* gameobj, + class SCA_TimeEventManager* timemgr, + class SCA_IScene* scene, + bool isInActiveLayer); #endif //__KX_CONVERTPROPERTIES_H__ diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h index 1c2d2869be0..47a01737cdb 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.h +++ b/source/gameengine/Ketsji/KX_PythonSeq.h @@ -52,7 +52,7 @@ enum KX_PYGENSEQ_TYPE { extern PyTypeObject KX_PythonSeq_Type; #define BPy_KX_PythonSeq_Check(obj) \ - (Py_TYPE(obj) == &KX_PythonSeq_Type) + (Py_TYPE(obj) == &KX_PythonSeq_Type) typedef struct { PyObject_VAR_HEAD From 657e62c9120c70beff8241c347b6a547402beb5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 18:57:32 +0000 Subject: [PATCH 21/55] code cleanup: tag unused vars --- doc/python_api/examples/bpy.types.Mesh.py | 1 - source/blender/editors/armature/poseobject.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/python_api/examples/bpy.types.Mesh.py b/doc/python_api/examples/bpy.types.Mesh.py index 69edf2cba50..1ee5118df6d 100644 --- a/doc/python_api/examples/bpy.types.Mesh.py +++ b/doc/python_api/examples/bpy.types.Mesh.py @@ -38,4 +38,3 @@ for poly in me.polygons: for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total): print(" Vertex: %d" % me.loops[loop_index].vertex_index) print(" UV: %r" % uv_layer[loop_index].uv) - diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index e0dba30e0b2..8a2af14e6f3 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -198,7 +198,7 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob) } /* show popup to determine settings */ -static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = object_pose_armature_get(CTX_data_active_object(C)); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 9561a5972ff..c669bbfe3b2 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1126,7 +1126,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) } /* show popup to determine settings */ -static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); From 6327c9aae18df2f226bd2b3207d51c920dc9a8af Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 20:08:23 +0000 Subject: [PATCH 22/55] style cleanup: whitespace, braces --- source/blender/blenkernel/intern/customdata.c | 6 +- source/blender/blenkernel/intern/particle.c | 4 +- source/blender/blenlib/intern/noise.c | 355 +++++++++++------- source/blender/collada/AnimationImporter.h | 4 +- source/blender/collada/DocumentImporter.cpp | 16 +- source/blender/editors/mesh/editmesh_tools.c | 17 +- source/blender/editors/sound/sound_ops.c | 6 +- source/blender/editors/transform/transform.c | 2 +- .../editors/transform/transform_conversions.c | 64 ++-- source/blender/gpu/intern/gpu_extensions.c | 47 ++- source/blender/gpu/intern/gpu_material.c | 19 +- source/blender/imbuf/intern/tiff.c | 4 +- source/blender/makesrna/intern/rna_lamp.c | 5 +- source/blender/makesrna/intern/rna_scene.c | 2 +- .../modifiers/intern/MOD_particlesystem.c | 2 +- .../nodes/node_composite_diffMatte.c | 24 +- .../nodes/node_composite_distanceMatte.c | 34 +- source/blender/render/intern/source/sunsky.c | 2 +- source/creator/creator.c | 3 +- source/gameengine/Ketsji/KX_VertexProxy.cpp | 2 +- .../gameengine/Rasterizer/RAS_IRasterizer.h | 2 +- 21 files changed, 333 insertions(+), 287 deletions(-) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 5855cc67719..a6666bf4fae 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1030,10 +1030,9 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 23: CD_CLOTH_ORCO */ {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 24: CD_RECAST */ - {sizeof(MRecast), "MRecast", 1, "Recast", NULL, NULL, NULL, NULL} + {sizeof(MRecast), "MRecast", 1, "Recast", NULL, NULL, NULL, NULL}, /* BMESH ONLY */ - , /* 25: CD_MPOLY */ {sizeof(MPoly), "MPoly", 1, "NGon Face", NULL, NULL, NULL, NULL, NULL}, /* 26: CD_MLOOP */ @@ -1070,10 +1069,9 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = { /* 5-9 */ "CDMTFace", "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags", /* 10-14 */ "CDMFloatProperty", "CDMIntProperty", "CDMStringProperty", "CDOrigSpace", "CDOrco", /* 15-19 */ "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent", "CDMDisps", - /* 20-24 */"CDPreviewMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast" + /* 20-24 */"CDPreviewMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast", /* BMESH ONLY */ - , /* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight", /* 30-32 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDPreviewLoopCol" /* END BMESH ONLY */ diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 882d907059e..1a1ae8e949c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1362,8 +1362,8 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData /* now we should have in chronologiacl order k1<=k2<=t<=k3<=k4 with keytime between [0, 1]->[k2, k3] (k1 & k4 used for cardinal & bspline interpolation)*/ psys_interpolate_particle((pind->keyed || pind->cache || point_vel) ? -1 /* signal for cubic interpolation */ - : (pind->bspline ? KEY_BSPLINE : KEY_CARDINAL) - , keys, keytime, result, 1); + : (pind->bspline ? KEY_BSPLINE : KEY_CARDINAL), + keys, keytime, result, 1); /* the velocity needs to be converted back from cubic interpolation */ if (pind->keyed || pind->cache || point_vel) diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index dde7efcb4a7..d795f9bf332 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -45,158 +45,225 @@ static float noise3_perlin(float vec[3]); //static float turbulence_perlin(float *point, float lofreq, float hifreq); //static float turbulencep(float noisesize, float x, float y, float z, int nr); -#define HASHVEC(x,y,z) hashvectf+3*hash[ (hash[ (hash[(z) & 255]+(y)) & 255]+(x)) & 255] +#define HASHVEC(x, y, z) hashvectf + 3 * hash[ (hash[ (hash[(z) & 255] + (y)) & 255] + (x)) & 255] /* needed for voronoi */ -#define HASHPNT(x,y,z) hashpntf+3*hash[ (hash[ (hash[(z) & 255]+(y)) & 255]+(x)) & 255] -static float hashpntf[768] = {0.536902, 0.020915, 0.501445, 0.216316, 0.517036, 0.822466, 0.965315, -0.377313, 0.678764, 0.744545, 0.097731, 0.396357, 0.247202, 0.520897, -0.613396, 0.542124, 0.146813, 0.255489, 0.810868, 0.638641, 0.980742, -0.292316, 0.357948, 0.114382, 0.861377, 0.629634, 0.722530, 0.714103, -0.048549, 0.075668, 0.564920, 0.162026, 0.054466, 0.411738, 0.156897, -0.887657, 0.599368, 0.074249, 0.170277, 0.225799, 0.393154, 0.301348, -0.057434, 0.293849, 0.442745, 0.150002, 0.398732, 0.184582, 0.915200, -0.630984, 0.974040, 0.117228, 0.795520, 0.763238, 0.158982, 0.616211, -0.250825, 0.906539, 0.316874, 0.676205, 0.234720, 0.667673, 0.792225, -0.273671, 0.119363, 0.199131, 0.856716, 0.828554, 0.900718, 0.705960, -0.635923, 0.989433, 0.027261, 0.283507, 0.113426, 0.388115, 0.900176, -0.637741, 0.438802, 0.715490, 0.043692, 0.202640, 0.378325, 0.450325, -0.471832, 0.147803, 0.906899, 0.524178, 0.784981, 0.051483, 0.893369, -0.596895, 0.275635, 0.391483, 0.844673, 0.103061, 0.257322, 0.708390, -0.504091, 0.199517, 0.660339, 0.376071, 0.038880, 0.531293, 0.216116, -0.138672, 0.907737, 0.807994, 0.659582, 0.915264, 0.449075, 0.627128, -0.480173, 0.380942, 0.018843, 0.211808, 0.569701, 0.082294, 0.689488, -0.573060, 0.593859, 0.216080, 0.373159, 0.108117, 0.595539, 0.021768, -0.380297, 0.948125, 0.377833, 0.319699, 0.315249, 0.972805, 0.792270, -0.445396, 0.845323, 0.372186, 0.096147, 0.689405, 0.423958, 0.055675, -0.117940, 0.328456, 0.605808, 0.631768, 0.372170, 0.213723, 0.032700, -0.447257, 0.440661, 0.728488, 0.299853, 0.148599, 0.649212, 0.498381, -0.049921, 0.496112, 0.607142, 0.562595, 0.990246, 0.739659, 0.108633, -0.978156, 0.209814, 0.258436, 0.876021, 0.309260, 0.600673, 0.713597, -0.576967, 0.641402, 0.853930, 0.029173, 0.418111, 0.581593, 0.008394, -0.589904, 0.661574, 0.979326, 0.275724, 0.111109, 0.440472, 0.120839, -0.521602, 0.648308, 0.284575, 0.204501, 0.153286, 0.822444, 0.300786, -0.303906, 0.364717, 0.209038, 0.916831, 0.900245, 0.600685, 0.890002, -0.581660, 0.431154, 0.705569, 0.551250, 0.417075, 0.403749, 0.696652, -0.292652, 0.911372, 0.690922, 0.323718, 0.036773, 0.258976, 0.274265, -0.225076, 0.628965, 0.351644, 0.065158, 0.080340, 0.467271, 0.130643, -0.385914, 0.919315, 0.253821, 0.966163, 0.017439, 0.392610, 0.478792, -0.978185, 0.072691, 0.982009, 0.097987, 0.731533, 0.401233, 0.107570, -0.349587, 0.479122, 0.700598, 0.481751, 0.788429, 0.706864, 0.120086, -0.562691, 0.981797, 0.001223, 0.192120, 0.451543, 0.173092, 0.108960, -0.549594, 0.587892, 0.657534, 0.396365, 0.125153, 0.666420, 0.385823, -0.890916, 0.436729, 0.128114, 0.369598, 0.759096, 0.044677, 0.904752, -0.088052, 0.621148, 0.005047, 0.452331, 0.162032, 0.494238, 0.523349, -0.741829, 0.698450, 0.452316, 0.563487, 0.819776, 0.492160, 0.004210, -0.647158, 0.551475, 0.362995, 0.177937, 0.814722, 0.727729, 0.867126, -0.997157, 0.108149, 0.085726, 0.796024, 0.665075, 0.362462, 0.323124, -0.043718, 0.042357, 0.315030, 0.328954, 0.870845, 0.683186, 0.467922, -0.514894, 0.809971, 0.631979, 0.176571, 0.366320, 0.850621, 0.505555, -0.749551, 0.750830, 0.401714, 0.481216, 0.438393, 0.508832, 0.867971, -0.654581, 0.058204, 0.566454, 0.084124, 0.548539, 0.902690, 0.779571, -0.562058, 0.048082, 0.863109, 0.079290, 0.713559, 0.783496, 0.265266, -0.672089, 0.786939, 0.143048, 0.086196, 0.876129, 0.408708, 0.229312, -0.629995, 0.206665, 0.207308, 0.710079, 0.341704, 0.264921, 0.028748, -0.629222, 0.470173, 0.726228, 0.125243, 0.328249, 0.794187, 0.741340, -0.489895, 0.189396, 0.724654, 0.092841, 0.039809, 0.860126, 0.247701, -0.655331, 0.964121, 0.672536, 0.044522, 0.690567, 0.837238, 0.631520, -0.953734, 0.352484, 0.289026, 0.034152, 0.852575, 0.098454, 0.795529, -0.452181, 0.826159, 0.186993, 0.820725, 0.440328, 0.922137, 0.704592, -0.915437, 0.738183, 0.733461, 0.193798, 0.929213, 0.161390, 0.318547, -0.888751, 0.430968, 0.740837, 0.193544, 0.872253, 0.563074, 0.274598, -0.347805, 0.666176, 0.449831, 0.800991, 0.588727, 0.052296, 0.714761, -0.420620, 0.570325, 0.057550, 0.210888, 0.407312, 0.662848, 0.924382, -0.895958, 0.775198, 0.688605, 0.025721, 0.301913, 0.791408, 0.500602, -0.831984, 0.828509, 0.642093, 0.494174, 0.525880, 0.446365, 0.440063, -0.763114, 0.630358, 0.223943, 0.333806, 0.906033, 0.498306, 0.241278, -0.427640, 0.772683, 0.198082, 0.225379, 0.503894, 0.436599, 0.016503, -0.803725, 0.189878, 0.291095, 0.499114, 0.151573, 0.079031, 0.904618, -0.708535, 0.273900, 0.067419, 0.317124, 0.936499, 0.716511, 0.543845, -0.939909, 0.826574, 0.715090, 0.154864, 0.750150, 0.845808, 0.648108, -0.556564, 0.644757, 0.140873, 0.799167, 0.632989, 0.444245, 0.471978, -0.435910, 0.359793, 0.216241, 0.007633, 0.337236, 0.857863, 0.380247, -0.092517, 0.799973, 0.919000, 0.296798, 0.096989, 0.854831, 0.165369, -0.568475, 0.216855, 0.020457, 0.835511, 0.538039, 0.999742, 0.620226, -0.244053, 0.060399, 0.323007, 0.294874, 0.988899, 0.384919, 0.735655, -0.773428, 0.549776, 0.292882, 0.660611, 0.593507, 0.621118, 0.175269, -0.682119, 0.794493, 0.868197, 0.632150, 0.807823, 0.509656, 0.482035, -0.001780, 0.259126, 0.358002, 0.280263, 0.192985, 0.290367, 0.208111, -0.917633, 0.114422, 0.925491, 0.981110, 0.255570, 0.974862, 0.016629, -0.552599, 0.575741, 0.612978, 0.615965, 0.803615, 0.772334, 0.089745, -0.838812, 0.634542, 0.113709, 0.755832, 0.577589, 0.667489, 0.529834, -0.325660, 0.817597, 0.316557, 0.335093, 0.737363, 0.260951, 0.737073, -0.049540, 0.735541, 0.988891, 0.299116, 0.147695, 0.417271, 0.940811, -0.524160, 0.857968, 0.176403, 0.244835, 0.485759, 0.033353, 0.280319, -0.750688, 0.755809, 0.924208, 0.095956, 0.962504, 0.275584, 0.173715, -0.942716, 0.706721, 0.078464, 0.576716, 0.804667, 0.559249, 0.900611, -0.646904, 0.432111, 0.927885, 0.383277, 0.269973, 0.114244, 0.574867, -0.150703, 0.241855, 0.272871, 0.199950, 0.079719, 0.868566, 0.962833, -0.789122, 0.320025, 0.905554, 0.234876, 0.991356, 0.061913, 0.732911, -0.785960, 0.874074, 0.069035, 0.658632, 0.309901, 0.023676, 0.791603, -0.764661, 0.661278, 0.319583, 0.829650, 0.117091, 0.903124, 0.982098, -0.161631, 0.193576, 0.670428, 0.857390, 0.003760, 0.572578, 0.222162, -0.114551, 0.420118, 0.530404, 0.470682, 0.525527, 0.764281, 0.040596, -0.443275, 0.501124, 0.816161, 0.417467, 0.332172, 0.447565, 0.614591, -0.559246, 0.805295, 0.226342, 0.155065, 0.714630, 0.160925, 0.760001, -0.453456, 0.093869, 0.406092, 0.264801, 0.720370, 0.743388, 0.373269, -0.403098, 0.911923, 0.897249, 0.147038, 0.753037, 0.516093, 0.739257, -0.175018, 0.045768, 0.735857, 0.801330, 0.927708, 0.240977, 0.591870, -0.921831, 0.540733, 0.149100, 0.423152, 0.806876, 0.397081, 0.061100, -0.811630, 0.044899, 0.460915, 0.961202, 0.822098, 0.971524, 0.867608, -0.773604, 0.226616, 0.686286, 0.926972, 0.411613, 0.267873, 0.081937, -0.226124, 0.295664, 0.374594, 0.533240, 0.237876, 0.669629, 0.599083, -0.513081, 0.878719, 0.201577, 0.721296, 0.495038, 0.079760, 0.965959, -0.233090, 0.052496, 0.714748, 0.887844, 0.308724, 0.972885, 0.723337, -0.453089, 0.914474, 0.704063, 0.823198, 0.834769, 0.906561, 0.919600, -0.100601, 0.307564, 0.901977, 0.468879, 0.265376, 0.885188, 0.683875, -0.868623, 0.081032, 0.466835, 0.199087, 0.663437, 0.812241, 0.311337, -0.821361, 0.356628, 0.898054, 0.160781, 0.222539, 0.714889, 0.490287, -0.984915, 0.951755, 0.964097, 0.641795, 0.815472, 0.852732, 0.862074, -0.051108, 0.440139, 0.323207, 0.517171, 0.562984, 0.115295, 0.743103, -0.977914, 0.337596, 0.440694, 0.535879, 0.959427, 0.351427, 0.704361, -0.010826, 0.131162, 0.577080, 0.349572, 0.774892, 0.425796, 0.072697, -0.500001, 0.267322, 0.909654, 0.206176, 0.223987, 0.937698, 0.323423, -0.117501, 0.490308, 0.474372, 0.689943, 0.168671, 0.719417, 0.188928, -0.330464, 0.265273, 0.446271, 0.171933, 0.176133, 0.474616, 0.140182, -0.114246, 0.905043, 0.713870, 0.555261, 0.951333}; +#define HASHPNT(x, y, z) hashpntf + 3 * hash[ (hash[ (hash[(z) & 255] + (y)) & 255] + (x)) & 255] +static float hashpntf[768] = { + 0.536902, 0.020915, 0.501445, 0.216316, 0.517036, 0.822466, 0.965315, + 0.377313, 0.678764, 0.744545, 0.097731, 0.396357, 0.247202, 0.520897, + 0.613396, 0.542124, 0.146813, 0.255489, 0.810868, 0.638641, 0.980742, + 0.292316, 0.357948, 0.114382, 0.861377, 0.629634, 0.722530, 0.714103, + 0.048549, 0.075668, 0.564920, 0.162026, 0.054466, 0.411738, 0.156897, + 0.887657, 0.599368, 0.074249, 0.170277, 0.225799, 0.393154, 0.301348, + 0.057434, 0.293849, 0.442745, 0.150002, 0.398732, 0.184582, 0.915200, + 0.630984, 0.974040, 0.117228, 0.795520, 0.763238, 0.158982, 0.616211, + 0.250825, 0.906539, 0.316874, 0.676205, 0.234720, 0.667673, 0.792225, + 0.273671, 0.119363, 0.199131, 0.856716, 0.828554, 0.900718, 0.705960, + 0.635923, 0.989433, 0.027261, 0.283507, 0.113426, 0.388115, 0.900176, + 0.637741, 0.438802, 0.715490, 0.043692, 0.202640, 0.378325, 0.450325, + 0.471832, 0.147803, 0.906899, 0.524178, 0.784981, 0.051483, 0.893369, + 0.596895, 0.275635, 0.391483, 0.844673, 0.103061, 0.257322, 0.708390, + 0.504091, 0.199517, 0.660339, 0.376071, 0.038880, 0.531293, 0.216116, + 0.138672, 0.907737, 0.807994, 0.659582, 0.915264, 0.449075, 0.627128, + 0.480173, 0.380942, 0.018843, 0.211808, 0.569701, 0.082294, 0.689488, + 0.573060, 0.593859, 0.216080, 0.373159, 0.108117, 0.595539, 0.021768, + 0.380297, 0.948125, 0.377833, 0.319699, 0.315249, 0.972805, 0.792270, + 0.445396, 0.845323, 0.372186, 0.096147, 0.689405, 0.423958, 0.055675, + 0.117940, 0.328456, 0.605808, 0.631768, 0.372170, 0.213723, 0.032700, + 0.447257, 0.440661, 0.728488, 0.299853, 0.148599, 0.649212, 0.498381, + 0.049921, 0.496112, 0.607142, 0.562595, 0.990246, 0.739659, 0.108633, + 0.978156, 0.209814, 0.258436, 0.876021, 0.309260, 0.600673, 0.713597, + 0.576967, 0.641402, 0.853930, 0.029173, 0.418111, 0.581593, 0.008394, + 0.589904, 0.661574, 0.979326, 0.275724, 0.111109, 0.440472, 0.120839, + 0.521602, 0.648308, 0.284575, 0.204501, 0.153286, 0.822444, 0.300786, + 0.303906, 0.364717, 0.209038, 0.916831, 0.900245, 0.600685, 0.890002, + 0.581660, 0.431154, 0.705569, 0.551250, 0.417075, 0.403749, 0.696652, + 0.292652, 0.911372, 0.690922, 0.323718, 0.036773, 0.258976, 0.274265, + 0.225076, 0.628965, 0.351644, 0.065158, 0.080340, 0.467271, 0.130643, + 0.385914, 0.919315, 0.253821, 0.966163, 0.017439, 0.392610, 0.478792, + 0.978185, 0.072691, 0.982009, 0.097987, 0.731533, 0.401233, 0.107570, + 0.349587, 0.479122, 0.700598, 0.481751, 0.788429, 0.706864, 0.120086, + 0.562691, 0.981797, 0.001223, 0.192120, 0.451543, 0.173092, 0.108960, + 0.549594, 0.587892, 0.657534, 0.396365, 0.125153, 0.666420, 0.385823, + 0.890916, 0.436729, 0.128114, 0.369598, 0.759096, 0.044677, 0.904752, + 0.088052, 0.621148, 0.005047, 0.452331, 0.162032, 0.494238, 0.523349, + 0.741829, 0.698450, 0.452316, 0.563487, 0.819776, 0.492160, 0.004210, + 0.647158, 0.551475, 0.362995, 0.177937, 0.814722, 0.727729, 0.867126, + 0.997157, 0.108149, 0.085726, 0.796024, 0.665075, 0.362462, 0.323124, + 0.043718, 0.042357, 0.315030, 0.328954, 0.870845, 0.683186, 0.467922, + 0.514894, 0.809971, 0.631979, 0.176571, 0.366320, 0.850621, 0.505555, + 0.749551, 0.750830, 0.401714, 0.481216, 0.438393, 0.508832, 0.867971, + 0.654581, 0.058204, 0.566454, 0.084124, 0.548539, 0.902690, 0.779571, + 0.562058, 0.048082, 0.863109, 0.079290, 0.713559, 0.783496, 0.265266, + 0.672089, 0.786939, 0.143048, 0.086196, 0.876129, 0.408708, 0.229312, + 0.629995, 0.206665, 0.207308, 0.710079, 0.341704, 0.264921, 0.028748, + 0.629222, 0.470173, 0.726228, 0.125243, 0.328249, 0.794187, 0.741340, + 0.489895, 0.189396, 0.724654, 0.092841, 0.039809, 0.860126, 0.247701, + 0.655331, 0.964121, 0.672536, 0.044522, 0.690567, 0.837238, 0.631520, + 0.953734, 0.352484, 0.289026, 0.034152, 0.852575, 0.098454, 0.795529, + 0.452181, 0.826159, 0.186993, 0.820725, 0.440328, 0.922137, 0.704592, + 0.915437, 0.738183, 0.733461, 0.193798, 0.929213, 0.161390, 0.318547, + 0.888751, 0.430968, 0.740837, 0.193544, 0.872253, 0.563074, 0.274598, + 0.347805, 0.666176, 0.449831, 0.800991, 0.588727, 0.052296, 0.714761, + 0.420620, 0.570325, 0.057550, 0.210888, 0.407312, 0.662848, 0.924382, + 0.895958, 0.775198, 0.688605, 0.025721, 0.301913, 0.791408, 0.500602, + 0.831984, 0.828509, 0.642093, 0.494174, 0.525880, 0.446365, 0.440063, + 0.763114, 0.630358, 0.223943, 0.333806, 0.906033, 0.498306, 0.241278, + 0.427640, 0.772683, 0.198082, 0.225379, 0.503894, 0.436599, 0.016503, + 0.803725, 0.189878, 0.291095, 0.499114, 0.151573, 0.079031, 0.904618, + 0.708535, 0.273900, 0.067419, 0.317124, 0.936499, 0.716511, 0.543845, + 0.939909, 0.826574, 0.715090, 0.154864, 0.750150, 0.845808, 0.648108, + 0.556564, 0.644757, 0.140873, 0.799167, 0.632989, 0.444245, 0.471978, + 0.435910, 0.359793, 0.216241, 0.007633, 0.337236, 0.857863, 0.380247, + 0.092517, 0.799973, 0.919000, 0.296798, 0.096989, 0.854831, 0.165369, + 0.568475, 0.216855, 0.020457, 0.835511, 0.538039, 0.999742, 0.620226, + 0.244053, 0.060399, 0.323007, 0.294874, 0.988899, 0.384919, 0.735655, + 0.773428, 0.549776, 0.292882, 0.660611, 0.593507, 0.621118, 0.175269, + 0.682119, 0.794493, 0.868197, 0.632150, 0.807823, 0.509656, 0.482035, + 0.001780, 0.259126, 0.358002, 0.280263, 0.192985, 0.290367, 0.208111, + 0.917633, 0.114422, 0.925491, 0.981110, 0.255570, 0.974862, 0.016629, + 0.552599, 0.575741, 0.612978, 0.615965, 0.803615, 0.772334, 0.089745, + 0.838812, 0.634542, 0.113709, 0.755832, 0.577589, 0.667489, 0.529834, + 0.325660, 0.817597, 0.316557, 0.335093, 0.737363, 0.260951, 0.737073, + 0.049540, 0.735541, 0.988891, 0.299116, 0.147695, 0.417271, 0.940811, + 0.524160, 0.857968, 0.176403, 0.244835, 0.485759, 0.033353, 0.280319, + 0.750688, 0.755809, 0.924208, 0.095956, 0.962504, 0.275584, 0.173715, + 0.942716, 0.706721, 0.078464, 0.576716, 0.804667, 0.559249, 0.900611, + 0.646904, 0.432111, 0.927885, 0.383277, 0.269973, 0.114244, 0.574867, + 0.150703, 0.241855, 0.272871, 0.199950, 0.079719, 0.868566, 0.962833, + 0.789122, 0.320025, 0.905554, 0.234876, 0.991356, 0.061913, 0.732911, + 0.785960, 0.874074, 0.069035, 0.658632, 0.309901, 0.023676, 0.791603, + 0.764661, 0.661278, 0.319583, 0.829650, 0.117091, 0.903124, 0.982098, + 0.161631, 0.193576, 0.670428, 0.857390, 0.003760, 0.572578, 0.222162, + 0.114551, 0.420118, 0.530404, 0.470682, 0.525527, 0.764281, 0.040596, + 0.443275, 0.501124, 0.816161, 0.417467, 0.332172, 0.447565, 0.614591, + 0.559246, 0.805295, 0.226342, 0.155065, 0.714630, 0.160925, 0.760001, + 0.453456, 0.093869, 0.406092, 0.264801, 0.720370, 0.743388, 0.373269, + 0.403098, 0.911923, 0.897249, 0.147038, 0.753037, 0.516093, 0.739257, + 0.175018, 0.045768, 0.735857, 0.801330, 0.927708, 0.240977, 0.591870, + 0.921831, 0.540733, 0.149100, 0.423152, 0.806876, 0.397081, 0.061100, + 0.811630, 0.044899, 0.460915, 0.961202, 0.822098, 0.971524, 0.867608, + 0.773604, 0.226616, 0.686286, 0.926972, 0.411613, 0.267873, 0.081937, + 0.226124, 0.295664, 0.374594, 0.533240, 0.237876, 0.669629, 0.599083, + 0.513081, 0.878719, 0.201577, 0.721296, 0.495038, 0.079760, 0.965959, + 0.233090, 0.052496, 0.714748, 0.887844, 0.308724, 0.972885, 0.723337, + 0.453089, 0.914474, 0.704063, 0.823198, 0.834769, 0.906561, 0.919600, + 0.100601, 0.307564, 0.901977, 0.468879, 0.265376, 0.885188, 0.683875, + 0.868623, 0.081032, 0.466835, 0.199087, 0.663437, 0.812241, 0.311337, + 0.821361, 0.356628, 0.898054, 0.160781, 0.222539, 0.714889, 0.490287, + 0.984915, 0.951755, 0.964097, 0.641795, 0.815472, 0.852732, 0.862074, + 0.051108, 0.440139, 0.323207, 0.517171, 0.562984, 0.115295, 0.743103, + 0.977914, 0.337596, 0.440694, 0.535879, 0.959427, 0.351427, 0.704361, + 0.010826, 0.131162, 0.577080, 0.349572, 0.774892, 0.425796, 0.072697, + 0.500001, 0.267322, 0.909654, 0.206176, 0.223987, 0.937698, 0.323423, + 0.117501, 0.490308, 0.474372, 0.689943, 0.168671, 0.719417, 0.188928, + 0.330464, 0.265273, 0.446271, 0.171933, 0.176133, 0.474616, 0.140182, + 0.114246, 0.905043, 0.713870, 0.555261, 0.951333 +}; unsigned char hash[512]= { -0xA2,0xA0,0x19,0x3B,0xF8,0xEB,0xAA,0xEE,0xF3,0x1C,0x67,0x28,0x1D,0xED,0x0,0xDE,0x95,0x2E,0xDC,0x3F,0x3A,0x82,0x35,0x4D,0x6C,0xBA,0x36,0xD0,0xF6,0xC,0x79,0x32,0xD1,0x59,0xF4,0x8,0x8B,0x63,0x89,0x2F,0xB8,0xB4,0x97,0x83,0xF2,0x8F,0x18,0xC7,0x51,0x14,0x65,0x87,0x48,0x20,0x42,0xA8,0x80,0xB5,0x40,0x13,0xB2,0x22,0x7E,0x57, -0xBC,0x7F,0x6B,0x9D,0x86,0x4C,0xC8,0xDB,0x7C,0xD5,0x25,0x4E,0x5A,0x55,0x74,0x50,0xCD,0xB3,0x7A,0xBB,0xC3,0xCB,0xB6,0xE2,0xE4,0xEC,0xFD,0x98,0xB,0x96,0xD3,0x9E,0x5C,0xA1,0x64,0xF1,0x81,0x61,0xE1,0xC4,0x24,0x72,0x49,0x8C,0x90,0x4B,0x84,0x34,0x38,0xAB,0x78,0xCA,0x1F,0x1,0xD7,0x93,0x11,0xC1,0x58,0xA9,0x31,0xF9,0x44,0x6D, -0xBF,0x33,0x9C,0x5F,0x9,0x94,0xA3,0x85,0x6,0xC6,0x9A,0x1E,0x7B,0x46,0x15,0x30,0x27,0x2B,0x1B,0x71,0x3C,0x5B,0xD6,0x6F,0x62,0xAC,0x4F,0xC2,0xC0,0xE,0xB1,0x23,0xA7,0xDF,0x47,0xB0,0x77,0x69,0x5,0xE9,0xE6,0xE7,0x76,0x73,0xF,0xFE,0x6E,0x9B,0x56,0xEF,0x12,0xA5,0x37,0xFC,0xAE,0xD9,0x3,0x8E,0xDD,0x10,0xB9,0xCE,0xC9,0x8D, -0xDA,0x2A,0xBD,0x68,0x17,0x9F,0xBE,0xD4,0xA,0xCC,0xD2,0xE8,0x43,0x3D,0x70,0xB7,0x2,0x7D,0x99,0xD8,0xD,0x60,0x8A,0x4,0x2C,0x3E,0x92,0xE5,0xAF,0x53,0x7,0xE0,0x29,0xA6,0xC5,0xE3,0xF5,0xF7,0x4A,0x41,0x26,0x6A,0x16,0x5E,0x52,0x2D,0x21,0xAD,0xF0,0x91,0xFF,0xEA,0x54,0xFA,0x66,0x1A,0x45,0x39,0xCF,0x75,0xA4,0x88,0xFB,0x5D, -0xA2,0xA0,0x19,0x3B,0xF8,0xEB,0xAA,0xEE,0xF3,0x1C,0x67,0x28,0x1D,0xED,0x0,0xDE,0x95,0x2E,0xDC,0x3F,0x3A,0x82,0x35,0x4D,0x6C,0xBA,0x36,0xD0,0xF6,0xC,0x79,0x32,0xD1,0x59,0xF4,0x8,0x8B,0x63,0x89,0x2F,0xB8,0xB4,0x97,0x83,0xF2,0x8F,0x18,0xC7,0x51,0x14,0x65,0x87,0x48,0x20,0x42,0xA8,0x80,0xB5,0x40,0x13,0xB2,0x22,0x7E,0x57, -0xBC,0x7F,0x6B,0x9D,0x86,0x4C,0xC8,0xDB,0x7C,0xD5,0x25,0x4E,0x5A,0x55,0x74,0x50,0xCD,0xB3,0x7A,0xBB,0xC3,0xCB,0xB6,0xE2,0xE4,0xEC,0xFD,0x98,0xB,0x96,0xD3,0x9E,0x5C,0xA1,0x64,0xF1,0x81,0x61,0xE1,0xC4,0x24,0x72,0x49,0x8C,0x90,0x4B,0x84,0x34,0x38,0xAB,0x78,0xCA,0x1F,0x1,0xD7,0x93,0x11,0xC1,0x58,0xA9,0x31,0xF9,0x44,0x6D, -0xBF,0x33,0x9C,0x5F,0x9,0x94,0xA3,0x85,0x6,0xC6,0x9A,0x1E,0x7B,0x46,0x15,0x30,0x27,0x2B,0x1B,0x71,0x3C,0x5B,0xD6,0x6F,0x62,0xAC,0x4F,0xC2,0xC0,0xE,0xB1,0x23,0xA7,0xDF,0x47,0xB0,0x77,0x69,0x5,0xE9,0xE6,0xE7,0x76,0x73,0xF,0xFE,0x6E,0x9B,0x56,0xEF,0x12,0xA5,0x37,0xFC,0xAE,0xD9,0x3,0x8E,0xDD,0x10,0xB9,0xCE,0xC9,0x8D, -0xDA,0x2A,0xBD,0x68,0x17,0x9F,0xBE,0xD4,0xA,0xCC,0xD2,0xE8,0x43,0x3D,0x70,0xB7,0x2,0x7D,0x99,0xD8,0xD,0x60,0x8A,0x4,0x2C,0x3E,0x92,0xE5,0xAF,0x53,0x7,0xE0,0x29,0xA6,0xC5,0xE3,0xF5,0xF7,0x4A,0x41,0x26,0x6A,0x16,0x5E,0x52,0x2D,0x21,0xAD,0xF0,0x91,0xFF,0xEA,0x54,0xFA,0x66,0x1A,0x45,0x39,0xCF,0x75,0xA4,0x88,0xFB,0x5D, + 0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, + 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63, + 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80, + 0xB5, 0x40, 0x13, 0xB2, 0x22, 0x7E, 0x57, 0xBC, 0x7F, 0x6B, 0x9D, 0x86, 0x4C, 0xC8, 0xDB, 0x7C, 0xD5, 0x25, 0x4E, + 0x5A, 0x55, 0x74, 0x50, 0xCD, 0xB3, 0x7A, 0xBB, 0xC3, 0xCB, 0xB6, 0xE2, 0xE4, 0xEC, 0xFD, 0x98, 0xB, 0x96, 0xD3, + 0x9E, 0x5C, 0xA1, 0x64, 0xF1, 0x81, 0x61, 0xE1, 0xC4, 0x24, 0x72, 0x49, 0x8C, 0x90, 0x4B, 0x84, 0x34, 0x38, 0xAB, + 0x78, 0xCA, 0x1F, 0x1, 0xD7, 0x93, 0x11, 0xC1, 0x58, 0xA9, 0x31, 0xF9, 0x44, 0x6D, 0xBF, 0x33, 0x9C, 0x5F, 0x9, + 0x94, 0xA3, 0x85, 0x6, 0xC6, 0x9A, 0x1E, 0x7B, 0x46, 0x15, 0x30, 0x27, 0x2B, 0x1B, 0x71, 0x3C, 0x5B, 0xD6, 0x6F, + 0x62, 0xAC, 0x4F, 0xC2, 0xC0, 0xE, 0xB1, 0x23, 0xA7, 0xDF, 0x47, 0xB0, 0x77, 0x69, 0x5, 0xE9, 0xE6, 0xE7, 0x76, + 0x73, 0xF, 0xFE, 0x6E, 0x9B, 0x56, 0xEF, 0x12, 0xA5, 0x37, 0xFC, 0xAE, 0xD9, 0x3, 0x8E, 0xDD, 0x10, 0xB9, 0xCE, + 0xC9, 0x8D, 0xDA, 0x2A, 0xBD, 0x68, 0x17, 0x9F, 0xBE, 0xD4, 0xA, 0xCC, 0xD2, 0xE8, 0x43, 0x3D, 0x70, 0xB7, 0x2, + 0x7D, 0x99, 0xD8, 0xD, 0x60, 0x8A, 0x4, 0x2C, 0x3E, 0x92, 0xE5, 0xAF, 0x53, 0x7, 0xE0, 0x29, 0xA6, 0xC5, 0xE3, + 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, + 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D, 0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, + 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, + 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, + 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80, 0xB5, 0x40, 0x13, 0xB2, 0x22, 0x7E, 0x57, 0xBC, 0x7F, 0x6B, + 0x9D, 0x86, 0x4C, 0xC8, 0xDB, 0x7C, 0xD5, 0x25, 0x4E, 0x5A, 0x55, 0x74, 0x50, 0xCD, 0xB3, 0x7A, 0xBB, 0xC3, 0xCB, + 0xB6, 0xE2, 0xE4, 0xEC, 0xFD, 0x98, 0xB, 0x96, 0xD3, 0x9E, 0x5C, 0xA1, 0x64, 0xF1, 0x81, 0x61, 0xE1, 0xC4, 0x24, + 0x72, 0x49, 0x8C, 0x90, 0x4B, 0x84, 0x34, 0x38, 0xAB, 0x78, 0xCA, 0x1F, 0x1, 0xD7, 0x93, 0x11, 0xC1, 0x58, 0xA9, + 0x31, 0xF9, 0x44, 0x6D, 0xBF, 0x33, 0x9C, 0x5F, 0x9, 0x94, 0xA3, 0x85, 0x6, 0xC6, 0x9A, 0x1E, 0x7B, 0x46, 0x15, + 0x30, 0x27, 0x2B, 0x1B, 0x71, 0x3C, 0x5B, 0xD6, 0x6F, 0x62, 0xAC, 0x4F, 0xC2, 0xC0, 0xE, 0xB1, 0x23, 0xA7, 0xDF, + 0x47, 0xB0, 0x77, 0x69, 0x5, 0xE9, 0xE6, 0xE7, 0x76, 0x73, 0xF, 0xFE, 0x6E, 0x9B, 0x56, 0xEF, 0x12, 0xA5, 0x37, + 0xFC, 0xAE, 0xD9, 0x3, 0x8E, 0xDD, 0x10, 0xB9, 0xCE, 0xC9, 0x8D, 0xDA, 0x2A, 0xBD, 0x68, 0x17, 0x9F, 0xBE, 0xD4, + 0xA, 0xCC, 0xD2, 0xE8, 0x43, 0x3D, 0x70, 0xB7, 0x2, 0x7D, 0x99, 0xD8, 0xD, 0x60, 0x8A, 0x4, 0x2C, 0x3E, 0x92, + 0xE5, 0xAF, 0x53, 0x7, 0xE0, 0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, + 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D, }; float hashvectf[768]= { -0.33783,0.715698,-0.611206,-0.944031,-0.326599,-0.045624,-0.101074,-0.416443,-0.903503,0.799286,0.49411,-0.341949,-0.854645,0.518036,0.033936,0.42514,-0.437866,-0.792114,-0.358948,0.597046,0.717377,-0.985413,0.144714,0.089294,-0.601776,-0.33728,-0.723907,-0.449921,0.594513,0.666382,0.208313,-0.10791, -0.972076,0.575317,0.060425,0.815643,0.293365,-0.875702,-0.383453,0.293762,0.465759,0.834686,-0.846008,-0.233398,-0.47934,-0.115814,0.143036,-0.98291,0.204681,-0.949036,-0.239532,0.946716,-0.263947,0.184326,-0.235596,0.573822,0.784332,0.203705,-0.372253,-0.905487,0.756989,-0.651031,0.055298,0.497803, -0.814697,-0.297363,-0.16214,0.063995,-0.98468,-0.329254,0.834381,0.441925,0.703827,-0.527039,-0.476227,0.956421,0.266113,0.119781,0.480133,0.482849,0.7323,-0.18631,0.961212,-0.203125,-0.748474,-0.656921,-0.090393,-0.085052,-0.165253,0.982544,-0.76947,0.628174,-0.115234,0.383148,0.537659,0.751068, -0.616486,-0.668488,-0.415924,-0.259979,-0.630005,0.73175,0.570953,-0.087952,0.816223,-0.458008,0.023254,0.888611,-0.196167,0.976563,-0.088287,-0.263885,-0.69812,-0.665527,0.437134,-0.892273,-0.112793,-0.621674,-0.230438,0.748566,0.232422,0.900574,-0.367249,0.22229,-0.796143,0.562744,-0.665497,-0.73764, -0.11377,0.670135,0.704803,0.232605,0.895599,0.429749,-0.114655,-0.11557,-0.474243,0.872742,0.621826,0.604004,-0.498444,-0.832214,0.012756,0.55426,-0.702484,0.705994,-0.089661,-0.692017,0.649292,0.315399,-0.175995,-0.977997,0.111877,0.096954,-0.04953,0.994019,0.635284,-0.606689,-0.477783,-0.261261, --0.607422,-0.750153,0.983276,0.165436,0.075958,-0.29837,0.404083,-0.864655,-0.638672,0.507721,0.578156,0.388214,0.412079,0.824249,0.556183,-0.208832,0.804352,0.778442,0.562012,0.27951,-0.616577,0.781921,-0.091522,0.196289,0.051056,0.979187,-0.121216,0.207153,-0.970734,-0.173401,-0.384735,0.906555, -0.161499,-0.723236,-0.671387,0.178497,-0.006226,-0.983887,-0.126038,0.15799,0.97934,0.830475,-0.024811,0.556458,-0.510132,-0.76944,0.384247,0.81424,0.200104,-0.544891,-0.112549,-0.393311,-0.912445,0.56189,0.152222,-0.813049,0.198914,-0.254517,-0.946381,-0.41217,0.690979,-0.593811,-0.407257,0.324524, -0.853668,-0.690186,0.366119,-0.624115,-0.428345,0.844147,-0.322296,-0.21228,-0.297546,-0.930756,-0.273071,0.516113,0.811798,0.928314,0.371643,0.007233,0.785828,-0.479218,-0.390778,-0.704895,0.058929,0.706818,0.173248,0.203583,0.963562,0.422211,-0.904297,-0.062469,-0.363312,-0.182465,0.913605,0.254028, --0.552307,-0.793945,-0.28891,-0.765747,-0.574554,0.058319,0.291382,0.954803,0.946136,-0.303925,0.111267,-0.078156,0.443695,-0.892731,0.182098,0.89389,0.409515,-0.680298,-0.213318,0.701141,0.062469,0.848389,-0.525635,-0.72879,-0.641846,0.238342,-0.88089,0.427673,0.202637,-0.532501,-0.21405,0.818878, -0.948975,-0.305084,0.07962,0.925446,0.374664,0.055817,0.820923,0.565491,0.079102,0.25882,0.099792,-0.960724,-0.294617,0.910522,0.289978,0.137115,0.320038,-0.937408,-0.908386,0.345276,-0.235718,-0.936218,0.138763,0.322754,0.366577,0.925934,-0.090637,0.309296,-0.686829,-0.657684,0.66983,0.024445, -0.742065,-0.917999,-0.059113,-0.392059,0.365509,0.462158,-0.807922,0.083374,0.996399,-0.014801,0.593842,0.253143,-0.763672,0.974976,-0.165466,0.148285,0.918976,0.137299,0.369537,0.294952,0.694977,0.655731,0.943085,0.152618,-0.295319,0.58783,-0.598236,0.544495,0.203796,0.678223,0.705994,-0.478821, --0.661011,0.577667,0.719055,-0.1698,-0.673828,-0.132172,-0.965332,0.225006,-0.981873,-0.14502,0.121979,0.763458,0.579742,0.284546,-0.893188,0.079681,0.442474,-0.795776,-0.523804,0.303802,0.734955,0.67804,-0.007446,0.15506,0.986267,-0.056183,0.258026,0.571503,-0.778931,-0.681549,-0.702087,-0.206116, --0.96286,-0.177185,0.203613,-0.470978,-0.515106,0.716095,-0.740326,0.57135,0.354095,-0.56012,-0.824982,-0.074982,-0.507874,0.753204,0.417969,-0.503113,0.038147,0.863342,0.594025,0.673553,-0.439758,-0.119873,-0.005524,-0.992737,0.098267,-0.213776,0.971893,-0.615631,0.643951,0.454163,0.896851,-0.441071, -0.032166,-0.555023,0.750763,-0.358093,0.398773,0.304688,0.864929,-0.722961,0.303589,0.620544,-0.63559,-0.621948,-0.457306,-0.293243,0.072327,0.953278,-0.491638,0.661041,-0.566772,-0.304199,-0.572083,-0.761688,0.908081,-0.398956,0.127014,-0.523621,-0.549683,-0.650848,-0.932922,-0.19986,0.299408,0.099426, -0.140869,0.984985,-0.020325,-0.999756,-0.002319,0.952667,0.280853,-0.11615,-0.971893,0.082581,0.220337,0.65921,0.705292,-0.260651,0.733063,-0.175537,0.657043,-0.555206,0.429504,-0.712189,0.400421,-0.89859,0.179352,0.750885,-0.19696,0.630341,0.785675,-0.569336,0.241821,-0.058899,-0.464111,0.883789, -0.129608,-0.94519,0.299622,-0.357819,0.907654,0.219238,-0.842133,-0.439117,-0.312927,-0.313477,0.84433,0.434479,-0.241211,0.053253,0.968994,0.063873,0.823273,0.563965,0.476288,0.862152,-0.172516,0.620941,-0.298126,0.724915,0.25238,-0.749359,-0.612122,-0.577545,0.386566,0.718994,-0.406342,-0.737976, -0.538696,0.04718,0.556305,0.82959,-0.802856,0.587463,0.101166,-0.707733,-0.705963,0.026428,0.374908,0.68457,0.625092,0.472137,0.208405,-0.856506,-0.703064,-0.581085,-0.409821,-0.417206,-0.736328,0.532623,-0.447876,-0.20285,-0.870728,0.086945,-0.990417,0.107086,0.183685,0.018341,-0.982788,0.560638, --0.428864,0.708282,0.296722,-0.952576,-0.0672,0.135773,0.990265,0.030243,-0.068787,0.654724,0.752686,0.762604,-0.551758,0.337585,-0.819611,-0.407684,0.402466,-0.727844,-0.55072,-0.408539,-0.855774,-0.480011,0.19281,0.693176,-0.079285,0.716339,0.226013,0.650116,-0.725433,0.246704,0.953369,-0.173553, --0.970398,-0.239227,-0.03244,0.136383,-0.394318,0.908752,0.813232,0.558167,0.164368,0.40451,0.549042,-0.731323,-0.380249,-0.566711,0.730865,0.022156,0.932739,0.359741,0.00824,0.996552,-0.082306,0.956635,-0.065338,-0.283722,-0.743561,0.008209,0.668579,-0.859589,-0.509674,0.035767,-0.852234,0.363678, --0.375977,-0.201965,-0.970795,-0.12915,0.313477,0.947327,0.06546,-0.254028,-0.528259,0.81015,0.628052,0.601105,0.49411,-0.494385,0.868378,0.037933,0.275635,-0.086426,0.957336,-0.197937,0.468903,-0.860748,0.895599,0.399384,0.195801,0.560791,0.825012,-0.069214,0.304199,-0.849487,0.43103,0.096375, -0.93576,0.339111,-0.051422,0.408966,-0.911072,0.330444,0.942841,-0.042389,-0.452362,-0.786407,0.420563,0.134308,-0.933472,-0.332489,0.80191,-0.566711,-0.188934,-0.987946,-0.105988,0.112518,-0.24408,0.892242,-0.379791,-0.920502,0.229095,-0.316376,0.7789,0.325958,0.535706,-0.912872,0.185211,-0.36377, --0.184784,0.565369,-0.803833,-0.018463,0.119537,0.992615,-0.259247,-0.935608,0.239532,-0.82373,-0.449127,-0.345947,-0.433105,0.659515,0.614349,-0.822754,0.378845,-0.423676,0.687195,-0.674835,-0.26889,-0.246582,-0.800842,0.545715,-0.729187,-0.207794,0.651978,0.653534,-0.610443,-0.447388,0.492584,-0.023346, -0.869934,0.609039,0.009094,-0.79306,0.962494,-0.271088,-0.00885,0.2659,-0.004913,0.963959,0.651245,0.553619,-0.518951,0.280548,-0.84314,0.458618,-0.175293,-0.983215,0.049805,0.035339,-0.979919,0.196045,-0.982941,0.164307,-0.082245,0.233734,-0.97226,-0.005005,-0.747253,-0.611328,0.260437,0.645599, -0.592773,0.481384,0.117706,-0.949524,-0.29068,-0.535004,-0.791901,-0.294312,-0.627167,-0.214447,0.748718,-0.047974,-0.813477,-0.57959,-0.175537,0.477264,-0.860992,0.738556,-0.414246,-0.53183,0.562561,-0.704071,0.433289,-0.754944,0.64801,-0.100586,0.114716,0.044525,-0.992371,0.966003,0.244873,-0.082764, + 0.33783, 0.715698, -0.611206, -0.944031, -0.326599, -0.045624, -0.101074, -0.416443, -0.903503, 0.799286, 0.49411, + -0.341949, -0.854645, 0.518036, 0.033936, 0.42514, -0.437866, -0.792114, -0.358948, 0.597046, 0.717377, -0.985413, + 0.144714, 0.089294, -0.601776, -0.33728, -0.723907, -0.449921, 0.594513, 0.666382, 0.208313, -0.10791, 0.972076, + 0.575317, 0.060425, 0.815643, 0.293365, -0.875702, -0.383453, 0.293762, 0.465759, 0.834686, -0.846008, -0.233398, + -0.47934, -0.115814, 0.143036, -0.98291, 0.204681, -0.949036, -0.239532, 0.946716, -0.263947, 0.184326, -0.235596, + 0.573822, 0.784332, 0.203705, -0.372253, -0.905487, 0.756989, -0.651031, 0.055298, 0.497803, 0.814697, -0.297363, + -0.16214, 0.063995, -0.98468, -0.329254, 0.834381, 0.441925, 0.703827, -0.527039, -0.476227, 0.956421, 0.266113, + 0.119781, 0.480133, 0.482849, 0.7323, -0.18631, 0.961212, -0.203125, -0.748474, -0.656921, -0.090393, -0.085052, + -0.165253, 0.982544, -0.76947, 0.628174, -0.115234, 0.383148, 0.537659, 0.751068, 0.616486, -0.668488, -0.415924, + -0.259979, -0.630005, 0.73175, 0.570953, -0.087952, 0.816223, -0.458008, 0.023254, 0.888611, -0.196167, 0.976563, + -0.088287, -0.263885, -0.69812, -0.665527, 0.437134, -0.892273, -0.112793, -0.621674, -0.230438, 0.748566, 0.232422, + 0.900574, -0.367249, 0.22229, -0.796143, 0.562744, -0.665497, -0.73764, 0.11377, 0.670135, 0.704803, 0.232605, + 0.895599, 0.429749, -0.114655, -0.11557, -0.474243, 0.872742, 0.621826, 0.604004, -0.498444, -0.832214, 0.012756, + 0.55426, -0.702484, 0.705994, -0.089661, -0.692017, 0.649292, 0.315399, -0.175995, -0.977997, 0.111877, 0.096954, + -0.04953, 0.994019, 0.635284, -0.606689, -0.477783, -0.261261, -0.607422, -0.750153, 0.983276, 0.165436, 0.075958, + -0.29837, 0.404083, -0.864655, -0.638672, 0.507721, 0.578156, 0.388214, 0.412079, 0.824249, 0.556183, -0.208832, + 0.804352, 0.778442, 0.562012, 0.27951, -0.616577, 0.781921, -0.091522, 0.196289, 0.051056, 0.979187, -0.121216, + 0.207153, -0.970734, -0.173401, -0.384735, 0.906555, 0.161499, -0.723236, -0.671387, 0.178497, -0.006226, -0.983887, + -0.126038, 0.15799, 0.97934, 0.830475, -0.024811, 0.556458, -0.510132, -0.76944, 0.384247, 0.81424, 0.200104, + -0.544891, -0.112549, -0.393311, -0.912445, 0.56189, 0.152222, -0.813049, 0.198914, -0.254517, -0.946381, -0.41217, + 0.690979, -0.593811, -0.407257, 0.324524, 0.853668, -0.690186, 0.366119, -0.624115, -0.428345, 0.844147, -0.322296, + -0.21228, -0.297546, -0.930756, -0.273071, 0.516113, 0.811798, 0.928314, 0.371643, 0.007233, 0.785828, -0.479218, + -0.390778, -0.704895, 0.058929, 0.706818, 0.173248, 0.203583, 0.963562, 0.422211, -0.904297, -0.062469, -0.363312, + -0.182465, 0.913605, 0.254028, -0.552307, -0.793945, -0.28891, -0.765747, -0.574554, 0.058319, 0.291382, 0.954803, + 0.946136, -0.303925, 0.111267, -0.078156, 0.443695, -0.892731, 0.182098, 0.89389, 0.409515, -0.680298, -0.213318, + 0.701141, 0.062469, 0.848389, -0.525635, -0.72879, -0.641846, 0.238342, -0.88089, 0.427673, 0.202637, -0.532501, + -0.21405, 0.818878, 0.948975, -0.305084, 0.07962, 0.925446, 0.374664, 0.055817, 0.820923, 0.565491, 0.079102, + 0.25882, 0.099792, -0.960724, -0.294617, 0.910522, 0.289978, 0.137115, 0.320038, -0.937408, -0.908386, 0.345276, + -0.235718, -0.936218, 0.138763, 0.322754, 0.366577, 0.925934, -0.090637, 0.309296, -0.686829, -0.657684, 0.66983, + 0.024445, 0.742065, -0.917999, -0.059113, -0.392059, 0.365509, 0.462158, -0.807922, 0.083374, 0.996399, -0.014801, + 0.593842, 0.253143, -0.763672, 0.974976, -0.165466, 0.148285, 0.918976, 0.137299, 0.369537, 0.294952, 0.694977, + 0.655731, 0.943085, 0.152618, -0.295319, 0.58783, -0.598236, 0.544495, 0.203796, 0.678223, 0.705994, -0.478821, + -0.661011, 0.577667, 0.719055, -0.1698, -0.673828, -0.132172, -0.965332, 0.225006, -0.981873, -0.14502, 0.121979, + 0.763458, 0.579742, 0.284546, -0.893188, 0.079681, 0.442474, -0.795776, -0.523804, 0.303802, 0.734955, 0.67804, + -0.007446, 0.15506, 0.986267, -0.056183, 0.258026, 0.571503, -0.778931, -0.681549, -0.702087, -0.206116, -0.96286, + -0.177185, 0.203613, -0.470978, -0.515106, 0.716095, -0.740326, 0.57135, 0.354095, -0.56012, -0.824982, -0.074982, + -0.507874, 0.753204, 0.417969, -0.503113, 0.038147, 0.863342, 0.594025, 0.673553, -0.439758, -0.119873, -0.005524, + -0.992737, 0.098267, -0.213776, 0.971893, -0.615631, 0.643951, 0.454163, 0.896851, -0.441071, 0.032166, -0.555023, + 0.750763, -0.358093, 0.398773, 0.304688, 0.864929, -0.722961, 0.303589, 0.620544, -0.63559, -0.621948, -0.457306, + -0.293243, 0.072327, 0.953278, -0.491638, 0.661041, -0.566772, -0.304199, -0.572083, -0.761688, 0.908081, -0.398956, + 0.127014, -0.523621, -0.549683, -0.650848, -0.932922, -0.19986, 0.299408, 0.099426, 0.140869, 0.984985, -0.020325, + -0.999756, -0.002319, 0.952667, 0.280853, -0.11615, -0.971893, 0.082581, 0.220337, 0.65921, 0.705292, -0.260651, + 0.733063, -0.175537, 0.657043, -0.555206, 0.429504, -0.712189, 0.400421, -0.89859, 0.179352, 0.750885, -0.19696, + 0.630341, 0.785675, -0.569336, 0.241821, -0.058899, -0.464111, 0.883789, 0.129608, -0.94519, 0.299622, -0.357819, + 0.907654, 0.219238, -0.842133, -0.439117, -0.312927, -0.313477, 0.84433, 0.434479, -0.241211, 0.053253, 0.968994, + 0.063873, 0.823273, 0.563965, 0.476288, 0.862152, -0.172516, 0.620941, -0.298126, 0.724915, 0.25238, -0.749359, + -0.612122, -0.577545, 0.386566, 0.718994, -0.406342, -0.737976, 0.538696, 0.04718, 0.556305, 0.82959, -0.802856, + 0.587463, 0.101166, -0.707733, -0.705963, 0.026428, 0.374908, 0.68457, 0.625092, 0.472137, 0.208405, -0.856506, + -0.703064, -0.581085, -0.409821, -0.417206, -0.736328, 0.532623, -0.447876, -0.20285, -0.870728, 0.086945, + -0.990417, 0.107086, 0.183685, 0.018341, -0.982788, 0.560638, -0.428864, 0.708282, 0.296722, -0.952576, -0.0672, + 0.135773, 0.990265, 0.030243, -0.068787, 0.654724, 0.752686, 0.762604, -0.551758, 0.337585, -0.819611, -0.407684, + 0.402466, -0.727844, -0.55072, -0.408539, -0.855774, -0.480011, 0.19281, 0.693176, -0.079285, 0.716339, 0.226013, + 0.650116, -0.725433, 0.246704, 0.953369, -0.173553, -0.970398, -0.239227, -0.03244, 0.136383, -0.394318, 0.908752, + 0.813232, 0.558167, 0.164368, 0.40451, 0.549042, -0.731323, -0.380249, -0.566711, 0.730865, 0.022156, 0.932739, + 0.359741, 0.00824, 0.996552, -0.082306, 0.956635, -0.065338, -0.283722, -0.743561, 0.008209, 0.668579, -0.859589, + -0.509674, 0.035767, -0.852234, 0.363678, -0.375977, -0.201965, -0.970795, -0.12915, 0.313477, 0.947327, 0.06546, + -0.254028, -0.528259, 0.81015, 0.628052, 0.601105, 0.49411, -0.494385, 0.868378, 0.037933, 0.275635, -0.086426, + 0.957336, -0.197937, 0.468903, -0.860748, 0.895599, 0.399384, 0.195801, 0.560791, 0.825012, -0.069214, 0.304199, + -0.849487, 0.43103, 0.096375, 0.93576, 0.339111, -0.051422, 0.408966, -0.911072, 0.330444, 0.942841, -0.042389, + -0.452362, -0.786407, 0.420563, 0.134308, -0.933472, -0.332489, 0.80191, -0.566711, -0.188934, -0.987946, -0.105988, + 0.112518, -0.24408, 0.892242, -0.379791, -0.920502, 0.229095, -0.316376, 0.7789, 0.325958, 0.535706, -0.912872, + 0.185211, -0.36377, -0.184784, 0.565369, -0.803833, -0.018463, 0.119537, 0.992615, -0.259247, -0.935608, 0.239532, + -0.82373, -0.449127, -0.345947, -0.433105, 0.659515, 0.614349, -0.822754, 0.378845, -0.423676, 0.687195, -0.674835, + -0.26889, -0.246582, -0.800842, 0.545715, -0.729187, -0.207794, 0.651978, 0.653534, -0.610443, -0.447388, 0.492584, + -0.023346, 0.869934, 0.609039, 0.009094, -0.79306, 0.962494, -0.271088, -0.00885, 0.2659, -0.004913, 0.963959, + 0.651245, 0.553619, -0.518951, 0.280548, -0.84314, 0.458618, -0.175293, -0.983215, 0.049805, 0.035339, -0.979919, + 0.196045, -0.982941, 0.164307, -0.082245, 0.233734, -0.97226, -0.005005, -0.747253, -0.611328, 0.260437, 0.645599, + 0.592773, 0.481384, 0.117706, -0.949524, -0.29068, -0.535004, -0.791901, -0.294312, -0.627167, -0.214447, 0.748718, + -0.047974, -0.813477, -0.57959, -0.175537, 0.477264, -0.860992, 0.738556, -0.414246, -0.53183, 0.562561, -0.704071, +0.433289, -0.754944, 0.64801, -0.100586, 0.114716, 0.044525, -0.992371, 0.966003, 0.244873, -0.082764, }; /**************************/ diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 492d63dbe8e..362b288dbb4 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -143,9 +143,9 @@ public: virtual void change_eul_to_quat(Object *ob, bAction *act); #endif - void translate_Animations(COLLADAFW::Node * Node , + void translate_Animations(COLLADAFW::Node * Node, std::map& root_map, - std::multimap& object_map , + std::multimap& object_map, std::map FW_object_map); AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map FW_object_map ); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a3c9ff38e87..a1f69ef16bd 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -371,7 +371,7 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod Object *new_child = NULL; if (inodes.getCount()) { // \todo loop through instance nodes const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId(); - fprintf(stderr,"Doing %d child nodes\n" ,node_map.count(id)); + fprintf(stderr, "Doing %d child nodes\n", node_map.count(id)); new_child = create_instance_node(object_map.find(id)->second, node_map[id], child_node, sce, is_library_node); } else { @@ -401,7 +401,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren par = add_object(sce, OB_ARMATURE); bc_set_parent(par, empty->parent, mContext); //remove empty : todo - object_map.insert( std::make_pair(parent_node->getUniqueId(),par) ); + object_map.insert(std::make_pair(parent_node->getUniqueId(), par)); } armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce); } @@ -450,14 +450,14 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren ob = NULL; } else { - std::pair::iterator, std::multimap::iterator> pair_iter = object_map.equal_range(node_id); - for(std::multimap::iterator it2 = pair_iter.first; it2 != pair_iter.second; it2++){ + std::pair::iterator, std::multimap::iterator> pair_iter = object_map.equal_range(node_id); + for (std::multimap::iterator it2 = pair_iter.first; it2 != pair_iter.second; it2++) { Object *source_ob = (Object *)it2->second; COLLADAFW::Node *source_node = node_map[node_id]; ob = create_instance_node(source_ob, source_node, node, sce, is_library_node); } } - if(ob != NULL) objects_done->push_back(ob); + if (ob != NULL) objects_done->push_back(ob); ++inst_done; read_transform = false; @@ -472,11 +472,11 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren // XXX: if there're multiple instances, only one is stored if (!ob) return; - for(std::vector::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { + for (std::vector::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { ob = *it; std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId(); rename_id(&ob->id, (char*)nodename.c_str()); - object_map.insert( std::make_pair(node->getUniqueId(),ob) ); + object_map.insert(std::make_pair(node->getUniqueId(), ob)); node_map[node->getUniqueId()] = node; if (is_library_node) @@ -485,7 +485,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren } - for(std::vector::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { + for (std::vector::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { ob =*it; if (read_transform) diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index e8c1a034dc9..92f4d6f01d5 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4368,8 +4368,9 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) /* Delete unused vertices, edges, and faces */ if (RNA_boolean_get(op->ptr, "delete_unused")) { - if(!EDBM_op_callf(em, op, "del geom=%s context=%i", - &bmop, "unused_geom", DEL_ONLYTAGGED)) { + if (!EDBM_op_callf(em, op, "del geom=%s context=%i", + &bmop, "unused_geom", DEL_ONLYTAGGED)) + { EDBM_op_finish(em, &bmop, op, TRUE); return OPERATOR_CANCELLED; } @@ -4377,8 +4378,9 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) /* Delete hole edges/faces */ if (RNA_boolean_get(op->ptr, "make_holes")) { - if(!EDBM_op_callf(em, op, "del geom=%s context=%i", - &bmop, "holes_geom", DEL_ONLYTAGGED)) { + if (!EDBM_op_callf(em, op, "del geom=%s context=%i", + &bmop, "holes_geom", DEL_ONLYTAGGED)) + { EDBM_op_finish(em, &bmop, op, TRUE); return OPERATOR_CANCELLED; } @@ -4386,9 +4388,10 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) /* Merge adjacent triangles */ if (RNA_boolean_get(op->ptr, "join_triangles")) { - if(!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f", - &bmop, "geomout", - RNA_float_get(op->ptr, "limit"))) { + if (!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f", + &bmop, "geomout", + RNA_float_get(op->ptr, "limit"))) + { EDBM_op_finish(em, &bmop, op, TRUE); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index aa3ae0077a9..24bc01989fc 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -344,12 +344,12 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) BLI_strncpy(filename, path, sizeof(filename)); BLI_path_abs(filename, bmain->name); - if(split) + if (split) result = AUD_mixdown_per_channel(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, - accuracy, filename, specs, container, codec, bitrate); + accuracy, filename, specs, container, codec, bitrate); else result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, - accuracy, filename, specs, container, codec, bitrate); + accuracy, filename, specs, container, codec, bitrate); if (result) { BKE_report(op->reports, RPT_ERROR, result); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6d72ca99678..81791721015 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -654,7 +654,7 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= TREDRAW_HARD; } else if (t->mode == TFM_TRANSLATION) { - if(t->options & CTX_MOVIECLIP) { + if (t->options & CTX_MOVIECLIP) { restoreTransObjects(t); t->flag ^= T_ALT_TRANSFORM; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 75bd0de5d1a..5ee3e4bb96d 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -618,9 +618,8 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) { Bone *bone= lb->first; - for (;bone;bone= bone->next) { - if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED)) - { + for ( ; bone;bone= bone->next) { + if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED)) { bone->flag |= BONE_HINGE_CHILD_TRANSFORM; } else if ((bone->flag & BONE_TRANSFORM) && @@ -696,8 +695,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) } /* if there are no translatable bones, do rotation */ - if (mode == TFM_TRANSLATION && !hastranslation) - { + if (mode == TFM_TRANSLATION && !hastranslation) { *out_mode = TFM_ROTATION; } @@ -1025,16 +1023,13 @@ static void createTransArmatureVerts(TransInfo *t) t->mode= TFM_BONE_ENVELOPE; t->total = 0; - for (ebo = edbo->first; ebo; ebo = ebo->next) - { - if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) - { - if (t->mode==TFM_BONESIZE) - { + for (ebo = edbo->first; ebo; ebo = ebo->next) { + if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) { + if (t->mode == TFM_BONESIZE) { if (ebo->flag & BONE_SELECTED) t->total++; } - else if (t->mode==TFM_BONE_ROLL) { + else if (t->mode == TFM_BONE_ROLL) { if (ebo->flag & BONE_SELECTED) t->total++; } @@ -1054,16 +1049,12 @@ static void createTransArmatureVerts(TransInfo *t) td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone"); - for (ebo = edbo->first; ebo; ebo = ebo->next) - { + for (ebo = edbo->first; ebo; ebo = ebo->next) { ebo->oldlength = ebo->length; // length==0.0 on extrude, used for scaling radius of bone points - if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) - { - if (t->mode==TFM_BONE_ENVELOPE) - { - if (ebo->flag & BONE_ROOTSEL) - { + if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) { + if (t->mode==TFM_BONE_ENVELOPE) { + if (ebo->flag & BONE_ROOTSEL) { td->val= &ebo->rad_head; td->ival= *td->val; @@ -1079,8 +1070,7 @@ static void createTransArmatureVerts(TransInfo *t) td++; } - if (ebo->flag & BONE_TIPSEL) - { + if (ebo->flag & BONE_TIPSEL) { td->val= &ebo->rad_tail; td->ival= *td->val; copy_v3_v3(td->center, ebo->tail); @@ -1099,8 +1089,7 @@ static void createTransArmatureVerts(TransInfo *t) } else if (t->mode==TFM_BONESIZE) { if (ebo->flag & BONE_SELECTED) { - if (arm->drawtype==ARM_ENVELOPE) - { + if (arm->drawtype==ARM_ENVELOPE) { td->loc= NULL; td->val= &ebo->dist; td->ival= ebo->dist; @@ -1130,8 +1119,7 @@ static void createTransArmatureVerts(TransInfo *t) } } else if (t->mode==TFM_BONE_ROLL) { - if (ebo->flag & BONE_SELECTED) - { + if (ebo->flag & BONE_SELECTED) { td->loc= NULL; td->val= &(ebo->roll); td->ival= ebo->roll; @@ -1146,8 +1134,7 @@ static void createTransArmatureVerts(TransInfo *t) } } else { - if (ebo->flag & BONE_TIPSEL) - { + if (ebo->flag & BONE_TIPSEL) { copy_v3_v3(td->iloc, ebo->tail); copy_v3_v3(td->center, (t->around==V3D_LOCAL) ? ebo->head : td->iloc); td->loc= ebo->tail; @@ -1161,8 +1148,7 @@ static void createTransArmatureVerts(TransInfo *t) sub_v3_v3v3(delta, ebo->tail, ebo->head); vec_roll_to_mat3(delta, ebo->roll, td->axismtx); - if ((ebo->flag & BONE_ROOTSEL) == 0) - { + if ((ebo->flag & BONE_ROOTSEL) == 0) { td->extra = ebo; } @@ -1172,8 +1158,7 @@ static void createTransArmatureVerts(TransInfo *t) td++; } - if (ebo->flag & BONE_ROOTSEL) - { + if (ebo->flag & BONE_ROOTSEL) { copy_v3_v3(td->iloc, ebo->head); copy_v3_v3(td->center, td->iloc); td->loc= ebo->head; @@ -1943,8 +1928,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) char *selstate = NULL; short selectmode = ts->selectmode; - if (t->flag & T_MIRROR) - { + if (t->flag & T_MIRROR) { EDBM_verts_mirror_cache_begin(em, TRUE); mirror = 1; } @@ -2071,8 +2055,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); for (a=0; eve; eve=BM_iter_step(&iter), a++) { if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) { - if (eve->co[0]<0.0f) - { + if (eve->co[0] < 0.0f) { t->mirror = -1; mirror = -1; } @@ -2144,13 +2127,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } } - if (mirror != 0) - { + if (mirror != 0) { tob = t->data; - for (a = 0; a < t->total; a++, tob++ ) - { - if (ABS(tob->loc[0]) <= 0.00001f) - { + for (a = 0; a < t->total; a++, tob++ ) { + if (ABS(tob->loc[0]) <= 0.00001f) { tob->flag |= TD_MIRROR_EDGE; } } diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index c15366c4976..32e4ff8d81c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -914,10 +914,10 @@ void GPU_framebuffer_blur(GPUFrameBuffer *fb, GPUTexture *tex, GPUFrameBuffer *b /* Drawing quad */ glBegin(GL_QUADS); - glTexCoord2d(0,0);glVertex2f(1,1); - glTexCoord2d(1,0);glVertex2f(-1,1); - glTexCoord2d(1,1);glVertex2f(-1,-1); - glTexCoord2d(0,1);glVertex2f(1,-1); + glTexCoord2d(0, 0); glVertex2f(1, 1); + glTexCoord2d(1, 0); glVertex2f(-1, 1); + glTexCoord2d(1, 1); glVertex2f(-1, -1); + glTexCoord2d(0, 1); glVertex2f(1, -1); glEnd(); /* Blurring vertically */ @@ -927,12 +927,14 @@ void GPU_framebuffer_blur(GPUFrameBuffer *fb, GPUTexture *tex, GPUFrameBuffer *b GPU_shader_uniform_vector(blur_shader, scale_uniform, 2, 1, (float*)scalev); GPU_shader_uniform_texture(blur_shader, texture_source_uniform, blurtex); GPU_texture_bind(blurtex, 0); + glBegin(GL_QUADS); - glTexCoord2d(0,0);glVertex2f(1,1); - glTexCoord2d(1,0);glVertex2f(-1,1); - glTexCoord2d(1,1);glVertex2f(-1,-1); - glTexCoord2d(0,1);glVertex2f(1,-1); + glTexCoord2d(0, 0); glVertex2f(1, 1); + glTexCoord2d(1, 0); glVertex2f(-1, 1); + glTexCoord2d(1, 1); glVertex2f(-1, -1); + glTexCoord2d(0, 1); glVertex2f(1, -1); glEnd(); + GPU_shader_unbind(blur_shader); } @@ -1267,18 +1269,17 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) { GPUShader *retval = NULL; - switch (shader) - { - case GPU_SHADER_VSM_STORE: - if (!GG.shaders.vsm_store) - GG.shaders.vsm_store = GPU_shader_create(datatoc_gpu_shader_vsm_store_vert_glsl, datatoc_gpu_shader_vsm_store_frag_glsl, NULL); - retval = GG.shaders.vsm_store; - break; - case GPU_SHADER_SEP_GAUSSIAN_BLUR: - if (!GG.shaders.sep_gaussian_blur) - GG.shaders.sep_gaussian_blur = GPU_shader_create(datatoc_gpu_shader_sep_gaussian_blur_vert_glsl, datatoc_gpu_shader_sep_gaussian_blur_frag_glsl, NULL); - retval = GG.shaders.sep_gaussian_blur; - break; + switch (shader) { + case GPU_SHADER_VSM_STORE: + if (!GG.shaders.vsm_store) + GG.shaders.vsm_store = GPU_shader_create(datatoc_gpu_shader_vsm_store_vert_glsl, datatoc_gpu_shader_vsm_store_frag_glsl, NULL); + retval = GG.shaders.vsm_store; + break; + case GPU_SHADER_SEP_GAUSSIAN_BLUR: + if (!GG.shaders.sep_gaussian_blur) + GG.shaders.sep_gaussian_blur = GPU_shader_create(datatoc_gpu_shader_sep_gaussian_blur_vert_glsl, datatoc_gpu_shader_sep_gaussian_blur_frag_glsl, NULL); + retval = GG.shaders.sep_gaussian_blur; + break; } if (retval == NULL) @@ -1289,14 +1290,12 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) void GPU_shader_free_builtin_shaders() { - if (GG.shaders.vsm_store) - { + if (GG.shaders.vsm_store) { MEM_freeN(GG.shaders.vsm_store); GG.shaders.vsm_store = NULL; } - if (GG.shaders.sep_gaussian_blur) - { + if (GG.shaders.sep_gaussian_blur) { MEM_freeN(GG.shaders.sep_gaussian_blur); GG.shaders.sep_gaussian_blur = NULL; } diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 5f046806beb..173fbf02287 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -327,10 +327,11 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v mul_m4_v3(viewmat, lamp->dynco); } - if (material->dynproperty & DYN_LAMP_IMAT) + if (material->dynproperty & DYN_LAMP_IMAT) { mult_m4_m4m4(lamp->dynimat, lamp->imat, viewinv); - if (material->dynproperty & DYN_LAMP_PERSMAT) - { + } + + if (material->dynproperty & DYN_LAMP_PERSMAT) { if (!GPU_lamp_has_shadow_buffer(lamp)) /* The lamp matrices are already updated if we're using shadow buffers */ GPU_lamp_update_buffer_mats(lamp); mult_m4_m4m4(lamp->dynpersmat, lamp->persmat, viewinv); @@ -1611,7 +1612,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l /* makeshadowbuf */ if (lamp->type == LA_SUN) { wsize = la->shadow_frustum_size; - orthographic_m4( lamp->winmat,-wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend); + orthographic_m4(lamp->winmat, -wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend); } else { angle= saacos(lamp->spotsi); @@ -1636,11 +1637,11 @@ static void gpu_lamp_shadow_free(GPULamp *lamp) GPU_framebuffer_free(lamp->fb); lamp->fb= NULL; } - if(lamp->blurtex) { + if (lamp->blurtex) { GPU_texture_free(lamp->blurtex); lamp->blurtex= NULL; } - if(lamp->blurfb) { + if (lamp->blurfb) { GPU_framebuffer_free(lamp->blurfb); lamp->blurfb= NULL; } @@ -1721,7 +1722,7 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par) } else { lamp->tex = GPU_texture_create_depth(lamp->size, lamp->size, NULL); - if(!lamp->tex) { + if (!lamp->tex) { gpu_lamp_shadow_free(lamp); return lamp; } @@ -1814,7 +1815,7 @@ void GPU_lamp_shadow_buffer_bind(GPULamp *lamp, float viewmat[][4], int *winsize glDisable(GL_SCISSOR_TEST); GPU_framebuffer_texture_bind(lamp->fb, lamp->tex, GPU_texture_opengl_width(lamp->tex), GPU_texture_opengl_height(lamp->tex)); - if(lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) + if (lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) GPU_shader_bind(GPU_shader_get_builtin_shader(GPU_SHADER_VSM_STORE)); /* set matrices */ @@ -1825,7 +1826,7 @@ void GPU_lamp_shadow_buffer_bind(GPULamp *lamp, float viewmat[][4], int *winsize void GPU_lamp_shadow_buffer_unbind(GPULamp *lamp) { - if(lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) { + if (lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) { GPU_shader_unbind(GPU_shader_get_builtin_shader(GPU_SHADER_VSM_STORE)); GPU_framebuffer_blur(lamp->fb, lamp->tex, lamp->blurfb, lamp->blurtex); } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index e2a956f0dba..2fd259d2816 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -239,7 +239,7 @@ static int imb_tiff_CloseProc(thandle_t handle) /* get the pointer to the in-memory file */ mfile = IMB_TIFF_GET_MEMFILE(handle); if (!mfile || !mfile->mem) { - fprintf(stderr,"imb_tiff_CloseProc: !mfile || !mfile->mem!\n"); + fprintf(stderr, "imb_tiff_CloseProc: !mfile || !mfile->mem!\n"); return (0); } @@ -265,7 +265,7 @@ static toff_t imb_tiff_SizeProc(thandle_t handle) /* get the pointer to the in-memory file */ mfile = IMB_TIFF_GET_MEMFILE(handle); if (!mfile || !mfile->mem) { - fprintf(stderr,"imb_tiff_SizeProc: !mfile || !mfile->mem!\n"); + fprintf(stderr, "imb_tiff_SizeProc: !mfile || !mfile->mem!\n"); return (0); } diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 22001cf6bae..88bab4d5af3 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -95,8 +95,7 @@ static int rna_use_shadow_get(PointerRNA *ptr) static void rna_use_shadow_set(PointerRNA *ptr, int value) { Lamp *la = (Lamp*)ptr->data; - if (value) - { + if (value) { la->mode |= LA_SHAD_BUF; la->mode &= ~LA_SHAD_RAY; } @@ -495,7 +494,7 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_shadbuffiltertype_items[] = { - {LA_SHADBUF_BOX , "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"}, + {LA_SHADBUF_BOX, "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"}, {LA_SHADBUF_TENT, "TENT", 0, "Tent", "Apply the Tent Filter to shadow buffer samples"}, {LA_SHADBUF_GAUSS, "GAUSS", 0, "Gauss", "Apply the Gauss filter to shadow buffer samples"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ba927a1c739..986c76db199 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1924,7 +1924,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if(scene) { + if (scene) { prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index d93779fc07d..dc1429208a0 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -226,7 +226,7 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformVertsEM */ NULL /* deformVertsEM */ , + /* deformVertsEM */ NULL, /* deformMatrices */ NULL, /* deformMatricesEM */ NULL, /* applyModifier */ NULL, diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index dd09bc5d0d4..c7fbcb46c23 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -34,15 +34,15 @@ /* ******************* channel Difference Matte ********************************* */ static bNodeSocketTemplate cmp_node_diff_matte_in[]={ - {SOCK_RGBA,1,"Image 1", 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA,1,"Image 2", 1.0f, 1.0f, 1.0f, 1.0f}, - {-1,0,""} + {SOCK_RGBA, 1, "Image 1", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, 1, "Image 2", 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, 0, ""} }; static bNodeSocketTemplate cmp_node_diff_matte_out[]={ - {SOCK_RGBA,0,"Image"}, - {SOCK_FLOAT,0,"Matte"}, - {-1,0,""} + {SOCK_RGBA, 0, "Image"}, + {SOCK_FLOAT, 0, "Matte"}, + {-1, 0, ""} }; static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *inColor2) @@ -65,10 +65,10 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * copy_v3_v3(outColor, inColor1); if (difference <= tolerence) { - if(difference<=falloff) { - alpha=0.0f; + if (difference <= falloff) { + alpha = 0.0f; } - else{ + else { /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/ alpha=(difference-falloff)/(tolerence-falloff); } @@ -77,9 +77,9 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * maxInputAlpha=maxf(inColor1[3], inColor2[3]); if (alpha < maxInputAlpha) { /*clamp*/ - if(alpha<0.0f) alpha=0.0f; - if(alpha>1.0f) alpha=1.0f; - outColor[3]=alpha; + if (alpha < 0.0f) alpha = 0.0f; + if (alpha > 1.0f) alpha = 1.0f; + outColor[3] = alpha; } else { /* leave as before */ outColor[3]=maxInputAlpha; diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index a485210e37e..1976aa45eed 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -34,15 +34,15 @@ /* ******************* channel Distance Matte ********************************* */ static bNodeSocketTemplate cmp_node_distance_matte_in[]={ - {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA,1,"Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, - {-1,0,""} + {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, 1, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, 0, ""} }; static bNodeSocketTemplate cmp_node_distance_matte_out[]={ - {SOCK_RGBA,0,"Image"}, - {SOCK_FLOAT,0,"Matte"}, - {-1,0,""} + {SOCK_RGBA, 0, "Image"}, + {SOCK_FLOAT, 0, "Matte"}, + {-1, 0, ""} }; /* note, keyvals is passed on from caller as stack array */ @@ -64,10 +64,10 @@ static void do_distance_matte(bNode *node, float *out, float *in) copy_v3_v3(out, in); if (distance <= tolerence) { - if(distance<=falloff) { - alpha=0.0f; + if (distance <= falloff) { + alpha = 0.0f; } - else{ + else { /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/ alpha=(distance-falloff)/(tolerence-falloff); } @@ -75,8 +75,8 @@ static void do_distance_matte(bNode *node, float *out, float *in) /*only change if more transparent than before */ if (alpha < in[3]) { /*clamp*/ - if(alpha<0.0f) alpha=0.0f; - if(alpha>1.0f) alpha=1.0f; + if (alpha < 0.0f) alpha = 0.0f; + if (alpha > 1.0f) alpha = 1.0f; out[3]=alpha; } else { /* leave as before */ @@ -115,10 +115,10 @@ static void do_chroma_distance_matte(bNode *node, float *out, float *in) copy_v3_v3(out, in); if (distance <= tolerence) { - if(distance<=falloff) { - alpha=0.0f; + if (distance <= falloff) { + alpha = 0.0f; } - else{ + else { /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/ alpha=(distance-falloff)/(tolerence-falloff); } @@ -126,8 +126,8 @@ static void do_chroma_distance_matte(bNode *node, float *out, float *in) /*only change if more transparent than before */ if (alpha < in[3]) { /*clamp*/ - if(alpha<0.0f) alpha=0.0f; - if(alpha>1.0f) alpha=1.0f; + if (alpha < 0.0f) alpha = 0.0f; + if (alpha > 1.0f) alpha = 1.0f; out[3]=alpha; } else { /* leave as before */ @@ -162,7 +162,7 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac c->key[2]= in[1]->vec[2]; /* work in RGB color space */ - if(c->channel==1) { + if (c->channel == 1) { /* note, processor gets a keyvals array passed on as buffer constant */ composit1_pixel_processor(node, workbuf, workbuf, in[0]->vec, do_distance_matte, CB_RGBA); } diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 5d0e7c1d4c8..111ec75dd27 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -484,7 +484,7 @@ void AtmospherePixleShader(struct SunSky* sunSky, float view[3], float s, float FOPVEC3(vTemp2, 1.0f, -, E1); VEC3OPV(vTemp1, vTemp1, *, vTemp2); - FOPVEC3(vTemp2, 1.0f, / , sunSky->atm_BetaRM); + FOPVEC3(vTemp2, 1.0f, /, sunSky->atm_BetaRM); VEC3OPV(I, vTemp1, *, vTemp2); diff --git a/source/creator/creator.c b/source/creator/creator.c index 13daeec87be..c28f72881cf 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1322,8 +1322,7 @@ int main(int argc, const char **argv) BLI_argsFree(ba); #ifdef WIN32 - while (argci) - { + while (argci) { free(argv[--argci]); } MEM_freeN(argv); diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index 1739f26ab6f..d489c015273 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -500,7 +500,7 @@ PyObject* KX_VertexProxy::PyGetRGBA() PyObject* KX_VertexProxy::PySetRGBA(PyObject* value) { - if PyLong_Check(value) { + if (PyLong_Check(value)) { int rgba = PyLong_AsSsize_t(value); m_vertex->SetRGBA(rgba); m_mesh->SetMeshModified(true); diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 592ddbe07d3..d6c9ddd9603 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -386,7 +386,7 @@ public: */ virtual void SetPolygonOffset(float mult, float add) = 0; - virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)=0; + virtual void DrawDebugLine(const MT_Vector3& from, const MT_Vector3& to, const MT_Vector3& color)=0; virtual void DrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color, const MT_Vector3& normal, int nsector)=0; virtual void FlushDebugShapes()=0; From 4cfa761951b885a06608b1f0f1feda4c8c617544 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 20:36:39 +0000 Subject: [PATCH 23/55] source code style checker to, (similar to pythons pep8 checker) currently checks for brace placement and some whitespace use. can be accessed with: make test_style or... source/tools/check_style_c.py source/blender also style cleanup on bmo_primitives.c --- GNUmakefile | 5 +- .../blender/bmesh/operators/bmo_primitive.c | 350 +++++++++--------- 2 files changed, 179 insertions(+), 176 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index b448f93310d..fcbc79e26a8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -164,6 +164,7 @@ help: @echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions" @echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting" @echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed" + @echo " * test_style - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle" @echo "" @echo "Static Source Code Checking (not assosiated with building blender)" @echo " * check_cppcheck - run blender source through cppcheck (C & C++)" @@ -213,6 +214,9 @@ test_cmake: test_deprecated: python3 source/tests/check_deprecated.py +test_style: + # run our own checks on C/C++ style + PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator # ----------------------------------------------------------------------------- # Project Files @@ -250,7 +254,6 @@ check_spelling_py: check_spelling_c: cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source - # ----------------------------------------------------------------------------- # Documentation # diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 6fd3c8ce99c..a08532fde3a 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -36,41 +36,41 @@ /* ************************ primitives ******************* */ static float icovert[12][3] = { - {0.0f,0.0f,-200.0f}, - {144.72f, -105.144f,-89.443f}, - {-55.277f, -170.128,-89.443f}, - {-178.885f,0.0f,-89.443f}, - {-55.277f,170.128f,-89.443f}, - {144.72f,105.144f,-89.443f}, - {55.277f,-170.128f,89.443f}, - {-144.72f,-105.144f,89.443f}, - {-144.72f,105.144f,89.443f}, - {55.277f,170.128f,89.443f}, - {178.885f,0.0f,89.443f}, - {0.0f,0.0f,200.0f} + {0.0f, 0.0f, -200.0f}, + {144.72f, -105.144f, -89.443f}, + {-55.277f, -170.128, -89.443f}, + {-178.885f, 0.0f, -89.443f}, + {-55.277f, 170.128f, -89.443f}, + {144.72f, 105.144f, -89.443f}, + {55.277f, -170.128f, 89.443f}, + {-144.72f, -105.144f, 89.443f}, + {-144.72f, 105.144f, 89.443f}, + {55.277f, 170.128f, 89.443f}, + {178.885f, 0.0f, 89.443f}, + {0.0f, 0.0f, 200.0f} }; static short icoface[20][3] = { - {0,1,2}, - {1,0,5}, - {0,2,3}, - {0,3,4}, - {0,4,5}, - {1,5,10}, - {2,1,6}, - {3,2,7}, - {4,3,8}, - {5,4,9}, - {1,10,6}, - {2,6,7}, - {3,7,8}, - {4,8,9}, - {5,9,10}, - {6,10,11}, - {7,6,11}, - {8,7,11}, - {9,8,11}, - {10,9,11} + {0, 1, 2}, + {1, 0, 5}, + {0, 2, 3}, + {0, 3, 4}, + {0, 4, 5}, + {1, 5, 10}, + {2, 1, 6}, + {3, 2, 7}, + {4, 3, 8}, + {5, 4, 9}, + {1, 10, 6}, + {2, 6, 7}, + {3, 7, 8}, + {4, 8, 9}, + {5, 9, 10}, + {6, 10, 11}, + {7, 6, 11}, + {8, 7, 11}, + {9, 8, 11}, + {10, 9, 11} }; /* HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker @@ -81,149 +81,149 @@ static int monkeyo = 4; static int monkeynv = 271; static int monkeynf = 250; static signed char monkeyv[271][3] = { - {-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92}, - {-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83}, - {-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102}, - {-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92}, - {-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74}, - {-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99}, - {-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105}, - {-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100}, - {-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100}, - {-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73}, - {-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45}, - {-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68}, - {-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68}, - {-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80}, - {-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96}, - {-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90}, - {-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85}, - {-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94}, - {-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96}, - {-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95}, - {-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84}, - {-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109}, - {-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88}, - {-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82}, - {-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96}, - {-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96}, - {-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100}, - {-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104}, - {-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71}, - {-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88}, - {-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84}, - {-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81}, - {-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99}, - {-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87}, - {-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100}, - {-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97}, - {-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86}, - {-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96}, - {-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79}, - {-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59}, - {-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37}, - {-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59}, - {-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7}, - {-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9}, - {-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52}, - {-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51}, - {-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55}, - {-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34}, - {-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30}, - {-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7}, - {-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57}, - {-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26}, - {-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16}, - {6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54}, - {4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52}, - {28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28}, - {-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57}, - {31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27}, - {-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35}, - {-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24}, - {-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41}, - {-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41}, - {6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62}, - {7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42}, - {-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48}, - {8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62}, - {33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63}, - {-26,-16,-42},{-17,49,-49}, + {-71, 21, 98}, {-63, 12, 88}, {-57, 7, 74}, {-82, -3, 79}, {-82, 4, 92}, + {-82, 17, 100}, {-92, 21, 102}, {-101, 12, 95}, {-107, 7, 83}, + {-117, 31, 84}, {-109, 31, 95}, {-96, 31, 102}, {-92, 42, 102}, + {-101, 50, 95}, {-107, 56, 83}, {-82, 66, 79}, {-82, 58, 92}, + {-82, 46, 100}, {-71, 42, 98}, {-63, 50, 88}, {-57, 56, 74}, + {-47, 31, 72}, {-55, 31, 86}, {-67, 31, 97}, {-66, 31, 99}, + {-70, 43, 100}, {-82, 48, 103}, {-93, 43, 105}, {-98, 31, 105}, + {-93, 20, 105}, {-82, 31, 106}, {-82, 15, 103}, {-70, 20, 100}, + {-127, 55, 95}, {-127, 45, 105}, {-127, -87, 94}, {-127, -41, 100}, + {-127, -24, 102}, {-127, -99, 92}, {-127, 52, 77}, {-127, 73, 73}, + {-127, 115, -70}, {-127, 72, -109}, {-127, 9, -106}, {-127, -49, -45}, + {-101, -24, 72}, {-87, -56, 73}, {-82, -89, 73}, {-80, -114, 68}, + {-85, -121, 67}, {-104, -124, 71}, {-127, -126, 74}, {-71, -18, 68}, + {-46, -5, 69}, {-21, 19, 57}, {-17, 55, 76}, {-36, 62, 80}, + {-64, 77, 88}, {-86, 97, 94}, {-107, 92, 97}, {-119, 63, 96}, + {-106, 53, 99}, {-111, 39, 98}, {-101, 12, 95}, {-79, 2, 90}, + {-64, 8, 86}, {-47, 24, 83}, {-45, 38, 83}, {-50, 48, 85}, + {-72, 56, 92}, {-95, 60, 97}, {-127, -98, 94}, {-113, -92, 94}, + {-112, -107, 91}, {-119, -113, 89}, {-127, -114, 88}, {-127, -25, 96}, + {-127, -18, 95}, {-114, -19, 95}, {-111, -29, 96}, {-116, -37, 95}, + {-76, -6, 86}, {-48, 7, 80}, {-34, 26, 77}, {-32, 48, 84}, + {-39, 53, 93}, {-71, 70, 102}, {-87, 82, 107}, {-101, 79, 109}, + {-114, 55, 108}, {-111, -13, 104}, {-100, -57, 91}, {-95, -90, 88}, + {-93, -105, 85}, {-97, -117, 81}, {-106, -119, 81}, {-127, -121, 82}, + {-127, 6, 93}, {-127, 27, 98}, {-85, 61, 95}, {-106, 18, 96}, + {-110, 27, 97}, {-112, -88, 94}, {-117, -57, 96}, {-127, -57, 96}, + {-127, -42, 95}, {-115, -35, 100}, {-110, -29, 102}, {-113, -17, 100}, + {-122, -16, 100}, {-127, -26, 106}, {-121, -19, 104}, {-115, -20, 104}, + {-113, -29, 106}, {-117, -32, 103}, {-127, -37, 103}, {-94, -40, 71}, + {-106, -31, 91}, {-104, -40, 91}, {-97, -32, 71}, {-127, -112, 88}, + {-121, -111, 88}, {-115, -105, 91}, {-115, -95, 93}, {-127, -100, 84}, + {-115, -96, 85}, {-115, -104, 82}, {-121, -109, 81}, {-127, -110, 81}, + {-105, 28, 100}, {-103, 20, 99}, {-84, 55, 97}, {-92, 54, 99}, + {-73, 51, 99}, {-55, 45, 89}, {-52, 37, 88}, {-53, 25, 87}, + {-66, 13, 92}, {-79, 8, 95}, {-98, 14, 100}, {-104, 38, 100}, + {-100, 48, 100}, {-97, 46, 97}, {-102, 38, 97}, {-96, 16, 97}, + {-79, 11, 93}, {-68, 15, 90}, {-57, 27, 86}, {-56, 36, 86}, + {-59, 43, 87}, {-74, 50, 96}, {-91, 51, 98}, {-84, 52, 96}, + {-101, 22, 96}, {-102, 29, 96}, {-113, 59, 78}, {-102, 85, 79}, + {-84, 88, 76}, {-65, 71, 71}, {-40, 58, 63}, {-25, 52, 59}, + {-28, 21, 48}, {-50, 0, 53}, {-71, -12, 60}, {-127, 115, 37}, + {-127, 126, -10}, {-127, -25, -86}, {-127, -59, 24}, {-127, -125, 59}, + {-127, -103, 44}, {-127, -73, 41}, {-127, -62, 36}, {-18, 30, 7}, + {-17, 41, -6}, {-28, 34, -56}, {-68, 56, -90}, {-33, -6, 9}, + {-51, -16, -21}, {-45, -1, -55}, {-84, 7, -85}, {-97, -45, 52}, + {-104, -53, 33}, {-90, -91, 49}, {-95, -64, 50}, {-85, -117, 51}, + {-109, -97, 47}, {-111, -69, 46}, {-106, -121, 56}, {-99, -36, 55}, + {-100, -29, 60}, {-101, -22, 64}, {-100, -50, 21}, {-89, -40, -34}, + {-83, -19, -69}, {-69, 111, -49}, {-69, 119, -9}, {-69, 109, 30}, + {-68, 67, 55}, {-34, 52, 43}, {-46, 58, 36}, {-45, 90, 7}, + {-25, 72, 16}, {-25, 79, -15}, {-45, 96, -25}, {-45, 87, -57}, + {-25, 69, -46}, {-48, 42, -75}, {-65, 3, -70}, {-22, 42, -26}, + {-75, -22, 19}, {-72, -25, -27}, {-13, 52, -30}, {-28, -18, -16}, + {6, -13, -42}, {37, 7, -55}, {46, 41, -54}, {31, 65, -54}, + {4, 61, -40}, {3, 53, -37}, {25, 56, -50}, {35, 37, -52}, + {28, 10, -52}, {5, -5, -39}, {-21, -9, -17}, {-9, 46, -28}, + {-6, 39, -37}, {-14, -3, -27}, {6, 0, -47}, {25, 12, -57}, + {31, 32, -57}, {23, 46, -56}, {4, 44, -46}, {-19, 37, -27}, + {-20, 22, -35}, {-30, 12, -35}, {-22, 11, -35}, {-19, 2, -35}, + {-23, -2, -35}, {-34, 0, -9}, {-35, -3, -22}, {-35, 5, -24}, + {-25, 26, -27}, {-13, 31, -34}, {-13, 30, -41}, {-23, -2, -41}, + {-18, 2, -41}, {-21, 10, -41}, {-29, 12, -41}, {-19, 22, -41}, + {6, 42, -53}, {25, 44, -62}, {34, 31, -63}, {28, 11, -62}, + {7, 0, -54}, {-14, -2, -34}, {-5, 37, -44}, {-13, 14, -42}, + {-7, 8, -43}, {1, 16, -47}, {-4, 22, -45}, {3, 30, -48}, + {8, 24, -49}, {15, 27, -50}, {12, 35, -50}, {4, 56, -62}, + {33, 60, -70}, {48, 38, -64}, {41, 7, -68}, {6, -11, -63}, + {-26, -16, -42}, {-17, 49, -49}, }; static signed char monkeyf[250][4] = { - {27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4}, - {3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6}, - {5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8}, - {7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12}, - {5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12}, - {-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4}, - {10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4}, - {5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23}, - {20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15}, - {12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, - {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, - {18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44}, - {24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19}, - {16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38}, - {8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39}, - {16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42}, - {19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16}, - {13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32}, - {-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35}, - {34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21}, - {1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11}, - {35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38}, - {-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39}, - {33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34}, - {8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34}, - {-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36}, - {-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27}, - {-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42}, - {25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34}, - {25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26}, - {23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35}, - {-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35}, - {-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58}, - {40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52}, - {-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49}, - {43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24}, - {-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100}, - {-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24}, - {-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110}, - {6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48}, - {17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43}, - {35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6}, - {-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30}, - {4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5}, - {-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13}, - {-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30}, - {-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31}, - {30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35}, - {32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27}, - {25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23}, - {11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35}, - {32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4}, - {-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35}, - {24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33}, - {24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35}, - {11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36}, - {35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39}, - {18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17}, - {24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19}, - {16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30}, - {-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30}, - {23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66}, - {-68,-67,24,-33}, + {27, 4, 5, 26}, {25, 4, 5, 24}, {3, 6, 5, 4}, {1, 6, 5, 2}, {5, 6, 7, 4}, + {3, 6, 7, 2}, {5, 8, 7, 6}, {3, 8, 7, 4}, {7, 8, 9, 6}, + {5, 8, 9, 4}, {7, 10, 9, 8}, {5, 10, 9, 6}, {9, 10, 11, 8}, + {7, 10, 11, 6}, {9, 12, 11, 10}, {7, 12, 11, 8}, {11, 6, 13, 12}, + {5, 4, 13, 12}, {3, -2, 13, 12}, {-3, -4, 13, 12}, {-5, -10, 13, 12}, + {-11, -12, 14, 12}, {-13, -18, 14, 13}, {-19, 4, 5, 13}, {10, 12, 4, 4}, + {10, 11, 9, 9}, {8, 7, 9, 9}, {7, 5, 6, 6}, {6, 3, 4, 4}, + {5, 1, 2, 2}, {4, -1, 0, 0}, {3, -3, -2, -2}, {22, 67, 68, 23}, + {20, 65, 66, 21}, {18, 63, 64, 19}, {16, 61, 62, 17}, {14, 59, 60, 15}, + {12, 19, 48, 57}, {18, 19, 48, 47}, {18, 19, 48, 47}, {18, 19, 48, 47}, + {18, 19, 48, 47}, {18, 19, 48, 47}, {18, 19, 48, 47}, {18, 19, 48, 47}, + {18, 19, 48, 47}, {18, -9, -8, 47}, {18, 27, 45, 46}, {26, 55, 43, 44}, + {24, 41, 42, 54}, {22, 39, 40, 23}, {20, 37, 38, 21}, {18, 35, 36, 19}, + {16, 33, 34, 17}, {14, 31, 32, 15}, {12, 39, 30, 13}, {11, 48, 45, 38}, + {8, 36, -19, 9}, {8, -20, 44, 47}, {42, 45, 46, 43}, {18, 19, 40, 39}, + {16, 17, 38, 37}, {14, 15, 36, 35}, {32, 44, 43, 33}, {12, 33, 32, 42}, + {19, 44, 43, 42}, {40, 41, 42, -27}, {8, 9, 39, -28}, {15, 43, 42, 16}, + {13, 43, 42, 14}, {11, 43, 42, 12}, {9, -30, 42, 10}, {37, 12, 38, -32}, + {-33, 37, 45, 46}, {-33, 40, 41, 39}, {38, 40, 41, 37}, {36, 40, 41, 35}, + {34, 40, 41, 33}, {36, 39, 38, 37}, {35, 40, 39, 38}, {1, 2, 14, 21}, + {1, 2, 40, 13}, {1, 2, 40, 39}, {1, 24, 12, 39}, {-34, 36, 38, 11}, + {35, 38, 36, 37}, {-37, 8, 35, 37}, {-11, -12, -45, 40}, {-11, -12, 39, 38}, + {-11, -12, 37, 36}, {-11, -12, 35, 34}, {33, 34, 40, 41}, {33, 34, 38, 39}, + {33, 34, 36, 37}, {33, -52, 34, 35}, {33, 37, 36, 34}, {33, 35, 34, 34}, + {8, 7, 37, 36}, {-32, 7, 35, 46}, {-34, -33, 45, 46}, {4, -33, 43, 34}, + {-34, -33, 41, 42}, {-34, -33, 39, 40}, {-34, -33, 37, 38}, {-34, -33, 35, 36}, + {-34, -33, 33, 34}, {-34, -33, 31, 32}, {-34, -4, 28, 30}, {-5, -34, 28, 27}, + {-35, -44, 36, 27}, {26, 35, 36, 45}, {24, 25, 44, 45}, {25, 23, 44, 42}, + {25, 24, 41, 40}, {25, 24, 39, 38}, {25, 24, 37, 36}, {25, 24, 35, 34}, + {25, 24, 33, 32}, {25, 24, 31, 30}, {15, 24, 29, 38}, {25, 24, 27, 26}, + {23, 12, 37, 26}, {11, 12, 35, 36}, {-86, -59, 36, -80}, {-60, -61, 36, 35}, + {-62, -63, 36, 35}, {-64, -65, 36, 35}, {-66, -67, 36, 35}, {-68, -69, 36, 35}, + {-70, -71, 36, 35}, {-72, -73, 36, 35}, {-74, -75, 36, 35}, {42, 43, 53, 58}, + {40, 41, 57, 56}, {38, 39, 55, 57}, {-81, -80, 37, 56}, {-83, -82, 55, 52}, + {-85, -84, 51, 49}, {-87, -86, 48, 49}, {47, 50, 51, 48}, {46, 48, 51, 49}, + {43, 46, 49, 44}, {-92, -91, 45, 42}, {-23, 49, 50, -20}, {-94, 40, 48, -24}, + {-96, -22, 48, 49}, {-97, 48, 21, -90}, {-100, 36, 50, 23}, {22, 49, 48, -100}, + {-101, 47, 46, 22}, {21, 45, 35, 25}, {33, 34, 44, 41}, {13, 14, 28, 24}, + {-107, 26, 30, -106}, {14, 46, 45, 15}, {14, 44, 43, -110}, {-111, 42, 23, -110}, + {6, 7, 45, 46}, {45, 44, 47, 46}, {45, 46, 47, 48}, {47, 46, 49, 48}, + {17, 49, 47, 48}, {17, 36, 46, 48}, {35, 36, 44, 45}, {35, 36, 40, 43}, + {35, 36, 38, 39}, {-4, -3, 37, 35}, {-123, 34, 33, 1}, {-9, -8, -7, -6}, + {-10, -7, 32, -125}, {-127, -11, -126, -126}, {-7, -6, 5, 31}, {4, 5, 33, 30}, + {4, 39, 33, 32}, {4, 35, 32, 38}, {20, 21, 39, 38}, {4, 37, 38, 5}, + {-11, -10, 36, 3}, {-11, 15, 14, 35}, {13, 16, 34, 34}, {-13, 14, 13, 13}, + {-3, 1, 30, 29}, {-3, 28, 29, 1}, {-2, 31, 28, -1}, {12, 13, 27, 30}, + {-2, 26, 12, 12}, {35, 29, 42, 36}, {34, 35, 36, 33}, {32, 35, 36, 31}, + {30, 35, 36, 29}, {28, 35, 36, 27}, {26, 35, 36, 25}, {34, 39, 38, 35}, + {32, 39, 38, 33}, {30, 39, 38, 31}, {28, 39, 38, 29}, {26, 39, 38, 27}, + {25, 31, 32, 38}, {-18, -17, 45, 44}, {-18, 17, 28, 44}, {-24, -20, 42, -23}, + {11, 35, 27, 14}, {25, 28, 39, 41}, {37, 41, 40, 38}, {34, 40, 36, 35}, + {32, 40, 39, 33}, {30, 39, 31, 40}, {21, 29, 39, 22}, {-31, 37, 28, 4}, + {-32, 33, 35, 36}, {32, 33, 34, 34}, {18, 35, 36, 48}, {34, 25, 40, 35}, + {24, 25, 38, 39}, {24, 25, 36, 37}, {24, 25, 34, 35}, {24, 25, 32, 33}, + {24, 13, 41, 31}, {17, 11, 41, 35}, {15, 16, 34, 35}, {13, 14, 34, 35}, + {11, 12, 34, 35}, {9, 10, 34, 35}, {7, 8, 34, 35}, {26, 25, 37, 36}, + {35, 36, 37, 38}, {37, 36, 39, 38}, {37, 38, 39, 40}, {25, 31, 36, 39}, + {18, 34, 35, 30}, {17, 22, 30, 33}, {19, 29, 21, 20}, {16, 26, 29, 17}, + {24, 29, 28, 25}, {22, 31, 28, 23}, {20, 31, 30, 21}, {18, 31, 30, 19}, + {16, 30, 17, 17}, {-21, -22, 35, 34}, {-21, -22, 33, 32}, {-21, -22, 31, 30}, + {-21, -22, 29, 28}, {-21, -22, 27, 26}, {-28, -22, 25, 31}, {24, 28, 29, 30}, + {23, 24, 26, 27}, {23, 24, 25, 25}, {-69, -35, -32, 27}, {-70, 26, 25, -66}, + {-68, -67, 24, -33}, }; -#define VERT_MARK 1 +#define VERT_MARK 1 -#define EDGE_ORIG 1 -#define EDGE_MARK 2 +#define EDGE_ORIG 1 +#define EDGE_MARK 2 -#define FACE_MARK 1 -#define FACE_NEW 2 +#define FACE_MARK 1 +#define FACE_NEW 2 void bmo_create_grid_exec(BMesh *bm, BMOperator *op) { @@ -308,7 +308,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) phid /= 2; for (a = 0; a <= tot; a++) { /* Going in this direction, then edge extruding, makes normals face outward */ - vec[0] = -dia * sinf(phi); + vec[0] = -dia *sinf(phi); vec[1] = 0.0; vec[2] = dia * cosf(phi); eve = BM_vert_create(bm, vec, NULL); @@ -353,7 +353,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) { float len, len2, vec2[3]; - len = 2 * dia * sinf(phid / 2.0f); + len = 2 *dia *sinf(phid / 2.0f); /* length of one segment in shortest parallen */ vec[0] = dia * sinf(phid); @@ -430,7 +430,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) "smooth=%f " "numcuts=%i " "use_gridfill=%b use_sphere=%b", - EDGE_MARK, dia, (1 << (subdiv-1)) - 1, + EDGE_MARK, dia, (1 << (subdiv - 1)) - 1, TRUE, TRUE); BMO_op_exec(bm, &bmop); @@ -467,8 +467,8 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, tv[i], VERT_MARK); tv[monkeynv + i] = (fabsf(v[0] = -v[0]) < 0.001f) ? - tv[i] : - (eve = BM_vert_create(bm, v, NULL), mul_m4_v3(mat, eve->co), eve); + tv[i] : + (eve = BM_vert_create(bm, v, NULL), mul_m4_v3(mat, eve->co), eve); BMO_elem_flag_enable(bm, tv[monkeynv + i], VERT_MARK); @@ -487,7 +487,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op) tv[monkeynv + monkeyf[i][2] + i - monkeyo], tv[monkeynv + monkeyf[i][1] + i - monkeyo], tv[monkeynv + monkeyf[i][0] + i - monkeyo], - (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeynv + monkeyf[i][3] + i - monkeyo]: NULL, + (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeynv + monkeyf[i][3] + i - monkeyo] : NULL, NULL, FALSE); } @@ -525,7 +525,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) for (a = 0; a < segs; a++, phi += phid) { /* Going this way ends up with normal(s) upward */ - vec[0] = -dia * sinf(phi); + vec[0] = -dia *sinf(phi); vec[1] = dia * cosf(phi); vec[2] = 0.0f; mul_m4_v3(mat, vec); From ac4b757287efd4150499fd61eb623331e0df2652 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 1 May 2012 20:45:03 +0000 Subject: [PATCH 24/55] patch [#31216] OpenGL urls updated by Julien DUROURE (julien) update for the apidocs for the BGL module --- doc/python_api/rst/bgl.rst | 244 ++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst index 8fe765836a1..9f7817c6fa2 100644 --- a/doc/python_api/rst/bgl.rst +++ b/doc/python_api/rst/bgl.rst @@ -27,7 +27,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Operate on the accumulation buffer. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type op: Enumerated constant :arg op: The accumulation buffer operation. @@ -39,7 +39,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the alpha test function. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type func: Enumerated constant :arg func: Specifies the alpha comparison function. @@ -52,7 +52,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Determine if textures are loaded in texture memory - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type n: int :arg n: Specifies the number of textures to be queried. @@ -68,7 +68,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Delimit the vertices of a primitive or a group of like primatives - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies the primitive that will be create from vertices between @@ -79,7 +79,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Bind a named texture to a texturing target - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the target to which the texture is bound. @@ -91,7 +91,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Draw a bitmap - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type width, height: int :arg width, height: Specify the pixel width and height of the bitmap image. @@ -109,7 +109,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify pixel arithmetic - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type sfactor: Enumerated constant :arg sfactor: Specifies how the red, green, blue, and alpha source blending factors are @@ -123,7 +123,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Execute a display list - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type list: unsigned int :arg list: Specifies the integer name of the display list to be executed. @@ -133,7 +133,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Execute a list of display lists - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type n: int :arg n: Specifies the number of display lists to be executed. @@ -149,7 +149,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Clear buffers to preset values - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mask: Enumerated constant(s) :arg mask: Bitwise OR of masks that indicate the buffers to be cleared. @@ -159,7 +159,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify clear values for the accumulation buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type red, green, blue, alpha: float :arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the @@ -170,7 +170,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify clear values for the color buffers - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type red, green, blue, alpha: float :arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the @@ -181,7 +181,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the clear value for the depth buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type depth: int :arg depth: Specifies the depth value used when the depth buffer is cleared. @@ -192,7 +192,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the clear value for the color index buffers - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type c: float :arg c: Specifies the index used when the color index buffers are cleared. @@ -203,7 +203,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the clear value for the stencil buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type s: int :arg s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. @@ -213,7 +213,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify a plane against which all geometry is clipped - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type plane: Enumerated constant :arg plane: Specifies which clipping plane is being positioned. @@ -232,7 +232,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set a new color. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type red, green, blue, alpha: Depends on function prototype. :arg red, green, blue: Specify new red, green, and blue values for the current color. @@ -244,7 +244,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Enable and disable writing of frame buffer color components - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type red, green, blue, alpha: int (boolean) :arg red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be @@ -256,7 +256,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Cause a material color to track the current color - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type face: Enumerated constant :arg face: Specifies whether front, back, or both front and back material parameters should @@ -269,7 +269,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Copy pixels in the frame buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y: int :arg x, y: Specify the window coordinates of the lower left corner of the rectangular @@ -314,7 +314,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify whether front- or back-facing facets can be culled - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies whether front- or back-facing facets are candidates for culling. @@ -324,7 +324,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Delete a contiguous group of display lists - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type list: unsigned int :arg list: Specifies the integer name of the first display list to delete @@ -336,7 +336,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Delete named textures - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type n: int :arg n: Specifies the number of textures to be deleted @@ -348,7 +348,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the value used for depth buffer comparisons - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type func: Enumerated constant :arg func: Specifies the depth comparison function. @@ -358,7 +358,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Enable or disable writing into the depth buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type flag: int (boolean) :arg flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, @@ -370,7 +370,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify mapping of depth values from normalized device coordinates to window coordinates - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type zNear: int :arg zNear: Specifies the mapping of the near clipping plane to window coordinates. @@ -384,7 +384,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Disable server-side GL capabilities - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type cap: Enumerated constant :arg cap: Specifies a symbolic constant indicating a GL capability. @@ -394,7 +394,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify which color buffers are to be drawn into - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies up to four color buffers to be drawn into. @@ -404,7 +404,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Write a block of pixels to the frame buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type width, height: int :arg width, height: Specify the dimensions of the pixel rectangle to be @@ -423,7 +423,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Flag edges as either boundary or non-boundary - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type flag: Depends of function prototype :arg flag: Specifies the current edge flag value.The initial value is GL_TRUE. @@ -433,7 +433,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Enable server-side GL capabilities - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type cap: Enumerated constant :arg cap: Specifies a symbolic constant indicating a GL capability. @@ -443,14 +443,14 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Delimit the vertices of a primitive or group of like primitives - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glEndList(): Create or replace a display list - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glEvalCoord (u,v): @@ -460,7 +460,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Evaluate enabled one- and two-dimensional maps - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type u: Depends on function prototype. :arg u: Specifies a value that is the domain coordinate u to the basis function defined @@ -478,7 +478,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Compute a one- or two-dimensional grid of points or lines - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: In glEvalMesh1, specifies whether to compute a one-dimensional @@ -493,7 +493,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Generate and evaluate a single point in a mesh - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type i: int :arg i: Specifies the integer value for grid domain variable i. @@ -505,7 +505,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Controls feedback mode - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type size: int :arg size: Specifies the maximum number of values that can be written into buffer. @@ -520,14 +520,14 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Block until all GL execution is complete - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glFlush(): Force Execution of GL commands in finite time - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glFog (pname, param): @@ -536,7 +536,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify fog parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type pname: Enumerated constant :arg pname: Specifies a single-valued fog parameter. If the function prototype @@ -551,7 +551,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Define front- and back-facing polygons - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies the orientation of front-facing polygons. @@ -561,7 +561,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Multiply the current matrix by a perspective matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type left, right: double (float) :arg left, right: Specify the coordinates for the left and right vertical @@ -578,7 +578,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Generate a contiguous set of empty display lists - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type range: int :arg range: Specifies the number of contiguous empty display lists to be generated. @@ -588,7 +588,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Generate texture names - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type n: int :arg n: Specifies the number of textures name to be generated. @@ -602,7 +602,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return the value or values of a selected parameter - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type pname: Enumerated constant :arg pname: Specifies the parameter value to be returned. @@ -614,7 +614,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return the coefficients of the specified clipping plane - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type plane: Enumerated constant :arg plane: Specifies a clipping plane. The number of clipping planes depends on the @@ -629,7 +629,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return error information - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glGetLight (light, pname, params): @@ -638,7 +638,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return light source parameter values - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type light: Enumerated constant :arg light: Specifies a light source. The number of possible lights depends on the @@ -656,7 +656,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return evaluator parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the symbolic name of a map. @@ -672,7 +672,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return material parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type face: Enumerated constant :arg face: Specifies which of the two materials is being queried. @@ -689,7 +689,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return the specified pixel map - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type map: Enumerated constant :arg map: Specifies the name of the pixel map to return. @@ -701,7 +701,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return the polygon stipple pattern - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mask: :class:`bgl.Buffer` object I{type GL_BYTE} :arg mask: Returns the stipple pattern. The initial value is all 1's. @@ -711,7 +711,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return a string describing the current GL connection - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type name: Enumerated constant :arg name: Specifies a symbolic constant. @@ -724,7 +724,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return texture environment parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. @@ -740,7 +740,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return texture coordinate generation parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type coord: Enumerated constant :arg coord: Specifies a texture coordinate. @@ -754,7 +754,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return a texture image - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies which texture is to be obtained. @@ -776,7 +776,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. return texture parameter values for a specific level of detail - .. seealso:: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html>`_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the symbolic name of the target texture. @@ -795,7 +795,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Return texture parameter values - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the symbolic name of the target texture. @@ -809,7 +809,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify implementation-specific hints - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies a symbolic constant indicating the behavior to be @@ -824,7 +824,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the current color index - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type c: :class:`bgl.Buffer` object. Depends on function prototype. :arg c: Specifies a pointer to a one element array that contains the new value for @@ -835,14 +835,14 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Initialize the name stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glIsEnabled(cap): Test whether a capability is enabled - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type cap: Enumerated constant :arg cap: Specifies a constant representing a GL capability. @@ -852,7 +852,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Determine if a name corresponds to a display-list - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type list: unsigned int :arg list: Specifies a potential display-list name. @@ -862,7 +862,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Determine if a name corresponds to a texture - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type texture: unsigned int :arg texture: Specifies a value that may be the name of a texture. @@ -874,7 +874,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the light source parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type light: Enumerated constant :arg light: Specifies a light. The number of lights depends on the implementation, @@ -894,7 +894,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the lighting model parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type pname: Enumerated constant :arg pname: Specifies a single-value light model parameter. @@ -907,7 +907,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the line stipple pattern - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type factor: int :arg factor: Specifies a multiplier for each bit in the line stipple pattern. @@ -924,7 +924,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the width of rasterized lines. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type width: float :arg width: Specifies the width of rasterized lines. The initial value is 1. @@ -934,7 +934,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the display-list base for glCallLists - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type base: unsigned int :arg base: Specifies an integer offset that will be added to glCallLists @@ -945,7 +945,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Replace the current matrix with the identity matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glLoadMatrix (m): @@ -954,7 +954,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Replace the current matrix with the specified matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type m: :class:`bgl.Buffer` object. Depends on function prototype. :arg m: Specifies a pointer to 16 consecutive values, which are used as the elements @@ -965,7 +965,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Load a name onto the name stack. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type name: unsigned int :arg name: Specifies a name that will replace the top value on the name stack. @@ -975,7 +975,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify a logical pixel operation for color index rendering - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type opcode: Enumerated constant :arg opcode: Specifies a symbolic constant that selects a logical operation. @@ -987,7 +987,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Define a one-dimensional evaluator - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the kind of values that are generated by the evaluator. @@ -1012,7 +1012,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Define a two-dimensional evaluator - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the kind of values that are generated by the evaluator. @@ -1053,7 +1053,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Define a one- or two-dimensional mesh - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type un: int :arg un: Specifies the number of partitions in the grid range interval @@ -1072,7 +1072,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify material parameters for the lighting model. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type face: Enumerated constant :arg face: Specifies which face or faces are being updated. Must be one of: @@ -1089,7 +1089,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify which matrix is the current matrix. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies which matrix stack is the target for subsequent matrix operations. @@ -1101,7 +1101,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Multiply the current matrix with the specified matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type m: :class:`bgl.Buffer` object. Depends on function prototype. :arg m: Points to 16 consecutive values that are used as the elements of a 4x4 column @@ -1112,7 +1112,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Create or replace a display list - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type list: unsigned int :arg list: Specifies the display list name @@ -1127,7 +1127,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the current normal vector - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) :arg nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. @@ -1141,7 +1141,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Multiply the current matrix with an orthographic matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type left, right: double (float) :arg left, right: Specify the coordinates for the left and @@ -1158,7 +1158,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Place a marker in the feedback buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type token: float :arg token: Specifies a marker value to be placed in the feedback @@ -1171,7 +1171,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set up pixel transfer maps - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type map: Enumerated constant :arg map: Specifies a symbolic map name. @@ -1187,7 +1187,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set pixel storage modes - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type pname: Enumerated constant :arg pname: Specifies the symbolic name of the parameter to be set. @@ -1203,7 +1203,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set pixel transfer modes - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type pname: Enumerated constant :arg pname: Specifies the symbolic name of the pixel transfer parameter to be set. @@ -1215,7 +1215,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the pixel zoom factors - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type xfactor, yfactor: float :arg xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. @@ -1225,7 +1225,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the diameter of rasterized points - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type size: float :arg size: Specifies the diameter of rasterized points. The initial value is 1. @@ -1235,7 +1235,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Select a polygon rasterization mode - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type face: Enumerated constant :arg face: Specifies the polygons that mode applies to. @@ -1250,7 +1250,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the scale and units used to calculate depth values - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type factor: float :arg factor: Specifies a scale factor that is used to create a variable depth @@ -1264,7 +1264,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the polygon stippling pattern - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mask: :class:`bgl.Buffer` object I{type GL_BYTE} :arg mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked @@ -1275,35 +1275,35 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Pop the server attribute stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glPopClientAttrib(): Pop the client attribute stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glPopMatrix(): Pop the current matrix stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glPopName(): Pop the name stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glPrioritizeTextures(n, textures, priorities): Set texture residence priority - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type n: int :arg n: Specifies the number of textures to be prioritized. @@ -1319,7 +1319,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Push the server attribute stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mask: Enumerated constant(s) :arg mask: Specifies a mask that indicates which attributes to save. @@ -1329,7 +1329,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Push the client attribute stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mask: Enumerated constant(s) :arg mask: Specifies a mask that indicates which attributes to save. @@ -1339,14 +1339,14 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Push the current matrix stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ .. function:: glPushName(name): Push the name stack - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type name: unsigned int :arg name: Specifies a name that will be pushed onto the name stack. @@ -1362,7 +1362,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify the raster position for pixel operations - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) :arg x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the @@ -1394,7 +1394,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Select a color buffer source for pixels. - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies a color buffer. @@ -1404,7 +1404,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Read a block of pixels from the frame buffer - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y: int :arg x, y: Specify the window coordinates of the first pixel that is read @@ -1427,7 +1427,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Draw a rectangle - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x1, y1: Depends on function prototype. (for non 'v' prototypes only) :arg x1, y1: Specify one vertex of a rectangle @@ -1442,7 +1442,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set rasterization mode - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies the rasterization mode. @@ -1454,7 +1454,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Multiply the current matrix by a rotation matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type angle: Depends on function prototype. :arg angle: Specifies the angle of rotation in degrees. @@ -1468,7 +1468,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Multiply the current matrix by a general scaling matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y, z: Depends on function prototype. :arg x, y, z: Specify scale factors along the x, y, and z axes, respectively. @@ -1478,7 +1478,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Define the scissor box - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y: int :arg x, y: Specify the lower left corner of the scissor box. Initially (0, 0). @@ -1492,7 +1492,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Establish a buffer for selection mode values - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type size: int :arg size: Specifies the size of buffer @@ -1504,7 +1504,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Select flat or smooth shading - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mode: Enumerated constant :arg mode: Specifies a symbolic value representing a shading technique. @@ -1514,7 +1514,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set function and reference value for stencil testing - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type func: Enumerated constant :arg func: Specifies the test function. @@ -1531,7 +1531,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Control the writing of individual bits in the stencil planes - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type mask: unsigned int :arg mask: Specifies a bit mask to enable and disable writing of individual bits @@ -1542,7 +1542,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set stencil test actions - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type fail: Enumerated constant :arg fail: Specifies the action to take when the stencil test fails. @@ -1570,7 +1570,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the current texture coordinates - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) :arg s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are @@ -1586,7 +1586,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set texture environment parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. @@ -1605,7 +1605,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Control the generation of texture coordinates - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type coord: Enumerated constant :arg coord: Specifies a texture coordinate. @@ -1623,7 +1623,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify a one-dimensional texture image - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the target texture. @@ -1650,7 +1650,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify a two-dimensional texture image - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the target texture. @@ -1683,7 +1683,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set texture parameters - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type target: Enumerated constant :arg target: Specifies the target texture. @@ -1700,7 +1700,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Multiply the current matrix by a translation matrix - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y, z: Depends on function prototype. :arg x, y, z: Specify the x, y, and z coordinates of a translation vector. @@ -1715,7 +1715,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Specify a vertex - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) :arg x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters @@ -1731,7 +1731,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. Set the viewport - .. seealso:: `OpenGL Docs `_ + .. seealso:: `OpenGL Docs `_ :type x, y: int :arg x, y: Specify the lower left corner of the viewport rectangle, From c6051ea87b21f408dbf70d6679500f9a655914e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 20:45:16 +0000 Subject: [PATCH 25/55] replace python3 command with python3.2, python3 isnt available on ubuntu. --- GNUmakefile | 24 +++++++++---------- build_files/cmake/cmake_consistency_check.py | 2 +- build_files/cmake/cmake_netbeans_project.py | 2 +- build_files/cmake/cmake_qtcreator_project.py | 2 +- .../cmake/cmake_static_check_cppcheck.py | 2 +- .../cmake/cmake_static_check_sparse.py | 2 +- .../cmake/cmake_static_check_splint.py | 2 +- .../cmake/example_scripts/make_quicky.py | 2 +- build_files/cmake/project_info.py | 2 +- build_files/scons/tools/Blender.py | 2 +- .../BlendFileDnaExporter_25.py | 2 +- doc/blender_file_format/BlendFileReader.py | 2 +- .../makesrna/rna_cleanup/rna_cleaner.py | 2 +- .../makesrna/rna_cleanup/rna_cleaner_merge.py | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index fcbc79e26a8..ebd2db60e0a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -202,31 +202,31 @@ test: # run pep8 check check on scripts we distribute. test_pep8: - python3 source/tests/pep8.py > test_pep8.log 2>&1 + python3.2 source/tests/pep8.py > test_pep8.log 2>&1 @echo "written: test_pep8.log" # run some checks on our cmakefiles. test_cmake: - python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1 + python3.2 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1 @echo "written: test_cmake_consistency.log" # run deprecation tests, see if we have anything to remove. test_deprecated: - python3 source/tests/check_deprecated.py + python3.2 source/tests/check_deprecated.py test_style: # run our own checks on C/C++ style - PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator + PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator # ----------------------------------------------------------------------------- # Project Files # project_qtcreator: - python3 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR) + python3.2 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR) project_netbeans: - python3 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR) + python3.2 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR) project_eclipse: cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR) @@ -238,21 +238,21 @@ project_eclipse: check_cppcheck: $(CMAKE_CONFIG) - cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py + cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py check_splint: $(CMAKE_CONFIG) - cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py + cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py check_sparse: $(CMAKE_CONFIG) - cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py + cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py check_spelling_py: - cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts + cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts check_spelling_c: - cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source + cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source # ----------------------------------------------------------------------------- # Documentation @@ -273,7 +273,7 @@ doc_dna: @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'" doc_man: - python3 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender + python3.2 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender clean: diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index 65a9442a90d..072bbb12fb3 100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py index 45c19adff36..aa6124ac8fe 100755 --- a/build_files/cmake/cmake_netbeans_project.py +++ b/build_files/cmake/cmake_netbeans_project.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py index 8cabc75e426..32d20489e6a 100755 --- a/build_files/cmake/cmake_qtcreator_project.py +++ b/build_files/cmake/cmake_qtcreator_project.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py index 436470a7020..c340ca5c458 100644 --- a/build_files/cmake/cmake_static_check_cppcheck.py +++ b/build_files/cmake/cmake_static_check_cppcheck.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/cmake/cmake_static_check_sparse.py b/build_files/cmake/cmake_static_check_sparse.py index bd7629e4229..db1b14e7acb 100644 --- a/build_files/cmake/cmake_static_check_sparse.py +++ b/build_files/cmake/cmake_static_check_sparse.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/cmake/cmake_static_check_splint.py b/build_files/cmake/cmake_static_check_splint.py index edfefa3d068..f538fa612d0 100644 --- a/build_files/cmake/cmake_static_check_splint.py +++ b/build_files/cmake/cmake_static_check_splint.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/cmake/example_scripts/make_quicky.py b/build_files/cmake/example_scripts/make_quicky.py index a4e0d3371f1..9b853fc01d4 100755 --- a/build_files/cmake/example_scripts/make_quicky.py +++ b/build_files/cmake/example_scripts/make_quicky.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3.2 # ##### BEGIN GPL LICENSE BLOCK ##### # diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index 3f64ac51a4d..a80ae623eb9 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 5a066470225..eb3d4fd04b8 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.2 """ tools.BlenderEnvironment diff --git a/doc/blender_file_format/BlendFileDnaExporter_25.py b/doc/blender_file_format/BlendFileDnaExporter_25.py index a201f618fbb..b7b89c89268 100755 --- a/doc/blender_file_format/BlendFileDnaExporter_25.py +++ b/doc/blender_file_format/BlendFileDnaExporter_25.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/doc/blender_file_format/BlendFileReader.py b/doc/blender_file_format/BlendFileReader.py index 88eb71b3ce2..b7091ad8ff5 100644 --- a/doc/blender_file_format/BlendFileReader.py +++ b/doc/blender_file_format/BlendFileReader.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3.2 # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index ca610eeb024..b75d177d809 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3.2 """ This script is used to help cleaning RNA api. diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py index 89d95b5a627..75851105991 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3.2 import sys From e54a0039dc93535bd6518766fc29790aa627e250 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 1 May 2012 20:57:39 +0000 Subject: [PATCH 26/55] Add pthread dll for MinGW64 during installation. Now people who download from buildbot will be able to run the build even without MinGW-w64 installed. --- SConstruct | 1 + source/creator/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/SConstruct b/SConstruct index b1603fd0397..46ce989e9c0 100644 --- a/SConstruct +++ b/SConstruct @@ -805,6 +805,7 @@ if env['OURPLATFORM'] == 'win64-mingw': dllsources.append('${LCGDIR}/sdl/lib/SDL.dll') dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll') + dllsources.append('${LCGDIR}/binaries/pthreadGC2-w64.dll') dllsources.append('#source/icons/blender.exe.manifest') windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 9168b634250..f4c3964ab83 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -566,6 +566,11 @@ elseif(WIN32) FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll DESTINATION ${TARGETDIR} ) + elseif(WITH_MINGW64) + install( + FILES ${LIBDIR}/binaries/pthreadGC2-w64.dll + DESTINATION ${TARGETDIR} + ) endif() endif() From f4a82ab917fc398c19ca0ca74134d2a7e6463046 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Tue, 1 May 2012 21:02:04 +0000 Subject: [PATCH 27/55] Logic brick connection highlighting on mouseover. Merged from candy branch. I hope it works - my first commit to trunk ^_^ --- source/blender/editors/interface/interface.c | 44 +++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 9e12c8f94b7..c8806aa0166 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -498,7 +498,7 @@ static int ui_but_float_precision(uiBut *but, double value) return prec; } -static void ui_draw_linkline(uiLinkLine *line) +static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines) { rcti rect; @@ -509,8 +509,10 @@ static void ui_draw_linkline(uiLinkLine *line) rect.xmax = (line->to->x1 + line->to->x2) / 2.0f; rect.ymax = (line->to->y1 + line->to->y2) / 2.0f; - if (line->flag & UI_SELECT) - glColor3ub(100, 100, 100); + if(line->flag & UI_SELECT) + glColor3ub(100,100,100); + else if(hilightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))) + UI_ThemeColor(TH_TEXT_HI); else glColor3ub(0, 0, 0); @@ -521,18 +523,38 @@ static void ui_draw_links(uiBlock *block) { uiBut *but; uiLinkLine *line; - - but = block->buttons.first; - while (but) { - if (but->type == LINK && but->link) { - line = but->link->lines.first; - while (line) { - ui_draw_linkline(line); - line = line->next; + + // Draw the inactive lines (lines with neither button being hovered over). + // As we go, remember if we see any active or selected lines. + int foundselectline = 0; + int foundactiveline = 0; + for (but=block->buttons.first; but; but=but->next) { + if(but->type==LINK && but->link) { + for (line=but->link->lines.first; line; line=line->next) { + if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) + ui_draw_linkline(line, 0); + else + foundactiveline = 1; + + if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT)) + foundselectline = 1; } } but = but->next; } + + // Draw any active lines (lines with either button being hovered over). + // Do this last so they appear on top of inactive lines. + if (foundactiveline) { + for (but=block->buttons.first; but; but=but->next) { + if(but->type==LINK && but->link) { + for (line=but->link->lines.first; line; line=line->next) { + if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)) + ui_draw_linkline(line, !foundselectline); + } + } + } + } } /* ************** BLOCK ENDING FUNCTION ************* */ From 5cd4b32b3886798b795090d273a7c6f67195d176 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Tue, 1 May 2012 21:39:52 +0000 Subject: [PATCH 28/55] Fix for r46170. * "but=but->next" was there twice, once in the loop block and once at the end, caused Blender to crash on startup. Please always compile and check it works before committing. :) --- source/blender/editors/interface/interface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index c8806aa0166..c7fb523dcba 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -540,7 +540,6 @@ static void ui_draw_links(uiBlock *block) foundselectline = 1; } } - but = but->next; } // Draw any active lines (lines with either button being hovered over). From 274d3d2daa078645982a14399c07af8f084fdb3e Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Tue, 1 May 2012 21:46:55 +0000 Subject: [PATCH 29/55] Fixes opening video files on Windows. [#30752] Thanks Lockal for finding faulty stat function which helped a lot. Now there BLI_stat. I will replace all other stat later. *** Please use BLI_xxxx() functions *** for file operations Reported by Leon Cheung, Lockal, Believil --- source/blender/blenlib/BLI_fileops.h | 1 + source/blender/blenlib/intern/storage.c | 17 +++++++++++++++++ source/blender/imbuf/intern/util.c | 7 +++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 73220cbd739..1bf4efca8a0 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -55,6 +55,7 @@ int BLI_rename(const char *from, const char *to); int BLI_delete(const char *path, int dir, int recursive); int BLI_move(const char *path, const char *to); int BLI_create_symlink(const char *path, const char *to); +int BLI_stat(const char *path, struct stat *buffer); /* Directories */ diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 0245a9c90af..047463f1e26 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -493,6 +493,23 @@ int BLI_exists(const char *name) return(st.st_mode); } + +#ifdef WIN32 +int BLI_stat(const char *path, struct stat *buffer) +{ + int r; + UTF16_ENCODE(path); + r=_wstat(path_16,buffer); + UTF16_UN_ENCODE(path); + return r; +} +#else +int BLI_stat(const char *path, struct stat *buffer) +{ + return stat(path, buffer); +} +#endif + /* would be better in fileops.c except that it needs stat.h so add here */ int BLI_is_dir(const char *file) { diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 62cf206dfec..99872192e32 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -40,6 +40,7 @@ #endif #include "BLI_blenlib.h" +#include "BLI_fileops.h" #include "DNA_userdef_types.h" #include "BKE_global.h" @@ -342,14 +343,14 @@ int imb_get_anim_type(const char * name) /* stat test below fails on large files > 4GB */ if (isffmpeg(name)) return (ANIM_FFMPEG); # endif - if (stat(name, &st) == -1) return(0); + if (BLI_stat(name, &st) == -1) return(0); if (((st.st_mode) & S_IFMT) != S_IFREG) return(0); if (isavi(name)) return (ANIM_AVI); if (ismovie(name)) return (ANIM_MOVIE); #else - if (stat(name, &st) == -1) return(0); + if (BLI_stat(name, &st) == -1) return(0); if (((st.st_mode) & S_IFMT) != S_IFREG) return(0); if (ismovie(name)) return (ANIM_MOVIE); @@ -359,6 +360,8 @@ int imb_get_anim_type(const char * name) # ifdef WITH_FFMPEG if (isffmpeg(name)) return (ANIM_FFMPEG); # endif + + if (isavi(name)) return (ANIM_AVI); #endif #ifdef WITH_REDCODE From 7f8643806da80831cb19ef46b4f424739e1c22f6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 May 2012 23:22:58 +0000 Subject: [PATCH 30/55] cmake - improved detection of numpy, now works for typical ubuntu installation. numpy directory can be referenced manually with the advanced option PYTHON_NUMPY_PATH if needed. --- CMakeLists.txt | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d91212fa47d..43636740e91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,6 +229,9 @@ if(UNIX AND NOT APPLE) endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON) +set(PYTHON_NUMPY_PATH "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module") +mark_as_advanced(PYTHON_NUMPY_PATH) + option(WITH_MINGW64 "Use the 64-bit version of MinGW" OFF) mark_as_advanced(WITH_MINGW64) @@ -1614,11 +1617,46 @@ if(WITH_PYTHON) "Python.h for python version \"${PYTHON_VERSION}\"") endif() - if(WITH_PYTHON_INSTALL_NUMPY) - if(NOT EXISTS "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy") - message(WARNING "Numpy path '${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy' is missing, " - "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") - set(WITH_PYTHON_INSTALL_NUMPY OFF) + if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) + # set but invalid + if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "") + if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy") + message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' " + "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") + set(WITH_PYTHON_INSTALL_NUMPY OFF) + endif() + # not set, so initialize + else() + string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}") + list(GET _PY_VER_SPLIT 0 _PY_VER_MAJOR) + + # re-cache + unset(PYTHON_NUMPY_PATH CACHE) + find_path(PYTHON_NUMPY_PATH + NAMES + numpy + HINTS + "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/" + "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/" + PATH_SUFFIXES + site-packages + dist-packages + ) + + if(NOT EXISTS "${PYTHON_NUMPY_PATH}") + message(WARNING "'numpy' path could not be found in:\n" + "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy', " + "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/numpy', " + "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/numpy', " + "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/numpy', " + "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") + set(WITH_PYTHON_INSTALL_NUMPY OFF) + else() + message(STATUS "numpy found at '${PYTHON_NUMPY_PATH}'") + endif() + + unset(_PY_VER_SPLIT) + unset(_PY_VER_MAJOR) endif() endif() endif() From 01b3deb680f7e3b34adaad5b5a888e7bd44cfaa4 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 2 May 2012 07:18:51 +0000 Subject: [PATCH 31/55] A number of changes to node RNA and the file output node, to simplify socket types and make node code more robust for future nodes with extra socket data. * Removed the struct_type identifier from sockets completely. Any specialization of socket types can be done by using separate collections in RNA and customized socket draw callbacks in node type. Sockets themselves are pure data inputs/outputs now. Possibly the sock->storage data could also be removed, but this will change anyway with id properties in custom nodes. * Replaced the direct socket button draw calls by extra callbacks in node types. This allows nodes to draw sockets in specialized ways without referring to the additional struct_type identifier. Default is simply drawing the socket default_value button, only file output node overrides this atm. * File output node slots now use a separate file sub-path in their storage data, instead of using the socket name. That way the path is an actual PROP_FILEPATH property and it works better with the UI list template (name property is local to the data struct). * Node draw contexts for options on the node itself and detail buttons in the sidebar now have an extra context pointer "node" (uiLayoutSetContextPointer). This can be used to bind operator buttons to a specific node, instead of having to rely on the active/selected node(s) or making weak links via node name. Compare to modifiers and logic bricks, they use the same feature. * Added another operator for reordering custom input slots in the file output node. --- source/blender/blenkernel/BKE_node.h | 3 + source/blender/blenloader/intern/readfile.c | 38 ++- source/blender/editors/space_node/drawnode.c | 248 +++++++++--------- .../blender/editors/space_node/node_buttons.c | 6 +- source/blender/editors/space_node/node_draw.c | 26 +- source/blender/editors/space_node/node_edit.c | 84 +++++- .../blender/editors/space_node/node_intern.h | 1 + source/blender/editors/space_node/node_ops.c | 1 + source/blender/makesdna/DNA_node_types.h | 9 +- source/blender/makesrna/intern/rna_nodetree.c | 83 +++--- .../nodes/node_composite_outputFile.c | 12 +- 11 files changed, 308 insertions(+), 203 deletions(-) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index a4eddd0b590..e7e1577c6b4 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -145,6 +145,9 @@ typedef struct bNodeType { void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); /// Additional parameters in the side panel. void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + /// Draw a node socket. Default draws the input value button. + NodeSocketButtonFunction drawinputfunc; + NodeSocketButtonFunction drawoutputfunc; /// Optional custom label function for the node header. const char *(*labelfunc)(struct bNode *); /// Optional custom resize handle polling. diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5dd0a1b996f..1813bd49936 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7786,6 +7786,23 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me) } } +static void do_versions_nodetree_multi_file_output_path_2_64_0(bNodeTree *ntree) +{ + bNode *node; + + for (node=ntree->nodes.first; node; node=node->next) { + if (node->type==CMP_NODE_OUTPUT_FILE) { + bNodeSocket *sock; + for (sock=node->inputs.first; sock; sock=sock->next) { + NodeImageMultiFileSocket *input = sock->storage; + /* input file path is stored in dedicated struct now instead socket name */ + BLI_strncpy(input->path, sock->name, sizeof(input->path)); + sock->name[0] = '\0'; /* unused */ + } + } + } +} + static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ @@ -13282,10 +13299,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 263) { - /* Default for old files is to save particle rotations to pointcache */ - ParticleSettings *part; - for (part = main->particle.first; part; part = part->id.next) - part->flag |= PART_ROTATIONS; + { + /* Default for old files is to save particle rotations to pointcache */ + ParticleSettings *part; + for (part = main->particle.first; part; part = part->id.next) + part->flag |= PART_ROTATIONS; + } + { + /* file output node paths are now stored in the file info struct instead socket name */ + Scene *sce; + bNodeTree *ntree; + + for (sce = main->scene.first; sce; sce=sce->id.next) + if (sce->nodetree) + do_versions_nodetree_multi_file_output_path_2_64_0(sce->nodetree); + for (ntree = main->nodetree.first; ntree; ntree=ntree->id.next) + do_versions_nodetree_multi_file_output_path_2_64_0(ntree); + } } if (main->versionfile <= 263 && main->subversionfile == 0) { diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index f8ed6c20657..69e5cbefde5 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -98,71 +98,23 @@ static void node_socket_button_label(const bContext *UNUSED(C), uiBlock *block, uiDefBut(block, LABEL, 0, sock->name, x, y, width, NODE_DY, NULL, 0, 0, 0, 0, ""); } -/* draw function for file output node sockets. - * XXX a bit ugly use atm, called from datatype button functions, - * since all node types and callbacks only use data type without struct_type. - */ -static void node_socket_button_output_file(const bContext *C, uiBlock *block, - bNodeTree *ntree, bNode *node, bNodeSocket *sock, - const char *UNUSED(name), int x, int y, int width) -{ - uiLayout *layout, *row; - PointerRNA nodeptr, sockptr, imfptr; - int imtype; - int rx, ry; - RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr); - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &sockptr); - - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y+NODE_DY, width, 20, UI_GetStyle()); - row = uiLayoutRow(layout, 0); - - uiItemL(row, sock->name, 0); - - imfptr = RNA_pointer_get(&nodeptr, "format"); - imtype = RNA_enum_get(&imfptr, "file_format"); - /* in multilayer format all socket format details are ignored */ - if (imtype != R_IMF_IMTYPE_MULTILAYER) { - PropertyRNA *imtype_prop; - const char *imtype_name; - - if (!RNA_boolean_get(&sockptr, "use_node_format")) - imfptr = RNA_pointer_get(&sockptr, "format"); - - imtype_prop = RNA_struct_find_property(&imfptr, "file_format"); - RNA_property_enum_name((bContext*)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); - uiBlockSetEmboss(block, UI_EMBOSSP); - uiItemL(row, imtype_name, 0); - uiBlockSetEmboss(block, UI_EMBOSSN); - } - - uiBlockLayoutResolve(block, &rx, &ry); -} - static void node_socket_button_default(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { - switch (sock->struct_type) { - case SOCK_STRUCT_NONE: { - if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) - node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); - else { - PointerRNA ptr; - uiBut *bt; - - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); - - bt = uiDefButR(block, NUM, B_NODE_EXEC, name, - x, y+1, width, NODE_DY-2, - &ptr, "default_value", 0, 0, 0, -1, -1, NULL); - if (node) - uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); - } - break; - } - case SOCK_STRUCT_OUTPUT_FILE: - node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width); - break; + if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) + node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); + else { + PointerRNA ptr; + uiBut *bt; + + RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); + + bt = uiDefButR(block, NUM, B_NODE_EXEC, name, + x, y+1, width, NODE_DY-2, + &ptr, "default_value", 0, 0, 0, -1, -1, NULL); + if (node) + uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); } } @@ -192,33 +144,25 @@ static void node_socket_button_components(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { - switch (sock->struct_type) { - case SOCK_STRUCT_NONE: { - if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) - node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); - else { - PointerRNA ptr; - SocketComponentMenuArgs *args; - - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); - - args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs"); - - args->ptr = ptr; - args->x = x; - args->y = y; - args->width = width; - args->cb = node_sync_cb; - args->arg1 = CTX_wm_space_node(C); - args->arg2 = node; - - uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, ""); - } - break; - } - case SOCK_STRUCT_OUTPUT_FILE: - node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width); - break; + if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) + node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); + else { + PointerRNA ptr; + SocketComponentMenuArgs *args; + + RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); + + args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs"); + + args->ptr = ptr; + args->x = x; + args->y = y; + args->width = width; + args->cb = node_sync_cb; + args->arg1 = CTX_wm_space_node(C); + args->arg2 = node; + + uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, ""); } } @@ -226,35 +170,52 @@ static void node_socket_button_color(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { - /* XXX would be nicer to have draw function based on sock->struct_type as well, - * but currently socket types are completely identified by data type only. - */ - - switch (sock->struct_type) { - case SOCK_STRUCT_NONE: { - if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) - node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); - else { - PointerRNA ptr; - uiBut *bt; - int labelw= width - 40; - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); - - bt=uiDefButR(block, COL, B_NODE_EXEC, "", - x, y+2, (labelw>0 ? 40 : width), NODE_DY-2, - &ptr, "default_value", 0, 0, 0, -1, -1, NULL); - if (node) - uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); - - if (name[0]!='\0' && labelw>0) - uiDefBut(block, LABEL, 0, name, x + 40, y+2, labelw, NODE_DY-2, NULL, 0, 0, 0, 0, ""); - } - break; + if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) + node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); + else { + PointerRNA ptr; + uiBut *bt; + int labelw= width - 40; + RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); + + bt=uiDefButR(block, COL, B_NODE_EXEC, "", + x, y+2, (labelw>0 ? 40 : width), NODE_DY-2, + &ptr, "default_value", 0, 0, 0, -1, -1, NULL); + if (node) + uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); + + if (name[0]!='\0' && labelw>0) + uiDefBut(block, LABEL, 0, name, x + 40, y+2, labelw, NODE_DY-2, NULL, 0, 0, 0, 0, ""); } - case SOCK_STRUCT_OUTPUT_FILE: - node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width); - break; +} + +/* standard draw function, display the default input value */ +static void node_draw_input_default(const bContext *C, uiBlock *block, + bNodeTree *ntree, bNode *node, bNodeSocket *sock, + const char *name, int x, int y, int width) +{ + bNodeSocketType *stype = ntreeGetSocketType(sock->type); + if (stype->buttonfunc) + stype->buttonfunc(C, block, ntree, node, sock, name, x, y, width); + else + node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); +} + +static void node_draw_output_default(const bContext *C, uiBlock *block, + bNodeTree *UNUSED(ntree), bNode *node, bNodeSocket *sock, + const char *name, int UNUSED(x), int UNUSED(y), int UNUSED(width)) +{ + SpaceNode *snode = CTX_wm_space_node(C); + float slen; + int ofs = 0; + UI_ThemeColor(TH_TEXT); + slen= snode->aspect*UI_GetStringWidth(name); + while (slen > node->width) { + ofs++; + slen= snode->aspect*UI_GetStringWidth(name+ofs); } + uiDefBut(block, LABEL, 0, name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f), + (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, ""); } /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */ @@ -1743,6 +1704,43 @@ static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), Po uiItemR(layout, ptr, "use_smooth_mask", 0, NULL, ICON_NONE); } +/* draw function for file output node sockets, displays only sub-path and format, no value button */ +static void node_draw_input_file_output(const bContext *C, uiBlock *block, + bNodeTree *ntree, bNode *node, bNodeSocket *sock, + const char *UNUSED(name), int x, int y, int width) +{ + NodeImageMultiFileSocket *input = sock->storage; + uiLayout *layout, *row; + PointerRNA nodeptr, inputptr, imfptr; + int imtype; + int rx, ry; + RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr); + RNA_pointer_create(&ntree->id, &RNA_NodeImageFileSocket, input, &inputptr); + + layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y+NODE_DY, width, 20, UI_GetStyle()); + row = uiLayoutRow(layout, 0); + + uiItemL(row, input->path, 0); + + imfptr = RNA_pointer_get(&nodeptr, "format"); + imtype = RNA_enum_get(&imfptr, "file_format"); + /* in multilayer format all socket format details are ignored */ + if (imtype != R_IMF_IMTYPE_MULTILAYER) { + PropertyRNA *imtype_prop; + const char *imtype_name; + + if (!RNA_boolean_get(&inputptr, "use_node_format")) + imfptr = RNA_pointer_get(&inputptr, "format"); + + imtype_prop = RNA_struct_find_property(&imfptr, "file_format"); + RNA_property_enum_name((bContext*)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); + uiBlockSetEmboss(block, UI_EMBOSSP); + uiItemL(row, imtype_name, 0); + uiBlockSetEmboss(block, UI_EMBOSSN); + } + + uiBlockLayoutResolve(block, &rx, &ry); +} static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA imfptr = RNA_pointer_get(ptr, "format"); @@ -1757,7 +1755,9 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C) static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA imfptr = RNA_pointer_get(ptr, "format"); - PointerRNA active_input_ptr = RNA_pointer_get(ptr, "active_input"); + PointerRNA active_input_ptr, op_ptr; + uiLayout *col, *row; + int active_index; int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER); node_composit_buts_file_output(layout, C, ptr); @@ -1767,7 +1767,16 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C uiItemO(layout, "Add Input", ICON_ZOOMIN, "NODE_OT_output_file_add_socket"); - uiTemplateList(layout, C, ptr, "inputs", ptr, "active_input_index", NULL, 0, 0, 0); + uiTemplateList(layout, C, ptr, "file_inputs", ptr, "active_input_index", NULL, 0, 0, 0); + + active_index = RNA_int_get(ptr, "active_input_index"); + RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_inputs"), active_index, &active_input_ptr); + + row = uiLayoutRow(layout, 1); + op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); + RNA_enum_set(&op_ptr, "direction", 1); + op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); + RNA_enum_set(&op_ptr, "direction", 2); if (active_input_ptr.data) { uiLayout *row, *col; @@ -1778,7 +1787,7 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C else uiItemL(col, "File Path:", 0); row = uiLayoutRow(col, 0); - uiItemR(row, &active_input_ptr, "name", 0, "", 0); + uiItemR(row, &active_input_ptr, "path", 0, "", 0); uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); /* in multilayer format all socket format details are ignored */ @@ -2033,6 +2042,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_OUTPUT_FILE: ntype->uifunc= node_composit_buts_file_output; ntype->uifuncbut= node_composit_buts_file_output_details; + ntype->drawinputfunc = node_draw_input_file_output; break; case CMP_NODE_DIFF_MATTE: ntype->uifunc=node_composit_buts_diff_matte; @@ -2292,6 +2302,8 @@ void ED_init_node_butfuncs(void) ntype->drawupdatefunc = node_update_default; ntype->uifunc = NULL; ntype->uifuncbut = NULL; + ntype->drawinputfunc = node_draw_input_default; + ntype->drawoutputfunc = node_draw_output_default; ntype->resize_area_func = node_resize_area_default; node_common_set_butfunc(ntype); diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index f7d517915da..c92abf116c4 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -89,7 +89,7 @@ static void active_node_panel(const bContext *C, Panel *pa) SpaceNode *snode= CTX_wm_space_node(C); bNodeTree *ntree= (snode) ? snode->edittree : NULL; bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; // xxx... for editing group nodes - uiLayout *layout= pa->layout; + uiLayout *layout; PointerRNA ptr; /* verify pointers, and create RNA pointer for the node */ @@ -100,6 +100,10 @@ static void active_node_panel(const bContext *C, Panel *pa) //else RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); + /* XXX nicer way to make sub-layout? */ + layout = uiLayoutColumn(pa->layout, 0); + uiLayoutSetContextPointer(layout, "node", &ptr); + /* draw this node's name, etc. */ uiItemR(layout, &ptr, "label", 0, NULL, ICON_NODE); uiItemS(layout); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 7cddaa5e0e7..3a920e16f8a 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -303,6 +303,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) layout= uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, locx+NODE_DYS, dy, node->butr.xmax, NODE_DY, UI_GetStyle()); + uiLayoutSetContextPointer(layout, "node", &ptr); node->typeinfo->uifunc(layout, (bContext *)C, &ptr); @@ -711,41 +712,24 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* socket inputs, buttons */ for (sock= node->inputs.first; sock; sock= sock->next) { - bNodeSocketType *stype= ntreeGetSocketType(sock->type); - if (nodeSocketIsHidden(sock)) continue; node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE); - if (stype->buttonfunc) - stype->buttonfunc(C, node->block, ntree, node, sock, IFACE_(sock->name), sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY); + node->typeinfo->drawinputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name), + sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY); } /* socket outputs */ for (sock= node->outputs.first; sock; sock= sock->next) { - PointerRNA sockptr; - - RNA_pointer_create((ID*)ntree, &RNA_NodeSocket, sock, &sockptr); - if (nodeSocketIsHidden(sock)) continue; node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE); - { - const char *name = IFACE_(sock->name); - float slen; - int ofs = 0; - UI_ThemeColor(TH_TEXT); - slen= snode->aspect*UI_GetStringWidth(name); - while (slen > node->width) { - ofs++; - slen= snode->aspect*UI_GetStringWidth(name+ofs); - } - uiDefBut(node->block, LABEL, 0, name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f), - (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, ""); - } + node->typeinfo->drawoutputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name), + sock->locx-node->width+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY); } /* preview */ diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index b63770ef049..c0817f9c895 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3591,12 +3591,16 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); SpaceNode *snode= CTX_wm_space_node(C); - bNodeTree *ntree = snode->edittree; - bNode *node = nodeGetActive(ntree); + PointerRNA ptr; + bNodeTree *ntree; + bNode *node; char file_path[MAX_NAME]; - if (!node) + ptr = CTX_data_pointer_get(C, "node"); + if (!ptr.data) return OPERATOR_CANCELLED; + node = ptr.data; + ntree = ptr.id.data; RNA_string_get(op->ptr, "file_path", file_path); ntreeCompositOutputFileAddSocket(ntree, node, file_path, &scene->r.im_format); @@ -3628,11 +3632,14 @@ void NODE_OT_output_file_add_socket(wmOperatorType *ot) static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); - bNodeTree *ntree = snode->edittree; - bNode *node = nodeGetActive(ntree); + PointerRNA ptr = CTX_data_pointer_get(C, "node"); + bNodeTree *ntree; + bNode *node; - if (!node) + if (!ptr.data) return OPERATOR_CANCELLED; + node = ptr.data; + ntree = ptr.id.data; if (!ntreeCompositOutputFileRemoveActiveSocket(ntree, node)) return OPERATOR_CANCELLED; @@ -3656,3 +3663,68 @@ void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } + +/* ****************** Multi File Output Move Socket ******************* */ + +static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op) +{ + SpaceNode *snode= CTX_wm_space_node(C); + PointerRNA ptr = CTX_data_pointer_get(C, "node"); + bNode *node; + NodeImageMultiFile *nimf; + bNodeSocket *sock; + int direction; + + if (!ptr.data) + return OPERATOR_CANCELLED; + node = ptr.data; + nimf = node->storage; + + sock = BLI_findlink(&node->inputs, nimf->active_input); + if (!sock) + return OPERATOR_CANCELLED; + + direction = RNA_enum_get(op->ptr, "direction"); + + if (direction==1) { + bNodeSocket *before = sock->prev; + if (!before) + return OPERATOR_CANCELLED; + BLI_remlink(&node->inputs, sock); + BLI_insertlinkbefore(&node->inputs, before, sock); + --nimf->active_input; + } + else { + bNodeSocket *after = sock->next; + if (!after) + return OPERATOR_CANCELLED; + BLI_remlink(&node->inputs, sock); + BLI_insertlinkafter(&node->inputs, after, sock); + ++nimf->active_input; + } + + snode_notify(C, snode); + + return OPERATOR_FINISHED; +} + +void NODE_OT_output_file_move_active_socket(wmOperatorType *ot) +{ + static EnumPropertyItem direction_items[] = { + {1, "UP", 0, "Up", ""}, + {2, "DOWN", 0, "Down", ""}}; + + /* identifiers */ + ot->name = "Move File Node Socket"; + ot->description = "Move the active input of a file output node up or down the list"; + ot->idname = "NODE_OT_output_file_move_active_socket"; + + /* callbacks */ + ot->exec = node_output_file_move_active_socket_exec; + ot->poll = composite_node_active; + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "direction", direction_items, 2, "Direction", ""); +} diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index aa80f729343..17078443987 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -166,6 +166,7 @@ void NODE_OT_new_node_tree(struct wmOperatorType *ot); void NODE_OT_output_file_add_socket(struct wmOperatorType *ot); void NODE_OT_output_file_remove_active_socket(struct wmOperatorType *ot); +void NODE_OT_output_file_move_active_socket(struct wmOperatorType *ot); extern const char *node_context_dir[]; diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 25940787b60..1c681220016 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -103,6 +103,7 @@ void node_operatortypes(void) WM_operatortype_append(NODE_OT_output_file_add_socket); WM_operatortype_append(NODE_OT_output_file_remove_active_socket); + WM_operatortype_append(NODE_OT_output_file_move_active_socket); } void ED_operatormacros_node(void) diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 01096b6459e..6874e8de4f1 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -77,7 +77,7 @@ typedef struct bNodeSocket { short type, flag; short limit; /* max. number of links */ - short struct_type; /* optional identifier for RNA struct subtype */ + short pad1; float locx, locy; @@ -87,7 +87,7 @@ typedef struct bNodeSocket { short stack_index; /* local stack index */ /* XXX deprecated, kept for forward compatibility */ short stack_type DNA_DEPRECATED; - int pad3; + int pad2; void *cache; /* cached data from execution */ /* internal data to retrieve relations and groups */ @@ -112,10 +112,6 @@ typedef struct bNodeSocket { #define SOCK_INT 6 #define NUM_SOCKET_TYPES 7 /* must be last! */ -/* sock->struct_type */ -#define SOCK_STRUCT_NONE 0 /* default, type is defined by sock->type only */ -#define SOCK_STRUCT_OUTPUT_FILE 1 /* file output node socket */ - /* socket side (input/output) */ #define SOCK_IN 1 #define SOCK_OUT 2 @@ -371,6 +367,7 @@ typedef struct NodeImageMultiFileSocket { short use_render_format DNA_DEPRECATED; short use_node_format; /* use overall node image format */ int pad2; + char path[1024]; /* 1024 = FILE_MAX */ ImageFormatData format; } NodeImageMultiFileSocket; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 5173d927e83..cffcca177b3 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -245,28 +245,22 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr) return &RNA_NodeSocket##stypename##idname; \ } - switch (sock->struct_type) { - case SOCK_STRUCT_NONE: - switch (sock->type) { - case SOCK_FLOAT: - NODE_DEFINE_SUBTYPES_FLOAT - break; - case SOCK_INT: - NODE_DEFINE_SUBTYPES_INT - break; - case SOCK_BOOLEAN: - return &RNA_NodeSocketBoolean; - case SOCK_VECTOR: - NODE_DEFINE_SUBTYPES_VECTOR - break; - case SOCK_RGBA: - return &RNA_NodeSocketRGBA; - case SOCK_SHADER: - return &RNA_NodeSocketShader; - } - break; - case SOCK_STRUCT_OUTPUT_FILE: - return &RNA_NodeImageFileSocket; + switch (sock->type) { + case SOCK_FLOAT: + NODE_DEFINE_SUBTYPES_FLOAT + break; + case SOCK_INT: + NODE_DEFINE_SUBTYPES_INT + break; + case SOCK_BOOLEAN: + return &RNA_NodeSocketBoolean; + case SOCK_VECTOR: + NODE_DEFINE_SUBTYPES_VECTOR + break; + case SOCK_RGBA: + return &RNA_NodeSocketRGBA; + case SOCK_SHADER: + return &RNA_NodeSocketShader; } #undef SUBTYPE @@ -858,14 +852,18 @@ static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Node_update(bmain, scene, ptr); } -static PointerRNA rna_CompositNodeOutputMultiFile_active_input_get(PointerRNA *ptr) +static void rna_NodeOutputFile_file_inputs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { bNode *node = ptr->data; - NodeImageMultiFile *nimf = node->storage; - bNodeSocket *sock = BLI_findlink(&node->inputs, nimf->active_input); - PointerRNA sock_ptr; - RNA_pointer_create((ID*)ptr->id.data, &RNA_NodeSocket, sock, &sock_ptr); - return sock_ptr; + rna_iterator_listbase_begin(iter, &node->inputs, NULL); +} + +static PointerRNA rna_NodeOutputFile_file_inputs_get(CollectionPropertyIterator *iter) +{ + PointerRNA ptr; + bNodeSocket *sock = rna_iterator_listbase_get(iter); + RNA_pointer_create(iter->ptr.id.data, &RNA_NodeImageFileSocket, sock->storage, &ptr); + return ptr; } #else @@ -1827,22 +1825,23 @@ static void rna_def_cmp_output_file_socket(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna = RNA_def_struct(brna, "NodeImageFileSocket", "NodeSocketRGBA"); - RNA_def_struct_sdna(srna, "bNodeSocket"); - RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); + srna = RNA_def_struct(brna, "NodeImageFileSocket", NULL); + RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket"); RNA_def_struct_ui_text(srna, "Node Image File Socket", "Socket data of file output node"); - RNA_def_struct_ui_icon(srna, ICON_PLUG); - RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL); - - RNA_def_struct_sdna_from(srna, "NodeImageMultiFileSocket", "storage"); prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_node_format", 1); RNA_def_property_ui_text(prop, "Use Node Format", ""); - RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, NULL); prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ImageFormatSettings"); + + prop = RNA_def_property(srna, "path", PROP_STRING, PROP_FILEPATH); + RNA_def_property_string_sdna(prop, NULL, "path"); + RNA_def_property_ui_text(prop, "Path", "Subpath used for this input"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, NULL); } static void def_cmp_output_file(StructRNA *srna) { @@ -1855,12 +1854,6 @@ static void def_cmp_output_file(StructRNA *srna) RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "active_input", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_funcs(prop, "rna_CompositNodeOutputMultiFile_active_input_get", NULL, NULL, NULL); - RNA_def_property_struct_type(prop, "NodeSocket"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active Input", "Active input in details view list"); - prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_input"); RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list"); @@ -1868,6 +1861,12 @@ static void def_cmp_output_file(StructRNA *srna) prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ImageFormatSettings"); + + prop = RNA_def_property(srna, "file_inputs", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_funcs(prop, "rna_NodeOutputFile_file_inputs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", + "rna_NodeOutputFile_file_inputs_get", NULL, NULL, NULL, NULL); + RNA_def_property_struct_type(prop, "NodeImageFileSocket"); + RNA_def_property_ui_text(prop, "File Inputs", ""); } static void def_cmp_dilate_erode(StructRNA *srna) diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 2eb68c787fb..f89dcf63f64 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -48,12 +48,13 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, ImageFormatData *im_format) { NodeImageMultiFile *nimf = node->storage; - bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_RGBA); + bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, "", SOCK_RGBA); /* create format data for the input socket */ NodeImageMultiFileSocket *sockdata = MEM_callocN(sizeof(NodeImageMultiFileSocket), "socket image format"); sock->storage = sockdata; - sock->struct_type = SOCK_STRUCT_OUTPUT_FILE; + + BLI_strncpy(sockdata->path, name, sizeof(sockdata->path)); if (im_format) { sockdata->format= *im_format; @@ -188,7 +189,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack ibuf->profile = IB_PROFILE_LINEAR_RGB; /* get full path */ - BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sock->name); + BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sockdata->path); BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE); if (0 == BKE_write_ibuf(ibuf, filename, format)) @@ -229,6 +230,7 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) { if (in[i]->data) { + NodeImageMultiFileSocket *sockdata = sock->storage; CompBuf *cbuf = in[i]->data; char layname[EXR_LAY_MAXNAME]; char channelname[EXR_PASS_MAXNAME]; @@ -247,8 +249,8 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack continue; } - BLI_strncpy(layname, sock->name, sizeof(layname)); - BLI_strncpy(channelname, sock->name, sizeof(channelname)-2); + BLI_strncpy(layname, sockdata->path, sizeof(layname)); + BLI_strncpy(channelname, sockdata->path, sizeof(channelname)-2); channelname_ext = channelname + strlen(channelname); /* create channels */ From ad929044d378715f31f67717a218554b57ff1b30 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 09:03:04 +0000 Subject: [PATCH 32/55] Fix: recent commit setting python3.2 command should not be applied to this file scons build scripts are still using python2. --- build_files/scons/tools/Blender.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index eb3d4fd04b8..5a066470225 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3.2 +#!/usr/bin/env python """ tools.BlenderEnvironment From 5d4fd04f05fc20d1a15817e5de4f1e2b776ab2b6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 2 May 2012 09:03:15 +0000 Subject: [PATCH 33/55] Fix #31230: Grid primitive changes size with changing resolution --- source/blender/bmesh/operators/bmo_primitive.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index a08532fde3a..08cd3835b2d 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -260,6 +260,7 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op) } /* extrude and translate */ + phid = 2.0f / ((float)seg - 1); vec[0] = vec[2] = 0.0f; vec[1] = dia * phid; mul_mat3_m4_v3(mat, vec); From 1e2afcddd3f1fd7b82fc0ea78fec2d80021fe844 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 09:33:45 +0000 Subject: [PATCH 34/55] Fix #31168: cycles mask layer should only affect objects for camera rays. Fix: texture coordinate normal output was not correct, still changed under object transform. --- intern/cycles/blender/blender_mesh.cpp | 12 ++---- intern/cycles/blender/blender_object.cpp | 12 ++++-- intern/cycles/blender/blender_sync.h | 2 +- intern/cycles/kernel/kernel_camera.h | 6 +-- intern/cycles/kernel/kernel_object.h | 50 +++++++++++++----------- intern/cycles/kernel/kernel_path.h | 15 +++++-- intern/cycles/kernel/kernel_shader.h | 2 + intern/cycles/kernel/kernel_textures.h | 1 + intern/cycles/kernel/kernel_types.h | 10 +++-- intern/cycles/kernel/svm/svm_tex_coord.h | 6 +-- intern/cycles/render/camera.cpp | 6 ++- intern/cycles/render/object.cpp | 13 ++++++ intern/cycles/render/object.h | 1 + intern/cycles/render/scene.h | 1 + intern/cycles/util/util_math.h | 5 +++ intern/cycles/util/util_transform.h | 12 +++--- 16 files changed, 99 insertions(+), 55 deletions(-) diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index f77e6551de0..867cc71bf47 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -198,11 +198,11 @@ static void create_subd_mesh(Mesh *mesh, BL::Mesh b_mesh, PointerRNA *cmesh, con /* Sync */ -Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated) +Mesh *BlenderSync::sync_mesh(BL::Object b_ob, 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::ID key = (object_is_modified(b_ob))? b_ob: b_ob_data; BL::Material material_override = render_layer.material_override; /* find shader indices */ @@ -212,18 +212,14 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated) for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) { BL::Material material_override = render_layer.material_override; - if(holdout) - find_shader(PointerRNA_NULL, used_shaders, scene->default_holdout); - else if(material_override) + if(material_override) find_shader(material_override, used_shaders, scene->default_surface); else find_shader(slot->material(), used_shaders, scene->default_surface); } if(used_shaders.size() == 0) { - if(holdout) - used_shaders.push_back(scene->default_holdout); - else if(material_override) + 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/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index b1cd778c6d3..bbf48050222 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -232,11 +232,15 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, if(object_map.sync(&object, b_ob, b_parent, key)) object_updated = true; - /* holdout? */ - bool holdout = (layer_flag & render_layer.holdout_layer) != 0; - + bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0; + /* mesh sync */ - object->mesh = sync_mesh(b_ob, holdout, object_updated); + object->mesh = sync_mesh(b_ob, object_updated); + + if(use_holdout != object->use_holdout) { + object->use_holdout = use_holdout; + scene->object_manager->tag_update(scene); + } /* object sync */ if(object_updated || (object->mesh && object->mesh->need_update)) { diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index acdcea1ef9b..d6a7218f74f 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -79,7 +79,7 @@ private: void sync_shaders(); void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree); - Mesh *sync_mesh(BL::Object b_ob, bool holdout, bool object_updated); + Mesh *sync_mesh(BL::Object b_ob, bool object_updated); void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag, int motion); void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm); void sync_background_light(); diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 7b93ed7c0e6..e4b10f6151c 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -64,7 +64,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float Transform cameratoworld = kernel_data.cam.cameratoworld; #ifdef __MOTION__ - if(ray->time != TIME_INVALID) + if(kernel_data.cam.have_motion) transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time); #endif @@ -107,7 +107,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa Transform cameratoworld = kernel_data.cam.cameratoworld; #ifdef __MOTION__ - if(ray->time != TIME_INVALID) + if(kernel_data.cam.have_motion) transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time); #endif @@ -147,7 +147,7 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float Transform cameratoworld = kernel_data.cam.cameratoworld; #ifdef __MOTION__ - if(ray->time != TIME_INVALID) + if(kernel_data.cam.have_motion) transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time); #endif diff --git a/intern/cycles/kernel/kernel_object.h b/intern/cycles/kernel/kernel_object.h index 262ca848f28..4a3ef55e8cb 100644 --- a/intern/cycles/kernel/kernel_object.h +++ b/intern/cycles/kernel/kernel_object.h @@ -32,34 +32,28 @@ __device_inline Transform object_fetch_transform(KernelGlobals *kg, int object, #ifdef __MOTION__ /* if we do motion blur */ - if(time != TIME_INVALID) { - int offset = object*OBJECT_SIZE + (int)OBJECT_TRANSFORM_MOTION_PRE; - float4 have_motion = kernel_tex_fetch(__objects, offset + 0); + if(sd->flag & SD_OBJECT_MOTION) { + /* fetch motion transforms */ + MotionTransform motion; - /* if this object have motion */ - if(have_motion.x != FLT_MAX) { - /* fetch motion transforms */ - MotionTransform motion; + motion.pre.x = have_motion; + motion.pre.y = kernel_tex_fetch(__objects, offset + 1); + motion.pre.z = kernel_tex_fetch(__objects, offset + 2); + motion.pre.w = kernel_tex_fetch(__objects, offset + 3); - motion.pre.x = have_motion; - motion.pre.y = kernel_tex_fetch(__objects, offset + 1); - motion.pre.z = kernel_tex_fetch(__objects, offset + 2); - motion.pre.w = kernel_tex_fetch(__objects, offset + 3); + motion.post.x = kernel_tex_fetch(__objects, offset + 4); + motion.post.y = kernel_tex_fetch(__objects, offset + 5); + motion.post.z = kernel_tex_fetch(__objects, offset + 6); + motion.post.w = kernel_tex_fetch(__objects, offset + 7); - motion.post.x = kernel_tex_fetch(__objects, offset + 4); - motion.post.y = kernel_tex_fetch(__objects, offset + 5); - motion.post.z = kernel_tex_fetch(__objects, offset + 6); - motion.post.w = kernel_tex_fetch(__objects, offset + 7); + /* interpolate (todo: do only once per object) */ + transform_motion_interpolate(&tfm, &motion, time); - /* interpolate (todo: do only once per object) */ - transform_motion_interpolate(&tfm, &motion, time); + /* invert */ + if(type == OBJECT_INVERSE_TRANSFORM) + tfm = transform_quick_inverse(tfm); - /* invert */ - if(type == OBJECT_INVERSE_TRANSFORM) - tfm = transform_quick_inverse(tfm); - - return tfm; - } + return tfm; } #endif @@ -83,6 +77,16 @@ __device_inline void object_position_transform(KernelGlobals *kg, ShaderData *sd #endif } +__device_inline void object_inverse_normal_transform(KernelGlobals *kg, ShaderData *sd, float3 *N) +{ +#ifdef __MOTION__ + *N = normalize(transform_direction_transposed(&sd->ob_tfm, *N)); +#else + Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM); + *N = normalize(transform_direction_transposed(&tfm, *N)); +#endif +} + __device_inline void object_normal_transform(KernelGlobals *kg, ShaderData *sd, float3 *N) { #ifdef __MOTION__ diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index b7c22087e1f..87d996ef9e2 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -277,12 +277,21 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R /* holdout */ #ifdef __HOLDOUT__ - if((sd.flag & SD_HOLDOUT) && (state.flag & PATH_RAY_CAMERA)) { - float3 holdout_weight = shader_holdout_eval(kg, &sd); + if((sd.flag & (SD_HOLDOUT|SD_HOLDOUT_MASK)) && (state.flag & PATH_RAY_CAMERA)) { + if(kernel_data.background.transparent) { + float3 holdout_weight; + + if(sd.flag & SD_HOLDOUT_MASK) + holdout_weight = make_float3(1.0f, 1.0f, 1.0f); + else + shader_holdout_eval(kg, &sd); - if(kernel_data.background.transparent) /* any throughput is ok, should all be identical here */ L_transparent += average(holdout_weight*throughput); + } + + if(sd.flag & SD_HOLDOUT_MASK) + break; } #endif diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index b2f2a7577be..e4edc480272 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -83,6 +83,7 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, sd->N = triangle_smooth_normal(kg, sd->prim, sd->u, sd->v); sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2); + sd->flag |= kernel_tex_fetch(__object_flag, sd->object); #ifdef __DPDU__ /* dPdu/dPdv */ @@ -177,6 +178,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, } sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2); + sd->flag |= kernel_tex_fetch(__object_flag, sd->object); #ifdef __DPDU__ /* dPdu/dPdv */ diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h index 8bab735d0d1..f4de4c100c4 100644 --- a/intern/cycles/kernel/kernel_textures.h +++ b/intern/cycles/kernel/kernel_textures.h @@ -39,6 +39,7 @@ KERNEL_TEX(float2, texture_float2, __light_background_conditional_cdf) /* shaders */ KERNEL_TEX(uint4, texture_uint4, __svm_nodes) KERNEL_TEX(uint, texture_uint, __shader_flag) +KERNEL_TEX(uint, texture_uint, __object_flag) /* camera/film */ KERNEL_TEX(float, texture_float, __filter_table) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index e9103087025..414943320e0 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -38,7 +38,7 @@ CCL_NAMESPACE_BEGIN /* device capabilities */ #ifdef __KERNEL_CPU__ #define __KERNEL_SHADING__ -#define __KERNEL_ADV_SHADING__ +//#define __KERNEL_ADV_SHADING__ #endif #ifdef __KERNEL_CUDA__ @@ -370,7 +370,11 @@ enum ShaderDataFlag { SD_SAMPLE_AS_LIGHT = 128, /* direct light sample */ SD_HAS_SURFACE_TRANSPARENT = 256, /* has surface transparency */ SD_HAS_VOLUME = 512, /* has volume shader */ - SD_HOMOGENEOUS_VOLUME = 1024 /* has homogeneous volume */ + SD_HOMOGENEOUS_VOLUME = 1024, /* has homogeneous volume */ + + /* object flags */ + SD_HOLDOUT_MASK = 2048, /* holdout for camera rays */ + SD_OBJECT_MOTION = 4096 /* has object motion blur */ }; typedef struct ShaderData { @@ -463,7 +467,7 @@ typedef struct KernelCamera { /* motion blur */ float shuttertime; - float pad; + int have_motion; /* clipping */ float nearclip; diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h index 5ecda795251..3b73cac5430 100644 --- a/intern/cycles/kernel/svm/svm_tex_coord.h +++ b/intern/cycles/kernel/svm/svm_tex_coord.h @@ -43,7 +43,7 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack case NODE_TEXCO_NORMAL: { if(sd->object != ~0) { data = sd->N; - object_normal_transform(kg, sd, &data); + object_inverse_normal_transform(kg, sd, &data); } else data = sd->N; @@ -97,7 +97,7 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa case NODE_TEXCO_NORMAL: { if(sd->object != ~0) { data = sd->N; - object_normal_transform(kg, sd, &data); + object_inverse_normal_transform(kg, sd, &data); } else data = sd->N; @@ -154,7 +154,7 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa case NODE_TEXCO_NORMAL: { if(sd->object != ~0) { data = sd->N; - object_normal_transform(kg, sd, &data); + object_inverse_normal_transform(kg, sd, &data); } else data = sd->N; diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index e9ca7c3a366..f0b77871130 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -149,6 +149,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) /* camera motion */ Scene::MotionType need_motion = scene->need_motion(); + kcam->have_motion = 0; if(need_motion == Scene::MOTION_PASS) { if(use_motion) { @@ -162,7 +163,10 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) } else if(need_motion == Scene::MOTION_BLUR) { /* todo: exact camera position will not be hit this way */ - transform_motion_decompose(&kcam->motion, &motion); + if(use_motion) { + transform_motion_decompose(&kcam->motion, &motion); + kcam->have_motion = 1; + } } /* depth of field */ diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index ccc654965f1..cae69c06f7d 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -41,6 +41,7 @@ Object::Object() motion.pre = transform_identity(); motion.post = transform_identity(); use_motion = false; + use_holdout = false; } Object::~Object() @@ -143,12 +144,14 @@ ObjectManager::~ObjectManager() void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) { float4 *objects = dscene->objects.resize(OBJECT_SIZE*scene->objects.size()); + uint *object_flag = dscene->object_flag.resize(OBJECT_SIZE*scene->objects.size()); int i = 0; map surface_area_map; Scene::MotionType need_motion = scene->need_motion(); foreach(Object *ob, scene->objects) { Mesh *mesh = ob->mesh; + uint flag = 0; /* compute transformations */ Transform tfm = ob->tfm; @@ -219,6 +222,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene transform_motion_decompose(&decomp, &ob->motion); memcpy(&objects[offset+8], &decomp, sizeof(float4)*8); + flag |= SD_OBJECT_MOTION; } else { float4 no_motion = make_float4(FLT_MAX); @@ -226,12 +230,18 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene } } + /* object flag */ + if(ob->use_holdout) + flag |= SD_HOLDOUT_MASK; + object_flag[i] = flag; + i++; if(progress.get_cancel()) return; } device->tex_alloc("__objects", dscene->objects); + device->tex_alloc("__object_flag", dscene->object_flag); } void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) @@ -266,6 +276,9 @@ void ObjectManager::device_free(Device *device, DeviceScene *dscene) { device->tex_free(dscene->objects); dscene->objects.clear(); + + device->tex_free(dscene->object_flag); + dscene->object_flag.clear(); } void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress) diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h index e84c4b26767..267052bfca7 100644 --- a/intern/cycles/render/object.h +++ b/intern/cycles/render/object.h @@ -46,6 +46,7 @@ public: uint visibility; MotionTransform motion; bool use_motion; + bool use_holdout; Object(); ~Object(); diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index 7d4acf369fd..ca4d9fc9625 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -85,6 +85,7 @@ public: /* shaders */ device_vector svm_nodes; device_vector shader_flag; + device_vector object_flag; /* filter */ device_vector filter_table; diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index f09803d8b09..7b527241847 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -436,6 +436,11 @@ __device_inline float len(const float3 a) return sqrtf(dot(a, a)); } +__device_inline float len_squared(const float3 a) +{ + return dot(a, a); +} + #ifndef __KERNEL_OPENCL__ __device_inline float3 normalize(const float3 a) diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 03dfbaa441d..7136c185d04 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -255,12 +255,12 @@ __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale) Transform ttfm = transform_transpose(tfm); float eps = 1e-7f; - float sx = len(float4_to_float3(tfm.x)); - float sy = len(float4_to_float3(tfm.y)); - float sz = len(float4_to_float3(tfm.z)); - float stx = len(float4_to_float3(ttfm.x)); - float sty = len(float4_to_float3(ttfm.y)); - float stz = len(float4_to_float3(ttfm.z)); + float sx = len_squared(float4_to_float3(tfm.x)); + float sy = len_squared(float4_to_float3(tfm.y)); + float sz = len_squared(float4_to_float3(tfm.z)); + float stx = len_squared(float4_to_float3(ttfm.x)); + float sty = len_squared(float4_to_float3(ttfm.y)); + float stz = len_squared(float4_to_float3(ttfm.z)); if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps && fabsf(sx - stx) < eps && fabsf(sx - sty) < eps && From afcc42c324e8f3bf6508f2087602a0e055eedead Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 09:50:48 +0000 Subject: [PATCH 35/55] Fix #31102: changing scene.use_color_management from render_pre callback would crash. --- source/blender/makesrna/intern/rna_scene.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 986c76db199..eb3c1c75cf4 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1077,8 +1077,11 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSE bNode *node; if (ntree && scene->use_nodes) { - /* XXX images are freed here, stop render and preview threads, until Image is threadsafe */ - WM_jobs_stop_all(bmain->wm.first); + /* images are freed here, stop render and preview threads, until + * Image is threadsafe. when we are changing this propery from a + * python script in the render thread, don't stop own thread */ + if(BLI_thread_is_main()) + WM_jobs_stop_all(bmain->wm.first); for (node = ntree->nodes.first; node; node = node->next) { if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_IMAGE)) { From f965858867a6df5825b52060d13d736793e25595 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 10:10:05 +0000 Subject: [PATCH 36/55] Fix 31220: glsl sun lamp shadows did not apparently respect shadow flag when working in blender render rather than blender game mode. Tweaked the flags a bit to make it compatible more, but for full configuration you need to be in blender game mode still. --- source/blender/gpu/intern/gpu_material.c | 2 +- source/blender/makesrna/intern/rna_lamp.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 173fbf02287..383dd6b8f2f 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1669,7 +1669,7 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par) la = ob->data; gpu_lamp_from_blender(scene, ob, par, la, lamp); - if ((la->type==LA_SPOT || la->type==LA_SUN) && (la->mode & LA_SHAD_BUF)) { + if ((la->type==LA_SPOT && (la->mode & LA_SHAD_BUF)) || (la->type==LA_SUN && (la->mode & LA_SHAD_RAY))) { /* opengl */ lamp->fb = GPU_framebuffer_create(); if (!lamp->fb) { diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 88bab4d5af3..fef362c8f10 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -89,18 +89,24 @@ static void rna_Lamp_active_texture_set(PointerRNA *ptr, PointerRNA value) static int rna_use_shadow_get(PointerRNA *ptr) { Lamp *la = (Lamp*)ptr->data; - return la->mode & LA_SHAD_BUF; + + if(la->type == LA_SPOT) + return la->mode & LA_SHAD_BUF; + else + return la->mode & LA_SHAD_RAY; } static void rna_use_shadow_set(PointerRNA *ptr, int value) { Lamp *la = (Lamp*)ptr->data; if (value) { - la->mode |= LA_SHAD_BUF; - la->mode &= ~LA_SHAD_RAY; + if(la->type == LA_SPOT) + la->mode |= LA_SHAD_BUF; + else + la->mode |= LA_SHAD_RAY; } else - la->mode &= ~(LA_SHAD_BUF + LA_SHAD_RAY); + la->mode &= ~(LA_SHAD_BUF|LA_SHAD_RAY); } static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr) From d47499f6fcaf140af3d6d38a845a1efa608fb83b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 10:52:29 +0000 Subject: [PATCH 37/55] Fix #31199 & #31112: cycles not working well with vertex/weight paint selection mask drawing. Now refactored the code a bit so that in no longer calls textured mesh drawing for the face mask drawing, just handle it as part of regular paint color drawing. Should also make the blender internal behavior more logical where it would start showing textures in solid mode when enabling face masking. --- .../blender/editors/space_view3d/drawmesh.c | 77 ++++++++++++++----- .../blender/editors/space_view3d/drawobject.c | 36 +-------- .../editors/space_view3d/view3d_intern.h | 1 + 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index f5f3b4c3f16..e2a7478bc8f 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -179,7 +179,7 @@ static DMDrawOption draw_mesh_face_select__drawFaceOptsInv(void *userData, int i return DM_DRAW_OPTION_SKIP; } -static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) +void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { drawMeshFaceSelect_userData data; @@ -593,20 +593,6 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index) } } -static DMDrawOption wpaint__setSolidDrawOptions_material(void *userData, int index) -{ - Mesh *me = (Mesh *)userData; - - if (me->mat && me->mpoly) { - Material *ma = me->mat[me->mpoly[index].mat_nr]; - if (ma && (ma->game.flag & GEMAT_INVISIBLE)) { - return DM_DRAW_OPTION_SKIP; - } - } - - return DM_DRAW_OPTION_NORMAL; -} - /* when face select is on, use face hidden flag */ static DMDrawOption wpaint__setSolidDrawOptions_facemask(void *userData, int index) { @@ -946,6 +932,10 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags); return; } + else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) { + draw_mesh_paint(scene, v3d, rv3d, ob, dm, draw_flags); + return; + } /* set opengl state for negative scale & color */ if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW); @@ -953,12 +943,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o glEnable(GL_LIGHTING); - if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) { - /* weight paint mode exception */ - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_material, - GPU_enable_material, NULL, ob->data, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); - } - else { + { Mesh *me = ob->data; TexMatCallback data = {scene, ob, me, dm}; int (*set_face_cb)(void *, int); @@ -1015,3 +1000,53 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o draw_mesh_face_select(rv3d, ob->data, dm); } +/* Vertex Paint and Weight Paint */ + +void draw_mesh_paint(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) +{ + DMSetDrawOptions facemask = NULL; + Mesh *me = ob->data; + + /* hide faces in face select mode */ + if (draw_flags & DRAW_FACE_SELECT) + facemask = wpaint__setSolidDrawOptions_facemask; + + if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { + /* enforce default material settings */ + GPU_enable_material(0, NULL); + + /* but set default spec */ + glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); + glEnable(GL_COLOR_MATERIAL); /* according manpages needed */ + glColor3ub(120, 120, 120); + glDisable(GL_COLOR_MATERIAL); + + /* diffuse */ + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable(GL_LIGHTING); + glEnable(GL_COLOR_MATERIAL); + + dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, + DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); + + glDisable(GL_COLOR_MATERIAL); + glDisable(GL_LIGHTING); + + GPU_disable_material(); + } + else if (ob->mode & OB_MODE_VERTEX_PAINT) { + if (me->mloopcol) + dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, + DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); + else { + glColor3f(1.0f, 1.0f, 1.0f); + dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, + DM_DRAW_ALWAYS_SMOOTH); + } + } + + /* draw face selection on top */ + if (draw_flags & DRAW_FACE_SELECT) + draw_mesh_face_select(rv3d, me, dm); +} + diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 740947d2fb8..66aa6b60b34 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3319,7 +3319,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D else if (dt == OB_WIRE || totface == 0) { draw_wire = OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff */ } - else if ( (draw_flags & DRAW_FACE_SELECT || (is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) || + else if ( ((is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) || check_object_draw_texture(scene, v3d, dt)) { if ( (v3d->flag & V3D_SELECT_OUTLINE) && @@ -3474,39 +3474,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } } else if (dt == OB_PAINT) { - if (is_obact) { - if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { - /* enforce default material settings */ - GPU_enable_material(0, NULL); - - /* but set default spec */ - glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); - glEnable(GL_COLOR_MATERIAL); /* according manpages needed */ - glColor3ub(120, 120, 120); - glDisable(GL_COLOR_MATERIAL); - /* diffuse */ - glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); - glEnable(GL_LIGHTING); - glEnable(GL_COLOR_MATERIAL); - - dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly, - DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); - glDisable(GL_COLOR_MATERIAL); - glDisable(GL_LIGHTING); - - GPU_disable_material(); - } - else if (ob->mode & OB_MODE_VERTEX_PAINT) { - if (me->mloopcol) - dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL, - DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); - else { - glColor3f(1.0f, 1.0f, 1.0f); - dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL, - DM_DRAW_ALWAYS_SMOOTH); - } - } - } + draw_mesh_paint(scene, v3d, rv3d, ob, dm, draw_flags); } /* set default draw color back for wire or for draw-extra later on */ diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 168775deae2..0a6e0da8247 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -130,6 +130,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in /* drawmesh.c */ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect); +void draw_mesh_paint(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect); /* view3d_draw.c */ void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar); From d6be860d3164820d3ddfae25c14fdd9efaabde63 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 2 May 2012 11:10:54 +0000 Subject: [PATCH 38/55] bmesh: use fixed stack size for face flipping array. also quiet unused var warnings --- source/blender/bmesh/intern/bmesh_core.c | 24 +++++++++++-------- source/blender/editors/space_node/drawnode.c | 2 +- .../blender/editors/space_view3d/drawmesh.c | 4 ++-- .../blender/editors/space_view3d/drawobject.c | 2 +- .../editors/space_view3d/view3d_intern.h | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index f38c737b8ac..e20eb103e1b 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -582,6 +582,9 @@ void BM_face_verts_kill(BMesh *bm, BMFace *f) BLI_array_free(verts); } +/** + * Kills \a f and its loops. + */ void BM_face_kill(BMesh *bm, BMFace *f) { #ifdef USE_BMESH_HOLES @@ -671,7 +674,10 @@ void BM_vert_kill(BMesh *bm, BMVert *v) /********** private disk and radial cycle functions ********** */ -static int bm_loop_length(BMLoop *l) +/** + * return the length of the face, should always equal \a l->f->len + */ +static int UNUSED_FUNCTION(bm_loop_length)(BMLoop *l) { BMLoop *l_first = l; int i = 0; @@ -707,18 +713,15 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f BMLoop *l_first = f->l_first; #endif + const int len = f->len; + const int do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS); BMLoop *l_iter, *oldprev, *oldnext; BMEdge **edar = NULL; - MDisps *md; - BLI_array_staticdeclare(edar, BM_NGON_STACK_SIZE); - int i, j, edok, len = 0, do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS); - - len = bm_loop_length(l_first); + BLI_array_fixedstack_declare(edar, BM_NGON_STACK_SIZE, len, __func__); + int i, j, edok; for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) { - BMEdge *curedge = l_iter->e; - bmesh_radial_loop_remove(l_iter, curedge); - BLI_array_append(edar, curedge); + bmesh_radial_loop_remove(l_iter, (edar[i] = l_iter->e)); } /* actually reverse the loop */ @@ -732,6 +735,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f if (do_disps) { float (*co)[3]; int x, y, sides; + MDisps *md; md = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MDISPS); if (!md->totdisp || !md->disps) @@ -777,7 +781,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f BM_CHECK_ELEMENT(l_iter->f); } - BLI_array_free(edar); + BLI_array_fixedstack_free(edar); BM_CHECK_ELEMENT(f); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 69e5cbefde5..bfa8111af3e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1756,7 +1756,7 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C { PointerRNA imfptr = RNA_pointer_get(ptr, "format"); PointerRNA active_input_ptr, op_ptr; - uiLayout *col, *row; + uiLayout *row; int active_index; int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER); diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index e2a7478bc8f..524b66c852c 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -933,7 +933,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o return; } else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) { - draw_mesh_paint(scene, v3d, rv3d, ob, dm, draw_flags); + draw_mesh_paint(rv3d, ob, dm, draw_flags); return; } @@ -1002,7 +1002,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* Vertex Paint and Weight Paint */ -void draw_mesh_paint(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) +void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) { DMSetDrawOptions facemask = NULL; Mesh *me = ob->data; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 66aa6b60b34..585fc43e5c2 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3474,7 +3474,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } } else if (dt == OB_PAINT) { - draw_mesh_paint(scene, v3d, rv3d, ob, dm, draw_flags); + draw_mesh_paint(rv3d, ob, dm, draw_flags); } /* set default draw color back for wire or for draw-extra later on */ diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 0a6e0da8247..66b8ceb7a85 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -130,7 +130,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in /* drawmesh.c */ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect); -void draw_mesh_paint(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect); +void draw_mesh_paint(RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect); /* view3d_draw.c */ void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar); From 4d10642e8bd7a85256f26952283dda97cfd1b22a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 12:14:27 +0000 Subject: [PATCH 39/55] Python/context: allow overriding window/screen/area/region context for running operators from python, this is useful to run an operator in a particular place in the UI. --- source/blender/blenkernel/intern/context.c | 501 +++++++++++---------- 1 file changed, 270 insertions(+), 231 deletions(-) diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 7a5b4ef9b24..1b4a9cb7f5a 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -202,6 +202,7 @@ void CTX_store_free_list(ListBase *contexts) } /* is python initialied? */ + int CTX_py_init_get(bContext *C) { return C->data.py_init; @@ -220,237 +221,6 @@ void CTX_py_dict_set(bContext *C, void *value) C->data.py_context= value; } -/* window manager context */ - -wmWindowManager *CTX_wm_manager(const bContext *C) -{ - return C->wm.manager; -} - -wmWindow *CTX_wm_window(const bContext *C) -{ - return C->wm.window; -} - -bScreen *CTX_wm_screen(const bContext *C) -{ - return C->wm.screen; -} - -ScrArea *CTX_wm_area(const bContext *C) -{ - return C->wm.area; -} - -SpaceLink *CTX_wm_space_data(const bContext *C) -{ - return (C->wm.area)? C->wm.area->spacedata.first: NULL; -} - -ARegion *CTX_wm_region(const bContext *C) -{ - return C->wm.region; -} - -void *CTX_wm_region_data(const bContext *C) -{ - return (C->wm.region)? C->wm.region->regiondata: NULL; -} - -struct ARegion *CTX_wm_menu(const bContext *C) -{ - return C->wm.menu; -} - -struct ReportList *CTX_wm_reports(const bContext *C) -{ - if (C->wm.manager) - return &(C->wm.manager->reports); - - return NULL; -} - -View3D *CTX_wm_view3d(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D) - return C->wm.area->spacedata.first; - return NULL; -} - -RegionView3D *CTX_wm_region_view3d(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D) - if (C->wm.region) - return C->wm.region->regiondata; - return NULL; -} - -struct SpaceText *CTX_wm_space_text(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_TEXT) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceConsole *CTX_wm_space_console(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_CONSOLE) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceImage *CTX_wm_space_image(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_IMAGE) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceButs *CTX_wm_space_buts(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_BUTS) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceFile *CTX_wm_space_file(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_FILE) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceSeq *CTX_wm_space_seq(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_SEQ) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceOops *CTX_wm_space_outliner(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_OUTLINER) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceNla *CTX_wm_space_nla(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_NLA) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceTime *CTX_wm_space_time(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_TIME) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceNode *CTX_wm_space_node(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_NODE) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceLogic *CTX_wm_space_logic(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_LOGIC) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceIpo *CTX_wm_space_graph(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_IPO) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceAction *CTX_wm_space_action(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_ACTION) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceInfo *CTX_wm_space_info(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_INFO) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_USERPREF) - return C->wm.area->spacedata.first; - return NULL; -} - -struct SpaceClip *CTX_wm_space_clip(const bContext *C) -{ - if (C->wm.area && C->wm.area->spacetype==SPACE_CLIP) - return C->wm.area->spacedata.first; - return NULL; -} - -void CTX_wm_manager_set(bContext *C, wmWindowManager *wm) -{ - C->wm.manager= wm; - C->wm.window= NULL; - C->wm.screen= NULL; - C->wm.area= NULL; - C->wm.region= NULL; -} - -void CTX_wm_window_set(bContext *C, wmWindow *win) -{ - C->wm.window= win; - C->wm.screen= (win)? win->screen: NULL; - if (C->wm.screen) - C->data.scene= C->wm.screen->scene; - C->wm.area= NULL; - C->wm.region= NULL; -} - -void CTX_wm_screen_set(bContext *C, bScreen *screen) -{ - C->wm.screen= screen; - if (C->wm.screen) - C->data.scene= C->wm.screen->scene; - C->wm.area= NULL; - C->wm.region= NULL; -} - -void CTX_wm_area_set(bContext *C, ScrArea *area) -{ - C->wm.area= area; - C->wm.region= NULL; -} - -void CTX_wm_region_set(bContext *C, ARegion *region) -{ - C->wm.region= region; -} - -void CTX_wm_menu_set(bContext *C, ARegion *menu) -{ - C->wm.menu= menu; -} - -void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg) -{ - C->wm.operator_poll_msg= msg; -} - -const char *CTX_wm_operator_poll_msg_get(bContext *C) -{ - return C->wm.operator_poll_msg; -} - /* data context utility functions */ struct bContextDataResult { @@ -460,6 +230,22 @@ struct bContextDataResult { short type; /* 0: normal, 1: seq */ }; +static void *ctx_wm_python_context_get(const bContext *C, const char *member, void *fall_through) +{ +#ifdef WITH_PYTHON + bContextDataResult result; + + if (C && CTX_py_dict_get(C)) { + memset(&result, 0, sizeof(bContextDataResult)); + BPY_context_member_get((bContext*)C, member, &result); + if(result.ptr.data) + return result.ptr.data; + } +#endif + + return fall_through; +} + static int ctx_data_get(bContext *C, const char *member, bContextDataResult *result) { int done= 0, recursion= C->data.recursion; @@ -745,6 +531,259 @@ short CTX_data_type_get(bContextDataResult *result) return result->type; } + + +/* window manager context */ + +wmWindowManager *CTX_wm_manager(const bContext *C) +{ + return C->wm.manager; +} + +wmWindow *CTX_wm_window(const bContext *C) +{ + return ctx_wm_python_context_get(C, "window", C->wm.window); +} + +bScreen *CTX_wm_screen(const bContext *C) +{ + return ctx_wm_python_context_get(C, "screen", C->wm.screen); +} + +ScrArea *CTX_wm_area(const bContext *C) +{ + return ctx_wm_python_context_get(C, "area", C->wm.area); +} + +SpaceLink *CTX_wm_space_data(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + return (sa)? sa->spacedata.first: NULL; +} + +ARegion *CTX_wm_region(const bContext *C) +{ + return ctx_wm_python_context_get(C, "region", C->wm.region); +} + +void *CTX_wm_region_data(const bContext *C) +{ + ARegion *ar = CTX_wm_region(C); + return (ar)? ar->regiondata: NULL; +} + +struct ARegion *CTX_wm_menu(const bContext *C) +{ + return C->wm.menu; +} + +struct ReportList *CTX_wm_reports(const bContext *C) +{ + if (C->wm.manager) + return &(C->wm.manager->reports); + + return NULL; +} + +View3D *CTX_wm_view3d(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_VIEW3D) + return sa->spacedata.first; + return NULL; +} + +RegionView3D *CTX_wm_region_view3d(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_VIEW3D) + if (C->wm.region) + return C->wm.region->regiondata; + return NULL; +} + +struct SpaceText *CTX_wm_space_text(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_TEXT) + return sa->spacedata.first; + return NULL; +} + +struct SpaceConsole *CTX_wm_space_console(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_CONSOLE) + return sa->spacedata.first; + return NULL; +} + +struct SpaceImage *CTX_wm_space_image(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_IMAGE) + return sa->spacedata.first; + return NULL; +} + +struct SpaceButs *CTX_wm_space_buts(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_BUTS) + return sa->spacedata.first; + return NULL; +} + +struct SpaceFile *CTX_wm_space_file(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_FILE) + return sa->spacedata.first; + return NULL; +} + +struct SpaceSeq *CTX_wm_space_seq(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_SEQ) + return sa->spacedata.first; + return NULL; +} + +struct SpaceOops *CTX_wm_space_outliner(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_OUTLINER) + return sa->spacedata.first; + return NULL; +} + +struct SpaceNla *CTX_wm_space_nla(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_NLA) + return sa->spacedata.first; + return NULL; +} + +struct SpaceTime *CTX_wm_space_time(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_TIME) + return sa->spacedata.first; + return NULL; +} + +struct SpaceNode *CTX_wm_space_node(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_NODE) + return sa->spacedata.first; + return NULL; +} + +struct SpaceLogic *CTX_wm_space_logic(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_LOGIC) + return sa->spacedata.first; + return NULL; +} + +struct SpaceIpo *CTX_wm_space_graph(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_IPO) + return sa->spacedata.first; + return NULL; +} + +struct SpaceAction *CTX_wm_space_action(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_ACTION) + return sa->spacedata.first; + return NULL; +} + +struct SpaceInfo *CTX_wm_space_info(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_INFO) + return sa->spacedata.first; + return NULL; +} + +struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_USERPREF) + return sa->spacedata.first; + return NULL; +} + +struct SpaceClip *CTX_wm_space_clip(const bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype==SPACE_CLIP) + return sa->spacedata.first; + return NULL; +} + +void CTX_wm_manager_set(bContext *C, wmWindowManager *wm) +{ + C->wm.manager= wm; + C->wm.window= NULL; + C->wm.screen= NULL; + C->wm.area= NULL; + C->wm.region= NULL; +} + +void CTX_wm_window_set(bContext *C, wmWindow *win) +{ + C->wm.window= win; + C->wm.screen= (win)? win->screen: NULL; + if (C->wm.screen) + C->data.scene= C->wm.screen->scene; + C->wm.area= NULL; + C->wm.region= NULL; +} + +void CTX_wm_screen_set(bContext *C, bScreen *screen) +{ + C->wm.screen= screen; + if (C->wm.screen) + C->data.scene= C->wm.screen->scene; + C->wm.area= NULL; + C->wm.region= NULL; +} + +void CTX_wm_area_set(bContext *C, ScrArea *area) +{ + C->wm.area= area; + C->wm.region= NULL; +} + +void CTX_wm_region_set(bContext *C, ARegion *region) +{ + C->wm.region= region; +} + +void CTX_wm_menu_set(bContext *C, ARegion *menu) +{ + C->wm.menu= menu; +} + +void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg) +{ + C->wm.operator_poll_msg= msg; +} + +const char *CTX_wm_operator_poll_msg_get(bContext *C) +{ + return C->wm.operator_poll_msg; +} + /* data context */ Main *CTX_data_main(const bContext *C) From 4fd18b5d3c211b153cfab0996b616df019527f68 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 13:09:26 +0000 Subject: [PATCH 40/55] Fix crash setting area.type from a context that not include the right window, ideally this function should become context free, for now just trick it to execute in the right context. --- source/blender/makesrna/intern/rna_screen.c | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 67a4bafb8ee..db43db273bd 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -111,10 +111,31 @@ static void rna_Area_type_set(PointerRNA *ptr, int value) static void rna_Area_type_update(bContext *C, PointerRNA *ptr) { + wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win; + bScreen *sc = (bScreen*)ptr->id.data; ScrArea *sa = (ScrArea*)ptr->data; - ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */ - ED_area_tag_redraw(sa); + /* XXX this call still use context, so we trick it to work in the right context */ + for(win=wm->windows.first; win; win=win->next) { + if(sc == win->screen) { + wmWindow *prevwin = CTX_wm_window(C); + ScrArea *prevsa = CTX_wm_area(C); + ARegion *prevar = CTX_wm_region(C); + + CTX_wm_window_set(C, win); + CTX_wm_area_set(C, sa); + CTX_wm_region_set(C, NULL); + + ED_area_newspace(C, sa, sa->butspacetype); + ED_area_tag_redraw(sa); + + CTX_wm_window_set(C, prevwin); + CTX_wm_area_set(C, prevsa); + CTX_wm_region_set(C, prevar); + break; + } + } } #else From 2151c2f28efff1394a7e315240c1835326e66233 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 13:28:13 +0000 Subject: [PATCH 41/55] Python: documentation about overriding context members. --- doc/python_api/examples/bpy.ops.2.py | 18 ++++++++++++++++++ doc/python_api/examples/bpy.ops.3.py | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 doc/python_api/examples/bpy.ops.2.py create mode 100644 doc/python_api/examples/bpy.ops.3.py diff --git a/doc/python_api/examples/bpy.ops.2.py b/doc/python_api/examples/bpy.ops.2.py new file mode 100644 index 00000000000..86b7438888c --- /dev/null +++ b/doc/python_api/examples/bpy.ops.2.py @@ -0,0 +1,18 @@ +""" +Overriding Context +++++++++++++++++++ + +It is possible to override context members that the operator sees, so that they +act on specified rather than the selected or active data, or to execute an +operator in the different part of the user interface. + +The context overrides are passed as a dictionary, with keys matching the context +member names in bpy.context. For example to override bpy.context.active_object, +you would pass {'active_object': object}. +""" + +# remove all objects in scene rather than the selected ones +import bpy +override = {'selected_bases': list(bpy.context.scene.object_bases)} +bpy.ops.object.delete(override) + diff --git a/doc/python_api/examples/bpy.ops.3.py b/doc/python_api/examples/bpy.ops.3.py new file mode 100644 index 00000000000..0b5bcafe5be --- /dev/null +++ b/doc/python_api/examples/bpy.ops.3.py @@ -0,0 +1,18 @@ +""" +It is also possible to run an operator in a particular part of the user +interface. For this we need to pass the window, screen, area and sometimes +a region. +""" + +# maximize 3d view in all windows +import bpy + +for window in bpy.context.window_manager.windows: + screen = window.screen + + for area in screen.areas: + if area.type == 'VIEW_3D': + override = {'window': window, 'screen': screen, 'area': area} + bpy.ops.screen.screen_full_area(override) + break + From aa3621c7e653ed703b65005ba55365bd8996fd47 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 13:48:14 +0000 Subject: [PATCH 42/55] Python/context: tweak code further so that when you set screen/area/region from python, it actually gets data context from there as well. --- source/blender/blenkernel/intern/context.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 1b4a9cb7f5a..75573246122 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -248,6 +248,9 @@ static void *ctx_wm_python_context_get(const bContext *C, const char *member, vo static int ctx_data_get(bContext *C, const char *member, bContextDataResult *result) { + bScreen *sc; + ScrArea *sa; + ARegion *ar; int done= 0, recursion= C->data.recursion; int ret= 0; @@ -279,23 +282,23 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res done= 1; } } - if (done!=1 && recursion < 2 && C->wm.region) { + if (done!=1 && recursion < 2 && (ar=CTX_wm_region(C))) { C->data.recursion= 2; - if (C->wm.region->type && C->wm.region->type->context) { - ret = C->wm.region->type->context(C, member, result); + if (ar->type && ar->type->context) { + ret = ar->type->context(C, member, result); if (ret) done= -(-ret | -done); } } - if (done!=1 && recursion < 3 && C->wm.area) { + if (done!=1 && recursion < 3 && (sa=CTX_wm_area(C))) { C->data.recursion= 3; - if (C->wm.area->type && C->wm.area->type->context) { - ret = C->wm.area->type->context(C, member, result); + if (sa->type && sa->type->context) { + ret = sa->type->context(C, member, result); if (ret) done= -(-ret | -done); } } - if (done!=1 && recursion < 4 && C->wm.screen) { - bContextDataCallback cb= C->wm.screen->context; + if (done!=1 && recursion < 4 && (sc=CTX_wm_screen(C))) { + bContextDataCallback cb= sc->context; C->data.recursion= 4; if (cb) { ret = cb(C, member, result); From 3224ac738ee3aeb13ad1329b12621ff0f0e3a322 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 2 May 2012 14:16:35 +0000 Subject: [PATCH 43/55] CMake: Fix to install numpy (source dir was "hardcoded", rather use PYTHON_NUMPY_PATH), was failing under Debian testing. Note that there is still a problem, destination ("site-packages") is not in blender's python path, so you have to edit sys.path before being able to import numpy... but at least it installs again. --- source/creator/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index f4c3964ab83..d069811168d 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -441,7 +441,7 @@ if(UNIX AND NOT APPLE) if(WITH_PYTHON_INSTALL_NUMPY) install( - DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy + DIRECTORY ${PYTHON_NUMPY_PATH}/numpy DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/site-packages PATTERN ".svn" EXCLUDE PATTERN "__pycache__" EXCLUDE # * any cache * From 30c2abd32326f856f3ea45589c0a2e02b71536ed Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 14:22:22 +0000 Subject: [PATCH 44/55] Fixes for recent cycles and python/context commits. --- intern/cycles/kernel/kernel_types.h | 2 +- source/blender/blenkernel/intern/context.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 414943320e0..bf48ec8c000 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -38,7 +38,7 @@ CCL_NAMESPACE_BEGIN /* device capabilities */ #ifdef __KERNEL_CPU__ #define __KERNEL_SHADING__ -//#define __KERNEL_ADV_SHADING__ +#define __KERNEL_ADV_SHADING__ #endif #ifdef __KERNEL_CUDA__ diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 75573246122..bd47e7cbd37 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -427,6 +427,9 @@ ListBase CTX_data_dir_get(const bContext *C) { bContextDataResult result; ListBase lb; + bScreen *sc; + ScrArea *sa; + ARegion *ar; int a; memset(&lb, 0, sizeof(lb)); @@ -437,24 +440,24 @@ ListBase CTX_data_dir_get(const bContext *C) for (entry=C->wm.store->entries.first; entry; entry=entry->next) data_dir_add(&lb, entry->name); } - if (C->wm.region && C->wm.region->type && C->wm.region->type->context) { + if ((ar=CTX_wm_region(C)) && ar->type && ar->type->context) { memset(&result, 0, sizeof(result)); - C->wm.region->type->context(C, "", &result); + ar->type->context(C, "", &result); if (result.dir) for (a=0; result.dir[a]; a++) data_dir_add(&lb, result.dir[a]); } - if (C->wm.area && C->wm.area->type && C->wm.area->type->context) { + if ((sa=CTX_wm_area(C)) && sa->type && sa->type->context) { memset(&result, 0, sizeof(result)); - C->wm.area->type->context(C, "", &result); + sa->type->context(C, "", &result); if (result.dir) for (a=0; result.dir[a]; a++) data_dir_add(&lb, result.dir[a]); } - if (C->wm.screen && C->wm.screen->context) { - bContextDataCallback cb= C->wm.screen->context; + if ((sc=CTX_wm_screen(C)) && sc->context) { + bContextDataCallback cb= sc->context; memset(&result, 0, sizeof(result)); cb(C, "", &result); @@ -599,9 +602,11 @@ View3D *CTX_wm_view3d(const bContext *C) RegionView3D *CTX_wm_region_view3d(const bContext *C) { ScrArea *sa = CTX_wm_area(C); + ARegion *ar = CTX_wm_region(C); + if (sa && sa->spacetype==SPACE_VIEW3D) - if (C->wm.region) - return C->wm.region->regiondata; + if (ar) + return ar->regiondata; return NULL; } From 5c5349e086144657236d1638c893bd7866979f01 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 14:23:00 +0000 Subject: [PATCH 45/55] Fix: --debug-python command option was not working correct. --- source/creator/creator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/creator/creator.c b/source/creator/creator.c index c28f72881cf..8024356c181 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1101,7 +1101,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) #ifdef WITH_FFMPEG BLI_argsAdd(ba, 1, NULL, "--debug-ffmpeg", "\n\tEnable debug messages from FFmpeg library", debug_mode_generic, (void *)G_DEBUG_FFMPEG); #endif - BLI_argsAdd(ba, 1, NULL, "--debug-python", "\n\tEnable debug messages for python", debug_mode_generic, (void *)G_DEBUG_FFMPEG); + BLI_argsAdd(ba, 1, NULL, "--debug-python", "\n\tEnable debug messages for python", debug_mode_generic, (void *)G_DEBUG_PYTHON); BLI_argsAdd(ba, 1, NULL, "--debug-events", "\n\tEnable debug messages for the event system", debug_mode_generic, (void *)G_DEBUG_EVENTS); BLI_argsAdd(ba, 1, NULL, "--debug-wm", "\n\tEnable debug messages for the window manager", debug_mode_generic, (void *)G_DEBUG_WM); BLI_argsAdd(ba, 1, NULL, "--debug-all", "\n\tEnable all debug messages (excludes libmv)", debug_mode_generic, (void *)G_DEBUG_ALL); From 1d2e1018f7babf913d2f6d09f921d3137a8999fa Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 2 May 2012 14:29:12 +0000 Subject: [PATCH 46/55] Small enhancement to Fast Gaussian compo blur node: do not compute when size is below 0.001! (Was already checked/done for other blur algos, can be annoying when you animate the blur size to apply it only on a few frames.) --- .../composite/nodes/node_composite_blur.c | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 354bb458ea9..5675acbe084 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -605,36 +605,40 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN out[0]->data= new; } else if (nbd->filtertype == R_FILTER_FAST_GAUSS) { - CompBuf *new, *img = in[0]->data; - // TODO: can this be mapped with reference, too? - const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f; - int c; - - if ((img==NULL) || (out[0]->hasoutput==0)) return; - - if (img->type == CB_VEC2) - new = typecheck_compbuf(img, CB_VAL); - else if (img->type == CB_VEC3) - new = typecheck_compbuf(img, CB_RGBA); - else - new = dupalloc_compbuf(img); - - if ((sx == sy) && (sx > 0.f)) { - for (c=0; ctype; ++c) - IIR_gauss(new, sx, c, 3); + if (in[1]->vec[0] < 0.001f) { /* time node inputs can be a tiny value */ + new = pass_on_compbuf(img); } else { - if (sx > 0.f) { + CompBuf *new, *img = in[0]->data; + // TODO: can this be mapped with reference, too? + const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f; + int c; + + if ((img==NULL) || (out[0]->hasoutput==0)) return; + + if (img->type == CB_VEC2) + new = typecheck_compbuf(img, CB_VAL); + else if (img->type == CB_VEC3) + new = typecheck_compbuf(img, CB_RGBA); + else + new = dupalloc_compbuf(img); + + if ((sx == sy) && (sx > 0.f)) { for (c=0; ctype; ++c) - IIR_gauss(new, sx, c, 1); + IIR_gauss(new, sx, c, 3); } - if (sy > 0.f) { - for (c=0; ctype; ++c) - IIR_gauss(new, sy, c, 2); + else { + if (sx > 0.f) { + for (c=0; ctype; ++c) + IIR_gauss(new, sx, c, 1); + } + if (sy > 0.f) { + for (c=0; ctype; ++c) + IIR_gauss(new, sy, c, 2); + } } } out[0]->data = new; - } else { /* All non fast gauss blur methods */ From b2a9d012b4e0ce820cb81ce170d84bed143ac041 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 15:47:15 +0000 Subject: [PATCH 47/55] Fix #31236: linking a socket of a different type to an existing node group output would crash, did not convert default value storage correctly. --- source/blender/editors/space_node/node_edit.c | 3 ++- source/blender/nodes/intern/node_common.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c0817f9c895..4bbba419613 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2412,7 +2412,8 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event) /* when linking to group outputs, update the socket type */ /* XXX this should all be part of a generic update system */ if (!link->tonode) { - link->tosock->type = link->fromsock->type; + if(link->tosock->type != link->fromsock->type) + nodeSocketSetType(link->tosock, link->fromsock->type); } } else if (outside_group_rect(snode) && (link->tonode || link->fromnode)) { diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 13882d631d8..3aadcef4c82 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -551,7 +551,8 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o sock->groupsock = gsock; BLI_strncpy(sock->name, gsock->name, sizeof(sock->name)); - sock->type= gsock->type; + if(gsock->type != sock->type) + nodeSocketSetType(sock, gsock->type); /* XXX hack: group socket input/output roles are inverted internally, * need to change the limit value when making actual node sockets from them. From a0642a259759ebd76a956433a2949b94b00374bb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 16:05:25 +0000 Subject: [PATCH 48/55] Fix wrong unified weight paint value version patch, was doing incorrect version check. Fix #31209: weight paint sample & fill not using correct brush/unified value. --- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenkernel/BKE_brush.h | 1 + source/blender/blenkernel/intern/brush.c | 10 ++++++++++ source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 10 ++++++++-- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 19ca0f8cc61..4ea38628001 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 263 -#define BLENDER_SUBVERSION 2 +#define BLENDER_SUBVERSION 3 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 2a62d204e78..52666ca1538 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -100,6 +100,7 @@ void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, flo float brush_alpha(const struct Scene *scene, struct Brush *brush); float brush_weight(const Scene *scene, struct Brush *brush); +void brush_set_weight(const Scene *scene, struct Brush *brush, float value); int brush_use_locked_size(const struct Scene *scene, struct Brush *brush); int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 917c59b35a1..b3d128bf2b4 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -718,6 +718,16 @@ float brush_weight(const Scene *scene, Brush *brush) return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight; } +void brush_set_weight(const Scene *scene, Brush *brush, float value) +{ + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + + if(ups->flag & UNIFIED_PAINT_WEIGHT) + ups->weight = value; + else + brush->weight = value; +} + /* scale unprojected radius to reflect a change in the brush's 2D size */ void brush_scale_unprojected_radius(float *unprojected_radius, int new_brush_size, diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1813bd49936..6c0ac651f13 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -13318,7 +13318,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile <= 263 && main->subversionfile == 0) { + if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 3)) { Scene *scene; Brush *brush; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 2d984adf5cb..18ddc965976 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1025,7 +1025,9 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event) else { MPoly *mp = ((MPoly *)me->mpoly) + (index - 1); const int vgroup_active = vc.obact->actdef - 1; + Scene *scene = vc.scene; ToolSettings *ts = vc.scene->toolsettings; + Brush *brush = paint_brush(&ts->wpaint->paint); float mval_f[2]; int v_idx_best = -1; int fidx; @@ -1048,7 +1050,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event) } while (fidx--); if (v_idx_best != -1) { /* should always be valid */ - ts->vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active); + float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active); + brush_set_weight(scene, brush, vgroup_weight); change = TRUE; } } @@ -2505,8 +2508,11 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op)) { struct Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); + ToolSettings *ts = CTX_data_tool_settings(C); + Brush *brush = paint_brush(&ts->wpaint->paint); + float vgroup_weight = brush_weight(scene, brush); - wpaint_fill(scene->toolsettings->wpaint, obact, scene->toolsettings->vgroup_weight); + wpaint_fill(scene->toolsettings->wpaint, obact, vgroup_weight); ED_region_tag_redraw(CTX_wm_region(C)); /* XXX - should redraw all 3D views */ return OPERATOR_FINISHED; } From ade7f59d0a7163c14afaa0a5418698149d141d4b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 16:17:04 +0000 Subject: [PATCH 49/55] Fix #31190: mirror modifier caused non-planar quads to be split differently on the other side, now keep the first vertex of the polygon the same to avoid this. --- source/blender/modifiers/intern/MOD_mirror.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 1284d5a6769..09924b5b0a4 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -113,7 +113,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, float mtx[4][4]; int i, j; int a, totshape; - int *vtargetmap, *vtmap_a = NULL, *vtmap_b = NULL; + int *vtargetmap = NULL, *vtmap_a = NULL, *vtmap_b = NULL; /* mtx is the mirror transformation */ unit_m4(mtx); @@ -223,10 +223,11 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, MLoop *ml2; int e; - /* reverse the loop */ - for (j = 0; j < mp->totloop; j++) { - DM_copy_loop_data(result, result, mp->loopstart + j, mp->loopstart + maxLoops + mp->totloop - j - 1, 1); - } + /* reverse the loop, but we keep the first vertex in the face the same, + * to ensure that quads are split the same way as on the other side */ + DM_copy_loop_data(result, result, mp->loopstart, mp->loopstart + maxLoops, 1); + for (j = 1; j < mp->totloop; j++) + DM_copy_loop_data(result, result, mp->loopstart + j, mp->loopstart + maxLoops + mp->totloop - j, 1); ml2 = ml + mp->loopstart + maxLoops; e = ml2[0].e; From 66581e903c346e60797669693de99fd710806af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20M=C3=A4ki-Kanto?= Date: Wed, 2 May 2012 16:18:20 +0000 Subject: [PATCH 50/55] Fix #31176: Collada model shows weird textures in editmode Issue with multimaterial meshes and mface to mpoly conversion being before assignment of materials (which is done on meshobject instancing?). Added explicit bmesh conversion to MeshImporter which is called from DocumentImporter::import. --- source/blender/collada/DocumentImporter.cpp | 2 ++ source/blender/collada/MeshImporter.cpp | 13 +++++++++++-- source/blender/collada/MeshImporter.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a1f69ef16bd..947bedc2ff7 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -144,6 +144,8 @@ bool DocumentImporter::import() delete ehandler; + mesh_importer.bmeshConversion(); + return true; } diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 73b2a1c23ad..d6cc35deca7 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -727,6 +727,16 @@ bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {} +void MeshImporter::bmeshConversion() +{ + for (std::map::iterator m = uid_mesh_map.begin(); + m != uid_mesh_map.end(); ++m) + { + if ((*m).second) BKE_mesh_convert_mfaces_to_mpolys((*m).second); + } +} + + Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) { if (uid_object_map.find(geom_uid) != uid_object_map.end()) @@ -921,7 +931,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta fprintf(stderr, "invalid referenced material for %s\n", mat_array[i].getName().c_str()); } } - + return ob; } @@ -964,6 +974,5 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); - BKE_mesh_convert_mfaces_to_mpolys(me); return true; } diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h index 0c2e600121f..97ae4d99ad7 100644 --- a/source/blender/collada/MeshImporter.h +++ b/source/blender/collada/MeshImporter.h @@ -129,6 +129,8 @@ public: MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce); + void bmeshConversion(); + virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid); MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture, From d821cdd948497a3d484b657e72c282f02a270af6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 2 May 2012 16:42:42 +0000 Subject: [PATCH 51/55] Clip editor: added drag-n-drop support so files can be opened in clip editor by drag-n-dropping them from an external application. --- .../blender/editors/space_clip/space_clip.c | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 271ad84fec6..80755828f7e 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -304,9 +304,12 @@ static void clip_free(SpaceLink *sl) } /* spacetype; init callback */ -static void clip_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) +static void clip_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { + ListBase *lb = WM_dropboxmap_find("Clip", SPACE_CLIP, 0); + /* add drop boxes */ + WM_event_add_dropbox_handler(&sa->handlers, lb); } static SpaceLink *clip_duplicate(SpaceLink *sl) @@ -731,6 +734,30 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul return FALSE; } +/* dropboxes */ +static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +{ + if (drag->type == WM_DRAG_PATH) + if (ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ + return TRUE; + + return FALSE; +} + +static void clip_drop_copy(wmDrag *drag, wmDropBox *drop) +{ + /* copy drag path to properties */ + RNA_string_set(drop->ptr, "filepath", drag->path); +} + +/* area+region dropbox definition */ +static void clip_dropboxes(void) +{ + ListBase *lb = WM_dropboxmap_find("Clip", SPACE_CLIP, 0); + + WM_dropbox_add(lb, "CLIP_OT_open", clip_drop_poll, clip_drop_copy); +} + static void clip_refresh(const bContext *C, ScrArea *sa) { wmWindowManager *wm = CTX_wm_manager(C); @@ -1296,6 +1323,7 @@ void ED_spacetype_clip(void) st->keymap = clip_keymap; st->listener = clip_listener; st->context = clip_context; + st->dropboxes = clip_dropboxes; st->refresh = clip_refresh; /* regions: main window */ From 89f554fd24abb6c3986090933f771da267345b96 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 2 May 2012 17:01:48 +0000 Subject: [PATCH 52/55] Clip editor: remove Z-key shortcut for curve view. It doesn't make many sense anymore. --- source/blender/editors/space_clip/space_clip.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 80755828f7e..4543876ffe5 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -525,11 +525,6 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION); RNA_boolean_set(kmi->ptr, "toggle", TRUE); - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, 0, 0); - RNA_string_set(kmi->ptr, "data_path", "space_data.view"); - RNA_string_set(kmi->ptr, "value_1", "CLIP"); - RNA_string_set(kmi->ptr, "value_2", "GRAPH"); - WM_keymap_add_item(keymap, "CLIP_OT_solve_camera", SKEY, KM_PRESS, KM_SHIFT, 0); /* ******** Hotkeys avalaible for main region only ******** */ From d64661b5078cd4781bd58fce6fadedac511c4132 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 May 2012 17:03:46 +0000 Subject: [PATCH 53/55] Cycles: add Ray Length output to Light Path node. This gives the distance travelled by the last light ray. One use case for this might be to do absorption. Patch #31232 by Agustin benavidez, see this blog post for details: http://agus3d.blogspot.com.ar/2012/05/blender-cycles-ray-length-node-output.html --- intern/cycles/kernel/kernel_emission.h | 6 +++--- intern/cycles/kernel/kernel_shader.h | 7 +++++-- intern/cycles/kernel/kernel_types.h | 3 +++ intern/cycles/kernel/svm/svm_light_path.h | 1 + intern/cycles/kernel/svm/svm_types.h | 3 ++- intern/cycles/render/nodes.cpp | 8 ++++++++ .../blender/nodes/shader/nodes/node_shader_light_path.c | 1 + 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index cd7701a0c75..0ef1425e68a 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN /* Direction Emission */ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando, - LightSample *ls, float u, float v, float3 I, float time) + LightSample *ls, float u, float v, float3 I, float t, float time) { /* setup shading at emitter */ ShaderData sd; @@ -40,7 +40,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando, else #endif { - shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, time); + shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time); ls->Ng = sd.Ng; /* no path flag, we're evaluating this for all closures. that's weak but @@ -87,7 +87,7 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex, return false; /* evaluate closure */ - float3 light_eval = direct_emissive_eval(kg, rando, &ls, randu, randv, -ls.D, sd->time); + float3 light_eval = direct_emissive_eval(kg, rando, &ls, randu, randv, -ls.D, ls.t, sd->time); if(is_zero(light_eval)) return false; diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index e4edc480272..af821bad868 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -77,6 +77,7 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, sd->N = Ng; sd->I = -ray->D; sd->shader = shader; + sd->ray_length = isect->t; /* smooth normal */ if(sd->shader & SHADER_SMOOTH_NORMAL) @@ -127,7 +128,7 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, const float3 P, const float3 Ng, const float3 I, - int shader, int object, int prim, float u, float v, float time) + int shader, int object, int prim, float u, float v, float t, float time) { /* vectors */ sd->P = P; @@ -145,6 +146,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, sd->u = u; sd->v = v; #endif + sd->ray_length = t; /* detect instancing, for non-instanced the object index is -object-1 */ #ifdef __INSTANCING__ @@ -242,7 +244,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd, /* watch out: no instance transform currently */ - shader_setup_from_sample(kg, sd, P, Ng, I, shader, object, prim, u, v, TIME_INVALID); + shader_setup_from_sample(kg, sd, P, Ng, I, shader, object, prim, u, v, 0.0f, TIME_INVALID); } /* ShaderData setup from ray into background */ @@ -259,6 +261,7 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData #ifdef __MOTION__ sd->time = ray->time; #endif + sd->ray_length = 0.0f; #ifdef __INSTANCING__ sd->object = ~0; diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index bf48ec8c000..85ee16fc5c6 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -401,6 +401,9 @@ typedef struct ShaderData { /* motion blur sample time */ float time; + + /* length of the ray being shaded */ + float ray_length; #ifdef __MOTION__ /* object <-> world space transformations, cached to avoid diff --git a/intern/cycles/kernel/svm/svm_light_path.h b/intern/cycles/kernel/svm/svm_light_path.h index 1b13fd93a0f..ebbcb5be61f 100644 --- a/intern/cycles/kernel/svm/svm_light_path.h +++ b/intern/cycles/kernel/svm/svm_light_path.h @@ -33,6 +33,7 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint case NODE_LP_reflection: info = (path_flag & PATH_RAY_REFLECT)? 1.0f: 0.0f; break; case NODE_LP_transmission: info = (path_flag & PATH_RAY_TRANSMIT)? 1.0f: 0.0f; break; case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break; + case NODE_LP_ray_length: info = sd->ray_length; break; } stack_store_float(stack, out_offset, info); diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index fa7c211b5f9..8037c3964a9 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -115,7 +115,8 @@ typedef enum NodeLightPath { NODE_LP_singular, NODE_LP_reflection, NODE_LP_transmission, - NODE_LP_backfacing + NODE_LP_backfacing, + NODE_LP_ray_length } NodeLightPath; typedef enum NodeTexCoord { diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 7039f5b6412..fd26c552f21 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1623,6 +1623,7 @@ LightPathNode::LightPathNode() add_output("Is Singular Ray", SHADER_SOCKET_FLOAT); add_output("Is Reflection Ray", SHADER_SOCKET_FLOAT); add_output("Is Transmission Ray", SHADER_SOCKET_FLOAT); + add_output("Ray Length", SHADER_SOCKET_FLOAT); } void LightPathNode::compile(SVMCompiler& compiler) @@ -1671,6 +1672,13 @@ void LightPathNode::compile(SVMCompiler& compiler) compiler.stack_assign(out); compiler.add_node(NODE_LIGHT_PATH, NODE_LP_transmission, out->stack_offset); } + + out = output("Ray Length"); + if(!out->links.empty()) { + compiler.stack_assign(out); + compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_length, out->stack_offset); + } + } void LightPathNode::compile(OSLCompiler& compiler) diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c index 5d7a3014682..5ebbd63a5a1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.c +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c @@ -37,6 +37,7 @@ static bNodeSocketTemplate sh_node_light_path_out[]= { { SOCK_FLOAT, 0, "Is Singular Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, "Is Reflection Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, "Is Transmission Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, "Ray Length", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; From 6f3400ca521e84b1b627f2b5a53835d73e3ed2ea Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 2 May 2012 17:33:48 +0000 Subject: [PATCH 54/55] Clip editor: cleanup of View menu - do not show operators which doesn't make sense in dopesheet/curve view --- release/scripts/startup/bl_ui/space_clip.py | 33 ++++++++++--------- source/blender/editors/include/ED_clip.h | 3 ++ .../blender/editors/space_clip/clip_editor.c | 11 +++++++ .../editors/space_clip/clip_graph_ops.c | 6 +--- source/blender/editors/space_clip/clip_ops.c | 14 ++++---- 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 0b96ec772c8..e2fa67e3873 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -776,27 +776,28 @@ class CLIP_MT_view(Menu): layout = self.layout sc = context.space_data - layout.prop(sc, "show_seconds") - layout.separator() + if sc.view == 'CLIP': + layout.operator("clip.properties", icon='MENU_PANEL') + layout.operator("clip.tools", icon='MENU_PANEL') + layout.separator() - layout.operator("clip.properties", icon='MENU_PANEL') - layout.operator("clip.tools", icon='MENU_PANEL') - layout.separator() + layout.operator("clip.view_selected") + layout.operator("clip.view_all") - layout.operator("clip.view_selected") - layout.operator("clip.view_all") + layout.separator() + layout.operator("clip.view_zoom_in") + layout.operator("clip.view_zoom_out") - layout.separator() - layout.operator("clip.view_zoom_in") - layout.operator("clip.view_zoom_out") + layout.separator() - layout.separator() + ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) - ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) - - for a, b in ratios: - text = "Zoom %d:%d" % (a, b) - layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b + for a, b in ratios: + text = "Zoom %d:%d" % (a, b) + layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b + else: + layout.prop(sc, "show_seconds") + layout.separator() layout.separator() layout.operator("screen.area_dupli") diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index db6d9bbd013..03e7bd62a2c 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -42,6 +42,9 @@ struct wmEvent; /* clip_editor.c */ int ED_space_clip_poll(struct bContext *C); + +int ED_space_clip_view_clip_poll(struct bContext *C); + int ED_space_clip_tracking_poll(struct bContext *C); int ED_space_clip_tracking_size_poll(struct bContext *C); int ED_space_clip_tracking_frame_poll(struct bContext *C); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 443cb8f7ef4..c5c5628abb9 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -73,6 +73,17 @@ int ED_space_clip_poll(bContext *C) return FALSE; } +int ED_space_clip_view_clip_poll(bContext *C) +{ + SpaceClip *sc = CTX_wm_space_clip(C); + + if (sc && sc->clip) { + return sc->view == SC_VIEW_CLIP; + } + + return FALSE; +} + int ED_space_clip_tracking_poll(bContext *C) { SpaceClip *sc= CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 03557a0b264..905aa2d11d4 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -66,11 +66,7 @@ static int ED_space_clip_graph_poll(bContext *C) if (ED_space_clip_tracking_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); - if (sc->view == SC_VIEW_GRAPH) { - ARegion *ar = CTX_wm_region(C); - - return ar->regiontype == RGN_TYPE_PREVIEW; - } + return sc->view == SC_VIEW_GRAPH; } return FALSE; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 2bfc7a1dec8..133c807a7ff 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -408,7 +408,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot) ot->invoke = view_pan_invoke; ot->modal = view_pan_modal; ot->cancel = view_pan_cancel; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* flags */ ot->flag = OPTYPE_BLOCKING; @@ -534,7 +534,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot) ot->invoke = view_zoom_invoke; ot->modal = view_zoom_modal; ot->cancel = view_zoom_cancel; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* flags */ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -580,7 +580,7 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot) /* api callbacks */ ot->exec = view_zoom_in_exec; ot->invoke = view_zoom_in_invoke; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f); @@ -620,7 +620,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot) /* api callbacks */ ot->exec = view_zoom_out_exec; ot->invoke = view_zoom_out_invoke; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); @@ -652,7 +652,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot) /* api callbacks */ ot->exec = view_zoom_ratio_exec; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX, @@ -719,7 +719,7 @@ void CLIP_OT_view_all(wmOperatorType *ot) /* api callbacks */ ot->exec = view_all_exec; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport"); @@ -749,7 +749,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot) /* api callbacks */ ot->exec = view_selected_exec; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; } /********************** change frame operator *********************/ From a1f4be4577776add4a71ac3446aceb4195234fc7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 2 May 2012 17:37:39 +0000 Subject: [PATCH 55/55] Style cleanup: spaces around operators --- source/blender/editors/space_clip/clip_ops.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 133c807a7ff..c8a5b487b65 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -287,14 +287,14 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event) vpd->y = event->y; if (sc->flag & SC_LOCK_SELECTION) - vpd->vec= &sc->xlockof; + vpd->vec = &sc->xlockof; else - vpd->vec= &sc->xof; + vpd->vec = &sc->xof; copy_v2_v2(&vpd->xof, vpd->vec); copy_v2_v2(&vpd->xorig, &vpd->xof); - vpd->event_type= event->type; + vpd->event_type = event->type; WM_event_add_modal_handler(C, op); } @@ -636,8 +636,8 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op) sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"), NULL); /* ensure pixel exact locations for draw */ - sc->xof= (int) sc->xof; - sc->yof= (int) sc->yof; + sc->xof = (int) sc->xof; + sc->yof = (int) sc->yof; ED_region_tag_redraw(CTX_wm_region(C)); @@ -687,18 +687,18 @@ static int view_all_exec(bContext *C, wmOperator *op) if (fit_view) { const int margin = 5; /* margin from border */ - zoomx= (float) width / (w + 2 * margin); - zoomy= (float) height / (h + 2 * margin); + zoomx = (float) width / (w + 2 * margin); + zoomy = (float) height / (h + 2 * margin); sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL); } else { if ((w >= width || h >= height) && (width > 0 && height > 0)) { - zoomx= (float) width / w; - zoomy= (float) height / h; + zoomx = (float) width / w; + zoomy = (float) height / h; /* find the zoom value that will fit the image in the image space */ - sclip_zoom_set(sc, ar, 1.0f/power_of_2(1/MIN2(zoomx, zoomy)), NULL); + sclip_zoom_set(sc, ar, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL); } else sclip_zoom_set(sc, ar, 1.0f, NULL); @@ -800,7 +800,7 @@ static int frame_from_event(bContext *C, wmEvent *event) UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy); - framenr= (int) floor(viewx + 0.5f); + framenr = (int) floor(viewx + 0.5f); } return framenr;