From e568ea668e80578d6f98feb7ab16a0916220a248 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Oct 2010 11:42:39 +0000 Subject: revert r32284, turns out OpenSuse needs this for forkpty(), also fixed missing import with 3ds export. --- CMakeLists.txt | 3 ++- release/scripts/op/io_scene_3ds/export_3ds.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63cade84647..f527f9d410c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,7 +297,8 @@ IF(UNIX AND NOT APPLE) FIND_PACKAGE(X11 REQUIRED) - SET(LLIBS "-lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}") + # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed + SET(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}") IF(CMAKE_SYSTEM_NAME MATCHES "Linux") # BSD's dont use libdl.so diff --git a/release/scripts/op/io_scene_3ds/export_3ds.py b/release/scripts/op/io_scene_3ds/export_3ds.py index 0cbb4347dda..943c94af55f 100644 --- a/release/scripts/op/io_scene_3ds/export_3ds.py +++ b/release/scripts/op/io_scene_3ds/export_3ds.py @@ -431,6 +431,7 @@ def make_material_texture_chunk(id, images): mat_sub = _3ds_chunk(id) def add_image(img): + import os filename = os.path.basename(image.filepath) mat_sub_file = _3ds_chunk(MATMAPFILE) mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename))) -- cgit v1.2.3 From c76d339b6cb121e3dc31dc7f032e8a0cb3ad9e90 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Oct 2010 12:02:18 +0000 Subject: fix for copy in the console (wasnt taking the prompt into account) --- .../blender/editors/space_console/console_draw.c | 32 ++++++++++++++-------- .../blender/editors/space_console/console_intern.h | 3 ++ source/blender/editors/space_console/console_ops.c | 11 ++++++-- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index d1fa4e17e6f..d5ffb34b3a2 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -286,6 +286,24 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, #undef STEP_SEL } +void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy) +{ + /* fake the edit line being in the scroll buffer */ + ConsoleLine *cl= sc->history.last; + cl_dummy->type= CONSOLE_LINE_INPUT; + cl_dummy->len= cl_dummy->len_alloc= strlen(sc->prompt) + cl->len; + cl_dummy->len_alloc= cl_dummy->len + 1; + cl_dummy->line= MEM_mallocN(cl_dummy->len_alloc, "cl_dummy"); + memcpy(cl_dummy->line, sc->prompt, (cl_dummy->len_alloc - cl->len)); + memcpy(cl_dummy->line + ((cl_dummy->len_alloc - cl->len)) - 1, cl->line, cl->len + 1); + BLI_addtail(&sc->scrollback, cl_dummy); +} +void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy) +{ + MEM_freeN(cl_dummy->line); + BLI_remlink(&sc->scrollback, cl_dummy); +} + #define CONSOLE_DRAW_MARGIN 4 #define CONSOLE_DRAW_SCROLL 16 @@ -349,15 +367,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion * xy[0]= x_orig; /* remove prompt offset */ } - /* fake the edit line being in the scroll buffer */ - cl_dummy.type= CONSOLE_LINE_INPUT; - cl_dummy.len= cl_dummy.len_alloc= prompt_len + cl->len; - cl_dummy.len_alloc= cl_dummy.len + 1; - cl_dummy.line= MEM_mallocN(cl_dummy.len_alloc, "cl_dummy"); - memcpy(cl_dummy.line, sc->prompt, (cl_dummy.len_alloc - cl->len)); - memcpy(cl_dummy.line + ((cl_dummy.len_alloc - cl->len)) - 1, cl->line, cl->len + 1); - BLI_addtail(&sc->scrollback, &cl_dummy); - + console_scrollback_prompt_begin(sc, &cl_dummy); for(cl= sc->scrollback.last; cl; cl= cl->prev) { y_prev= xy[1]; @@ -378,9 +388,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion * } } - /* temp line end */ - MEM_freeN(cl_dummy.line); - BLI_remlink(&sc->scrollback, &cl_dummy); + console_scrollback_prompt_end(sc, &cl_dummy); } else { Report *report; diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index c74d39f25e3..0e2c35bcf83 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -41,6 +41,9 @@ int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, struct Repo void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports, int mouse_y); /* needed for selection */ int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int mval[2]); +void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy); +void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy); + /* console_ops.c */ void console_history_free(SpaceConsole *sc, ConsoleLine *cl); void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index a49581cb417..8ececa22163 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -705,6 +705,8 @@ static int copy_exec(bContext *C, wmOperator *op) int sel[2]; int offset= 0; + ConsoleLine cl_dummy= {0}; + #if 0 /* copy whole file */ for(cl= sc->scrollback.first; cl; cl= cl->next) { @@ -716,14 +718,16 @@ static int copy_exec(bContext *C, wmOperator *op) if(sc->sel_start == sc->sel_end) return OPERATOR_CANCELLED; + console_scrollback_prompt_begin(sc, &cl_dummy); for(cl= sc->scrollback.first; cl; cl= cl->next) { offset += cl->len + 1; } - if(offset==0) + if(offset==0) { + console_scrollback_prompt_end(sc, &cl_dummy); return OPERATOR_CANCELLED; - + } offset -= 1; sel[0]= offset - sc->sel_end; @@ -750,6 +754,9 @@ static int copy_exec(bContext *C, wmOperator *op) WM_clipboard_text_set(buf_str, 0); MEM_freeN(buf_str); + + console_scrollback_prompt_end(sc, &cl_dummy); + return OPERATOR_FINISHED; } -- cgit v1.2.3 From e88b8dac7b7bba016fca80d4d2e83850ed924968 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Oct 2010 15:31:04 +0000 Subject: [#22825] Copy Scenes with Audio Strip Crash. --- source/blender/blenkernel/BKE_sequencer.h | 4 ++-- source/blender/blenkernel/intern/scene.c | 7 ++++--- source/blender/blenkernel/intern/sequencer.c | 19 ++++++++++--------- .../blender/editors/space_sequencer/sequencer_edit.c | 10 +++++----- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 0766012b4a5..252c9fee8f7 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -220,14 +220,14 @@ int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene); int seqbase_isolated_sel_check(struct ListBase *seqbase); void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles); -struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Sequence * seq, int dupe_flag); +struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag); int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b); void seq_update_sound(struct Scene* scene, struct Sequence *seq); void seq_update_muting(struct Scene* scene, struct Editing *ed); void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase); void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq); -void seqbase_dupli_recursive(struct Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag); +void seqbase_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag); void clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 8793c412d7d..3f41b704f97 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -210,6 +210,9 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type) if(type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) { ID_NEW(scen->camera); } + + /* before scene copy */ + sound_create_scene(scen); /* world */ if(type == SCE_COPY_FULL) { @@ -221,12 +224,10 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type) if(sce->ed) { scen->ed= MEM_callocN( sizeof(Editing), "addseq"); scen->ed->seqbasep= &scen->ed->seqbase; - seqbase_dupli_recursive(sce, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL); + seqbase_dupli_recursive(sce, scen, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL); } } - sound_create_scene(scen); - return scen; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b6bb5c3a51b..430d6f87619 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3531,8 +3531,9 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo } -static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag) +static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag) { + Scene *sce_audio= scene_to ? scene_to : scene; Sequence *seqn = MEM_dupallocN(seq); seq->tmp = seqn; @@ -3566,7 +3567,7 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag) } else if(seq->type == SEQ_SCENE) { seqn->strip->stripdata = 0; if(seq->scene_sound) - seqn->scene_sound = sound_scene_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); + seqn->scene_sound = sound_scene_add_scene_sound(sce_audio, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); } else if(seq->type == SEQ_MOVIE) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); @@ -3575,7 +3576,7 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag) seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); if(seq->scene_sound) - seqn->scene_sound = sound_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); + seqn->scene_sound = sound_add_scene_sound(sce_audio, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); seqn->sound->id.us++; } else if(seq->type == SEQ_IMAGE) { @@ -3610,13 +3611,13 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag) return seqn; } -Sequence * seq_dupli_recursive(struct Scene *scene, Sequence * seq, int dupe_flag) +Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence * seq, int dupe_flag) { - Sequence * seqn = seq_dupli(scene, seq, dupe_flag); + Sequence * seqn = seq_dupli(scene, scene_to, seq, dupe_flag); if (seq->type == SEQ_META) { Sequence *s; for(s= seq->seqbase.first; s; s = s->next) { - Sequence *n = seq_dupli_recursive(scene, s, dupe_flag); + Sequence *n = seq_dupli_recursive(scene, scene_to, s, dupe_flag); if (n) { BLI_addtail(&seqn->seqbase, n); } @@ -3625,7 +3626,7 @@ Sequence * seq_dupli_recursive(struct Scene *scene, Sequence * seq, int dupe_fla return seqn; } -void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag) +void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag) { Sequence *seq; Sequence *seqn = 0; @@ -3634,7 +3635,7 @@ void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase for(seq= seqbase->first; seq; seq= seq->next) { seq->tmp= NULL; if((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) { - seqn = seq_dupli(scene, seq, dupe_flag); + seqn = seq_dupli(scene, scene_to, seq, dupe_flag); if (seqn) { /*should never fail */ if(dupe_flag & SEQ_DUPE_CONTEXT) { seq->flag &= ~SEQ_ALLSEL; @@ -3643,7 +3644,7 @@ void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase BLI_addtail(nseqbase, seqn); if(seq->type==SEQ_META) - seqbase_dupli_recursive(scene, &seqn->seqbase, &seq->seqbase, dupe_flag); + seqbase_dupli_recursive(scene, scene_to, &seqn->seqbase, &seq->seqbase, dupe_flag); if(dupe_flag & SEQ_DUPE_CONTEXT) { if (seq == last_seq) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index d1654dc5d37..84ced036f75 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -788,7 +788,7 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); + seqn = seq_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -879,7 +879,7 @@ static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cut if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); + seqn = seq_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -1619,7 +1619,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) if(ed==NULL) return OPERATOR_CANCELLED; - seqbase_dupli_recursive(scene, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT); + seqbase_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT); if(nseqbase.first) { Sequence * seq= nseqbase.first; @@ -2595,7 +2595,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - seqbase_dupli_recursive(scene, &seqbase_clipboard, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME); + seqbase_dupli_recursive(scene, NULL, &seqbase_clipboard, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME); seqbase_clipboard_frame= scene->r.cfra; /* Need to remove anything that references the current scene */ @@ -2649,7 +2649,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op) deselect_all_seq(scene); ofs = scene->r.cfra - seqbase_clipboard_frame; - seqbase_dupli_recursive(scene, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME); + seqbase_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME); /* transform pasted strips before adding */ if(ofs) { -- cgit v1.2.3 From f994c6caee126f00f97e7da9fde79bdefadd27ec Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Oct 2010 19:01:25 +0000 Subject: bugfix [#24133] r32303, Mirror Modifier + EditMode + VBO's Problem. drawing the triangle arrays were only broken up by hidden faces, but switches in material were ignored. now check for materual context changes. --- source/blender/blenkernel/intern/cdderivedmesh.c | 67 +++++++++++++++--------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index ca81e216006..e2ecf21bd62 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -872,34 +872,51 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us if( !GPU_buffer_legacy(dm) ) { int tottri = dm->drawObject->nelements/3; glShadeModel(GL_SMOOTH); - - for( i = 0; i < tottri; i++ ) { - int actualFace = dm->drawObject->faceRemap[i]; - int drawSmooth = (mf[actualFace].flag & ME_SMOOTH); - int draw = 1; - - if(index) { - orig = index[actualFace]; - if(setDrawOptions && orig == ORIGINDEX_NONE) + + if(tottri == 0) { + /* avoid buffer problems in following code */ + } + if(setDrawOptions == NULL) { + /* just draw the entire face array */ + glDrawArrays(GL_TRIANGLES, 0, (tottri-1) * 3); + } + else { + /* we need to check if the next material changes */ + int next_actualFace= dm->drawObject->faceRemap[0]; + + for( i = 0; i < tottri; i++ ) { + //int actualFace = dm->drawObject->faceRemap[i]; + int actualFace = next_actualFace; + int drawSmooth = (mf[actualFace].flag & ME_SMOOTH); + int draw = 1; + + if(i != tottri-1) + next_actualFace= dm->drawObject->faceRemap[i+1]; + + if(index) { + orig = index[actualFace]; + if(orig == ORIGINDEX_NONE) + draw = 0; + } + else + orig = actualFace; + + if(draw && !setDrawOptions(userData, orig, &drawSmooth)) draw = 0; - } - else - orig = actualFace; - - if(draw && setDrawOptions && !setDrawOptions(userData, orig, &drawSmooth)) - draw = 0; - - /* Goal is to draw as long of a contiguous triangle - array as possible, so draw when we hit either an - invisible triangle or at the end of the array */ - if(!draw || i == tottri - 1) { - if(prevstart != i) - /* Add one to the length (via `draw') - if we're drawing at the end of the array */ - glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3); - prevstart = i + 1; + + /* Goal is to draw as long of a contiguous triangle + array as possible, so draw when we hit either an + invisible triangle or at the end of the array */ + if(!draw || i == tottri - 1 || mf[actualFace].mat_nr != mf[next_actualFace].mat_nr) { + if(prevstart != i) + /* Add one to the length (via `draw') + if we're drawing at the end of the array */ + glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3); + prevstart = i + 1; + } } } + glShadeModel(GL_FLAT); } GPU_buffer_unbind(); -- cgit v1.2.3 From 63b4c93e449902da3bb9a17d4f8b9f8ef7d00ae5 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 4 Oct 2010 23:52:53 +0000 Subject: Update stubs for recent changes (BKE_utildefines.h and header printing). --- source/blenderplayer/bad_level_call_stubs/CMakeLists.txt | 1 + source/blenderplayer/bad_level_call_stubs/stubs.c | 1 + 2 files changed, 2 insertions(+) diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index dbcf4d96942..50be3c91dbe 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -37,6 +37,7 @@ SET(INC ../../../intern/guardedalloc ../../../source/blender/makesdna ../../../source/blender/makesrna + ../../../source/blender/blenkernel ) IF(WITH_GAMEENGINE) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index b341f798478..f563cacf8a8 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -162,6 +162,7 @@ void ED_node_composit_default(struct Scene *sce){} void *ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *custumdata, int type){return 0;} /* XXX this one looks weird */ void *ED_region_draw_cb_customdata(void *handle){return 0;} /* XXX This one looks wrong also */ void ED_region_draw_cb_exit(struct ARegionType *art, void *handle){} +void ED_area_headerprint(struct ScrArea *sa, char *str){} struct EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, struct EditBone *ebo){return (struct EditBone *) NULL;} struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name){return (struct EditBone*) NULL;} -- cgit v1.2.3 From 82209cdc86f5f248102df89b3dfeca86149768f7 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 5 Oct 2010 00:05:14 +0000 Subject: Reorganisation of COLLADA import code. Classes have been split into their own files. No functional changes. Where necessary extern "C" {} blocks have been added. --- source/blender/blenkernel/BKE_context.h | 6 +- source/blender/blenkernel/BKE_depsgraph.h | 8 + source/blender/blenkernel/BKE_fcurve.h | 8 + source/blender/blenkernel/BKE_library.h | 8 + source/blender/blenkernel/BKE_main.h | 8 + source/blender/blenkernel/BKE_scene.h | 8 + source/blender/blenkernel/BKE_texture.h | 8 + source/blender/collada/AnimationImporter.cpp | 1149 +++++++++ source/blender/collada/AnimationImporter.h | 132 + source/blender/collada/ArmatureImporter.cpp | 585 +++++ source/blender/collada/ArmatureImporter.h | 160 ++ source/blender/collada/DocumentExporter.cpp | 30 +- source/blender/collada/DocumentExporter.h | 6 + source/blender/collada/DocumentImporter.cpp | 3181 +----------------------- source/blender/collada/DocumentImporter.h | 5 + source/blender/collada/MeshImporter.cpp | 907 +++++++ source/blender/collada/MeshImporter.h | 150 ++ source/blender/collada/SkinInfo.cpp | 320 +++ source/blender/collada/SkinInfo.h | 133 + source/blender/collada/TransformReader.cpp | 125 + source/blender/collada/TransformReader.h | 70 + source/blender/collada/collada.cpp | 6 +- source/blender/collada/collada_internal.h | 11 +- source/blender/collada/collada_utils.cpp | 106 + source/blender/collada/collada_utils.h | 50 + source/blender/editors/include/ED_armature.h | 8 + source/blender/editors/include/ED_keyframing.h | 8 + source/blender/editors/include/ED_mesh.h | 8 + source/blender/editors/include/ED_object.h | 8 + source/blender/makesdna/DNA_customdata_types.h | 8 + source/blender/makesdna/DNA_texture_types.h | 8 + source/blender/makesdna/DNA_userdef_types.h | 8 + source/blender/makesrna/intern/rna_screen.c | 4 +- source/blender/windowmanager/WM_api.h | 8 + source/blender/windowmanager/WM_types.h | 8 + 35 files changed, 4058 insertions(+), 3198 deletions(-) create mode 100644 source/blender/collada/AnimationImporter.cpp create mode 100644 source/blender/collada/AnimationImporter.h create mode 100644 source/blender/collada/ArmatureImporter.cpp create mode 100644 source/blender/collada/ArmatureImporter.h create mode 100644 source/blender/collada/MeshImporter.cpp create mode 100644 source/blender/collada/MeshImporter.h create mode 100644 source/blender/collada/SkinInfo.cpp create mode 100644 source/blender/collada/SkinInfo.h create mode 100644 source/blender/collada/TransformReader.cpp create mode 100644 source/blender/collada/TransformReader.h create mode 100644 source/blender/collada/collada_utils.cpp create mode 100644 source/blender/collada/collada_utils.h diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 9f38c5833a2..7cbaf6bdad2 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -28,13 +28,13 @@ #ifndef BKE_CONTEXT_H #define BKE_CONTEXT_H +#include "DNA_listBase.h" +#include "RNA_types.h" + #ifdef __cplusplus extern "C" { #endif -#include "DNA_listBase.h" -#include "RNA_types.h" - struct ARegion; struct bScreen; struct EditMesh; diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 0b78a1206fe..5b2dca5299c 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -28,6 +28,10 @@ #ifndef DEPSGRAPH_API #define DEPSGRAPH_API +#ifdef __cplusplus +extern "C" { +#endif + /* #define DEPS_DEBUG */ @@ -120,5 +124,9 @@ void DAG_pose_sort(struct Object *ob); /* callback for editors module to do updates */ void DAG_editors_update_cb(void (*func)(struct Main *bmain, struct ID *id)); + +#ifdef __cplusplus +} +#endif #endif diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 95e0cfc3a91..8dbfb4f2c73 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -28,6 +28,10 @@ #ifndef BKE_FCURVE_H #define BKE_FCURVE_H +#ifdef __cplusplus +extern "C" { +#endif + struct FCurve; struct FModifier; struct ChannelDriver; @@ -248,4 +252,8 @@ float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime */ void fcurve_store_samples(struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb); +#ifdef __cplusplus +} +#endif + #endif /* BKE_FCURVE_H*/ diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index e25c379ded1..b74de66f7b6 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -33,6 +33,10 @@ #ifndef BKE_LIBRARY_TYPES_H #define BKE_LIBRARY_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + struct ListBase; struct ID; struct Main; @@ -85,4 +89,8 @@ void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowMa /* use when "" is given to new_id() */ #define ID_FALLBACK_NAME "Untitled" +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 60c2d51571f..1a53f488841 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -40,6 +40,10 @@ #include "DNA_listBase.h" +#ifdef __cplusplus +extern "C" { +#endif + struct Library; typedef struct Main { @@ -80,5 +84,9 @@ typedef struct Main { } Main; +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 96ef8d44cf4..8d5ebb64cf0 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -31,6 +31,10 @@ #ifndef BKE_SCENE_H #define BKE_SCENE_H +#ifdef __cplusplus +extern "C" { +#endif + struct AviCodecData; struct Base; struct bglMats; @@ -93,5 +97,9 @@ int get_render_child_particle_number(struct RenderData *r, int num); int get_render_shadow_samples(struct RenderData *r, int samples); float get_render_aosss_error(struct RenderData *r, float error); +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 99bb8db44ed..cbae90f4c38 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -31,6 +31,10 @@ #ifndef BKE_TEXTURE_H #define BKE_TEXTURE_H +#ifdef __cplusplus +extern "C" { +#endif + struct bNode; struct Brush; struct ColorBand; @@ -112,5 +116,9 @@ struct VoxelData *BKE_copy_voxeldata(struct VoxelData *vd); int BKE_texture_dependsOnTime(const struct Tex *texture); +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp new file mode 100644 index 00000000000..92e863db023 --- /dev/null +++ b/source/blender/collada/AnimationImporter.cpp @@ -0,0 +1,1149 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "DNA_armature_types.h" + +#include "ED_keyframing.h" + +#include "BLI_listbase.h" +#include "BLI_math.h" +#include "BLI_path_util.h" +#include "BLI_string.h" + +#include "BKE_action.h" +#include "BKE_armature.h" +#include "BKE_fcurve.h" +#include "BKE_object.h" + +#include "MEM_guardedalloc.h" + +#include "collada_utils.h" +#include "AnimationImporter.h" +#include "ArmatureImporter.h" + +#include + +// use this for retrieving bone names, since these must be unique +template +static const char *bc_get_joint_name(T *node) +{ + const std::string& id = node->getOriginalId(); + return id.size() ? id.c_str() : node->getName().c_str(); +} + +FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path) +{ + FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); + + fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); + fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path)); + fcu->array_index = array_index; + return fcu; +} + +void AnimationImporter::create_bezt(FCurve *fcu, float frame, float output) +{ + BezTriple bez; + memset(&bez, 0, sizeof(BezTriple)); + bez.vec[1][0] = frame; + bez.vec[1][1] = output; + bez.ipo = U.ipo_new; /* use default interpolation mode here... */ + bez.f1 = bez.f2 = bez.f3 = SELECT; + bez.h1 = bez.h2 = HD_AUTO; + insert_bezt_fcurve(fcu, &bez, 0); + calchandles_fcurve(fcu); +} + +// create one or several fcurves depending on the number of parameters being animated +void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) +{ + COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues(); + COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues(); + // COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); + // COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); + float fps = (float)FPS; + size_t dim = curve->getOutDimension(); + unsigned int i; + + std::vector& fcurves = curve_map[curve->getUniqueId()]; + + switch (dim) { + case 1: // X, Y, Z or angle + case 3: // XYZ + case 16: // matrix + { + for (i = 0; i < dim; i++ ) { + FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); + + fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); + // fcu->rna_path = BLI_strdupn(path, strlen(path)); + fcu->array_index = 0; + //fcu->totvert = curve->getKeyCount(); + + // create beztriple for each key + for (unsigned int j = 0; j < curve->getKeyCount(); j++) { + BezTriple bez; + memset(&bez, 0, sizeof(BezTriple)); + + // intangent + // bez.vec[0][0] = get_float_value(intan, j * 6 + i + i) * fps; + // bez.vec[0][1] = get_float_value(intan, j * 6 + i + i + 1); + + // input, output + bez.vec[1][0] = bc_get_float_value(input, j) * fps; + bez.vec[1][1] = bc_get_float_value(output, j * dim + i); + + // outtangent + // bez.vec[2][0] = get_float_value(outtan, j * 6 + i + i) * fps; + // bez.vec[2][1] = get_float_value(outtan, j * 6 + i + i + 1); + + bez.ipo = U.ipo_new; /* use default interpolation mode here... */ + bez.f1 = bez.f2 = bez.f3 = SELECT; + bez.h1 = bez.h2 = HD_AUTO; + insert_bezt_fcurve(fcu, &bez, 0); + } + + calchandles_fcurve(fcu); + + fcurves.push_back(fcu); + } + } + break; + default: + fprintf(stderr, "Output dimension of %d is not yet supported (animation id = %s)\n", dim, curve->getOriginalId().c_str()); + } + + for (std::vector::iterator it = fcurves.begin(); it != fcurves.end(); it++) + unused_curves.push_back(*it); +} + +void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) +{ + for (unsigned int i = 0; i < cu->totvert; i++) { + // TODO convert handles too + cu->bezt[i].vec[1][1] *= M_PI / 180.0f; + } +} + +void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated) +{ + bAction *act; + + if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1); + else act = ob->adt->action; + + std::vector::iterator it; + int i; + +#if 0 + char *p = strstr(rna_path, "rotation_euler"); + bool is_rotation = p && *(p + strlen("rotation_euler")) == '\0'; + + // convert degrees to radians for rotation + if (is_rotation) + fcurve_deg_to_rad(fcu); +#endif + + for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) { + FCurve *fcu = *it; + fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path)); + + if (array_index == -1) fcu->array_index = i; + else fcu->array_index = array_index; + + if (ob->type == OB_ARMATURE) { + bActionGroup *grp = NULL; + const char *bone_name = bc_get_joint_name(animated->node); + + if (bone_name) { + /* try to find group */ + grp = action_groups_find_named(act, bone_name); + + /* no matching groups, so add one */ + if (grp == NULL) { + /* Add a new group, and make it active */ + grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); + + grp->flag = AGRP_SELECTED; + BLI_strncpy(grp->name, bone_name, sizeof(grp->name)); + + BLI_addtail(&act->groups, grp); + BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64); + } + + /* add F-Curve to group */ + action_groups_add_channel(act, grp, fcu); + + } +#if 0 + if (is_rotation) { + fcurves_actionGroup_map[grp].push_back(fcu); + } +#endif + } + else { + BLI_addtail(&act->curves, fcu); + } + + // curve is used, so remove it from unused_curves + unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end()); + } +} + +AnimationImporter::AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) : + TransformReader(conv), armature_importer(arm), scene(scene) { } + +AnimationImporter::~AnimationImporter() +{ + // free unused FCurves + for (std::vector::iterator it = unused_curves.begin(); it != unused_curves.end(); it++) + free_fcurve(*it); + + if (unused_curves.size()) + fprintf(stderr, "removed %u unused curves\n", unused_curves.size()); +} + +bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim) +{ + if (anim->getAnimationType() == COLLADAFW::Animation::ANIMATION_CURVE) { + COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve*)anim; + + // XXX Don't know if it's necessary + // Should we check outPhysicalDimension? + if (curve->getInPhysicalDimension() != COLLADAFW::PHYSICAL_DIMENSION_TIME) { + fprintf(stderr, "Inputs physical dimension is not time. \n"); + return true; + } + + // a curve can have mixed interpolation type, + // in this case curve->getInterpolationTypes returns a list of interpolation types per key + COLLADAFW::AnimationCurve::InterpolationType interp = curve->getInterpolationType(); + + if (interp != COLLADAFW::AnimationCurve::INTERPOLATION_MIXED) { + switch (interp) { + case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR: + case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER: + animation_to_fcurves(curve); + break; + default: + // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types + fprintf(stderr, "CARDINAL, HERMITE, BSPLINE and STEP anim interpolation types not supported yet.\n"); + break; + } + } + else { + // not supported yet + fprintf(stderr, "MIXED anim interpolation type is not supported yet.\n"); + } + } + else { + fprintf(stderr, "FORMULA animation type is not supported yet.\n"); + } + + return true; +} + +// called on post-process stage after writeVisualScenes +bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* animlist) +{ + const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId(); + + animlist_map[animlist_id] = animlist; + +#if 0 + // should not happen + if (uid_animated_map.find(animlist_id) == uid_animated_map.end()) { + return true; + } + + // for bones rna_path is like: pose.bones["bone-name"].rotation + + // what does this AnimationList animate? + Animation& animated = uid_animated_map[animlist_id]; + Object *ob = animated.ob; + + char rna_path[100]; + char joint_path[100]; + bool is_joint = false; + + // if ob is NULL, it should be a JOINT + if (!ob) { + ob = armature_importer->get_armature_for_joint(animated.node); + + if (!ob) { + fprintf(stderr, "Cannot find armature for node %s\n", get_joint_name(animated.node)); + return true; + } + + armature_importer->get_rna_path_for_joint(animated.node, joint_path, sizeof(joint_path)); + + is_joint = true; + } + + const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); + + switch (animated.tm->getTransformationType()) { + case COLLADAFW::Transformation::TRANSLATE: + case COLLADAFW::Transformation::SCALE: + { + bool loc = animated.tm->getTransformationType() == COLLADAFW::Transformation::TRANSLATE; + if (is_joint) + BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale"); + else + BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path)); + + for (int i = 0; i < bindings.getCount(); i++) { + const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i]; + COLLADAFW::UniqueId anim_uid = binding.animation; + + if (curve_map.find(anim_uid) == curve_map.end()) { + fprintf(stderr, "Cannot find FCurve by animation UID.\n"); + continue; + } + + std::vector& fcurves = curve_map[anim_uid]; + + switch (binding.animationClass) { + case COLLADAFW::AnimationList::POSITION_X: + add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated); + break; + case COLLADAFW::AnimationList::POSITION_Y: + add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated); + break; + case COLLADAFW::AnimationList::POSITION_Z: + add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated); + break; + case COLLADAFW::AnimationList::POSITION_XYZ: + add_fcurves_to_object(ob, fcurves, rna_path, -1, &animated); + break; + default: + fprintf(stderr, "AnimationClass %d is not supported for %s.\n", + binding.animationClass, loc ? "TRANSLATE" : "SCALE"); + } + } + } + break; + case COLLADAFW::Transformation::ROTATE: + { + if (is_joint) + BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path); + else + BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path)); + + COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)animated.tm; + COLLADABU::Math::Vector3& axis = rot->getRotationAxis(); + + for (int i = 0; i < bindings.getCount(); i++) { + const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i]; + COLLADAFW::UniqueId anim_uid = binding.animation; + + if (curve_map.find(anim_uid) == curve_map.end()) { + fprintf(stderr, "Cannot find FCurve by animation UID.\n"); + continue; + } + + std::vector& fcurves = curve_map[anim_uid]; + + switch (binding.animationClass) { + case COLLADAFW::AnimationList::ANGLE: + if (COLLADABU::Math::Vector3::UNIT_X == axis) { + add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated); + } + else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { + add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated); + } + else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { + add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated); + } + break; + case COLLADAFW::AnimationList::AXISANGLE: + // TODO convert axis-angle to quat? or XYZ? + default: + fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n", + binding.animationClass); + } + } + } + break; + case COLLADAFW::Transformation::MATRIX: + case COLLADAFW::Transformation::SKEW: + case COLLADAFW::Transformation::LOOKAT: + fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n"); + break; + } +#endif + + return true; +} + +void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob) +{ + float mat[4][4]; + TransformReader::get_node_mat(mat, node, &uid_animated_map, ob); + if (ob) { + copy_m4_m4(ob->obmat, mat); + object_apply_mat4(ob, ob->obmat); + } +} + +#if 0 +virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) +{ + bActionGroup *grp; + int i; + + for (grp = (bActionGroup*)act->groups.first; grp; grp = grp->next) { + + FCurve *eulcu[3] = {NULL, NULL, NULL}; + + if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end()) + continue; + + std::vector &rot_fcurves = fcurves_actionGroup_map[grp]; + + if (rot_fcurves.size() > 3) continue; + + for (i = 0; i < rot_fcurves.size(); i++) + eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i]; + + char joint_path[100]; + char rna_path[100]; + + BLI_snprintf(joint_path, sizeof(joint_path), "pose.bones[\"%s\"]", grp->name); + BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_quaternion", joint_path); + + FCurve *quatcu[4] = { + create_fcurve(0, rna_path), + create_fcurve(1, rna_path), + create_fcurve(2, rna_path), + create_fcurve(3, rna_path) + }; + + bPoseChannel *chan = get_pose_channel(ob->pose, grp->name); + + float m4[4][4], irest[3][3]; + invert_m4_m4(m4, chan->bone->arm_mat); + copy_m3_m4(irest, m4); + + for (i = 0; i < 3; i++) { + + FCurve *cu = eulcu[i]; + + if (!cu) continue; + + for (int j = 0; j < cu->totvert; j++) { + float frame = cu->bezt[j].vec[1][0]; + + float eul[3] = { + eulcu[0] ? evaluate_fcurve(eulcu[0], frame) : 0.0f, + eulcu[1] ? evaluate_fcurve(eulcu[1], frame) : 0.0f, + eulcu[2] ? evaluate_fcurve(eulcu[2], frame) : 0.0f + }; + + // make eul relative to bone rest pose + float rot[3][3], rel[3][3], quat[4]; + + /*eul_to_mat3(rot, eul); + + mul_m3_m3m3(rel, irest, rot); + + mat3_to_quat(quat, rel); + */ + + eul_to_quat(quat, eul); + + for (int k = 0; k < 4; k++) + create_bezt(quatcu[k], frame, quat[k]); + } + } + + // now replace old Euler curves + + for (i = 0; i < 3; i++) { + if (!eulcu[i]) continue; + + action_groups_remove_channel(act, eulcu[i]); + free_fcurve(eulcu[i]); + } + + chan->rotmode = ROT_MODE_QUAT; + + for (i = 0; i < 4; i++) + action_groups_add_channel(act, grp, quatcu[i]); + } + + bPoseChannel *pchan; + for (pchan = (bPoseChannel*)ob->pose->chanbase.first; pchan; pchan = pchan->next) { + pchan->rotmode = ROT_MODE_QUAT; + } +} +#endif + +// prerequisites: +// animlist_map - map animlist id -> animlist +// curve_map - map anim id -> curve(s) +Object *AnimationImporter::translate_animation(COLLADAFW::Node *node, + std::map& object_map, + std::map& root_map, + COLLADAFW::Transformation::TransformationType tm_type, + Object *par_job) +{ + bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE; + bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX; + bool is_joint = node->getType() == COLLADAFW::Node::JOINT; + + COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()]; + Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()]; + const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; + + if (!ob) { + fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str()); + return NULL; + } + + // frames at which to sample + std::vector frames; + + // for each , , etc. there is a separate Transformation + const COLLADAFW::TransformationPointerArray& tms = node->getTransformations(); + + unsigned int i; + + // find frames at which to sample plus convert all rotation keys to radians + for (i = 0; i < tms.getCount(); i++) { + COLLADAFW::Transformation *tm = tms[i]; + COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); + + if (type == tm_type) { + const COLLADAFW::UniqueId& listid = tm->getAnimationList(); + + if (animlist_map.find(listid) != animlist_map.end()) { + const COLLADAFW::AnimationList *animlist = animlist_map[listid]; + const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); + + if (bindings.getCount()) { + for (unsigned int j = 0; j < bindings.getCount(); j++) { + std::vector& curves = curve_map[bindings[j].animation]; + bool xyz = ((type == COLLADAFW::Transformation::TRANSLATE || type == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ); + + if ((!xyz && curves.size() == 1) || (xyz && curves.size() == 3) || is_matrix) { + std::vector::iterator iter; + + for (iter = curves.begin(); iter != curves.end(); iter++) { + FCurve *fcu = *iter; + + if (is_rotation) + fcurve_deg_to_rad(fcu); + + for (unsigned int k = 0; k < fcu->totvert; k++) { + float fra = fcu->bezt[k].vec[1][0]; + if (std::find(frames.begin(), frames.end(), fra) == frames.end()) + frames.push_back(fra); + } + } + } + else { + fprintf(stderr, "expected %d curves, got %u\n", xyz ? 3 : 1, curves.size()); + } + } + } + } + } + } + + float irest_dae[4][4]; + float rest[4][4], irest[4][4]; + + if (is_joint) { + get_joint_rest_mat(irest_dae, root, node); + invert_m4(irest_dae); + + Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); + if (!bone) { + fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); + return NULL; + } + + unit_m4(rest); + copy_m4_m4(rest, bone->arm_mat); + invert_m4_m4(irest, rest); + } + + Object *job = NULL; + +#ifdef ARMATURE_TEST + FCurve *job_curves[10]; + job = get_joint_object(root, node, par_job); +#endif + + if (frames.size() == 0) + return job; + + std::sort(frames.begin(), frames.end()); + + const char *tm_str = NULL; + switch (tm_type) { + case COLLADAFW::Transformation::ROTATE: + tm_str = "rotation_quaternion"; + break; + case COLLADAFW::Transformation::SCALE: + tm_str = "scale"; + break; + case COLLADAFW::Transformation::TRANSLATE: + tm_str = "location"; + break; + case COLLADAFW::Transformation::MATRIX: + break; + default: + return job; + } + + char rna_path[200]; + char joint_path[200]; + + if (is_joint) + armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); + + // new curves + FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale + unsigned int totcu = is_matrix ? 10 : (is_rotation ? 4 : 3); + + for (i = 0; i < totcu; i++) { + + int axis = i; + + if (is_matrix) { + if (i < 4) { + tm_str = "rotation_quaternion"; + axis = i; + } + else if (i < 7) { + tm_str = "location"; + axis = i - 4; + } + else { + tm_str = "scale"; + axis = i - 7; + } + } + + if (is_joint) + BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); + else + strcpy(rna_path, tm_str); + + newcu[i] = create_fcurve(axis, rna_path); + +#ifdef ARMATURE_TEST + if (is_joint) + job_curves[i] = create_fcurve(axis, tm_str); +#endif + } + + std::vector::iterator it; + + // sample values at each frame + for (it = frames.begin(); it != frames.end(); it++) { + float fra = *it; + + float mat[4][4]; + float matfra[4][4]; + + unit_m4(matfra); + + // calc object-space mat + evaluate_transform_at_frame(matfra, node, fra); + + // for joints, we need a special matrix + if (is_joint) { + // special matrix: iR * M * iR_dae * R + // where R, iR are bone rest and inverse rest mats in world space (Blender bones), + // iR_dae is joint inverse rest matrix (DAE) and M is an evaluated joint world-space matrix (DAE) + float temp[4][4], par[4][4]; + + // calc M + calc_joint_parent_mat_rest(par, NULL, root, node); + mul_m4_m4m4(temp, matfra, par); + + // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra); + + // calc special matrix + mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL); + } + else { + copy_m4_m4(mat, matfra); + } + + float val[4], rot[4], loc[3], scale[3]; + + switch (tm_type) { + case COLLADAFW::Transformation::ROTATE: + mat4_to_quat(val, mat); + break; + case COLLADAFW::Transformation::SCALE: + mat4_to_size(val, mat); + break; + case COLLADAFW::Transformation::TRANSLATE: + copy_v3_v3(val, mat[3]); + break; + case COLLADAFW::Transformation::MATRIX: + mat4_to_quat(rot, mat); + copy_v3_v3(loc, mat[3]); + mat4_to_size(scale, mat); + break; + default: + break; + } + + // add keys + for (i = 0; i < totcu; i++) { + if (is_matrix) { + if (i < 4) + add_bezt(newcu[i], fra, rot[i]); + else if (i < 7) + add_bezt(newcu[i], fra, loc[i - 4]); + else + add_bezt(newcu[i], fra, scale[i - 7]); + } + else { + add_bezt(newcu[i], fra, val[i]); + } + } + +#ifdef ARMATURE_TEST + if (is_joint) { + switch (tm_type) { + case COLLADAFW::Transformation::ROTATE: + mat4_to_quat(val, matfra); + break; + case COLLADAFW::Transformation::SCALE: + mat4_to_size(val, matfra); + break; + case COLLADAFW::Transformation::TRANSLATE: + copy_v3_v3(val, matfra[3]); + break; + case MATRIX: + mat4_to_quat(rot, matfra); + copy_v3_v3(loc, matfra[3]); + mat4_to_size(scale, matfra); + break; + default: + break; + } + + for (i = 0; i < totcu; i++) { + if (is_matrix) { + if (i < 4) + add_bezt(job_curves[i], fra, rot[i]); + else if (i < 7) + add_bezt(job_curves[i], fra, loc[i - 4]); + else + add_bezt(job_curves[i], fra, scale[i - 7]); + } + else { + add_bezt(job_curves[i], fra, val[i]); + } + } + } +#endif + } + + verify_adt_action((ID*)&ob->id, 1); + + ListBase *curves = &ob->adt->action->curves; + + // add curves + for (i = 0; i < totcu; i++) { + if (is_joint) + add_bone_fcurve(ob, node, newcu[i]); + else + BLI_addtail(curves, newcu[i]); + +#ifdef ARMATURE_TEST + if (is_joint) + BLI_addtail(&job->adt->action->curves, job_curves[i]); +#endif + } + + if (is_rotation || is_matrix) { + if (is_joint) { + bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + chan->rotmode = ROT_MODE_QUAT; + } + else { + ob->rotmode = ROT_MODE_QUAT; + } + } + + return job; +} + +// internal, better make it private +// warning: evaluates only rotation +// prerequisites: animlist_map, curve_map +void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra) +{ + const COLLADAFW::TransformationPointerArray& tms = node->getTransformations(); + + unit_m4(mat); + + for (unsigned int i = 0; i < tms.getCount(); i++) { + COLLADAFW::Transformation *tm = tms[i]; + COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); + float m[4][4]; + + unit_m4(m); + + if (!evaluate_animation(tm, m, fra, node->getOriginalId().c_str())) { + switch (type) { + case COLLADAFW::Transformation::ROTATE: + dae_rotate_to_mat4(tm, m); + break; + case COLLADAFW::Transformation::TRANSLATE: + dae_translate_to_mat4(tm, m); + break; + case COLLADAFW::Transformation::SCALE: + dae_scale_to_mat4(tm, m); + break; + case COLLADAFW::Transformation::MATRIX: + dae_matrix_to_mat4(tm, m); + break; + default: + fprintf(stderr, "unsupported transformation type %d\n", type); + } + } + + float temp[4][4]; + copy_m4_m4(temp, mat); + + mul_m4_m4m4(mat, m, temp); + } +} + +// return true to indicate that mat contains a sane value +bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id) +{ + const COLLADAFW::UniqueId& listid = tm->getAnimationList(); + COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); + + if (type != COLLADAFW::Transformation::ROTATE && + type != COLLADAFW::Transformation::SCALE && + type != COLLADAFW::Transformation::TRANSLATE && + type != COLLADAFW::Transformation::MATRIX) { + fprintf(stderr, "animation of transformation %d is not supported yet\n", type); + return false; + } + + if (animlist_map.find(listid) == animlist_map.end()) + return false; + + const COLLADAFW::AnimationList *animlist = animlist_map[listid]; + const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); + + if (bindings.getCount()) { + float vec[3]; + + bool is_scale = (type == COLLADAFW::Transformation::SCALE); + bool is_translate = (type == COLLADAFW::Transformation::TRANSLATE); + + if (type == COLLADAFW::Transformation::SCALE) + dae_scale_to_v3(tm, vec); + else if (type == COLLADAFW::Transformation::TRANSLATE) + dae_translate_to_v3(tm, vec); + + for (unsigned int j = 0; j < bindings.getCount(); j++) { + const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[j]; + std::vector& curves = curve_map[binding.animation]; + COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass; + char path[100]; + + switch (type) { + case COLLADAFW::Transformation::ROTATE: + BLI_snprintf(path, sizeof(path), "%s.rotate (binding %u)", node_id, j); + break; + case COLLADAFW::Transformation::SCALE: + BLI_snprintf(path, sizeof(path), "%s.scale (binding %u)", node_id, j); + break; + case COLLADAFW::Transformation::TRANSLATE: + BLI_snprintf(path, sizeof(path), "%s.translate (binding %u)", node_id, j); + break; + case COLLADAFW::Transformation::MATRIX: + BLI_snprintf(path, sizeof(path), "%s.matrix (binding %u)", node_id, j); + break; + default: + break; + } + + if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) { + fprintf(stderr, "%s: UNKNOWN animation class\n", path); + continue; + } + + if (type == COLLADAFW::Transformation::ROTATE) { + if (curves.size() != 1) { + fprintf(stderr, "expected 1 curve, got %u\n", curves.size()); + return false; + } + + // TODO support other animclasses + if (animclass != COLLADAFW::AnimationList::ANGLE) { + fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass); + return false; + } + + COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis(); + float ax[3] = {axis[0], axis[1], axis[2]}; + float angle = evaluate_fcurve(curves[0], fra); + axis_angle_to_mat4(mat, ax, angle); + + return true; + } + else if (is_scale || is_translate) { + bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ; + + if ((!is_xyz && curves.size() != 1) || (is_xyz && curves.size() != 3)) { + if (is_xyz) + fprintf(stderr, "%s: expected 3 curves, got %u\n", path, curves.size()); + else + fprintf(stderr, "%s: expected 1 curve, got %u\n", path, curves.size()); + return false; + } + + switch (animclass) { + case COLLADAFW::AnimationList::POSITION_X: + vec[0] = evaluate_fcurve(curves[0], fra); + break; + case COLLADAFW::AnimationList::POSITION_Y: + vec[1] = evaluate_fcurve(curves[0], fra); + break; + case COLLADAFW::AnimationList::POSITION_Z: + vec[2] = evaluate_fcurve(curves[0], fra); + break; + case COLLADAFW::AnimationList::POSITION_XYZ: + vec[0] = evaluate_fcurve(curves[0], fra); + vec[1] = evaluate_fcurve(curves[1], fra); + vec[2] = evaluate_fcurve(curves[2], fra); + break; + default: + fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass); + break; + } + } + else if (type == COLLADAFW::Transformation::MATRIX) { + // for now, of matrix animation, support only the case when all values are packed into one animation + if (curves.size() != 16) { + fprintf(stderr, "%s: expected 16 curves, got %u\n", path, curves.size()); + return false; + } + + COLLADABU::Math::Matrix4 matrix; + int i = 0, j = 0; + + for (std::vector::iterator it = curves.begin(); it != curves.end(); it++) { + matrix.setElement(i, j, evaluate_fcurve(*it, fra)); + j++; + if (j == 4) { + i++; + j = 0; + } + } + + COLLADAFW::Matrix tm(matrix); + dae_matrix_to_mat4(&tm, mat); + + return true; + } + } + + if (is_scale) + size_to_mat4(mat, vec); + else + copy_v3_v3(mat[3], vec); + + return is_scale || is_translate; + } + + return false; +} + +// gives a world-space mat of joint at rest position +void AnimationImporter::get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node) +{ + // if bind mat is not available, + // use "current" node transform, i.e. all those tms listed inside + if (!armature_importer->get_joint_bind_mat(mat, node)) { + float par[4][4], m[4][4]; + + calc_joint_parent_mat_rest(par, NULL, root, node); + get_node_mat(m, node, NULL, NULL); + mul_m4_m4m4(mat, m, par); + } +} + +// gives a world-space mat, end's mat not included +bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end) +{ + float m[4][4]; + + if (node == end) { + par ? copy_m4_m4(mat, par) : unit_m4(mat); + return true; + } + + // use bind matrix if available or calc "current" world mat + if (!armature_importer->get_joint_bind_mat(m, node)) { + if (par) { + float temp[4][4]; + get_node_mat(temp, node, NULL, NULL); + mul_m4_m4m4(m, temp, par); + } + else { + get_node_mat(m, node, NULL, NULL); + } + } + + COLLADAFW::NodePointerArray& children = node->getChildNodes(); + for (unsigned int i = 0; i < children.getCount(); i++) { + if (calc_joint_parent_mat_rest(mat, m, children[i], end)) + return true; + } + + return false; +} + +#ifdef ARMATURE_TEST +Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job) +{ + if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) { + Object *job = add_object(scene, OB_EMPTY); + + rename_id((ID*)&job->id, (char*)get_joint_name(node)); + + job->lay = object_in_scene(job, scene)->lay = 2; + + mul_v3_fl(job->size, 0.5f); + job->recalc |= OB_RECALC_OB; + + verify_adt_action((ID*)&job->id, 1); + + job->rotmode = ROT_MODE_QUAT; + + float mat[4][4]; + get_joint_rest_mat(mat, root, node); + + if (par_job) { + float temp[4][4], ipar[4][4]; + invert_m4_m4(ipar, par_job->obmat); + copy_m4_m4(temp, mat); + mul_m4_m4m4(mat, temp, ipar); + } + + TransformBase::decompose(mat, job->loc, NULL, job->quat, job->size); + + if (par_job) { + job->parent = par_job; + + par_job->recalc |= OB_RECALC_OB; + job->parsubstr[0] = 0; + } + + where_is_object(scene, job); + + // after parenting and layer change + DAG_scene_sort(CTX_data_main(C), scene); + + joint_objects[node->getUniqueId()] = job; + } + + return joint_objects[node->getUniqueId()]; +} +#endif + +#if 0 +// recursively evaluates joint tree until end is found, mat then is world-space matrix of end +// mat must be identity on enter, node must be root +bool AnimationImporter::evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra) +{ + float m[4][4]; + if (par) { + float temp[4][4]; + evaluate_transform_at_frame(temp, node, node == end ? fra : 0.0f); + mul_m4_m4m4(m, temp, par); + } + else { + evaluate_transform_at_frame(m, node, node == end ? fra : 0.0f); + } + + if (node == end) { + copy_m4_m4(mat, m); + return true; + } + else { + COLLADAFW::NodePointerArray& children = node->getChildNodes(); + for (int i = 0; i < children.getCount(); i++) { + if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra)) + return true; + } + } + + return false; +} +#endif + +void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu) +{ + const char *bone_name = bc_get_joint_name(node); + bAction *act = ob->adt->action; + + /* try to find group */ + bActionGroup *grp = action_groups_find_named(act, bone_name); + + /* no matching groups, so add one */ + if (grp == NULL) { + /* Add a new group, and make it active */ + grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); + + grp->flag = AGRP_SELECTED; + BLI_strncpy(grp->name, bone_name, sizeof(grp->name)); + + BLI_addtail(&act->groups, grp); + BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64); + } + + /* add F-Curve to group */ + action_groups_add_channel(act, grp, fcu); +} + +void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value) +{ + BezTriple bez; + memset(&bez, 0, sizeof(BezTriple)); + bez.vec[1][0] = fra; + bez.vec[1][1] = value; + bez.ipo = U.ipo_new; /* use default interpolation mode here... */ + bez.f1 = bez.f2 = bez.f3 = SELECT; + bez.h1 = bez.h2 = HD_AUTO; + insert_bezt_fcurve(fcu, &bez, 0); + calchandles_fcurve(fcu); +} diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h new file mode 100644 index 00000000000..9854a9d2663 --- /dev/null +++ b/source/blender/collada/AnimationImporter.h @@ -0,0 +1,132 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BC_ANIMATIONIMPORTER_H__ +#define __BC_ANIMATIONIMPORTER_H__ + +#include +#include + +#include "COLLADAFWAnimation.h" +#include "COLLADAFWAnimationCurve.h" +#include "COLLADAFWAnimationList.h" +#include "COLLADAFWNode.h" +#include "COLLADAFWUniqueId.h" + +#include "DNA_anim_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +//#include "ArmatureImporter.h" +#include "TransformReader.h" + +#include "collada_internal.h" + +class ArmatureImporter; + +class AnimationImporterBase +{ +public: + // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0; +}; + +class AnimationImporter : private TransformReader, public AnimationImporterBase +{ +private: + + ArmatureImporter *armature_importer; + Scene *scene; + + std::map > curve_map; + std::map uid_animated_map; + // std::map > fcurves_actionGroup_map; + std::map animlist_map; + std::vector unused_curves; + std::map joint_objects; + + FCurve *create_fcurve(int array_index, const char *rna_path); + + void create_bezt(FCurve *fcu, float frame, float output); + + // create one or several fcurves depending on the number of parameters being animated + void animation_to_fcurves(COLLADAFW::AnimationCurve *curve); + + void fcurve_deg_to_rad(FCurve *cu); + + void add_fcurves_to_object(Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated); +public: + + AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene); + + ~AnimationImporter(); + + bool write_animation(const COLLADAFW::Animation* anim); + + // called on post-process stage after writeVisualScenes + bool write_animation_list(const COLLADAFW::AnimationList* animlist); + + void read_node_transform(COLLADAFW::Node *node, Object *ob); +#if 0 + virtual void change_eul_to_quat(Object *ob, bAction *act); +#endif + + // prerequisites: + // animlist_map - map animlist id -> animlist + // curve_map - map anim id -> curve(s) + Object *translate_animation(COLLADAFW::Node *node, + std::map& object_map, + std::map& root_map, + COLLADAFW::Transformation::TransformationType tm_type, + Object *par_job = NULL); + + // internal, better make it private + // warning: evaluates only rotation + // prerequisites: animlist_map, curve_map + void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra); + + // return true to indicate that mat contains a sane value + bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id); + + // gives a world-space mat of joint at rest position + void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node); + + // gives a world-space mat, end's mat not included + bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end); + +#ifdef ARMATURE_TEST + Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job); +#endif + +#if 0 + // recursively evaluates joint tree until end is found, mat then is world-space matrix of end + // mat must be identity on enter, node must be root + bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra); +#endif + + void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu); + + void add_bezt(FCurve *fcu, float fra, float value); +}; + + #endif \ No newline at end of file diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp new file mode 100644 index 00000000000..f931c04aef1 --- /dev/null +++ b/source/blender/collada/ArmatureImporter.cpp @@ -0,0 +1,585 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "COLLADAFWUniqueId.h" + +#include "BKE_action.h" +#include "BKE_depsgraph.h" +#include "BKE_object.h" +#include "BLI_string.h" +#include "ED_armature.h" + +#include "ArmatureImporter.h" + +// use this for retrieving bone names, since these must be unique +template +static const char *bc_get_joint_name(T *node) +{ + const std::string& id = node->getOriginalId(); + return id.size() ? id.c_str() : node->getName().c_str(); +} + +ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) : + TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {} + +ArmatureImporter::~ArmatureImporter() +{ + // free skin controller data if we forget to do this earlier + std::map::iterator it; + for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { + it->second.free(); + } +} + +#if 0 +JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node); +{ + const COLLADAFW::UniqueId& joint_id = node->getUniqueId(); + + if (joint_id_to_joint_index_map.find(joint_id) == joint_id_to_joint_index_map.end()) { + fprintf(stderr, "Cannot find a joint index by joint id for %s.\n", + node->getOriginalId().c_str()); + return NULL; + } + + int joint_index = joint_id_to_joint_index_map[joint_id]; + + return &joint_index_to_joint_info_map[joint_index]; +} +#endif + +void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild, + float parent_mat[][4], bArmature *arm) +{ + float joint_inv_bind_mat[4][4]; + + // JointData* jd = get_joint_data(node); + + float mat[4][4]; + + if (skin.get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) { + // get original world-space matrix + invert_m4_m4(mat, joint_inv_bind_mat); + } + // create a bone even if there's no joint data for it (i.e. it has no influence) + else { + float obmat[4][4]; + + // object-space + get_node_mat(obmat, node, NULL, NULL); + + // get world-space + if (parent) + mul_m4_m4m4(mat, obmat, parent_mat); + else + copy_m4_m4(mat, obmat); + } + + // TODO rename from Node "name" attrs later + EditBone *bone = ED_armature_edit_bone_add(arm, (char*)bc_get_joint_name(node)); + totbone++; + + if (parent) bone->parent = parent; + + // set head + copy_v3_v3(bone->head, mat[3]); + + // set tail, don't set it to head because 0-length bones are not allowed + float vec[3] = {0.0f, 0.5f, 0.0f}; + add_v3_v3v3(bone->tail, bone->head, vec); + + // set parent tail + if (parent && totchild == 1) { + copy_v3_v3(parent->tail, bone->head); + + // not setting BONE_CONNECTED because this would lock child bone location with respect to parent + // bone->flag |= BONE_CONNECTED; + + // XXX increase this to prevent "very" small bones? + const float epsilon = 0.000001f; + + // derive leaf bone length + float length = len_v3v3(parent->head, parent->tail); + if ((length < leaf_bone_length || totbone == 0) && length > epsilon) { + leaf_bone_length = length; + } + + // treat zero-sized bone like a leaf bone + if (length <= epsilon) { + add_leaf_bone(parent_mat, parent); + } + + /* +#if 0 + // and which row in mat is bone direction + float vec[3]; + sub_v3_v3v3(vec, parent->tail, parent->head); +#ifdef COLLADA_DEBUG + print_v3("tail - head", vec); + print_m4("matrix", parent_mat); +#endif + for (int i = 0; i < 3; i++) { +#ifdef COLLADA_DEBUG + char *axis_names[] = {"X", "Y", "Z"}; + printf("%s-axis length is %f\n", axis_names[i], len_v3(parent_mat[i])); +#endif + float angle = angle_v2v2(vec, parent_mat[i]); + if (angle < min_angle) { +#ifdef COLLADA_DEBUG + print_v3("picking", parent_mat[i]); + printf("^ %s axis of %s's matrix\n", axis_names[i], get_dae_name(node)); +#endif + bone_direction_row = i; + min_angle = angle; + } + } +#endif + */ + } + + COLLADAFW::NodePointerArray& children = node->getChildNodes(); + for (unsigned int i = 0; i < children.getCount(); i++) { + create_bone(skin, children[i], bone, children.getCount(), mat, arm); + } + + // in second case it's not a leaf bone, but we handle it the same way + if (!children.getCount() || children.getCount() > 1) { + add_leaf_bone(mat, bone); + } +} + +void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone) +{ + LeafBone leaf; + + leaf.bone = bone; + copy_m4_m4(leaf.mat, mat); + BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name)); + + leaf_bones.push_back(leaf); +} + +void ArmatureImporter::fix_leaf_bones() +{ + // just setting tail for leaf bones here + + std::vector::iterator it; + for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { + LeafBone& leaf = *it; + + // pointing up + float vec[3] = {0.0f, 0.0f, 1.0f}; + + mul_v3_fl(vec, leaf_bone_length); + + copy_v3_v3(leaf.bone->tail, leaf.bone->head); + add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); + } +} + +void ArmatureImporter::set_leaf_bone_shapes(Object *ob_arm) +{ + bPose *pose = ob_arm->pose; + + std::vector::iterator it; + for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { + LeafBone& leaf = *it; + + bPoseChannel *pchan = get_pose_channel(pose, leaf.name); + if (pchan) { + pchan->custom = get_empty_for_leaves(); + } + else { + fprintf(stderr, "Cannot find a pose channel for leaf bone %s\n", leaf.name); + } + } +} + +#if 0 +void ArmatureImporter::set_euler_rotmode() +{ + // just set rotmode = ROT_MODE_EUL on pose channel for each joint + + std::map::iterator it; + + for (it = joint_by_uid.begin(); it != joint_by_uid.end(); it++) { + + COLLADAFW::Node *joint = it->second; + + std::map::iterator sit; + + for (sit = skin_by_data_uid.begin(); sit != skin_by_data_uid.end(); sit++) { + SkinInfo& skin = sit->second; + + if (skin.uses_joint_or_descendant(joint)) { + bPoseChannel *pchan = skin.get_pose_channel_from_node(joint); + + if (pchan) { + pchan->rotmode = ROT_MODE_EUL; + } + else { + fprintf(stderr, "Cannot find pose channel for %s.\n", get_joint_name(joint)); + } + + break; + } + } + } +} +#endif + +Object *ArmatureImporter::get_empty_for_leaves() +{ + if (empty) return empty; + + empty = add_object(scene, OB_EMPTY); + empty->empty_drawtype = OB_EMPTY_SPHERE; + + return empty; +} + +#if 0 +Object *ArmatureImporter::find_armature(COLLADAFW::Node *node) +{ + JointData* jd = get_joint_data(node); + if (jd) return jd->ob_arm; + + COLLADAFW::NodePointerArray& children = node->getChildNodes(); + for (int i = 0; i < children.getCount(); i++) { + Object *ob_arm = find_armature(children[i]); + if (ob_arm) return ob_arm; + } + + return NULL; +} + +ArmatureJoints& ArmatureImporter::get_armature_joints(Object *ob_arm) +{ + // try finding it + std::vector::iterator it; + for (it = armature_joints.begin(); it != armature_joints.end(); it++) { + if ((*it).ob_arm == ob_arm) return *it; + } + + // not found, create one + ArmatureJoints aj; + aj.ob_arm = ob_arm; + armature_joints.push_back(aj); + + return armature_joints.back(); +} +#endif + +void ArmatureImporter::create_armature_bones(SkinInfo& skin) +{ + // just do like so: + // - get armature + // - enter editmode + // - add edit bones and head/tail properties using matrices and parent-child info + // - exit edit mode + // - set a sphere shape to leaf bones + + Object *ob_arm = NULL; + + /* + * find if there's another skin sharing at least one bone with this skin + * if so, use that skin's armature + */ + + /* + Pseudocode: + + find_node_in_tree(node, root_joint) + + skin::find_root_joints(root_joints): + std::vector root_joints; + for each root in root_joints: + for each joint in joints: + if find_node_in_tree(joint, root): + if (std::find(root_joints.begin(), root_joints.end(), root) == root_joints.end()) + root_joints.push_back(root); + + for (each skin B with armature) { + find all root joints for skin B + + for each joint X in skin A: + for each root joint R in skin B: + if (find_node_in_tree(X, R)) { + shared = 1; + goto endloop; + } + } + + endloop: + */ + + SkinInfo *a = &skin; + Object *shared = NULL; + std::vector skin_root_joints; + + std::map::iterator it; + for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { + SkinInfo *b = &it->second; + if (b == a || b->get_armature() == NULL) + continue; + + skin_root_joints.clear(); + + b->find_root_joints(root_joints, joint_by_uid, skin_root_joints); + + std::vector::iterator ri; + for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) { + if (a->uses_joint_or_descendant(*ri)) { + shared = b->get_armature(); + break; + } + } + + if (shared != NULL) + break; + } + + if (shared) + ob_arm = skin.set_armature(shared); + else + ob_arm = skin.create_armature(scene); + + // enter armature edit mode + ED_armature_to_edit(ob_arm); + + leaf_bones.clear(); + totbone = 0; + // bone_direction_row = 1; // TODO: don't default to Y but use asset and based on it decide on default row + leaf_bone_length = 0.1f; + // min_angle = 360.0f; // minimum angle between bone head-tail and a row of bone matrix + + // create bones + /* + TODO: + check if bones have already been created for a given joint + */ + + std::vector::iterator ri; + for (ri = root_joints.begin(); ri != root_joints.end(); ri++) { + // for shared armature check if bone tree is already created + if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), *ri) != skin_root_joints.end()) + continue; + + // since root_joints may contain joints for multiple controllers, we need to filter + if (skin.uses_joint_or_descendant(*ri)) { + create_bone(skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data); + + if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && !skin.get_parent()) + skin.set_parent(joint_parent_map[(*ri)->getUniqueId()]); + } + } + + fix_leaf_bones(); + + // exit armature edit mode + ED_armature_from_edit(ob_arm); + ED_armature_edit_free(ob_arm); + DAG_id_flush_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA); + + set_leaf_bone_shapes(ob_arm); + + // set_euler_rotmode(); +} + + +// root - if this joint is the top joint in hierarchy, if a joint +// is a child of a node (not joint), root should be true since +// this is where we build armature bones from +void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent) +{ + joint_by_uid[node->getUniqueId()] = node; + if (root) { + root_joints.push_back(node); + + if (parent) + joint_parent_map[node->getUniqueId()] = parent; + } +} + +#if 0 +void ArmatureImporter::add_root_joint(COLLADAFW::Node *node) +{ + // root_joints.push_back(node); + Object *ob_arm = find_armature(node); + if (ob_arm) { + get_armature_joints(ob_arm).root_joints.push_back(node); + } +#ifdef COLLADA_DEBUG + else { + fprintf(stderr, "%s cannot be added to armature.\n", get_joint_name(node)); + } +#endif +} +#endif + +// here we add bones to armatures, having armatures previously created in write_controller +void ArmatureImporter::make_armatures(bContext *C) +{ + std::map::iterator it; + for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { + + SkinInfo& skin = it->second; + + create_armature_bones(skin); + + // link armature with a mesh object + Object *ob = mesh_importer->get_object_by_geom_uid(*get_geometry_uid(skin.get_controller_uid())); + if (ob) + skin.link_armature(C, ob, joint_by_uid, this); + else + fprintf(stderr, "Cannot find object to link armature with.\n"); + + // set armature parent if any + Object *par = skin.get_parent(); + if (par) + bc_set_parent(skin.get_armature(), par, C, false); + + // free memory stolen from SkinControllerData + skin.free(); + } +} + +#if 0 +// link with meshes, create vertex groups, assign weights +void ArmatureImporter::link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id) +{ + Object *ob = mesh_importer->get_object_by_geom_uid(geom_id); + + if (!ob) { + fprintf(stderr, "Cannot find object by geometry UID.\n"); + return; + } + + if (skin_by_data_uid.find(controller_data_id) == skin_by_data_uid.end()) { + fprintf(stderr, "Cannot find skin info by controller data UID.\n"); + return; + } + + SkinInfo& skin = skin_by_data_uid[conroller_data_id]; + + // create vertex groups +} +#endif + +bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControllerData* data) +{ + // at this stage we get vertex influence info that should go into me->verts and ob->defbase + // there's no info to which object this should be long so we associate it with skin controller data UID + + // don't forget to call defgroup_unique_name before we copy + + // controller data uid -> [armature] -> joint data, + // [mesh object] + // + + SkinInfo skin(unit_converter); + skin.borrow_skin_controller_data(data); + + // store join inv bind matrix to use it later in armature construction + const COLLADAFW::Matrix4Array& inv_bind_mats = data->getInverseBindMatrices(); + for (unsigned int i = 0; i < data->getJointsCount(); i++) { + skin.add_joint(inv_bind_mats[i]); + } + + skin_by_data_uid[data->getUniqueId()] = skin; + + return true; +} + +bool ArmatureImporter::write_controller(const COLLADAFW::Controller* controller) +{ + // - create and store armature object + + const COLLADAFW::UniqueId& skin_id = controller->getUniqueId(); + + if (controller->getControllerType() == COLLADAFW::Controller::CONTROLLER_TYPE_SKIN) { + COLLADAFW::SkinController *co = (COLLADAFW::SkinController*)controller; + // to be able to find geom id by controller id + geom_uid_by_controller_uid[skin_id] = co->getSource(); + + const COLLADAFW::UniqueId& data_uid = co->getSkinControllerData(); + if (skin_by_data_uid.find(data_uid) == skin_by_data_uid.end()) { + fprintf(stderr, "Cannot find skin by controller data UID.\n"); + return true; + } + + skin_by_data_uid[data_uid].set_controller(co); + } + // morph controller + else { + // shape keys? :) + fprintf(stderr, "Morph controller is not supported yet.\n"); + } + + return true; +} + +COLLADAFW::UniqueId *ArmatureImporter::get_geometry_uid(const COLLADAFW::UniqueId& controller_uid) +{ + if (geom_uid_by_controller_uid.find(controller_uid) == geom_uid_by_controller_uid.end()) + return NULL; + + return &geom_uid_by_controller_uid[controller_uid]; +} + +Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) +{ + std::map::iterator it; + for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { + SkinInfo& skin = it->second; + + if (skin.uses_joint_or_descendant(node)) + return skin.get_armature(); + } + + return NULL; +} + +void ArmatureImporter::get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count) +{ + BLI_snprintf(joint_path, count, "pose.bones[\"%s\"]", bc_get_joint_name(node)); +} + +// gives a world-space mat +bool ArmatureImporter::get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint) +{ + std::map::iterator it; + bool found = false; + for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { + SkinInfo& skin = it->second; + if ((found = skin.get_joint_inv_bind_matrix(m, joint))) { + invert_m4(m); + break; + } + } + + return found; +} \ No newline at end of file diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h new file mode 100644 index 00000000000..64d4669b33c --- /dev/null +++ b/source/blender/collada/ArmatureImporter.h @@ -0,0 +1,160 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BC_ARMATUREIMPORTER_H__ +#define __BC_ARMATUREIMPORTER_H__ + +#include "COLLADAFWNode.h" +#include "COLLADAFWUniqueId.h" + +extern "C" { +#include "BKE_context.h" + +#include "DNA_armature_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "ED_armature.h" +} + +#include "AnimationImporter.h" +#include "MeshImporter.h" +#include "SkinInfo.h" +#include "TransformReader.h" + +#include +#include + +#include "collada_internal.h" +#include "collada_utils.h" + +class ArmatureImporter : private TransformReader +{ +private: + Scene *scene; + UnitConverter *unit_converter; + + // std::map joint_index_to_joint_info_map; + // std::map joint_id_to_joint_index_map; + + struct LeafBone { + // COLLADAFW::Node *node; + EditBone *bone; + char name[32]; + float mat[4][4]; // bone matrix, derived from inv_bind_mat + }; + std::vector leaf_bones; + // int bone_direction_row; // XXX not used + float leaf_bone_length; + int totbone; + // XXX not used + // float min_angle; // minimum angle between bone head-tail and a row of bone matrix + +#if 0 + struct ArmatureJoints { + Object *ob_arm; + std::vector root_joints; + }; + std::vector armature_joints; +#endif + + Object *empty; // empty for leaf bones + + std::map geom_uid_by_controller_uid; + std::map joint_by_uid; // contains all joints + std::vector root_joints; + std::map joint_parent_map; + + MeshImporterBase *mesh_importer; + AnimationImporterBase *anim_importer; + + // This is used to store data passed in write_controller_data. + // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members + // so that arrays don't get freed until we free them explicitly. + + std::map skin_by_data_uid; // data UID = skin controller data UID +#if 0 + JointData *get_joint_data(COLLADAFW::Node *node); +#endif + + void create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild, + float parent_mat[][4], bArmature *arm); + + void add_leaf_bone(float mat[][4], EditBone *bone); + + void fix_leaf_bones(); + + void set_leaf_bone_shapes(Object *ob_arm); + +#if 0 + void set_euler_rotmode(); +#endif + + Object *get_empty_for_leaves(); + +#if 0 + Object *find_armature(COLLADAFW::Node *node); + + ArmatureJoints& get_armature_joints(Object *ob_arm); +#endif + + void create_armature_bones(SkinInfo& skin); + +public: + + ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce); + ~ArmatureImporter(); + + // root - if this joint is the top joint in hierarchy, if a joint + // is a child of a node (not joint), root should be true since + // this is where we build armature bones from + void add_joint(COLLADAFW::Node *node, bool root, Object *parent); + +#if 0 + void add_root_joint(COLLADAFW::Node *node); +#endif + + // here we add bones to armatures, having armatures previously created in write_controller + void make_armatures(bContext *C); + +#if 0 + // link with meshes, create vertex groups, assign weights + void link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id); +#endif + + bool write_skin_controller_data(const COLLADAFW::SkinControllerData* data); + + bool write_controller(const COLLADAFW::Controller* controller); + + COLLADAFW::UniqueId *get_geometry_uid(const COLLADAFW::UniqueId& controller_uid); + + Object *get_armature_for_joint(COLLADAFW::Node *node); + + void get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count); + + // gives a world-space mat + bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint); +}; + +#endif \ No newline at end of file diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index d10fa4ca94c..c13e089fa4a 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -91,7 +91,6 @@ extern char build_rev[]; #include "COLLADASWSurfaceInitOption.h" #include "COLLADASWSampler.h" #include "COLLADASWScene.h" -//#include "COLLADASWSurface.h" #include "COLLADASWTechnique.h" #include "COLLADASWTexture.h" #include "COLLADASWLibraryMaterials.h" @@ -112,31 +111,6 @@ extern char build_rev[]; #include #include // std::find -// arithb.c now has QuatToAxisAngle too -#if 0 -// This function assumes that quat is normalized. -// The following document was used as reference: -// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm -void quat_to_axis_angle( float *axis, float *angle,float *q) -{ - // quat to axis angle - *angle = 2 * acos(q[0]); - float divisor = sqrt(1 - q[0] * q[0]); - - // test to avoid divide by zero, divisor is always positive - if (divisor < 0.001f ) { - axis[0] = 1.0f; - axis[1] = 0.0f; - axis[2] = 0.0f; - } - else { - axis[0] = q[1] / divisor; - axis[1] = q[2] / divisor; - axis[2] = q[3] / divisor; - } -} -#endif - char *CustomData_get_layer_name(const struct CustomData *data, int type, int n) { int layer_index = CustomData_get_layer_index(data, type); @@ -2580,8 +2554,8 @@ protected: find_frames(ob, fra, prefix, "rotation_euler"); else if (rotmode == ROT_MODE_QUAT) find_frames(ob, fra, prefix, "rotation_quaternion"); - else if (rotmode == ROT_MODE_AXISANGLE) - ; + /*else if (rotmode == ROT_MODE_AXISANGLE) + ;*/ } // enable fcurves driving a specific bone, disable all the rest diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h index bb6d400fdf1..4aac393b1ab 100644 --- a/source/blender/collada/DocumentExporter.h +++ b/source/blender/collada/DocumentExporter.h @@ -21,6 +21,10 @@ * * ***** END GPL LICENSE BLOCK ***** */ + +#ifndef __DOCUMENTEXPORTER_H__ +#define __DOCUMENTEXPORTER_H__ + struct Scene; class DocumentExporter @@ -29,3 +33,5 @@ class DocumentExporter void exportCurrentScene(Scene *sce, const char* filename); void exportScenes(const char* filename); }; + +#endif diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 0b50326ad6c..40e4d389b88 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -25,3210 +25,74 @@ // * name imported objects // * import object rotation as euler +#include +#include +#include // sort() + +#include +#include + #include "COLLADAFWRoot.h" #include "COLLADAFWIWriter.h" #include "COLLADAFWStableHeaders.h" -#include "COLLADAFWAnimationCurve.h" -#include "COLLADAFWAnimationList.h" #include "COLLADAFWCamera.h" #include "COLLADAFWColorOrTexture.h" #include "COLLADAFWEffect.h" -#include "COLLADAFWFloatOrDoubleArray.h" -#include "COLLADAFWGeometry.h" #include "COLLADAFWImage.h" #include "COLLADAFWIndexList.h" #include "COLLADAFWInstanceGeometry.h" #include "COLLADAFWLight.h" #include "COLLADAFWMaterial.h" -#include "COLLADAFWMesh.h" #include "COLLADAFWMeshPrimitiveWithFaceVertexCount.h" -#include "COLLADAFWNode.h" #include "COLLADAFWPolygons.h" #include "COLLADAFWSampler.h" -#include "COLLADAFWSkinController.h" -#include "COLLADAFWSkinControllerData.h" -#include "COLLADAFWTransformation.h" -#include "COLLADAFWTranslate.h" -#include "COLLADAFWRotate.h" -#include "COLLADAFWScale.h" -#include "COLLADAFWMatrix.h" #include "COLLADAFWTypes.h" #include "COLLADAFWVisualScene.h" -#include "COLLADAFWFileInfo.h" #include "COLLADAFWArrayPrimitiveType.h" #include "COLLADAFWLibraryNodes.h" #include "COLLADASaxFWLLoader.h" -// TODO move "extern C" into header files -extern "C" -{ -#include "ED_keyframing.h" -#include "ED_armature.h" -#include "ED_mesh.h" // ED_vgroup_vert_add, ... -#include "ED_anim_api.h" -#include "ED_object.h" - -#include "WM_types.h" -#include "WM_api.h" - #include "BKE_main.h" -#include "BKE_customdata.h" #include "BKE_library.h" #include "BKE_texture.h" #include "BKE_fcurve.h" #include "BKE_depsgraph.h" #include "BLI_path_util.h" -#include "BKE_displist.h" -#include "BLI_math.h" #include "BKE_scene.h" -} -#include "BKE_armature.h" -#include "BKE_mesh.h" #include "BKE_global.h" -#include "BKE_context.h" #include "BKE_object.h" -#include "BKE_image.h" #include "BKE_material.h" #include "BKE_utildefines.h" -#include "BKE_action.h" +#include "BKE_image.h" -#include "BLI_math.h" #include "BLI_listbase.h" #include "BLI_string.h" -#include "DNA_lamp_types.h" -#include "DNA_armature_types.h" -#include "DNA_anim_types.h" -#include "DNA_curve_types.h" -#include "DNA_texture_types.h" #include "DNA_camera_types.h" -#include "DNA_object_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_mesh_types.h" -#include "DNA_material_types.h" -#include "DNA_scene_types.h" -#include "DNA_modifier_types.h" +#include "DNA_lamp_types.h" #include "MEM_guardedalloc.h" #include "DocumentImporter.h" #include "collada_internal.h" -#include -#include -#include // sort() +#include "TransformReader.h" +#include "AnimationImporter.h" +#include "ArmatureImporter.h" +#include "MeshImporter.h" +#include "collada_utils.h" -#include -#include -// #define COLLADA_DEBUG +/* + COLLADA Importer limitations: + - no multiple scene import, all objects are added to active scene + */ +// #define COLLADA_DEBUG // creates empties for each imported bone on layer 2, for debugging // #define ARMATURE_TEST -char *CustomData_get_layer_name(const struct CustomData *data, int type, int n); - -static const char *primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type) -{ - using namespace COLLADAFW; - - switch (type) { - case MeshPrimitive::LINES: - return "LINES"; - case MeshPrimitive::LINE_STRIPS: - return "LINESTRIPS"; - case MeshPrimitive::POLYGONS: - return "POLYGONS"; - case MeshPrimitive::POLYLIST: - return "POLYLIST"; - case MeshPrimitive::TRIANGLES: - return "TRIANGLES"; - case MeshPrimitive::TRIANGLE_FANS: - return "TRIANGLE_FANS"; - case MeshPrimitive::TRIANGLE_STRIPS: - return "TRIANGLE_FANS"; - case MeshPrimitive::POINTS: - return "POINTS"; - case MeshPrimitive::UNDEFINED_PRIMITIVE_TYPE: - return "UNDEFINED_PRIMITIVE_TYPE"; - } - return "UNKNOWN"; -} - -static const char *geomTypeToStr(COLLADAFW::Geometry::GeometryType type) -{ - switch (type) { - case COLLADAFW::Geometry::GEO_TYPE_MESH: - return "MESH"; - case COLLADAFW::Geometry::GEO_TYPE_SPLINE: - return "SPLINE"; - case COLLADAFW::Geometry::GEO_TYPE_CONVEX_MESH: - return "CONVEX_MESH"; - case COLLADAFW::Geometry::GEO_TYPE_UNKNOWN: - default: - return "UNKNOWN"; - } -} - -// works for COLLADAFW::Node, COLLADAFW::Geometry -template -static const char *get_dae_name(T *node) -{ - const std::string& name = node->getName(); - return name.size() ? name.c_str() : node->getOriginalId().c_str(); -} - -// use this for retrieving bone names, since these must be unique -template -static const char *get_joint_name(T *node) -{ - const std::string& id = node->getOriginalId(); - return id.size() ? id.c_str() : node->getName().c_str(); -} - -static float get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index) -{ - if (index >= array.getValuesCount()) - return 0.0f; - - if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT) - return array.getFloatValues()->getData()[index]; - else - return array.getDoubleValues()->getData()[index]; -} - -// copied from /editors/object/object_relations.c -static int test_parent_loop(Object *par, Object *ob) -{ - /* test if 'ob' is a parent somewhere in par's parents */ - - if(par == NULL) return 0; - if(ob == par) return 1; - - return test_parent_loop(par->parent, ob); -} - -// a shortened version of parent_set_exec() -// if is_parent_space is true then ob->obmat will be multiplied by par->obmat before parenting -static int set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true) -{ - if (!par || test_parent_loop(par, ob)) - return false; - - Object workob; - Main *bmain = CTX_data_main(C); - Scene *sce = CTX_data_scene(C); - - ob->parent = par; - ob->partype = PAROBJECT; - - ob->parsubstr[0] = 0; - - if (is_parent_space) { - // calc par->obmat - where_is_object(sce, par); - - // move child obmat into world space - float mat[4][4]; - mul_m4_m4m4(mat, ob->obmat, par->obmat); - copy_m4_m4(ob->obmat, mat); - } - - // apply child obmat (i.e. decompose it into rot/loc/size) - object_apply_mat4(ob, ob->obmat); - - // compute parentinv - what_does_parent(sce, ob, &workob); - invert_m4_m4(ob->parentinv, workob.obmat); - - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; - par->recalc |= OB_RECALC_OB; - - DAG_scene_sort(bmain, sce); - DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); - - return true; -} - -typedef std::map > TexIndexTextureArrayMap; - -class TransformReader : public TransformBase -{ -protected: - - UnitConverter *unit_converter; - - struct Animation { - Object *ob; - COLLADAFW::Node *node; - COLLADAFW::Transformation *tm; // which transform is animated by an AnimationList->id - }; - -public: - - TransformReader(UnitConverter* conv) : unit_converter(conv) {} - - void get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map *animation_map, - Object *ob) - { - float cur[4][4]; - float copy[4][4]; - - unit_m4(mat); - - for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) { - - COLLADAFW::Transformation *tm = node->getTransformations()[i]; - COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); - - switch(type) { - case COLLADAFW::Transformation::TRANSLATE: - dae_translate_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::ROTATE: - dae_rotate_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::SCALE: - dae_scale_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::MATRIX: - dae_matrix_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::LOOKAT: - case COLLADAFW::Transformation::SKEW: - fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet.\n"); - break; - } - - copy_m4_m4(copy, mat); - mul_m4_m4m4(mat, cur, copy); - - if (animation_map) { - // AnimationList that drives this Transformation - const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList(); - - // store this so later we can link animation data with ob - Animation anim = {ob, node, tm}; - (*animation_map)[anim_list_id] = anim; - } - } - } - - void dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) - { - COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm; - COLLADABU::Math::Vector3& axis = ro->getRotationAxis(); - float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f); - float ax[] = {axis[0], axis[1], axis[2]}; - // float quat[4]; - // axis_angle_to_quat(quat, axis, angle); - // quat_to_mat4(m, quat); - axis_angle_to_mat4(m, ax, angle); - } - - void dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) - { - COLLADAFW::Translate *tra = (COLLADAFW::Translate*)tm; - COLLADABU::Math::Vector3& t = tra->getTranslation(); - - unit_m4(m); - - m[3][0] = (float)t[0]; - m[3][1] = (float)t[1]; - m[3][2] = (float)t[2]; - } - - void dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) - { - COLLADABU::Math::Vector3& s = ((COLLADAFW::Scale*)tm)->getScale(); - float size[3] = {(float)s[0], (float)s[1], (float)s[2]}; - size_to_mat4(m, size); - } - - void dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) - { - unit_converter->dae_matrix_to_mat4(m, ((COLLADAFW::Matrix*)tm)->getMatrix()); - } - - void dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3]) - { - dae_vector3_to_v3(((COLLADAFW::Translate*)tm)->getTranslation(), v); - } - - void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3]) - { - dae_vector3_to_v3(((COLLADAFW::Scale*)tm)->getScale(), v); - } - - void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]) - { - v[0] = v3.x; - v[1] = v3.y; - v[2] = v3.z; - } -}; - -// only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid -class MeshImporterBase -{ -public: - virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0; -}; - -// ditto as above -class AnimationImporterBase -{ -public: - // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0; -}; - -class ArmatureImporter : private TransformReader -{ -private: - Scene *scene; - UnitConverter *unit_converter; - - // std::map joint_index_to_joint_info_map; - // std::map joint_id_to_joint_index_map; - - struct LeafBone { - // COLLADAFW::Node *node; - EditBone *bone; - char name[32]; - float mat[4][4]; // bone matrix, derived from inv_bind_mat - }; - std::vector leaf_bones; - // int bone_direction_row; // XXX not used - float leaf_bone_length; - int totbone; - // XXX not used - // float min_angle; // minimum angle between bone head-tail and a row of bone matrix - -#if 0 - struct ArmatureJoints { - Object *ob_arm; - std::vector root_joints; - }; - std::vector armature_joints; -#endif - - Object *empty; // empty for leaf bones - - std::map geom_uid_by_controller_uid; - std::map joint_by_uid; // contains all joints - std::vector root_joints; - std::map joint_parent_map; - - MeshImporterBase *mesh_importer; - AnimationImporterBase *anim_importer; - - // This is used to store data passed in write_controller_data. - // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members - // so that arrays don't get freed until we free them explicitly. - class SkinInfo - { - private: - // to build armature bones from inverse bind matrices - struct JointData { - float inv_bind_mat[4][4]; // joint inverse bind matrix - COLLADAFW::UniqueId joint_uid; // joint node UID - // Object *ob_arm; // armature object - }; - - float bind_shape_matrix[4][4]; - - // data from COLLADAFW::SkinControllerData, each array should be freed - COLLADAFW::UIntValuesArray joints_per_vertex; - COLLADAFW::UIntValuesArray weight_indices; - COLLADAFW::IntValuesArray joint_indices; - // COLLADAFW::FloatOrDoubleArray weights; - std::vector weights; - - std::vector joint_data; // index to this vector is joint index - - UnitConverter *unit_converter; - - Object *ob_arm; - COLLADAFW::UniqueId controller_uid; - Object *parent; - - public: - - SkinInfo() {} - - SkinInfo(const SkinInfo& skin) : weights(skin.weights), - joint_data(skin.joint_data), - unit_converter(skin.unit_converter), - ob_arm(skin.ob_arm), - controller_uid(skin.controller_uid), - parent(skin.parent) - { - copy_m4_m4(bind_shape_matrix, (float (*)[4])skin.bind_shape_matrix); - - transfer_uint_array_data_const(skin.joints_per_vertex, joints_per_vertex); - transfer_uint_array_data_const(skin.weight_indices, weight_indices); - transfer_int_array_data_const(skin.joint_indices, joint_indices); - } - - SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) {} - - // nobody owns the data after this, so it should be freed manually with releaseMemory - template - void transfer_array_data(T& src, T& dest) - { - dest.setData(src.getData(), src.getCount()); - src.yieldOwnerShip(); - dest.yieldOwnerShip(); - } - - // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor - void transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest) - { - dest.setData((int*)src.getData(), src.getCount()); - dest.yieldOwnerShip(); - } - - void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest) - { - dest.setData((unsigned int*)src.getData(), src.getCount()); - dest.yieldOwnerShip(); - } - - void borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin) - { - transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getJointsPerVertex(), joints_per_vertex); - transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getWeightIndices(), weight_indices); - transfer_array_data((COLLADAFW::IntValuesArray&)skin->getJointIndices(), joint_indices); - // transfer_array_data(skin->getWeights(), weights); - - // cannot transfer data for FloatOrDoubleArray, copy values manually - const COLLADAFW::FloatOrDoubleArray& weight = skin->getWeights(); - for (unsigned int i = 0; i < weight.getValuesCount(); i++) - weights.push_back(get_float_value(weight, i)); - - unit_converter->dae_matrix_to_mat4(bind_shape_matrix, skin->getBindShapeMatrix()); - } - - void free() - { - joints_per_vertex.releaseMemory(); - weight_indices.releaseMemory(); - joint_indices.releaseMemory(); - // weights.releaseMemory(); - } - - // using inverse bind matrices to construct armature - // it is safe to invert them to get the original matrices - // because if they are inverse matrices, they can be inverted - void add_joint(const COLLADABU::Math::Matrix4& matrix) - { - JointData jd; - unit_converter->dae_matrix_to_mat4(jd.inv_bind_mat, matrix); - joint_data.push_back(jd); - } - - void set_controller(const COLLADAFW::SkinController* co) - { - controller_uid = co->getUniqueId(); - - // fill in joint UIDs - const COLLADAFW::UniqueIdArray& joint_uids = co->getJoints(); - for (unsigned int i = 0; i < joint_uids.getCount(); i++) { - joint_data[i].joint_uid = joint_uids[i]; - - // // store armature pointer - // JointData& jd = joint_index_to_joint_info_map[i]; - // jd.ob_arm = ob_arm; - - // now we'll be able to get inv bind matrix from joint id - // joint_id_to_joint_index_map[joint_ids[i]] = i; - } - } - - // called from write_controller - Object *create_armature(Scene *scene) - { - ob_arm = add_object(scene, OB_ARMATURE); - return ob_arm; - } - - Object* set_armature(Object *ob_arm) - { - if (this->ob_arm) - return this->ob_arm; - - this->ob_arm = ob_arm; - return ob_arm; - } - - bool get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node) - { - const COLLADAFW::UniqueId& uid = node->getUniqueId(); - std::vector::iterator it; - for (it = joint_data.begin(); it != joint_data.end(); it++) { - if ((*it).joint_uid == uid) { - copy_m4_m4(inv_bind_mat, (*it).inv_bind_mat); - return true; - } - } - - return false; - } - - Object *get_armature() - { - return ob_arm; - } - - const COLLADAFW::UniqueId& get_controller_uid() - { - return controller_uid; - } - - // check if this skin controller references a joint or any descendant of it - // - // some nodes may not be referenced by SkinController, - // in this case to determine if the node belongs to this armature, - // we need to search down the tree - bool uses_joint_or_descendant(COLLADAFW::Node *node) - { - const COLLADAFW::UniqueId& uid = node->getUniqueId(); - std::vector::iterator it; - for (it = joint_data.begin(); it != joint_data.end(); it++) { - if ((*it).joint_uid == uid) - return true; - } - - COLLADAFW::NodePointerArray& children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { - if (uses_joint_or_descendant(children[i])) - return true; - } - - return false; - } - - void link_armature(bContext *C, Object *ob, std::map& joint_by_uid, - TransformReader *tm) - { - Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); - - ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature); - ((ArmatureModifierData *)md)->object = ob_arm; - - copy_m4_m4(ob->obmat, bind_shape_matrix); - object_apply_mat4(ob, ob->obmat); -#if 1 - ::set_parent(ob, ob_arm, C); -#else - Object workob; - ob->parent = ob_arm; - ob->partype = PAROBJECT; - - what_does_parent(scene, ob, &workob); - invert_m4_m4(ob->parentinv, workob.obmat); - - ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA; - - DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); -#endif - - ((bArmature*)ob_arm->data)->deformflag = ARM_DEF_VGROUP; - - // create all vertex groups - std::vector::iterator it; - int joint_index; - for (it = joint_data.begin(), joint_index = 0; it != joint_data.end(); it++, joint_index++) { - const char *name = "Group"; - - // name group by joint node name - if (joint_by_uid.find((*it).joint_uid) != joint_by_uid.end()) { - name = get_joint_name(joint_by_uid[(*it).joint_uid]); - } - - ED_vgroup_add_name(ob, (char*)name); - } - - // - number of joints per vertex - joints_per_vertex - // - [[bone index, weight index] * joints per vertex] * vertices - weight indices - // ^ bone index can be -1 meaning weight toward bind shape, how to express this in Blender? - - // for each vertex in weight indices - // for each bone index in vertex - // add vertex to group at group index - // treat group index -1 specially - - // get def group by index with BLI_findlink - - for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) { - - unsigned int limit = weight + joints_per_vertex[vertex]; - for ( ; weight < limit; weight++) { - int joint = joint_indices[weight], joint_weight = weight_indices[weight]; - - // -1 means "weight towards the bind shape", we just don't assign it to any group - if (joint != -1) { - bDeformGroup *def = (bDeformGroup*)BLI_findlink(&ob->defbase, joint); - - ED_vgroup_vert_add(ob, def, vertex, weights[joint_weight], WEIGHT_REPLACE); - } - } - } - } - - bPoseChannel *get_pose_channel_from_node(COLLADAFW::Node *node) - { - return get_pose_channel(ob_arm->pose, get_joint_name(node)); - } - - void set_parent(Object *_parent) - { - parent = _parent; - } - - Object* get_parent() - { - return parent; - } - - void find_root_joints(const std::vector &root_joints, - std::map& joint_by_uid, - std::vector& result) - { - std::vector::const_iterator it; - for (it = root_joints.begin(); it != root_joints.end(); it++) { - COLLADAFW::Node *root = *it; - std::vector::iterator ji; - for (ji = joint_data.begin(); ji != joint_data.end(); ji++) { - COLLADAFW::Node *joint = joint_by_uid[(*ji).joint_uid]; - if (find_node_in_tree(joint, root)) { - if (std::find(result.begin(), result.end(), root) == result.end()) - result.push_back(root); - } - } - } - } - - bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root) - { - if (node == tree_root) - return true; - - COLLADAFW::NodePointerArray& children = tree_root->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { - if (find_node_in_tree(node, children[i])) - return true; - } - - return false; - } - - }; - - std::map skin_by_data_uid; // data UID = skin controller data UID -#if 0 - JointData *get_joint_data(COLLADAFW::Node *node) - { - const COLLADAFW::UniqueId& joint_id = node->getUniqueId(); - - if (joint_id_to_joint_index_map.find(joint_id) == joint_id_to_joint_index_map.end()) { - fprintf(stderr, "Cannot find a joint index by joint id for %s.\n", - node->getOriginalId().c_str()); - return NULL; - } - - int joint_index = joint_id_to_joint_index_map[joint_id]; - - return &joint_index_to_joint_info_map[joint_index]; - } -#endif - - void create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild, - float parent_mat[][4], bArmature *arm) - { - float joint_inv_bind_mat[4][4]; - - // JointData* jd = get_joint_data(node); - - float mat[4][4]; - - if (skin.get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) { - // get original world-space matrix - invert_m4_m4(mat, joint_inv_bind_mat); - } - // create a bone even if there's no joint data for it (i.e. it has no influence) - else { - float obmat[4][4]; - - // object-space - get_node_mat(obmat, node, NULL, NULL); - - // get world-space - if (parent) - mul_m4_m4m4(mat, obmat, parent_mat); - else - copy_m4_m4(mat, obmat); - } - - // TODO rename from Node "name" attrs later - EditBone *bone = ED_armature_edit_bone_add(arm, (char*)get_joint_name(node)); - totbone++; - - if (parent) bone->parent = parent; - - // set head - copy_v3_v3(bone->head, mat[3]); - - // set tail, don't set it to head because 0-length bones are not allowed - float vec[3] = {0.0f, 0.5f, 0.0f}; - add_v3_v3v3(bone->tail, bone->head, vec); - - // set parent tail - if (parent && totchild == 1) { - copy_v3_v3(parent->tail, bone->head); - - // not setting BONE_CONNECTED because this would lock child bone location with respect to parent - // bone->flag |= BONE_CONNECTED; - - // XXX increase this to prevent "very" small bones? - const float epsilon = 0.000001f; - - // derive leaf bone length - float length = len_v3v3(parent->head, parent->tail); - if ((length < leaf_bone_length || totbone == 0) && length > epsilon) { - leaf_bone_length = length; - } - - // treat zero-sized bone like a leaf bone - if (length <= epsilon) { - add_leaf_bone(parent_mat, parent); - } - - /* -#if 0 - // and which row in mat is bone direction - float vec[3]; - sub_v3_v3v3(vec, parent->tail, parent->head); -#ifdef COLLADA_DEBUG - print_v3("tail - head", vec); - print_m4("matrix", parent_mat); -#endif - for (int i = 0; i < 3; i++) { -#ifdef COLLADA_DEBUG - char *axis_names[] = {"X", "Y", "Z"}; - printf("%s-axis length is %f\n", axis_names[i], len_v3(parent_mat[i])); -#endif - float angle = angle_v2v2(vec, parent_mat[i]); - if (angle < min_angle) { -#ifdef COLLADA_DEBUG - print_v3("picking", parent_mat[i]); - printf("^ %s axis of %s's matrix\n", axis_names[i], get_dae_name(node)); -#endif - bone_direction_row = i; - min_angle = angle; - } - } -#endif - */ - } - - COLLADAFW::NodePointerArray& children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { - create_bone(skin, children[i], bone, children.getCount(), mat, arm); - } - - // in second case it's not a leaf bone, but we handle it the same way - if (!children.getCount() || children.getCount() > 1) { - add_leaf_bone(mat, bone); - } - } - - void add_leaf_bone(float mat[][4], EditBone *bone) - { - LeafBone leaf; - - leaf.bone = bone; - copy_m4_m4(leaf.mat, mat); - BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name)); - - leaf_bones.push_back(leaf); - } - - void fix_leaf_bones() - { - // just setting tail for leaf bones here - - std::vector::iterator it; - for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { - LeafBone& leaf = *it; - - // pointing up - float vec[3] = {0.0f, 0.0f, 1.0f}; - - mul_v3_fl(vec, leaf_bone_length); - - copy_v3_v3(leaf.bone->tail, leaf.bone->head); - add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); - } - } - - void set_leaf_bone_shapes(Object *ob_arm) - { - bPose *pose = ob_arm->pose; - - std::vector::iterator it; - for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { - LeafBone& leaf = *it; - - bPoseChannel *pchan = get_pose_channel(pose, leaf.name); - if (pchan) { - pchan->custom = get_empty_for_leaves(); - } - else { - fprintf(stderr, "Cannot find a pose channel for leaf bone %s\n", leaf.name); - } - } - } - -#if 0 - void set_euler_rotmode() - { - // just set rotmode = ROT_MODE_EUL on pose channel for each joint - - std::map::iterator it; - - for (it = joint_by_uid.begin(); it != joint_by_uid.end(); it++) { - - COLLADAFW::Node *joint = it->second; - - std::map::iterator sit; - - for (sit = skin_by_data_uid.begin(); sit != skin_by_data_uid.end(); sit++) { - SkinInfo& skin = sit->second; - - if (skin.uses_joint_or_descendant(joint)) { - bPoseChannel *pchan = skin.get_pose_channel_from_node(joint); - - if (pchan) { - pchan->rotmode = ROT_MODE_EUL; - } - else { - fprintf(stderr, "Cannot find pose channel for %s.\n", get_joint_name(joint)); - } - - break; - } - } - } - } -#endif - - Object *get_empty_for_leaves() - { - if (empty) return empty; - - empty = add_object(scene, OB_EMPTY); - empty->empty_drawtype = OB_EMPTY_SPHERE; - - return empty; - } - -#if 0 - Object *find_armature(COLLADAFW::Node *node) - { - JointData* jd = get_joint_data(node); - if (jd) return jd->ob_arm; - - COLLADAFW::NodePointerArray& children = node->getChildNodes(); - for (int i = 0; i < children.getCount(); i++) { - Object *ob_arm = find_armature(children[i]); - if (ob_arm) return ob_arm; - } - - return NULL; - } - - ArmatureJoints& get_armature_joints(Object *ob_arm) - { - // try finding it - std::vector::iterator it; - for (it = armature_joints.begin(); it != armature_joints.end(); it++) { - if ((*it).ob_arm == ob_arm) return *it; - } - - // not found, create one - ArmatureJoints aj; - aj.ob_arm = ob_arm; - armature_joints.push_back(aj); - - return armature_joints.back(); - } -#endif - - void create_armature_bones(SkinInfo& skin) - { - // just do like so: - // - get armature - // - enter editmode - // - add edit bones and head/tail properties using matrices and parent-child info - // - exit edit mode - // - set a sphere shape to leaf bones - - Object *ob_arm = NULL; - - /* - * find if there's another skin sharing at least one bone with this skin - * if so, use that skin's armature - */ - - /* - Pseudocode: - - find_node_in_tree(node, root_joint) - - skin::find_root_joints(root_joints): - std::vector root_joints; - for each root in root_joints: - for each joint in joints: - if find_node_in_tree(joint, root): - if (std::find(root_joints.begin(), root_joints.end(), root) == root_joints.end()) - root_joints.push_back(root); - - for (each skin B with armature) { - find all root joints for skin B - - for each joint X in skin A: - for each root joint R in skin B: - if (find_node_in_tree(X, R)) { - shared = 1; - goto endloop; - } - } - - endloop: - */ - - SkinInfo *a = &skin; - Object *shared = NULL; - std::vector skin_root_joints; - - std::map::iterator it; - for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { - SkinInfo *b = &it->second; - if (b == a || b->get_armature() == NULL) - continue; - - skin_root_joints.clear(); - - b->find_root_joints(root_joints, joint_by_uid, skin_root_joints); - - std::vector::iterator ri; - for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) { - if (a->uses_joint_or_descendant(*ri)) { - shared = b->get_armature(); - break; - } - } - - if (shared != NULL) - break; - } - - if (shared) - ob_arm = skin.set_armature(shared); - else - ob_arm = skin.create_armature(scene); - - // enter armature edit mode - ED_armature_to_edit(ob_arm); - - leaf_bones.clear(); - totbone = 0; - // bone_direction_row = 1; // TODO: don't default to Y but use asset and based on it decide on default row - leaf_bone_length = 0.1f; - // min_angle = 360.0f; // minimum angle between bone head-tail and a row of bone matrix - - // create bones - /* - TODO: - check if bones have already been created for a given joint - */ - - std::vector::iterator ri; - for (ri = root_joints.begin(); ri != root_joints.end(); ri++) { - // for shared armature check if bone tree is already created - if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), *ri) != skin_root_joints.end()) - continue; - - // since root_joints may contain joints for multiple controllers, we need to filter - if (skin.uses_joint_or_descendant(*ri)) { - create_bone(skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data); - - if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && !skin.get_parent()) - skin.set_parent(joint_parent_map[(*ri)->getUniqueId()]); - } - } - - fix_leaf_bones(); - - // exit armature edit mode - ED_armature_from_edit(ob_arm); - ED_armature_edit_free(ob_arm); - DAG_id_flush_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA); - - set_leaf_bone_shapes(ob_arm); - - // set_euler_rotmode(); - } - - -public: - - ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) : - TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {} - - ~ArmatureImporter() - { - // free skin controller data if we forget to do this earlier - std::map::iterator it; - for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { - it->second.free(); - } - } - - // root - if this joint is the top joint in hierarchy, if a joint - // is a child of a node (not joint), root should be true since - // this is where we build armature bones from - void add_joint(COLLADAFW::Node *node, bool root, Object *parent) - { - joint_by_uid[node->getUniqueId()] = node; - if (root) { - root_joints.push_back(node); - - if (parent) - joint_parent_map[node->getUniqueId()] = parent; - } - } - -#if 0 - void add_root_joint(COLLADAFW::Node *node) - { - // root_joints.push_back(node); - Object *ob_arm = find_armature(node); - if (ob_arm) { - get_armature_joints(ob_arm).root_joints.push_back(node); - } -#ifdef COLLADA_DEBUG - else { - fprintf(stderr, "%s cannot be added to armature.\n", get_joint_name(node)); - } -#endif - } -#endif - - // here we add bones to armatures, having armatures previously created in write_controller - void make_armatures(bContext *C) - { - std::map::iterator it; - for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { - - SkinInfo& skin = it->second; - - create_armature_bones(skin); - - // link armature with a mesh object - Object *ob = mesh_importer->get_object_by_geom_uid(*get_geometry_uid(skin.get_controller_uid())); - if (ob) - skin.link_armature(C, ob, joint_by_uid, this); - else - fprintf(stderr, "Cannot find object to link armature with.\n"); - - // set armature parent if any - Object *par = skin.get_parent(); - if (par) - set_parent(skin.get_armature(), par, C, false); - - // free memory stolen from SkinControllerData - skin.free(); - } - } - -#if 0 - // link with meshes, create vertex groups, assign weights - void link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id) - { - Object *ob = mesh_importer->get_object_by_geom_uid(geom_id); - - if (!ob) { - fprintf(stderr, "Cannot find object by geometry UID.\n"); - return; - } - - if (skin_by_data_uid.find(controller_data_id) == skin_by_data_uid.end()) { - fprintf(stderr, "Cannot find skin info by controller data UID.\n"); - return; - } - - SkinInfo& skin = skin_by_data_uid[conroller_data_id]; - - // create vertex groups - } -#endif - - bool write_skin_controller_data(const COLLADAFW::SkinControllerData* data) - { - // at this stage we get vertex influence info that should go into me->verts and ob->defbase - // there's no info to which object this should be long so we associate it with skin controller data UID - - // don't forget to call defgroup_unique_name before we copy - - // controller data uid -> [armature] -> joint data, - // [mesh object] - // - - SkinInfo skin(unit_converter); - skin.borrow_skin_controller_data(data); - - // store join inv bind matrix to use it later in armature construction - const COLLADAFW::Matrix4Array& inv_bind_mats = data->getInverseBindMatrices(); - for (unsigned int i = 0; i < data->getJointsCount(); i++) { - skin.add_joint(inv_bind_mats[i]); - } - - skin_by_data_uid[data->getUniqueId()] = skin; - - return true; - } - - bool write_controller(const COLLADAFW::Controller* controller) - { - // - create and store armature object - - const COLLADAFW::UniqueId& skin_id = controller->getUniqueId(); - - if (controller->getControllerType() == COLLADAFW::Controller::CONTROLLER_TYPE_SKIN) { - COLLADAFW::SkinController *co = (COLLADAFW::SkinController*)controller; - // to be able to find geom id by controller id - geom_uid_by_controller_uid[skin_id] = co->getSource(); - - const COLLADAFW::UniqueId& data_uid = co->getSkinControllerData(); - if (skin_by_data_uid.find(data_uid) == skin_by_data_uid.end()) { - fprintf(stderr, "Cannot find skin by controller data UID.\n"); - return true; - } - - skin_by_data_uid[data_uid].set_controller(co); - } - // morph controller - else { - // shape keys? :) - fprintf(stderr, "Morph controller is not supported yet.\n"); - } - - return true; - } - - COLLADAFW::UniqueId *get_geometry_uid(const COLLADAFW::UniqueId& controller_uid) - { - if (geom_uid_by_controller_uid.find(controller_uid) == geom_uid_by_controller_uid.end()) - return NULL; - - return &geom_uid_by_controller_uid[controller_uid]; - } - - Object *get_armature_for_joint(COLLADAFW::Node *node) - { - std::map::iterator it; - for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { - SkinInfo& skin = it->second; - - if (skin.uses_joint_or_descendant(node)) - return skin.get_armature(); - } - - return NULL; - } - - void get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count) - { - BLI_snprintf(joint_path, count, "pose.bones[\"%s\"]", get_joint_name(node)); - } - - // gives a world-space mat - bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint) - { - std::map::iterator it; - bool found = false; - for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { - SkinInfo& skin = it->second; - if ((found = skin.get_joint_inv_bind_matrix(m, joint))) { - invert_m4(m); - break; - } - } - - return found; - } -}; - -class MeshImporter : public MeshImporterBase -{ -private: - - Scene *scene; - ArmatureImporter *armature_importer; - - std::map uid_mesh_map; // geometry unique id-to-mesh map - std::map uid_object_map; // geom uid-to-object - // this structure is used to assign material indices to faces - // it holds a portion of Mesh faces and corresponds to a DAE primitive list (, , etc.) - struct Primitive { - MFace *mface; - unsigned int totface; - }; - typedef std::map > MaterialIdPrimitiveArrayMap; - std::map geom_uid_mat_mapping_map; // crazy name! - - class UVDataWrapper - { - COLLADAFW::MeshVertexData *mVData; - public: - UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata) - {} - -#ifdef COLLADA_DEBUG - void print() - { - fprintf(stderr, "UVs:\n"); - switch(mVData->getType()) { - case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: - { - COLLADAFW::ArrayPrimitiveType* values = mVData->getFloatValues(); - if (values->getCount()) { - for (int i = 0; i < values->getCount(); i += 2) { - fprintf(stderr, "%.1f, %.1f\n", (*values)[i], (*values)[i+1]); - } - } - } - break; - case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: - { - COLLADAFW::ArrayPrimitiveType* values = mVData->getDoubleValues(); - if (values->getCount()) { - for (int i = 0; i < values->getCount(); i += 2) { - fprintf(stderr, "%.1f, %.1f\n", (float)(*values)[i], (float)(*values)[i+1]); - } - } - } - break; - } - fprintf(stderr, "\n"); - } -#endif - - void getUV(int uv_index[2], float *uv) - { - switch(mVData->getType()) { - case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: - { - COLLADAFW::ArrayPrimitiveType* values = mVData->getFloatValues(); - if (values->empty()) return; - uv[0] = (*values)[uv_index[0]]; - uv[1] = (*values)[uv_index[1]]; - - } - break; - case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: - { - COLLADAFW::ArrayPrimitiveType* values = mVData->getDoubleValues(); - if (values->empty()) return; - uv[0] = (float)(*values)[uv_index[0]]; - uv[1] = (float)(*values)[uv_index[1]]; - - } - break; - case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN: - default: - fprintf(stderr, "MeshImporter.getUV(): unknown data type\n"); - } - } - }; - - void set_face_indices(MFace *mface, unsigned int *indices, bool quad) - { - mface->v1 = indices[0]; - mface->v2 = indices[1]; - mface->v3 = indices[2]; - if (quad) mface->v4 = indices[3]; - else mface->v4 = 0; -#ifdef COLLADA_DEBUG - // fprintf(stderr, "%u, %u, %u \n", indices[0], indices[1], indices[2]); -#endif - } - - // not used anymore, test_index_face from blenkernel is better -#if 0 - // change face indices order so that v4 is not 0 - void rotate_face_indices(MFace *mface) { - mface->v4 = mface->v1; - mface->v1 = mface->v2; - mface->v2 = mface->v3; - mface->v3 = 0; - } -#endif - - void set_face_uv(MTFace *mtface, UVDataWrapper &uvs, - COLLADAFW::IndexList& index_list, unsigned int *tris_indices) - { - int uv_indices[4][2]; - - // per face vertex indices, this means for quad we have 4 indices, not 8 - COLLADAFW::UIntValuesArray& indices = index_list.getIndices(); - - // make indices into FloatOrDoubleArray - for (int i = 0; i < 3; i++) { - int uv_index = indices[tris_indices[i]]; - uv_indices[i][0] = uv_index * 2; - uv_indices[i][1] = uv_index * 2 + 1; - } - - uvs.getUV(uv_indices[0], mtface->uv[0]); - uvs.getUV(uv_indices[1], mtface->uv[1]); - uvs.getUV(uv_indices[2], mtface->uv[2]); - } - - void set_face_uv(MTFace *mtface, UVDataWrapper &uvs, - COLLADAFW::IndexList& index_list, int index, bool quad) - { - int uv_indices[4][2]; - - // per face vertex indices, this means for quad we have 4 indices, not 8 - COLLADAFW::UIntValuesArray& indices = index_list.getIndices(); - - // make indices into FloatOrDoubleArray - for (int i = 0; i < (quad ? 4 : 3); i++) { - int uv_index = indices[index + i]; - uv_indices[i][0] = uv_index * 2; - uv_indices[i][1] = uv_index * 2 + 1; - } - - uvs.getUV(uv_indices[0], mtface->uv[0]); - uvs.getUV(uv_indices[1], mtface->uv[1]); - uvs.getUV(uv_indices[2], mtface->uv[2]); - - if (quad) uvs.getUV(uv_indices[3], mtface->uv[3]); - -#ifdef COLLADA_DEBUG - /*if (quad) { - fprintf(stderr, "face uv:\n" - "((%d, %d), (%d, %d), (%d, %d), (%d, %d))\n" - "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", - - uv_indices[0][0], uv_indices[0][1], - uv_indices[1][0], uv_indices[1][1], - uv_indices[2][0], uv_indices[2][1], - uv_indices[3][0], uv_indices[3][1], - - mtface->uv[0][0], mtface->uv[0][1], - mtface->uv[1][0], mtface->uv[1][1], - mtface->uv[2][0], mtface->uv[2][1], - mtface->uv[3][0], mtface->uv[3][1]); - } - else { - fprintf(stderr, "face uv:\n" - "((%d, %d), (%d, %d), (%d, %d))\n" - "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", - - uv_indices[0][0], uv_indices[0][1], - uv_indices[1][0], uv_indices[1][1], - uv_indices[2][0], uv_indices[2][1], - - mtface->uv[0][0], mtface->uv[0][1], - mtface->uv[1][0], mtface->uv[1][1], - mtface->uv[2][0], mtface->uv[2][1]); - }*/ -#endif - } - -#ifdef COLLADA_DEBUG - void print_index_list(COLLADAFW::IndexList& index_list) - { - fprintf(stderr, "Index list for \"%s\":\n", index_list.getName().c_str()); - for (int i = 0; i < index_list.getIndicesCount(); i += 2) { - fprintf(stderr, "%u, %u\n", index_list.getIndex(i), index_list.getIndex(i + 1)); - } - fprintf(stderr, "\n"); - } -#endif - - bool is_nice_mesh(COLLADAFW::Mesh *mesh) - { - COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); - - const char *name = get_dae_name(mesh); - - for (unsigned i = 0; i < prim_arr.getCount(); i++) { - - COLLADAFW::MeshPrimitive *mp = prim_arr[i]; - COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType(); - - const char *type_str = primTypeToStr(type); - - // OpenCollada passes POLYGONS type for - if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) { - - COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; - COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray(); - - for(unsigned int j = 0; j < vca.getCount(); j++){ - int count = vca[j]; - if (count < 3) { - fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n", - type_str, name); - return false; - } - } - - } - else if(type != COLLADAFW::MeshPrimitive::TRIANGLES) { - fprintf(stderr, "Primitive type %s is not supported.\n", type_str); - return false; - } - } - - if (mesh->getPositions().empty()) { - fprintf(stderr, "Mesh %s has no vertices.\n", name); - return false; - } - - return true; - } - - void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) - { - // vertices - me->totvert = mesh->getPositions().getFloatValues()->getCount() / 3; - me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert); - - COLLADAFW::MeshVertexData& pos = mesh->getPositions(); - MVert *mvert; - int i; - - for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) - get_vector(mvert->co, pos, i); - } - - int triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector& tri) - { - ListBase dispbase; - DispList *dl; - float *vert; - int i = 0; - - dispbase.first = dispbase.last = NULL; - - dl = (DispList*)MEM_callocN(sizeof(DispList), "poly disp"); - dl->nr = totvert; - dl->type = DL_POLY; - dl->parts = 1; - dl->verts = vert = (float*)MEM_callocN(totvert * 3 * sizeof(float), "poly verts"); - dl->index = (int*)MEM_callocN(sizeof(int) * 3 * totvert, "dl index"); - - BLI_addtail(&dispbase, dl); - - for (i = 0; i < totvert; i++) { - copy_v3_v3(vert, verts[indices[i]].co); - vert += 3; - } - - filldisplist(&dispbase, &dispbase, 0); - - int tottri = 0; - dl= (DispList*)dispbase.first; - - if (dl->type == DL_INDEX3) { - tottri = dl->parts; - - int *index = dl->index; - for (i= 0; i < tottri; i++) { - int t[3]= {*index, *(index + 1), *(index + 2)}; - - std::sort(t, t + 3); - - tri.push_back(t[0]); - tri.push_back(t[1]); - tri.push_back(t[2]); - - index += 3; - } - } - - freedisplist(&dispbase); - - return tottri; - } - - int count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me) - { - COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); - unsigned int i; - int tottri = 0; - - for (i = 0; i < prim_arr.getCount(); i++) { - - COLLADAFW::MeshPrimitive *mp = prim_arr[i]; - int type = mp->getPrimitiveType(); - size_t prim_totface = mp->getFaceCount(); - unsigned int *indices = mp->getPositionIndices().getData(); - - if (type == COLLADAFW::MeshPrimitive::POLYLIST || - type == COLLADAFW::MeshPrimitive::POLYGONS) { - - COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; - COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray(); - - for (unsigned int j = 0; j < prim_totface; j++) { - int vcount = vcounta[j]; - - if (vcount > 4) { - std::vector tri; - - // tottri += triangulate_poly(indices, vcount, me->mvert, tri) - 1; // XXX why - 1?! - tottri += triangulate_poly(indices, vcount, me->mvert, tri); - } - - indices += vcount; - } - } - } - return tottri; - } - - // TODO: import uv set names - void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) - { - unsigned int i; - - // allocate faces - me->totface = mesh->getFacesCount() + new_tris; - me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface); - - // allocate UV layers - unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount(); - - for (i = 0; i < totuvset; i++) { - if (mesh->getUVCoords().getLength(i) == 0) { - totuvset = 0; - break; - } - } - - for (i = 0; i < totuvset; i++) { - COLLADAFW::MeshVertexData::InputInfos *info = mesh->getUVCoords().getInputInfosArray()[i]; - CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface, info->mName.c_str()); - //this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i); - } - - // activate the first uv layer - if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0); - - UVDataWrapper uvs(mesh->getUVCoords()); - -#ifdef COLLADA_DEBUG - // uvs.print(); -#endif - - MFace *mface = me->mface; - - MaterialIdPrimitiveArrayMap mat_prim_map; - - int face_index = 0; - - COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); - - bool has_normals = mesh->hasNormals(); - COLLADAFW::MeshVertexData& nor = mesh->getNormals(); - - for (i = 0; i < prim_arr.getCount(); i++) { - - COLLADAFW::MeshPrimitive *mp = prim_arr[i]; - - // faces - size_t prim_totface = mp->getFaceCount(); - unsigned int *indices = mp->getPositionIndices().getData(); - unsigned int *nind = mp->getNormalIndices().getData(); - unsigned int j, k; - int type = mp->getPrimitiveType(); - int index = 0; - - // since we cannot set mface->mat_nr here, we store a portion of me->mface in Primitive - Primitive prim = {mface, 0}; - COLLADAFW::IndexListArray& index_list_array = mp->getUVCoordIndicesArray(); - -#ifdef COLLADA_DEBUG - /* - fprintf(stderr, "Primitive %d:\n", i); - for (int j = 0; j < totuvset; j++) { - print_index_list(*index_list_array[j]); - } - */ -#endif - - if (type == COLLADAFW::MeshPrimitive::TRIANGLES) { - for (j = 0; j < prim_totface; j++){ - - set_face_indices(mface, indices, false); - indices += 3; - -#if 0 - for (k = 0; k < totuvset; k++) { - if (!index_list_array.empty() && index_list_array[k]) { - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); - set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, false); - } - } -#else - for (k = 0; k < index_list_array.getCount(); k++) { - int uvset_index = index_list_array[k]->getSetIndex(); - - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); - set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, false); - } -#endif - - test_index_face(mface, &me->fdata, face_index, 3); - - if (has_normals) { - if (!flat_face(nind, nor, 3)) - mface->flag |= ME_SMOOTH; - - nind += 3; - } - - index += 3; - mface++; - face_index++; - prim.totface++; - } - } - else if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) { - COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; - COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray(); - - for (j = 0; j < prim_totface; j++) { - - // face - int vcount = vcounta[j]; - if (vcount == 3 || vcount == 4) { - - set_face_indices(mface, indices, vcount == 4); - - // set mtface for each uv set - // it is assumed that all primitives have equal number of UV sets - -#if 0 - for (k = 0; k < totuvset; k++) { - if (!index_list_array.empty() && index_list_array[k]) { - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); - set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, mface->v4 != 0); - } - } -#else - for (k = 0; k < index_list_array.getCount(); k++) { - int uvset_index = index_list_array[k]->getSetIndex(); - - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); - set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0); - } -#endif - - test_index_face(mface, &me->fdata, face_index, vcount); - - if (has_normals) { - if (!flat_face(nind, nor, vcount)) - mface->flag |= ME_SMOOTH; - - nind += vcount; - } - - mface++; - face_index++; - prim.totface++; - - } - else { - std::vector tri; - - triangulate_poly(indices, vcount, me->mvert, tri); - - for (k = 0; k < tri.size() / 3; k++) { - int v = k * 3; - unsigned int uv_indices[3] = { - index + tri[v], - index + tri[v + 1], - index + tri[v + 2] - }; - unsigned int tri_indices[3] = { - indices[tri[v]], - indices[tri[v + 1]], - indices[tri[v + 2]] - }; - - set_face_indices(mface, tri_indices, false); - -#if 0 - for (unsigned int l = 0; l < totuvset; l++) { - if (!index_list_array.empty() && index_list_array[l]) { - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l); - set_face_uv(&mtface[face_index], uvs, l, *index_list_array[l], uv_indices); - } - } -#else - for (unsigned int l = 0; l < index_list_array.getCount(); l++) { - int uvset_index = index_list_array[l]->getSetIndex(); - - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); - set_face_uv(&mtface[face_index], uvs, *index_list_array[l], uv_indices); - } -#endif - - - test_index_face(mface, &me->fdata, face_index, 3); - - if (has_normals) { - unsigned int ntri[3] = {nind[tri[v]], nind[tri[v + 1]], nind[tri[v + 2]]}; - - if (!flat_face(ntri, nor, 3)) - mface->flag |= ME_SMOOTH; - } - - mface++; - face_index++; - prim.totface++; - } - - if (has_normals) - nind += vcount; - } - - index += vcount; - indices += vcount; - } - } - - mat_prim_map[mp->getMaterialId()].push_back(prim); - } - - geom_uid_mat_mapping_map[mesh->getUniqueId()] = mat_prim_map; - } - - void get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i) - { - i *= 3; - - switch(arr.getType()) { - case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: - { - COLLADAFW::ArrayPrimitiveType* values = arr.getFloatValues(); - if (values->empty()) return; - - v[0] = (*values)[i++]; - v[1] = (*values)[i++]; - v[2] = (*values)[i]; - } - break; - case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: - { - COLLADAFW::ArrayPrimitiveType* values = arr.getDoubleValues(); - if (values->empty()) return; - - v[0] = (float)(*values)[i++]; - v[1] = (float)(*values)[i++]; - v[2] = (float)(*values)[i]; - } - break; - default: - break; - } - } - - bool flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count) - { - float a[3], b[3]; - - get_vector(a, nor, *nind); - normalize_v3(a); - - nind++; - - for (int i = 1; i < count; i++, nind++) { - get_vector(b, nor, *nind); - normalize_v3(b); - - float dp = dot_v3v3(a, b); - - if (dp < 0.99999f || dp > 1.00001f) - return false; - } - - return true; - } - -public: - - MeshImporter(ArmatureImporter *arm, Scene *sce) : scene(sce), armature_importer(arm) {} - - virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) - { - if (uid_object_map.find(geom_uid) != uid_object_map.end()) - return uid_object_map[geom_uid]; - return NULL; - } - - MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture, - Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map, - MTex *color_texture) - { - const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId(); - const size_t setindex = ctexture.getSetIndex(); - std::string uvname = ctexture.getName(); - - const CustomData *data = &me->fdata; - int layer_index = CustomData_get_layer_index(data, CD_MTFACE); - CustomDataLayer *cdl = &data->layers[layer_index+setindex]; - - /* set uvname to bind_vertex_input semantic */ - BLI_strncpy(cdl->name, uvname.c_str(), sizeof(cdl->name)); - - if (texindex_texarray_map.find(texture_index) == texindex_texarray_map.end()) { - - fprintf(stderr, "Cannot find texture array by texture index.\n"); - return color_texture; - } - - std::vector textures = texindex_texarray_map[texture_index]; - - std::vector::iterator it; - - for (it = textures.begin(); it != textures.end(); it++) { - - MTex *texture = *it; - - if (texture) { - BLI_strncpy(texture->uvname, uvname.c_str(), sizeof(texture->uvname)); - if (texture->mapto == MAP_COL) color_texture = texture; - } - } - return color_texture; - } - - MTFace *assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, - std::map& uid_material_map, - Object *ob, const COLLADAFW::UniqueId *geom_uid, - MTex **color_texture, char *layername, MTFace *texture_face, - std::map& material_texture_mapping_map, int mat_index) - { - Mesh *me = (Mesh*)ob->data; - const COLLADAFW::UniqueId& ma_uid = cmaterial.getReferencedMaterial(); - - // do we know this material? - if (uid_material_map.find(ma_uid) == uid_material_map.end()) { - - fprintf(stderr, "Cannot find material by UID.\n"); - return NULL; - } - - Material *ma = uid_material_map[ma_uid]; - assign_material(ob, ma, ob->totcol + 1); - - COLLADAFW::TextureCoordinateBindingArray& tex_array = - cmaterial.getTextureCoordinateBindingArray(); - TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma]; - unsigned int i; - // loop through - for (i = 0; i < tex_array.getCount(); i++) { - - *color_texture = assign_textures_to_uvlayer(tex_array[i], me, texindex_texarray_map, - *color_texture); - } - - // set texture face - if (*color_texture && - strlen((*color_texture)->uvname) && - strcmp(layername, (*color_texture)->uvname) != 0) { - - texture_face = (MTFace*)CustomData_get_layer_named(&me->fdata, CD_MTFACE, - (*color_texture)->uvname); - strcpy(layername, (*color_texture)->uvname); - } - - MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid]; - COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId(); - - // assign material indices to mesh faces - if (mat_prim_map.find(mat_id) != mat_prim_map.end()) { - - std::vector& prims = mat_prim_map[mat_id]; - - std::vector::iterator it; - - for (it = prims.begin(); it != prims.end(); it++) { - Primitive& prim = *it; - i = 0; - while (i++ < prim.totface) { - prim.mface->mat_nr = mat_index; - prim.mface++; - // bind texture images to faces - if (texture_face && (*color_texture)) { - texture_face->mode = TF_TEX; - texture_face->tpage = (Image*)(*color_texture)->tex->ima; - texture_face++; - } - } - } - } - - return texture_face; - } - - - Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom, - bool isController, - std::map& uid_material_map, - std::map& material_texture_mapping_map) - { - const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId(); - - // check if node instanciates controller or geometry - if (isController) { - - geom_uid = armature_importer->get_geometry_uid(*geom_uid); - - if (!geom_uid) { - fprintf(stderr, "Couldn't find a mesh UID by controller's UID.\n"); - return NULL; - } - } - else { - - if (uid_mesh_map.find(*geom_uid) == uid_mesh_map.end()) { - // this could happen if a mesh was not created - // (e.g. if it contains unsupported geometry) - fprintf(stderr, "Couldn't find a mesh by UID.\n"); - return NULL; - } - } - if (!uid_mesh_map[*geom_uid]) return NULL; - - Object *ob = add_object(scene, OB_MESH); - - // store object pointer for ArmatureImporter - uid_object_map[*geom_uid] = ob; - - // name Object - const std::string& id = node->getOriginalId(); - if (id.length()) - rename_id(&ob->id, (char*)id.c_str()); - - // replace ob->data freeing the old one - Mesh *old_mesh = (Mesh*)ob->data; - - set_mesh(ob, uid_mesh_map[*geom_uid]); - - if (old_mesh->id.us == 0) free_libblock(&G.main->mesh, old_mesh); - - char layername[100]; - MTFace *texture_face = NULL; - MTex *color_texture = NULL; - - COLLADAFW::MaterialBindingArray& mat_array = - geom->getMaterialBindings(); - - // loop through geom's materials - for (unsigned int i = 0; i < mat_array.getCount(); i++) { - - texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid, - &color_texture, layername, texture_face, - material_texture_mapping_map, i); - } - - return ob; - } - - // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID - bool write_geometry(const COLLADAFW::Geometry* geom) - { - // TODO: import also uvs, normals - // XXX what to do with normal indices? - // XXX num_normals may be != num verts, then what to do? - - // check geometry->getType() first - if (geom->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH) { - // TODO: report warning - fprintf(stderr, "Mesh type %s is not supported\n", geomTypeToStr(geom->getType())); - return true; - } - - COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh*)geom; - - if (!is_nice_mesh(mesh)) { - fprintf(stderr, "Ignoring mesh %s\n", get_dae_name(mesh)); - return true; - } - - const std::string& str_geom_id = mesh->getOriginalId(); - Mesh *me = add_mesh((char*)str_geom_id.c_str()); - - // store the Mesh pointer to link it later with an Object - this->uid_mesh_map[mesh->getUniqueId()] = me; - - int new_tris = 0; - - read_vertices(mesh, me); - - new_tris = count_new_tris(mesh, me); - - read_faces(mesh, me, new_tris); - - make_edges(me, 0); - - mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); - - return true; - } - -}; - -class AnimationImporter : private TransformReader, public AnimationImporterBase -{ -private: - - ArmatureImporter *armature_importer; - Scene *scene; - - std::map > curve_map; - std::map uid_animated_map; - // std::map > fcurves_actionGroup_map; - std::map animlist_map; - std::vector unused_curves; - std::map joint_objects; - - FCurve *create_fcurve(int array_index, const char *rna_path) - { - FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); - - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); - fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path)); - fcu->array_index = array_index; - return fcu; - } - - void create_bezt(FCurve *fcu, float frame, float output) - { - BezTriple bez; - memset(&bez, 0, sizeof(BezTriple)); - bez.vec[1][0] = frame; - bez.vec[1][1] = output; - bez.ipo = U.ipo_new; /* use default interpolation mode here... */ - bez.f1 = bez.f2 = bez.f3 = SELECT; - bez.h1 = bez.h2 = HD_AUTO; - insert_bezt_fcurve(fcu, &bez, 0); - calchandles_fcurve(fcu); - } - - // create one or several fcurves depending on the number of parameters being animated - void animation_to_fcurves(COLLADAFW::AnimationCurve *curve) - { - COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues(); - COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues(); - // COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); - // COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); - float fps = (float)FPS; - size_t dim = curve->getOutDimension(); - unsigned int i; - - std::vector& fcurves = curve_map[curve->getUniqueId()]; - - switch (dim) { - case 1: // X, Y, Z or angle - case 3: // XYZ - case 16: // matrix - { - for (i = 0; i < dim; i++ ) { - FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); - - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); - // fcu->rna_path = BLI_strdupn(path, strlen(path)); - fcu->array_index = 0; - //fcu->totvert = curve->getKeyCount(); - - // create beztriple for each key - for (unsigned int j = 0; j < curve->getKeyCount(); j++) { - BezTriple bez; - memset(&bez, 0, sizeof(BezTriple)); - - // intangent - // bez.vec[0][0] = get_float_value(intan, j * 6 + i + i) * fps; - // bez.vec[0][1] = get_float_value(intan, j * 6 + i + i + 1); - - // input, output - bez.vec[1][0] = get_float_value(input, j) * fps; - bez.vec[1][1] = get_float_value(output, j * dim + i); - - // outtangent - // bez.vec[2][0] = get_float_value(outtan, j * 6 + i + i) * fps; - // bez.vec[2][1] = get_float_value(outtan, j * 6 + i + i + 1); - - bez.ipo = U.ipo_new; /* use default interpolation mode here... */ - bez.f1 = bez.f2 = bez.f3 = SELECT; - bez.h1 = bez.h2 = HD_AUTO; - insert_bezt_fcurve(fcu, &bez, 0); - } - - calchandles_fcurve(fcu); - - fcurves.push_back(fcu); - } - } - break; - default: - fprintf(stderr, "Output dimension of %d is not yet supported (animation id = %s)\n", dim, curve->getOriginalId().c_str()); - } - - for (std::vector::iterator it = fcurves.begin(); it != fcurves.end(); it++) - unused_curves.push_back(*it); - } - - void fcurve_deg_to_rad(FCurve *cu) - { - for (unsigned int i = 0; i < cu->totvert; i++) { - // TODO convert handles too - cu->bezt[i].vec[1][1] *= M_PI / 180.0f; - } - } - - void add_fcurves_to_object(Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated) - { - bAction *act; - - if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1); - else act = ob->adt->action; - - std::vector::iterator it; - int i; - -#if 0 - char *p = strstr(rna_path, "rotation_euler"); - bool is_rotation = p && *(p + strlen("rotation_euler")) == '\0'; - - // convert degrees to radians for rotation - if (is_rotation) - fcurve_deg_to_rad(fcu); -#endif - - for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) { - FCurve *fcu = *it; - fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path)); - - if (array_index == -1) fcu->array_index = i; - else fcu->array_index = array_index; - - if (ob->type == OB_ARMATURE) { - bActionGroup *grp = NULL; - const char *bone_name = get_joint_name(animated->node); - - if (bone_name) { - /* try to find group */ - grp = action_groups_find_named(act, bone_name); - - /* no matching groups, so add one */ - if (grp == NULL) { - /* Add a new group, and make it active */ - grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); - - grp->flag = AGRP_SELECTED; - BLI_strncpy(grp->name, bone_name, sizeof(grp->name)); - - BLI_addtail(&act->groups, grp); - BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64); - } - - /* add F-Curve to group */ - action_groups_add_channel(act, grp, fcu); - - } -#if 0 - if (is_rotation) { - fcurves_actionGroup_map[grp].push_back(fcu); - } -#endif - } - else { - BLI_addtail(&act->curves, fcu); - } - - // curve is used, so remove it from unused_curves - unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end()); - } - } -public: - - AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) : - TransformReader(conv), armature_importer(arm), scene(scene) { } - - ~AnimationImporter() - { - // free unused FCurves - for (std::vector::iterator it = unused_curves.begin(); it != unused_curves.end(); it++) - free_fcurve(*it); - - if (unused_curves.size()) - fprintf(stderr, "removed %u unused curves\n", unused_curves.size()); - } - - bool write_animation(const COLLADAFW::Animation* anim) - { - if (anim->getAnimationType() == COLLADAFW::Animation::ANIMATION_CURVE) { - COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve*)anim; - - // XXX Don't know if it's necessary - // Should we check outPhysicalDimension? - if (curve->getInPhysicalDimension() != COLLADAFW::PHYSICAL_DIMENSION_TIME) { - fprintf(stderr, "Inputs physical dimension is not time. \n"); - return true; - } - - // a curve can have mixed interpolation type, - // in this case curve->getInterpolationTypes returns a list of interpolation types per key - COLLADAFW::AnimationCurve::InterpolationType interp = curve->getInterpolationType(); - - if (interp != COLLADAFW::AnimationCurve::INTERPOLATION_MIXED) { - switch (interp) { - case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR: - case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER: - animation_to_fcurves(curve); - break; - default: - // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types - fprintf(stderr, "CARDINAL, HERMITE, BSPLINE and STEP anim interpolation types not supported yet.\n"); - break; - } - } - else { - // not supported yet - fprintf(stderr, "MIXED anim interpolation type is not supported yet.\n"); - } - } - else { - fprintf(stderr, "FORMULA animation type is not supported yet.\n"); - } - - return true; - } - - // called on post-process stage after writeVisualScenes - bool write_animation_list(const COLLADAFW::AnimationList* animlist) - { - const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId(); - - animlist_map[animlist_id] = animlist; - -#if 0 - // should not happen - if (uid_animated_map.find(animlist_id) == uid_animated_map.end()) { - return true; - } - - // for bones rna_path is like: pose.bones["bone-name"].rotation - - // what does this AnimationList animate? - Animation& animated = uid_animated_map[animlist_id]; - Object *ob = animated.ob; - - char rna_path[100]; - char joint_path[100]; - bool is_joint = false; - - // if ob is NULL, it should be a JOINT - if (!ob) { - ob = armature_importer->get_armature_for_joint(animated.node); - - if (!ob) { - fprintf(stderr, "Cannot find armature for node %s\n", get_joint_name(animated.node)); - return true; - } - - armature_importer->get_rna_path_for_joint(animated.node, joint_path, sizeof(joint_path)); - - is_joint = true; - } - - const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); - - switch (animated.tm->getTransformationType()) { - case COLLADAFW::Transformation::TRANSLATE: - case COLLADAFW::Transformation::SCALE: - { - bool loc = animated.tm->getTransformationType() == COLLADAFW::Transformation::TRANSLATE; - if (is_joint) - BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale"); - else - BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path)); - - for (int i = 0; i < bindings.getCount(); i++) { - const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i]; - COLLADAFW::UniqueId anim_uid = binding.animation; - - if (curve_map.find(anim_uid) == curve_map.end()) { - fprintf(stderr, "Cannot find FCurve by animation UID.\n"); - continue; - } - - std::vector& fcurves = curve_map[anim_uid]; - - switch (binding.animationClass) { - case COLLADAFW::AnimationList::POSITION_X: - add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated); - break; - case COLLADAFW::AnimationList::POSITION_Y: - add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated); - break; - case COLLADAFW::AnimationList::POSITION_Z: - add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated); - break; - case COLLADAFW::AnimationList::POSITION_XYZ: - add_fcurves_to_object(ob, fcurves, rna_path, -1, &animated); - break; - default: - fprintf(stderr, "AnimationClass %d is not supported for %s.\n", - binding.animationClass, loc ? "TRANSLATE" : "SCALE"); - } - } - } - break; - case COLLADAFW::Transformation::ROTATE: - { - if (is_joint) - BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path); - else - BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path)); - - COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)animated.tm; - COLLADABU::Math::Vector3& axis = rot->getRotationAxis(); - - for (int i = 0; i < bindings.getCount(); i++) { - const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i]; - COLLADAFW::UniqueId anim_uid = binding.animation; - - if (curve_map.find(anim_uid) == curve_map.end()) { - fprintf(stderr, "Cannot find FCurve by animation UID.\n"); - continue; - } - - std::vector& fcurves = curve_map[anim_uid]; - - switch (binding.animationClass) { - case COLLADAFW::AnimationList::ANGLE: - if (COLLADABU::Math::Vector3::UNIT_X == axis) { - add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated); - } - else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { - add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated); - } - else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { - add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated); - } - break; - case COLLADAFW::AnimationList::AXISANGLE: - // TODO convert axis-angle to quat? or XYZ? - default: - fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n", - binding.animationClass); - } - } - } - break; - case COLLADAFW::Transformation::MATRIX: - case COLLADAFW::Transformation::SKEW: - case COLLADAFW::Transformation::LOOKAT: - fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n"); - break; - } -#endif - - return true; - } - - void read_node_transform(COLLADAFW::Node *node, Object *ob) - { - float mat[4][4]; - TransformReader::get_node_mat(mat, node, &uid_animated_map, ob); - if (ob) { - copy_m4_m4(ob->obmat, mat); - object_apply_mat4(ob, ob->obmat); - } - } - -#if 0 - virtual void change_eul_to_quat(Object *ob, bAction *act) - { - bActionGroup *grp; - int i; - - for (grp = (bActionGroup*)act->groups.first; grp; grp = grp->next) { - - FCurve *eulcu[3] = {NULL, NULL, NULL}; - - if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end()) - continue; - - std::vector &rot_fcurves = fcurves_actionGroup_map[grp]; - - if (rot_fcurves.size() > 3) continue; - - for (i = 0; i < rot_fcurves.size(); i++) - eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i]; - - char joint_path[100]; - char rna_path[100]; - - BLI_snprintf(joint_path, sizeof(joint_path), "pose.bones[\"%s\"]", grp->name); - BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_quaternion", joint_path); - - FCurve *quatcu[4] = { - create_fcurve(0, rna_path), - create_fcurve(1, rna_path), - create_fcurve(2, rna_path), - create_fcurve(3, rna_path) - }; - - bPoseChannel *chan = get_pose_channel(ob->pose, grp->name); - - float m4[4][4], irest[3][3]; - invert_m4_m4(m4, chan->bone->arm_mat); - copy_m3_m4(irest, m4); - - for (i = 0; i < 3; i++) { - - FCurve *cu = eulcu[i]; - - if (!cu) continue; - - for (int j = 0; j < cu->totvert; j++) { - float frame = cu->bezt[j].vec[1][0]; - - float eul[3] = { - eulcu[0] ? evaluate_fcurve(eulcu[0], frame) : 0.0f, - eulcu[1] ? evaluate_fcurve(eulcu[1], frame) : 0.0f, - eulcu[2] ? evaluate_fcurve(eulcu[2], frame) : 0.0f - }; - - // make eul relative to bone rest pose - float rot[3][3], rel[3][3], quat[4]; - - /*eul_to_mat3(rot, eul); - - mul_m3_m3m3(rel, irest, rot); - - mat3_to_quat(quat, rel); - */ - - eul_to_quat(quat, eul); - - for (int k = 0; k < 4; k++) - create_bezt(quatcu[k], frame, quat[k]); - } - } - - // now replace old Euler curves - - for (i = 0; i < 3; i++) { - if (!eulcu[i]) continue; - - action_groups_remove_channel(act, eulcu[i]); - free_fcurve(eulcu[i]); - } - - chan->rotmode = ROT_MODE_QUAT; - - for (i = 0; i < 4; i++) - action_groups_add_channel(act, grp, quatcu[i]); - } - - bPoseChannel *pchan; - for (pchan = (bPoseChannel*)ob->pose->chanbase.first; pchan; pchan = pchan->next) { - pchan->rotmode = ROT_MODE_QUAT; - } - } -#endif - - // prerequisites: - // animlist_map - map animlist id -> animlist - // curve_map - map anim id -> curve(s) - Object *translate_animation(COLLADAFW::Node *node, - std::map& object_map, - std::map& root_map, - COLLADAFW::Transformation::TransformationType tm_type, - Object *par_job = NULL) - { - bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE; - bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX; - bool is_joint = node->getType() == COLLADAFW::Node::JOINT; - - COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()]; - Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()]; - const char *bone_name = is_joint ? get_joint_name(node) : NULL; - - if (!ob) { - fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str()); - return NULL; - } - - // frames at which to sample - std::vector frames; - - // for each , , etc. there is a separate Transformation - const COLLADAFW::TransformationPointerArray& tms = node->getTransformations(); - - unsigned int i; - - // find frames at which to sample plus convert all rotation keys to radians - for (i = 0; i < tms.getCount(); i++) { - COLLADAFW::Transformation *tm = tms[i]; - COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); - - if (type == tm_type) { - const COLLADAFW::UniqueId& listid = tm->getAnimationList(); - - if (animlist_map.find(listid) != animlist_map.end()) { - const COLLADAFW::AnimationList *animlist = animlist_map[listid]; - const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); - - if (bindings.getCount()) { - for (unsigned int j = 0; j < bindings.getCount(); j++) { - std::vector& curves = curve_map[bindings[j].animation]; - bool xyz = ((type == COLLADAFW::Transformation::TRANSLATE || type == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ); - - if ((!xyz && curves.size() == 1) || (xyz && curves.size() == 3) || is_matrix) { - std::vector::iterator iter; - - for (iter = curves.begin(); iter != curves.end(); iter++) { - FCurve *fcu = *iter; - - if (is_rotation) - fcurve_deg_to_rad(fcu); - - for (unsigned int k = 0; k < fcu->totvert; k++) { - float fra = fcu->bezt[k].vec[1][0]; - if (std::find(frames.begin(), frames.end(), fra) == frames.end()) - frames.push_back(fra); - } - } - } - else { - fprintf(stderr, "expected %d curves, got %u\n", xyz ? 3 : 1, curves.size()); - } - } - } - } - } - } - - float irest_dae[4][4]; - float rest[4][4], irest[4][4]; - - if (is_joint) { - get_joint_rest_mat(irest_dae, root, node); - invert_m4(irest_dae); - - Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); - if (!bone) { - fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); - return NULL; - } - - unit_m4(rest); - copy_m4_m4(rest, bone->arm_mat); - invert_m4_m4(irest, rest); - } - - Object *job = NULL; - -#ifdef ARMATURE_TEST - FCurve *job_curves[10]; - job = get_joint_object(root, node, par_job); -#endif - - if (frames.size() == 0) - return job; - - std::sort(frames.begin(), frames.end()); - - const char *tm_str = NULL; - switch (tm_type) { - case COLLADAFW::Transformation::ROTATE: - tm_str = "rotation_quaternion"; - break; - case COLLADAFW::Transformation::SCALE: - tm_str = "scale"; - break; - case COLLADAFW::Transformation::TRANSLATE: - tm_str = "location"; - break; - case COLLADAFW::Transformation::MATRIX: - break; - default: - return job; - } - - char rna_path[200]; - char joint_path[200]; - - if (is_joint) - armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); - - // new curves - FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale - unsigned int totcu = is_matrix ? 10 : (is_rotation ? 4 : 3); - - for (i = 0; i < totcu; i++) { - - int axis = i; - - if (is_matrix) { - if (i < 4) { - tm_str = "rotation_quaternion"; - axis = i; - } - else if (i < 7) { - tm_str = "location"; - axis = i - 4; - } - else { - tm_str = "scale"; - axis = i - 7; - } - } - - if (is_joint) - BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); - else - strcpy(rna_path, tm_str); - - newcu[i] = create_fcurve(axis, rna_path); - -#ifdef ARMATURE_TEST - if (is_joint) - job_curves[i] = create_fcurve(axis, tm_str); -#endif - } - - std::vector::iterator it; - - // sample values at each frame - for (it = frames.begin(); it != frames.end(); it++) { - float fra = *it; - - float mat[4][4]; - float matfra[4][4]; - - unit_m4(matfra); - - // calc object-space mat - evaluate_transform_at_frame(matfra, node, fra); - - // for joints, we need a special matrix - if (is_joint) { - // special matrix: iR * M * iR_dae * R - // where R, iR are bone rest and inverse rest mats in world space (Blender bones), - // iR_dae is joint inverse rest matrix (DAE) and M is an evaluated joint world-space matrix (DAE) - float temp[4][4], par[4][4]; - - // calc M - calc_joint_parent_mat_rest(par, NULL, root, node); - mul_m4_m4m4(temp, matfra, par); - - // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra); - - // calc special matrix - mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL); - } - else { - copy_m4_m4(mat, matfra); - } - - float val[4], rot[4], loc[3], scale[3]; - - switch (tm_type) { - case COLLADAFW::Transformation::ROTATE: - mat4_to_quat(val, mat); - break; - case COLLADAFW::Transformation::SCALE: - mat4_to_size(val, mat); - break; - case COLLADAFW::Transformation::TRANSLATE: - copy_v3_v3(val, mat[3]); - break; - case COLLADAFW::Transformation::MATRIX: - mat4_to_quat(rot, mat); - copy_v3_v3(loc, mat[3]); - mat4_to_size(scale, mat); - break; - default: - break; - } - - // add keys - for (i = 0; i < totcu; i++) { - if (is_matrix) { - if (i < 4) - add_bezt(newcu[i], fra, rot[i]); - else if (i < 7) - add_bezt(newcu[i], fra, loc[i - 4]); - else - add_bezt(newcu[i], fra, scale[i - 7]); - } - else { - add_bezt(newcu[i], fra, val[i]); - } - } - -#ifdef ARMATURE_TEST - if (is_joint) { - switch (tm_type) { - case COLLADAFW::Transformation::ROTATE: - mat4_to_quat(val, matfra); - break; - case COLLADAFW::Transformation::SCALE: - mat4_to_size(val, matfra); - break; - case COLLADAFW::Transformation::TRANSLATE: - copy_v3_v3(val, matfra[3]); - break; - case MATRIX: - mat4_to_quat(rot, matfra); - copy_v3_v3(loc, matfra[3]); - mat4_to_size(scale, matfra); - break; - default: - break; - } - - for (i = 0; i < totcu; i++) { - if (is_matrix) { - if (i < 4) - add_bezt(job_curves[i], fra, rot[i]); - else if (i < 7) - add_bezt(job_curves[i], fra, loc[i - 4]); - else - add_bezt(job_curves[i], fra, scale[i - 7]); - } - else { - add_bezt(job_curves[i], fra, val[i]); - } - } - } -#endif - } - - verify_adt_action((ID*)&ob->id, 1); - - ListBase *curves = &ob->adt->action->curves; - - // add curves - for (i = 0; i < totcu; i++) { - if (is_joint) - add_bone_fcurve(ob, node, newcu[i]); - else - BLI_addtail(curves, newcu[i]); - -#ifdef ARMATURE_TEST - if (is_joint) - BLI_addtail(&job->adt->action->curves, job_curves[i]); -#endif - } - - if (is_rotation || is_matrix) { - if (is_joint) { - bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); - chan->rotmode = ROT_MODE_QUAT; - } - else { - ob->rotmode = ROT_MODE_QUAT; - } - } - - return job; - } - - // internal, better make it private - // warning: evaluates only rotation - // prerequisites: animlist_map, curve_map - void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra) - { - const COLLADAFW::TransformationPointerArray& tms = node->getTransformations(); - - unit_m4(mat); - - for (unsigned int i = 0; i < tms.getCount(); i++) { - COLLADAFW::Transformation *tm = tms[i]; - COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); - float m[4][4]; - - unit_m4(m); - - if (!evaluate_animation(tm, m, fra, node->getOriginalId().c_str())) { - switch (type) { - case COLLADAFW::Transformation::ROTATE: - dae_rotate_to_mat4(tm, m); - break; - case COLLADAFW::Transformation::TRANSLATE: - dae_translate_to_mat4(tm, m); - break; - case COLLADAFW::Transformation::SCALE: - dae_scale_to_mat4(tm, m); - break; - case COLLADAFW::Transformation::MATRIX: - dae_matrix_to_mat4(tm, m); - break; - default: - fprintf(stderr, "unsupported transformation type %d\n", type); - } - } - - float temp[4][4]; - copy_m4_m4(temp, mat); - - mul_m4_m4m4(mat, m, temp); - } - } - - // return true to indicate that mat contains a sane value - bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id) - { - const COLLADAFW::UniqueId& listid = tm->getAnimationList(); - COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); - - if (type != COLLADAFW::Transformation::ROTATE && - type != COLLADAFW::Transformation::SCALE && - type != COLLADAFW::Transformation::TRANSLATE && - type != COLLADAFW::Transformation::MATRIX) { - fprintf(stderr, "animation of transformation %d is not supported yet\n", type); - return false; - } - - if (animlist_map.find(listid) == animlist_map.end()) - return false; - - const COLLADAFW::AnimationList *animlist = animlist_map[listid]; - const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); - - if (bindings.getCount()) { - float vec[3]; - - bool is_scale = (type == COLLADAFW::Transformation::SCALE); - bool is_translate = (type == COLLADAFW::Transformation::TRANSLATE); - - if (type == COLLADAFW::Transformation::SCALE) - dae_scale_to_v3(tm, vec); - else if (type == COLLADAFW::Transformation::TRANSLATE) - dae_translate_to_v3(tm, vec); - - for (unsigned int j = 0; j < bindings.getCount(); j++) { - const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[j]; - std::vector& curves = curve_map[binding.animation]; - COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass; - char path[100]; - - switch (type) { - case COLLADAFW::Transformation::ROTATE: - BLI_snprintf(path, sizeof(path), "%s.rotate (binding %u)", node_id, j); - break; - case COLLADAFW::Transformation::SCALE: - BLI_snprintf(path, sizeof(path), "%s.scale (binding %u)", node_id, j); - break; - case COLLADAFW::Transformation::TRANSLATE: - BLI_snprintf(path, sizeof(path), "%s.translate (binding %u)", node_id, j); - break; - case COLLADAFW::Transformation::MATRIX: - BLI_snprintf(path, sizeof(path), "%s.matrix (binding %u)", node_id, j); - break; - default: - break; - } - - if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) { - fprintf(stderr, "%s: UNKNOWN animation class\n", path); - continue; - } - - if (type == COLLADAFW::Transformation::ROTATE) { - if (curves.size() != 1) { - fprintf(stderr, "expected 1 curve, got %u\n", curves.size()); - return false; - } - - // TODO support other animclasses - if (animclass != COLLADAFW::AnimationList::ANGLE) { - fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass); - return false; - } - - COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis(); - float ax[3] = {axis[0], axis[1], axis[2]}; - float angle = evaluate_fcurve(curves[0], fra); - axis_angle_to_mat4(mat, ax, angle); - - return true; - } - else if (is_scale || is_translate) { - bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ; - - if ((!is_xyz && curves.size() != 1) || (is_xyz && curves.size() != 3)) { - if (is_xyz) - fprintf(stderr, "%s: expected 3 curves, got %u\n", path, curves.size()); - else - fprintf(stderr, "%s: expected 1 curve, got %u\n", path, curves.size()); - return false; - } - - switch (animclass) { - case COLLADAFW::AnimationList::POSITION_X: - vec[0] = evaluate_fcurve(curves[0], fra); - break; - case COLLADAFW::AnimationList::POSITION_Y: - vec[1] = evaluate_fcurve(curves[0], fra); - break; - case COLLADAFW::AnimationList::POSITION_Z: - vec[2] = evaluate_fcurve(curves[0], fra); - break; - case COLLADAFW::AnimationList::POSITION_XYZ: - vec[0] = evaluate_fcurve(curves[0], fra); - vec[1] = evaluate_fcurve(curves[1], fra); - vec[2] = evaluate_fcurve(curves[2], fra); - break; - default: - fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass); - break; - } - } - else if (type == COLLADAFW::Transformation::MATRIX) { - // for now, of matrix animation, support only the case when all values are packed into one animation - if (curves.size() != 16) { - fprintf(stderr, "%s: expected 16 curves, got %u\n", path, curves.size()); - return false; - } - - COLLADABU::Math::Matrix4 matrix; - int i = 0, j = 0; - - for (std::vector::iterator it = curves.begin(); it != curves.end(); it++) { - matrix.setElement(i, j, evaluate_fcurve(*it, fra)); - j++; - if (j == 4) { - i++; - j = 0; - } - } - - COLLADAFW::Matrix tm(matrix); - dae_matrix_to_mat4(&tm, mat); - - return true; - } - } - - if (is_scale) - size_to_mat4(mat, vec); - else - copy_v3_v3(mat[3], vec); - - return is_scale || is_translate; - } - - return false; - } - - // gives a world-space mat of joint at rest position - void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node) - { - // if bind mat is not available, - // use "current" node transform, i.e. all those tms listed inside - if (!armature_importer->get_joint_bind_mat(mat, node)) { - float par[4][4], m[4][4]; - - calc_joint_parent_mat_rest(par, NULL, root, node); - get_node_mat(m, node, NULL, NULL); - mul_m4_m4m4(mat, m, par); - } - } - - // gives a world-space mat, end's mat not included - bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end) - { - float m[4][4]; - - if (node == end) { - par ? copy_m4_m4(mat, par) : unit_m4(mat); - return true; - } - - // use bind matrix if available or calc "current" world mat - if (!armature_importer->get_joint_bind_mat(m, node)) { - if (par) { - float temp[4][4]; - get_node_mat(temp, node, NULL, NULL); - mul_m4_m4m4(m, temp, par); - } - else { - get_node_mat(m, node, NULL, NULL); - } - } - - COLLADAFW::NodePointerArray& children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { - if (calc_joint_parent_mat_rest(mat, m, children[i], end)) - return true; - } - - return false; - } - -#ifdef ARMATURE_TEST - Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job) - { - if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) { - Object *job = add_object(scene, OB_EMPTY); - - rename_id((ID*)&job->id, (char*)get_joint_name(node)); - - job->lay = object_in_scene(job, scene)->lay = 2; - - mul_v3_fl(job->size, 0.5f); - job->recalc |= OB_RECALC_OB; - - verify_adt_action((ID*)&job->id, 1); - - job->rotmode = ROT_MODE_QUAT; - - float mat[4][4]; - get_joint_rest_mat(mat, root, node); - - if (par_job) { - float temp[4][4], ipar[4][4]; - invert_m4_m4(ipar, par_job->obmat); - copy_m4_m4(temp, mat); - mul_m4_m4m4(mat, temp, ipar); - } - - TransformBase::decompose(mat, job->loc, NULL, job->quat, job->size); - - if (par_job) { - job->parent = par_job; - - par_job->recalc |= OB_RECALC_OB; - job->parsubstr[0] = 0; - } - - where_is_object(scene, job); - - // after parenting and layer change - DAG_scene_sort(CTX_data_main(C), scene); - - joint_objects[node->getUniqueId()] = job; - } - - return joint_objects[node->getUniqueId()]; - } -#endif - -#if 0 - // recursively evaluates joint tree until end is found, mat then is world-space matrix of end - // mat must be identity on enter, node must be root - bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra) - { - float m[4][4]; - if (par) { - float temp[4][4]; - evaluate_transform_at_frame(temp, node, node == end ? fra : 0.0f); - mul_m4_m4m4(m, temp, par); - } - else { - evaluate_transform_at_frame(m, node, node == end ? fra : 0.0f); - } - - if (node == end) { - copy_m4_m4(mat, m); - return true; - } - else { - COLLADAFW::NodePointerArray& children = node->getChildNodes(); - for (int i = 0; i < children.getCount(); i++) { - if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra)) - return true; - } - } - - return false; - } -#endif - - void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu) - { - const char *bone_name = get_joint_name(node); - bAction *act = ob->adt->action; - - /* try to find group */ - bActionGroup *grp = action_groups_find_named(act, bone_name); - - /* no matching groups, so add one */ - if (grp == NULL) { - /* Add a new group, and make it active */ - grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); - - grp->flag = AGRP_SELECTED; - BLI_strncpy(grp->name, bone_name, sizeof(grp->name)); - - BLI_addtail(&act->groups, grp); - BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64); - } - - /* add F-Curve to group */ - action_groups_add_channel(act, grp, fcu); - } - - void add_bezt(FCurve *fcu, float fra, float value) - { - BezTriple bez; - memset(&bez, 0, sizeof(BezTriple)); - bez.vec[1][0] = fra; - bez.vec[1][1] = value; - bez.ipo = U.ipo_new; /* use default interpolation mode here... */ - bez.f1 = bez.f2 = bez.f3 = SELECT; - bez.h1 = bez.h2 = HD_AUTO; - insert_bezt_fcurve(fcu, &bez, 0); - calchandles_fcurve(fcu); - } -}; - -/* - - COLLADA Importer limitations: - - - no multiple scene import, all objects are added to active scene - - */ /** Class that needs to be implemented by a writer. IMPORTANT: The write functions are called in arbitrary order.*/ class Writer: public COLLADAFW::IWriter @@ -3468,7 +332,7 @@ public: else { new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, is_library_node); } - set_parent(new_child, obn, mContext, true); + bc_set_parent(new_child, obn, mContext, true); if (is_library_node) libnode_ob.push_back(new_child); @@ -3547,7 +411,7 @@ public: if (!is_joint) { // if par was given make this object child of the previous if (par && ob) - set_parent(ob, par, mContext); + bc_set_parent(ob, par, mContext); } // if node has child nodes write them @@ -3650,8 +514,7 @@ public: // phong else if (shader == COLLADAFW::EffectCommon::SHADER_PHONG) { ma->spec_shader = MA_SPEC_PHONG; - // XXX setting specular hardness instead of specularity intensity - ma->har = ef->getShininess().getFloatValue() * 4; + ma->har = ef->getShininess().getFloatValue(); } // lambert else if (shader == COLLADAFW::EffectCommon::SHADER_LAMBERT) { diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h index babf8f65d7f..6a6f1dcb3bc 100644 --- a/source/blender/collada/DocumentImporter.h +++ b/source/blender/collada/DocumentImporter.h @@ -21,6 +21,9 @@ * * ***** END GPL LICENSE BLOCK ***** */ + +#ifndef __DOCUMENTIMPORTER_H__ +#define __DOCUMENTIMPORTER_H__ struct Main; struct bContext; @@ -29,3 +32,5 @@ class DocumentImporter public: void import(bContext *C, const char *filename); }; + +#endif diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp new file mode 100644 index 00000000000..a210eb3b2e0 --- /dev/null +++ b/source/blender/collada/MeshImporter.cpp @@ -0,0 +1,907 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "COLLADAFWMeshPrimitive.h" +#include "COLLADAFWMeshVertexData.h" +#include "COLLADAFWPolygons.h" + +extern "C" { +#include "BKE_blender.h" +#include "BKE_customdata.h" +#include "BKE_displist.h" +#include "BKE_global.h" +#include "BKE_library.h" +#include "BKE_main.h" +#include "BKE_material.h" +#include "BKE_mesh.h" +#include "BKE_object.h" + +#include "BLI_listbase.h" +#include "BLI_math.h" +#include "BLI_string.h" + +#include "MEM_guardedalloc.h" +} + +#include "ArmatureImporter.h" +#include "MeshImporter.h" +#include "collada_utils.h" + +// works for COLLADAFW::Node, COLLADAFW::Geometry +template +static const char *bc_get_dae_name(T *node) +{ + const std::string& name = node->getName(); + return name.size() ? name.c_str() : node->getOriginalId().c_str(); +} + +static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type) +{ + switch (type) { + case COLLADAFW::MeshPrimitive::LINES: + return "LINES"; + case COLLADAFW::MeshPrimitive::LINE_STRIPS: + return "LINESTRIPS"; + case COLLADAFW::MeshPrimitive::POLYGONS: + return "POLYGONS"; + case COLLADAFW::MeshPrimitive::POLYLIST: + return "POLYLIST"; + case COLLADAFW::MeshPrimitive::TRIANGLES: + return "TRIANGLES"; + case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: + return "TRIANGLE_FANS"; + case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS: + return "TRIANGLE_FANS"; + case COLLADAFW::MeshPrimitive::POINTS: + return "POINTS"; + case COLLADAFW::MeshPrimitive::UNDEFINED_PRIMITIVE_TYPE: + return "UNDEFINED_PRIMITIVE_TYPE"; + } + return "UNKNOWN"; +} + +static const char *bc_geomTypeToStr(COLLADAFW::Geometry::GeometryType type) +{ + switch (type) { + case COLLADAFW::Geometry::GEO_TYPE_MESH: + return "MESH"; + case COLLADAFW::Geometry::GEO_TYPE_SPLINE: + return "SPLINE"; + case COLLADAFW::Geometry::GEO_TYPE_CONVEX_MESH: + return "CONVEX_MESH"; + case COLLADAFW::Geometry::GEO_TYPE_UNKNOWN: + default: + return "UNKNOWN"; + } +} + + +UVDataWrapper::UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata) +{} + +#ifdef COLLADA_DEBUG +void WVDataWrapper::print() +{ + fprintf(stderr, "UVs:\n"); + switch(mVData->getType()) { + case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: + { + COLLADAFW::ArrayPrimitiveType* values = mVData->getFloatValues(); + if (values->getCount()) { + for (int i = 0; i < values->getCount(); i += 2) { + fprintf(stderr, "%.1f, %.1f\n", (*values)[i], (*values)[i+1]); + } + } + } + break; + case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: + { + COLLADAFW::ArrayPrimitiveType* values = mVData->getDoubleValues(); + if (values->getCount()) { + for (int i = 0; i < values->getCount(); i += 2) { + fprintf(stderr, "%.1f, %.1f\n", (float)(*values)[i], (float)(*values)[i+1]); + } + } + } + break; + } + fprintf(stderr, "\n"); +} +#endif + +void UVDataWrapper::getUV(int uv_index[2], float *uv) +{ + switch(mVData->getType()) { + case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: + { + COLLADAFW::ArrayPrimitiveType* values = mVData->getFloatValues(); + if (values->empty()) return; + uv[0] = (*values)[uv_index[0]]; + uv[1] = (*values)[uv_index[1]]; + + } + break; + case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: + { + COLLADAFW::ArrayPrimitiveType* values = mVData->getDoubleValues(); + if (values->empty()) return; + uv[0] = (float)(*values)[uv_index[0]]; + uv[1] = (float)(*values)[uv_index[1]]; + + } + break; + case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN: + default: + fprintf(stderr, "MeshImporter.getUV(): unknown data type\n"); + } +} + +void MeshImporter::set_face_indices(MFace *mface, unsigned int *indices, bool quad) +{ + mface->v1 = indices[0]; + mface->v2 = indices[1]; + mface->v3 = indices[2]; + if (quad) mface->v4 = indices[3]; + else mface->v4 = 0; +#ifdef COLLADA_DEBUG + // fprintf(stderr, "%u, %u, %u \n", indices[0], indices[1], indices[2]); +#endif +} + +// not used anymore, test_index_face from blenkernel is better +#if 0 +// change face indices order so that v4 is not 0 +void MeshImporter::rotate_face_indices(MFace *mface) { + mface->v4 = mface->v1; + mface->v1 = mface->v2; + mface->v2 = mface->v3; + mface->v3 = 0; +} +#endif + +void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, + COLLADAFW::IndexList& index_list, unsigned int *tris_indices) +{ + int uv_indices[4][2]; + + // per face vertex indices, this means for quad we have 4 indices, not 8 + COLLADAFW::UIntValuesArray& indices = index_list.getIndices(); + + // make indices into FloatOrDoubleArray + for (int i = 0; i < 3; i++) { + int uv_index = indices[tris_indices[i]]; + uv_indices[i][0] = uv_index * 2; + uv_indices[i][1] = uv_index * 2 + 1; + } + + uvs.getUV(uv_indices[0], mtface->uv[0]); + uvs.getUV(uv_indices[1], mtface->uv[1]); + uvs.getUV(uv_indices[2], mtface->uv[2]); +} + +void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, + COLLADAFW::IndexList& index_list, int index, bool quad) +{ + int uv_indices[4][2]; + + // per face vertex indices, this means for quad we have 4 indices, not 8 + COLLADAFW::UIntValuesArray& indices = index_list.getIndices(); + + // make indices into FloatOrDoubleArray + for (int i = 0; i < (quad ? 4 : 3); i++) { + int uv_index = indices[index + i]; + uv_indices[i][0] = uv_index * 2; + uv_indices[i][1] = uv_index * 2 + 1; + } + + uvs.getUV(uv_indices[0], mtface->uv[0]); + uvs.getUV(uv_indices[1], mtface->uv[1]); + uvs.getUV(uv_indices[2], mtface->uv[2]); + + if (quad) uvs.getUV(uv_indices[3], mtface->uv[3]); + +#ifdef COLLADA_DEBUG + /*if (quad) { + fprintf(stderr, "face uv:\n" + "((%d, %d), (%d, %d), (%d, %d), (%d, %d))\n" + "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", + + uv_indices[0][0], uv_indices[0][1], + uv_indices[1][0], uv_indices[1][1], + uv_indices[2][0], uv_indices[2][1], + uv_indices[3][0], uv_indices[3][1], + + mtface->uv[0][0], mtface->uv[0][1], + mtface->uv[1][0], mtface->uv[1][1], + mtface->uv[2][0], mtface->uv[2][1], + mtface->uv[3][0], mtface->uv[3][1]); + } + else { + fprintf(stderr, "face uv:\n" + "((%d, %d), (%d, %d), (%d, %d))\n" + "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", + + uv_indices[0][0], uv_indices[0][1], + uv_indices[1][0], uv_indices[1][1], + uv_indices[2][0], uv_indices[2][1], + + mtface->uv[0][0], mtface->uv[0][1], + mtface->uv[1][0], mtface->uv[1][1], + mtface->uv[2][0], mtface->uv[2][1]); + }*/ +#endif +} + +#ifdef COLLADA_DEBUG +void MeshImporter::print_index_list(COLLADAFW::IndexList& index_list) +{ + fprintf(stderr, "Index list for \"%s\":\n", index_list.getName().c_str()); + for (int i = 0; i < index_list.getIndicesCount(); i += 2) { + fprintf(stderr, "%u, %u\n", index_list.getIndex(i), index_list.getIndex(i + 1)); + } + fprintf(stderr, "\n"); +} +#endif + +bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) +{ + COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); + + const char *name = bc_get_dae_name(mesh); + + for (unsigned i = 0; i < prim_arr.getCount(); i++) { + + COLLADAFW::MeshPrimitive *mp = prim_arr[i]; + COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType(); + + const char *type_str = bc_primTypeToStr(type); + + // OpenCollada passes POLYGONS type for + if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) { + + COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; + COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray(); + + for(unsigned int j = 0; j < vca.getCount(); j++){ + int count = vca[j]; + if (count < 3) { + fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n", + type_str, name); + return false; + } + } + + } + else if(type != COLLADAFW::MeshPrimitive::TRIANGLES) { + fprintf(stderr, "Primitive type %s is not supported.\n", type_str); + return false; + } + } + + if (mesh->getPositions().empty()) { + fprintf(stderr, "Mesh %s has no vertices.\n", name); + return false; + } + + return true; +} + +void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) +{ + // vertices + me->totvert = mesh->getPositions().getFloatValues()->getCount() / 3; + me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert); + + COLLADAFW::MeshVertexData& pos = mesh->getPositions(); + MVert *mvert; + int i; + + for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) + get_vector(mvert->co, pos, i); +} + +int MeshImporter::triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector& tri) +{ + ListBase dispbase; + DispList *dl; + float *vert; + int i = 0; + + dispbase.first = dispbase.last = NULL; + + dl = (DispList*)MEM_callocN(sizeof(DispList), "poly disp"); + dl->nr = totvert; + dl->type = DL_POLY; + dl->parts = 1; + dl->verts = vert = (float*)MEM_callocN(totvert * 3 * sizeof(float), "poly verts"); + dl->index = (int*)MEM_callocN(sizeof(int) * 3 * totvert, "dl index"); + + BLI_addtail(&dispbase, dl); + + for (i = 0; i < totvert; i++) { + copy_v3_v3(vert, verts[indices[i]].co); + vert += 3; + } + + filldisplist(&dispbase, &dispbase, 0); + + int tottri = 0; + dl= (DispList*)dispbase.first; + + if (dl->type == DL_INDEX3) { + tottri = dl->parts; + + int *index = dl->index; + for (i= 0; i < tottri; i++) { + int t[3]= {*index, *(index + 1), *(index + 2)}; + + std::sort(t, t + 3); + + tri.push_back(t[0]); + tri.push_back(t[1]); + tri.push_back(t[2]); + + index += 3; + } + } + + freedisplist(&dispbase); + + return tottri; +} + +int MeshImporter::count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me) +{ + COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); + unsigned int i; + int tottri = 0; + + for (i = 0; i < prim_arr.getCount(); i++) { + + COLLADAFW::MeshPrimitive *mp = prim_arr[i]; + int type = mp->getPrimitiveType(); + size_t prim_totface = mp->getFaceCount(); + unsigned int *indices = mp->getPositionIndices().getData(); + + if (type == COLLADAFW::MeshPrimitive::POLYLIST || + type == COLLADAFW::MeshPrimitive::POLYGONS) { + + COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; + COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray(); + + for (unsigned int j = 0; j < prim_totface; j++) { + int vcount = vcounta[j]; + + if (vcount > 4) { + std::vector tri; + + // tottri += triangulate_poly(indices, vcount, me->mvert, tri) - 1; // XXX why - 1?! + tottri += triangulate_poly(indices, vcount, me->mvert, tri); + } + + indices += vcount; + } + } + } + return tottri; +} + +// TODO: import uv set names +void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) +{ + unsigned int i; + + // allocate faces + me->totface = mesh->getFacesCount() + new_tris; + me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface); + + // allocate UV layers + unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount(); + + for (i = 0; i < totuvset; i++) { + if (mesh->getUVCoords().getLength(i) == 0) { + totuvset = 0; + break; + } + } + + for (i = 0; i < totuvset; i++) { + COLLADAFW::MeshVertexData::InputInfos *info = mesh->getUVCoords().getInputInfosArray()[i]; + CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface, info->mName.c_str()); + //this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i); + } + + // activate the first uv layer + if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0); + + UVDataWrapper uvs(mesh->getUVCoords()); + +#ifdef COLLADA_DEBUG + // uvs.print(); +#endif + + MFace *mface = me->mface; + + MaterialIdPrimitiveArrayMap mat_prim_map; + + int face_index = 0; + + COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); + + bool has_normals = mesh->hasNormals(); + COLLADAFW::MeshVertexData& nor = mesh->getNormals(); + + for (i = 0; i < prim_arr.getCount(); i++) { + + COLLADAFW::MeshPrimitive *mp = prim_arr[i]; + + // faces + size_t prim_totface = mp->getFaceCount(); + unsigned int *indices = mp->getPositionIndices().getData(); + unsigned int *nind = mp->getNormalIndices().getData(); + unsigned int j, k; + int type = mp->getPrimitiveType(); + int index = 0; + + // since we cannot set mface->mat_nr here, we store a portion of me->mface in Primitive + Primitive prim = {mface, 0}; + COLLADAFW::IndexListArray& index_list_array = mp->getUVCoordIndicesArray(); + +#ifdef COLLADA_DEBUG + /* + fprintf(stderr, "Primitive %d:\n", i); + for (int j = 0; j < totuvset; j++) { + print_index_list(*index_list_array[j]); + } + */ +#endif + + if (type == COLLADAFW::MeshPrimitive::TRIANGLES) { + for (j = 0; j < prim_totface; j++){ + + set_face_indices(mface, indices, false); + indices += 3; + +#if 0 + for (k = 0; k < totuvset; k++) { + if (!index_list_array.empty() && index_list_array[k]) { + // get mtface by face index and uv set index + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); + set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, false); + } + } +#else + for (k = 0; k < index_list_array.getCount(); k++) { + int uvset_index = index_list_array[k]->getSetIndex(); + + // get mtface by face index and uv set index + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); + set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, false); + } +#endif + + test_index_face(mface, &me->fdata, face_index, 3); + + if (has_normals) { + if (!flat_face(nind, nor, 3)) + mface->flag |= ME_SMOOTH; + + nind += 3; + } + + index += 3; + mface++; + face_index++; + prim.totface++; + } + } + else if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) { + COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; + COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray(); + + for (j = 0; j < prim_totface; j++) { + + // face + int vcount = vcounta[j]; + if (vcount == 3 || vcount == 4) { + + set_face_indices(mface, indices, vcount == 4); + + // set mtface for each uv set + // it is assumed that all primitives have equal number of UV sets + +#if 0 + for (k = 0; k < totuvset; k++) { + if (!index_list_array.empty() && index_list_array[k]) { + // get mtface by face index and uv set index + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); + set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, mface->v4 != 0); + } + } +#else + for (k = 0; k < index_list_array.getCount(); k++) { + int uvset_index = index_list_array[k]->getSetIndex(); + + // get mtface by face index and uv set index + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); + set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0); + } +#endif + + test_index_face(mface, &me->fdata, face_index, vcount); + + if (has_normals) { + if (!flat_face(nind, nor, vcount)) + mface->flag |= ME_SMOOTH; + + nind += vcount; + } + + mface++; + face_index++; + prim.totface++; + + } + else { + std::vector tri; + + triangulate_poly(indices, vcount, me->mvert, tri); + + for (k = 0; k < tri.size() / 3; k++) { + int v = k * 3; + unsigned int uv_indices[3] = { + index + tri[v], + index + tri[v + 1], + index + tri[v + 2] + }; + unsigned int tri_indices[3] = { + indices[tri[v]], + indices[tri[v + 1]], + indices[tri[v + 2]] + }; + + set_face_indices(mface, tri_indices, false); + +#if 0 + for (unsigned int l = 0; l < totuvset; l++) { + if (!index_list_array.empty() && index_list_array[l]) { + // get mtface by face index and uv set index + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l); + set_face_uv(&mtface[face_index], uvs, l, *index_list_array[l], uv_indices); + } + } +#else + for (unsigned int l = 0; l < index_list_array.getCount(); l++) { + int uvset_index = index_list_array[l]->getSetIndex(); + + // get mtface by face index and uv set index + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); + set_face_uv(&mtface[face_index], uvs, *index_list_array[l], uv_indices); + } +#endif + + + test_index_face(mface, &me->fdata, face_index, 3); + + if (has_normals) { + unsigned int ntri[3] = {nind[tri[v]], nind[tri[v + 1]], nind[tri[v + 2]]}; + + if (!flat_face(ntri, nor, 3)) + mface->flag |= ME_SMOOTH; + } + + mface++; + face_index++; + prim.totface++; + } + + if (has_normals) + nind += vcount; + } + + index += vcount; + indices += vcount; + } + } + + mat_prim_map[mp->getMaterialId()].push_back(prim); + } + + geom_uid_mat_mapping_map[mesh->getUniqueId()] = mat_prim_map; +} + +void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i) +{ + i *= 3; + + switch(arr.getType()) { + case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: + { + COLLADAFW::ArrayPrimitiveType* values = arr.getFloatValues(); + if (values->empty()) return; + + v[0] = (*values)[i++]; + v[1] = (*values)[i++]; + v[2] = (*values)[i]; + } + break; + case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: + { + COLLADAFW::ArrayPrimitiveType* values = arr.getDoubleValues(); + if (values->empty()) return; + + v[0] = (float)(*values)[i++]; + v[1] = (float)(*values)[i++]; + v[2] = (float)(*values)[i]; + } + break; + default: + break; + } +} + +bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count) +{ + float a[3], b[3]; + + get_vector(a, nor, *nind); + normalize_v3(a); + + nind++; + + for (int i = 1; i < count; i++, nind++) { + get_vector(b, nor, *nind); + normalize_v3(b); + + float dp = dot_v3v3(a, b); + + if (dp < 0.99999f || dp > 1.00001f) + return false; + } + + return true; +} + +MeshImporter::MeshImporter(ArmatureImporter *arm, Scene *sce) : scene(sce), armature_importer(arm) {} + +Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) +{ + if (uid_object_map.find(geom_uid) != uid_object_map.end()) + return uid_object_map[geom_uid]; + return NULL; +} + +MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture, + Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map, + MTex *color_texture) +{ + const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId(); + const size_t setindex = ctexture.getSetIndex(); + std::string uvname = ctexture.getName(); + + const CustomData *data = &me->fdata; + int layer_index = CustomData_get_layer_index(data, CD_MTFACE); + CustomDataLayer *cdl = &data->layers[layer_index+setindex]; + + /* set uvname to bind_vertex_input semantic */ + BLI_strncpy(cdl->name, uvname.c_str(), sizeof(cdl->name)); + + if (texindex_texarray_map.find(texture_index) == texindex_texarray_map.end()) { + + fprintf(stderr, "Cannot find texture array by texture index.\n"); + return color_texture; + } + + std::vector textures = texindex_texarray_map[texture_index]; + + std::vector::iterator it; + + for (it = textures.begin(); it != textures.end(); it++) { + + MTex *texture = *it; + + if (texture) { + BLI_strncpy(texture->uvname, uvname.c_str(), sizeof(texture->uvname)); + if (texture->mapto == MAP_COL) color_texture = texture; + } + } + return color_texture; +} + +MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, + std::map& uid_material_map, + Object *ob, const COLLADAFW::UniqueId *geom_uid, + MTex **color_texture, char *layername, MTFace *texture_face, + std::map& material_texture_mapping_map, int mat_index) +{ + Mesh *me = (Mesh*)ob->data; + const COLLADAFW::UniqueId& ma_uid = cmaterial.getReferencedMaterial(); + + // do we know this material? + if (uid_material_map.find(ma_uid) == uid_material_map.end()) { + + fprintf(stderr, "Cannot find material by UID.\n"); + return NULL; + } + + Material *ma = uid_material_map[ma_uid]; + assign_material(ob, ma, ob->totcol + 1); + + COLLADAFW::TextureCoordinateBindingArray& tex_array = + cmaterial.getTextureCoordinateBindingArray(); + TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma]; + unsigned int i; + // loop through + for (i = 0; i < tex_array.getCount(); i++) { + + *color_texture = assign_textures_to_uvlayer(tex_array[i], me, texindex_texarray_map, + *color_texture); + } + + // set texture face + if (*color_texture && + strlen((*color_texture)->uvname) && + strcmp(layername, (*color_texture)->uvname) != 0) { + + texture_face = (MTFace*)CustomData_get_layer_named(&me->fdata, CD_MTFACE, + (*color_texture)->uvname); + strcpy(layername, (*color_texture)->uvname); + } + + MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid]; + COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId(); + + // assign material indices to mesh faces + if (mat_prim_map.find(mat_id) != mat_prim_map.end()) { + + std::vector& prims = mat_prim_map[mat_id]; + + std::vector::iterator it; + + for (it = prims.begin(); it != prims.end(); it++) { + Primitive& prim = *it; + i = 0; + while (i++ < prim.totface) { + prim.mface->mat_nr = mat_index; + prim.mface++; + // bind texture images to faces + if (texture_face && (*color_texture)) { + texture_face->mode = TF_TEX; + texture_face->tpage = (Image*)(*color_texture)->tex->ima; + texture_face++; + } + } + } + } + + return texture_face; +} + + +Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom, + bool isController, + std::map& uid_material_map, + std::map& material_texture_mapping_map) +{ + const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId(); + + // check if node instanciates controller or geometry + if (isController) { + + geom_uid = armature_importer->get_geometry_uid(*geom_uid); + + if (!geom_uid) { + fprintf(stderr, "Couldn't find a mesh UID by controller's UID.\n"); + return NULL; + } + } + else { + + if (uid_mesh_map.find(*geom_uid) == uid_mesh_map.end()) { + // this could happen if a mesh was not created + // (e.g. if it contains unsupported geometry) + fprintf(stderr, "Couldn't find a mesh by UID.\n"); + return NULL; + } + } + if (!uid_mesh_map[*geom_uid]) return NULL; + + Object *ob = add_object(scene, OB_MESH); + + // store object pointer for ArmatureImporter + uid_object_map[*geom_uid] = ob; + + // name Object + const std::string& id = node->getOriginalId(); + if (id.length()) + rename_id(&ob->id, (char*)id.c_str()); + + // replace ob->data freeing the old one + Mesh *old_mesh = (Mesh*)ob->data; + + set_mesh(ob, uid_mesh_map[*geom_uid]); + + if (old_mesh->id.us == 0) free_libblock(&G.main->mesh, old_mesh); + + char layername[100]; + MTFace *texture_face = NULL; + MTex *color_texture = NULL; + + COLLADAFW::MaterialBindingArray& mat_array = + geom->getMaterialBindings(); + + // loop through geom's materials + for (unsigned int i = 0; i < mat_array.getCount(); i++) { + + texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid, + &color_texture, layername, texture_face, + material_texture_mapping_map, i); + } + + return ob; +} + +// create a mesh storing a pointer in a map so it can be retrieved later by geometry UID +bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) +{ + // TODO: import also uvs, normals + // XXX what to do with normal indices? + // XXX num_normals may be != num verts, then what to do? + + // check geometry->getType() first + if (geom->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH) { + // TODO: report warning + fprintf(stderr, "Mesh type %s is not supported\n", bc_geomTypeToStr(geom->getType())); + return true; + } + + COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh*)geom; + + if (!is_nice_mesh(mesh)) { + fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh)); + return true; + } + + const std::string& str_geom_id = mesh->getOriginalId(); + Mesh *me = add_mesh((char*)str_geom_id.c_str()); + + // store the Mesh pointer to link it later with an Object + this->uid_mesh_map[mesh->getUniqueId()] = me; + + int new_tris = 0; + + read_vertices(mesh, me); + + new_tris = count_new_tris(mesh, me); + + read_faces(mesh, me, new_tris); + + make_edges(me, 0); + + mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); + + return true; +} diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h new file mode 100644 index 00000000000..8c468b01fb6 --- /dev/null +++ b/source/blender/collada/MeshImporter.h @@ -0,0 +1,150 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BC__MESHIMPORTER_H__ +#define __BC__MESHIMPORTER_H__ + +#include +#include + +#include "COLLADAFWIndexList.h" +#include "COLLADAFWInstanceGeometry.h" +#include "COLLADAFWMaterialBinding.h" +#include "COLLADAFWMesh.h" +#include "COLLADAFWMeshVertexData.h" +#include "COLLADAFWNode.h" +#include "COLLADAFWTextureCoordinateBinding.h" +#include "COLLADAFWTypes.h" +#include "COLLADAFWUniqueId.h" + +#include "DNA_material_types.h" +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" +#include "DNA_texture_types.h" + +#include "ArmatureImporter.h" +#include "collada_utils.h" + +// only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid +class MeshImporterBase +{ +public: + virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0; +}; + +class UVDataWrapper +{ + COLLADAFW::MeshVertexData *mVData; +public: + UVDataWrapper(COLLADAFW::MeshVertexData& vdata); + +#ifdef COLLADA_DEBUG + void print(); +#endif + + void getUV(int uv_index[2], float *uv); +}; + +class MeshImporter : public MeshImporterBase +{ +private: + + Scene *scene; + ArmatureImporter *armature_importer; + + std::map uid_mesh_map; // geometry unique id-to-mesh map + std::map uid_object_map; // geom uid-to-object + // this structure is used to assign material indices to faces + // it holds a portion of Mesh faces and corresponds to a DAE primitive list (, , etc.) + struct Primitive { + MFace *mface; + unsigned int totface; + }; + typedef std::map > MaterialIdPrimitiveArrayMap; + std::map geom_uid_mat_mapping_map; // crazy name! + + + void set_face_indices(MFace *mface, unsigned int *indices, bool quad); + + // not used anymore, test_index_face from blenkernel is better +#if 0 + // change face indices order so that v4 is not 0 + void rotate_face_indices(MFace *mface); +#endif + + void set_face_uv(MTFace *mtface, UVDataWrapper &uvs, + COLLADAFW::IndexList& index_list, unsigned int *tris_indices); + + void set_face_uv(MTFace *mtface, UVDataWrapper &uvs, + COLLADAFW::IndexList& index_list, int index, bool quad); + +#ifdef COLLADA_DEBUG + void print_index_list(COLLADAFW::IndexList& index_list); +#endif + + bool is_nice_mesh(COLLADAFW::Mesh *mesh); + + void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me); + + int triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector& tri); + + int count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me); + + // TODO: import uv set names + void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris); + + void get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i); + + bool flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count); + +public: + + MeshImporter(ArmatureImporter *arm, Scene *sce); + + virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid); + + MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture, + Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map, + MTex *color_texture); + + MTFace *assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, + std::map& uid_material_map, + Object *ob, const COLLADAFW::UniqueId *geom_uid, + MTex **color_texture, char *layername, MTFace *texture_face, + std::map& material_texture_mapping_map, int mat_index); + + + Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom, + bool isController, + std::map& uid_material_map, + std::map& material_texture_mapping_map); + + // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID + bool write_geometry(const COLLADAFW::Geometry* geom); + +}; + +#endif diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp new file mode 100644 index 00000000000..db6a7a62b54 --- /dev/null +++ b/source/blender/collada/SkinInfo.cpp @@ -0,0 +1,320 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "BKE_object.h" +#include "DNA_armature_types.h" +#include "DNA_modifier_types.h" +#include "ED_mesh.h" +#include "ED_object.h" +#include "BKE_action.h" +#include "BLI_listbase.h" +#include "BLI_math.h" + +#include "SkinInfo.h" +#include "collada_utils.h" + +// use this for retrieving bone names, since these must be unique +template +static const char *bc_get_joint_name(T *node) +{ + const std::string& id = node->getOriginalId(); + return id.size() ? id.c_str() : node->getName().c_str(); +} + +// This is used to store data passed in write_controller_data. +// Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members +// so that arrays don't get freed until we free them explicitly. +SkinInfo::SkinInfo() {} + +SkinInfo::SkinInfo(const SkinInfo& skin) : weights(skin.weights), + joint_data(skin.joint_data), + unit_converter(skin.unit_converter), + ob_arm(skin.ob_arm), + controller_uid(skin.controller_uid), + parent(skin.parent) +{ + copy_m4_m4(bind_shape_matrix, (float (*)[4])skin.bind_shape_matrix); + + transfer_uint_array_data_const(skin.joints_per_vertex, joints_per_vertex); + transfer_uint_array_data_const(skin.weight_indices, weight_indices); + transfer_int_array_data_const(skin.joint_indices, joint_indices); +} + +SkinInfo::SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) {} + +// nobody owns the data after this, so it should be freed manually with releaseMemory +template +void SkinInfo::transfer_array_data(T& src, T& dest) +{ + dest.setData(src.getData(), src.getCount()); + src.yieldOwnerShip(); + dest.yieldOwnerShip(); +} + +// when src is const we cannot src.yieldOwnerShip, this is used by copy constructor +void SkinInfo::transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest) +{ + dest.setData((int*)src.getData(), src.getCount()); + dest.yieldOwnerShip(); +} + +void SkinInfo::transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest) +{ + dest.setData((unsigned int*)src.getData(), src.getCount()); + dest.yieldOwnerShip(); +} + +void SkinInfo::borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin) +{ + transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getJointsPerVertex(), joints_per_vertex); + transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getWeightIndices(), weight_indices); + transfer_array_data((COLLADAFW::IntValuesArray&)skin->getJointIndices(), joint_indices); + // transfer_array_data(skin->getWeights(), weights); + + // cannot transfer data for FloatOrDoubleArray, copy values manually + const COLLADAFW::FloatOrDoubleArray& weight = skin->getWeights(); + for (unsigned int i = 0; i < weight.getValuesCount(); i++) + weights.push_back(bc_get_float_value(weight, i)); + + unit_converter->dae_matrix_to_mat4_(bind_shape_matrix, skin->getBindShapeMatrix()); +} + +void SkinInfo::free() +{ + joints_per_vertex.releaseMemory(); + weight_indices.releaseMemory(); + joint_indices.releaseMemory(); + // weights.releaseMemory(); +} + +// using inverse bind matrices to construct armature +// it is safe to invert them to get the original matrices +// because if they are inverse matrices, they can be inverted +void SkinInfo::add_joint(const COLLADABU::Math::Matrix4& matrix) +{ + JointData jd; + unit_converter->dae_matrix_to_mat4_(jd.inv_bind_mat, matrix); + joint_data.push_back(jd); +} + +void SkinInfo::set_controller(const COLLADAFW::SkinController* co) +{ + controller_uid = co->getUniqueId(); + + // fill in joint UIDs + const COLLADAFW::UniqueIdArray& joint_uids = co->getJoints(); + for (unsigned int i = 0; i < joint_uids.getCount(); i++) { + joint_data[i].joint_uid = joint_uids[i]; + + // // store armature pointer + // JointData& jd = joint_index_to_joint_info_map[i]; + // jd.ob_arm = ob_arm; + + // now we'll be able to get inv bind matrix from joint id + // joint_id_to_joint_index_map[joint_ids[i]] = i; + } +} + +// called from write_controller +Object *SkinInfo::create_armature(Scene *scene) +{ + ob_arm = add_object(scene, OB_ARMATURE); + return ob_arm; +} + +Object* SkinInfo::set_armature(Object *ob_arm) +{ + if (this->ob_arm) + return this->ob_arm; + + this->ob_arm = ob_arm; + return ob_arm; +} + +bool SkinInfo::get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node) +{ + const COLLADAFW::UniqueId& uid = node->getUniqueId(); + std::vector::iterator it; + for (it = joint_data.begin(); it != joint_data.end(); it++) { + if ((*it).joint_uid == uid) { + copy_m4_m4(inv_bind_mat, (*it).inv_bind_mat); + return true; + } + } + + return false; +} + +Object *SkinInfo::get_armature() +{ + return ob_arm; +} + +const COLLADAFW::UniqueId& SkinInfo::get_controller_uid() +{ + return controller_uid; +} + +// check if this skin controller references a joint or any descendant of it +// +// some nodes may not be referenced by SkinController, +// in this case to determine if the node belongs to this armature, +// we need to search down the tree +bool SkinInfo::uses_joint_or_descendant(COLLADAFW::Node *node) +{ + const COLLADAFW::UniqueId& uid = node->getUniqueId(); + std::vector::iterator it; + for (it = joint_data.begin(); it != joint_data.end(); it++) { + if ((*it).joint_uid == uid) + return true; + } + + COLLADAFW::NodePointerArray& children = node->getChildNodes(); + for (unsigned int i = 0; i < children.getCount(); i++) { + if (uses_joint_or_descendant(children[i])) + return true; + } + + return false; +} + +void SkinInfo::link_armature(bContext *C, Object *ob, std::map& joint_by_uid, + TransformReader *tm) +{ + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + + ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature); + ((ArmatureModifierData *)md)->object = ob_arm; + + copy_m4_m4(ob->obmat, bind_shape_matrix); + object_apply_mat4(ob, ob->obmat); +#if 1 + bc_set_parent(ob, ob_arm, C); +#else + Object workob; + ob->parent = ob_arm; + ob->partype = PAROBJECT; + + what_does_parent(scene, ob, &workob); + invert_m4_m4(ob->parentinv, workob.obmat); + + ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA; + + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); +#endif + + ((bArmature*)ob_arm->data)->deformflag = ARM_DEF_VGROUP; + + // create all vertex groups + std::vector::iterator it; + int joint_index; + for (it = joint_data.begin(), joint_index = 0; it != joint_data.end(); it++, joint_index++) { + const char *name = "Group"; + + // name group by joint node name + if (joint_by_uid.find((*it).joint_uid) != joint_by_uid.end()) { + name = bc_get_joint_name(joint_by_uid[(*it).joint_uid]); + } + + ED_vgroup_add_name(ob, (char*)name); + } + + // - number of joints per vertex - joints_per_vertex + // - [[bone index, weight index] * joints per vertex] * vertices - weight indices + // ^ bone index can be -1 meaning weight toward bind shape, how to express this in Blender? + + // for each vertex in weight indices + // for each bone index in vertex + // add vertex to group at group index + // treat group index -1 specially + + // get def group by index with BLI_findlink + + for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) { + + unsigned int limit = weight + joints_per_vertex[vertex]; + for ( ; weight < limit; weight++) { + int joint = joint_indices[weight], joint_weight = weight_indices[weight]; + + // -1 means "weight towards the bind shape", we just don't assign it to any group + if (joint != -1) { + bDeformGroup *def = (bDeformGroup*)BLI_findlink(&ob->defbase, joint); + + ED_vgroup_vert_add(ob, def, vertex, weights[joint_weight], WEIGHT_REPLACE); + } + } + } +} + +bPoseChannel *SkinInfo::get_pose_channel_from_node(COLLADAFW::Node *node) +{ + return get_pose_channel(ob_arm->pose, bc_get_joint_name(node)); +} + +void SkinInfo::set_parent(Object *_parent) +{ + parent = _parent; +} + +Object* SkinInfo::get_parent() +{ + return parent; +} + +void SkinInfo::find_root_joints(const std::vector &root_joints, + std::map& joint_by_uid, + std::vector& result) +{ + std::vector::const_iterator it; + for (it = root_joints.begin(); it != root_joints.end(); it++) { + COLLADAFW::Node *root = *it; + std::vector::iterator ji; + for (ji = joint_data.begin(); ji != joint_data.end(); ji++) { + COLLADAFW::Node *joint = joint_by_uid[(*ji).joint_uid]; + if (find_node_in_tree(joint, root)) { + if (std::find(result.begin(), result.end(), root) == result.end()) + result.push_back(root); + } + } + } +} + +bool SkinInfo::find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root) +{ + if (node == tree_root) + return true; + + COLLADAFW::NodePointerArray& children = tree_root->getChildNodes(); + for (unsigned int i = 0; i < children.getCount(); i++) { + if (find_node_in_tree(node, children[i])) + return true; + } + + return false; +} \ No newline at end of file diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h new file mode 100644 index 00000000000..b7b87494be6 --- /dev/null +++ b/source/blender/collada/SkinInfo.h @@ -0,0 +1,133 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BC_SKININFO_H__ +#define __BC_SKININFO_H__ + +#include +#include + +#include "COLLADAFWUniqueId.h" +#include "COLLADAFWTypes.h" +#include "COLLADAFWNode.h" +#include "COLLADAFWSkinController.h" +#include "COLLADAFWSkinControllerData.h" + +#include "DNA_object_types.h" +#include "BKE_context.h" + +#include "TransformReader.h" +#include "collada_internal.h" + +// This is used to store data passed in write_controller_data. +// Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members +// so that arrays don't get freed until we free them explicitly. +class SkinInfo +{ +private: + // to build armature bones from inverse bind matrices + struct JointData { + float inv_bind_mat[4][4]; // joint inverse bind matrix + COLLADAFW::UniqueId joint_uid; // joint node UID + // Object *ob_arm; // armature object + }; + + float bind_shape_matrix[4][4]; + + // data from COLLADAFW::SkinControllerData, each array should be freed + COLLADAFW::UIntValuesArray joints_per_vertex; + COLLADAFW::UIntValuesArray weight_indices; + COLLADAFW::IntValuesArray joint_indices; + // COLLADAFW::FloatOrDoubleArray weights; + std::vector weights; + + std::vector joint_data; // index to this vector is joint index + + UnitConverter *unit_converter; + + Object *ob_arm; + COLLADAFW::UniqueId controller_uid; + Object *parent; + +public: + + SkinInfo(); + SkinInfo(const SkinInfo& skin); + SkinInfo(UnitConverter *conv); + + // nobody owns the data after this, so it should be freed manually with releaseMemory + template + void transfer_array_data(T& src, T& dest); + + // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor + void transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest); + + void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest); + + void borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin); + + void free(); + + // using inverse bind matrices to construct armature + // it is safe to invert them to get the original matrices + // because if they are inverse matrices, they can be inverted + void add_joint(const COLLADABU::Math::Matrix4& matrix); + + void set_controller(const COLLADAFW::SkinController* co); + + // called from write_controller + Object *create_armature(Scene *scene); + + Object* set_armature(Object *ob_arm); + + bool get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node); + + Object *get_armature(); + + const COLLADAFW::UniqueId& get_controller_uid(); + + // check if this skin controller references a joint or any descendant of it + // + // some nodes may not be referenced by SkinController, + // in this case to determine if the node belongs to this armature, + // we need to search down the tree + bool uses_joint_or_descendant(COLLADAFW::Node *node); + + void link_armature(bContext *C, Object *ob, std::map& joint_by_uid, TransformReader *tm); + + bPoseChannel *get_pose_channel_from_node(COLLADAFW::Node *node); + + void set_parent(Object *_parent); + + Object* get_parent(); + + void find_root_joints(const std::vector &root_joints, + std::map& joint_by_uid, + std::vector& result); + + bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root); + +}; + +#endif \ No newline at end of file diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp new file mode 100644 index 00000000000..d951bfb6474 --- /dev/null +++ b/source/blender/collada/TransformReader.cpp @@ -0,0 +1,125 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "TransformReader.h" + +TransformReader::TransformReader(UnitConverter* conv) : unit_converter(conv) {} + +void TransformReader::get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map *animation_map, Object *ob) +{ + float cur[4][4]; + float copy[4][4]; + + unit_m4(mat); + + for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) { + + COLLADAFW::Transformation *tm = node->getTransformations()[i]; + COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); + + switch(type) { + case COLLADAFW::Transformation::TRANSLATE: + dae_translate_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::ROTATE: + dae_rotate_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::SCALE: + dae_scale_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::MATRIX: + dae_matrix_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::LOOKAT: + case COLLADAFW::Transformation::SKEW: + fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet.\n"); + break; + } + + copy_m4_m4(copy, mat); + mul_m4_m4m4(mat, cur, copy); + + if (animation_map) { + // AnimationList that drives this Transformation + const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList(); + + // store this so later we can link animation data with ob + Animation anim = {ob, node, tm}; + (*animation_map)[anim_list_id] = anim; + } + } +} + +void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) +{ + COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm; + COLLADABU::Math::Vector3& axis = ro->getRotationAxis(); + float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f); + float ax[] = {axis[0], axis[1], axis[2]}; + // float quat[4]; + // axis_angle_to_quat(quat, axis, angle); + // quat_to_mat4(m, quat); + axis_angle_to_mat4(m, ax, angle); +} + +void TransformReader::dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) +{ + COLLADAFW::Translate *tra = (COLLADAFW::Translate*)tm; + COLLADABU::Math::Vector3& t = tra->getTranslation(); + + unit_m4(m); + + m[3][0] = (float)t[0]; + m[3][1] = (float)t[1]; + m[3][2] = (float)t[2]; +} + +void TransformReader::dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) +{ + COLLADABU::Math::Vector3& s = ((COLLADAFW::Scale*)tm)->getScale(); + float size[3] = {(float)s[0], (float)s[1], (float)s[2]}; + size_to_mat4(m, size); +} + +void TransformReader::dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[][4]) +{ + unit_converter->dae_matrix_to_mat4_(m, ((COLLADAFW::Matrix*)tm)->getMatrix()); +} + +void TransformReader::dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3]) +{ + dae_vector3_to_v3(((COLLADAFW::Translate*)tm)->getTranslation(), v); +} + +void TransformReader::dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3]) +{ + dae_vector3_to_v3(((COLLADAFW::Scale*)tm)->getScale(), v); +} + +void TransformReader::dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]) +{ + v[0] = v3.x; + v[1] = v3.y; + v[2] = v3.z; +} \ No newline at end of file diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h new file mode 100644 index 00000000000..fa08df1d4fa --- /dev/null +++ b/source/blender/collada/TransformReader.h @@ -0,0 +1,70 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BC_TRANSFORMREADER_H__ +#define __BC_TRANSFORMREADER_H__ + +#include "COLLADAFWNode.h" +#include "COLLADAFWTransformation.h" +#include "COLLADAFWTranslate.h" +#include "COLLADAFWRotate.h" +#include "COLLADAFWScale.h" +#include "COLLADAFWMatrix.h" +#include "COLLADAFWUniqueId.h" +#include "Math/COLLADABUMathVector3.h" + +#include "DNA_object_types.h" +#include "BLI_math.h" + +#include "collada_internal.h" + +//struct Object; + +class TransformReader : public TransformBase +{ +protected: + + UnitConverter *unit_converter; + +public: + struct Animation { + Object *ob; + COLLADAFW::Node *node; + COLLADAFW::Transformation *tm; // which transform is animated by an AnimationList->id + }; + + TransformReader(UnitConverter* conv); + + void get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map *animation_map, Object *ob); + + void dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]); + void dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]); + void dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[][4]); + void dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[][4]); + void dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3]); + void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3]); + void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]); +}; + +#endif \ No newline at end of file diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index a519db3332c..d499249cfa2 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -21,15 +21,15 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#include "BKE_main.h" -#include "BKE_scene.h" -#include "BKE_context.h" #include "DocumentExporter.h" #include "DocumentImporter.h" extern "C" { +#include "BKE_scene.h" +#include "BKE_context.h" + int collada_import(bContext *C, const char *filepath) { DocumentImporter imp; diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h index 242fce749c4..f8fbe71e6d9 100644 --- a/source/blender/collada/collada_internal.h +++ b/source/blender/collada/collada_internal.h @@ -27,6 +27,8 @@ #include "COLLADAFWFileInfo.h" #include "Math/COLLADABUMathMatrix4.h" +#include "BLI_math.h" + class UnitConverter { private: @@ -35,6 +37,7 @@ private: public: + // Initialize with Z_UP, since Blender uses right-handed, z-up UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} void read_asset(const COLLADAFW::FileInfo* asset) @@ -49,7 +52,7 @@ public: // TODO need also for angle conversion, time conversion... - void dae_matrix_to_mat4(float out[][4], const COLLADABU::Math::Matrix4& in) + void dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in) { // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h) // so here, to make a blender matrix, we swap columns and rows @@ -84,10 +87,12 @@ public: void decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size) { mat4_to_size(size, mat); - if (eul) + if (eul) { mat4_to_eul(eul, mat); - if (quat) + } + if (quat) { mat4_to_quat(quat, mat); + } copy_v3_v3(loc, mat[3]); } }; diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp new file mode 100644 index 00000000000..ec0bc91ee0b --- /dev/null +++ b/source/blender/collada/collada_utils.cpp @@ -0,0 +1,106 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "COLLADAFWGeometry.h" +#include "COLLADAFWMeshPrimitive.h" +#include "COLLADAFWMeshVertexData.h" + +#include "DNA_customdata_types.h" +#include "DNA_object_types.h" + +#include "BLI_math.h" + +#include "BKE_context.h" +#include "BKE_customdata.h" +#include "BKE_depsgraph.h" +#include "BKE_object.h" + +#include "WM_api.h" // XXX hrm, see if we can do without this +#include "WM_types.h" + +float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index) +{ + if (index >= array.getValuesCount()) + return 0.0f; + + if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT) + return array.getFloatValues()->getData()[index]; + else + return array.getDoubleValues()->getData()[index]; +} + +// copied from /editors/object/object_relations.c +int bc_test_parent_loop(Object *par, Object *ob) +{ + /* test if 'ob' is a parent somewhere in par's parents */ + + if(par == NULL) return 0; + if(ob == par) return 1; + + return bc_test_parent_loop(par->parent, ob); +} + +// a shortened version of parent_set_exec() +// if is_parent_space is true then ob->obmat will be multiplied by par->obmat before parenting +int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) +{ + Object workob; + Main *bmain = CTX_data_main(C); + Scene *sce = CTX_data_scene(C); + + if (!par || bc_test_parent_loop(par, ob)) + return false; + + ob->parent = par; + ob->partype = PAROBJECT; + + ob->parsubstr[0] = 0; + + if (is_parent_space) { + float mat[4][4]; + // calc par->obmat + where_is_object(sce, par); + + // move child obmat into world space + mul_m4_m4m4(mat, ob->obmat, par->obmat); + copy_m4_m4(ob->obmat, mat); + } + + // apply child obmat (i.e. decompose it into rot/loc/size) + object_apply_mat4(ob, ob->obmat); + + // compute parentinv + what_does_parent(sce, ob, &workob); + invert_m4_m4(ob->parentinv, workob.obmat); + + ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; + par->recalc |= OB_RECALC_OB; + + DAG_scene_sort(bmain, sce); + DAG_ids_flush_update(bmain, 0); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + + return true; +} + diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h new file mode 100644 index 00000000000..dbcbfdafec8 --- /dev/null +++ b/source/blender/collada/collada_utils.h @@ -0,0 +1,50 @@ +/** + * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BC_UTILS_H__ +#define __BC_UTILS_H__ + +#include "COLLADAFWMeshPrimitive.h" +#include "COLLADAFWGeometry.h" +#include "COLLADAFWFloatOrDoubleArray.h" +#include "COLLADAFWTypes.h" + +#include +#include + +#include "DNA_object_types.h" +#include "DNA_customdata_types.h" +#include "DNA_texture_types.h" +#include "BKE_context.h" + +typedef std::map > TexIndexTextureArrayMap; + +extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index); + +extern int bc_test_parent_loop(Object *par, Object *ob); +extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true); +extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n); +extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type); + +#endif diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 6055b9eecb3..474b50540d8 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -27,6 +27,10 @@ #ifndef ED_ARMATURE_H #define ED_ARMATURE_H +#ifdef __cplusplus +extern "C" { +#endif + struct bArmature; struct Base; struct bContext; @@ -168,6 +172,10 @@ int BDR_drawSketchNames(struct ViewContext *vc); void mesh_deform_bind(struct Scene *scene, struct MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[][4]); + +#ifdef __cplusplus +} +#endif #endif /* ED_ARMATURE_H */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 8718d39dd18..b3aac489852 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -28,6 +28,10 @@ #ifndef ED_KEYFRAMING_H #define ED_KEYFRAMING_H +#ifdef __cplusplus +extern "C" { +#endif + struct ListBase; struct ID; struct Scene; @@ -280,4 +284,8 @@ typedef enum eAnimFilterFlags { ANIMFILTER_KEYS_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */ } eAnimFilterFlags; +#ifdef __cplusplus +} +#endif + #endif /* ED_KEYFRAMING_H */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 564fe04ca4d..c4477ee5a8e 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -28,6 +28,10 @@ #ifndef ED_MESH_H #define ED_MESH_H +#ifdef __cplusplus +extern "C" { +#endif + struct ID; struct View3D; struct ARegion; @@ -224,5 +228,9 @@ int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); +#ifdef __cplusplus +} +#endif + #endif /* ED_MESH_H */ diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index f243b4cc497..64e72a5e2fa 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -28,6 +28,10 @@ #ifndef ED_OBJECT_H #define ED_OBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + struct Base; struct bConstraint; struct bContext; @@ -141,5 +145,9 @@ int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, s int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md, int mode); int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md); +#ifdef __cplusplus +} +#endif + #endif /* ED_OBJECT_H */ diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index 8908143946a..6c0b4db221d 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -30,6 +30,10 @@ #ifndef DNA_CUSTOMDATA_TYPES_H #define DNA_CUSTOMDATA_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + /* descriptor and storage for a custom data layer */ typedef struct CustomDataLayer { int type; /* type of data in layer */ @@ -128,4 +132,8 @@ typedef struct CustomData { #define MAX_MTFACE 8 #define MAX_MCOL 8 +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index e9e058cbbd6..19aacaa8108 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -34,6 +34,10 @@ #include "DNA_ID.h" #include "DNA_image_types.h" /* ImageUser */ +#ifdef __cplusplus +extern "C" { +#endif + struct AnimData; struct Ipo; struct PluginTex; @@ -554,5 +558,9 @@ typedef struct TexMapping { #define TEX_VD_SMOKEHEAT 1 #define TEX_VD_SMOKEVEL 2 +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 52e82eb743d..4e3a957d775 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -35,6 +35,10 @@ #include "DNA_listBase.h" #include "DNA_texture_types.h" /* ColorBand */ +#ifdef __cplusplus +extern "C" { +#endif + /* themes; defines in BIF_resource.h */ struct ColorBand; @@ -558,4 +562,8 @@ extern UserDef U; /* from blenkernel blender.c */ #define TH_OLDSKOOL 3 #define TH_SHADED 4 +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 93b38499673..d6964f5d569 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -44,10 +44,10 @@ EnumPropertyItem region_type_items[] = { {RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""}, {0, NULL, 0, NULL, NULL}}; -#ifdef RNA_RUNTIME - #include "ED_screen.h" +#ifdef RNA_RUNTIME + #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 690d8ad0f75..f103cbe2d4e 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -31,6 +31,10 @@ /* dna-savable wmStructs here */ #include "DNA_windowmanager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bContext; struct IDProperty; struct wmEvent; @@ -338,5 +342,9 @@ void WM_clipboard_text_set(char *buf, int selection); void WM_progress_set(struct wmWindow *win, float progress); void WM_progress_clear(struct wmWindow *win); +#ifdef __cplusplus +} +#endif + #endif /* WM_API_H */ diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 73f1fe8cbd3..0447524255f 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -28,6 +28,10 @@ #ifndef WM_TYPES_H #define WM_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + struct bContext; struct wmEvent; struct wmWindowManager; @@ -511,5 +515,9 @@ typedef struct RecentFile { } RecentFile; +#ifdef __cplusplus +} +#endif + #endif /* WM_TYPES_H */ -- cgit v1.2.3 From 9f3d203acbc267063f274209b460dc5f059100e6 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Tue, 5 Oct 2010 00:49:39 +0000 Subject: SVN maintenance. --- source/blender/collada/AnimationImporter.cpp | 2 +- source/blender/collada/AnimationImporter.h | 4 ++-- source/blender/collada/ArmatureImporter.cpp | 4 ++-- source/blender/collada/ArmatureImporter.h | 4 ++-- source/blender/collada/MeshImporter.cpp | 2 +- source/blender/collada/MeshImporter.h | 2 +- source/blender/collada/SkinInfo.cpp | 4 ++-- source/blender/collada/SkinInfo.h | 4 ++-- source/blender/collada/TransformReader.cpp | 4 ++-- source/blender/collada/TransformReader.h | 4 ++-- source/blender/collada/collada_utils.cpp | 2 +- source/blender/collada/collada_utils.h | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 92e863db023..32390fe01eb 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 9854a9d2663..01abac38280 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -129,4 +129,4 @@ public: void add_bezt(FCurve *fcu, float fra, float value); }; - #endif \ No newline at end of file + #endif diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index f931c04aef1..a8ac6d8b768 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -582,4 +582,4 @@ bool ArmatureImporter::get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint) } return found; -} \ No newline at end of file +} diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index 64d4669b33c..a857ab67f12 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -157,4 +157,4 @@ public: bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint); }; -#endif \ No newline at end of file +#endif diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index a210eb3b2e0..da8ae70fdb3 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h index 8c468b01fb6..1fa9ebfbabc 100644 --- a/source/blender/collada/MeshImporter.h +++ b/source/blender/collada/MeshImporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index db6a7a62b54..58985d58db3 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -317,4 +317,4 @@ bool SkinInfo::find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_ro } return false; -} \ No newline at end of file +} diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h index b7b87494be6..1e31baff2a9 100644 --- a/source/blender/collada/SkinInfo.h +++ b/source/blender/collada/SkinInfo.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -130,4 +130,4 @@ public: }; -#endif \ No newline at end of file +#endif diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index d951bfb6474..814fda58e3c 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -122,4 +122,4 @@ void TransformReader::dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, floa v[0] = v3.x; v[1] = v3.y; v[2] = v3.z; -} \ No newline at end of file +} diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h index fa08df1d4fa..4dff8884a44 100644 --- a/source/blender/collada/TransformReader.h +++ b/source/blender/collada/TransformReader.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -67,4 +67,4 @@ public: void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]); }; -#endif \ No newline at end of file +#endif diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index ec0bc91ee0b..0634c910e96 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index dbcbfdafec8..ba5ba7f3cf5 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentImporter.cpp 32235 2010-10-01 19:46:42Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From 3cf2d2fd4ec7bfafc86fe2a288e4143544e6b781 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 5 Oct 2010 05:44:15 +0000 Subject: A bit of bge.events work: * A few places in the bge.events docs mentioned bge.keys, when it should have been bge.events * Created two aliases to bge.events.RETKEY: ENTERKEY and RETURNKEY * ENTERKEY and RETURNKEY have been added to the docs and RETKEY marked as deprecated * Added an example of using bge.logic.keyboard to the bge.events docs --- source/gameengine/Ketsji/KX_PythonInit.cpp | 2 ++ source/gameengine/PyDoc/bge.events.rst | 36 ++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index a6b2453f0c5..473e6fc9265 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -2214,6 +2214,8 @@ PyObject* initGameKeys() KX_MACRO_addTypesToDict(d, ESCKEY, SCA_IInputDevice::KX_ESCKEY); KX_MACRO_addTypesToDict(d, TABKEY, SCA_IInputDevice::KX_TABKEY); KX_MACRO_addTypesToDict(d, RETKEY, SCA_IInputDevice::KX_RETKEY); + KX_MACRO_addTypesToDict(d, ENTERKEY, SCA_IInputDevice::KX_RETKEY); + KX_MACRO_addTypesToDict(d, RETURNKEY, SCA_IInputDevice::KX_RETKEY); KX_MACRO_addTypesToDict(d, SPACEKEY, SCA_IInputDevice::KX_SPACEKEY); KX_MACRO_addTypesToDict(d, LINEFEEDKEY, SCA_IInputDevice::KX_LINEFEEDKEY); KX_MACRO_addTypesToDict(d, BACKSPACEKEY, SCA_IInputDevice::KX_BACKSPACEKEY); diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst index f642291fe97..5738e7a0f48 100644 --- a/source/gameengine/PyDoc/bge.events.rst +++ b/source/gameengine/PyDoc/bge.events.rst @@ -18,7 +18,7 @@ This module holds key constants for the SCA_KeyboardSensor. co = bge.logic.getCurrentController() # 'Keyboard' is a keyboard sensor sensor = co.sensors["Keyboard"] - sensor.key = bge.keys.F1KEY + sensor.key = bge.events.F1KEY .. code-block:: python @@ -30,17 +30,37 @@ This module holds key constants for the SCA_KeyboardSensor. sensor = co.sensors["Keyboard"] for key,status in sensor.events: - # key[0] == bge.keys.keycode, key[1] = status + # key[0] == bge.events.keycode, key[1] = status if status == bge.logic.KX_INPUT_JUST_ACTIVATED: - if key == bge.keys.WKEY: + if key == bge.events.WKEY: # Activate Forward! - if key == bge.keys.SKEY: + if key == bge.events.SKEY: # Activate Backward! - if key == bge.keys.AKEY: + if key == bge.events.AKEY: # Activate Left! - if key == bge.keys.DKEY: + if key == bge.events.DKEY: # Activate Right! +.. code-block:: python + + # The all keys thing without a keyboard sensor (but you will + # need an always sensor with pulse mode on) + import bge + + # Just shortening names here + keyboard = bge.logic.keyboard + JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED + + if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED: + print("Activate Forward!") + if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED: + print("Activate Backward!") + if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED: + print("Activate Left!") + if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED: + print("Activate Right!") + + ********* Functions ********* @@ -222,7 +242,9 @@ Other Keys .. data:: PERIODKEY .. data:: QUOTEKEY .. data:: RIGHTBRACKETKEY -.. data:: RETKEY +.. data:: RETKEY (Deprecated: use bge.events.ENTERKEY or bge.events.RETURNKEY) +.. data:: ENTERKEY +.. data:: RETURNKEY .. data:: SEMICOLONKEY .. data:: SLASHKEY .. data:: SPACEKEY -- cgit v1.2.3 From 4eae531f31382a8632428131a654191eb3947205 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 5 Oct 2010 06:10:17 +0000 Subject: TextureCoordinateBinding.getName() -> TextureCoordinateBinding.getSemantic(); as per my own patch on OpenCOLLADA issue tracker. --- source/blender/collada/MeshImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index da8ae70fdb3..34da6c9e897 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -700,7 +700,7 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi { const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId(); const size_t setindex = ctexture.getSetIndex(); - std::string uvname = ctexture.getName(); + std::string uvname = ctexture.getSemantic(); const CustomData *data = &me->fdata; int layer_index = CustomData_get_layer_index(data, CD_MTFACE); @@ -904,4 +904,4 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); return true; -} +} \ No newline at end of file -- cgit v1.2.3 From a92c232c8b94d926b14785fb95cf8592f7deb1c3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 5 Oct 2010 07:22:44 +0000 Subject: Fixed own typo in last commit to curve RNA --- source/blender/makesrna/intern/rna_curve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 50c21640554..7983b8f8a7f 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1373,7 +1373,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC); RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction"); - RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v"); /* Note, endpoint and bezier flags should never be on at the same time! */ -- cgit v1.2.3 From 6ca186fc5ac422001559a0c86d3d436163acc849 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Tue, 5 Oct 2010 09:32:35 +0000 Subject: Fix for [#24107] Hair/General particle glitch- Presets --- release/scripts/ui/properties_particle.py | 6 ++---- source/blender/makesrna/intern/rna_particle.c | 8 +++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index 7f630d6e5ff..ff49b0e4e9f 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -28,12 +28,10 @@ from properties_physics_common import basic_force_field_falloff_ui def particle_panel_enabled(context, psys): phystype = psys.settings.physics_type - if phystype == 'NO' or phystype == 'KEYED': + if psys.settings.type in ('EMITTER', 'REACTOR') and phystype in ('NO', 'KEYED'): return True - if psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics): - return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable) else: - return True + return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable) def particle_panel_poll(cls, context): diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 1151215f5f7..7a8165e9aa5 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -325,15 +325,21 @@ static PointerRNA rna_particle_settings_get(PointerRNA *ptr) static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value) { ParticleSystem *psys= (ParticleSystem*)ptr->data; + int old_type = 0; - if(psys->part) + + if(psys->part) { + old_type = psys->part->type; psys->part->id.us--; + } psys->part = (ParticleSettings *)value.data; if(psys->part) { psys->part->id.us++; psys_check_boid_data(psys); + if(old_type != psys->part->type) + psys->recalc |= PSYS_RECALC_TYPE; } } static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr) -- cgit v1.2.3 From 459cf92bf4ab9c571de4a005cf73ab66acc9b1bd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 10:23:25 +0000 Subject: build-fix [#24142] path changes break osx --- source/creator/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 526c1e3f13c..dbd2f817204 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -254,16 +254,17 @@ IF(WITH_INSTALL) COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/ COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/ COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO} - COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles - COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/ - COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/ + COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION} + COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION} + COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/ + COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/ ) IF(WITH_INTERNATIONAL) ADD_CUSTOM_COMMAND( TARGET blender POST_BUILD MAIN_DEPENDENCY blender - COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/ - COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/ + COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/ + COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/ ) ENDIF(WITH_INTERNATIONAL) @@ -271,10 +272,9 @@ IF(WITH_INSTALL) SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip") ADD_CUSTOM_COMMAND( TARGET blender POST_BUILD MAIN_DEPENDENCY blender - COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/ - COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/python/ - COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/python/ - COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/python/ + COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/ + COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/ + COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/ COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;" ) ENDIF(WITH_PYTHON) -- cgit v1.2.3 From 9c91affd6f91b6c2db2af308bd5c103c9a466acd Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Tue, 5 Oct 2010 10:45:54 +0000 Subject: "Fix" for [#24115] Offset animation on object with particules system doesn't work like 2.49 * Object time offset is not supported for particles anymore, something that enables similar functionality will have to be coded later. --- release/scripts/ui/properties_object.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index dd242723cac..65f1cc2d929 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -251,9 +251,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel): col.label(text="Time Offset:") col.prop(ob, "use_time_offset_edit", text="Edit") row = col.row() - row.prop(ob, "use_time_offset_particle", text="Particle") - row.active = bool(ob.particle_systems) - row = col.row() row.prop(ob, "use_time_offset_parent", text="Parent") row.active = (ob.parent is not None) row = col.row() -- cgit v1.2.3 From a7258c96512d45f2392e13f5d5c8fb6edf651a00 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 11:16:07 +0000 Subject: - fix for crash when drawing a subsurf after a modifier that lost original indices (bevel/screw/decimate) - fix for own mistake used madd_v3_v3fl rather then mul_v3_v3fl, r32241. --- source/blender/blenkernel/intern/subsurf_ccg.c | 4 +++- source/blender/editors/space_view3d/drawmesh.c | 2 +- source/blender/gpu/intern/gpu_draw.c | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index d6486c3ee4d..b0ea5f979ac 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1619,8 +1619,10 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, if(drawParams) flag = drawParams(tf, mcol, mat_nr); - else + else if(index != ORIGINDEX_NONE) flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1; + else + flag= 1; if (flag == 0) { /* flag 0 == the face is hidden or invisible */ if(tf) tf += gridFaces*gridFaces*numVerts; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 372ac976342..53b32dd167c 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -523,7 +523,7 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index) MCol *mcol; int matnr; - if (efa==NULL || efa->h) + if (efa->h) return 0; tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index e8701793e5d..55522ea18b9 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -911,10 +911,10 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, } } else { - madd_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit); + mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit); smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */ - madd_v3_v3fl(smat->spec, &bmat->specr, bmat->spec); + mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec); smat->spec[3]= 1.0; /* always 1 */ smat->hard= CLAMPIS(bmat->har, 0, 128); @@ -1043,10 +1043,10 @@ int GPU_enable_material(int nr, void *attribs) memset(&GMS, 0, sizeof(GMS)); - madd_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit); + mul_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit); diff[3]= 1.0; - madd_v3_v3fl(spec, &defmaterial.specr, defmaterial.spec); + mul_v3_v3fl(spec, &defmaterial.specr, defmaterial.spec); spec[3]= 1.0; glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); @@ -1286,7 +1286,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4 } /* setup energy */ - madd_v3_v3fl(energy, &la->r, la->energy); + mul_v3_v3fl(energy, &la->r, la->energy); energy[3]= 1.0; glLightfv(GL_LIGHT0+count, GL_DIFFUSE, energy); -- cgit v1.2.3 From 0eeeab515b6b46f907016091b3a89bf5e320c400 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 11:25:34 +0000 Subject: bugfix [#23506] Bevel Modifier display problem This is a more general problem that drawing functions would skip faces when the original index could not be found, screw result for example wasnt visible in editmode too. Fixed by adding a material set argument to DerivedMesh->drawMappedFaces(), this was already being done in some of the other drawing functions. --- source/blender/blenkernel/BKE_DerivedMesh.h | 3 +- source/blender/blenkernel/intern/DerivedMesh.c | 4 +- source/blender/blenkernel/intern/cdderivedmesh.c | 47 ++++++++++++------------ source/blender/blenkernel/intern/subsurf_ccg.c | 21 +++++++---- source/blender/editors/space_view3d/drawmesh.c | 2 +- source/blender/editors/space_view3d/drawobject.c | 22 +++++------ 6 files changed, 54 insertions(+), 45 deletions(-) diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 33852a1b923..5b33d9e1c53 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -280,7 +280,8 @@ struct DerivedMesh { void (*drawMappedFaces)(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), - void *userData, int useColors); + void *userData, int useColors, + int (*setMaterial)(int, void *attribs)); /* Draw mapped faces using MTFace * o Drawing options too complicated to enumerate, look at code. diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 01b02653a51..eb5d77bb9b0 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -626,7 +626,9 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use func(userData, i, cent, emdm->vertexCos?emdm->faceNos[i]:efa->n); } } -static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) + +/* note, material function is ignored for now. */ +static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) { EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm; EditFace *efa; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index e2ecf21bd62..b9ca7bfafe3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -777,7 +777,7 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tfa cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } -static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) +static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mv = cddm->mvert; @@ -798,16 +798,16 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" ); for(i = 0; i < dm->numFaceData; i++, mf++) { int drawSmooth = (mf->flag & ME_SMOOTH); + int draw= 1; - if(index) { - orig = *index++; - if(setDrawOptions && orig == ORIGINDEX_NONE) - { if(nors) nors += 3; continue; } - } - else - orig = i; + orig= (index==NULL) ? i : *index++; + + if(orig == ORIGINDEX_NONE) + draw= setMaterial(mf->mat_nr + 1, NULL); + else if (setDrawOptions != NULL) + draw= setDrawOptions(userData, orig, &drawSmooth); - if(!setDrawOptions || setDrawOptions(userData, orig, &drawSmooth)) { + if(draw) { unsigned char *cp = NULL; if(useColors && mc) @@ -887,22 +887,19 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us for( i = 0; i < tottri; i++ ) { //int actualFace = dm->drawObject->faceRemap[i]; int actualFace = next_actualFace; - int drawSmooth = (mf[actualFace].flag & ME_SMOOTH); + MFace *mface= mf + actualFace; + int drawSmooth= (mface->flag & ME_SMOOTH); int draw = 1; if(i != tottri-1) next_actualFace= dm->drawObject->faceRemap[i+1]; - - if(index) { - orig = index[actualFace]; - if(orig == ORIGINDEX_NONE) - draw = 0; - } - else - orig = actualFace; - - if(draw && !setDrawOptions(userData, orig, &drawSmooth)) - draw = 0; + + orig= (index==NULL) ? actualFace : index[actualFace]; + + if(orig == ORIGINDEX_NONE) + draw= setMaterial(mface->mat_nr + 1, NULL); + else if (setDrawOptions != NULL) + draw= setDrawOptions(userData, orig, &drawSmooth); /* Goal is to draw as long of a contiguous triangle array as possible, so draw when we hit either an @@ -974,8 +971,12 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo else if(setDrawOptions) { orig = (index)? index[a]: a; - if(orig == ORIGINDEX_NONE) - continue; + if(orig == ORIGINDEX_NONE) { + /* since the material is set by setMaterial(), faces with no + * origin can be assumed to be generated by a modifier */ + + /* continue */ + } else if(!setDrawOptions(userData, orig)) continue; } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index b0ea5f979ac..6323e1e3c79 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1619,11 +1619,12 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, if(drawParams) flag = drawParams(tf, mcol, mat_nr); - else if(index != ORIGINDEX_NONE) + else if (index != ORIGINDEX_NONE) flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1; else - flag= 1; - + flag= GPU_enable_material(mat_nr, NULL) ? 1:0; + + if (flag == 0) { /* flag 0 == the face is hidden or invisible */ if(tf) tf += gridFaces*gridFaces*numVerts; if(mcol) mcol += gridFaces*gridFaces*numVerts*4; @@ -1763,7 +1764,7 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm) } } -static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) { +static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; MCol *mcol= NULL; @@ -1795,10 +1796,14 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u mcol += gridFaces*gridFaces*numVerts*4; } - if (index!=-1) { - int draw; - draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, index, &drawSmooth); - + { + int draw= 1; + + if(index == ORIGINDEX_NONE) + draw= setMaterial(faceFlags ? faceFlags[origIndex*2 + 1] + 1: 1, NULL); /* XXX, no faceFlags no material */ + else if (setDrawOptions) + draw= setDrawOptions(userData, index, &drawSmooth); + if (draw) { if (draw==2) { glEnable(GL_POLYGON_STIPPLE); diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 53b32dd167c..7a7462433d7 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -647,7 +647,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh); } else if(faceselect) { if(ob->mode & OB_MODE_WEIGHT_PAINT) - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material); else dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 30b12b96ed5..aba3d04d960 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1867,7 +1867,7 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned data.cols[2] = actCol; data.efa_act = efa_act; - dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0); + dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material); } static int draw_dm_creases__setDrawOptions(void *userData, int index) @@ -2287,7 +2287,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object glEnable(GL_LIGHTING); glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, 0, 0); + finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, 0, 0, GPU_enable_material); glFrontFace(GL_CCW); glDisable(GL_LIGHTING); @@ -2517,7 +2517,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D /* weight paint in solid mode, special case. focus on making the weights clear * rather then the shading, this is also forced in wire view */ GPU_enable_material(0, NULL); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); bglPolygonOffset(rv3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better @@ -2599,7 +2599,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); glDisable(GL_COLOR_MATERIAL); glDisable(GL_LIGHTING); @@ -2607,10 +2607,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) { if(me->mcol) - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material); else { glColor3f(1.0f, 1.0f, 1.0f); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material); } } else do_draw= 1; @@ -6328,7 +6328,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh cpack(0); if (facecol) { - dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0); + dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0, GPU_enable_material); if(check_ob_drawface_dot(scene, v3d, ob->dt)) { glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); @@ -6339,7 +6339,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh } } else { - dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0); + dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0, GPU_enable_material); } } @@ -6369,8 +6369,8 @@ static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob) glColor3ub(0, 0, 0); - if(face_sel_mode) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0); - else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0); + if(face_sel_mode) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material); + else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material); dm->release(dm); } @@ -6477,7 +6477,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r GPU_end_object_materials(); } else if(edm) - edm->drawMappedFaces(edm, NULL, NULL, 0); + edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material); glDisable(GL_LIGHTING); } -- cgit v1.2.3 From 629ddacd48d1cb4256f25620730ab870bbd7eb60 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 5 Oct 2010 11:55:54 +0000 Subject: Fix #24135: Material modification not immediately updated in Outliner Also fixed outliner update when changing active_material_index from Py and when selecting texture from UI --- source/blender/editors/render/render_shading.c | 2 ++ source/blender/editors/space_outliner/outliner.c | 4 +++- source/blender/editors/space_outliner/space_outliner.c | 12 ++++++++++++ source/blender/makesrna/intern/rna_object.c | 14 ++++++++++---- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index debd13c8d99..71a46a16f98 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -263,6 +263,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *op) object_add_material_slot(ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob); return OPERATOR_FINISHED; } @@ -290,6 +291,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) object_remove_material_slot(ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index aaeab9e7843..b876aa11ab5 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -2050,7 +2050,9 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo } } - WM_event_add_notifier(C, NC_TEXTURE, NULL); + if(set) + WM_event_add_notifier(C, NC_TEXTURE, NULL); + return 0; } diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index d91c8caa14c..f0f9ac945ef 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -116,6 +116,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_BONE_ACTIVE: case ND_BONE_SELECT: case ND_PARENT: + case ND_OB_SHADING: ED_region_tag_redraw(ar); break; case ND_CONSTRAINT: @@ -150,6 +151,17 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) if(wmn->action == NA_RENAME) ED_region_tag_redraw(ar); break; + case NC_MATERIAL: + switch(wmn->data) { + case ND_SHADING: + case ND_SHADING_DRAW: + ED_region_tag_redraw(ar); + break; + } + break; + case NC_TEXTURE: + ED_region_tag_redraw(ar); + break; } } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3f07d953e0b..e74bec566d5 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -769,6 +769,12 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) strcpy(str, ""); } +static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_Object_internal_update(bmain, scene, ptr); + WM_main_add_notifier(NC_OBJECT|ND_OB_SHADING, ptr->id.data); +} + /* why does this have to be so complicated?, can't all this crap be * moved to in BGE conversion function? - Campbell * * @@ -1143,13 +1149,13 @@ static void rna_def_material_slot(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL); RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update"); prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, link_items); RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL); RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update"); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL); @@ -1739,14 +1745,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update"); prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range"); RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); /* transform */ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); -- cgit v1.2.3 From 1bf56930ac18c7ae6c37079fb25446108e1e7309 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 13:15:58 +0000 Subject: bugfix [#24122] Shift-C doesn't work in "Camera View" also fixed some glitches with smoothview. --- source/blender/editors/space_view3d/view3d_edit.c | 30 ++++++--------------- source/blender/editors/space_view3d/view3d_view.c | 32 +++++++++++++---------- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 06d93f01e02..4cac0e297d1 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1274,7 +1274,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) RNA_def_int(ot->srna, "my", 0, 0, INT_MAX, "Zoom Position Y", "", 0, INT_MAX); } -static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */ +static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */ { ARegion *ar= CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); @@ -1289,12 +1289,11 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. int ok= 1, onedone=0; if(center) { - min[0]= min[1]= min[2]= 0.0f; - max[0]= max[1]= max[2]= 0.0f; - /* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */ curs= give_cursor(scene, v3d); - curs[0]= curs[1]= curs[2]= 0.0; + zero_v3(min); + zero_v3(max); + zero_v3(curs); } else { INIT_MINMAX(min, max); @@ -1318,9 +1317,7 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. return OPERATOR_FINISHED; } - afm[0]= (max[0]-min[0]); - afm[1]= (max[1]-min[1]); - afm[2]= (max[2]-min[2]); + sub_v3_v3v3(afm, max, min); size= 0.7f*MAX3(afm[0], afm[1], afm[2]); if(size==0.0) ok= 0; @@ -1342,7 +1339,7 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. if (rv3d->persp==RV3D_CAMOB) { rv3d->persp= RV3D_PERSP; - smooth_view(C, NULL, v3d->camera, new_ofs, NULL, &new_dist, NULL); + smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL); } else { smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL); @@ -1358,17 +1355,6 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. return OPERATOR_FINISHED; } -static int viewhome_poll(bContext *C) -{ - if(ED_operator_view3d_active(C)) { - RegionView3D *rv3d= CTX_wm_region_view3d(C); //XXX, when accessed from a header menu this doesnt work! - if(rv3d && rv3d->persp!=RV3D_CAMOB) { - return 1; - } - } - - return 0; -} void VIEW3D_OT_view_all(wmOperatorType *ot) { @@ -1378,8 +1364,8 @@ void VIEW3D_OT_view_all(wmOperatorType *ot) ot->idname= "VIEW3D_OT_view_all"; /* api callbacks */ - ot->exec= viewhome_exec; - ot->poll= viewhome_poll; + ot->exec= view3d_all_exec; + ot->poll= ED_operator_view3d_active; /* flags */ ot->flag= 0; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index d66144b2c30..860f9f461c4 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -205,7 +205,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo if(quat) copy_qt_qt(sms.new_quat, quat); if(dist) sms.new_dist= *dist; if(lens) sms.new_lens= *lens; - + if (camera) { view3d_settings_from_ob(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens); sms.to_camera= 1; /* restore view3d values in end */ @@ -214,15 +214,15 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo if (C && U.smooth_viewtx) { int changed = 0; /* zero means no difference */ - if (sms.new_dist != rv3d->dist) + if (oldcamera != camera) changed = 1; - if (sms.new_lens != v3d->lens) + else if (sms.new_dist != rv3d->dist) changed = 1; - - if (!equals_v3v3(sms.new_ofs, rv3d->ofs)) + else if (sms.new_lens != v3d->lens) changed = 1; - - if (!equals_v4v4(sms.new_quat, rv3d->viewquat)) + else if (!equals_v3v3(sms.new_ofs, rv3d->ofs)) + changed = 1; + else if (!equals_v4v4(sms.new_quat, rv3d->viewquat)) changed = 1; /* The new view is different from the old one @@ -449,17 +449,21 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); Scene *scene= CTX_data_scene(C); - - if(BASACT) { + Object *ob = CTX_data_active_object(C); + + if(ob) { + Object *camera_old= (rv3d->persp == RV3D_CAMOB && scene->camera) ? scene->camera : NULL; rv3d->persp= RV3D_CAMOB; - v3d->camera= OBACT; + v3d->camera= ob; if(v3d->scenelock) - scene->camera= OBACT; - smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens); + scene->camera= ob; + + if(camera_old != ob) /* unlikely but looks like a glitch when set to the same */ + smooth_view(C, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens); + + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C)); } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C)); - return OPERATOR_FINISHED; } -- cgit v1.2.3 From 31ff2a6da254e17603f677261c79ce799d51db59 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 5 Oct 2010 13:39:45 +0000 Subject: Enable lcms support on Windows. --- CMakeLists.txt | 13 ++++++------ build_files/cmake/macros.cmake | 8 ++++++- build_files/scons/config/win32-vc-config.py | 7 +++++- build_files/scons/config/win64-vc-config.py | 33 ++++++----------------------- build_files/scons/tools/btools.py | 2 +- 5 files changed, 26 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f527f9d410c..e4ef5680e02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -478,13 +478,15 @@ IF(WIN32) SET(OPENCOLLADA_INC ${OPENCOLLADA}/include) SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib) SET(OPENCOLLADA_LIB OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser xml2 buffer ftoa) - #pcre is bundled with openCollada - #SET(PCRE ${LIBDIR}/pcre) - #SET(PCRE_LIBPATH ${PCRE}/lib) SET(PCRE_LIB pcre) ENDIF(WITH_OPENCOLLADA) - # TODO: IF(WITH_LCMS) + IF(WITH_LCMS) + SET(LCMS ${LIBDIR}/lcms) + SET(LCMS_INC ${LCMS}/include) + SET(LCMS_LIBPATH ${LCMS}/lib) + SET(LCMS_LIB lcms) + ENDIF(WITH_LCMS) IF(WITH_FFMPEG) SET(FFMPEG ${LIBDIR}/ffmpeg) @@ -606,9 +608,6 @@ IF(WIN32) SET(OPENCOLLADA_INC ${OPENCOLLADA}/include) SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib) SET(OPENCOLLADA_LIB OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa) - #pcre is bundled with openCollada - #SET(PCRE ${LIBDIR}/pcre) - #SET(PCRE_LIBPATH ${PCRE}/lib) SET(PCRE_LIB pcre) ENDIF(WITH_OPENCOLLADA) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 0957ace301c..08a571cceaf 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -172,11 +172,17 @@ MACRO(SETUP_LIBLINKS TARGET_LINK_LIBRARIES(${target} optimized ${EXPAT_LIB}) ENDIF(EXPAT_LIB) ELSE(WIN32) - TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB}) + TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB}) TARGET_LINK_LIBRARIES(${target} ${PCRE_LIB}) TARGET_LINK_LIBRARIES(${target} ${EXPAT_LIB}) ENDIF(WIN32) ENDIF(WITH_OPENCOLLADA) + IF(WITH_LCMS) + IF(WIN32) + TARGET_LINK_LIBRARIES(${target} debug ${LCMS_LIB}_d) + TARGET_LINK_LIBRARIES(${target} optimized ${LCMS_LIB}) + ENDIF(WIN32) + ENDIF(WITH_LCMS) IF(WIN32) TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB}) ENDIF(WIN32) diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 3572dd113bf..c8c04e74068 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -149,6 +149,12 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' +WITH_BF_LCMS = True +BF_LCMS = LIBDIR + '/lcms' +BF_LCMS_INC = '${BF_LCMS}/include' +BF_LCMS_LIB = 'lcms' +BF_LCMS_LIBPATH = '${BF_LCMS}/lib' + #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE'] @@ -188,7 +194,6 @@ PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/INCREMENTAL:NO','/N # BF_PROFILE_LINKFLAGS = ['-pg'] # BF_PROFILE = False -#turn off makebsc by default ( as 64 bit version does ) .. takes ages to build .. for nothing ( well some M$ addicts may disagree ) BF_BSC=False BF_BUILDDIR = '..\\build\\win32-vc' diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 0a4b05a28bf..8987d66a7a0 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -107,23 +107,6 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE' WITH_BF_BINRELOC = False -#WITH_BF_NSPR = True -#BF_NSPR = $(LIBDIR)/nspr -#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr -#BF_NSPR_LIB = - -# Uncomment the following line to use Mozilla inplace of netscape -#CPPFLAGS += -DMOZ_NOT_NET -# Location of MOZILLA/Netscape header files... -#BF_MOZILLA = $(LIBDIR)/mozilla -#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl -#BF_MOZILLA_LIB = -# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB -# if this is not set. -# -# Be paranoid regarding library creation (do not update archives) -#BF_PARANOID = True - # enable freetype2 support for text objects BF_WITH_FREETYPE = True BF_FREETYPE = LIBDIR + '/freetype' @@ -162,6 +145,12 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' +WITH_BF_LCMS = True +BF_LCMS = LIBDIR + '/lcms' +BF_LCMS_INC = '${BF_LCMS}/include' +BF_LCMS_LIB = 'lcms' +BF_LCMS_LIBPATH = '${BF_LCMS}/lib' + #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2'] @@ -194,9 +183,6 @@ CXX_WARN = [] LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid'] -BF_DEBUG=False -BF_BSC=False - if BF_DEBUG: BF_NUMJOBS=1 else: @@ -207,10 +193,3 @@ PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/INCREMENTAL:NO','/NO BF_BUILDDIR = '..\\build\\blender25-win64-vc' BF_INSTALLDIR='..\\install\\blender25-win64-vc' - - -######################### MERGE WITH ABOVE ################################ - - - - diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index da916a8e89c..ce8ddcf0858 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -408,7 +408,7 @@ def read_opts(env, cfg, args): ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''), ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''), - (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)), + (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', False)), ('BF_BUILDDIR', 'Build dir', ''), ('BF_INSTALLDIR', 'Installation dir', ''), -- cgit v1.2.3 From e1878f7142acb96c8b9cce4fa0557419896511e0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 15:29:06 +0000 Subject: patch [#24146] UV layout selection menu in UV editor ala CTRL+TAB in edit mode --- release/scripts/ui/space_image.py | 41 ++++++++++++++++++++++++++++++ release/scripts/ui/space_view3d.py | 18 ++++++------- source/blender/editors/mesh/mesh_ops.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 1 + 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index d2e5046c816..d46220ad7b9 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -250,6 +250,47 @@ class IMAGE_MT_uvs(bpy.types.Menu): layout.separator() layout.menu("IMAGE_MT_uvs_showhide") + +class IMAGE_MT_uvs_select_mode(bpy.types.Menu): + bl_label = "UV Select Mode" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + toolsettings = context.tool_settings + + # do smart things depending on whether uv_select_sync is on + + if toolsettings.use_uv_select_sync: + prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL') + prop.value = "(True, False, False)" + prop.data_path = "tool_settings.mesh_select_mode" + + prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL') + prop.value = "(False, True, False)" + prop.data_path = "tool_settings.mesh_select_mode" + + prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL') + prop.value = "(False, False, True)" + prop.data_path = "tool_settings.mesh_select_mode" + + else: + prop = layout.operator("wm.context_set_string", text="Vertex", icon='UV_VERTEXSEL') + prop.value = "VERTEX" + prop.data_path = "tool_settings.uv_select_mode" + + prop = layout.operator("wm.context_set_string", text="Edge", icon='UV_EDGESEL') + prop.value = "EDGE" + prop.data_path = "tool_settings.uv_select_mode" + + prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL') + prop.value = "FACE" + prop.data_path = "tool_settings.uv_select_mode" + + prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL') + prop.value = "ISLAND" + prop.data_path = "tool_settings.uv_select_mode" class IMAGE_HT_header(bpy.types.Header): diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 02f29c7632c..5bd809fea7e 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1370,7 +1370,7 @@ class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu): layout.operator("mesh.select_vertex_path") -class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): bl_label = "Mesh Select Mode" def draw(self, context): @@ -1397,7 +1397,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): @staticmethod def extrude_options(context): mesh = context.object.data - selection_mode = context.tool_settings.mesh_select_mode + select_mode = context.tool_settings.mesh_select_mode totface = mesh.total_face_sel totedge = mesh.total_edge_sel @@ -1405,7 +1405,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): # the following is dependent on selection modes # we don't really want that -# if selection_mode[0]: # vert +# if select_mode[0]: # vert # if totvert == 0: # return () # elif totvert == 1: @@ -1418,7 +1418,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): # return (0, 2, 3) # else: # return (0, 1, 2, 3) -# elif selection_mode[1]: # edge +# elif select_mode[1]: # edge # if totedge == 0: # return () # elif totedge == 1: @@ -1429,7 +1429,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): # return (0, 2) # else: # return (0, 1, 2) -# elif selection_mode[2]: # face +# elif select_mode[2]: # face # if totface == 0: # return () # elif totface == 1: @@ -1479,17 +1479,17 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): def execute(self, context): mesh = context.object.data - selection_mode = context.tool_settings.mesh_select_mode + select_mode = context.tool_settings.mesh_select_mode totface = mesh.total_face_sel totedge = mesh.total_edge_sel totvert = mesh.total_vert_sel - if selection_mode[2] and totface == 1: + if select_mode[2] and totface == 1: return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]}) - elif selection_mode[2] and totface > 1: + elif select_mode[2] and totface > 1: return bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN') - elif selection_mode[1] and totedge >= 1: + elif select_mode[1] and totedge >= 1: return bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN') else: return bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN') diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 9e071aa4a21..fa055a385f3 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -251,7 +251,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); /* selection mode */ - WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_selection_mode", TABKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0); /* hide */ WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 565bad987e3..5c4564f1946 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3239,6 +3239,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0); ED_object_generic_keymap(keyconf, keymap, 2); -- cgit v1.2.3 From 1e0d2d4700bb1a314e6771aa6404433b8c5a5d68 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 15:44:58 +0000 Subject: patch [#24125] Fix for Slider Widget (UI) from Alexander Kuznetsov (alexk) --- source/blender/editors/interface/interface_widgets.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b892ce1ca6d..134ab70e4ca 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -284,8 +284,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */ float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f; int a, tot= 0, minsize; + const int hnum= ((roundboxalign & (1|2))==(1|2) || (roundboxalign & (4|8))==(4|8)) ? 1 : 2; + const int vnum= ((roundboxalign & (1|8))==(1|8) || (roundboxalign & (2|4))==(2|4)) ? 1 : 2; - minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin); + minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum); if(2.0f*rad > minsize) rad= 0.5f*minsize; @@ -2219,7 +2221,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s uiWidgetBase wtb, wtb1; rcti rect1; double value; - float offs, fac; + float offs, toffs, fac; char outline[3]; widget_init(&wtb); @@ -2229,6 +2231,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s /* fully rounded */ offs= 0.5f*(rect->ymax - rect->ymin); + toffs = offs*0.75f; round_box_edges(&wtb, roundboxalign, rect, offs); wtb.outline= 0; @@ -2274,8 +2277,8 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s widgetbase_draw(&wtb, wcol); /* text space */ - rect->xmin += offs*0.75f; - rect->xmax -= offs*0.75f; + rect->xmin += toffs; + rect->xmax -= toffs; } /* I think 3 is sufficient border to indicate keyed status */ -- cgit v1.2.3 From 5bab95fc5800d674e3e093118df0ee080020c87d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 5 Oct 2010 16:43:01 +0000 Subject: Scons options for static linking to libsamplerate, sndfile and fftw3 --- build_files/scons/config/linux2-config.py | 8 +++++++- build_files/scons/tools/Blender.py | 16 +++++++++++++--- build_files/scons/tools/btools.py | 12 +++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index 75428937b39..a9c74d692d7 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -23,9 +23,11 @@ WITH_BF_STATICCXX = False BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a' BF_LIBSAMPLERATE = '/usr' +WITH_BF_STATICLIBSAMPLERATE = False BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include' BF_LIBSAMPLERATE_LIB = 'samplerate' BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib' +BF_LIBSAMPLERATE_LIB_STATIC = '${BF_LIBSAMPLERATE}/lib/libsamplerate.a' WITH_BF_JACK = False BF_JACK = '/usr' @@ -34,10 +36,12 @@ BF_JACK_LIB = 'jack' BF_JACK_LIBPATH = '${BF_JACK}/lib' WITH_BF_SNDFILE = False +WITH_BF_STATICSNDFILE = False BF_SNDFILE = '/usr' BF_SNDFILE_INC = '${BF_SNDFILE}/include/sndfile' BF_SNDFILE_LIB = 'sndfile' BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib' +BF_SNDFILE_LIB_STATIC = '${BF_SNDFILE}/lib/libsndfile.a ${BF_OGG}/lib/libvorbis.a ${BF_OGG}/lib/libFLAC.a ${BF_OGG}/lib/libvorbisenc.a ${BF_OGG}/lib/libogg.a' WITH_BF_SDL = True BF_SDL = '/usr' #$(shell sdl-config --prefix) @@ -136,10 +140,12 @@ BF_OPENJPEG_INC = '${BF_OPENJPEG}' BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib' WITH_BF_FFTW3 = False -BF_FFTW3 = LIBDIR + '/usr' +WITH_BF_STATICFFTW3 = False +BF_FFTW3 = '/usr' BF_FFTW3_INC = '${BF_FFTW3}/include' BF_FFTW3_LIB = 'fftw3' BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib' +BF_FFTW3_LIB_STATIC = '${BF_FFTW3_LIBPATH}/libfftw3.a' WITH_BF_REDCODE = False BF_REDCODE = '#extern/libredcode' diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index c855d9ee07e..1f503a5ea2d 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -158,6 +158,8 @@ def setup_staticlibs(lenv): statlibs += Split(lenv['BF_ZLIB_LIB_STATIC']) if lenv['WITH_BF_FFTW3']: libincs += Split(lenv['BF_FFTW3_LIBPATH']) + if lenv['WITH_BF_STATICFFTW3']: + statlibs += Split(lenv['BF_FFTW3_LIB_STATIC']) if lenv['WITH_BF_FFMPEG'] and lenv['WITH_BF_STATICFFMPEG']: statlibs += Split(lenv['BF_FFMPEG_LIB_STATIC']) if lenv['WITH_BF_INTERNATIONAL']: @@ -178,6 +180,9 @@ def setup_staticlibs(lenv): if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']: statlibs += Split(lenv['BF_PYTHON_LIB_STATIC']) + if lenv['WITH_BF_SNDFILE'] and lenv['WITH_BF_STATICSNDFILE']: + statlibs += Split(lenv['BF_SNDFILE_LIB_STATIC']) + if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): libincs += Split(lenv['BF_PTHREADS_LIBPATH']) @@ -191,6 +196,9 @@ def setup_staticlibs(lenv): if lenv['OURPLATFORM'] == 'linuxcross': libincs += Split(lenv['BF_OPENMP_LIBPATH']) + if lenv['WITH_BF_STATICLIBSAMPLERATE']: + statlibs += Split(lenv['BF_LIBSAMPLERATE_LIB_STATIC']) + # setting this last so any overriding of manually libs could be handled if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): libincs.append('/usr/lib') @@ -202,7 +210,6 @@ def setup_syslibs(lenv): lenv['BF_JPEG_LIB'], lenv['BF_PNG_LIB'], - lenv['BF_LIBSAMPLERATE_LIB'] ] if not lenv['WITH_BF_FREETYPE_STATIC']: @@ -236,9 +243,9 @@ def setup_syslibs(lenv): syslibs += Split(lenv['BF_OGG_LIB']) if lenv['WITH_BF_JACK']: syslibs += Split(lenv['BF_JACK_LIB']) - if lenv['WITH_BF_SNDFILE']: + if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']: syslibs += Split(lenv['BF_SNDFILE_LIB']) - if lenv['WITH_BF_FFTW3']: + if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']: syslibs += Split(lenv['BF_FFTW3_LIB']) if lenv['WITH_BF_SDL']: syslibs += Split(lenv['BF_SDL_LIB']) @@ -253,6 +260,9 @@ def setup_syslibs(lenv): syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) syslibs.append(lenv['BF_EXPAT_LIB']) + if not lenv['WITH_BF_STATICLIBSAMPLERATE']: + syslibs += Split(lenv['BF_LIBSAMPLERATE_LIB']) + syslibs += lenv['LLIBS'] diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index ce8ddcf0858..37d9048d70d 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -39,9 +39,9 @@ def validate_arguments(args, bc): 'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC', 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', - 'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', + 'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', 'WITH_BF_STATICLIBSAMPLERATE', 'BF_LIBSAMPLERATE_LIB_STATIC', 'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', - 'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH', + 'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH', 'WITH_BF_STATICSNDFILE', 'BF_SNDFILE_LIB_STATIC', 'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH', 'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC', 'WITH_BF_DDS', 'WITH_BF_CINEON', 'WITH_BF_HDR', @@ -61,7 +61,7 @@ def validate_arguments(args, bc): 'BF_WINTAB', 'BF_WINTAB_INC', 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC', 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH', - 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', + 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC', 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', 'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH', 'WITH_BF_PLAYER', @@ -206,6 +206,8 @@ def read_opts(env, cfg, args): ('BF_LIBSAMPLERATE_INC', 'libsamplerate aka SRC include path', ''), ('BF_LIBSAMPLERATE_LIB', 'libsamplerate aka SRC library', ''), ('BF_LIBSAMPLERATE_LIBPATH', 'libsamplerate aka SRC library path', ''), + ('BF_LIBSAMPLERATE_LIB_STATIC', 'Path to libsamplerate static library', ''), + (BoolVariable('WITH_BF_STATICLIBSAMPLERATE', 'Staticly link to libsamplerate', False)), (BoolVariable('WITH_BF_JACK', 'Enable jack support if true', True)), ('BF_JACK', 'jack base path', ''), @@ -217,7 +219,9 @@ def read_opts(env, cfg, args): ('BF_SNDFILE', 'sndfile base path', ''), ('BF_SNDFILE_INC', 'sndfile include path', ''), ('BF_SNDFILE_LIB', 'sndfile library', ''), + ('BF_SNDFILE_LIB_STATIC', 'Path to sndfile static library', ''), ('BF_SNDFILE_LIBPATH', 'sndfile library path', ''), + (BoolVariable('WITH_BF_STATICSNDFILE', 'Staticly link to sndfile', False)), ('BF_PTHREADS', 'Pthreads base path', ''), ('BF_PTHREADS_INC', 'Pthreads include path', ''), @@ -352,7 +356,9 @@ def read_opts(env, cfg, args): ('BF_FFTW3', 'FFTW3 base path', ''), ('BF_FFTW3_INC', 'FFTW3 include path', ''), ('BF_FFTW3_LIB', 'FFTW3 library', ''), + ('BF_FFTW3_LIB_STATIC', 'FFTW3 static libraries', ''), ('BF_FFTW3_LIBPATH', 'FFTW3 library path', ''), + (BoolVariable('WITH_BF_STATICFFTW3', 'Staticly link to FFTW3', False)), (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)), ('BF_OPENGL', 'OpenGL base path', ''), -- cgit v1.2.3 From 458de52151994854cd3fec191fe1761bca2c88d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 18:35:02 +0000 Subject: bugfix [#24148] unable to get keyboard mappings to work in the text window this exposes another problem: RNA_property_is_set cant be used on properties set from a keymap, they are always set. for now check for string length. --- source/blender/editors/space_console/console_ops.c | 8 +++++++- source/blender/editors/space_text/text_ops.c | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 8ececa22163..3f04d0e4293 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -403,8 +403,14 @@ static int insert_exec(bContext *C, wmOperator *op) static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(!RNA_property_is_set(op->ptr, "text")) { + // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; + + /* if alt/ctrl/super are pressed pass through */ + if(event->alt || event->ctrl || event->oskey) + return OPERATOR_PASS_THROUGH; + RNA_string_set(op->ptr, "text", str); } return insert_exec(C, op); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index ed70f31f970..e3bf390dba8 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2317,18 +2317,19 @@ static int insert_exec(bContext *C, wmOperator *op) static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { - char str[2]; int ret; - /* XXX old code from winqreadtextspace, is it still needed somewhere? */ - /* smartass code to prevent the CTRL/ALT events below from not working! */ - /*if(qual & (LR_ALTKEY|LR_CTRLKEY)) - if(!ispunct(ascii)) - ascii= 0;*/ - str[0]= event->ascii; - str[1]= '\0'; + // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + if(!RNA_string_length(op->ptr, "text")) { + char str[2] = {event->ascii, '\0'}; + + /* if alt/ctrl/super are pressed pass through */ + if(event->alt || event->ctrl || event->oskey) + return OPERATOR_PASS_THROUGH; + + RNA_string_set(op->ptr, "text", str); + } - RNA_string_set(op->ptr, "text", str); ret = insert_exec(C, op); /* run the script while editing, evil but useful */ -- cgit v1.2.3 From 0c7dce887cea687eb61ac3c660de9e84bf36997d Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 5 Oct 2010 19:05:09 +0000 Subject: Updating the bge.types docs to note which KX_GameObject attributes return mathutils objects. Also adding localLinearVelocity, worldLinearVelocity, localAngularVelocity, and worldAngularVelocity to the KX_GameObject docs. --- source/gameengine/PyDoc/bge.types.rst | 62 ++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst index 24b87e97286..6dc5488af32 100644 --- a/source/gameengine/PyDoc/bge.types.rst +++ b/source/gameengine/PyDoc/bge.types.rst @@ -929,9 +929,9 @@ Game Engine bge.types Module .. attribute:: color - The object color of the object. + The object color of the object. [r, g, b, a] - :type: list [r, g, b, a] + :type: :class:`mathutils.Vector` .. attribute:: occlusion @@ -941,63 +941,87 @@ Game Engine bge.types Module .. attribute:: position - The object's position. + The object's position. [x, y, z] On write: local position, on read: world position .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. - :type: list [x, y, z] On write: local position, on read: world position + :type: :class:`mathurils.Vector` .. attribute:: orientation - The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. + The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`. - :type: 3x3 Matrix [[float]] On write: local orientation, on read: world orientation + :type: :class:`mathutils.Matrix` .. attribute:: scaling - The object's scaling factor. list [sx, sy, sz] + The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling .. deprecated:: use :data:`localScale` and :data:`worldScale`. - :type: list [sx, sy, sz] On write: local scaling, on read: world scaling + :type: :class:`mathutils.Vector` .. attribute:: localOrientation The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. - :type: 3x3 Matrix [[float]] + :type: :class:`mathutils.Matrix` .. attribute:: worldOrientation - The object's world orientation. + The object's world orientation. 3x3 Matrix. - :type: 3x3 Matrix [[float]] + :type: :class:`mathutils.Matrix` .. attribute:: localScale - The object's local scaling factor. + The object's local scaling factor. [sx, sy, sz] - :type: list [sx, sy, sz] + :type: :class:`mathutils.Vector` .. attribute:: worldScale - The object's world scaling factor. Read-only. + The object's world scaling factor. Read-only. [sx, sy, sz] - :type: list [sx, sy, sz] + :type: :class:`mathutils.Vector` .. attribute:: localPosition - The object's local position. + The object's local position. [x, y, z] - :type: list [x, y, z] + :type: :class:`mathutils.Vector` .. attribute:: worldPosition - The object's world position. + The object's world position. [x, y, z] - :type: list [x, y, z] + :type: :class:`mathutils.Vector` + + .. attribute:: localLinearVelocity + + The object's local linear velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: worldLinearVelocity + + The object's world linear velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: localAngularVelocity + + The object's local angular velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: worldAngularVelocity + + The object's world angular velocity. [x, y, z] + + :type: :class:`mathutils.Vector` .. attribute:: timeOffset -- cgit v1.2.3 From 568cb066162b13983c8454b9d20ec010b2a1251d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 19:10:15 +0000 Subject: rename Command key to OSKey, Window manager already called it the OSKey but internally it was mixed. --- intern/ghost/GHOST_Types.h | 4 ++-- intern/ghost/intern/GHOST_EventPrinter.cpp | 5 ++--- intern/ghost/intern/GHOST_ModifierKeys.cpp | 14 +++++++------- intern/ghost/intern/GHOST_ModifierKeys.h | 4 ++-- intern/ghost/intern/GHOST_SystemCarbon.cpp | 4 ++-- intern/ghost/intern/GHOST_SystemWin32.cpp | 8 ++++---- intern/ghost/intern/GHOST_SystemX11.cpp | 10 +++++----- intern/ghost/test/multitest/EventToBuf.c | 2 +- source/blender/editors/space_outliner/outliner.c | 2 +- source/blender/editors/space_text/text_python.c | 2 +- source/blender/editors/transform/transform.c | 2 +- source/blender/makesrna/intern/rna_wm.c | 2 +- source/blender/windowmanager/intern/wm_event_system.c | 4 ++-- source/blender/windowmanager/intern/wm_window.c | 4 ++-- source/blender/windowmanager/wm_event_types.h | 4 ++-- 15 files changed, 35 insertions(+), 36 deletions(-) diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index f926e72119f..20b69611bfb 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -96,7 +96,7 @@ typedef enum { GHOST_kModifierKeyRightAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyRightControl, - GHOST_kModifierKeyCommand, // APPLE only + GHOST_kModifierKeyOS, GHOST_kModifierKeyNumMasks } GHOST_TModifierKeyMask; @@ -283,7 +283,7 @@ typedef enum { GHOST_kKeyRightControl, GHOST_kKeyLeftAlt, GHOST_kKeyRightAlt, - GHOST_kKeyCommand, // Command key on Apple, Windows key(s) on Windows + GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows GHOST_kKeyGrLess , // German PC only! GHOST_kKeyCapsLock, diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp index 645a33ab8c5..697ced64a70 100644 --- a/intern/ghost/intern/GHOST_EventPrinter.cpp +++ b/intern/ghost/intern/GHOST_EventPrinter.cpp @@ -255,9 +255,8 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, STR_String& str) const case GHOST_kKeyRightAlt: str = "RightAlt"; break; - case GHOST_kKeyCommand: - // APPLE only! - str = "Command"; + case GHOST_kKeyOS: + str = "OS"; break; case GHOST_kKeyGrLess: // PC german! diff --git a/intern/ghost/intern/GHOST_ModifierKeys.cpp b/intern/ghost/intern/GHOST_ModifierKeys.cpp index ed884966cb3..361329532f9 100644 --- a/intern/ghost/intern/GHOST_ModifierKeys.cpp +++ b/intern/ghost/intern/GHOST_ModifierKeys.cpp @@ -55,7 +55,7 @@ GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKeyMask mask) case GHOST_kModifierKeyRightAlt: key = GHOST_kKeyRightAlt; break; case GHOST_kModifierKeyLeftControl: key = GHOST_kKeyLeftControl; break; case GHOST_kModifierKeyRightControl: key = GHOST_kKeyRightControl; break; - case GHOST_kModifierKeyCommand: key = GHOST_kKeyCommand; break; + case GHOST_kModifierKeyOS: key = GHOST_kKeyOS; break; default: // Should not happen key = GHOST_kKeyUnknown; @@ -80,8 +80,8 @@ bool GHOST_ModifierKeys::get(GHOST_TModifierKeyMask mask) const return m_LeftControl; case GHOST_kModifierKeyRightControl: return m_RightControl; - case GHOST_kModifierKeyCommand: - return m_Command; + case GHOST_kModifierKeyOS: + return m_OS; default: return false; } @@ -103,8 +103,8 @@ void GHOST_ModifierKeys::set(GHOST_TModifierKeyMask mask, bool down) m_LeftControl = down; break; case GHOST_kModifierKeyRightControl: m_RightControl = down; break; - case GHOST_kModifierKeyCommand: - m_Command = down; break; + case GHOST_kModifierKeyOS: + m_OS = down; break; default: break; } @@ -119,7 +119,7 @@ void GHOST_ModifierKeys::clear() m_RightAlt = false; m_LeftControl = false; m_RightControl = false; - m_Command = false; + m_OS = false; } @@ -131,5 +131,5 @@ bool GHOST_ModifierKeys::equals(const GHOST_ModifierKeys& keys) const (m_RightAlt == keys.m_RightAlt) && (m_LeftControl == keys.m_LeftControl) && (m_RightControl == keys.m_RightControl) && - (m_Command == keys.m_Command); + (m_OS == keys.m_OS); } diff --git a/intern/ghost/intern/GHOST_ModifierKeys.h b/intern/ghost/intern/GHOST_ModifierKeys.h index e18899bc939..77d6d5757d9 100644 --- a/intern/ghost/intern/GHOST_ModifierKeys.h +++ b/intern/ghost/intern/GHOST_ModifierKeys.h @@ -96,8 +96,8 @@ struct GHOST_ModifierKeys GHOST_TUns8 m_LeftControl : 1; /** Bitfield that stores the appropriate key state. */ GHOST_TUns8 m_RightControl : 1; - /** Bitfield that stores the appropriate key state. APPLE only! */ - GHOST_TUns8 m_Command : 1; + /** Bitfield that stores the appropriate key state. */ + GHOST_TUns8 m_OS : 1; }; #endif // _GHOST_MODIFIER_KEYS_H_ diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index ecdc03b4347..75cbe5db574 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -553,7 +553,7 @@ GHOST_TSuccess GHOST_SystemCarbon::getModifierKeys(GHOST_ModifierKeys& keys) con { UInt32 modifiers = ::GetCurrentKeyModifiers(); - keys.set(GHOST_kModifierKeyCommand, (modifiers & cmdKey) ? true : false); + keys.set(GHOST_kModifierKeyOS, (modifiers & cmdKey) ? true : false); keys.set(GHOST_kModifierKeyLeftAlt, (modifiers & optionKey) ? true : false); keys.set(GHOST_kModifierKeyLeftShift, (modifiers & shiftKey) ? true : false); keys.set(GHOST_kModifierKeyLeftControl, (modifiers & controlKey) ? true : false); @@ -941,7 +941,7 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event) pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) ); } if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) { - pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) ); + pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) ); } m_modifierMask = modifiers; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index dceecb53dd2..62559953195 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -303,9 +303,9 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) cons bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; if(lwindown || rwindown) - keys.set(GHOST_kModifierKeyCommand, true); + keys.set(GHOST_kModifierKeyOS, true); else - keys.set(GHOST_kModifierKeyCommand, false); + keys.set(GHOST_kModifierKeyOS, false); } else { bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0; @@ -320,9 +320,9 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) cons bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; if(lwindown || rwindown) - keys.set(GHOST_kModifierKeyCommand, true); + keys.set(GHOST_kModifierKeyOS, true); else - keys.set(GHOST_kModifierKeyCommand, false); + keys.set(GHOST_kModifierKeyOS, false); } return GHOST_kSuccess; } diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index b07dba7319f..393761566ba 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -891,13 +891,13 @@ getModifierKeys( keys.set(GHOST_kModifierKeyRightAlt,false); } - // Super (Windows) - only one GHOST-kModifierKeyCommand, so mapping + // Super (Windows) - only one GHOST-kModifierKeyOS, so mapping // to either if ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) { - keys.set(GHOST_kModifierKeyCommand,true); + keys.set(GHOST_kModifierKeyOS,true); } else { - keys.set(GHOST_kModifierKeyCommand,false); + keys.set(GHOST_kModifierKeyOS,false); } return GHOST_kSuccess; } @@ -1106,8 +1106,8 @@ convertXKey( GXMAP(type,XK_Control_R, GHOST_kKeyRightControl); GXMAP(type,XK_Alt_L, GHOST_kKeyLeftAlt); GXMAP(type,XK_Alt_R, GHOST_kKeyRightAlt); - GXMAP(type,XK_Super_L, GHOST_kKeyCommand); - GXMAP(type,XK_Super_R, GHOST_kKeyCommand); + GXMAP(type,XK_Super_L, GHOST_kKeyOS); + GXMAP(type,XK_Super_R, GHOST_kKeyOS); GXMAP(type,XK_Insert, GHOST_kKeyInsert); GXMAP(type,XK_Delete, GHOST_kKeyDelete); diff --git a/intern/ghost/test/multitest/EventToBuf.c b/intern/ghost/test/multitest/EventToBuf.c index 1dbaad35994..859600bb783 100644 --- a/intern/ghost/test/multitest/EventToBuf.c +++ b/intern/ghost/test/multitest/EventToBuf.c @@ -125,7 +125,7 @@ static char *keytype_to_string(GHOST_TKey key) { K(KeyRightControl); K(KeyLeftAlt); K(KeyRightAlt); - K(KeyCommand); + K(KeyOS); K(KeyCapsLock); K(KeyNumLock); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index b876aa11ab5..c9aac8502c4 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -5545,7 +5545,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, OL_H-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5; uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3; uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3; - uiDefButS(block, OPTION, 0, "Cmd", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3; + uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3; xstart+= 5; uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->keymodifier, "Key Modifier code"); xstart+= butw3+5; diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index aee1a7ecfd6..9be554924c9 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -182,7 +182,7 @@ static void confirm_suggestion(Text *text, int skipleft) #define LR_SHIFTKEY 0 #define LR_ALTKEY 0 #define LR_CTRLKEY 0 -#define LR_COMMANDKEY 0 +#define LR_OSKEY 0 // XXX static int doc_scroll= 0; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a6fcfb04982..1778e648e20 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1534,7 +1534,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) || - (kmi->type == COMMANDKEY && event->oskey)) { + (kmi->type == OSKEY && event->oskey)) { t->modifiers |= MOD_SNAP_INVERT; } break; diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 62d0c99f6c5..7e54a3b14fa 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -175,7 +175,7 @@ EnumPropertyItem event_type_items[] = { {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", ""}, {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", ""}, {0, "", 0, NULL, NULL}, - {COMMANDKEY, "COMMAND", 0, "Command", ""}, + {OSKEY, "OSKEY", 0, "OS Key", ""}, {0, "", 0, NULL, NULL}, {ESCKEY, "ESC", 0, "Esc", ""}, {TABKEY, "TAB", 0, "Tab", ""}, diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 590d28012f9..334bc79b96a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2067,7 +2067,7 @@ static int convert_key(GHOST_TKey key) case GHOST_kKeyRightShift: return RIGHTSHIFTKEY; case GHOST_kKeyLeftControl: return LEFTCTRLKEY; case GHOST_kKeyRightControl: return RIGHTCTRLKEY; - case GHOST_kKeyCommand: return COMMANDKEY; + case GHOST_kKeyOS: return OSKEY; case GHOST_kKeyLeftAlt: return LEFTALTKEY; case GHOST_kKeyRightAlt: return RIGHTALTKEY; @@ -2324,7 +2324,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t if(event.val==KM_PRESS && (evt->ctrl || evt->shift || evt->oskey)) event.alt= evt->alt = 3; // define? } - else if (event.type==COMMANDKEY) { + else if (event.type==OSKEY) { event.oskey= evt->oskey= (event.val==KM_PRESS); if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->shift)) event.oskey= evt->oskey = 3; // define? diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 328c3e80259..d9d7abd3a68 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -528,7 +528,7 @@ static int query_qual(char qual) left= GHOST_kModifierKeyLeftControl; right= GHOST_kModifierKeyRightControl; } else if (qual=='C') { - left= right= GHOST_kModifierKeyCommand; + left= right= GHOST_kModifierKeyOS; } else { left= GHOST_kModifierKeyLeftAlt; right= GHOST_kModifierKeyRightAlt; @@ -613,7 +613,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } if (win->eventstate->oskey && !query_qual('C')) { - kdata.key= GHOST_kKeyCommand; + kdata.key= GHOST_kKeyOS; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index e4b56080b03..efc31f6f7c3 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -204,7 +204,7 @@ #define ENDKEY 170 #define UNKNOWNKEY 171 -#define COMMANDKEY 172 +#define OSKEY 172 #define GRLESSKEY 173 /* for event checks */ @@ -215,7 +215,7 @@ #define ISKEYBOARD(event) (event >=' ' && event <=320) /* test whether the event is a modifier key */ -#define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == COMMANDKEY) +#define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY) /* test whether the event is a mouse button */ #define ISMOUSE(event) (event >= LEFTMOUSE && event <= MOUSEROTATE) -- cgit v1.2.3 From de1c5de70814c2eba5d273ac4ce4c73e38d3f309 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 19:14:41 +0000 Subject: bugfix [#24151] AddPresetBase class does not add Color import when saving color properties --- release/scripts/op/presets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 07852550ab7..4af27480669 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -63,6 +63,7 @@ class AddPresetBase(): else: file_preset = open(filepath, 'w') file_preset.write("import bpy\n") + file_preset.write("from mathutils import *\n") for rna_path in self.preset_values: value = eval(rna_path) -- cgit v1.2.3 From 8408997c84d6c4a8b47808422ed73d7d754ff509 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Oct 2010 21:22:33 +0000 Subject: remove some unused code and reduced the scope if some vars (no functional change). --- source/blender/blenkernel/intern/font.c | 8 ++++---- source/blender/blenkernel/intern/idprop.c | 9 ++------- source/blender/blenkernel/intern/image.c | 10 ++++++---- source/blender/blenkernel/intern/unit.c | 3 +-- source/blender/python/intern/bpy_rna.c | 3 +-- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 47627d09b97..131b16b319e 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -514,11 +514,12 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float float *fp, fsize, shear, x, si, co; VFontData *vfd = NULL; VChar *che = NULL; - int i, sel=0; + int i; vfd= vfont_get_data(which_vfont(cu, info)); if (!vfd) return; + /* if (cu->selend < cu->selstart) { if ((charidx >= (cu->selend)) && (charidx <= (cu->selstart-2))) sel= 1; @@ -527,6 +528,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float if ((charidx >= (cu->selstart-1)) && (charidx <= (cu->selend-1))) sel= 1; } + */ /* make a copy at distance ofsx,ofsy with shear*/ fsize= cu->fsize; @@ -1148,14 +1150,12 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if(mode == FO_EDIT) { /* make nurbdata */ - unsigned long cha; - freeNurblist(&cu->nurb); ct= chartransdata; if (cu->sepchar==0) { for (i= 0; imat_nr > (ob->totcol)) { /* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */ diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index a0df73d6c42..639e2062f83 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -421,9 +421,7 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) IDProperty *loop, *prop; for (prop=src->data.group.first; prop; prop=prop->next) { for (loop=dest->data.group.first; loop; loop=loop->next) { - if (BSTR_EQ(loop->name, prop->name)) { - int copy_done= 0; - + if (strcmp(loop->name, prop->name)==0) { if(prop->type==loop->type) { switch (prop->type) { @@ -431,11 +429,9 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) case IDP_FLOAT: case IDP_DOUBLE: loop->data= prop->data; - copy_done= 1; break; case IDP_GROUP: IDP_SyncGroupValues(loop, prop); - copy_done= 1; break; default: { @@ -702,7 +698,6 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) case IDP_STRING: { char *st = val.str; - int stlen; prop = MEM_callocN(sizeof(IDProperty), "IDProperty string"); if (st == NULL) { @@ -710,7 +705,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) prop->totallen = DEFAULT_ALLOC_FOR_NULL_STRINGS; prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/ } else { - stlen = strlen(st) + 1; + int stlen = strlen(st) + 1; prop->data.pointer = MEM_callocN(stlen, "id property string 2"); prop->len = prop->totallen = stlen; strcpy(prop->data.pointer, st); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index cb2261932ce..6dd1d4280ec 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -596,7 +596,7 @@ void BKE_image_free_all_textures(void) { Tex *tex; Image *ima; - unsigned int totsize= 0; + /* unsigned int totsize= 0; */ for(ima= G.main->image.first; ima; ima= ima->id.next) ima->id.flag &= ~LIB_DOIT; @@ -607,13 +607,14 @@ void BKE_image_free_all_textures(void) for(ima= G.main->image.first; ima; ima= ima->id.next) { if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) { + /* ImBuf *ibuf; for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) { if(ibuf->mipmap[0]) totsize+= 1.33*ibuf->x*ibuf->y*4; else totsize+= ibuf->x*ibuf->y*4; - } + } */ image_free_buffers(ima); } } @@ -2183,7 +2184,7 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser) void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr) { - int imanr, len; + int len; /* here (+fie_ima/2-1) makes sure that division happens correctly */ len= (iuser->fie_ima*iuser->frames)/2; @@ -2192,8 +2193,9 @@ void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr) iuser->framenr= 0; } else { + int imanr; cfra= cfra - iuser->sfra+1; - + /* cyclic */ if(iuser->cycl) { cfra= ( (cfra) % len ); diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 3d984c7e877..25aab77ba9b 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -398,7 +398,6 @@ void bUnit_AsString(char *str, int len_max, double value, int prec, int system, /* split output makes sense only for length, mass and time */ if(split && (type==B_UNIT_LENGTH || type==B_UNIT_MASS || type==B_UNIT_TIME)) { - int i; bUnitDef *unit_a, *unit_b; double value_a, value_b; @@ -406,7 +405,7 @@ void bUnit_AsString(char *str, int len_max, double value, int prec, int system, /* check the 2 is a smaller unit */ if(unit_b > unit_a) { - i= unit_as_string(str, len_max, value_a, prec, usys, unit_a, '\0'); + int i= unit_as_string(str, len_max, value_a, prec, usys, unit_a, '\0'); /* is there enough space for at least 1 char of the next unit? */ if(i+2 < len_max) { diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 93106d5400f..166213fa07c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3459,10 +3459,9 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA * PyObject *ret; int type = RNA_property_type(prop); int flag = RNA_property_flag(prop); - int a; if(RNA_property_array_check(ptr, prop)) { - int len; + int a, len; if (flag & PROP_DYNAMIC) { ParameterDynAlloc *data_alloc= data; -- cgit v1.2.3 From eef0ffe9be45fce28436f0be0abdbea6243675ed Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 5 Oct 2010 22:32:29 +0000 Subject: Unhide confirm on release property (otherwise, it's not easily modifiable in the keymap editor). --- source/blender/editors/transform/transform_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 0187a3b3567..95e167053ec 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -445,9 +445,9 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } } - // Add confirm method all the time. At the end because it's not really that important and should be hidden + // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button"); - RNA_def_property_flag(prop, PROP_HIDDEN); + //RNA_def_property_flag(prop, PROP_HIDDEN); } void TRANSFORM_OT_translate(struct wmOperatorType *ot) -- cgit v1.2.3 From 70def5c247583f0df6d190ebc1b7a2b9b69dfc3f Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 5 Oct 2010 23:14:31 +0000 Subject: [#24123] Network render gives black images Error with buffer handling when reading response. Also fix bug with blendfile relative path (wasn't converting them properly). --- release/scripts/io/netrender/client.py | 29 +++++++++++++++++------------ release/scripts/io/netrender/operators.py | 9 +++------ release/scripts/io/netrender/slave.py | 4 +++- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/release/scripts/io/netrender/client.py b/release/scripts/io/netrender/client.py index c17944725b0..128ae99ab1d 100644 --- a/release/scripts/io/netrender/client.py +++ b/release/scripts/io/netrender/client.py @@ -211,7 +211,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine): address = "" if netsettings.server_address == "[default]" else netsettings.server_address - master.runMaster((address, netsettings.server_port), netsettings.use_master_broadcast, netsettings.use_master_clear, netsettings.path, self.update_stats, self.test_break) + master.runMaster((address, netsettings.server_port), netsettings.use_master_broadcast, netsettings.use_master_clear, bpy.path.abspath(netsettings.path), self.update_stats, self.test_break) def render_slave(self, scene): @@ -236,10 +236,11 @@ class NetworkRenderEngine(bpy.types.RenderEngine): # reading back result self.update_stats("", "Network render waiting for results") - + + requestResult(conn, job_id, scene.frame_current) response = conn.getresponse() - response.read() + buf = response.read() if response.status == http.client.NO_CONTENT: new_job = True @@ -248,13 +249,13 @@ class NetworkRenderEngine(bpy.types.RenderEngine): requestResult(conn, job_id, scene.frame_current) response = conn.getresponse() - response.read() - + buf = response.read() + while response.status == http.client.ACCEPTED and not self.test_break(): time.sleep(1) requestResult(conn, job_id, scene.frame_current) response = conn.getresponse() - response.read() + buf = response.read() # cancel new jobs (animate on network) on break if self.test_break() and new_job: @@ -271,18 +272,22 @@ class NetworkRenderEngine(bpy.types.RenderEngine): r = scene.render x= int(r.resolution_x*r.resolution_percentage*0.01) y= int(r.resolution_y*r.resolution_percentage*0.01) + + result_path = os.path.join(bpy.path.abspath(netsettings.path), "output.exr") + + folder = os.path.split(result_path)[0] + + if not os.path.exists(folder): + os.mkdir(folder) - f = open(os.path.join(netsettings.path, "output.exr"), "wb") - buf = response.read(1024) + f = open(result_path, "wb") - while buf: - f.write(buf) - buf = response.read(1024) + f.write(buf) f.close() result = self.begin_result(0, 0, x, y) - result.load_from_file(os.path.join(netsettings.path, "output.exr")) + result.load_from_file(result_path) self.end_result(result) conn.close() diff --git a/release/scripts/io/netrender/operators.py b/release/scripts/io/netrender/operators.py index 2b40cd77125..96601dcf653 100644 --- a/release/scripts/io/netrender/operators.py +++ b/release/scripts/io/netrender/operators.py @@ -417,7 +417,7 @@ class netclientdownload(bpy.types.Operator): for frame in job.frames: client.requestResult(conn, job.id, frame.number) response = conn.getresponse() - response.read() + buf = response.read() if response.status != http.client.OK: print("missing", frame.number) @@ -425,12 +425,9 @@ class netclientdownload(bpy.types.Operator): print("got back", frame.number) - f = open(os.path.join(netsettings.path, "%06d.exr" % frame.number), "wb") - buf = response.read(1024) + f = open(os.path.join(bpy.path.abspath(netsettings.path), "%06d.exr" % frame.number), "wb") - while buf: - f.write(buf) - buf = response.read(1024) + f.write(buf) f.close() diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py index f017fefa4e3..526bd0b254f 100644 --- a/release/scripts/io/netrender/slave.py +++ b/release/scripts/io/netrender/slave.py @@ -21,6 +21,8 @@ import http, http.client, http.server, urllib import subprocess, time import json +import bpy + from netrender.utils import * import netrender.model import netrender.repath @@ -118,7 +120,7 @@ def render_slave(engine, netsettings, threads): slave_id = response.getheader("slave-id") - NODE_PREFIX = os.path.join(netsettings.path, "slave_" + slave_id) + NODE_PREFIX = os.path.join(bpy.path.abspath(netsettings.path), "slave_" + slave_id) if not os.path.exists(NODE_PREFIX): os.mkdir(NODE_PREFIX) -- cgit v1.2.3 From 02d97e4da297b8fa112811470846c0ae4598412a Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 6 Oct 2010 00:36:12 +0000 Subject: Campbell requested that I remove one of the bge.events.RETKEY aliases, so I'm removing bge.events.RETURNKEY. --- source/gameengine/Ketsji/KX_PythonInit.cpp | 1 - source/gameengine/PyDoc/bge.events.rst | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 473e6fc9265..cc44be2654b 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -2215,7 +2215,6 @@ PyObject* initGameKeys() KX_MACRO_addTypesToDict(d, TABKEY, SCA_IInputDevice::KX_TABKEY); KX_MACRO_addTypesToDict(d, RETKEY, SCA_IInputDevice::KX_RETKEY); KX_MACRO_addTypesToDict(d, ENTERKEY, SCA_IInputDevice::KX_RETKEY); - KX_MACRO_addTypesToDict(d, RETURNKEY, SCA_IInputDevice::KX_RETKEY); KX_MACRO_addTypesToDict(d, SPACEKEY, SCA_IInputDevice::KX_SPACEKEY); KX_MACRO_addTypesToDict(d, LINEFEEDKEY, SCA_IInputDevice::KX_LINEFEEDKEY); KX_MACRO_addTypesToDict(d, BACKSPACEKEY, SCA_IInputDevice::KX_BACKSPACEKEY); diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst index 5738e7a0f48..7215902a828 100644 --- a/source/gameengine/PyDoc/bge.events.rst +++ b/source/gameengine/PyDoc/bge.events.rst @@ -242,9 +242,8 @@ Other Keys .. data:: PERIODKEY .. data:: QUOTEKEY .. data:: RIGHTBRACKETKEY -.. data:: RETKEY (Deprecated: use bge.events.ENTERKEY or bge.events.RETURNKEY) +.. data:: RETKEY (Deprecated: use bge.events.ENTERKEY) .. data:: ENTERKEY -.. data:: RETURNKEY .. data:: SEMICOLONKEY .. data:: SLASHKEY .. data:: SPACEKEY -- cgit v1.2.3 From fdadab10062cd9fbef6a6585fd19f344280a9d5b Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 07:13:42 +0000 Subject: COLLADA exporter: split camera and light export into own files. --- CMakeLists.txt | 2 +- source/blender/collada/CameraExporter.cpp | 86 ++++++++ source/blender/collada/CameraExporter.h | 43 ++++ source/blender/collada/DocumentExporter.cpp | 296 +--------------------------- source/blender/collada/LightExporter.cpp | 106 ++++++++++ source/blender/collada/LightExporter.h | 43 ++++ source/blender/collada/collada_internal.cpp | 240 ++++++++++++++++++++++ source/blender/collada/collada_internal.h | 74 +++---- 8 files changed, 555 insertions(+), 335 deletions(-) create mode 100644 source/blender/collada/CameraExporter.cpp create mode 100644 source/blender/collada/CameraExporter.h create mode 100644 source/blender/collada/LightExporter.cpp create mode 100644 source/blender/collada/LightExporter.h create mode 100644 source/blender/collada/collada_internal.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e4ef5680e02..3ace8a771c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -483,7 +483,7 @@ IF(WIN32) IF(WITH_LCMS) SET(LCMS ${LIBDIR}/lcms) - SET(LCMS_INC ${LCMS}/include) + SET(LCMS_INCLUDE_DIR ${LCMS}/include) SET(LCMS_LIBPATH ${LCMS}/lib) SET(LCMS_LIB lcms) ENDIF(WITH_LCMS) diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp new file mode 100644 index 00000000000..b4ccfd5d6d1 --- /dev/null +++ b/source/blender/collada/CameraExporter.cpp @@ -0,0 +1,86 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "COLLADASWCamera.h" +#include "COLLADASWCameraOptic.h" + +#include "DNA_camera_types.h" + +#include "CameraExporter.h" + +#include "collada_internal.h" + +CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryCameras(sw){} + +template +void forEachCameraObjectInScene(Scene *sce, Functor &f) +{ + Base *base= (Base*) sce->base.first; + while(base) { + Object *ob = base->object; + + if (ob->type == OB_CAMERA && ob->data) { + f(ob, sce); + } + base= base->next; + } +} + +void CamerasExporter::exportCameras(Scene *sce) +{ + openLibrary(); + + forEachCameraObjectInScene(sce, *this); + + closeLibrary(); +} +void CamerasExporter::operator()(Object *ob, Scene *sce) +{ + // TODO: shiftx, shifty, YF_dofdist + Camera *cam = (Camera*)ob->data; + std::string cam_id(get_camera_id(ob)); + std::string cam_name(id_name(cam)); + + if (cam->type == CAM_PERSP) { + COLLADASW::PerspectiveOptic persp(mSW); + persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI)); + persp.setAspectRatio(1.0); + persp.setZFar(cam->clipend); + persp.setZNear(cam->clipsta); + COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name); + addCamera(ccam); + } + else { + COLLADASW::OrthographicOptic ortho(mSW); + ortho.setXMag(cam->ortho_scale); + ortho.setAspectRatio(1.0); + ortho.setZFar(cam->clipend); + ortho.setZNear(cam->clipsta); + COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); + addCamera(ccam); + } +} diff --git a/source/blender/collada/CameraExporter.h b/source/blender/collada/CameraExporter.h new file mode 100644 index 00000000000..a4605b99f52 --- /dev/null +++ b/source/blender/collada/CameraExporter.h @@ -0,0 +1,43 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __CAMERAEXPORTER_H__ +#define __CAMERAEXPORTER_H__ + +#include "COLLADASWStreamWriter.h" +#include "COLLADASWLibraryCameras.h" + +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +class CamerasExporter: COLLADASW::LibraryCameras +{ +public: + CamerasExporter(COLLADASW::StreamWriter *sw); + void exportCameras(Scene *sce); + void operator()(Object *ob, Scene *sce); +}; + +#endif diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index c13e089fa4a..661f31f5210 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -95,11 +95,11 @@ extern char build_rev[]; #include "COLLADASWTexture.h" #include "COLLADASWLibraryMaterials.h" #include "COLLADASWBindMaterial.h" -#include "COLLADASWLibraryCameras.h" +//#include "COLLADASWLibraryCameras.h" #include "COLLADASWLibraryLights.h" #include "COLLADASWInstanceCamera.h" #include "COLLADASWInstanceLight.h" -#include "COLLADASWCameraOptic.h" +//#include "COLLADASWCameraOptic.h" #include "COLLADASWConstants.h" #include "COLLADASWLibraryControllers.h" #include "COLLADASWInstanceController.h" @@ -108,6 +108,9 @@ extern char build_rev[]; #include "collada_internal.h" #include "DocumentExporter.h" +#include "CameraExporter.h" +#include "LightExporter.h" + #include #include // std::find @@ -128,161 +131,6 @@ char *CustomData_get_active_layer_name(const CustomData *data, int type) return data->layers[layer_index].name; } -/** -Translation map. -Used to translate every COLLADA id to a valid id, no matter what "wrong" letters may be -included. Look at the IDREF XSD declaration for more. -Follows strictly the COLLADA XSD declaration which explicitly allows non-english chars, -like special chars (e.g. micro sign), umlauts and so on. -The COLLADA spec also allows additional chars for member access ('.'), these -must obviously be removed too, otherwise they would be heavily misinterpreted. -*/ -const unsigned char translate_start_name_map[256] = { -95, 95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -65, 66, 67, 68, 69, 70, 71, 72, -73, 74, 75, 76, 77, 78, 79, 80, -81, 82, 83, 84, 85, 86, 87, 88, -89, 90, 95, 95, 95, 95, 95, 95, -97, 98, 99, 100, 101, 102, 103, 104, -105, 106, 107, 108, 109, 110, 111, 112, -113, 114, 115, 116, 117, 118, 119, 120, -121, 122, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 192, -193, 194, 195, 196, 197, 198, 199, 200, -201, 202, 203, 204, 205, 206, 207, 208, -209, 210, 211, 212, 213, 214, 95, 216, -217, 218, 219, 220, 221, 222, 223, 224, -225, 226, 227, 228, 229, 230, 231, 232, -233, 234, 235, 236, 237, 238, 239, 240, -241, 242, 243, 244, 245, 246, 95, 248, -249, 250, 251, 252, 253, 254, 255}; - -const unsigned char translate_name_map[256] = { -95, 95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 45, 95, 95, 48, -49, 50, 51, 52, 53, 54, 55, 56, -57, 95, 95, 95, 95, 95, 95, 95, -65, 66, 67, 68, 69, 70, 71, 72, -73, 74, 75, 76, 77, 78, 79, 80, -81, 82, 83, 84, 85, 86, 87, 88, -89, 90, 95, 95, 95, 95, 95, 95, -97, 98, 99, 100, 101, 102, 103, 104, -105, 106, 107, 108, 109, 110, 111, 112, -113, 114, 115, 116, 117, 118, 119, 120, -121, 122, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 95, 95, -95, 95, 95, 95, 95, 95, 183, 95, -95, 95, 95, 95, 95, 95, 95, 192, -193, 194, 195, 196, 197, 198, 199, 200, -201, 202, 203, 204, 205, 206, 207, 208, -209, 210, 211, 212, 213, 214, 95, 216, -217, 218, 219, 220, 221, 222, 223, 224, -225, 226, 227, 228, 229, 230, 231, 232, -233, 234, 235, 236, 237, 238, 239, 240, -241, 242, 243, 244, 245, 246, 95, 248, -249, 250, 251, 252, 253, 254, 255}; - -typedef std::map< std::string, std::vector > map_string_list; -map_string_list global_id_map; - -/** Look at documentation of translate_map */ -static std::string translate_id(const std::string &id) -{ - if (id.size() == 0) - { return id; } - std::string id_translated = id; - id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]]; - for (unsigned int i=1; i < id_translated.size(); i++) - { - id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; - } - // It's so much workload now, the if() should speed up things. - if (id_translated != id) - { - // Search duplicates - map_string_list::iterator iter = global_id_map.find(id_translated); - if (iter != global_id_map.end()) - { - unsigned int i = 0; - bool found = false; - for (i=0; i < iter->second.size(); i++) - { - if (id == iter->second[i]) - { - found = true; - break; - } - } - bool convert = false; - if (found) - { - if (i > 0) - { convert = true; } - } - else - { - convert = true; - global_id_map[id_translated].push_back(id); - } - if (convert) - { - std::stringstream out; - out << ++i; - id_translated += out.str(); - } - } - else { global_id_map[id_translated].push_back(id); } - } - return id_translated; -} - -static std::string id_name(void *id) -{ - return ((ID*)id)->name + 2; -} - -static std::string get_geometry_id(Object *ob) -{ - return translate_id(id_name(ob)) + "-mesh"; -} - -static std::string get_light_id(Object *ob) -{ - return translate_id(id_name(ob)) + "-light"; -} - -static std::string get_camera_id(Object *ob) -{ - return translate_id(id_name(ob)) + "-camera"; -} - -std::string get_joint_id(Bone *bone, Object *ob_arm) -{ - return translate_id(id_name(ob_arm) + "_" + bone->name); -} /* @@ -321,34 +169,6 @@ void forEachObjectInScene(Scene *sce, Functor &f) } } -template -void forEachCameraObjectInScene(Scene *sce, Functor &f) -{ - Base *base= (Base*) sce->base.first; - while(base) { - Object *ob = base->object; - - if (ob->type == OB_CAMERA && ob->data) { - f(ob, sce); - } - base= base->next; - } -} - -template -void forEachLampObjectInScene(Scene *sce, Functor &f) -{ - Base *base= (Base*) sce->base.first; - while(base) { - Object *ob = base->object; - - if (ob->type == OB_LAMP && ob->data) { - f(ob); - } - base= base->next; - } -} - // used in forEachMaterialInScene template class ForEachMaterialFunctor @@ -1869,108 +1689,6 @@ public: } }; -class CamerasExporter: COLLADASW::LibraryCameras -{ -public: - CamerasExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryCameras(sw){} - void exportCameras(Scene *sce) - { - openLibrary(); - - forEachCameraObjectInScene(sce, *this); - - closeLibrary(); - } - void operator()(Object *ob, Scene *sce) - { - // TODO: shiftx, shifty, YF_dofdist - Camera *cam = (Camera*)ob->data; - std::string cam_id(get_camera_id(ob)); - std::string cam_name(id_name(cam)); - - if (cam->type == CAM_PERSP) { - COLLADASW::PerspectiveOptic persp(mSW); - persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI)); - persp.setAspectRatio(1.0); - persp.setZFar(cam->clipend); - persp.setZNear(cam->clipsta); - COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name); - addCamera(ccam); - } - else { - COLLADASW::OrthographicOptic ortho(mSW); - ortho.setXMag(cam->ortho_scale); - ortho.setAspectRatio(1.0); - ortho.setZFar(cam->clipend); - ortho.setZNear(cam->clipsta); - COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); - addCamera(ccam); - } - } -}; - -class LightsExporter: COLLADASW::LibraryLights -{ -public: - LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){} - void exportLights(Scene *sce) - { - openLibrary(); - - forEachLampObjectInScene(sce, *this); - - closeLibrary(); - } - void operator()(Object *ob) - { - Lamp *la = (Lamp*)ob->data; - std::string la_id(get_light_id(ob)); - std::string la_name(id_name(la)); - COLLADASW::Color col(la->r, la->g, la->b); - float e = la->energy; - - // sun - if (la->type == LA_SUN) { - COLLADASW::DirectionalLight cla(mSW, la_id, la_name, e); - cla.setColor(col); - addLight(cla); - } - // hemi - else if (la->type == LA_HEMI) { - COLLADASW::AmbientLight cla(mSW, la_id, la_name, e); - cla.setColor(col); - addLight(cla); - } - // spot - else if (la->type == LA_SPOT) { - COLLADASW::SpotLight cla(mSW, la_id, la_name, e); - cla.setColor(col); - cla.setFallOffAngle(la->spotsize); - cla.setFallOffExponent(la->spotblend); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); - addLight(cla); - } - // lamp - else if (la->type == LA_LOCAL) { - COLLADASW::PointLight cla(mSW, la_id, la_name, e); - cla.setColor(col); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); - addLight(cla); - } - // area lamp is not supported - // it will be exported as a local lamp - else { - COLLADASW::PointLight cla(mSW, la_id, la_name, e); - cla.setColor(col); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); - addLight(cla); - } - } -}; - // TODO: it would be better to instantiate animations rather than create a new one per object // COLLADA allows this through multiple s in . // For this to work, we need to know objects that use a certain action. @@ -2584,8 +2302,8 @@ protected: void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) { - global_id_map.clear(); - + clear_global_id_map(); + COLLADABU::NativeString native_filename = COLLADABU::NativeString(std::string(filename)); COLLADASW::StreamWriter sw(native_filename); diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp new file mode 100644 index 00000000000..0bedce41bc0 --- /dev/null +++ b/source/blender/collada/LightExporter.cpp @@ -0,0 +1,106 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "COLLADASWColor.h" +#include "COLLADASWLight.h" + +#include "DNA_lamp_types.h" + +#include "LightExporter.h" +#include "collada_internal.h" + +template +void forEachLampObjectInScene(Scene *sce, Functor &f) +{ + Base *base= (Base*) sce->base.first; + while(base) { + Object *ob = base->object; + + if (ob->type == OB_LAMP && ob->data) { + f(ob); + } + base= base->next; + } +} + +LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){} +void LightsExporter::exportLights(Scene *sce) +{ + openLibrary(); + + forEachLampObjectInScene(sce, *this); + + closeLibrary(); +} +void LightsExporter::operator()(Object *ob) +{ + Lamp *la = (Lamp*)ob->data; + std::string la_id(get_light_id(ob)); + std::string la_name(id_name(la)); + COLLADASW::Color col(la->r, la->g, la->b); + float e = la->energy; + + // sun + if (la->type == LA_SUN) { + COLLADASW::DirectionalLight cla(mSW, la_id, la_name, e); + cla.setColor(col); + addLight(cla); + } + // hemi + else if (la->type == LA_HEMI) { + COLLADASW::AmbientLight cla(mSW, la_id, la_name, e); + cla.setColor(col); + addLight(cla); + } + // spot + else if (la->type == LA_SPOT) { + COLLADASW::SpotLight cla(mSW, la_id, la_name, e); + cla.setColor(col); + cla.setFallOffAngle(la->spotsize); + cla.setFallOffExponent(la->spotblend); + cla.setLinearAttenuation(la->att1); + cla.setQuadraticAttenuation(la->att2); + addLight(cla); + } + // lamp + else if (la->type == LA_LOCAL) { + COLLADASW::PointLight cla(mSW, la_id, la_name, e); + cla.setColor(col); + cla.setLinearAttenuation(la->att1); + cla.setQuadraticAttenuation(la->att2); + addLight(cla); + } + // area lamp is not supported + // it will be exported as a local lamp + else { + COLLADASW::PointLight cla(mSW, la_id, la_name, e); + cla.setColor(col); + cla.setLinearAttenuation(la->att1); + cla.setQuadraticAttenuation(la->att2); + addLight(cla); + } +} diff --git a/source/blender/collada/LightExporter.h b/source/blender/collada/LightExporter.h new file mode 100644 index 00000000000..70fa88d6193 --- /dev/null +++ b/source/blender/collada/LightExporter.h @@ -0,0 +1,43 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __LIGHTEXPORTER_H__ +#define __LIGHTEXPORTER_H__ + +#include "COLLADASWStreamWriter.h" +#include "COLLADASWLibraryLights.h" + +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +class LightsExporter: COLLADASW::LibraryLights +{ +public: + LightsExporter(COLLADASW::StreamWriter *sw); + void exportLights(Scene *sce); + void operator()(Object *ob); +}; + +#endif diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp new file mode 100644 index 00000000000..cfa94e60199 --- /dev/null +++ b/source/blender/collada/collada_internal.cpp @@ -0,0 +1,240 @@ +/** + * $Id: collada_internal.h 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "collada_internal.h" + +UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} + +void UnitConverter::read_asset(const COLLADAFW::FileInfo* asset) +{ +} + +// TODO +// convert vector vec from COLLADA format to Blender +void UnitConverter::convertVec3(float *vec) +{ +} + +// TODO need also for angle conversion, time conversion... + +void UnitConverter::dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in) +{ + // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h) + // so here, to make a blender matrix, we swap columns and rows + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + out[i][j] = in[j][i]; + } + } +} + +void UnitConverter::mat4_to_dae(float out[][4], float in[][4]) +{ + copy_m4_m4(out, in); + transpose_m4(out); +} + +void UnitConverter::mat4_to_dae_double(double out[][4], float in[][4]) +{ + float mat[4][4]; + + mat4_to_dae(mat, in); + + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + out[i][j] = mat[i][j]; +} + +void TransformBase::decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size) +{ + mat4_to_size(size, mat); + if (eul) { + mat4_to_eul(eul, mat); + } + if (quat) { + mat4_to_quat(quat, mat); + } + copy_v3_v3(loc, mat[3]); +} + +/** +Translation map. +Used to translate every COLLADA id to a valid id, no matter what "wrong" letters may be +included. Look at the IDREF XSD declaration for more. +Follows strictly the COLLADA XSD declaration which explicitly allows non-english chars, +like special chars (e.g. micro sign), umlauts and so on. +The COLLADA spec also allows additional chars for member access ('.'), these +must obviously be removed too, otherwise they would be heavily misinterpreted. +*/ +const unsigned char translate_start_name_map[256] = { +95, 95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +65, 66, 67, 68, 69, 70, 71, 72, +73, 74, 75, 76, 77, 78, 79, 80, +81, 82, 83, 84, 85, 86, 87, 88, +89, 90, 95, 95, 95, 95, 95, 95, +97, 98, 99, 100, 101, 102, 103, 104, +105, 106, 107, 108, 109, 110, 111, 112, +113, 114, 115, 116, 117, 118, 119, 120, +121, 122, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 192, +193, 194, 195, 196, 197, 198, 199, 200, +201, 202, 203, 204, 205, 206, 207, 208, +209, 210, 211, 212, 213, 214, 95, 216, +217, 218, 219, 220, 221, 222, 223, 224, +225, 226, 227, 228, 229, 230, 231, 232, +233, 234, 235, 236, 237, 238, 239, 240, +241, 242, 243, 244, 245, 246, 95, 248, +249, 250, 251, 252, 253, 254, 255}; + +const unsigned char translate_name_map[256] = { +95, 95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 45, 95, 95, 48, +49, 50, 51, 52, 53, 54, 55, 56, +57, 95, 95, 95, 95, 95, 95, 95, +65, 66, 67, 68, 69, 70, 71, 72, +73, 74, 75, 76, 77, 78, 79, 80, +81, 82, 83, 84, 85, 86, 87, 88, +89, 90, 95, 95, 95, 95, 95, 95, +97, 98, 99, 100, 101, 102, 103, 104, +105, 106, 107, 108, 109, 110, 111, 112, +113, 114, 115, 116, 117, 118, 119, 120, +121, 122, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 95, 95, +95, 95, 95, 95, 95, 95, 183, 95, +95, 95, 95, 95, 95, 95, 95, 192, +193, 194, 195, 196, 197, 198, 199, 200, +201, 202, 203, 204, 205, 206, 207, 208, +209, 210, 211, 212, 213, 214, 95, 216, +217, 218, 219, 220, 221, 222, 223, 224, +225, 226, 227, 228, 229, 230, 231, 232, +233, 234, 235, 236, 237, 238, 239, 240, +241, 242, 243, 244, 245, 246, 95, 248, +249, 250, 251, 252, 253, 254, 255}; + +typedef std::map< std::string, std::vector > map_string_list; +map_string_list global_id_map; + +void clear_global_id_map() +{ + global_id_map.clear(); +} + +/** Look at documentation of translate_map */ +std::string translate_id(const std::string &id) +{ + if (id.size() == 0) + { return id; } + std::string id_translated = id; + id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]]; + for (unsigned int i=1; i < id_translated.size(); i++) + { + id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; + } + // It's so much workload now, the if() should speed up things. + if (id_translated != id) + { + // Search duplicates + map_string_list::iterator iter = global_id_map.find(id_translated); + if (iter != global_id_map.end()) + { + unsigned int i = 0; + bool found = false; + for (i=0; i < iter->second.size(); i++) + { + if (id == iter->second[i]) + { + found = true; + break; + } + } + bool convert = false; + if (found) + { + if (i > 0) + { convert = true; } + } + else + { + convert = true; + global_id_map[id_translated].push_back(id); + } + if (convert) + { + std::stringstream out; + out << ++i; + id_translated += out.str(); + } + } + else { global_id_map[id_translated].push_back(id); } + } + return id_translated; +} + +std::string id_name(void *id) +{ + return ((ID*)id)->name + 2; +} + +std::string get_geometry_id(Object *ob) +{ + return translate_id(id_name(ob)) + "-mesh"; +} + +std::string get_light_id(Object *ob) +{ + return translate_id(id_name(ob)) + "-light"; +} + +std::string get_joint_id(Bone *bone, Object *ob_arm) +{ + return translate_id(id_name(ob_arm) + "_" + bone->name); +} + +std::string get_camera_id(Object *ob) +{ + return translate_id(id_name(ob)) + "-camera"; +} diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h index f8fbe71e6d9..1e3546263da 100644 --- a/source/blender/collada/collada_internal.h +++ b/source/blender/collada/collada_internal.h @@ -24,9 +24,15 @@ #ifndef BLENDER_COLLADA_H #define BLENDER_COLLADA_H +#include +#include +#include + #include "COLLADAFWFileInfo.h" #include "Math/COLLADABUMathMatrix4.h" +#include "DNA_armature_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" class UnitConverter @@ -38,63 +44,41 @@ private: public: // Initialize with Z_UP, since Blender uses right-handed, z-up - UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} + UnitConverter(); - void read_asset(const COLLADAFW::FileInfo* asset) - { - } + void read_asset(const COLLADAFW::FileInfo* asset); // TODO // convert vector vec from COLLADA format to Blender - void convertVec3(float *vec) - { - } + void convertVec3(float *vec); // TODO need also for angle conversion, time conversion... - void dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in) - { - // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h) - // so here, to make a blender matrix, we swap columns and rows - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - out[i][j] = in[j][i]; - } - } - } - - void mat4_to_dae(float out[][4], float in[][4]) - { - copy_m4_m4(out, in); - transpose_m4(out); - } - - void mat4_to_dae_double(double out[][4], float in[][4]) - { - float mat[4][4]; - - mat4_to_dae(mat, in); - - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) - out[i][j] = mat[i][j]; - } + void dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in); + + void mat4_to_dae(float out[][4], float in[][4]); + + void mat4_to_dae_double(double out[][4], float in[][4]); }; class TransformBase { public: - void decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size) - { - mat4_to_size(size, mat); - if (eul) { - mat4_to_eul(eul, mat); - } - if (quat) { - mat4_to_quat(quat, mat); - } - copy_v3_v3(loc, mat[3]); - } + void decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size); }; +extern void clear_global_id_map(); +/** Look at documentation of translate_map */ +extern std::string translate_id(const std::string &id); + +extern std::string id_name(void *id); + +extern std::string get_geometry_id(Object *ob); + +extern std::string get_light_id(Object *ob); + +extern std::string get_joint_id(Bone *bone, Object *ob_arm); + +extern std::string get_camera_id(Object *ob); + #endif -- cgit v1.2.3 From 20d0236f10f1ae59734be692e7f42c188152f439 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 6 Oct 2010 07:57:55 +0000 Subject: Fix for [#24134] pointcache memory error (crash) --- source/blender/blenkernel/intern/pointcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index e1006cd99cd..4ec12b3482c 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1890,7 +1890,7 @@ int BKE_ptcache_write_cache(PTCacheID *pid, int cfra) } if(cache->cached_frames) - cache->cached_frames[cfra] = 1; + cache->cached_frames[cfra-cache->startframe] = 1; if(pf) ptcache_file_close(pf); -- cgit v1.2.3 From d6b235f3ef70811e035a13f1110de95592c09324 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 09:21:40 +0000 Subject: patch [#24162] r32332 missed a couple of command key changes - with fix from Shane Ambler (sambler) --- intern/ghost/intern/GHOST_SystemCocoa.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 286c4eda675..97cfcf1006c 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -853,7 +853,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_T GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) const { - keys.set(GHOST_kModifierKeyCommand, (m_modifierMask & NSCommandKeyMask) ? true : false); + keys.set(GHOST_kModifierKeyOS, (m_modifierMask & NSCommandKeyMask) ? true : false); keys.set(GHOST_kModifierKeyLeftAlt, (m_modifierMask & NSAlternateKeyMask) ? true : false); keys.set(GHOST_kModifierKeyLeftShift, (m_modifierMask & NSShiftKeyMask) ? true : false); keys.set(GHOST_kModifierKeyLeftControl, (m_modifierMask & NSControlKeyMask) ? true : false); @@ -1018,7 +1018,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent() pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) ); } if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) { - pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) ); + pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) ); } m_modifierMask = modifiers; @@ -1698,7 +1698,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) ); } if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) { - pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) ); + pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) ); } m_modifierMask = modifiers; -- cgit v1.2.3 From c88a46e585ff5924be6ec2b5b8cdf9d2ff8faefa Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 09:53:06 +0000 Subject: COLLADACOLLADA exporter: split geometry export into own files. --- source/blender/blenkernel/BKE_customdata.h | 8 + source/blender/collada/DocumentExporter.cpp | 480 +--------------------------- source/blender/collada/GeometryExporter.cpp | 472 +++++++++++++++++++++++++++ source/blender/collada/GeometryExporter.h | 114 +++++++ 4 files changed, 603 insertions(+), 471 deletions(-) create mode 100644 source/blender/collada/GeometryExporter.cpp create mode 100644 source/blender/collada/GeometryExporter.h diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 84eb8ef5300..5d306e75db9 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -32,6 +32,10 @@ #ifndef BKE_CUSTOMDATA_H #define BKE_CUSTOMDATA_H +#ifdef __cplusplus +extern "C" { +#endif + struct ID; struct CustomData; struct CustomDataLayer; @@ -295,5 +299,9 @@ void CustomData_external_read(struct CustomData *data, void CustomData_external_reload(struct CustomData *data, struct ID *id, CustomDataMask mask, int totelem); +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 661f31f5210..0a3166c37c3 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -34,8 +34,8 @@ extern "C" #include "DNA_image_types.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" -#include "DNA_camera_types.h" -#include "DNA_lamp_types.h" +//#include "DNA_camera_types.h" +//#include "DNA_lamp_types.h" #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_curve_types.h" @@ -74,7 +74,7 @@ extern char build_rev[]; #include "COLLADASWAsset.h" #include "COLLADASWLibraryVisualScenes.h" #include "COLLADASWNode.h" -#include "COLLADASWLibraryGeometries.h" +//#include "COLLADASWLibraryGeometries.h" #include "COLLADASWSource.h" #include "COLLADASWInstanceGeometry.h" #include "COLLADASWInputList.h" @@ -96,7 +96,7 @@ extern char build_rev[]; #include "COLLADASWLibraryMaterials.h" #include "COLLADASWBindMaterial.h" //#include "COLLADASWLibraryCameras.h" -#include "COLLADASWLibraryLights.h" +//#include "COLLADASWLibraryLights.h" #include "COLLADASWInstanceCamera.h" #include "COLLADASWInstanceLight.h" //#include "COLLADASWCameraOptic.h" @@ -110,6 +110,7 @@ extern char build_rev[]; #include "CameraExporter.h" #include "LightExporter.h" +#include "GeometryExporter.h" #include #include // std::find @@ -138,23 +139,6 @@ char *CustomData_get_active_layer_name(const CustomData *data, int type) Definition can take some time to understand, but they should be useful. */ -// f should have -// void operator()(Object* ob) -template -void forEachMeshObjectInScene(Scene *sce, Functor &f) -{ - - Base *base= (Base*) sce->base.first; - while(base) { - Object *ob = base->object; - - if (ob->type == OB_MESH && ob->data) { - f(ob); - } - base= base->next; - - } -} template void forEachObjectInScene(Scene *sce, Functor &f) @@ -203,7 +187,8 @@ template void forEachMaterialInScene(Scene *sce, Functor &f) { ForEachMaterialFunctor matfunc(&f); - forEachMeshObjectInScene(sce, matfunc); + GeometryFunctor gf; + gf.forEachMeshObjectInScene>(sce, matfunc); } // OB_MESH is assumed @@ -218,454 +203,6 @@ std::string getActiveUVLayerName(Object *ob) return ""; } -// TODO: optimize UV sets by making indexed list with duplicates removed -class GeometryExporter : COLLADASW::LibraryGeometries -{ - struct Face - { - unsigned int v1, v2, v3, v4; - }; - - struct Normal - { - float x, y, z; - }; - - Scene *mScene; - -public: - GeometryExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryGeometries(sw) {} - - void exportGeom(Scene *sce) - { - openLibrary(); - - mScene = sce; - forEachMeshObjectInScene(sce, *this); - - closeLibrary(); - } - - void operator()(Object *ob) - { - // XXX don't use DerivedMesh, Mesh instead? - -#if 0 - DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH); -#endif - Mesh *me = (Mesh*)ob->data; - std::string geom_id = get_geometry_id(ob); - std::vector nor; - std::vector norind; - - bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL); - - create_normals(nor, norind, me); - - // openMesh(geoId, geoName, meshId) - openMesh(geom_id); - - // writes for vertex coords - createVertsSource(geom_id, me); - - // writes for normal coords - createNormalsSource(geom_id, me, nor); - - bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE); - - // writes for uv coords if mesh has uv coords - if (has_uvs) - createTexcoordsSource(geom_id, me); - - if (has_color) - createVertexColorSource(geom_id, me); - - // - COLLADASW::Vertices verts(mSW); - verts.setId(getIdBySemantics(geom_id, COLLADASW::VERTEX)); - COLLADASW::InputList &input_list = verts.getInputList(); - COLLADASW::Input input(COLLADASW::POSITION, getUrlBySemantics(geom_id, COLLADASW::POSITION)); - input_list.push_back(input); - verts.add(); - - // XXX slow - if (ob->totcol) { - for(int a = 0; a < ob->totcol; a++) { - createPolylist(a, has_uvs, has_color, ob, geom_id, norind); - } - } - else { - createPolylist(0, has_uvs, has_color, ob, geom_id, norind); - } - - closeMesh(); - closeGeometry(); - -#if 0 - dm->release(dm); -#endif - } - - // powerful because it handles both cases when there is material and when there's not - void createPolylist(int material_index, - bool has_uvs, - bool has_color, - Object *ob, - std::string& geom_id, - std::vector& norind) - { - Mesh *me = (Mesh*)ob->data; - MFace *mfaces = me->mface; - int totfaces = me->totface; - - // - int i; - int faces_in_polylist = 0; - std::vector vcount_list; - - // count faces with this material - for (i = 0; i < totfaces; i++) { - MFace *f = &mfaces[i]; - - if (f->mat_nr == material_index) { - faces_in_polylist++; - if (f->v4 == 0) { - vcount_list.push_back(3); - } - else { - vcount_list.push_back(4); - } - } - } - - // no faces using this material - if (faces_in_polylist == 0) { - fprintf(stderr, "%s: no faces use material %d\n", id_name(ob).c_str(), material_index); - return; - } - - Material *ma = ob->totcol ? give_current_material(ob, material_index + 1) : NULL; - COLLADASW::Polylist polylist(mSW); - - // sets count attribute in - polylist.setCount(faces_in_polylist); - - // sets material name - if (ma) { - polylist.setMaterial(translate_id(id_name(ma))); - } - - COLLADASW::InputList &til = polylist.getInputList(); - - // creates in for vertices - COLLADASW::Input input1(COLLADASW::VERTEX, getUrlBySemantics(geom_id, COLLADASW::VERTEX), 0); - - // creates in for normals - COLLADASW::Input input2(COLLADASW::NORMAL, getUrlBySemantics(geom_id, COLLADASW::NORMAL), 1); - - til.push_back(input1); - til.push_back(input2); - - // if mesh has uv coords writes for TEXCOORD - int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); - - for (i = 0; i < num_layers; i++) { - // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i); - COLLADASW::Input input3(COLLADASW::TEXCOORD, - makeUrl(makeTexcoordSourceId(geom_id, i)), - 2, // offset always 2, this is only until we have optimized UV sets - i // set number equals UV layer index - ); - til.push_back(input3); - } - - if (has_color) { - COLLADASW::Input input4(COLLADASW::COLOR, getUrlBySemantics(geom_id, COLLADASW::COLOR), has_uvs ? 3 : 2); - til.push_back(input4); - } - - // sets - polylist.setVCountList(vcount_list); - - // performs the actual writing - polylist.prepareToAppendValues(); - - //

- int texindex = 0; - for (i = 0; i < totfaces; i++) { - MFace *f = &mfaces[i]; - - if (f->mat_nr == material_index) { - - unsigned int *v = &f->v1; - unsigned int *n = &norind[i].v1; - for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) { - polylist.appendValues(v[j]); - polylist.appendValues(n[j]); - - if (has_uvs) - polylist.appendValues(texindex + j); - - if (has_color) - polylist.appendValues(texindex + j); - } - } - - texindex += 3; - if (f->v4 != 0) - texindex++; - } - - polylist.finish(); - } - - // creates for positions - void createVertsSource(std::string geom_id, Mesh *me) - { -#if 0 - int totverts = dm->getNumVerts(dm); - MVert *verts = dm->getVertArray(dm); -#endif - int totverts = me->totvert; - MVert *verts = me->mvert; - - COLLADASW::FloatSourceF source(mSW); - source.setId(getIdBySemantics(geom_id, COLLADASW::POSITION)); - source.setArrayId(getIdBySemantics(geom_id, COLLADASW::POSITION) + - ARRAY_ID_SUFFIX); - source.setAccessorCount(totverts); - source.setAccessorStride(3); - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("X"); - param.push_back("Y"); - param.push_back("Z"); - /*main function, it creates , */ - source.prepareToAppendValues(); - //appends data to - int i = 0; - for (i = 0; i < totverts; i++) { - source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]); - } - - source.finish(); - - } - - void createVertexColorSource(std::string geom_id, Mesh *me) - { - if (!CustomData_has_layer(&me->fdata, CD_MCOL)) - return; - - MFace *f; - int totcolor = 0, i, j; - - for (i = 0, f = me->mface; i < me->totface; i++, f++) - totcolor += f->v4 ? 4 : 3; - - COLLADASW::FloatSourceF source(mSW); - source.setId(getIdBySemantics(geom_id, COLLADASW::COLOR)); - source.setArrayId(getIdBySemantics(geom_id, COLLADASW::COLOR) + ARRAY_ID_SUFFIX); - source.setAccessorCount(totcolor); - source.setAccessorStride(3); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("R"); - param.push_back("G"); - param.push_back("B"); - - source.prepareToAppendValues(); - - int index = CustomData_get_active_layer_index(&me->fdata, CD_MCOL); - - MCol *mcol = (MCol*)me->fdata.layers[index].data; - MCol *c = mcol; - - for (i = 0, f = me->mface; i < me->totface; i++, c += 4, f++) - for (j = 0; j < (f->v4 ? 4 : 3); j++) - source.appendValues(c[j].b / 255.0f, c[j].g / 255.0f, c[j].r / 255.0f); - - source.finish(); - } - - std::string makeTexcoordSourceId(std::string& geom_id, int layer_index) - { - char suffix[20]; - sprintf(suffix, "-%d", layer_index); - return getIdBySemantics(geom_id, COLLADASW::TEXCOORD) + suffix; - } - - //creates for texcoords - void createTexcoordsSource(std::string geom_id, Mesh *me) - { -#if 0 - int totfaces = dm->getNumFaces(dm); - MFace *mfaces = dm->getFaceArray(dm); -#endif - int totfaces = me->totface; - MFace *mfaces = me->mface; - - int totuv = 0; - int i; - - // count totuv - for (i = 0; i < totfaces; i++) { - MFace *f = &mfaces[i]; - if (f->v4 == 0) { - totuv+=3; - } - else { - totuv+=4; - } - } - - int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); - - // write for each layer - // each will get id like meshName + "map-channel-1" - for (int a = 0; a < num_layers; a++) { - MTFace *tface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a); - // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a); - - COLLADASW::FloatSourceF source(mSW); - std::string layer_id = makeTexcoordSourceId(geom_id, a); - source.setId(layer_id); - source.setArrayId(layer_id + ARRAY_ID_SUFFIX); - - source.setAccessorCount(totuv); - source.setAccessorStride(2); - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("S"); - param.push_back("T"); - - source.prepareToAppendValues(); - - for (i = 0; i < totfaces; i++) { - MFace *f = &mfaces[i]; - - for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) { - source.appendValues(tface[i].uv[j][0], - tface[i].uv[j][1]); - } - } - - source.finish(); - } - } - - - //creates for normals - void createNormalsSource(std::string geom_id, Mesh *me, std::vector& nor) - { -#if 0 - int totverts = dm->getNumVerts(dm); - MVert *verts = dm->getVertArray(dm); -#endif - - COLLADASW::FloatSourceF source(mSW); - source.setId(getIdBySemantics(geom_id, COLLADASW::NORMAL)); - source.setArrayId(getIdBySemantics(geom_id, COLLADASW::NORMAL) + - ARRAY_ID_SUFFIX); - source.setAccessorCount(nor.size()); - source.setAccessorStride(3); - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("X"); - param.push_back("Y"); - param.push_back("Z"); - - source.prepareToAppendValues(); - - std::vector::iterator it; - for (it = nor.begin(); it != nor.end(); it++) { - Normal& n = *it; - source.appendValues(n.x, n.y, n.z); - } - - source.finish(); - } - - void create_normals(std::vector &nor, std::vector &ind, Mesh *me) - { - int i, j, v; - MVert *vert = me->mvert; - std::map nshar; - - for (i = 0; i < me->totface; i++) { - MFace *fa = &me->mface[i]; - Face f; - unsigned int *nn = &f.v1; - unsigned int *vv = &fa->v1; - - memset(&f, 0, sizeof(f)); - v = fa->v4 == 0 ? 3 : 4; - - if (!(fa->flag & ME_SMOOTH)) { - Normal n; - if (v == 4) - normal_quad_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co, vert[fa->v4].co); - else - normal_tri_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co); - nor.push_back(n); - } - - for (j = 0; j < v; j++) { - if (fa->flag & ME_SMOOTH) { - if (nshar.find(*vv) != nshar.end()) - *nn = nshar[*vv]; - else { - Normal n = { - vert[*vv].no[0]/32767.0, - vert[*vv].no[1]/32767.0, - vert[*vv].no[2]/32767.0 - }; - nor.push_back(n); - *nn = nor.size() - 1; - nshar[*vv] = *nn; - } - vv++; - } - else { - *nn = nor.size() - 1; - } - nn++; - } - - ind.push_back(f); - } - } - - std::string getIdBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = "") { - return geom_id + getSuffixBySemantic(type) + other_suffix; - } - - - COLLADASW::URI getUrlBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = "") { - - std::string id(getIdBySemantics(geom_id, type, other_suffix)); - return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id); - - } - - COLLADASW::URI makeUrl(std::string id) - { - return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id); - } - - - /* int getTriCount(MFace *faces, int totface) { - int i; - int tris = 0; - for (i = 0; i < totface; i++) { - // if quad - if (faces[i].v4 != 0) - tris += 2; - else - tris++; - } - - return tris; - }*/ -}; class TransformWriter : protected TransformBase { @@ -828,7 +365,8 @@ public: openLibrary(); - forEachMeshObjectInScene(sce, *this); + GeometryFunctor gf; + gf.forEachMeshObjectInScene(sce, *this); closeLibrary(); } diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp new file mode 100644 index 00000000000..b06551a97b6 --- /dev/null +++ b/source/blender/collada/GeometryExporter.cpp @@ -0,0 +1,472 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "COLLADASWPrimitves.h" +#include "COLLADASWSource.h" +#include "COLLADASWVertices.h" +#include "COLLADABUUtils.h" + +#include "GeometryExporter.h" + +#include "DNA_meshdata_types.h" +#include "BKE_customdata.h" +#include "BKE_material.h" + +#include "collada_internal.h" + +// TODO: optimize UV sets by making indexed list with duplicates removed +GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryGeometries(sw) {} + + +void GeometryExporter::exportGeom(Scene *sce) +{ + openLibrary(); + + mScene = sce; + GeometryFunctor gf; + gf.forEachMeshObjectInScene(sce, *this); + + closeLibrary(); +} + +void GeometryExporter::operator()(Object *ob) +{ + // XXX don't use DerivedMesh, Mesh instead? + +#if 0 + DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH); +#endif + Mesh *me = (Mesh*)ob->data; + std::string geom_id = get_geometry_id(ob); + std::vector nor; + std::vector norind; + + bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL); + + create_normals(nor, norind, me); + + // openMesh(geoId, geoName, meshId) + openMesh(geom_id); + + // writes for vertex coords + createVertsSource(geom_id, me); + + // writes for normal coords + createNormalsSource(geom_id, me, nor); + + bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE); + + // writes for uv coords if mesh has uv coords + if (has_uvs) + createTexcoordsSource(geom_id, me); + + if (has_color) + createVertexColorSource(geom_id, me); + + // + COLLADASW::Vertices verts(mSW); + verts.setId(getIdBySemantics(geom_id, COLLADASW::VERTEX)); + COLLADASW::InputList &input_list = verts.getInputList(); + COLLADASW::Input input(COLLADASW::POSITION, getUrlBySemantics(geom_id, COLLADASW::POSITION)); + input_list.push_back(input); + verts.add(); + + // XXX slow + if (ob->totcol) { + for(int a = 0; a < ob->totcol; a++) { + createPolylist(a, has_uvs, has_color, ob, geom_id, norind); + } + } + else { + createPolylist(0, has_uvs, has_color, ob, geom_id, norind); + } + + closeMesh(); + closeGeometry(); + +#if 0 + dm->release(dm); +#endif +} + +// powerful because it handles both cases when there is material and when there's not +void GeometryExporter::createPolylist(int material_index, + bool has_uvs, + bool has_color, + Object *ob, + std::string& geom_id, + std::vector& norind) +{ + Mesh *me = (Mesh*)ob->data; + MFace *mfaces = me->mface; + int totfaces = me->totface; + + // + int i; + int faces_in_polylist = 0; + std::vector vcount_list; + + // count faces with this material + for (i = 0; i < totfaces; i++) { + MFace *f = &mfaces[i]; + + if (f->mat_nr == material_index) { + faces_in_polylist++; + if (f->v4 == 0) { + vcount_list.push_back(3); + } + else { + vcount_list.push_back(4); + } + } + } + + // no faces using this material + if (faces_in_polylist == 0) { + fprintf(stderr, "%s: no faces use material %d\n", id_name(ob).c_str(), material_index); + return; + } + + Material *ma = ob->totcol ? give_current_material(ob, material_index + 1) : NULL; + COLLADASW::Polylist polylist(mSW); + + // sets count attribute in + polylist.setCount(faces_in_polylist); + + // sets material name + if (ma) { + polylist.setMaterial(translate_id(id_name(ma))); + } + + COLLADASW::InputList &til = polylist.getInputList(); + + // creates in for vertices + COLLADASW::Input input1(COLLADASW::VERTEX, getUrlBySemantics(geom_id, COLLADASW::VERTEX), 0); + + // creates in for normals + COLLADASW::Input input2(COLLADASW::NORMAL, getUrlBySemantics(geom_id, COLLADASW::NORMAL), 1); + + til.push_back(input1); + til.push_back(input2); + + // if mesh has uv coords writes for TEXCOORD + int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); + + for (i = 0; i < num_layers; i++) { + // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i); + COLLADASW::Input input3(COLLADASW::TEXCOORD, + makeUrl(makeTexcoordSourceId(geom_id, i)), + 2, // offset always 2, this is only until we have optimized UV sets + i // set number equals UV layer index + ); + til.push_back(input3); + } + + if (has_color) { + COLLADASW::Input input4(COLLADASW::COLOR, getUrlBySemantics(geom_id, COLLADASW::COLOR), has_uvs ? 3 : 2); + til.push_back(input4); + } + + // sets + polylist.setVCountList(vcount_list); + + // performs the actual writing + polylist.prepareToAppendValues(); + + //

+ int texindex = 0; + for (i = 0; i < totfaces; i++) { + MFace *f = &mfaces[i]; + + if (f->mat_nr == material_index) { + + unsigned int *v = &f->v1; + unsigned int *n = &norind[i].v1; + for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) { + polylist.appendValues(v[j]); + polylist.appendValues(n[j]); + + if (has_uvs) + polylist.appendValues(texindex + j); + + if (has_color) + polylist.appendValues(texindex + j); + } + } + + texindex += 3; + if (f->v4 != 0) + texindex++; + } + + polylist.finish(); +} + +// creates for positions +void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me) +{ +#if 0 + int totverts = dm->getNumVerts(dm); + MVert *verts = dm->getVertArray(dm); +#endif + int totverts = me->totvert; + MVert *verts = me->mvert; + + COLLADASW::FloatSourceF source(mSW); + source.setId(getIdBySemantics(geom_id, COLLADASW::POSITION)); + source.setArrayId(getIdBySemantics(geom_id, COLLADASW::POSITION) + + ARRAY_ID_SUFFIX); + source.setAccessorCount(totverts); + source.setAccessorStride(3); + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("X"); + param.push_back("Y"); + param.push_back("Z"); + /*main function, it creates , */ + source.prepareToAppendValues(); + //appends data to + int i = 0; + for (i = 0; i < totverts; i++) { + source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]); + } + + source.finish(); + +} + +void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me) +{ + if (!CustomData_has_layer(&me->fdata, CD_MCOL)) + return; + + MFace *f; + int totcolor = 0, i, j; + + for (i = 0, f = me->mface; i < me->totface; i++, f++) + totcolor += f->v4 ? 4 : 3; + + COLLADASW::FloatSourceF source(mSW); + source.setId(getIdBySemantics(geom_id, COLLADASW::COLOR)); + source.setArrayId(getIdBySemantics(geom_id, COLLADASW::COLOR) + ARRAY_ID_SUFFIX); + source.setAccessorCount(totcolor); + source.setAccessorStride(3); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("R"); + param.push_back("G"); + param.push_back("B"); + + source.prepareToAppendValues(); + + int index = CustomData_get_active_layer_index(&me->fdata, CD_MCOL); + + MCol *mcol = (MCol*)me->fdata.layers[index].data; + MCol *c = mcol; + + for (i = 0, f = me->mface; i < me->totface; i++, c += 4, f++) + for (j = 0; j < (f->v4 ? 4 : 3); j++) + source.appendValues(c[j].b / 255.0f, c[j].g / 255.0f, c[j].r / 255.0f); + + source.finish(); +} + +std::string GeometryExporter::makeTexcoordSourceId(std::string& geom_id, int layer_index) +{ + char suffix[20]; + sprintf(suffix, "-%d", layer_index); + return getIdBySemantics(geom_id, COLLADASW::TEXCOORD) + suffix; +} + +//creates for texcoords +void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me) +{ +#if 0 + int totfaces = dm->getNumFaces(dm); + MFace *mfaces = dm->getFaceArray(dm); +#endif + int totfaces = me->totface; + MFace *mfaces = me->mface; + + int totuv = 0; + int i; + + // count totuv + for (i = 0; i < totfaces; i++) { + MFace *f = &mfaces[i]; + if (f->v4 == 0) { + totuv+=3; + } + else { + totuv+=4; + } + } + + int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); + + // write for each layer + // each will get id like meshName + "map-channel-1" + for (int a = 0; a < num_layers; a++) { + MTFace *tface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a); + // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a); + + COLLADASW::FloatSourceF source(mSW); + std::string layer_id = makeTexcoordSourceId(geom_id, a); + source.setId(layer_id); + source.setArrayId(layer_id + ARRAY_ID_SUFFIX); + + source.setAccessorCount(totuv); + source.setAccessorStride(2); + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("S"); + param.push_back("T"); + + source.prepareToAppendValues(); + + for (i = 0; i < totfaces; i++) { + MFace *f = &mfaces[i]; + + for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) { + source.appendValues(tface[i].uv[j][0], + tface[i].uv[j][1]); + } + } + + source.finish(); + } +} + + +//creates for normals +void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::vector& nor) +{ +#if 0 + int totverts = dm->getNumVerts(dm); + MVert *verts = dm->getVertArray(dm); +#endif + + COLLADASW::FloatSourceF source(mSW); + source.setId(getIdBySemantics(geom_id, COLLADASW::NORMAL)); + source.setArrayId(getIdBySemantics(geom_id, COLLADASW::NORMAL) + + ARRAY_ID_SUFFIX); + source.setAccessorCount((unsigned long)nor.size()); + source.setAccessorStride(3); + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("X"); + param.push_back("Y"); + param.push_back("Z"); + + source.prepareToAppendValues(); + + std::vector::iterator it; + for (it = nor.begin(); it != nor.end(); it++) { + Normal& n = *it; + source.appendValues(n.x, n.y, n.z); + } + + source.finish(); +} + +void GeometryExporter::create_normals(std::vector &nor, std::vector &ind, Mesh *me) +{ + int i, j, v; + MVert *vert = me->mvert; + std::map nshar; + + for (i = 0; i < me->totface; i++) { + MFace *fa = &me->mface[i]; + Face f; + unsigned int *nn = &f.v1; + unsigned int *vv = &fa->v1; + + memset(&f, 0, sizeof(f)); + v = fa->v4 == 0 ? 3 : 4; + + if (!(fa->flag & ME_SMOOTH)) { + Normal n; + if (v == 4) + normal_quad_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co, vert[fa->v4].co); + else + normal_tri_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co); + nor.push_back(n); + } + + for (j = 0; j < v; j++) { + if (fa->flag & ME_SMOOTH) { + if (nshar.find(*vv) != nshar.end()) + *nn = nshar[*vv]; + else { + Normal n = { + vert[*vv].no[0]/32767.0, + vert[*vv].no[1]/32767.0, + vert[*vv].no[2]/32767.0 + }; + nor.push_back(n); + *nn = (unsigned int)nor.size() - 1; + nshar[*vv] = *nn; + } + vv++; + } + else { + *nn = (unsigned int)nor.size() - 1; + } + nn++; + } + + ind.push_back(f); + } +} + +std::string GeometryExporter::getIdBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix) { + return geom_id + getSuffixBySemantic(type) + other_suffix; +} + + +COLLADASW::URI GeometryExporter::getUrlBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix) { + + std::string id(getIdBySemantics(geom_id, type, other_suffix)); + return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id); + +} + +COLLADASW::URI GeometryExporter::makeUrl(std::string id) +{ + return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id); +} + + +/* int GeometryExporter::getTriCount(MFace *faces, int totface) { + int i; + int tris = 0; + for (i = 0; i < totface; i++) { + // if quad + if (faces[i].v4 != 0) + tris += 2; + else + tris++; + } + + return tris; + }*/ diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h new file mode 100644 index 00000000000..4ea3cb4efdf --- /dev/null +++ b/source/blender/collada/GeometryExporter.h @@ -0,0 +1,114 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __GEOMETRYEXPORTER_H__ +#define __GEOMETRYEXPORTER_H__ + +#include +#include + +#include "COLLADASWStreamWriter.h" +#include "COLLADASWLibraryGeometries.h" +#include "COLLADASWInputList.h" + +#include "DNA_mesh_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +// TODO: optimize UV sets by making indexed list with duplicates removed +class GeometryExporter : COLLADASW::LibraryGeometries +{ + struct Face + { + unsigned int v1, v2, v3, v4; + }; + + struct Normal + { + float x, y, z; + }; + + Scene *mScene; + +public: + GeometryExporter(COLLADASW::StreamWriter *sw); + + void exportGeom(Scene *sce); + + void operator()(Object *ob); + + // powerful because it handles both cases when there is material and when there's not + void createPolylist(int material_index, + bool has_uvs, + bool has_color, + Object *ob, + std::string& geom_id, + std::vector& norind); + + // creates for positions + void createVertsSource(std::string geom_id, Mesh *me); + + void createVertexColorSource(std::string geom_id, Mesh *me); + + std::string makeTexcoordSourceId(std::string& geom_id, int layer_index); + + //creates for texcoords + void createTexcoordsSource(std::string geom_id, Mesh *me); + + //creates for normals + void createNormalsSource(std::string geom_id, Mesh *me, std::vector& nor); + + void create_normals(std::vector &nor, std::vector &ind, Mesh *me); + + std::string getIdBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = ""); + + COLLADASW::URI getUrlBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = ""); + + COLLADASW::URI makeUrl(std::string id); + + /* int getTriCount(MFace *faces, int totface);*/ +}; + +struct GeometryFunctor { + // f should have + // void operator()(Object* ob) + template + void forEachMeshObjectInScene(Scene *sce, Functor &f) + { + + Base *base= (Base*) sce->base.first; + while(base) { + Object *ob = base->object; + + if (ob->type == OB_MESH && ob->data) { + f(ob); + } + base= base->next; + + } + } +}; + +#endif -- cgit v1.2.3 From 0321f089d6e7d8321b8b5b3b48b367038b58b0db Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 10:00:15 +0000 Subject: [#24063] Error in RNA naming in SequenceCrop.min_x/y ; [#24153] Typo --- source/blender/editors/object/object_select.c | 4 ++-- source/blender/makesrna/intern/rna_sequencer.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 818bb50a1fb..20346ab080e 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -660,7 +660,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_by_layer(wmOperatorType *ot) { /* identifiers */ - ot->name= "select by layer"; + ot->name= "Select by Layer"; ot->description = "Select all visible objects on a layer"; ot->idname= "OBJECT_OT_select_by_layer"; @@ -809,7 +809,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) { /* identifiers */ - ot->name= "select same group"; + ot->name= "Select Same Group"; ot->description = "Select object in the same group"; ot->idname= "OBJECT_OT_select_same_group"; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index b6a09b9c217..c004f32f586 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -677,13 +677,13 @@ static void rna_def_strip_crop(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 4096, 1, 0); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "bottom"); RNA_def_property_ui_text(prop, "Bottom", ""); RNA_def_property_ui_range(prop, 0, 4096, 1, 0); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "left"); RNA_def_property_ui_text(prop, "Left", ""); RNA_def_property_ui_range(prop, 0, 4096, 1, 0); -- cgit v1.2.3 From d50cadbe0dd5a676c23e40b8a2939345442a4f28 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 6 Oct 2010 10:09:44 +0000 Subject: Fix for [#22236] Seg Fault when rendering sequence with speed effect, [#24160] VSE crash * Override the default render name in the case of the sequence renderer scene being included as a strip in the sequencer. * Somebody with deeper insight to the rendering pipeline should probably check if this is the best way to handle this. --- source/blender/blenkernel/intern/sequencer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 430d6f87619..8c496fea3b0 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1861,6 +1861,15 @@ static ImBuf * seq_render_scene_strip_impl( if(rendering) re= RE_NewRender(" do_build_seq_ibuf"); + /* If the top level scene that does the sequencer rendering is included + * as a strip the default render name for the strip will conflict with + * the original render, so override the name in this case. + * See bugs #22236 and #24160 for examples. + * XXX: Somebody with deeper insight to the rendering pipeline should + * probably check if this is the best way to handle this. -jahka + */ + else if(seq->scene == scene) + re= RE_NewRender("scene_conflict_render"); else re= RE_NewRender(sce->id.name); -- cgit v1.2.3 From 7245280f6c9c797e92d51bd10fc1d1127efdd394 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 11:02:44 +0000 Subject: COLLADA: Split ArmatureExporter, InstanceWriter and TransformWriter into separate files. --- source/blender/collada/ArmatureExporter.cpp | 469 +++++++++++++++++++++++ source/blender/collada/ArmatureExporter.h | 137 +++++++ source/blender/collada/DocumentExporter.cpp | 567 +--------------------------- source/blender/collada/InstanceWriter.cpp | 64 ++++ source/blender/collada/InstanceWriter.h | 39 ++ source/blender/collada/TransformWriter.cpp | 100 +++++ source/blender/collada/TransformWriter.h | 48 +++ 7 files changed, 866 insertions(+), 558 deletions(-) create mode 100644 source/blender/collada/ArmatureExporter.cpp create mode 100644 source/blender/collada/ArmatureExporter.h create mode 100644 source/blender/collada/InstanceWriter.cpp create mode 100644 source/blender/collada/InstanceWriter.h create mode 100644 source/blender/collada/TransformWriter.cpp create mode 100644 source/blender/collada/TransformWriter.h diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp new file mode 100644 index 00000000000..527ccd66577 --- /dev/null +++ b/source/blender/collada/ArmatureExporter.cpp @@ -0,0 +1,469 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "COLLADASWBaseInputElement.h" +#include "COLLADASWInstanceController.h" +#include "COLLADASWPrimitves.h" +#include "COLLADASWSource.h" + +#include "DNA_action_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_modifier_types.h" + +#include "BKE_action.h" +#include "BKE_armature.h" + +#include "BLI_listBase.h" + +#include "GeometryExporter.h" +#include "ArmatureExporter.h" + +// XXX exporter writes wrong data for shared armatures. A separate +// controller should be written for each armature-mesh binding how do +// we make controller ids then? +ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryControllers(sw) {} + +// write bone nodes +void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce) +{ + // write bone nodes + bArmature *arm = (bArmature*)ob_arm->data; + for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) { + // start from root bones + if (!bone->parent) + add_bone_node(bone, ob_arm); + } +} + +bool ArmatureExporter::is_skinned_mesh(Object *ob) +{ + return get_assigned_armature(ob) != NULL; +} + +void ArmatureExporter::add_instance_controller(Object *ob) +{ + Object *ob_arm = get_assigned_armature(ob); + bArmature *arm = (bArmature*)ob_arm->data; + + const std::string& controller_id = get_controller_id(ob_arm, ob); + + COLLADASW::InstanceController ins(mSW); + ins.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, controller_id)); + + // write root bone URLs + Bone *bone; + for (bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) { + if (!bone->parent) + ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm))); + } + + InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob); + + ins.add(); +} + +void ArmatureExporter::export_controllers(Scene *sce) +{ + scene = sce; + + openLibrary(); + + GeometryFunctor gf; + gf.forEachMeshObjectInScene(sce, *this); + + closeLibrary(); +} + +void ArmatureExporter::operator()(Object *ob) +{ + Object *ob_arm = get_assigned_armature(ob); + + if (ob_arm /*&& !already_written(ob_arm)*/) + export_controller(ob, ob_arm); +} +#if 0 + +bool ArmatureExporter::already_written(Object *ob_arm) +{ + return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != written_armatures.end(); +} + +void ArmatureExporter::wrote(Object *ob_arm) +{ + written_armatures.push_back(ob_arm); +} + +void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector& objects, Scene *sce) +{ + objects.clear(); + + Base *base= (Base*) sce->base.first; + while(base) { + Object *ob = base->object; + + if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) { + objects.push_back(ob); + } + + base= base->next; + } +} +#endif + +Object *ArmatureExporter::get_assigned_armature(Object *ob) +{ + Object *ob_arm = NULL; + + if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) { + ob_arm = ob->parent; + } + else { + ModifierData *mod = (ModifierData*)ob->modifiers.first; + while (mod) { + if (mod->type == eModifierType_Armature) { + ob_arm = ((ArmatureModifierData*)mod)->object; + } + + mod = mod->next; + } + } + + return ob_arm; +} + +std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm) +{ + return get_joint_id(bone, ob_arm); +} + +// parent_mat is armature-space +void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) +{ + std::string node_id = get_joint_id(bone, ob_arm); + std::string node_name = std::string(bone->name); + std::string node_sid = get_joint_sid(bone, ob_arm); + + COLLADASW::Node node(mSW); + + node.setType(COLLADASW::Node::JOINT); + node.setNodeId(node_id); + node.setNodeName(node_name); + node.setNodeSid(node_sid); + + node.start(); + + add_bone_transform(ob_arm, bone, node); + + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) { + add_bone_node(child, ob_arm); + } + + node.end(); +} + +void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node) +{ + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + + float mat[4][4]; + + if (bone->parent) { + // get bone-space matrix from armature-space + bPoseChannel *parchan = get_pose_channel(ob_arm->pose, bone->parent->name); + + float invpar[4][4]; + invert_m4_m4(invpar, parchan->pose_mat); + mul_m4_m4m4(mat, pchan->pose_mat, invpar); + } + else { + // get world-space from armature-space + mul_m4_m4m4(mat, pchan->pose_mat, ob_arm->obmat); + } + + TransformWriter::add_node_transform(node, mat, NULL); +} + +std::string ArmatureExporter::get_controller_id(Object *ob_arm, Object *ob) +{ + return translate_id(id_name(ob_arm)) + "_" + translate_id(id_name(ob)) + SKIN_CONTROLLER_ID_SUFFIX; +} + +// ob should be of type OB_MESH +// both args are required +void ArmatureExporter::export_controller(Object* ob, Object *ob_arm) +{ + // joint names + // joint inverse bind matrices + // vertex weights + + // input: + // joint names: ob -> vertex group names + // vertex group weights: me->dvert -> groups -> index, weight + + /* + me->dvert: + + typedef struct MDeformVert { + struct MDeformWeight *dw; + int totweight; + int flag; // flag only in use for weightpaint now + } MDeformVert; + + typedef struct MDeformWeight { + int def_nr; + float weight; + } MDeformWeight; + */ + + Mesh *me = (Mesh*)ob->data; + if (!me->dvert) return; + + std::string controller_name = id_name(ob_arm); + std::string controller_id = get_controller_id(ob_arm, ob); + + openSkin(controller_id, controller_name, + COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob))); + + add_bind_shape_mat(ob); + + std::string joints_source_id = add_joints_source(ob_arm, &ob->defbase, controller_id); + std::string inv_bind_mat_source_id = add_inv_bind_mats_source(ob_arm, &ob->defbase, controller_id); + std::string weights_source_id = add_weights_source(me, controller_id); + + add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id); + add_vertex_weights_element(weights_source_id, joints_source_id, me, ob_arm, &ob->defbase); + + closeSkin(); + closeController(); +} + +void ArmatureExporter::add_joints_element(ListBase *defbase, + const std::string& joints_source_id, const std::string& inv_bind_mat_source_id) +{ + COLLADASW::JointsElement joints(mSW); + COLLADASW::InputList &input = joints.getInputList(); + + input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h + COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id))); + input.push_back(COLLADASW::Input(COLLADASW::BINDMATRIX, + COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id))); + joints.add(); +} + +void ArmatureExporter::add_bind_shape_mat(Object *ob) +{ + double bind_mat[4][4]; + + converter.mat4_to_dae_double(bind_mat, ob->obmat); + + addBindShapeTransform(bind_mat); +} + +std::string ArmatureExporter::add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id) +{ + std::string source_id = controller_id + JOINTS_SOURCE_ID_SUFFIX; + + int totjoint = 0; + bDeformGroup *def; + for (def = (bDeformGroup*)defbase->first; def; def = def->next) { + if (is_bone_defgroup(ob_arm, def)) + totjoint++; + } + + COLLADASW::NameSource source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(totjoint); + source.setAccessorStride(1); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("JOINT"); + + source.prepareToAppendValues(); + + for (def = (bDeformGroup*)defbase->first; def; def = def->next) { + Bone *bone = get_bone_from_defgroup(ob_arm, def); + if (bone) + source.appendValues(get_joint_sid(bone, ob_arm)); + } + + source.finish(); + + return source_id; +} + +std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id) +{ + std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX; + + COLLADASW::FloatSourceF source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(BLI_countlist(defbase)); + source.setAccessorStride(16); + + source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4); + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("TRANSFORM"); + + source.prepareToAppendValues(); + + bPose *pose = ob_arm->pose; + bArmature *arm = (bArmature*)ob_arm->data; + + int flag = arm->flag; + + // put armature in rest position + if (!(arm->flag & ARM_RESTPOS)) { + arm->flag |= ARM_RESTPOS; + where_is_pose(scene, ob_arm); + } + + for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) { + if (is_bone_defgroup(ob_arm, def)) { + + bPoseChannel *pchan = get_pose_channel(pose, def->name); + + float mat[4][4]; + float world[4][4]; + float inv_bind_mat[4][4]; + + // make world-space matrix, pose_mat is armature-space + mul_m4_m4m4(world, pchan->pose_mat, ob_arm->obmat); + + invert_m4_m4(mat, world); + converter.mat4_to_dae(inv_bind_mat, mat); + + source.appendValues(inv_bind_mat); + } + } + + // back from rest positon + if (!(flag & ARM_RESTPOS)) { + arm->flag = flag; + where_is_pose(scene, ob_arm); + } + + source.finish(); + + return source_id; +} + +Bone *ArmatureExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def) +{ + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, def->name); + return pchan ? pchan->bone : NULL; +} + +bool ArmatureExporter::is_bone_defgroup(Object *ob_arm, bDeformGroup* def) +{ + return get_bone_from_defgroup(ob_arm, def) != NULL; +} + +std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& controller_id) +{ + std::string source_id = controller_id + WEIGHTS_SOURCE_ID_SUFFIX; + + int i; + int totweight = 0; + + for (i = 0; i < me->totvert; i++) { + totweight += me->dvert[i].totweight; + } + + COLLADASW::FloatSourceF source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(totweight); + source.setAccessorStride(1); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("WEIGHT"); + + source.prepareToAppendValues(); + + // NOTE: COLLADA spec says weights should be normalized + + for (i = 0; i < me->totvert; i++) { + MDeformVert *vert = &me->dvert[i]; + for (int j = 0; j < vert->totweight; j++) { + source.appendValues(vert->dw[j].weight); + } + } + + source.finish(); + + return source_id; +} + +void ArmatureExporter::add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me, + Object *ob_arm, ListBase *defbase) +{ + COLLADASW::VertexWeightsElement weights(mSW); + COLLADASW::InputList &input = weights.getInputList(); + + int offset = 0; + input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h + COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++)); + input.push_back(COLLADASW::Input(COLLADASW::WEIGHT, + COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++)); + + weights.setCount(me->totvert); + + // write number of deformers per vertex + COLLADASW::PrimitivesBase::VCountList vcount; + int i; + for (i = 0; i < me->totvert; i++) { + vcount.push_back(me->dvert[i].totweight); + } + + weights.prepareToAppendVCountValues(); + weights.appendVertexCount(vcount); + + // def group index -> joint index + std::map joint_index_by_def_index; + bDeformGroup *def; + int j; + for (def = (bDeformGroup*)defbase->first, i = 0, j = 0; def; def = def->next, i++) { + if (is_bone_defgroup(ob_arm, def)) + joint_index_by_def_index[i] = j++; + else + joint_index_by_def_index[i] = -1; + } + + weights.CloseVCountAndOpenVElement(); + + // write deformer index - weight index pairs + int weight_index = 0; + for (i = 0; i < me->totvert; i++) { + MDeformVert *dvert = &me->dvert[i]; + for (int j = 0; j < dvert->totweight; j++) { + weights.appendValues(joint_index_by_def_index[dvert->dw[j].def_nr]); + weights.appendValues(weight_index++); + } + } + + weights.finish(); +} diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h new file mode 100644 index 00000000000..fc3864a6c0f --- /dev/null +++ b/source/blender/collada/ArmatureExporter.h @@ -0,0 +1,137 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __ARMATUREEXPORTER_H__ +#define __ARMATUREEXPORTER_H__ + +#include +//#include + +#include "COLLADASWStreamWriter.h" +#include "COLLADASWLibraryControllers.h" +#include "COLLADASWInputList.h" +#include "COLLADASWNode.h" + +#include "DNA_armature_types.h" +#include "DNA_listBase.h" +#include "DNA_mesh_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "TransformWriter.h" +#include "InstanceWriter.h" + +// XXX exporter writes wrong data for shared armatures. A separate +// controller should be written for each armature-mesh binding how do +// we make controller ids then? +class ArmatureExporter: public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter +{ +private: + Scene *scene; + +public: + ArmatureExporter(COLLADASW::StreamWriter *sw); + + // write bone nodes + void add_armature_bones(Object *ob_arm, Scene *sce); + + bool is_skinned_mesh(Object *ob); + + void add_instance_controller(Object *ob); + + void export_controllers(Scene *sce); + + void operator()(Object *ob); + +private: + + UnitConverter converter; + +#if 0 + std::vector written_armatures; + + bool already_written(Object *ob_arm); + + void wrote(Object *ob_arm); + + void find_objects_using_armature(Object *ob_arm, std::vector& objects, Scene *sce); +#endif + + Object *get_assigned_armature(Object *ob); + + std::string get_joint_sid(Bone *bone, Object *ob_arm); + + // parent_mat is armature-space + void add_bone_node(Bone *bone, Object *ob_arm); + + void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node); + + std::string get_controller_id(Object *ob_arm, Object *ob); + + // ob should be of type OB_MESH + // both args are required + void export_controller(Object* ob, Object *ob_arm); + + void add_joints_element(ListBase *defbase, + const std::string& joints_source_id, const std::string& inv_bind_mat_source_id); + + void add_bind_shape_mat(Object *ob); + + std::string add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id); + + std::string add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id); + + Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def); + + bool is_bone_defgroup(Object *ob_arm, bDeformGroup* def); + + std::string add_weights_source(Mesh *me, const std::string& controller_id); + + void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me, + Object *ob_arm, ListBase *defbase); +}; + +/* +struct GeometryFunctor { + // f should have + // void operator()(Object* ob) + template + void forEachMeshObjectInScene(Scene *sce, Functor &f) + { + + Base *base= (Base*) sce->base.first; + while(base) { + Object *ob = base->object; + + if (ob->type == OB_MESH && ob->data) { + f(ob); + } + base= base->next; + + } + } +};*/ + +#endif diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 0a3166c37c3..ad85a81c6f8 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -34,8 +34,6 @@ extern "C" #include "DNA_image_types.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" -//#include "DNA_camera_types.h" -//#include "DNA_lamp_types.h" #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_curve_types.h" @@ -74,7 +72,6 @@ extern char build_rev[]; #include "COLLADASWAsset.h" #include "COLLADASWLibraryVisualScenes.h" #include "COLLADASWNode.h" -//#include "COLLADASWLibraryGeometries.h" #include "COLLADASWSource.h" #include "COLLADASWInstanceGeometry.h" #include "COLLADASWInputList.h" @@ -95,11 +92,8 @@ extern char build_rev[]; #include "COLLADASWTexture.h" #include "COLLADASWLibraryMaterials.h" #include "COLLADASWBindMaterial.h" -//#include "COLLADASWLibraryCameras.h" -//#include "COLLADASWLibraryLights.h" #include "COLLADASWInstanceCamera.h" #include "COLLADASWInstanceLight.h" -//#include "COLLADASWCameraOptic.h" #include "COLLADASWConstants.h" #include "COLLADASWLibraryControllers.h" #include "COLLADASWInstanceController.h" @@ -108,14 +102,19 @@ extern char build_rev[]; #include "collada_internal.h" #include "DocumentExporter.h" +#include "ArmatureExporter.h" #include "CameraExporter.h" -#include "LightExporter.h" #include "GeometryExporter.h" +#include "LightExporter.h" + +// can probably go after refactor is complete +#include "InstanceWriter.h" +#include "TransformWriter.h" #include #include // std::find -char *CustomData_get_layer_name(const struct CustomData *data, int type, int n) +char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n) { int layer_index = CustomData_get_layer_index(data, type); if(layer_index < 0) return NULL; @@ -123,7 +122,7 @@ char *CustomData_get_layer_name(const struct CustomData *data, int type, int n) return data->layers[layer_index+n].name; } -char *CustomData_get_active_layer_name(const CustomData *data, int type) +char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) { /* get the layer index of the active layer of type */ int layer_index = CustomData_get_active_layer_index(data, type); @@ -133,7 +132,6 @@ char *CustomData_get_active_layer_name(const CustomData *data, int type) } - /* Utilities to avoid code duplication. Definition can take some time to understand, but they should be useful. @@ -198,558 +196,11 @@ std::string getActiveUVLayerName(Object *ob) int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); if (num_layers) - return std::string(CustomData_get_active_layer_name(&me->fdata, CD_MTFACE)); + return std::string(bc_CustomData_get_active_layer_name(&me->fdata, CD_MTFACE)); return ""; } - -class TransformWriter : protected TransformBase -{ -protected: - void add_node_transform(COLLADASW::Node& node, float mat[][4], float parent_mat[][4]) - { - float loc[3], rot[3], scale[3]; - float local[4][4]; - - if (parent_mat) { - float invpar[4][4]; - invert_m4_m4(invpar, parent_mat); - mul_m4_m4m4(local, mat, invpar); - } - else { - copy_m4_m4(local, mat); - } - - TransformBase::decompose(local, loc, rot, NULL, scale); - - add_transform(node, loc, rot, scale); - } - - void add_node_transform_ob(COLLADASW::Node& node, Object *ob) - { - float rot[3], loc[3], scale[3]; - - if (ob->parent) { - float C[4][4], tmat[4][4], imat[4][4], mat[4][4]; - - // factor out scale from obmat - - copy_v3_v3(scale, ob->size); - - ob->size[0] = ob->size[1] = ob->size[2] = 1.0f; - object_to_mat4(ob, C); - copy_v3_v3(ob->size, scale); - - mul_serie_m4(tmat, ob->parent->obmat, ob->parentinv, C, NULL, NULL, NULL, NULL, NULL); - - // calculate local mat - - invert_m4_m4(imat, ob->parent->obmat); - mul_m4_m4m4(mat, tmat, imat); - - // done - - mat4_to_eul(rot, mat); - copy_v3_v3(loc, mat[3]); - } - else { - copy_v3_v3(loc, ob->loc); - copy_v3_v3(rot, ob->rot); - copy_v3_v3(scale, ob->size); - } - - add_transform(node, loc, rot, scale); - } - - void add_node_transform_identity(COLLADASW::Node& node) - { - float loc[] = {0.0f, 0.0f, 0.0f}, scale[] = {1.0f, 1.0f, 1.0f}, rot[] = {0.0f, 0.0f, 0.0f}; - add_transform(node, loc, rot, scale); - } - -private: - void add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3]) - { - node.addTranslate("location", loc[0], loc[1], loc[2]); - node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2])); - node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1])); - node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0])); - node.addScale("scale", scale[0], scale[1], scale[2]); - } -}; - -class InstanceWriter -{ -protected: - void add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob) - { - for(int a = 0; a < ob->totcol; a++) { - Material *ma = give_current_material(ob, a+1); - - COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList(); - - if (ma) { - std::string matid(id_name(ma)); - matid = translate_id(matid); - COLLADASW::InstanceMaterial im(matid, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid)); - - // create for each uv layer - Mesh *me = (Mesh*)ob->data; - int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE); - - for (int b = 0; b < totlayer; b++) { - char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, b); - im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b)); - } - - iml.push_back(im); - } - } - } -}; - -// XXX exporter writes wrong data for shared armatures. A separate -// controller should be written for each armature-mesh binding how do -// we make controller ids then? -class ArmatureExporter: public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter -{ -private: - Scene *scene; - -public: - ArmatureExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryControllers(sw) {} - - // write bone nodes - void add_armature_bones(Object *ob_arm, Scene *sce) - { - // write bone nodes - bArmature *arm = (bArmature*)ob_arm->data; - for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) { - // start from root bones - if (!bone->parent) - add_bone_node(bone, ob_arm); - } - } - - bool is_skinned_mesh(Object *ob) - { - return get_assigned_armature(ob) != NULL; - } - - void add_instance_controller(Object *ob) - { - Object *ob_arm = get_assigned_armature(ob); - bArmature *arm = (bArmature*)ob_arm->data; - - const std::string& controller_id = get_controller_id(ob_arm, ob); - - COLLADASW::InstanceController ins(mSW); - ins.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, controller_id)); - - // write root bone URLs - Bone *bone; - for (bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) { - if (!bone->parent) - ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm))); - } - - InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob); - - ins.add(); - } - - void export_controllers(Scene *sce) - { - scene = sce; - - openLibrary(); - - GeometryFunctor gf; - gf.forEachMeshObjectInScene(sce, *this); - - closeLibrary(); - } - - void operator()(Object *ob) - { - Object *ob_arm = get_assigned_armature(ob); - - if (ob_arm /*&& !already_written(ob_arm)*/) - export_controller(ob, ob_arm); - } - -private: - - UnitConverter converter; - -#if 0 - std::vector written_armatures; - - bool already_written(Object *ob_arm) - { - return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != written_armatures.end(); - } - - void wrote(Object *ob_arm) - { - written_armatures.push_back(ob_arm); - } - - void find_objects_using_armature(Object *ob_arm, std::vector& objects, Scene *sce) - { - objects.clear(); - - Base *base= (Base*) sce->base.first; - while(base) { - Object *ob = base->object; - - if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) { - objects.push_back(ob); - } - - base= base->next; - } - } -#endif - - Object *get_assigned_armature(Object *ob) - { - Object *ob_arm = NULL; - - if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) { - ob_arm = ob->parent; - } - else { - ModifierData *mod = (ModifierData*)ob->modifiers.first; - while (mod) { - if (mod->type == eModifierType_Armature) { - ob_arm = ((ArmatureModifierData*)mod)->object; - } - - mod = mod->next; - } - } - - return ob_arm; - } - - std::string get_joint_sid(Bone *bone, Object *ob_arm) - { - return get_joint_id(bone, ob_arm); - } - - // parent_mat is armature-space - void add_bone_node(Bone *bone, Object *ob_arm) - { - std::string node_id = get_joint_id(bone, ob_arm); - std::string node_name = std::string(bone->name); - std::string node_sid = get_joint_sid(bone, ob_arm); - - COLLADASW::Node node(mSW); - - node.setType(COLLADASW::Node::JOINT); - node.setNodeId(node_id); - node.setNodeName(node_name); - node.setNodeSid(node_sid); - - node.start(); - - add_bone_transform(ob_arm, bone, node); - - for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) { - add_bone_node(child, ob_arm); - } - - node.end(); - } - - void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node) - { - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); - - float mat[4][4]; - - if (bone->parent) { - // get bone-space matrix from armature-space - bPoseChannel *parchan = get_pose_channel(ob_arm->pose, bone->parent->name); - - float invpar[4][4]; - invert_m4_m4(invpar, parchan->pose_mat); - mul_m4_m4m4(mat, pchan->pose_mat, invpar); - } - else { - // get world-space from armature-space - mul_m4_m4m4(mat, pchan->pose_mat, ob_arm->obmat); - } - - TransformWriter::add_node_transform(node, mat, NULL); - } - - std::string get_controller_id(Object *ob_arm, Object *ob) - { - return translate_id(id_name(ob_arm)) + "_" + translate_id(id_name(ob)) + SKIN_CONTROLLER_ID_SUFFIX; - } - - // ob should be of type OB_MESH - // both args are required - void export_controller(Object* ob, Object *ob_arm) - { - // joint names - // joint inverse bind matrices - // vertex weights - - // input: - // joint names: ob -> vertex group names - // vertex group weights: me->dvert -> groups -> index, weight - - /* - me->dvert: - - typedef struct MDeformVert { - struct MDeformWeight *dw; - int totweight; - int flag; // flag only in use for weightpaint now - } MDeformVert; - - typedef struct MDeformWeight { - int def_nr; - float weight; - } MDeformWeight; - */ - - Mesh *me = (Mesh*)ob->data; - if (!me->dvert) return; - - std::string controller_name = id_name(ob_arm); - std::string controller_id = get_controller_id(ob_arm, ob); - - openSkin(controller_id, controller_name, - COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob))); - - add_bind_shape_mat(ob); - - std::string joints_source_id = add_joints_source(ob_arm, &ob->defbase, controller_id); - std::string inv_bind_mat_source_id = add_inv_bind_mats_source(ob_arm, &ob->defbase, controller_id); - std::string weights_source_id = add_weights_source(me, controller_id); - - add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id); - add_vertex_weights_element(weights_source_id, joints_source_id, me, ob_arm, &ob->defbase); - - closeSkin(); - closeController(); - } - - void add_joints_element(ListBase *defbase, - const std::string& joints_source_id, const std::string& inv_bind_mat_source_id) - { - COLLADASW::JointsElement joints(mSW); - COLLADASW::InputList &input = joints.getInputList(); - - input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h - COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id))); - input.push_back(COLLADASW::Input(COLLADASW::BINDMATRIX, - COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id))); - joints.add(); - } - - void add_bind_shape_mat(Object *ob) - { - double bind_mat[4][4]; - - converter.mat4_to_dae_double(bind_mat, ob->obmat); - - addBindShapeTransform(bind_mat); - } - - std::string add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id) - { - std::string source_id = controller_id + JOINTS_SOURCE_ID_SUFFIX; - - int totjoint = 0; - bDeformGroup *def; - for (def = (bDeformGroup*)defbase->first; def; def = def->next) { - if (is_bone_defgroup(ob_arm, def)) - totjoint++; - } - - COLLADASW::NameSource source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(totjoint); - source.setAccessorStride(1); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("JOINT"); - - source.prepareToAppendValues(); - - for (def = (bDeformGroup*)defbase->first; def; def = def->next) { - Bone *bone = get_bone_from_defgroup(ob_arm, def); - if (bone) - source.appendValues(get_joint_sid(bone, ob_arm)); - } - - source.finish(); - - return source_id; - } - - std::string add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id) - { - std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX; - - COLLADASW::FloatSourceF source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(BLI_countlist(defbase)); - source.setAccessorStride(16); - - source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4); - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("TRANSFORM"); - - source.prepareToAppendValues(); - - bPose *pose = ob_arm->pose; - bArmature *arm = (bArmature*)ob_arm->data; - - int flag = arm->flag; - - // put armature in rest position - if (!(arm->flag & ARM_RESTPOS)) { - arm->flag |= ARM_RESTPOS; - where_is_pose(scene, ob_arm); - } - - for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) { - if (is_bone_defgroup(ob_arm, def)) { - - bPoseChannel *pchan = get_pose_channel(pose, def->name); - - float mat[4][4]; - float world[4][4]; - float inv_bind_mat[4][4]; - - // make world-space matrix, pose_mat is armature-space - mul_m4_m4m4(world, pchan->pose_mat, ob_arm->obmat); - - invert_m4_m4(mat, world); - converter.mat4_to_dae(inv_bind_mat, mat); - - source.appendValues(inv_bind_mat); - } - } - - // back from rest positon - if (!(flag & ARM_RESTPOS)) { - arm->flag = flag; - where_is_pose(scene, ob_arm); - } - - source.finish(); - - return source_id; - } - - Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def) - { - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, def->name); - return pchan ? pchan->bone : NULL; - } - - bool is_bone_defgroup(Object *ob_arm, bDeformGroup* def) - { - return get_bone_from_defgroup(ob_arm, def) != NULL; - } - - std::string add_weights_source(Mesh *me, const std::string& controller_id) - { - std::string source_id = controller_id + WEIGHTS_SOURCE_ID_SUFFIX; - - int i; - int totweight = 0; - - for (i = 0; i < me->totvert; i++) { - totweight += me->dvert[i].totweight; - } - - COLLADASW::FloatSourceF source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(totweight); - source.setAccessorStride(1); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("WEIGHT"); - - source.prepareToAppendValues(); - - // NOTE: COLLADA spec says weights should be normalized - - for (i = 0; i < me->totvert; i++) { - MDeformVert *vert = &me->dvert[i]; - for (int j = 0; j < vert->totweight; j++) { - source.appendValues(vert->dw[j].weight); - } - } - - source.finish(); - - return source_id; - } - - void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me, - Object *ob_arm, ListBase *defbase) - { - COLLADASW::VertexWeightsElement weights(mSW); - COLLADASW::InputList &input = weights.getInputList(); - - int offset = 0; - input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h - COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++)); - input.push_back(COLLADASW::Input(COLLADASW::WEIGHT, - COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++)); - - weights.setCount(me->totvert); - - // write number of deformers per vertex - COLLADASW::PrimitivesBase::VCountList vcount; - int i; - for (i = 0; i < me->totvert; i++) { - vcount.push_back(me->dvert[i].totweight); - } - - weights.prepareToAppendVCountValues(); - weights.appendVertexCount(vcount); - - // def group index -> joint index - std::map joint_index_by_def_index; - bDeformGroup *def; - int j; - for (def = (bDeformGroup*)defbase->first, i = 0, j = 0; def; def = def->next, i++) { - if (is_bone_defgroup(ob_arm, def)) - joint_index_by_def_index[i] = j++; - else - joint_index_by_def_index[i] = -1; - } - - weights.CloseVCountAndOpenVElement(); - - // write deformer index - weight index pairs - int weight_index = 0; - for (i = 0; i < me->totvert; i++) { - MDeformVert *dvert = &me->dvert[i]; - for (int j = 0; j < dvert->totweight; j++) { - weights.appendValues(joint_index_by_def_index[dvert->dw[j].def_nr]); - weights.appendValues(weight_index++); - } - } - - weights.finish(); - } -}; - class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter, protected InstanceWriter { ArmatureExporter *arm_exporter; diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp new file mode 100644 index 00000000000..a3260c85f68 --- /dev/null +++ b/source/blender/collada/InstanceWriter.cpp @@ -0,0 +1,64 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "COLLADASWInstanceMaterial.h" + +#include "BKE_customdata.h" +#include "BKE_material.h" + +#include "DNA_mesh_types.h" + +#include "InstanceWriter.h" + +#include "collada_internal.h" +#include "collada_utils.h" + +void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob) +{ + for(int a = 0; a < ob->totcol; a++) { + Material *ma = give_current_material(ob, a+1); + + COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList(); + + if (ma) { + std::string matid(id_name(ma)); + matid = translate_id(matid); + COLLADASW::InstanceMaterial im(matid, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid)); + + // create for each uv layer + Mesh *me = (Mesh*)ob->data; + int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE); + + for (int b = 0; b < totlayer; b++) { + char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, b); + im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b)); + } + + iml.push_back(im); + } + } +} diff --git a/source/blender/collada/InstanceWriter.h b/source/blender/collada/InstanceWriter.h new file mode 100644 index 00000000000..f7585bb20db --- /dev/null +++ b/source/blender/collada/InstanceWriter.h @@ -0,0 +1,39 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __INSTANCEWRITER_H__ +#define __INSTANCEWRITER_H__ + +#include "COLLADASWBindMaterial.h" + +#include "DNA_object_types.h" + +class InstanceWriter +{ +protected: + void add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob); +}; + +#endif diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp new file mode 100644 index 00000000000..21260a2d4f1 --- /dev/null +++ b/source/blender/collada/TransformWriter.cpp @@ -0,0 +1,100 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "BKE_object.h" + +#include "TransformWriter.h" + +#include "BLI_math.h" + +void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4], float parent_mat[][4]) +{ + float loc[3], rot[3], scale[3]; + float local[4][4]; + + if (parent_mat) { + float invpar[4][4]; + invert_m4_m4(invpar, parent_mat); + mul_m4_m4m4(local, mat, invpar); + } + else { + copy_m4_m4(local, mat); + } + + TransformBase::decompose(local, loc, rot, NULL, scale); + + add_transform(node, loc, rot, scale); +} + +void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) +{ + float rot[3], loc[3], scale[3]; + + if (ob->parent) { + float C[4][4], tmat[4][4], imat[4][4], mat[4][4]; + + // factor out scale from obmat + + copy_v3_v3(scale, ob->size); + + ob->size[0] = ob->size[1] = ob->size[2] = 1.0f; + object_to_mat4(ob, C); + copy_v3_v3(ob->size, scale); + + mul_serie_m4(tmat, ob->parent->obmat, ob->parentinv, C, NULL, NULL, NULL, NULL, NULL); + + // calculate local mat + + invert_m4_m4(imat, ob->parent->obmat); + mul_m4_m4m4(mat, tmat, imat); + + // done + + mat4_to_eul(rot, mat); + copy_v3_v3(loc, mat[3]); + } + else { + copy_v3_v3(loc, ob->loc); + copy_v3_v3(rot, ob->rot); + copy_v3_v3(scale, ob->size); + } + + add_transform(node, loc, rot, scale); +} + +void TransformWriter::add_node_transform_identity(COLLADASW::Node& node) +{ + float loc[] = {0.0f, 0.0f, 0.0f}, scale[] = {1.0f, 1.0f, 1.0f}, rot[] = {0.0f, 0.0f, 0.0f}; + add_transform(node, loc, rot, scale); +} + +void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3]) +{ + node.addTranslate("location", loc[0], loc[1], loc[2]); + node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2])); + node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1])); + node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0])); + node.addScale("scale", scale[0], scale[1], scale[2]); +} diff --git a/source/blender/collada/TransformWriter.h b/source/blender/collada/TransformWriter.h new file mode 100644 index 00000000000..29aef721afb --- /dev/null +++ b/source/blender/collada/TransformWriter.h @@ -0,0 +1,48 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __TRANSFORMWRITER_H__ +#define __TRANSFORMWRITER_H__ + +#include "COLLADASWNode.h" + +#include "DNA_object_types.h" + +#include "collada_internal.h" + +class TransformWriter : protected TransformBase +{ +protected: + void add_node_transform(COLLADASW::Node& node, float mat[][4], float parent_mat[][4]); + + void add_node_transform_ob(COLLADASW::Node& node, Object *ob); + + void add_node_transform_identity(COLLADASW::Node& node); + +private: + void add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3]); +}; + +#endif -- cgit v1.2.3 From e161c22dc24842e1900f3c68948fe7a4af973c4e Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 12:04:56 +0000 Subject: Assorted GCC fixes for OpenCOLLADA support --- source/blender/collada/ArmatureExporter.cpp | 2 +- source/blender/collada/DocumentExporter.cpp | 2 +- source/blender/collada/MeshImporter.cpp | 6 +++++- source/blender/collada/SkinInfo.cpp | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 527ccd66577..bf75baaf89d 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -35,7 +35,7 @@ #include "BKE_action.h" #include "BKE_armature.h" -#include "BLI_listBase.h" +#include "BLI_listbase.h" #include "GeometryExporter.h" #include "ArmatureExporter.h" diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index ad85a81c6f8..914c8a656f9 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -186,7 +186,7 @@ void forEachMaterialInScene(Scene *sce, Functor &f) { ForEachMaterialFunctor matfunc(&f); GeometryFunctor gf; - gf.forEachMeshObjectInScene>(sce, matfunc); + gf.forEachMeshObjectInScene >(sce, matfunc); } // OB_MESH is assumed diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 34da6c9e897..df5136f1cb4 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -24,6 +24,10 @@ #include +#ifndef WIN32 +#include +#endif + #include "COLLADAFWMeshPrimitive.h" #include "COLLADAFWMeshVertexData.h" #include "COLLADAFWPolygons.h" @@ -904,4 +908,4 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); return true; -} \ No newline at end of file +} diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index 58985d58db3..a3ac6a30c59 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -24,6 +24,10 @@ #include +#ifndef WIN32 +#include +#endif + #include "BKE_object.h" #include "DNA_armature_types.h" #include "DNA_modifier_types.h" -- cgit v1.2.3 From 0d815d3528912eede6ee90f3a12435cbcca1eb04 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 13:21:08 +0000 Subject: COLLADA: Split MaterialsExporter into separate files. --- source/blender/collada/DocumentExporter.cpp | 70 ++--------------------- source/blender/collada/MaterialExporter.cpp | 55 ++++++++++++++++++ source/blender/collada/MaterialExporter.h | 88 +++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 65 deletions(-) create mode 100644 source/blender/collada/MaterialExporter.cpp create mode 100644 source/blender/collada/MaterialExporter.h diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 914c8a656f9..f93a8ef72cd 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -106,6 +106,7 @@ extern char build_rev[]; #include "CameraExporter.h" #include "GeometryExporter.h" #include "LightExporter.h" +#include "MaterialExporter.h" // can probably go after refactor is complete #include "InstanceWriter.h" @@ -151,43 +152,7 @@ void forEachObjectInScene(Scene *sce, Functor &f) } } -// used in forEachMaterialInScene -template -class ForEachMaterialFunctor -{ - std::vector mMat; // contains list of material names, to avoid duplicate calling of f - MaterialFunctor *f; -public: - ForEachMaterialFunctor(MaterialFunctor *f) : f(f) { } - void operator ()(Object *ob) - { - int a; - for(a = 0; a < ob->totcol; a++) { - - Material *ma = give_current_material(ob, a+1); - if (!ma) continue; - - std::string translated_id = translate_id(id_name(ma)); - if (find(mMat.begin(), mMat.end(), translated_id) == mMat.end()) { - (*this->f)(ma, ob); - - mMat.push_back(translated_id); - } - } - } -}; - -// calls f for each unique material linked to each object in sce -// f should have -// void operator()(Material* ma) -template -void forEachMaterialInScene(Scene *sce, Functor &f) -{ - ForEachMaterialFunctor matfunc(&f); - GeometryFunctor gf; - gf.forEachMeshObjectInScene >(sce, matfunc); -} // OB_MESH is assumed std::string getActiveUVLayerName(Object *ob) @@ -344,8 +309,8 @@ public: void exportImages(Scene *sce) { openLibrary(); - - forEachMaterialInScene(sce, *this); + MaterialFunctor mf; + mf.forEachMaterialInScene(sce, *this); closeLibrary(); } @@ -401,8 +366,8 @@ public: void exportEffects(Scene *sce) { openLibrary(); - - forEachMaterialInScene(sce, *this); + MaterialFunctor mf; + mf.forEachMaterialInScene(sce, *this); closeLibrary(); } @@ -652,31 +617,6 @@ public: } }; -class MaterialsExporter: COLLADASW::LibraryMaterials -{ -public: - MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){} - void exportMaterials(Scene *sce) - { - openLibrary(); - - forEachMaterialInScene(sce, *this); - - closeLibrary(); - } - - void operator()(Material *ma, Object *ob) - { - std::string name(id_name(ma)); - - openMaterial(translate_id(name), name); - - std::string efid = translate_id(name) + "-effect"; - addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid)); - - closeMaterial(); - } -}; // TODO: it would be better to instantiate animations rather than create a new one per object // COLLADA allows this through multiple s in . diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp new file mode 100644 index 00000000000..e873227745c --- /dev/null +++ b/source/blender/collada/MaterialExporter.cpp @@ -0,0 +1,55 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "COLLADABUUtils.h" + +#include "BKE_material.h" + +#include "MaterialExporter.h" +#include "collada_internal.h" + +MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){} + +void MaterialsExporter::exportMaterials(Scene *sce) +{ + openLibrary(); + + MaterialFunctor mf; + mf.forEachMaterialInScene(sce, *this); + + closeLibrary(); +} + +void MaterialsExporter::operator()(Material *ma, Object *ob) +{ + std::string name(id_name(ma)); + + openMaterial(translate_id(name), name); + + std::string efid = translate_id(name) + "-effect"; + addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid)); + + closeMaterial(); +} diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h new file mode 100644 index 00000000000..35aaaad43fd --- /dev/null +++ b/source/blender/collada/MaterialExporter.h @@ -0,0 +1,88 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __MATERIALEXPORTER_H__ +#define __MATERIALEXPORTER_H__ + +#include "COLLADASWLibraryMaterials.h" +#include "COLLADASWStreamWriter.h" + +#include "DNA_material_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "GeometryExporter.h" + +class MaterialsExporter: COLLADASW::LibraryMaterials +{ +public: + MaterialsExporter(COLLADASW::StreamWriter *sw); + void exportMaterials(Scene *sce); + void operator()(Material *ma, Object *ob); +}; + +// used in forEachMaterialInScene +template +class ForEachMaterialFunctor +{ + std::vector mMat; // contains list of material names, to avoid duplicate calling of f + Functor *f; +public: + ForEachMaterialFunctor(Functor*f) : f(f) {} + + void operator ()(Object *ob) + { + int a; + for(a = 0; a < ob->totcol; a++) { + + Material *ma = give_current_material(ob, a+1); + + if (!ma) continue; + + std::string translated_id = translate_id(id_name(ma)); + if (find(mMat.begin(), mMat.end(), translated_id) == mMat.end()) { + (*this->f)(ma, ob); + + mMat.push_back(translated_id); + } + } + } +}; + +struct MaterialFunctor { + // calls f for each unique material linked to each object in sce + // f should have + // void operator()(Material* ma) + template + void forEachMaterialInScene(Scene *sce, Functor &f) + { + ForEachMaterialFunctor matfunc(&f); + GeometryFunctor gf; + gf.forEachMeshObjectInScene >(sce, matfunc); + } +}; + + +#endif -- cgit v1.2.3 From ca44eb3abd4ac2729c0d276b561ed2d3b49efe3f Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 13:55:50 +0000 Subject: GCC fixes for r32346 --- source/blender/collada/DocumentExporter.cpp | 7 ++++--- source/blender/collada/MaterialExporter.cpp | 2 -- source/blender/collada/MaterialExporter.h | 6 ++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index f93a8ef72cd..06df94416b3 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -102,15 +102,16 @@ extern char build_rev[]; #include "collada_internal.h" #include "DocumentExporter.h" +// can probably go after refactor is complete +#include "InstanceWriter.h" +#include "TransformWriter.h" + #include "ArmatureExporter.h" #include "CameraExporter.h" #include "GeometryExporter.h" #include "LightExporter.h" #include "MaterialExporter.h" -// can probably go after refactor is complete -#include "InstanceWriter.h" -#include "TransformWriter.h" #include #include // std::find diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index e873227745c..66ebe2d9ed8 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -25,8 +25,6 @@ #include "COLLADABUUtils.h" -#include "BKE_material.h" - #include "MaterialExporter.h" #include "collada_internal.h" diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h index 35aaaad43fd..972cd8bd8e5 100644 --- a/source/blender/collada/MaterialExporter.h +++ b/source/blender/collada/MaterialExporter.h @@ -26,14 +26,20 @@ #ifndef __MATERIALEXPORTER_H__ #define __MATERIALEXPORTER_H__ +#include +#include + #include "COLLADASWLibraryMaterials.h" #include "COLLADASWStreamWriter.h" +#include "BKE_material.h" + #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "GeometryExporter.h" +#include "collada_internal.h" class MaterialsExporter: COLLADASW::LibraryMaterials { -- cgit v1.2.3 From d256ec9d2405416c7a8a26862fa2196f13dabb6b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 14:17:28 +0000 Subject: bugfix [#23311] Half a colour picker appears all popups which are positioned based on an existing button are now clamped to window bounds. --- source/blender/editors/interface/interface_regions.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 50b85360196..ff079a4b9e0 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1116,6 +1116,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, if(but) { int left=0, right=0, top=0, down=0; int winx, winy; + int offscreen; wm_window_get_size(window, &winx, &winy); @@ -1206,6 +1207,12 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, // apply requested offset in the block xof += block->xofs/block->aspect; yof += block->yofs/block->aspect; + + /* clamp to window bounds, could be made into an option if its ever annoying */ + if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */ + else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */ + if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */ + else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */ } /* apply */ -- cgit v1.2.3 From 61d23ff95b71eb71bf7ced09f410ab1acc9a6db4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 14:47:40 +0000 Subject: minor edits so traceray() uses less stack memory, also remove memset() usage, initialize as {0}. no functional change. --- source/blender/render/intern/source/rayshade.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 724fd9a3110..1172bee7d67 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -697,17 +697,9 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, * note: 'col' must be initialized */ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, float *start, float *vec, float *col, ObjectInstanceRen *obi, VlakRen *vlr, int traflag) { - ShadeInput shi; - ShadeResult shr; + ShadeInput shi= {0}; Isect isec; - float f, f1, fr, fg, fb; - float ref[3]; float dist_mir = origshi->mat->dist_mir; - - /* Warning, This is not that nice, and possibly a bit slow for every ray, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ - memset(&shi, 0, sizeof(ShadeInput)); - /* end warning! - Campbell */ VECCOPY(isec.start, start); VECCOPY(isec.vec, vec ); @@ -721,8 +713,9 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo RE_RC_INIT(isec, shi); if(RE_rayobject_raycast(R.raytree, &isec)) { + ShadeResult shr= {{0}}; float d= 1.0f; - + shi.mask= origshi->mask; shi.osatex= origshi->osatex; shi.depth= 1; /* only used to indicate tracing */ @@ -737,16 +730,15 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo shi.light_override= origshi->light_override; shi.mat_override= origshi->mat_override; - memset(&shr, 0, sizeof(ShadeResult)); - shade_ray(&isec, &shi, &shr); if (traflag & RAY_TRA) d= shade_by_transmission(&isec, &shi, &shr); if(depth>0) { + float fr, fg, fb, f, f1; if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) { - float nf, f, f1, refract[3], tracol[4]; + float nf, f, refract[3], tracol[4]; tracol[0]= shi.r; tracol[1]= shi.g; @@ -799,6 +791,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo if(f!=0.0f) { float mircol[4]; + float ref[3]; reflection(ref, shi.vn, shi.view, NULL); traceray(origshi, origshr, depth-1, shi.co, ref, mircol, shi.obi, shi.vlr, 0); -- cgit v1.2.3 From 352fbb154978fbcc6b01440df37a3447400e8364 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 14:53:13 +0000 Subject: remove unused vol_get_density() call. --- source/blender/render/intern/source/volumetric.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index a58d96736d5..d15ea0c792c 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -743,7 +743,6 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct float tr[3] = {1.0,1.0,1.0}; Isect is; float *startco, *endco; - float density=0.f; memset(shr, 0, sizeof(ShadeResult)); @@ -764,8 +763,7 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct shr->alpha = shr->combined[3] = 1.f; return; } - - density = vol_get_density(shi, startco); + vol_get_transmittance(shi, tr, startco, endco); copy_v3_v3(shr->combined, tr); -- cgit v1.2.3 From c0b36a0be0474c5bd3a4859450d257099c8fe681 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 6 Oct 2010 16:23:52 +0000 Subject: COLLADA: Split ImagesExporter into separate files. --- source/blender/blenlib/BLI_fileops.h | 8 +++ source/blender/collada/DocumentExporter.cpp | 63 +------------------ source/blender/collada/ImageExporter.cpp | 93 +++++++++++++++++++++++++++++ source/blender/collada/ImageExporter.h | 50 ++++++++++++++++ 4 files changed, 152 insertions(+), 62 deletions(-) create mode 100644 source/blender/collada/ImageExporter.cpp create mode 100644 source/blender/collada/ImageExporter.h diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 6c98d30e4b1..b721a21b1b9 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -36,6 +36,10 @@ #ifndef BLI_FILEOPS_H #define BLI_FILEOPS_H +#ifdef __cplusplus +extern "C" { +#endif + void BLI_recurdir_fileops(char *dirname); int BLI_link(char *file, char *to); int BLI_is_writable(char *filename); @@ -60,5 +64,9 @@ char *first_slash(char *string); void BLI_setCmdCallBack(int (*f)(char*)); #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 06df94416b3..9bf84c7e606 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -109,10 +109,10 @@ extern char build_rev[]; #include "ArmatureExporter.h" #include "CameraExporter.h" #include "GeometryExporter.h" +#include "ImageExporter.h" #include "LightExporter.h" #include "MaterialExporter.h" - #include #include // std::find @@ -299,67 +299,6 @@ public: } }; -class ImagesExporter: COLLADASW::LibraryImages -{ - const char *mfilename; - std::vector mImages; // contains list of written images, to avoid duplicates -public: - ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename) : COLLADASW::LibraryImages(sw), mfilename(filename) - {} - - void exportImages(Scene *sce) - { - openLibrary(); - MaterialFunctor mf; - mf.forEachMaterialInScene(sce, *this); - - closeLibrary(); - } - - void operator()(Material *ma, Object *ob) - { - int a; - for (a = 0; a < MAX_MTEX; a++) { - MTex *mtex = ma->mtex[a]; - if (mtex && mtex->tex && mtex->tex->ima) { - - Image *image = mtex->tex->ima; - std::string name(id_name(image)); - name = translate_id(name); - char rel[FILE_MAX]; - char abs[FILE_MAX]; - char src[FILE_MAX]; - char dir[FILE_MAX]; - - BLI_split_dirfile(mfilename, dir, NULL); - - BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir); - - if (abs[0] != '\0') { - - // make absolute source path - BLI_strncpy(src, image->name, sizeof(src)); - BLI_path_abs(src, G.sce); - - // make dest directory if it doesn't exist - BLI_make_existing_file(abs); - - if (BLI_copy_fileops(src, abs) != 0) { - fprintf(stderr, "Cannot copy image to file's directory. \n"); - } - } - - if (find(mImages.begin(), mImages.end(), name) == mImages.end()) { - COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name); - img.add(mSW); - - mImages.push_back(name); - } - } - } - } -}; - class EffectsExporter: COLLADASW::LibraryEffects { public: diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp new file mode 100644 index 00000000000..3bcce313aa5 --- /dev/null +++ b/source/blender/collada/ImageExporter.cpp @@ -0,0 +1,93 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "COLLADABUURI.h" +#include "COLLADASWImage.h" + +#include "ImageExporter.h" +#include "MaterialExporter.h" + +#include "DNA_texture_types.h" + +#include "BKE_global.h" +#include "BKE_utildefines.h" +#include "BLI_fileops.h" +#include "BLI_path_util.h" +#include "BLI_string.h" + +ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename) : COLLADASW::LibraryImages(sw), mfilename(filename) +{} + +void ImagesExporter::exportImages(Scene *sce) +{ + openLibrary(); + MaterialFunctor mf; + mf.forEachMaterialInScene(sce, *this); + + closeLibrary(); +} + +void ImagesExporter::operator()(Material *ma, Object *ob) +{ + int a; + for (a = 0; a < MAX_MTEX; a++) { + MTex *mtex = ma->mtex[a]; + if (mtex && mtex->tex && mtex->tex->ima) { + + Image *image = mtex->tex->ima; + std::string name(id_name(image)); + name = translate_id(name); + char rel[FILE_MAX]; + char abs[FILE_MAX]; + char src[FILE_MAX]; + char dir[FILE_MAX]; + + BLI_split_dirfile(mfilename, dir, NULL); + + BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir); + + if (abs[0] != '\0') { + + // make absolute source path + BLI_strncpy(src, image->name, sizeof(src)); + BLI_path_abs(src, G.sce); + + // make dest directory if it doesn't exist + BLI_make_existing_file(abs); + + if (BLI_copy_fileops(src, abs) != 0) { + fprintf(stderr, "Cannot copy image to file's directory. \n"); + } + } + + if (find(mImages.begin(), mImages.end(), name) == mImages.end()) { + COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name); + img.add(mSW); + + mImages.push_back(name); + } + } + } +} diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h new file mode 100644 index 00000000000..4ee9aba2f6d --- /dev/null +++ b/source/blender/collada/ImageExporter.h @@ -0,0 +1,50 @@ +/** + * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __IMAGEEXPORTER_H__ +#define __IMAGEEXPORTER_H__ + +#include +#include + +#include "COLLADASWStreamWriter.h" +#include "COLLADASWLibraryImages.h" + +#include "DNA_material_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +class ImagesExporter: COLLADASW::LibraryImages +{ + const char *mfilename; + std::vector mImages; // contains list of written images, to avoid duplicates +public: + ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename); + + void exportImages(Scene *sce); + void operator()(Material *ma, Object *ob); +}; + +#endif -- cgit v1.2.3 From c02526bdf97e2972971266ff0cec48482f719352 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 18:51:07 +0000 Subject: bugfix [#24157] AddPresetBase class writes incorrect values for float_vector properties --- release/scripts/op/presets.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 4af27480669..aa3c306ce06 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -63,11 +63,16 @@ class AddPresetBase(): else: file_preset = open(filepath, 'w') file_preset.write("import bpy\n") - file_preset.write("from mathutils import *\n") for rna_path in self.preset_values: value = eval(rna_path) - file_preset.write("%s = %s\n" % (rna_path, repr(value))) + # convert thin wrapped sequences to simple lists to repr() + try: + value = value[:] + except: + pass + + file_preset.write("%s = %r\n" % (rna_path, value)) file_preset.close() -- cgit v1.2.3 From 2cabb498dcd0664ad8940eefae9d012b175ad829 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 20:29:00 +0000 Subject: bugfix [#23988] The Maya preset as default --- release/scripts/op/presets.py | 2 +- release/scripts/presets/interaction/maya.py | 386 --------------------- release/scripts/presets/keyconfig/maya.py | 386 +++++++++++++++++++++ release/scripts/ui/space_userpref.py | 6 +- release/scripts/ui/space_userpref_keymap.py | 4 +- source/blender/windowmanager/intern/wm_operators.c | 5 +- 6 files changed, 398 insertions(+), 391 deletions(-) delete mode 100644 release/scripts/presets/interaction/maya.py create mode 100644 release/scripts/presets/keyconfig/maya.py diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index aa3c306ce06..2f6a5b69c20 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -256,7 +256,7 @@ class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator): '''Add a Keyconfig Preset''' bl_idname = "wm.keyconfig_preset_add" bl_label = "Add Keyconfig Preset" - preset_menu = "PREFS_MT_keyconfigs" + preset_menu = "USERPREF_MT_keyconfigs" preset_subdir = "keyconfig" def add(self, context, filepath): diff --git a/release/scripts/presets/interaction/maya.py b/release/scripts/presets/interaction/maya.py deleted file mode 100644 index 4a40326325e..00000000000 --- a/release/scripts/presets/interaction/maya.py +++ /dev/null @@ -1,386 +0,0 @@ -# Configuration Maya -import bpy - -wm = bpy.context.window_manager -kc = wm.keyconfigs.new('Maya') - -# Map 3D View -km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False) - -kmi = km.items.new('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True) -kmi.properties.release_confirm = True -kmi = km.items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS') -kmi = km.items.new('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True) -kmi = km.items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', alt=True) -kmi = km.items.new('view3d.zoom', 'RIGHTMOUSE', 'PRESS', alt=True) -kmi = km.items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS') -kmi = km.items.new('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True) -kmi = km.items.new('view3d.fly', 'F', 'PRESS', shift=True) -kmi = km.items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True) -kmi = km.items.new('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True) -kmi = km.items.new('view3d.rotate', 'MOUSEROTATE', 'ANY') -kmi = km.items.new('view3d.move', 'TRACKPADPAN', 'ANY') -kmi = km.items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY') -kmi = km.items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS') -kmi.properties.delta = 1 -kmi = km.items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS') -kmi.properties.delta = -1 -kmi = km.items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True) -kmi.properties.delta = 1 -kmi = km.items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True) -kmi.properties.delta = -1 -kmi = km.items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS') -kmi.properties.delta = 1 -kmi = km.items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS') -kmi.properties.delta = -1 -kmi = km.items.new('view3d.view_all', 'HOME', 'PRESS') -kmi.properties.center = False -kmi = km.items.new('view3d.view_all', 'C', 'PRESS', shift=True) -kmi.properties.center = True -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS') -kmi.properties.type = 'CAMERA' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS') -kmi.properties.type = 'FRONT' -kmi = km.items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS') -kmi.properties.type = 'ORBITDOWN' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS') -kmi.properties.type = 'RIGHT' -kmi = km.items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS') -kmi.properties.type = 'ORBITLEFT' -kmi = km.items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS') -kmi = km.items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS') -kmi.properties.type = 'ORBITRIGHT' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS') -kmi.properties.type = 'TOP' -kmi = km.items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS') -kmi.properties.type = 'ORBITUP' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True) -kmi.properties.type = 'BACK' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True) -kmi.properties.type = 'LEFT' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True) -kmi.properties.type = 'BOTTOM' -kmi = km.items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True) -kmi.properties.type = 'PANDOWN' -kmi = km.items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True) -kmi.properties.type = 'PANLEFT' -kmi = km.items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True) -kmi.properties.type = 'PANRIGHT' -kmi = km.items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True) -kmi.properties.type = 'PANUP' -kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True) -kmi.properties.type = 'PANRIGHT' -kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True) -kmi.properties.type = 'PANLEFT' -kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True) -kmi.properties.type = 'PANUP' -kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True) -kmi.properties.type = 'PANDOWN' -kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True) -kmi.properties.type = 'ORBITLEFT' -kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True) -kmi.properties.type = 'ORBITRIGHT' -kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True) -kmi.properties.type = 'ORBITUP' -kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True) -kmi.properties.type = 'ORBITDOWN' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True) -kmi.properties.align_active = True -kmi.properties.type = 'FRONT' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True) -kmi.properties.align_active = True -kmi.properties.type = 'RIGHT' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True) -kmi.properties.align_active = True -kmi.properties.type = 'TOP' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True) -kmi.properties.align_active = True -kmi.properties.type = 'BACK' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True) -kmi.properties.align_active = True -kmi.properties.type = 'LEFT' -kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True) -kmi.properties.align_active = True -kmi.properties.type = 'BOTTOM' -kmi = km.items.new('view3d.localview', 'NUMPAD_SLASH', 'PRESS') -kmi = km.items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS') -kmi.properties.nr = 0 -kmi = km.items.new('view3d.layers', 'ONE', 'PRESS', any=True) -kmi.properties.nr = 1 -kmi = km.items.new('view3d.layers', 'TWO', 'PRESS', any=True) -kmi.properties.nr = 2 -kmi = km.items.new('view3d.layers', 'THREE', 'PRESS', any=True) -kmi.properties.nr = 3 -kmi = km.items.new('view3d.layers', 'FOUR', 'PRESS', any=True) -kmi.properties.nr = 4 -kmi = km.items.new('view3d.layers', 'FIVE', 'PRESS', any=True) -kmi.properties.nr = 5 -kmi = km.items.new('view3d.layers', 'SIX', 'PRESS', any=True) -kmi.properties.nr = 6 -kmi = km.items.new('view3d.layers', 'SEVEN', 'PRESS', any=True) -kmi.properties.nr = 7 -kmi = km.items.new('view3d.layers', 'EIGHT', 'PRESS', any=True) -kmi.properties.nr = 8 -kmi = km.items.new('view3d.layers', 'NINE', 'PRESS', any=True) -kmi.properties.nr = 9 -kmi = km.items.new('view3d.layers', 'ZERO', 'PRESS', any=True) -kmi.properties.nr = 10 -kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS') -kmi.properties.data_path = 'space_data.viewport_shade' -kmi.properties.value_1 = 'SOLID' -kmi.properties.value_2 = 'WIREFRAME' -kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True) -kmi.properties.data_path = 'space_data.viewport_shade' -kmi.properties.value_1 = 'TEXTURED' -kmi.properties.value_2 = 'SOLID' -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS') -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True) -kmi.properties.extend = True -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True) -kmi.properties.center = True -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True) -kmi.properties.enumerate = True -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True) -kmi.properties.center = True -kmi.properties.extend = True -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True) -kmi.properties.center = True -kmi.properties.enumerate = True -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True) -kmi.properties.enumerate = True -kmi.properties.extend = True -kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True) -kmi.properties.center = True -kmi.properties.enumerate = True -kmi.properties.extend = True -kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY') -kmi.properties.extend = False -kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True) -kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True) -kmi.properties.deselect = True -kmi = km.items.new('view3d.select_circle', 'C', 'PRESS') -kmi = km.items.new('view3d.clip_border', 'B', 'PRESS', alt=True) -kmi = km.items.new('view3d.zoom_border', 'B', 'PRESS', shift=True) -kmi = km.items.new('view3d.render_border', 'B', 'PRESS', shift=True) -kmi = km.items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True) -kmi = km.items.new('wm.call_menu', 'S', 'PRESS', shift=True) -kmi.properties.name = 'VIEW3D_MT_snap' -kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS') -kmi.properties.data_path = 'space_data.pivot_point' -kmi.properties.value = 'BOUNDING_BOX_CENTER' -kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True) -kmi.properties.data_path = 'space_data.pivot_point' -kmi.properties.value = 'MEDIAN_POINT' -kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True) -kmi.properties.data_path = 'space_data.use_pivot_point_align' -kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS') -kmi.properties.data_path = 'space_data.show_manipulator' -kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS') -kmi.properties.data_path = 'space_data.pivot_point' -kmi.properties.value = 'CURSOR' -kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True) -kmi.properties.data_path = 'space_data.pivot_point' -kmi.properties.value = 'INDIVIDUAL_ORIGINS' -kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True) -kmi.properties.data_path = 'space_data.pivot_point' -kmi.properties.value = 'ACTIVE_ELEMENT' -kmi = km.items.new('transform.translate', 'G', 'PRESS', shift=True) -kmi = km.items.new('transform.translate', 'EVT_TWEAK_S', 'ANY') -kmi = km.items.new('transform.rotate', 'R', 'PRESS', shift=True) -kmi = km.items.new('transform.resize', 'S', 'PRESS', shift=True) -kmi = km.items.new('transform.warp', 'W', 'PRESS', shift=True) -kmi = km.items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True) -kmi = km.items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True) -kmi = km.items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True) -kmi = km.items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True) -kmi.properties.use = True -kmi = km.items.new('transform.mirror', 'M', 'PRESS', ctrl=True) -kmi = km.items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True) -kmi.properties.data_path = 'tool_settings.use_snap' -kmi = km.items.new('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('view3d.enable_manipulator', 'W', 'PRESS') -kmi.properties.translate = True -kmi = km.items.new('view3d.enable_manipulator', 'E', 'PRESS') -kmi.properties.rotate = True -kmi = km.items.new('view3d.enable_manipulator', 'R', 'PRESS') -kmi.properties.scale = True -kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY', shift=True) -kmi.properties.extend = True - -# Map Object Mode -km = kc.keymaps.new('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False) - -kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True) -kmi.properties.data_path = 'tool_settings.proportional_edit_falloff' -kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS') -kmi.properties.data_path = 'tool_settings.proportional_edit' -kmi.properties.value_1 = 'DISABLED' -kmi.properties.value_2 = 'ENABLED' -kmi = km.items.new('view3d.game_start', 'P', 'PRESS') -kmi = km.items.new('object.select_all', 'A', 'PRESS') -kmi = km.items.new('object.select_inverse', 'I', 'PRESS', ctrl=True) -kmi = km.items.new('object.select_linked', 'L', 'PRESS', shift=True) -kmi = km.items.new('object.select_grouped', 'G', 'PRESS', shift=True) -kmi = km.items.new('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS') -kmi.properties.direction = 'PARENT' -kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True) -kmi.properties.direction = 'PARENT' -kmi.properties.extend = True -kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS') -kmi.properties.direction = 'CHILD' -kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True) -kmi.properties.direction = 'CHILD' -kmi.properties.extend = True -kmi = km.items.new('object.parent_set', 'P', 'PRESS', ctrl=True) -kmi = km.items.new('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('object.parent_clear', 'P', 'PRESS', alt=True) -kmi = km.items.new('object.track_set', 'T', 'PRESS', ctrl=True) -kmi = km.items.new('object.track_clear', 'T', 'PRESS', alt=True) -kmi = km.items.new('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('object.location_clear', 'G', 'PRESS', alt=True) -kmi = km.items.new('object.rotation_clear', 'R', 'PRESS', alt=True) -kmi = km.items.new('object.scale_clear', 'S', 'PRESS', alt=True) -kmi = km.items.new('object.origin_clear', 'O', 'PRESS', alt=True) -kmi = km.items.new('object.hide_view_clear', 'H', 'PRESS', alt=True) -kmi = km.items.new('object.hide_view_set', 'H', 'PRESS') -kmi = km.items.new('object.hide_view_set', 'H', 'PRESS', shift=True) -kmi.properties.unselected = True -kmi = km.items.new('object.move_to_layer', 'M', 'PRESS') -kmi = km.items.new('object.delete', 'X', 'PRESS') -kmi = km.items.new('object.delete', 'DEL', 'PRESS') -kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True) -kmi.properties.name = 'INFO_MT_add' -kmi = km.items.new('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('wm.call_menu', 'A', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_object_apply' -kmi = km.items.new('wm.call_menu', 'U', 'PRESS') -kmi.properties.name = 'VIEW3D_MT_make_single_user' -kmi = km.items.new('wm.call_menu', 'L', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_make_links' -kmi = km.items.new('object.duplicate_move', 'D', 'PRESS', shift=True) -kmi = km.items.new('object.duplicate_move_linked', 'D', 'PRESS', alt=True) -kmi = km.items.new('object.join', 'J', 'PRESS', ctrl=True) -kmi = km.items.new('object.convert', 'C', 'PRESS', alt=True) -kmi = km.items.new('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('object.make_local', 'L', 'PRESS') -kmi = km.items.new('anim.keyframe_insert_menu', 'I', 'PRESS') -kmi = km.items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True) -kmi = km.items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True) -kmi = km.items.new('group.create', 'G', 'PRESS', ctrl=True) -kmi = km.items.new('group.objects_remove', 'G', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('group.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('group.objects_remove_active', 'G', 'PRESS', shift=True, alt=True) -kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_object_specials' -kmi = km.items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True) -kmi.properties.level = 0 -kmi = km.items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True) -kmi.properties.level = 1 -kmi = km.items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True) -kmi.properties.level = 2 -kmi = km.items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True) -kmi.properties.level = 3 -kmi = km.items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True) -kmi.properties.level = 4 -kmi = km.items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True) -kmi.properties.level = 5 -kmi = km.items.new('object.select_all', 'SELECTMOUSE', 'CLICK') -kmi.properties.action = 'DESELECT' - -# Map Mesh -km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False) - -kmi = km.items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True) -kmi.properties.extend = True -kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True) -kmi.properties.extend = True -kmi = km.items.new('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.select_all', 'A', 'PRESS') -kmi = km.items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.select_inverse', 'I', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True) -kmi = km.items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS') -kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True) -kmi.properties.deselect = True -kmi = km.items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True) -kmi.properties.sharpness = 135.0 -kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True) -kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_edit_mesh_selection_mode' -kmi = km.items.new('mesh.hide', 'H', 'PRESS') -kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True) -kmi.properties.unselected = True -kmi = km.items.new('mesh.reveal', 'H', 'PRESS', alt=True) -kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True) -kmi.properties.inside = True -kmi = km.items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS', ctrl=True) -kmi = km.items.new('view3d.edit_mesh_extrude_individual_move', 'E', 'PRESS', shift=True) -kmi = km.items.new('wm.call_menu', 'E', 'PRESS', alt=True) -kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude' -kmi = km.items.new('mesh.spin', 'R', 'PRESS', alt=True) -kmi = km.items.new('mesh.fill', 'F', 'PRESS', alt=True) -kmi = km.items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True) -kmi = km.items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True) -kmi = km.items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True) -kmi = km.items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True) -kmi = km.items.new('mesh.rip_move', 'V', 'PRESS') -kmi = km.items.new('mesh.merge', 'M', 'PRESS', alt=True) -kmi = km.items.new('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True) -kmi = km.items.new('mesh.edge_face_add', 'F', 'PRESS') -kmi = km.items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True) -kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True) -kmi.properties.name = 'INFO_MT_mesh_add' -kmi = km.items.new('mesh.separate', 'P', 'PRESS') -kmi = km.items.new('mesh.split', 'Y', 'PRESS') -kmi = km.items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True) -kmi = km.items.new('mesh.delete', 'X', 'PRESS') -kmi = km.items.new('mesh.delete', 'DEL', 'PRESS') -kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K') -kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K') -kmi.properties.type = 'MIDPOINTS' -kmi = km.items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True) -kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials' -kmi = km.items.new('wm.call_menu', 'F', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces' -kmi = km.items.new('wm.call_menu', 'E', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges' -kmi = km.items.new('wm.call_menu', 'V', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices' -kmi = km.items.new('wm.call_menu', 'H', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_hook' -kmi = km.items.new('wm.call_menu', 'U', 'PRESS') -kmi.properties.name = 'VIEW3D_MT_uv_map' -kmi = km.items.new('wm.call_menu', 'G', 'PRESS', ctrl=True) -kmi.properties.name = 'VIEW3D_MT_vertex_group' -kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True) -kmi.properties.data_path = 'tool_settings.proportional_edit_falloff' -kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS') -kmi.properties.data_path = 'tool_settings.proportional_edit' -kmi.properties.value_1 = 'DISABLED' -kmi.properties.value_2 = 'ENABLED' -kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True) -kmi.properties.data_path = 'tool_settings.proportional_edit' -kmi.properties.value_1 = 'DISABLED' -kmi.properties.value_2 = 'CONNECTED' -kmi = km.items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK') -kmi.properties.action = 'DESELECT' - -wm.keyconfigs.active = kc - -bpy.context.user_preferences.edit.use_drag_immediately = True -bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False -bpy.context.user_preferences.inputs.select_mouse = 'LEFT' -bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY' -bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL' -bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE' -bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py new file mode 100644 index 00000000000..8c67a4ed231 --- /dev/null +++ b/release/scripts/presets/keyconfig/maya.py @@ -0,0 +1,386 @@ +# Configuration Maya +import bpy + +wm = bpy.context.window_manager +kc = wm.keyconfigs.new('maya') + +# Map 3D View +km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False) + +kmi = km.items.new('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True) +kmi.properties.release_confirm = True +kmi = km.items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS') +kmi = km.items.new('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True) +kmi = km.items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', alt=True) +kmi = km.items.new('view3d.zoom', 'RIGHTMOUSE', 'PRESS', alt=True) +kmi = km.items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS') +kmi = km.items.new('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True) +kmi = km.items.new('view3d.fly', 'F', 'PRESS', shift=True) +kmi = km.items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True) +kmi = km.items.new('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True) +kmi = km.items.new('view3d.rotate', 'MOUSEROTATE', 'ANY') +kmi = km.items.new('view3d.move', 'TRACKPADPAN', 'ANY') +kmi = km.items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY') +kmi = km.items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS') +kmi.properties.delta = 1 +kmi = km.items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS') +kmi.properties.delta = -1 +kmi = km.items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True) +kmi.properties.delta = 1 +kmi = km.items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True) +kmi.properties.delta = -1 +kmi = km.items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS') +kmi.properties.delta = 1 +kmi = km.items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS') +kmi.properties.delta = -1 +kmi = km.items.new('view3d.view_all', 'HOME', 'PRESS') +kmi.properties.center = False +kmi = km.items.new('view3d.view_all', 'C', 'PRESS', shift=True) +kmi.properties.center = True +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS') +kmi.properties.type = 'CAMERA' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS') +kmi.properties.type = 'FRONT' +kmi = km.items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS') +kmi.properties.type = 'ORBITDOWN' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS') +kmi.properties.type = 'RIGHT' +kmi = km.items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS') +kmi.properties.type = 'ORBITLEFT' +kmi = km.items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS') +kmi = km.items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS') +kmi.properties.type = 'ORBITRIGHT' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS') +kmi.properties.type = 'TOP' +kmi = km.items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS') +kmi.properties.type = 'ORBITUP' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True) +kmi.properties.type = 'BACK' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True) +kmi.properties.type = 'LEFT' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True) +kmi.properties.type = 'BOTTOM' +kmi = km.items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True) +kmi.properties.type = 'PANDOWN' +kmi = km.items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True) +kmi.properties.type = 'PANLEFT' +kmi = km.items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True) +kmi.properties.type = 'PANRIGHT' +kmi = km.items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True) +kmi.properties.type = 'PANUP' +kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True) +kmi.properties.type = 'PANRIGHT' +kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True) +kmi.properties.type = 'PANLEFT' +kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True) +kmi.properties.type = 'PANUP' +kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True) +kmi.properties.type = 'PANDOWN' +kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True) +kmi.properties.type = 'ORBITLEFT' +kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True) +kmi.properties.type = 'ORBITRIGHT' +kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True) +kmi.properties.type = 'ORBITUP' +kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True) +kmi.properties.type = 'ORBITDOWN' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True) +kmi.properties.align_active = True +kmi.properties.type = 'FRONT' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True) +kmi.properties.align_active = True +kmi.properties.type = 'RIGHT' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True) +kmi.properties.align_active = True +kmi.properties.type = 'TOP' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True) +kmi.properties.align_active = True +kmi.properties.type = 'BACK' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True) +kmi.properties.align_active = True +kmi.properties.type = 'LEFT' +kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True) +kmi.properties.align_active = True +kmi.properties.type = 'BOTTOM' +kmi = km.items.new('view3d.localview', 'NUMPAD_SLASH', 'PRESS') +kmi = km.items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS') +kmi.properties.nr = 0 +kmi = km.items.new('view3d.layers', 'ONE', 'PRESS', any=True) +kmi.properties.nr = 1 +kmi = km.items.new('view3d.layers', 'TWO', 'PRESS', any=True) +kmi.properties.nr = 2 +kmi = km.items.new('view3d.layers', 'THREE', 'PRESS', any=True) +kmi.properties.nr = 3 +kmi = km.items.new('view3d.layers', 'FOUR', 'PRESS', any=True) +kmi.properties.nr = 4 +kmi = km.items.new('view3d.layers', 'FIVE', 'PRESS', any=True) +kmi.properties.nr = 5 +kmi = km.items.new('view3d.layers', 'SIX', 'PRESS', any=True) +kmi.properties.nr = 6 +kmi = km.items.new('view3d.layers', 'SEVEN', 'PRESS', any=True) +kmi.properties.nr = 7 +kmi = km.items.new('view3d.layers', 'EIGHT', 'PRESS', any=True) +kmi.properties.nr = 8 +kmi = km.items.new('view3d.layers', 'NINE', 'PRESS', any=True) +kmi.properties.nr = 9 +kmi = km.items.new('view3d.layers', 'ZERO', 'PRESS', any=True) +kmi.properties.nr = 10 +kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS') +kmi.properties.data_path = 'space_data.viewport_shade' +kmi.properties.value_1 = 'SOLID' +kmi.properties.value_2 = 'WIREFRAME' +kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True) +kmi.properties.data_path = 'space_data.viewport_shade' +kmi.properties.value_1 = 'TEXTURED' +kmi.properties.value_2 = 'SOLID' +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS') +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True) +kmi.properties.extend = True +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True) +kmi.properties.center = True +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True) +kmi.properties.enumerate = True +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True) +kmi.properties.center = True +kmi.properties.extend = True +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True) +kmi.properties.center = True +kmi.properties.enumerate = True +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True) +kmi.properties.enumerate = True +kmi.properties.extend = True +kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True) +kmi.properties.center = True +kmi.properties.enumerate = True +kmi.properties.extend = True +kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY') +kmi.properties.extend = False +kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True) +kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True) +kmi.properties.deselect = True +kmi = km.items.new('view3d.select_circle', 'C', 'PRESS') +kmi = km.items.new('view3d.clip_border', 'B', 'PRESS', alt=True) +kmi = km.items.new('view3d.zoom_border', 'B', 'PRESS', shift=True) +kmi = km.items.new('view3d.render_border', 'B', 'PRESS', shift=True) +kmi = km.items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True) +kmi = km.items.new('wm.call_menu', 'S', 'PRESS', shift=True) +kmi.properties.name = 'VIEW3D_MT_snap' +kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS') +kmi.properties.data_path = 'space_data.pivot_point' +kmi.properties.value = 'BOUNDING_BOX_CENTER' +kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True) +kmi.properties.data_path = 'space_data.pivot_point' +kmi.properties.value = 'MEDIAN_POINT' +kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True) +kmi.properties.data_path = 'space_data.use_pivot_point_align' +kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS') +kmi.properties.data_path = 'space_data.show_manipulator' +kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS') +kmi.properties.data_path = 'space_data.pivot_point' +kmi.properties.value = 'CURSOR' +kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True) +kmi.properties.data_path = 'space_data.pivot_point' +kmi.properties.value = 'INDIVIDUAL_ORIGINS' +kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True) +kmi.properties.data_path = 'space_data.pivot_point' +kmi.properties.value = 'ACTIVE_ELEMENT' +kmi = km.items.new('transform.translate', 'G', 'PRESS', shift=True) +kmi = km.items.new('transform.translate', 'EVT_TWEAK_S', 'ANY') +kmi = km.items.new('transform.rotate', 'R', 'PRESS', shift=True) +kmi = km.items.new('transform.resize', 'S', 'PRESS', shift=True) +kmi = km.items.new('transform.warp', 'W', 'PRESS', shift=True) +kmi = km.items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True) +kmi = km.items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True) +kmi = km.items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True) +kmi = km.items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True) +kmi.properties.use = True +kmi = km.items.new('transform.mirror', 'M', 'PRESS', ctrl=True) +kmi = km.items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True) +kmi.properties.data_path = 'tool_settings.use_snap' +kmi = km.items.new('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('view3d.enable_manipulator', 'W', 'PRESS') +kmi.properties.translate = True +kmi = km.items.new('view3d.enable_manipulator', 'E', 'PRESS') +kmi.properties.rotate = True +kmi = km.items.new('view3d.enable_manipulator', 'R', 'PRESS') +kmi.properties.scale = True +kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY', shift=True) +kmi.properties.extend = True + +# Map Object Mode +km = kc.keymaps.new('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False) + +kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True) +kmi.properties.data_path = 'tool_settings.proportional_edit_falloff' +kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS') +kmi.properties.data_path = 'tool_settings.proportional_edit' +kmi.properties.value_1 = 'DISABLED' +kmi.properties.value_2 = 'ENABLED' +kmi = km.items.new('view3d.game_start', 'P', 'PRESS') +kmi = km.items.new('object.select_all', 'A', 'PRESS') +kmi = km.items.new('object.select_inverse', 'I', 'PRESS', ctrl=True) +kmi = km.items.new('object.select_linked', 'L', 'PRESS', shift=True) +kmi = km.items.new('object.select_grouped', 'G', 'PRESS', shift=True) +kmi = km.items.new('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS') +kmi.properties.direction = 'PARENT' +kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True) +kmi.properties.direction = 'PARENT' +kmi.properties.extend = True +kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS') +kmi.properties.direction = 'CHILD' +kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True) +kmi.properties.direction = 'CHILD' +kmi.properties.extend = True +kmi = km.items.new('object.parent_set', 'P', 'PRESS', ctrl=True) +kmi = km.items.new('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('object.parent_clear', 'P', 'PRESS', alt=True) +kmi = km.items.new('object.track_set', 'T', 'PRESS', ctrl=True) +kmi = km.items.new('object.track_clear', 'T', 'PRESS', alt=True) +kmi = km.items.new('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('object.location_clear', 'G', 'PRESS', alt=True) +kmi = km.items.new('object.rotation_clear', 'R', 'PRESS', alt=True) +kmi = km.items.new('object.scale_clear', 'S', 'PRESS', alt=True) +kmi = km.items.new('object.origin_clear', 'O', 'PRESS', alt=True) +kmi = km.items.new('object.hide_view_clear', 'H', 'PRESS', alt=True) +kmi = km.items.new('object.hide_view_set', 'H', 'PRESS') +kmi = km.items.new('object.hide_view_set', 'H', 'PRESS', shift=True) +kmi.properties.unselected = True +kmi = km.items.new('object.move_to_layer', 'M', 'PRESS') +kmi = km.items.new('object.delete', 'X', 'PRESS') +kmi = km.items.new('object.delete', 'DEL', 'PRESS') +kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True) +kmi.properties.name = 'INFO_MT_add' +kmi = km.items.new('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('wm.call_menu', 'A', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_object_apply' +kmi = km.items.new('wm.call_menu', 'U', 'PRESS') +kmi.properties.name = 'VIEW3D_MT_make_single_user' +kmi = km.items.new('wm.call_menu', 'L', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_make_links' +kmi = km.items.new('object.duplicate_move', 'D', 'PRESS', shift=True) +kmi = km.items.new('object.duplicate_move_linked', 'D', 'PRESS', alt=True) +kmi = km.items.new('object.join', 'J', 'PRESS', ctrl=True) +kmi = km.items.new('object.convert', 'C', 'PRESS', alt=True) +kmi = km.items.new('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('object.make_local', 'L', 'PRESS') +kmi = km.items.new('anim.keyframe_insert_menu', 'I', 'PRESS') +kmi = km.items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True) +kmi = km.items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True) +kmi = km.items.new('group.create', 'G', 'PRESS', ctrl=True) +kmi = km.items.new('group.objects_remove', 'G', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('group.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('group.objects_remove_active', 'G', 'PRESS', shift=True, alt=True) +kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_object_specials' +kmi = km.items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True) +kmi.properties.level = 0 +kmi = km.items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True) +kmi.properties.level = 1 +kmi = km.items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True) +kmi.properties.level = 2 +kmi = km.items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True) +kmi.properties.level = 3 +kmi = km.items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True) +kmi.properties.level = 4 +kmi = km.items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True) +kmi.properties.level = 5 +kmi = km.items.new('object.select_all', 'SELECTMOUSE', 'CLICK') +kmi.properties.action = 'DESELECT' + +# Map Mesh +km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False) + +kmi = km.items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True) +kmi.properties.extend = True +kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True) +kmi.properties.extend = True +kmi = km.items.new('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.select_all', 'A', 'PRESS') +kmi = km.items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.select_inverse', 'I', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True) +kmi = km.items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS') +kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True) +kmi.properties.deselect = True +kmi = km.items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True) +kmi.properties.sharpness = 135.0 +kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True) +kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_edit_mesh_selection_mode' +kmi = km.items.new('mesh.hide', 'H', 'PRESS') +kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True) +kmi.properties.unselected = True +kmi = km.items.new('mesh.reveal', 'H', 'PRESS', alt=True) +kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True) +kmi.properties.inside = True +kmi = km.items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS', ctrl=True) +kmi = km.items.new('view3d.edit_mesh_extrude_individual_move', 'E', 'PRESS', shift=True) +kmi = km.items.new('wm.call_menu', 'E', 'PRESS', alt=True) +kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude' +kmi = km.items.new('mesh.spin', 'R', 'PRESS', alt=True) +kmi = km.items.new('mesh.fill', 'F', 'PRESS', alt=True) +kmi = km.items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True) +kmi = km.items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True) +kmi = km.items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True) +kmi = km.items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True) +kmi = km.items.new('mesh.rip_move', 'V', 'PRESS') +kmi = km.items.new('mesh.merge', 'M', 'PRESS', alt=True) +kmi = km.items.new('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True) +kmi = km.items.new('mesh.edge_face_add', 'F', 'PRESS') +kmi = km.items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True) +kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True) +kmi.properties.name = 'INFO_MT_mesh_add' +kmi = km.items.new('mesh.separate', 'P', 'PRESS') +kmi = km.items.new('mesh.split', 'Y', 'PRESS') +kmi = km.items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True) +kmi = km.items.new('mesh.delete', 'X', 'PRESS') +kmi = km.items.new('mesh.delete', 'DEL', 'PRESS') +kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K') +kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K') +kmi.properties.type = 'MIDPOINTS' +kmi = km.items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True) +kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials' +kmi = km.items.new('wm.call_menu', 'F', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces' +kmi = km.items.new('wm.call_menu', 'E', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges' +kmi = km.items.new('wm.call_menu', 'V', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices' +kmi = km.items.new('wm.call_menu', 'H', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_hook' +kmi = km.items.new('wm.call_menu', 'U', 'PRESS') +kmi.properties.name = 'VIEW3D_MT_uv_map' +kmi = km.items.new('wm.call_menu', 'G', 'PRESS', ctrl=True) +kmi.properties.name = 'VIEW3D_MT_vertex_group' +kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True) +kmi.properties.data_path = 'tool_settings.proportional_edit_falloff' +kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS') +kmi.properties.data_path = 'tool_settings.proportional_edit' +kmi.properties.value_1 = 'DISABLED' +kmi.properties.value_2 = 'ENABLED' +kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True) +kmi.properties.data_path = 'tool_settings.proportional_edit' +kmi.properties.value_1 = 'DISABLED' +kmi.properties.value_2 = 'CONNECTED' +kmi = km.items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK') +kmi.properties.action = 'DESELECT' + +wm.keyconfigs.active = kc + +bpy.context.user_preferences.edit.use_drag_immediately = True +bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False +bpy.context.user_preferences.inputs.select_mouse = 'LEFT' +bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY' +bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL' +bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE' +bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index f601b255510..40bb5bc4b55 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -127,7 +127,11 @@ class USERPREF_MT_splash(bpy.types.Menu): row.label("") row = split.row() row.label("Interaction:") - row.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_MT_interaction_presets.bl_label) + # XXX, no redraws + # text = bpy.path.display_name(context.window_manager.keyconfigs.active.name) + # if not text: + # text = "Blender (default)" + row.menu("USERPREF_MT_keyconfigs", text="Preset") class USERPREF_PT_interface(bpy.types.Panel): diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py index 0cdebd4734c..70fb2c57e9b 100644 --- a/release/scripts/ui/space_userpref_keymap.py +++ b/release/scripts/ui/space_userpref_keymap.py @@ -124,7 +124,7 @@ def _merge_keymaps(kc1, kc2): return merged_keymaps -class PREFS_MT_keyconfigs(bpy.types.Menu): +class USERPREF_MT_keyconfigs(bpy.types.Menu): bl_label = "KeyPresets" preset_subdir = "keyconfig" preset_operator = "wm.keyconfig_activate" @@ -384,7 +384,7 @@ class InputKeyMapPanel(bpy.types.Panel): text = bpy.path.display_name(context.window_manager.keyconfigs.active.name) if not text: text = "Blender (default)" - row.menu("PREFS_MT_keyconfigs", text=text) + row.menu("USERPREF_MT_keyconfigs", text=text) row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN") row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 5b7d952de77..f0962584801 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1153,7 +1153,6 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse uiStyle *style= U.uistyles.first; struct RecentFile *recent; int i; - Menu menu= {0}; MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE); char url[64]; @@ -1193,9 +1192,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse uiBlockSetEmboss(block, UI_EMBOSS); /* show the splash menu (containing interaction presets), using python */ if (mt) { + Menu menu= {0}; menu.layout= layout; menu.type= mt; mt->draw(C, &menu); + +// wmWindowManager *wm= CTX_wm_manager(C); +// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, 0); } uiBlockSetEmboss(block, UI_EMBOSSP); -- cgit v1.2.3 From 15a62013817a6775521a771b42ae15b537450d68 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 20:39:50 +0000 Subject: bugfix [#24168] verts[] was replaced with vertices[] but gives the old info to user. --- source/blender/makesrna/intern/rna_mesh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index db5a2062359..dc3cb675f7a 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -955,7 +955,7 @@ static char *rna_VertexGroupElement_path(PointerRNA *ptr) for(a=0, dvert=me->dvert; atotvert; a++, dvert++) for(b=0; btotweight; b++) if(dw == &dvert->dw[b]) - return BLI_sprintfN("verts[%d].groups[%d]", a, b); + return BLI_sprintfN("vertices[%d].groups[%d]", a, b); return NULL; } @@ -972,7 +972,7 @@ static char *rna_MeshEdge_path(PointerRNA *ptr) static char *rna_MeshVertex_path(PointerRNA *ptr) { - return BLI_sprintfN("verts[%d]", (MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert); + return BLI_sprintfN("vertices[%d]", (MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert); } static char *rna_MeshTextureFaceLayer_path(PointerRNA *ptr) -- cgit v1.2.3 From 47969866e0d2306d6e639105a0410ea18d8e3a05 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Wed, 6 Oct 2010 20:40:16 +0000 Subject: SVN maintenance. --- source/blender/collada/ArmatureExporter.cpp | 2 +- source/blender/collada/ArmatureExporter.h | 2 +- source/blender/collada/CameraExporter.cpp | 2 +- source/blender/collada/CameraExporter.h | 2 +- source/blender/collada/GeometryExporter.cpp | 2 +- source/blender/collada/GeometryExporter.h | 2 +- source/blender/collada/ImageExporter.cpp | 2 +- source/blender/collada/ImageExporter.h | 2 +- source/blender/collada/InstanceWriter.cpp | 2 +- source/blender/collada/InstanceWriter.h | 2 +- source/blender/collada/LightExporter.cpp | 2 +- source/blender/collada/LightExporter.h | 2 +- source/blender/collada/MaterialExporter.cpp | 2 +- source/blender/collada/MaterialExporter.h | 2 +- source/blender/collada/TransformWriter.cpp | 2 +- source/blender/collada/TransformWriter.h | 2 +- source/blender/collada/collada_internal.cpp | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index bf75baaf89d..255fb03da10 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index fc3864a6c0f..8d2508282bd 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index b4ccfd5d6d1..c3a6cda8b3c 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/CameraExporter.h b/source/blender/collada/CameraExporter.h index a4605b99f52..fd20c934c96 100644 --- a/source/blender/collada/CameraExporter.h +++ b/source/blender/collada/CameraExporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index b06551a97b6..1aef6e6489a 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h index 4ea3cb4efdf..7a78b676f49 100644 --- a/source/blender/collada/GeometryExporter.h +++ b/source/blender/collada/GeometryExporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 3bcce313aa5..ce40846ba59 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h index 4ee9aba2f6d..13854d00730 100644 --- a/source/blender/collada/ImageExporter.h +++ b/source/blender/collada/ImageExporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp index a3260c85f68..746f41fac00 100644 --- a/source/blender/collada/InstanceWriter.cpp +++ b/source/blender/collada/InstanceWriter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/InstanceWriter.h b/source/blender/collada/InstanceWriter.h index f7585bb20db..810bd04c7de 100644 --- a/source/blender/collada/InstanceWriter.h +++ b/source/blender/collada/InstanceWriter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index 0bedce41bc0..7327b309889 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/LightExporter.h b/source/blender/collada/LightExporter.h index 70fa88d6193..3a4a481e471 100644 --- a/source/blender/collada/LightExporter.h +++ b/source/blender/collada/LightExporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index 66ebe2d9ed8..d155b2196ff 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h index 972cd8bd8e5..2138d26e6a8 100644 --- a/source/blender/collada/MaterialExporter.h +++ b/source/blender/collada/MaterialExporter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 21260a2d4f1..a373191e773 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/TransformWriter.h b/source/blender/collada/TransformWriter.h index 29aef721afb..054a28c08a1 100644 --- a/source/blender/collada/TransformWriter.h +++ b/source/blender/collada/TransformWriter.h @@ -1,5 +1,5 @@ /** - * $Id: DocumentExporter.cpp 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index cfa94e60199..67ee4818f7e 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -1,5 +1,5 @@ /** - * $Id: collada_internal.h 32309 2010-10-05 00:05:14Z jesterking $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From 2ef0d5e13460fb231857697226b85d19a893c9ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 21:54:30 +0000 Subject: remove calls to WM_event_add_mousemove r22031, from view2d operators since it would cause a feedback loop where the operator apply function would keep using mousemove events and creating them. This was added for view updates but think it needs to be solved a better way. --- source/blender/editors/interface/view2d_ops.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index de1b26e987b..e10f0f20938 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -146,7 +146,6 @@ static void view_pan_apply(bContext *C, wmOperator *op) ED_region_tag_redraw(vpd->ar); UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY); - WM_event_add_mousemove(C); /* exceptions */ if (vpd->sa->spacetype==SPACE_OUTLINER) { @@ -628,7 +627,6 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) /* request updates to be done... */ ED_region_tag_redraw(vzd->ar); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); - WM_event_add_mousemove(C); } /* --------------- Individual Operators ------------------- */ @@ -822,7 +820,6 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) /* request updates to be done... */ ED_region_tag_redraw(vzd->ar); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); - WM_event_add_mousemove(C); } /* cleanup temp customdata */ @@ -1095,7 +1092,6 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) /* request updates to be done... */ ED_region_tag_redraw(ar); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); - WM_event_add_mousemove(C); return OPERATOR_FINISHED; } @@ -1355,7 +1351,6 @@ static void scroller_activate_apply(bContext *C, wmOperator *op) /* request updates to be done... */ ED_region_tag_redraw(vsm->ar); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); - WM_event_add_mousemove(C); } /* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */ @@ -1560,7 +1555,6 @@ static int reset_exec(bContext *C, wmOperator *op) /* request updates to be done... */ ED_region_tag_redraw(ar); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); - WM_event_add_mousemove(C); return OPERATOR_FINISHED; } -- cgit v1.2.3 From 8bb75bb5b6bc77cbc1e43b51a9cce9e2b9cd86eb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Oct 2010 22:29:34 +0000 Subject: bugfix [#24155] Operator Cheat Sheet doesn't work properly --- release/scripts/modules/bpy/ops.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index 7a824ce2e68..ba56fa12fe1 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -182,8 +182,15 @@ class bpy_ops_submodule_op(object): import bpy idname = self.idname() as_string = op_as_string(idname) - descr = getattr(bpy.types, idname).bl_rna.description - return as_string + "\n" + descr + op_class = getattr(bpy.types, idname) + descr = op_class.bl_rna.description + # XXX, workaround for not registering every __doc__ to save time on load. + if not descr: + descr = op_class.__doc__ + if not descr: + descr = "" + + return "# %s\n%s" % (descr, as_string) def __str__(self): # used for print(...) return "" % \ -- cgit v1.2.3 From 942d5dd804d27b67517e566a0d52dc466b3b247f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Oct 2010 00:14:21 +0000 Subject: bugfix [#24158] Object text fields immediately search based on existing content also remove some unused struct members from uiBlock/uiBut. --- source/blender/editors/include/UI_interface.h | 9 +++++---- source/blender/editors/interface/interface.c | 4 ++-- .../blender/editors/interface/interface_handlers.c | 1 + source/blender/editors/interface/interface_intern.h | 20 ++++++++++---------- source/blender/editors/interface/interface_layout.c | 3 ++- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 54a627da2da..4689153c9f5 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -77,17 +77,18 @@ typedef struct uiLayout uiLayout; #define UI_EMBOSST 3 /* Table */ /* uiBlock->direction */ +#define UI_DIRECTION (UI_TOP|UI_DOWN|UI_LEFT|UI_RIGHT) #define UI_TOP 1 #define UI_DOWN 2 #define UI_LEFT 4 #define UI_RIGHT 8 -#define UI_DIRECTION 15 + #define UI_CENTER 16 #define UI_SHIFT_FLIPPED 32 /* uiBlock->autofill (not yet used) */ -#define UI_BLOCK_COLLUMNS 1 -#define UI_BLOCK_ROWS 2 +// #define UI_BLOCK_COLLUMNS 1 +// #define UI_BLOCK_ROWS 2 /* uiBlock->flag (controls) */ #define UI_BLOCK_LOOP 1 @@ -316,7 +317,7 @@ void uiDrawBlock(const struct bContext *C, struct uiBlock *block); uiBlock *uiGetBlock(char *name, struct ARegion *ar); -void uiBlockSetEmboss(uiBlock *block, short dt); +void uiBlockSetEmboss(uiBlock *block, char dt); void uiFreeBlock(const struct bContext *C, uiBlock *block); void uiFreeBlocks(const struct bContext *C, struct ListBase *lb); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b7ec5565d80..f4866237f46 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -937,7 +937,7 @@ void uiComposeLinks(uiBlock *block) void uiBlockSetButLock(uiBlock *block, int val, char *lockstr) { if(val) { - block->lock |= val; + block->lock= val ? 1:0; block->lockstr= lockstr; } } @@ -1947,7 +1947,7 @@ uiBlock *uiGetBlock(char *name, ARegion *ar) return NULL; } -void uiBlockSetEmboss(uiBlock *block, short dt) +void uiBlockSetEmboss(uiBlock *block, char dt) { block->dt= dt; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c789c721aea..6d8c368db3f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1816,6 +1816,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle /* only update when typing for TAB key */ if(update && data->interactive) ui_apply_button(C, block, but, data, 1); else ui_check_but(but); + but->changed= TRUE; if(data->searchbox) ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 3873c5c9092..eb28df54b13 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -206,10 +206,11 @@ struct uiBut { char *tip, *lockstr; BIFIconID icon; - short but_align; /* aligning buttons, horiz/vertical */ - short lock; + char lock; + char dt; + short changed; /* could be made into a single flag */ short modifier_key; - short iconadd, dt; + short iconadd; /* IDPOIN data */ uiIDPoinFuncFP idpoin_func; @@ -296,13 +297,14 @@ struct uiBlock { void *drawextra_arg1; void *drawextra_arg2; - int afterval, flag; - - short direction, dt; - short auto_open, in_use; + int flag; + char direction, dt; + short auto_open; double auto_open_last; - int lock; + char active; // to keep blocks while drawing and free them afterwards + char tooltipdisabled; // to avoid tooltip after click + short lock; char *lockstr; float xofs, yofs; // offset to parent button @@ -314,9 +316,7 @@ struct uiBlock { ListBase saferct; // uiSafetyRct list uiPopupBlockHandle *handle; // handle - int tooltipdisabled; // to avoid tooltip after click - int active; // to keep blocks while drawing and free them afterwards int puphash; // popup menu hash for memory int color_profile; // color profile for correcting linear colors for display diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e268120fa07..4a9d7a0f6f3 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1109,6 +1109,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop); ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list"); CollItemSearch *cis; + const int skip_filter= !but->changed; /* build a temporary list of relevant items first */ RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) { @@ -1140,7 +1141,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui } if(name) { - if(BLI_strcasestr(name, str)) { + if(skip_filter || BLI_strcasestr(name, str)) { cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); cis->name = MEM_dupallocN(name); cis->index = i; -- cgit v1.2.3 From c139faf171e81b81ac0bf29fd27089ac75f8ce89 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 7 Oct 2010 00:24:42 +0000 Subject: COLLADA: Split EffectsExporter into separate files. --- source/blender/collada/DocumentExporter.cpp | 272 +------------------------ source/blender/collada/EffectExporter.cpp | 306 ++++++++++++++++++++++++++++ source/blender/collada/EffectExporter.h | 62 ++++++ 3 files changed, 369 insertions(+), 271 deletions(-) create mode 100644 source/blender/collada/EffectExporter.cpp create mode 100644 source/blender/collada/EffectExporter.h diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 9bf84c7e606..cbcb3984018 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -108,6 +108,7 @@ extern char build_rev[]; #include "ArmatureExporter.h" #include "CameraExporter.h" +#include "EffectExporter.h" #include "GeometryExporter.h" #include "ImageExporter.h" #include "LightExporter.h" @@ -155,18 +156,6 @@ void forEachObjectInScene(Scene *sce, Functor &f) -// OB_MESH is assumed -std::string getActiveUVLayerName(Object *ob) -{ - Mesh *me = (Mesh*)ob->data; - - int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); - if (num_layers) - return std::string(bc_CustomData_get_active_layer_name(&me->fdata, CD_MTFACE)); - - return ""; -} - class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter, protected InstanceWriter { ArmatureExporter *arm_exporter; @@ -299,265 +288,6 @@ public: } }; -class EffectsExporter: COLLADASW::LibraryEffects -{ -public: - EffectsExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryEffects(sw){} - void exportEffects(Scene *sce) - { - openLibrary(); - MaterialFunctor mf; - mf.forEachMaterialInScene(sce, *this); - - closeLibrary(); - } - - void operator()(Material *ma, Object *ob) - { - // create a list of indices to textures of type TEX_IMAGE - std::vector tex_indices; - createTextureIndices(ma, tex_indices); - - openEffect(translate_id(id_name(ma)) + "-effect"); - - COLLADASW::EffectProfile ep(mSW); - ep.setProfileType(COLLADASW::EffectProfile::COMMON); - ep.openProfile(); - // set shader type - one of three blinn, phong or lambert - if (ma->spec_shader == MA_SPEC_BLINN) { - ep.setShaderType(COLLADASW::EffectProfile::BLINN); - // shininess - ep.setShininess(ma->har); - } - else if (ma->spec_shader == MA_SPEC_PHONG) { - ep.setShaderType(COLLADASW::EffectProfile::PHONG); - // shininess - ep.setShininess(ma->har); - } - else { - // XXX write warning "Current shader type is not supported" - ep.setShaderType(COLLADASW::EffectProfile::LAMBERT); - } - // index of refraction - if (ma->mode & MA_RAYTRANSP) { - ep.setIndexOfRefraction(ma->ang); - } - else { - ep.setIndexOfRefraction(1.0f); - } - - COLLADASW::ColorOrTexture cot; - - // transparency - if (ma->mode & MA_TRANSP) { - // Tod: because we are in A_ONE mode transparency is calculated like this: - ep.setTransparency(ma->alpha); - // cot = getcol(1.0f, 1.0f, 1.0f, 1.0f); - // ep.setTransparent(cot); - } - - // emission - cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f); - ep.setEmission(cot); - - // diffuse multiplied by diffuse intensity - cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f); - ep.setDiffuse(cot); - - // ambient - cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f); - ep.setAmbient(cot); - - // reflective, reflectivity - if (ma->mode & MA_RAYMIRROR) { - cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f); - ep.setReflective(cot); - ep.setReflectivity(ma->ray_mirror); - } - // else { - // cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f); - // ep.setReflective(cot); - // ep.setReflectivity(ma->spec); - // } - - // specular - if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) { - cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f); - ep.setSpecular(cot); - } - - // XXX make this more readable if possible - - // create and for each image - COLLADASW::Sampler samplers[MAX_MTEX]; - //COLLADASW::Surface surfaces[MAX_MTEX]; - //void *samp_surf[MAX_MTEX][2]; - void *samp_surf[MAX_MTEX][1]; - - // image to index to samp_surf map - // samp_surf[index] stores 2 pointers, sampler and surface - std::map im_samp_map; - - unsigned int a, b; - for (a = 0, b = 0; a < tex_indices.size(); a++) { - MTex *t = ma->mtex[tex_indices[a]]; - Image *ima = t->tex->ima; - - // Image not set for texture - if(!ima) continue; - - std::string key(id_name(ima)); - key = translate_id(key); - - // create only one / pair for each unique image - if (im_samp_map.find(key) == im_samp_map.end()) { - // // - // COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D, - // key + COLLADASW::Surface::SURFACE_SID_SUFFIX); - // COLLADASW::SurfaceInitOption sio(COLLADASW::SurfaceInitOption::INIT_FROM); - // sio.setImageReference(key); - // surface.setInitOption(sio); - - // COLLADASW::NewParamSurface surface(mSW); - // surface->setParamType(COLLADASW::CSW_SURFACE_TYPE_2D); - - // - COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D, - key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX, - key + COLLADASW::Sampler::SURFACE_SID_SUFFIX); - sampler.setImageId(key); - // copy values to arrays since they will live longer - samplers[a] = sampler; - //surfaces[a] = surface; - - // store pointers so they can be used later when we create s - samp_surf[b][0] = &samplers[a]; - //samp_surf[b][1] = &surfaces[a]; - - im_samp_map[key] = b; - b++; - } - } - - // used as fallback when MTex->uvname is "" (this is pretty common) - // it is indeed the correct value to use in that case - std::string active_uv(getActiveUVLayerName(ob)); - - // write textures - // XXX very slow - for (a = 0; a < tex_indices.size(); a++) { - MTex *t = ma->mtex[tex_indices[a]]; - Image *ima = t->tex->ima; - - // Image not set for texture - if(!ima) continue; - - // we assume map input is always TEXCO_UV - - std::string key(id_name(ima)); - key = translate_id(key); - int i = im_samp_map[key]; - COLLADASW::Sampler *sampler = (COLLADASW::Sampler*)samp_surf[i][0]; - //COLLADASW::Surface *surface = (COLLADASW::Surface*)samp_surf[i][1]; - - std::string uvname = strlen(t->uvname) ? t->uvname : active_uv; - - // color - if (t->mapto & MAP_COL) { - ep.setDiffuse(createTexture(ima, uvname, sampler)); - } - // ambient - if (t->mapto & MAP_AMB) { - ep.setAmbient(createTexture(ima, uvname, sampler)); - } - // specular - if (t->mapto & MAP_SPEC) { - ep.setSpecular(createTexture(ima, uvname, sampler)); - } - // emission - if (t->mapto & MAP_EMIT) { - ep.setEmission(createTexture(ima, uvname, sampler)); - } - // reflective - if (t->mapto & MAP_REF) { - ep.setReflective(createTexture(ima, uvname, sampler)); - } - // alpha - if (t->mapto & MAP_ALPHA) { - ep.setTransparent(createTexture(ima, uvname, sampler)); - } - // extension: - // Normal map --> Must be stored with tag as different technique, - // since COLLADA doesn't support normal maps, even in current COLLADA 1.5. - if (t->mapto & MAP_NORM) { - COLLADASW::Texture texture(key); - texture.setTexcoord(uvname); - texture.setSampler(*sampler); - // technique FCOLLADA, with the tag, is most likely the best understood, - // most widespread de-facto standard. - texture.setProfileName("FCOLLADA"); - texture.setChildElementName("bump"); - ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture)); - } - } - // performs the actual writing - ep.addProfileElements(); - bool twoSided = false; - if (ob->type == OB_MESH && ob->data) { - Mesh *me = (Mesh*)ob->data; - if (me->flag & ME_TWOSIDED) - twoSided = true; - } - if (twoSided) - ep.addExtraTechniqueParameter("GOOGLEEARTH", "show_double_sided", 1); - ep.addExtraTechniques(mSW); - - ep.closeProfile(); - if (twoSided) - mSW->appendTextBlock("1"); - closeEffect(); - } - - COLLADASW::ColorOrTexture createTexture(Image *ima, - std::string& uv_layer_name, - COLLADASW::Sampler *sampler - /*COLLADASW::Surface *surface*/) - { - - COLLADASW::Texture texture(translate_id(id_name(ima))); - texture.setTexcoord(uv_layer_name); - //texture.setSurface(*surface); - texture.setSampler(*sampler); - - COLLADASW::ColorOrTexture cot(texture); - return cot; - } - - COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a) - { - COLLADASW::Color color(r,g,b,a); - COLLADASW::ColorOrTexture cot(color); - return cot; - } - - //returns the array of mtex indices which have image - //need this for exporting textures - void createTextureIndices(Material *ma, std::vector &indices) - { - indices.clear(); - - for (int a = 0; a < MAX_MTEX; a++) { - if (ma->mtex[a] && - ma->mtex[a]->tex && - ma->mtex[a]->tex->type == TEX_IMAGE && - ma->mtex[a]->texco == TEXCO_UV){ - indices.push_back(a); - } - } - } -}; - - // TODO: it would be better to instantiate animations rather than create a new one per object // COLLADA allows this through multiple s in . // For this to work, we need to know objects that use a certain action. diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp new file mode 100644 index 00000000000..af6fa09a25b --- /dev/null +++ b/source/blender/collada/EffectExporter.cpp @@ -0,0 +1,306 @@ +/** + * $Id: LightExporter.h 32355 2010-10-06 20:40:16Z gsrb3d $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "COLLADASWEffectProfile.h" + +#include "EffectExporter.h" +#include "MaterialExporter.h" + +#include "DNA_mesh_types.h" +#include "DNA_texture_types.h" + +#include "BKE_customdata.h" + +#include "collada_internal.h" +#include "collada_utils.h" + +// OB_MESH is assumed +static std::string getActiveUVLayerName(Object *ob) +{ + Mesh *me = (Mesh*)ob->data; + + int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE); + if (num_layers) + return std::string(bc_CustomData_get_active_layer_name(&me->fdata, CD_MTFACE)); + + return ""; +} + + +EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryEffects(sw){} +void EffectsExporter::exportEffects(Scene *sce) +{ + openLibrary(); + MaterialFunctor mf; + mf.forEachMaterialInScene(sce, *this); + + closeLibrary(); +} + +void EffectsExporter::operator()(Material *ma, Object *ob) +{ + // create a list of indices to textures of type TEX_IMAGE + std::vector tex_indices; + createTextureIndices(ma, tex_indices); + + openEffect(translate_id(id_name(ma)) + "-effect"); + + COLLADASW::EffectProfile ep(mSW); + ep.setProfileType(COLLADASW::EffectProfile::COMMON); + ep.openProfile(); + // set shader type - one of three blinn, phong or lambert + if (ma->spec_shader == MA_SPEC_BLINN) { + ep.setShaderType(COLLADASW::EffectProfile::BLINN); + // shininess + ep.setShininess(ma->har); + } + else if (ma->spec_shader == MA_SPEC_PHONG) { + ep.setShaderType(COLLADASW::EffectProfile::PHONG); + // shininess + ep.setShininess(ma->har); + } + else { + // XXX write warning "Current shader type is not supported" + ep.setShaderType(COLLADASW::EffectProfile::LAMBERT); + } + // index of refraction + if (ma->mode & MA_RAYTRANSP) { + ep.setIndexOfRefraction(ma->ang); + } + else { + ep.setIndexOfRefraction(1.0f); + } + + COLLADASW::ColorOrTexture cot; + + // transparency + if (ma->mode & MA_TRANSP) { + // Tod: because we are in A_ONE mode transparency is calculated like this: + ep.setTransparency(ma->alpha); + // cot = getcol(1.0f, 1.0f, 1.0f, 1.0f); + // ep.setTransparent(cot); + } + + // emission + cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f); + ep.setEmission(cot); + + // diffuse multiplied by diffuse intensity + cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f); + ep.setDiffuse(cot); + + // ambient + cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f); + ep.setAmbient(cot); + + // reflective, reflectivity + if (ma->mode & MA_RAYMIRROR) { + cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f); + ep.setReflective(cot); + ep.setReflectivity(ma->ray_mirror); + } + // else { + // cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f); + // ep.setReflective(cot); + // ep.setReflectivity(ma->spec); + // } + + // specular + if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) { + cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f); + ep.setSpecular(cot); + } + + // XXX make this more readable if possible + + // create and for each image + COLLADASW::Sampler samplers[MAX_MTEX]; + //COLLADASW::Surface surfaces[MAX_MTEX]; + //void *samp_surf[MAX_MTEX][2]; + void *samp_surf[MAX_MTEX][1]; + + // image to index to samp_surf map + // samp_surf[index] stores 2 pointers, sampler and surface + std::map im_samp_map; + + unsigned int a, b; + for (a = 0, b = 0; a < tex_indices.size(); a++) { + MTex *t = ma->mtex[tex_indices[a]]; + Image *ima = t->tex->ima; + + // Image not set for texture + if(!ima) continue; + + std::string key(id_name(ima)); + key = translate_id(key); + + // create only one / pair for each unique image + if (im_samp_map.find(key) == im_samp_map.end()) { + // // + // COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D, + // key + COLLADASW::Surface::SURFACE_SID_SUFFIX); + // COLLADASW::SurfaceInitOption sio(COLLADASW::SurfaceInitOption::INIT_FROM); + // sio.setImageReference(key); + // surface.setInitOption(sio); + + // COLLADASW::NewParamSurface surface(mSW); + // surface->setParamType(COLLADASW::CSW_SURFACE_TYPE_2D); + + // + COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D, + key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX, + key + COLLADASW::Sampler::SURFACE_SID_SUFFIX); + sampler.setImageId(key); + // copy values to arrays since they will live longer + samplers[a] = sampler; + //surfaces[a] = surface; + + // store pointers so they can be used later when we create s + samp_surf[b][0] = &samplers[a]; + //samp_surf[b][1] = &surfaces[a]; + + im_samp_map[key] = b; + b++; + } + } + + // used as fallback when MTex->uvname is "" (this is pretty common) + // it is indeed the correct value to use in that case + std::string active_uv(getActiveUVLayerName(ob)); + + // write textures + // XXX very slow + for (a = 0; a < tex_indices.size(); a++) { + MTex *t = ma->mtex[tex_indices[a]]; + Image *ima = t->tex->ima; + + // Image not set for texture + if(!ima) continue; + + // we assume map input is always TEXCO_UV + + std::string key(id_name(ima)); + key = translate_id(key); + int i = im_samp_map[key]; + COLLADASW::Sampler *sampler = (COLLADASW::Sampler*)samp_surf[i][0]; + //COLLADASW::Surface *surface = (COLLADASW::Surface*)samp_surf[i][1]; + + std::string uvname = strlen(t->uvname) ? t->uvname : active_uv; + + // color + if (t->mapto & MAP_COL) { + ep.setDiffuse(createTexture(ima, uvname, sampler)); + } + // ambient + if (t->mapto & MAP_AMB) { + ep.setAmbient(createTexture(ima, uvname, sampler)); + } + // specular + if (t->mapto & MAP_SPEC) { + ep.setSpecular(createTexture(ima, uvname, sampler)); + } + // emission + if (t->mapto & MAP_EMIT) { + ep.setEmission(createTexture(ima, uvname, sampler)); + } + // reflective + if (t->mapto & MAP_REF) { + ep.setReflective(createTexture(ima, uvname, sampler)); + } + // alpha + if (t->mapto & MAP_ALPHA) { + ep.setTransparent(createTexture(ima, uvname, sampler)); + } + // extension: + // Normal map --> Must be stored with tag as different technique, + // since COLLADA doesn't support normal maps, even in current COLLADA 1.5. + if (t->mapto & MAP_NORM) { + COLLADASW::Texture texture(key); + texture.setTexcoord(uvname); + texture.setSampler(*sampler); + // technique FCOLLADA, with the tag, is most likely the best understood, + // most widespread de-facto standard. + texture.setProfileName("FCOLLADA"); + texture.setChildElementName("bump"); + ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture)); + } + } + // performs the actual writing + ep.addProfileElements(); + bool twoSided = false; + if (ob->type == OB_MESH && ob->data) { + Mesh *me = (Mesh*)ob->data; + if (me->flag & ME_TWOSIDED) + twoSided = true; + } + if (twoSided) + ep.addExtraTechniqueParameter("GOOGLEEARTH", "show_double_sided", 1); + ep.addExtraTechniques(mSW); + + ep.closeProfile(); + if (twoSided) + mSW->appendTextBlock("1"); + closeEffect(); +} + +COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima, + std::string& uv_layer_name, + COLLADASW::Sampler *sampler + /*COLLADASW::Surface *surface*/) +{ + + COLLADASW::Texture texture(translate_id(id_name(ima))); + texture.setTexcoord(uv_layer_name); + //texture.setSurface(*surface); + texture.setSampler(*sampler); + + COLLADASW::ColorOrTexture cot(texture); + return cot; +} + +COLLADASW::ColorOrTexture EffectsExporter::getcol(float r, float g, float b, float a) +{ + COLLADASW::Color color(r,g,b,a); + COLLADASW::ColorOrTexture cot(color); + return cot; +} + +//returns the array of mtex indices which have image +//need this for exporting textures +void EffectsExporter::createTextureIndices(Material *ma, std::vector &indices) +{ + indices.clear(); + + for (int a = 0; a < MAX_MTEX; a++) { + if (ma->mtex[a] && + ma->mtex[a]->tex && + ma->mtex[a]->tex->type == TEX_IMAGE && + ma->mtex[a]->texco == TEXCO_UV){ + indices.push_back(a); + } + } +} diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h new file mode 100644 index 00000000000..ecd5d9a3c16 --- /dev/null +++ b/source/blender/collada/EffectExporter.h @@ -0,0 +1,62 @@ +/** + * $Id: LightExporter.h 32355 2010-10-06 20:40:16Z gsrb3d $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed, + * Nathan Letwory + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __EFFECTEXPORTER_H__ +#define __EFFECTEXPORTER_H__ + +#include +#include + +#include "COLLADASWColorOrTexture.h" +#include "COLLADASWStreamWriter.h" +#include "COLLADASWSampler.h" +#include "COLLADASWLibraryEffects.h" + +#include "DNA_image_types.h" +#include "DNA_material_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +class EffectsExporter: COLLADASW::LibraryEffects +{ +public: + EffectsExporter(COLLADASW::StreamWriter *sw); + void exportEffects(Scene *sce); + + void operator()(Material *ma, Object *ob); + + COLLADASW::ColorOrTexture createTexture(Image *ima, + std::string& uv_layer_name, + COLLADASW::Sampler *sampler + /*COLLADASW::Surface *surface*/); + + COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a); + + //returns the array of mtex indices which have image + //need this for exporting textures + void createTextureIndices(Material *ma, std::vector &indices); +}; + +#endif -- cgit v1.2.3 From c9453b1357dcb878dff6efc9dd3597452d6dc762 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Thu, 7 Oct 2010 01:20:59 +0000 Subject: SVN maintenance. --- source/blender/collada/EffectExporter.cpp | 2 +- source/blender/collada/EffectExporter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index af6fa09a25b..45b6450e444 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -1,5 +1,5 @@ /** - * $Id: LightExporter.h 32355 2010-10-06 20:40:16Z gsrb3d $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h index ecd5d9a3c16..e8f8754b20a 100644 --- a/source/blender/collada/EffectExporter.h +++ b/source/blender/collada/EffectExporter.h @@ -1,5 +1,5 @@ /** - * $Id: LightExporter.h 32355 2010-10-06 20:40:16Z gsrb3d $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From 8a4fe62843f8aa311226f543d14bd3e5440ffe7d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Oct 2010 10:04:07 +0000 Subject: misc fixes found with clang's static checker. --- source/blender/blenkernel/intern/anim.c | 2 +- source/blender/blenkernel/intern/library.c | 9 ++++---- source/blender/blenkernel/intern/modifier.c | 4 ++-- source/blender/blenkernel/intern/pointcache.c | 2 +- source/blender/blenlib/intern/math_color.c | 5 +++++ source/blender/editors/curve/editcurve.c | 8 ++++---- source/blender/editors/interface/interface_icons.c | 24 +++++++++++++++------- .../blender/editors/interface/interface_regions.c | 2 +- source/blender/editors/space_logic/logic_window.c | 6 +++--- .../editors/space_sequencer/sequencer_edit.c | 2 +- source/blender/editors/space_view3d/drawmesh.c | 13 ++++++------ source/blender/editors/space_view3d/drawobject.c | 4 +++- source/blender/editors/space_view3d/view3d_edit.c | 5 +---- source/blender/editors/transform/transform_snap.c | 4 ++++ source/blender/gpu/intern/gpu_material.c | 2 +- source/blender/imbuf/intern/thumbs_blend.c | 2 +- .../blender/render/intern/source/convertblender.c | 6 +++--- 17 files changed, 59 insertions(+), 41 deletions(-) diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 6da9f2bbabc..b2feb01352e 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -648,7 +648,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat, totfac= data[1]+data[2]; if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac); - else QUATCOPY(q1, p3->quat); + else QUATCOPY(q2, p3->quat); totfac = data[0]+data[1]+data[2]+data[3]; if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 834e7de5811..93e4b5fcfbe 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "MEM_guardedalloc.h" @@ -649,11 +650,9 @@ void *copy_libblock(void *rt) lb= which_libbase(G.main, GS(id->name)); idn= alloc_libblock(lb, GS(id->name), id->name+2); - - if(idn==NULL) { - printf("ERROR: Illegal ID name for %s (Crashing now)\n", id->name); - } - + + assert(idn != NULL); + idn_len= MEM_allocN_len(idn); if(idn_len - sizeof(ID) > 0) { cp= (char *)id; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 43d26f26d1f..d7c95a007e5 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -63,8 +63,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) types_init= 0; } - if(type >= 0 && type < NUM_MODIFIER_TYPES && - types[type]->name[0] != '\0') { + /* type unsigned, no need to chech < 0 */ + if(type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') { return types[type]; } else { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 4ec12b3482c..a15e66ed843 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1082,7 +1082,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup static int ptcache_path(PTCacheID *pid, char *filename) { - Library *lib= (pid)? pid->ob->id.lib: NULL; + Library *lib= (pid->ob)? pid->ob->id.lib: NULL; const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce; size_t i; diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 2b6a091cc8d..f0ef8b2c93d 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -25,6 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** * */ +#include #include "BLI_math.h" @@ -133,6 +134,8 @@ void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, in cb=(-0.16874f*sr)-(0.33126f*sg)+(0.5f*sb)+128.0f; cr=(0.5f*sr)-(0.41869f*sg)-(0.08131f*sb)+128.0f; break; + default: + assert(!"invalid colorspace"); } *ly=y; @@ -163,6 +166,8 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in g=y-0.34414f*cb - 0.71414f*cr + 135.45984f; b=y+1.772f*cb - 226.816f; break; + default: + assert(!"invalid colorspace"); } *lr=r/255.0f; *lg=g/255.0f; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 6193b6eb916..4c869d25869 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -732,7 +732,7 @@ static void calc_shapeKeys(Object *obedit) int totvert= count_curveverts(&editnurb->nurbs); float (*ofs)[3] = NULL; - float *oldkey, *newkey, *fp, *ofp; + float *oldkey, *newkey, *ofp; /* editing the base key should update others */ if(cu->key->type==KEY_RELATIVE) { @@ -776,7 +776,7 @@ static void calc_shapeKeys(Object *obedit) for (j= 0; j < 3; ++j) { VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]); i++; - fp+= 3; + // fp+= 3; // unused } ofs[i++][0]= bezt->alfa - oldbezt->alfa; } else { @@ -796,7 +796,7 @@ static void calc_shapeKeys(Object *obedit) } i += 2; ++bp; - fp += 4; + // fp += 4; //unused } } @@ -809,7 +809,7 @@ static void calc_shapeKeys(Object *obedit) while(currkey) { int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative)); - fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data"); + float *fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data"); ofp= oldkey = currkey->data; nu= editnurb->nurbs.first; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 482eece42f6..3fa53b73015 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -622,20 +622,30 @@ static void init_iconfile_list(struct ListBase *list) char *filename = dir[i].relname; if(BLI_testextensie(filename, ".png")) { - + /* check to see if the image is the right size, continue if not */ /* copying strings here should go ok, assuming that we never get back a complete path to file longer than 256 chars */ sprintf(iconfilestr, "%s/%s", icondirstr, filename); - if(BLI_exists(iconfilestr)) bbuf = IMB_loadiffname(iconfilestr, IB_rect); - - ifilex = bbuf->x; - ifiley = bbuf->y; - IMB_freeImBuf(bbuf); + if(BLI_exists(iconfilestr)) + bbuf= IMB_loadiffname(iconfilestr, IB_rect); + else + bbuf= NULL; + + + if(bbuf) { + ifilex = bbuf->x; + ifiley = bbuf->y; + IMB_freeImBuf(bbuf); + } + else { + ifilex= ifiley= 0; + } + /* bad size or failed to load */ if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H)) continue; - + /* found a potential icon file, so make an entry for it in the cache list */ ifile = MEM_callocN(sizeof(IconFile), "IconFile"); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index ff079a4b9e0..53981f202ed 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1008,7 +1008,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) x2= winx; } } - if(y1 < 0) { + if(y1 < 0) { /* XXX butregion NULL check?, there is one above */ int newy1; UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, 0, &newy1); newy1 += butregion->winrct.ymin; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 4b778e80b0e..148bcf1459f 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3712,7 +3712,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) break; case ACT_ARM_ENABLE: case ACT_ARM_DISABLE: - if (&pose_ptr.data) { + if (ob->pose) { uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) @@ -3720,7 +3720,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) } break; case ACT_ARM_SETTARGET: - if (&pose_ptr.data) { + if (ob->pose) { uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) @@ -3731,7 +3731,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) uiItemR(layout, ptr, "secondary_target", 0, NULL, 0); break; case ACT_ARM_SETWEIGHT: - if (&pose_ptr.data) { + if (ob->pose) { uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 84ced036f75..d96b8a27c99 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -159,7 +159,7 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect struct SeqEffectHandle sh; Sequence *last_seq= seq_active_get(scene); - if(last_seq && last_seq->type != SEQ_PLUGIN) return; + if(last_seq==NULL || last_seq->type != SEQ_PLUGIN) return; sh = get_sequence_effect(last_seq); sh.free(last_seq); diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 7a7462433d7..cf511a8ad9b 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -536,12 +536,13 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index) static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) { Mesh *me = (Mesh*)userData; - MTFace *tface = (me->mtface)? &me->mtface[index]: NULL; - MFace *mface = (me->mface)? &me->mface[index]: NULL; - - if ((mface->flag&ME_HIDE) || (tface && (tface->mode&TF_INVISIBLE))) - return 0; - + + if ( (me->mface && me->mface[index].flag & ME_HIDE) || + (me->mtface && (me->mtface[index].mode & TF_INVISIBLE)) + ) { + return 0; + } + *drawSmooth_r = 1; return 1; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index aba3d04d960..d28813f7522 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -917,6 +917,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, copy_m4_m4(imat, rv3d->viewinv); normalize_v3(imat[0]); normalize_v3(imat[1]); + + /* lamp center */ + copy_v3_v3(vec, ob->obmat[3]); /* for AA effects */ glGetFloatv(GL_CURRENT_COLOR, curcol); @@ -931,7 +934,6 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } /* Inner Circle */ - copy_v3_v3(vec, ob->obmat[3]); glEnable(GL_BLEND); drawcircball(GL_LINE_LOOP, vec, lampsize, imat); glDisable(GL_BLEND); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 4cac0e297d1..9f1b55ee2ce 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2121,14 +2121,11 @@ static int viewpan_exec(bContext *C, wmOperator *op) pandir = RNA_enum_get(op->ptr, "type"); initgrabz(rv3d, 0.0, 0.0, 0.0); - if(pandir == V3D_VIEW_PANRIGHT) window_to_3d_delta(ar, vec, -32, 0); else if(pandir == V3D_VIEW_PANLEFT) window_to_3d_delta(ar, vec, 32, 0); else if(pandir == V3D_VIEW_PANUP) window_to_3d_delta(ar, vec, 0, -25); else if(pandir == V3D_VIEW_PANDOWN) window_to_3d_delta(ar, vec, 0, 25); - rv3d->ofs[0]+= vec[0]; - rv3d->ofs[1]+= vec[1]; - rv3d->ofs[2]+= vec[2]; + add_v3_v3(rv3d->ofs, vec); if(rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(CTX_wm_area(C), ar); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 93331dd0ee3..5b7bcac65f2 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -784,6 +784,10 @@ void CalcSnapGeometry(TransInfo *t, float *vec) if (dist != FLT_MAX) { VECCOPY(loc, p); + /* XXX, is there a correct normal in this case ???, for now just z up */ + no[0]= 0.0; + no[1]= 0.0; + no[2]= 1.0; found = 1; } diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 5f8015be52f..a31ec950711 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -605,7 +605,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la Material *ma= shi->mat; GPUMaterial *mat= shi->gpumat; GPUNodeLink *lv, *dist, *visifac, *is, *inp, *i, *vn, *view; - GPUNodeLink *outcol, *specfac, *t, *shadfac; + GPUNodeLink *outcol, *specfac, *t, *shadfac= NULL; float one = 1.0f; if((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW)) diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 2fef230f1c2..f1f8383b85e 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -161,11 +161,11 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as { int x, y; - int hline, vline; int stride_x= (margin_r - margin_l) - 2; for(y=0; y < height; y++) { for(x=0; x < width; x++, px+=4) { + int hline= 0, vline= 0; if((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) { /* interior. skip */ x += stride_x; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 01dafd2ce4a..e741c622380 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -2341,7 +2341,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) VertRen *ver; VlakRen *vlr, *vlr1; Material *ma; - float *data, *nors, *orco, mat[4][4], imat[3][3], xn, yn, zn; + float *data, *nors, *orco=NULL, mat[4][4], imat[3][3], xn, yn, zn; int a, need_orco, vlakindex, *index; ListBase dispbase= {NULL, NULL}; @@ -2375,7 +2375,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) } } - for(a=0; anr; a++, data+=3, nors+=3, orco+=3) { + for(a=0; anr; a++, data+=3, nors+=3) { ver= RE_findOrAddVert(obr, obr->totvert++); VECCOPY(ver->co, data); @@ -2393,7 +2393,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) normalize_v3(ver->n); //if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n); - if(need_orco) ver->orco= orco; + if(need_orco) ver->orco= orco+=3; } index= dl->index; -- cgit v1.2.3 From 97576cd51b2fd5cca4de8003be0665f8d79fe2d3 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 7 Oct 2010 10:57:21 +0000 Subject: Fix for [#22250] Retopo projects to the wrong object when multiple objects are behind. * Scaling of objects wasn't properly taken into account when projecting the verts. --- source/blender/editors/transform/transform_snap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 5b7bcac65f2..09c04168a71 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1301,15 +1301,18 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E BVHTreeRayHit hit; BVHTreeFromMesh treeData; + /* local scale in normal direction */ + float local_scale = len_v3(ray_normal_local); + bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6); hit.index = -1; - hit.dist = *depth; + hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale); if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) { - if(hit.dist<=*depth) { - *depth= hit.dist; + if(hit.dist/local_scale <= *depth) { + *depth= hit.dist/local_scale; copy_v3_v3(loc, hit.co); copy_v3_v3(no, hit.no); -- cgit v1.2.3 From e9189bddb900ab86eedfb35dbf46d900a84509bb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 7 Oct 2010 12:18:09 +0000 Subject: Fix #24180: Make duplicates real doesn't update immediatly the outliner --- source/blender/editors/object/object_add.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e0608f03274..3ae1941035d 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1010,6 +1010,9 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { make_object_duplilist_real(C, scene, base); + + /* dependencies were changed */ + WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, base->object); } CTX_DATA_END; -- cgit v1.2.3 From e4964a347706e97f98043d80feff65769977c7bf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 7 Oct 2010 16:41:42 +0000 Subject: Fix #24167: Timeline keyframes don't update when selecting objects from outliner Based on patch from Alexander Kuznetsov. Own changes: - Keyframes in timelime depends on active object, so timelime better be listeing to ND_OB_ACTIVE notifier rather than ND_OB_SELECT - When scene is changing in this operator NC_WINDOW notifier would be send and the whole interface would be redrawed, so no need in ND_OB_ACTIVE in this case --- source/blender/editors/space_outliner/outliner.c | 7 +++---- source/blender/editors/space_time/space_time.c | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index c9aac8502c4..20b5ad7a34f 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1931,15 +1931,14 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops scene_deselect_all(scene); ED_base_object_select(base, BA_SELECT); } - if(C) + if(C) { ED_base_object_activate(C, base); /* adds notifier */ + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); + } } if(ob!=scene->obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); - - WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); - } static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index ca7dc29ad85..0d3b0514122 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -519,6 +519,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_SCENE: switch (wmn->data) { case ND_OB_SELECT: + case ND_OB_ACTIVE: case ND_FRAME: case ND_FRAME_RANGE: case ND_KEYINGSET: -- cgit v1.2.3 From c52c10d1781825290d56d27551b6a51b4ab85b40 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Oct 2010 21:25:05 +0000 Subject: append was using a freed Main pointer to refer to the curlib when instancing group objects and centering objects around the cursor. --- source/blender/blenloader/intern/readfile.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f24de9c605d..0eb25a6b894 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12433,25 +12433,29 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in { Main *mainvar= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + Library *curlib; /* make main consistent */ expand_main(*fd, mainl); /* do this when expand found other libs */ read_libraries(*fd, &(*fd)->mainlist); + + curlib= mainl->curlib; /* make the lib path relative if required */ if(flag & FILE_RELPATH) { /* use the full path, this could have been read by other library even */ - BLI_strncpy(mainl->curlib->name, mainl->curlib->filepath, sizeof(mainl->curlib->name)); + BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name)); /* uses current .blend file as reference */ - BLI_path_rel(mainl->curlib->name, G.sce); + BLI_path_rel(curlib->name, G.sce); } blo_join_main(&(*fd)->mainlist); mainvar= (*fd)->mainlist.first; + mainl= NULL; /* blo_join_main free's mainl, cant use anymore */ lib_link_all(*fd, mainvar); lib_verify_nodetree(mainvar, 0); @@ -12466,7 +12470,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in if (flag & FILE_LINK) { give_base_to_objects(mainvar, scene, NULL, 0); } else { - give_base_to_objects(mainvar, scene, mainl->curlib, 1); + give_base_to_objects(mainvar, scene, curlib, 1); } if (flag & FILE_GROUP_INSTANCE) { @@ -12486,7 +12490,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in *fd = NULL; } - append_do_cursor(scene, mainl->curlib, flag); + append_do_cursor(scene, curlib, flag); } void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag) -- cgit v1.2.3 From afa1bf33fb48db48fb909e4853094f2d962f8327 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Oct 2010 23:17:14 +0000 Subject: bugfix [#21610] alt-r for bone (reset rotation) doesnt work in weight painting mode pose operators now run in weightpaint mode when the weight paint objects pose armature is in pose mode. --- source/blender/editors/armature/editarmature.c | 18 +++--- source/blender/editors/armature/poseSlide.c | 2 +- source/blender/editors/armature/poselib.c | 16 ++--- source/blender/editors/armature/poseobject.c | 72 ++++++++++++++++------- source/blender/editors/include/ED_armature.h | 1 + source/blender/editors/object/object_constraint.c | 9 +-- source/blender/editors/screen/screen_context.c | 23 ++++---- source/blender/editors/screen/screen_ops.c | 5 +- 8 files changed, 92 insertions(+), 54 deletions(-) diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index ead5d44d393..26a89c4de02 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -558,7 +558,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob) static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); // must be active object, not edit-object + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object bArmature *arm= get_armature(ob); bPose *pose; bPoseChannel *pchan; @@ -658,7 +658,7 @@ void POSE_OT_armature_apply (wmOperatorType *ot) static int pose_visual_transform_apply_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); // must be active object, not edit-object + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object /* don't check if editmode (should be done by caller) */ if (ob->type!=OB_ARMATURE) @@ -1389,7 +1389,7 @@ static int pose_setflag_exec (bContext *C, wmOperator *op) CTX_DATA_END; /* note, notifier might evolve */ - WM_event_add_notifier(C, NC_OBJECT|ND_POSE, CTX_data_active_object(C)); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ED_object_pose_armature(CTX_data_active_object(C))); return OPERATOR_FINISHED; } @@ -4917,7 +4917,7 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod static int pose_clear_scale_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); short autokey = 0; /* only clear those channels that are not locked */ @@ -4985,7 +4985,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot) static int pose_clear_loc_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); short autokey = 0; /* only clear those channels that are not locked */ @@ -5054,7 +5054,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot) static int pose_clear_rot_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); short autokey = 0; /* only clear those channels that are not locked */ @@ -5306,7 +5306,7 @@ void POSE_OT_select_all(wmOperatorType *ot) static int pose_select_parent_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan,*parent; /* Determine if there is an active bone */ @@ -5381,7 +5381,7 @@ static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr) /* active object is armature in posemode, poll checked */ static int pose_hide_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; if(RNA_boolean_get(op->ptr, "unselected")) @@ -5431,7 +5431,7 @@ static int show_pose_bone(Object *ob, Bone *bone, void *ptr) /* active object is armature in posemode, poll checked */ static int pose_reveal_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone); diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 8d8f1bf24ee..482d97811a3 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -119,7 +119,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) /* get info from context */ pso->scene= CTX_data_scene(C); - pso->ob= CTX_data_active_object(C); + pso->ob= ED_object_pose_armature(CTX_data_active_object(C)); pso->arm= (pso->ob)? pso->ob->data : NULL; pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */ diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 6083616044e..9292c92294b 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -270,7 +270,7 @@ static KeyingSet *poselib_ks_locrotscale = NULL; /* the only keyingset we'll ne static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *arg) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= ob->poselib; TimeMarker *marker; @@ -293,7 +293,7 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= (ob) ? ob->data : NULL; bPose *pose= (ob) ? ob->pose : NULL; uiPopupMenu *pup; @@ -329,7 +329,7 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int poselib_add_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act = poselib_validate(ob); bArmature *arm= (ob) ? ob->data : NULL; bPose *pose= (ob) ? ob->pose : NULL; @@ -404,7 +404,7 @@ void POSELIB_OT_pose_add (wmOperatorType *ot) static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, int *free) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; TimeMarker *marker; EnumPropertyItem *item= NULL, item_tmp; @@ -436,7 +436,7 @@ static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, static int poselib_remove_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; TimeMarker *marker; FCurve *fcu; @@ -505,7 +505,7 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot) static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; TimeMarker *marker; @@ -533,7 +533,7 @@ static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int poselib_rename_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; TimeMarker *marker; char newname[64]; @@ -1237,7 +1237,7 @@ static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *e static void poselib_preview_init_data (bContext *C, wmOperator *op) { tPoseLib_PreviewData *pld; - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); int pose_index = RNA_int_get(op->ptr, "pose_index"); /* set up preview state info */ diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index b94b3e68318..4aff2f1e915 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -76,6 +76,38 @@ static void error(const char *dummy) {}; static void BIF_undo_push(const char *dummy) {} /* ************* XXX *************** */ + +static int object_pose_context(Object *ob) +{ + if( (ob) && + (ob->type == OB_ARMATURE) && + (ob->pose) && + (ob->mode & OB_MODE_POSE) + ) { + return 1; + } + else { + return 0; + } +} + +Object *ED_object_pose_armature(Object *ob) +{ + if(ob==NULL) + return NULL; + + if(object_pose_context(ob)) + return ob; + + ob= modifiers_isDeformedByArmature(ob); + + if(object_pose_context(ob)) + return ob; + + return NULL; +} + + /* This function is used to indicate that a bone is selected and needs keyframes inserted */ void set_pose_keys (Object *ob) { @@ -220,7 +252,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; @@ -296,7 +328,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object */ if ELEM(NULL, ob, ob->pose) @@ -330,7 +362,7 @@ void POSE_OT_paths_clear (wmOperatorType *ot) static int pose_select_constraint_target_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; bConstraint *con; int found= 0; @@ -390,7 +422,7 @@ void POSE_OT_select_constraint_target(wmOperatorType *ot) static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; Bone *curbone, *pabone, *chbone; int direction = RNA_enum_get(op->ptr, "direction"); @@ -570,7 +602,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend) static int pose_select_grouped_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); short extend= RNA_boolean_get(op->ptr, "extend"); short changed = 0; @@ -856,7 +888,7 @@ void free_posebuf(void) static int pose_copy_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); /* sanity checking */ if ELEM(NULL, ob, ob->pose) { @@ -895,7 +927,7 @@ void POSE_OT_copy (wmOperatorType *ot) static int pose_paste_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *chan, *pchan; int flip= RNA_boolean_get(op->ptr, "flipped"); @@ -1077,7 +1109,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object */ if (ob == NULL) @@ -1117,7 +1149,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object */ if (ob == NULL) @@ -1165,7 +1197,7 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1215,7 +1247,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1280,7 +1312,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1352,7 +1384,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1390,7 +1422,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; else - ob= CTX_data_active_object(C); + ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1423,7 +1455,7 @@ void POSE_OT_group_deselect (wmOperatorType *ot) static int pose_flip_names_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm; /* paranoia checks */ @@ -1468,7 +1500,7 @@ void POSE_OT_flip_names (wmOperatorType *ot) static int pose_autoside_names_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm; char newname[32]; short axis= RNA_enum_get(op->ptr, "axis"); @@ -1567,7 +1599,7 @@ void pose_activate_flipped_bone(Scene *scene) /* Present a popup to get the layers that should be used */ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ @@ -1588,7 +1620,7 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev /* Set the visible layers for the active armature (edit and pose modes) */ static int pose_armature_layers_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ @@ -1677,7 +1709,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) /* Set the visible layers for the active armature (edit and pose modes) */ static int pose_bone_layers_exec (bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ @@ -1798,7 +1830,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot) static int pose_flip_quats_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); /* loop through all selected pchans, flipping and keying (as needed) */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 474b50540d8..809b86d65f3 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -141,6 +141,7 @@ void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnam void undo_push_armature(struct bContext *C, char *name); /* poseobject.c */ +struct Object *ED_object_pose_armature(struct Object *ob); void ED_armature_exit_posemode(struct bContext *C, struct Base *base); void ED_armature_enter_posemode(struct bContext *C, struct Base *base); int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index f5d87df10a1..fd3c8b165c0 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -65,6 +65,7 @@ #include "RNA_enum_types.h" #include "ED_object.h" +#include "ED_armature.h" #include "ED_screen.h" #include "UI_interface.h" @@ -935,7 +936,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); /* free constraints for all selected bones */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) @@ -1364,7 +1365,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op) /* dummy operator callback */ static int pose_constraint_add_exec(bContext *C, wmOperator *op) { - Object *ob= ED_object_active_context(C); + Object *ob= ED_object_pose_armature(ED_object_active_context(C)); int type= RNA_enum_get(op->ptr, "type"); short with_targets= 0; @@ -1467,7 +1468,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) /* present menu with options + validation for targets to use */ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *evt) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan= get_active_posechannel(ob); bConstraint *con= NULL; @@ -1551,7 +1552,7 @@ void POSE_OT_ik_add(wmOperatorType *ot) /* remove IK constraints from selected bones */ static int pose_ik_clear_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); /* only remove IK Constraints */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index fbc83b1de65..b619398d985 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -209,14 +209,15 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if(CTX_data_equals(member, "visible_pose_bones")) { - bArmature *arm= (obact) ? obact->data : NULL; + Object *obpose= ED_object_pose_armature(obact); + bArmature *arm= (obpose) ? obpose->data : NULL; bPoseChannel *pchan; - if (obact && obact->pose && arm) { - for (pchan= obact->pose->chanbase.first; pchan; pchan= pchan->next) { + if (obpose && obpose->pose && arm) { + for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) { /* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */ if ((pchan->bone) && (arm->layer & pchan->bone->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) { - CTX_data_list_add(result, &obact->id, &RNA_PoseBone, pchan); + CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan); } } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); @@ -224,15 +225,16 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if(CTX_data_equals(member, "selected_pose_bones")) { - bArmature *arm= (obact) ? obact->data : NULL; + Object *obpose= ED_object_pose_armature(obact); + bArmature *arm= (obpose) ? obpose->data : NULL; bPoseChannel *pchan; - if (obact && obact->pose && arm) { - for (pchan= obact->pose->chanbase.first; pchan; pchan= pchan->next) { + if (obpose && obpose->pose && arm) { + for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) { /* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */ if ((pchan->bone) && (arm->layer & pchan->bone->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) { if (pchan->bone->flag & BONE_SELECTED || pchan->bone == arm->act_bone) - CTX_data_list_add(result, &obact->id, &RNA_PoseBone, pchan); + CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan); } } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); @@ -258,10 +260,11 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } else if(CTX_data_equals(member, "active_pose_bone")) { bPoseChannel *pchan; + Object *obpose= ED_object_pose_armature(obact); - pchan= get_active_posechannel(obact); + pchan= get_active_posechannel(obpose); if (pchan) { - CTX_data_pointer_set(result, &obact->id, &RNA_PoseBone, pchan); + CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan); return 1; } } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7638d576d9d..7b9bad5945d 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -56,6 +56,7 @@ #include "ED_util.h" #include "ED_screen.h" #include "ED_object.h" +#include "ED_armature.h" #include "ED_screen_types.h" #include "ED_keyframes_draw.h" @@ -259,8 +260,8 @@ int ED_operator_posemode(bContext *C) Object *obact= CTX_data_active_object(C); Object *obedit= CTX_data_edit_object(C); - if ((obact != obedit) && (obact) && (obact->type==OB_ARMATURE)) - return (obact->mode & OB_MODE_POSE)!=0; + if ((obact != obedit) && ED_object_pose_armature(obact)) + return 1; return 0; } -- cgit v1.2.3 From c6e2e7aa9374427ae114fcc532e7f2c8a8977874 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 02:08:11 +0000 Subject: move tracking functions into math_rotation.c (no functional changes) --- source/blender/blenkernel/intern/lattice.c | 65 +++++---------------------- source/blender/blenlib/BLI_math_rotation.h | 3 ++ source/blender/blenlib/intern/math_rotation.c | 62 +++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 55 deletions(-) diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 1390f0dbd56..71e5049f2cc 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -599,16 +599,6 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C } #endif - - static float q_x90d[4] = {0.70710676908493, 0.70710676908493, 0.0, 0.0}; // float rot_axis[3]= {1,0,0}; axis_angle_to_quat(q, rot_axis, 90 * (M_PI / 180)); - static float q_y90d[4] = {0.70710676908493, 0.0, 0.70710676908493, 0.0}; // float rot_axis[3]= {0,1,0}; axis_angle_to_quat(q, rot_axis, 90 * (M_PI / 180)); - static float q_z90d[4] = {0.70710676908493, 0.0, 0.0, 0.70710676908493}; // float rot_axis[3]= {0,0,2}; axis_angle_to_quat(q, rot_axis, 90 * (M_PI / 180)); - - static float q_nx90d[4] = {0.70710676908493, -0.70710676908493, 0.0, 0.0}; // float rot_axis[3]= {1,0,0}; axis_angle_to_quat(q, rot_axis, -90 * (M_PI / 180)); - static float q_ny90d[4] = {0.70710676908493, 0.0, -0.70710676908493, 0.0}; // float rot_axis[3]= {0,1,0}; axis_angle_to_quat(q, rot_axis, -90 * (M_PI / 180)); - static float q_nz90d[4] = {0.70710676908493, 0.0, 0.0, -0.70710676908493}; // float rot_axis[3]= {0,0,2}; axis_angle_to_quat(q, rot_axis, -90 * (M_PI / 180)); - - if(cd->no_rot_axis) { /* set by caller */ /* this is not exactly the same as 2.4x, since the axis is having rotation removed rather then @@ -635,53 +625,18 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C * Notice X,Y,Z Up all have light colors and each ordered CCW. * * Now for Neg Up XYZ, the colors are all dark, and ordered clockwise - Campbell + * + * note: moved functions into quat_apply_track/vec_apply_track * */ + copy_qt_qt(quat, new_quat); + copy_v3_v3(cent, co); + + /* zero the axis which is not used, + * the big block of text above now applies to these 3 lines */ + quat_apply_track(quat, axis-1); + vec_apply_track(cent, axis-1); + cent[axis < 4 ? axis-1 : axis-4]= 0.0f; - switch(axis) { - case MOD_CURVE_POSX: - mul_qt_qtqt(quat, new_quat, q_y90d); - - cent[0]= 0.0; - cent[1]= co[2]; - cent[2]= co[1]; - break; - case MOD_CURVE_NEGX: - mul_qt_qtqt(quat, new_quat, q_ny90d); - - cent[0]= 0.0; - cent[1]= -co[1]; - cent[2]= co[2]; - - break; - case MOD_CURVE_POSY: - mul_qt_qtqt(quat, new_quat, q_x90d); - - cent[0]= co[2]; - cent[1]= 0.0; - cent[2]= -co[0]; - break; - case MOD_CURVE_NEGY: - mul_qt_qtqt(quat, new_quat, q_nx90d); - - cent[0]= -co[0]; - cent[1]= 0.0; - cent[2]= -co[2]; - break; - case MOD_CURVE_POSZ: - mul_qt_qtqt(quat, new_quat, q_z90d); - - cent[0]= co[1]; - cent[1]= -co[0]; - cent[2]= 0.0; - break; - case MOD_CURVE_NEGZ: - mul_qt_qtqt(quat, new_quat, q_nz90d); - - cent[0]= co[0]; - cent[1]= -co[1]; - cent[2]= 0.0; - break; - } /* scale if enabled */ if(cu->flag & CU_PATH_RADIUS) diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 1b3f4dced02..4b33efc5578 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -169,6 +169,9 @@ void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq); void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]); void dquat_to_mat4(float R[4][4], DualQuat *dq); +void quat_apply_track(float quat[4], short axis); +void vec_apply_track(float vec[3], short axis); + float lens_to_angle(float lens); float angle_to_lens(float angle); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index b8cef511293..4e555b02c2b 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1530,6 +1530,68 @@ void copy_dq_dq(DualQuat *dq1, DualQuat *dq2) memcpy(dq1, dq2, sizeof(DualQuat)); } +/* axis matches eTrackToAxis_Modes */ +void quat_apply_track(float quat[4], short axis) +{ + /* axis calculated as follows */ + /* float axis[3]= {1,0,0}; axis_angle_to_quat(q, axis, 90 * (M_PI / 180)); + float axis[3]= {0,1,0}; axis_angle_to_quat(q, axis, 90 * (M_PI / 180)); + float axis[3]= {0,0,2}; axis_angle_to_quat(q, axis, 90 * (M_PI / 180)); + float axis[3]= {1,0,0}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); + float axis[3]= {0,1,0}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); + float axis[3]= {0,0,2}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); */ + + /* notice x/y flipped intentionally */ + const float quat_track[][4]= {{0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* pos-y */ + {0.70710676908493, 0.70710676908493, 0.0, 0.0}, /* pos-x */ + {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z */ + {0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* neg-y */ + {0.70710676908493, -0.70710676908493, 0.0, 0.0}, /* neg-x */ + {0.70710676908493, 0.0, 0.0, -0.70710676908493}};/* neg-z */ + + mul_qt_qtqt(quat, quat, quat_track[axis]); +} + +void vec_apply_track(float vec[3], short axis) +{ + float tvec[3]; + + copy_v3_v3(tvec, vec); + + switch(axis) { + case 0: /* pos-x */ + /* vec[0]= 0.0; */ + vec[1]= tvec[2]; + vec[2]= tvec[1]; + break; + case 1: /* pos-y */ + vec[0]= tvec[2]; + /* vec[1]= 0.0; */ + vec[2]= -tvec[0]; + break; + case 2: /* pos-z */ + vec[0]= tvec[1]; + vec[1]= -tvec[0]; + // vec[2]= 0.0; */ + break; + case 3: /* neg-x */ + /* vec[0]= 0.0; */ + vec[1]= -tvec[1]; + vec[2]= tvec[2]; + break; + case 4: /* neg-y */ + vec[0]= -tvec[0]; + /* vec[1]= 0.0; */ + vec[2]= -tvec[2]; + break; + case 5: /* neg-z */ + vec[0]= tvec[0]; + vec[1]= -tvec[1]; + /* vec[2]= 0.0; */ + break; + } +} + /* lense/angle conversion (radians) */ float lens_to_angle(float lens) { -- cgit v1.2.3 From 28b264de67b99023e2e42b895804d8e6d88798dd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 8 Oct 2010 02:48:24 +0000 Subject: Fix #23358: template_curve_mapping doesn't work in split views --- source/blender/editors/interface/interface_layout.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 4a9d7a0f6f3..45b38a8c9a9 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2169,6 +2169,7 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align) split->litem.enabled= 1; split->litem.context= layout->context; split->litem.space= layout->root->style->columnspace; + split->litem.w= layout->w; split->percentage= percentage; BLI_addtail(&layout->items, split); -- cgit v1.2.3 From 5e232548d3d3362ba5f2af7807237bc7d6b672d6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 03:50:01 +0000 Subject: fix for error in track rotation, found while looking into adding an up axis to this function. --- source/blender/blenlib/intern/math_rotation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 4e555b02c2b..be383fdc73c 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1542,10 +1542,10 @@ void quat_apply_track(float quat[4], short axis) float axis[3]= {0,0,2}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); */ /* notice x/y flipped intentionally */ - const float quat_track[][4]= {{0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* pos-y */ + const float quat_track[][4]= {{0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* pos-y */ {0.70710676908493, 0.70710676908493, 0.0, 0.0}, /* pos-x */ {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z */ - {0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* neg-y */ + {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y */ {0.70710676908493, -0.70710676908493, 0.0, 0.0}, /* neg-x */ {0.70710676908493, 0.0, 0.0, -0.70710676908493}};/* neg-z */ @@ -1562,7 +1562,7 @@ void vec_apply_track(float vec[3], short axis) case 0: /* pos-x */ /* vec[0]= 0.0; */ vec[1]= tvec[2]; - vec[2]= tvec[1]; + vec[2]= -tvec[1]; break; case 1: /* pos-y */ vec[0]= tvec[2]; @@ -1577,7 +1577,7 @@ void vec_apply_track(float vec[3], short axis) case 3: /* neg-x */ /* vec[0]= 0.0; */ vec[1]= -tvec[1]; - vec[2]= tvec[2]; + vec[2]= -tvec[2]; break; case 4: /* neg-y */ vec[0]= -tvec[0]; -- cgit v1.2.3 From 65b0893df0c82b04701f5f39c725df983c19f0c7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 07:29:08 +0000 Subject: bugfix [#21483] Twisting when Dupliframing a Surface Circle (Nurbs) along a Curve. use the curve's twist for follow path constraint and parent-path. --- source/blender/blenkernel/intern/constraint.c | 16 ++++++--- source/blender/blenkernel/intern/lattice.c | 2 +- source/blender/blenkernel/intern/object.c | 10 ++++-- source/blender/blenlib/BLI_math_rotation.h | 2 +- source/blender/blenlib/intern/math_rotation.c | 48 ++++++++++++++------------- 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index fe69f13bbda..3df395244f4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1201,7 +1201,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; - float q[4], vec[4], dir[3], quat[4], radius, x1; + float vec[4], dir[3], radius; float totmat[4][4]; float curvetime; @@ -1217,7 +1217,8 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr makeDispListCurveTypes(cob->scene, ct->tar, 0); if (cu->path && cu->path->data) { - if ((data->followflag & FOLLOWPATH_STATIC) == 0) { + float quat[4]; + if ((data->followflag & FOLLOWPATH_STATIC) == 0) { /* animated position along curve depending on time */ if (cob->scene) curvetime= bsystem_time(cob->scene, ct->tar, cu->ctime, 0.0) - data->offset; @@ -1238,8 +1239,10 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr curvetime= data->offset_fac; } - if ( where_on_path(ct->tar, curvetime, vec, dir, NULL, &radius, NULL) ) { + if ( where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/ if (data->followflag & FOLLOWPATH_FOLLOW) { +#if 0 + float x1, q[4]; vec_to_quat(quat, dir, (short)data->trackflag, (short)data->upflag); normalize_v3(dir); @@ -1249,10 +1252,13 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr q[2]= -x1*dir[1]; q[3]= -x1*dir[2]; mul_qt_qtqt(quat, q, quat); - +#else + quat_apply_track(quat, data->trackflag, data->upflag); +#endif + quat_to_mat4(totmat, quat); } - + if (data->followflag & FOLLOWPATH_RADIUS) { float tmat[4][4], rmat[4][4]; scale_m4_fl(tmat, radius); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 71e5049f2cc..638cab58229 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -633,7 +633,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C /* zero the axis which is not used, * the big block of text above now applies to these 3 lines */ - quat_apply_track(quat, axis-1); + quat_apply_track(quat, axis-1, (axis==1 || axis==3) ? 1:0); /* up flag is a dummy, set so no rotation is done */ vec_apply_track(cent, axis-1); cent[axis < 4 ? axis-1 : axis-4]= 0.0f; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index d9ee67920eb..0c437db335b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1791,9 +1791,10 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) /* vec: 4 items! */ - if( where_on_path(par, ctime, vec, dir, NULL, &radius, NULL) ) { + if( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) { if(cu->flag & CU_FOLLOW) { +#if 0 vec_to_quat( quat,dir, ob->trackflag, ob->upflag); /* the tilt */ @@ -1804,8 +1805,11 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) q[2]= -x1*dir[1]; q[3]= -x1*dir[2]; mul_qt_qtqt(quat, q, quat); - - quat_to_mat4( mat,quat); +#else + quat_apply_track(quat, ob->trackflag, ob->upflag); +#endif + + quat_to_mat4(mat,quat); } if(cu->flag & CU_PATH_RADIUS) { diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 4b33efc5578..321fd28a62f 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -169,7 +169,7 @@ void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq); void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]); void dquat_to_mat4(float R[4][4], DualQuat *dq); -void quat_apply_track(float quat[4], short axis); +void quat_apply_track(float quat[4], short axis, short upflag); void vec_apply_track(float vec[3], short axis); float lens_to_angle(float lens); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index be383fdc73c..c4f12a5efc1 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1531,25 +1531,27 @@ void copy_dq_dq(DualQuat *dq1, DualQuat *dq2) } /* axis matches eTrackToAxis_Modes */ -void quat_apply_track(float quat[4], short axis) -{ - /* axis calculated as follows */ - /* float axis[3]= {1,0,0}; axis_angle_to_quat(q, axis, 90 * (M_PI / 180)); - float axis[3]= {0,1,0}; axis_angle_to_quat(q, axis, 90 * (M_PI / 180)); - float axis[3]= {0,0,2}; axis_angle_to_quat(q, axis, 90 * (M_PI / 180)); - float axis[3]= {1,0,0}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); - float axis[3]= {0,1,0}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); - float axis[3]= {0,0,2}; axis_angle_to_quat(q, axis, -90 * (M_PI / 180)); */ - - /* notice x/y flipped intentionally */ - const float quat_track[][4]= {{0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* pos-y */ - {0.70710676908493, 0.70710676908493, 0.0, 0.0}, /* pos-x */ - {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z */ - {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y */ - {0.70710676908493, -0.70710676908493, 0.0, 0.0}, /* neg-x */ - {0.70710676908493, 0.0, 0.0, -0.70710676908493}};/* neg-z */ - +void quat_apply_track(float quat[4], short axis, short upflag) +{ + /* rotations are hard coded to match vec_to_quat */ + const float quat_track[][4]= {{0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* pos-y90 */ + {0.5, 0.5, 0.5, 0.5}, /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */ + {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z90 */ + {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y90 */ + {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */ + {1, 0, 0, 0}};/* no rotation */ + mul_qt_qtqt(quat, quat, quat_track[axis]); + + if(axis>2) + axis= axis-3; + + /* 90d rotation when the second */ + if(upflag != (2-axis)>>1) { // [0->1, 1->0, 2->0] + float q[4]= {0.70710676908493, 0, 0, 0}; + q[axis+1] = ((axis==1)) ? 0.70710676908493 : -0.70710676908493; /* flip non Y axis */ + mul_qt_qtqt(quat, quat, q); + } } void vec_apply_track(float vec[3], short axis) @@ -1565,9 +1567,9 @@ void vec_apply_track(float vec[3], short axis) vec[2]= -tvec[1]; break; case 1: /* pos-y */ - vec[0]= tvec[2]; + /* vec[0]= tvec[0]; */ /* vec[1]= 0.0; */ - vec[2]= -tvec[0]; + /* vec[2]= tvec[2]; */ break; case 2: /* pos-z */ vec[0]= tvec[1]; @@ -1580,12 +1582,12 @@ void vec_apply_track(float vec[3], short axis) vec[2]= -tvec[2]; break; case 4: /* neg-y */ - vec[0]= -tvec[0]; + vec[0]= -tvec[2]; /* vec[1]= 0.0; */ - vec[2]= -tvec[2]; + vec[2]= tvec[0]; break; case 5: /* neg-z */ - vec[0]= tvec[0]; + vec[0]= -tvec[0]; vec[1]= -tvec[1]; /* vec[2]= 0.0; */ break; -- cgit v1.2.3 From c79e054538074d5149296994214397641124d76e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 07:36:33 +0000 Subject: quat_apply_track had incomplete comments --- source/blender/blenlib/intern/math_rotation.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index c4f12a5efc1..3b58fe88bf5 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1539,21 +1539,24 @@ void quat_apply_track(float quat[4], short axis, short upflag) {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z90 */ {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y90 */ {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */ - {1, 0, 0, 0}};/* no rotation */ + {-3.0908619663705394e-08, 0.70710676908493, 0.70710676908493, 3.0908619663705394e-08}}; /* no rotation */ mul_qt_qtqt(quat, quat, quat_track[axis]); if(axis>2) axis= axis-3; - /* 90d rotation when the second */ - if(upflag != (2-axis)>>1) { // [0->1, 1->0, 2->0] - float q[4]= {0.70710676908493, 0, 0, 0}; + /* there are 2 possible up-axis for each axis used, the 'quat_track' applies so the first + * up axis is used X->Y, Y->X, Z->X, if this first up axis isn used then rotate 90d + * the strange bit shift below just find the low axis {X:Y, Y:X, Z:X} */ + if(upflag != (2-axis)>>1) { + float q[4]= {0.70710676908493, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */ q[axis+1] = ((axis==1)) ? 0.70710676908493 : -0.70710676908493; /* flip non Y axis */ mul_qt_qtqt(quat, quat, q); } } + void vec_apply_track(float vec[3], short axis) { float tvec[3]; @@ -1572,14 +1575,14 @@ void vec_apply_track(float vec[3], short axis) /* vec[2]= tvec[2]; */ break; case 2: /* pos-z */ - vec[0]= tvec[1]; - vec[1]= -tvec[0]; + /* vec[0]= tvec[0]; */ + /* vec[1]= tvec[1]; */ // vec[2]= 0.0; */ break; case 3: /* neg-x */ /* vec[0]= 0.0; */ - vec[1]= -tvec[1]; - vec[2]= -tvec[2]; + vec[1]= tvec[2]; + vec[2]= -tvec[1]; break; case 4: /* neg-y */ vec[0]= -tvec[2]; -- cgit v1.2.3 From 86e77bc53203f49f474f0b95550fc6de9bae4b97 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 8 Oct 2010 08:56:04 +0000 Subject: "Fix" for [#23863] Smoke Voxel Data Still Frame Number doesn't work * Not supported currently so hidden in ui. * Could be a nice option for later, but will need some proper thought put into the implementation. --- release/scripts/ui/properties_texture.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index bf0c5d56e4c..ebf4e6cdf80 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -864,10 +864,11 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel): layout.template_image(tex, "image", tex.image_user, compact=True) #layout.prop(vd, "frame_duration") - layout.prop(vd, "use_still_frame") - row = layout.row() - row.active = vd.use_still_frame - row.prop(vd, "still_frame") + if vd.file_format in ('BLENDER_VOXEL', 'RAW_8BIT'): + layout.prop(vd, "use_still_frame") + row = layout.row() + row.active = vd.use_still_frame + row.prop(vd, "still_frame") layout.prop(vd, "interpolation") layout.prop(vd, "extension") -- cgit v1.2.3 From 30137cbdbc7babccdbb20f375fd73971d0d21f75 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 11:33:10 +0000 Subject: bugfix [#24179] Button "Loop Cut and Slide" on Mesh Tools not work also added a message in the tooltip to say `why` a buttons disabled. depends on the operators poll setting the message. --- .../blender/editors/interface/interface_regions.c | 37 +++++++++++++++------- source/blender/editors/mesh/editmesh_mods.c | 2 +- source/blender/editors/mesh/loopcut.c | 2 +- source/blender/editors/screen/screen_ops.c | 6 +++- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 53981f202ed..a0f852239c4 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "MEM_guardedalloc.h" @@ -300,7 +301,7 @@ typedef struct uiTooltipData { rcti bbox; uiFontStyle fstyle; char lines[MAX_TOOLTIP_LINES][512]; - int linedark[MAX_TOOLTIP_LINES]; + unsigned int color[MAX_TOOLTIP_LINES]; int totline; int toth, spaceh, lineh; } uiTooltipData; @@ -320,9 +321,7 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) bbox.ymin= bbox.ymax - data->lineh; for(a=0; atotline; a++) { - if(!data->linedark[a]) glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - else glColor4f(0.5f, 0.5f, 0.5f, 1.0f); - + cpack(data->color[a]); uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]); bbox.ymin -= data->lineh + data->spaceh; bbox.ymax -= data->lineh + data->spaceh; @@ -358,6 +357,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(but->tip && strlen(but->tip)) { BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0])); + data->color[data->totline]= 0xFFFFFF; data->totline++; } @@ -367,7 +367,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Shortcut: %s", buf); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; } } @@ -377,7 +377,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) ui_get_but_string(but, buf, sizeof(buf)); if(buf[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; } } @@ -388,7 +388,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex)); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; } } @@ -397,21 +397,21 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(ui_but_anim_expression_get(but, buf, sizeof(buf))) { /* expression */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; } } /* rna info */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; if(but->rnapoin.id.data) { ID *id= but->rnapoin.id.data; if(id->lib && id->lib->name) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; } } @@ -425,12 +425,27 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* operator info */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str); - data->linedark[data->totline]= 1; + data->color[data->totline]= 0x888888; data->totline++; MEM_freeN(str); + + /* second check if we are disabled - why */ + if(but->flag & UI_BUT_DISABLED) { + const char *poll_msg; + CTX_wm_operator_poll_msg_set(C, NULL); + WM_operator_poll(C, but->optype); + poll_msg= CTX_wm_operator_poll_msg_get(C); + if(poll_msg) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Disabled: %s", poll_msg); + data->color[data->totline]= 0x6666ff; /* alert */ + data->totline++; + } + } } + assert(data->totline < MAX_TOOLTIP_LINES); + if(data->totline == 0) { MEM_freeN(data); return NULL; diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index f8018c686f5..164e8980b83 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -2113,7 +2113,7 @@ void MESH_OT_loop_select(wmOperatorType *ot) /* api callbacks */ ot->invoke= mesh_select_loop_invoke; - ot->poll= ED_operator_editmesh_region_view3d; + ot->poll= ED_operator_editmesh_view3d; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 7f1a7d0e1fc..13538a6f218 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -506,7 +506,7 @@ void MESH_OT_loopcut (wmOperatorType *ot) ot->invoke= ringcut_invoke; ot->modal= ringcut_modal; ot->cancel= ringcut_cancel; - ot->poll= ED_operator_editmesh_region_view3d; + ot->poll= ED_operator_editmesh_view3d; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7b9bad5945d..613c8bc0178 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -244,7 +244,11 @@ int ED_operator_editmesh_view3d(bContext *C) int ED_operator_editmesh_region_view3d(bContext *C) { - return ED_operator_editmesh(C) && CTX_wm_region_view3d(C); + if(ED_operator_editmesh(C) && CTX_wm_region_view3d(C)) + return 1; + + CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh"); + return 0; } int ED_operator_editarmature(bContext *C) -- cgit v1.2.3 From 7006309b3a105dbab8d1d5534d95d53fab5174ef Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 12:16:03 +0000 Subject: fix for console selection when pasting. --- source/blender/editors/space_console/console_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 3f04d0e4293..4e50b589bc6 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -782,6 +782,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot) static int paste_exec(bContext *C, wmOperator *op) { + SpaceConsole *sc= CTX_wm_space_console(C); ConsoleLine *ci= console_history_verify(C); char *buf_str= WM_clipboard_text_get(0); @@ -805,7 +806,7 @@ static int paste_exec(bContext *C, wmOperator *op) ci= console_history_verify(C); } - console_line_insert(ci, buf_next); + console_select_offset(sc, console_line_insert(ci, buf_next)); } MEM_freeN(buf_str); -- cgit v1.2.3 From 48d2aac250624664cd1db77470af0fc45526f3c9 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 8 Oct 2010 13:08:13 +0000 Subject: Fix for [#24092] F-Curve Cycle doesn't behave properly at end of Cycles (also: possible problem with how the cycle range is determined) * Cycle code had difficulties handling the transitions from one cycle iteration to the next one. * Now the transition frames are handled manually so that: - cycles before the actual fcurve data respect the first datapoint - cycles after the fcurve data respect the last datapoint * Also fixes a bug where the count of "before" cycles was off by one from the given value. --- source/blender/blenkernel/intern/fmodifier.c | 40 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index f63b58fe489..5a10f93ac72 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -529,7 +529,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e FMod_Cycles *data= (FMod_Cycles *)fcm->data; float prevkey[2], lastkey[2], cycyofs=0.0f; short side=0, mode=0; - int cycles=0; + int cycles=0, ofs=0; /* check if modifier is first in stack, otherwise disable ourself... */ // FIXME... @@ -571,6 +571,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e side= -1; mode= data->before_mode; cycles= data->before_cycles; + ofs= prevkey[0]; } } else if (evaltime > lastkey[0]) { @@ -578,6 +579,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e side= 1; mode= data->after_mode; cycles= data->after_cycles; + ofs= lastkey[0]; } } if ELEM(0, side, mode) @@ -585,11 +587,8 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e /* find relative place within a cycle */ { - float cycdx=0, cycdy=0, ofs=0; - float cycle= 0; - - /* ofs is start frame of cycle */ - ofs= prevkey[0]; + float cycdx=0, cycdy=0; + float cycle= 0, cyct=0; /* calculate period and amplitude (total height) of a cycle */ cycdx= lastkey[0] - prevkey[0]; @@ -601,6 +600,9 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e /* calculate the 'number' of the cycle */ cycle= ((float)side * (evaltime - ofs) / cycdx); + + /* calculate the time inside the cycle */ + cyct= fmod(evaltime - ofs, cycdx); /* check that cyclic is still enabled for the specified time */ if (cycles == 0) { @@ -608,7 +610,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e * as this indicates infinite cycles... */ } - else if (cycle > (cycles+1)) { + else if (cycle > cycles) { /* we are too far away from range to evaluate * TODO: but we should still hold last value... */ @@ -617,26 +619,36 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e /* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle */ if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) { - cycyofs = (float)floor((evaltime - ofs) / cycdx); + if(side < 0) + cycyofs = (float)floor((evaltime - ofs) / cycdx); + else + cycyofs = (float)ceil((evaltime - ofs) / cycdx); cycyofs *= cycdy; } - + + /* special case for cycle start/end */ + if(cyct == 0.0f) { + evaltime = (side == 1 ? lastkey[0] : prevkey[0]); + + if((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2)) + evaltime = (side == 1 ? prevkey[0] : lastkey[0]); + } /* calculate where in the cycle we are (overwrite evaltime to reflect this) */ - if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle) % 2)) { + else if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle+1) % 2)) { /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse * - for 'before' extrapolation, we need to flip in a different way, otherwise values past * then end of the curve get referenced (result of fmod will be negative, and with different phase) */ if (side < 0) - evaltime= (float)(prevkey[0] - fmod(evaltime-ofs, cycdx)); + evaltime= prevkey[0] - cyct; else - evaltime= (float)(lastkey[0] - fmod(evaltime-ofs, cycdx)); + evaltime= lastkey[0] - cyct; } else { /* the cycle is played normally... */ - evaltime= (float)(fmod(evaltime-ofs, cycdx) + ofs); + evaltime= prevkey[0] + cyct; } - if (evaltime < ofs) evaltime += cycdx; + if (evaltime < prevkey[0]) evaltime += cycdx; } /* store temp data if needed */ -- cgit v1.2.3 From 663ce490e0174a90ba3e4ed6f3468301d593958a Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 8 Oct 2010 20:39:56 +0000 Subject: Enable CXX_GUARDEDALLOC support through SCons. --- build_files/scons/tools/btools.py | 2 ++ intern/guardedalloc/SConscript | 11 +++++++++-- intern/string/SConscript | 8 +++++++- source/gameengine/BlenderRoutines/SConscript | 3 +++ source/gameengine/Converter/SConscript | 3 +++ source/gameengine/Expressions/SConscript | 3 +++ source/gameengine/GameLogic/SConscript | 4 ++++ source/gameengine/Ketsji/SConscript | 3 +++ source/gameengine/Network/SConscript | 8 +++++++- source/gameengine/Physics/Bullet/SConscript | 3 +++ source/gameengine/Physics/Dummy/SConscript | 8 +++++++- source/gameengine/Physics/common/SConscript | 8 +++++++- source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript | 3 +++ source/gameengine/Rasterizer/SConscript | 3 +++ source/gameengine/SceneGraph/SConscript | 8 +++++++- 15 files changed, 71 insertions(+), 7 deletions(-) diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 37d9048d70d..737ce40d702 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -92,6 +92,7 @@ def validate_arguments(args, bc): 'WITH_BF_RAYOPTIMIZATION', 'BF_RAYOPTIMIZATION_SSE_FLAGS', 'BF_NO_ELBEEM', + 'WITH_BF_CXX_GUARDEDALLOC', 'BF_VCREDIST' # Windows-only, and useful only when creating installer ] @@ -453,6 +454,7 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)), ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''), + (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)), ('BF_VCREDIST', 'Full path to vcredist', '') ) # end of opts.AddOptions() diff --git a/intern/guardedalloc/SConscript b/intern/guardedalloc/SConscript index 0c9c7d13608..74d6e07269f 100644 --- a/intern/guardedalloc/SConscript +++ b/intern/guardedalloc/SConscript @@ -2,7 +2,14 @@ Import('env') -sources = env.Glob('intern/*.c') +defs = [] + +sources = ['intern/mallocn.c', 'intern/mmap_win.c'] + +if env['WITH_BF_CXX_GUARDEDALLOC']: + sources.append('cpp/mallocn.cpp') + defs.append('WITH_CXX_GUARDEDALLOC') + incs = '.' -env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defines=[], libtype=['intern','player'], priority = [5,150] ) +env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defs, libtype=['intern','player'], priority = [5,150] ) diff --git a/intern/string/SConscript b/intern/string/SConscript index f8342bf12c2..dac0ead8e61 100644 --- a/intern/string/SConscript +++ b/intern/string/SConscript @@ -4,4 +4,10 @@ Import ('env') sources = env.Glob('intern/*.cpp') incs = '.' -env.BlenderLib ('bf_intern_string', sources, Split(incs), [], libtype=['intern','player'], priority = [50,10] ) +defs = [] + +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' #intern/guardedalloc' + +env.BlenderLib ('bf_intern_string', sources, Split(incs), defs, libtype=['intern','player'], priority = [50,10] ) diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript index f53fc509c6d..1a774fc8aba 100644 --- a/source/gameengine/BlenderRoutines/SConscript +++ b/source/gameengine/BlenderRoutines/SConscript @@ -30,6 +30,9 @@ if env['WITH_BF_PYTHON']: else: defs.append('DISABLE_PYTHON') +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index ab1d7574d89..7701d27730b 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -32,4 +32,7 @@ if env['WITH_BF_PYTHON']: else: defs.append('DISABLE_PYTHON') +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript index 007d6373c77..85db689a9ba 100644 --- a/source/gameengine/Expressions/SConscript +++ b/source/gameengine/Expressions/SConscript @@ -12,4 +12,7 @@ if env['WITH_BF_PYTHON']: else: defs.append('DISABLE_PYTHON') +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index 507bb7f0bdd..c9d1fed875d 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -23,4 +23,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): if env['BF_DEBUG']: defs.append('_DEBUG') +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' #/intern/guardedalloc' + env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 8d54452be0d..49e4528594f 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -40,4 +40,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): if env['BF_DEBUG']: defs.append('_DEBUG') # for Python +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Network/SConscript b/source/gameengine/Network/SConscript index 3883dc71c9c..3cf1747d013 100644 --- a/source/gameengine/Network/SConscript +++ b/source/gameengine/Network/SConscript @@ -5,4 +5,10 @@ sources = env.Glob('*.cpp') #'NG_NetworkMessage.cpp NG_NetworkObject.cpp NG_Netw incs = '. #source/kernel/gen_system #intern/string #intern/moto/include' -env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), [], libtype=['core','player'], priority=[400,130] ) +defs = [] + +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' #intern/guardedalloc' + +env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), defs, libtype=['core','player'], priority=[400,130] ) diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript index f58085ab354..6beb044671c 100644 --- a/source/gameengine/Physics/Bullet/SConscript +++ b/source/gameengine/Physics/Bullet/SConscript @@ -27,4 +27,7 @@ if env['WITH_BF_PYTHON']: else: defs.append('DISABLE_PYTHON') +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/Dummy/SConscript b/source/gameengine/Physics/Dummy/SConscript index dc76e8046a0..496092133c3 100644 --- a/source/gameengine/Physics/Dummy/SConscript +++ b/source/gameengine/Physics/Dummy/SConscript @@ -5,4 +5,10 @@ sources = 'DummyPhysicsEnvironment.cpp' incs = '. ../common' -env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,60] ) +defs = [] + +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' #intern/guardedalloc' + +env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,60] ) diff --git a/source/gameengine/Physics/common/SConscript b/source/gameengine/Physics/common/SConscript index 719c028ee8f..38bb7a11309 100644 --- a/source/gameengine/Physics/common/SConscript +++ b/source/gameengine/Physics/common/SConscript @@ -5,4 +5,10 @@ sources = 'PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp P incs = '. ../Dummy #intern/moto/include' -env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS']) +defs = [] + +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' #intern/guardedalloc' + +env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript index 68e6789c05e..8ad6a8b28a2 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript @@ -10,4 +10,7 @@ incs += ' #source/blender/gpu #extern/glew/include ' + env['BF_OPENGL_INC'] incs += ' #source/blender/gameengine/Ketsji #source/gameengine/SceneGraph #source/blender/makesdna #source/blender/blenkernel' incs += ' #intern/guardedalloc #source/blender/blenlib' +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), defines = defs, libtype=['core','player'], priority=[350,75], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript index a78a0289d98..dc189c54a40 100644 --- a/source/gameengine/Rasterizer/SConscript +++ b/source/gameengine/Rasterizer/SConscript @@ -13,4 +13,7 @@ if env['WITH_BF_PYTHON']: else: defs.append('DISABLE_PYTHON') +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/SceneGraph/SConscript b/source/gameengine/SceneGraph/SConscript index 2a33cd67b5e..992a10befa2 100644 --- a/source/gameengine/SceneGraph/SConscript +++ b/source/gameengine/SceneGraph/SConscript @@ -6,4 +6,10 @@ sources = env.Glob('*.cpp') incs = '. #intern/moto/include' -env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS']) +defs = [] + +if env['WITH_BF_CXX_GUARDEDALLOC']: + defs.append('WITH_CXX_GUARDEDALLOC') + incs += ' #intern/guardedalloc' + +env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), defs, libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS']) -- cgit v1.2.3 From c9d240626d17f95ff88559efc121f6ea7fccdae5 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 8 Oct 2010 20:40:42 +0000 Subject: c++ -> C++ --- intern/guardedalloc/cpp/mallocn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp index bf51409e84f..b4d19a62bdc 100644 --- a/intern/guardedalloc/cpp/mallocn.cpp +++ b/intern/guardedalloc/cpp/mallocn.cpp @@ -26,7 +26,7 @@ void* operator new (size_t size) { - return MEM_mallocN(size, "c++/anonymous"); + return MEM_mallocN(size, "C++/anonymous"); } /* not default but can be used when needing to set a string */ -- cgit v1.2.3 From e02439d2f3cc7e0a30736b1d0954aefd636e519e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 21:18:08 +0000 Subject: fix for operator cheat sheet, recent description order change broke it. --- release/scripts/ui/space_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index fb700104b14..bd33153d017 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -354,7 +354,7 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator): for op_submodule_name in dir(op_module): op = getattr(op_module, op_submodule_name) text = repr(op) - if text.startswith('bpy.ops.'): + if text.split("\n")[-1].startswith('bpy.ops.'): op_strings.append(text) tot += 1 -- cgit v1.2.3 From 9bb10e571b99e4ddbfe11e52bdb385b0433e8b10 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Oct 2010 22:33:43 +0000 Subject: bugfix [#23868] NodeGroup font resolution problem when editing it --- source/blender/editors/space_node/node_draw.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 0b33196c646..dfc63e032d9 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1031,9 +1031,14 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN else BLI_strncpy(showname, ngroup->id.name+2, sizeof(showname)); - // XXX this shows some scaling artifacts - UI_DrawString(rect.xmin+8.0f, rect.ymax+5.0f, showname); - + + uiDefBut(gnode->block, LABEL, 0, showname, (short)(rect.xmin+15), (short)(rect.ymax), + (int)(rect.xmax - rect.xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, ""); + uiEndBlock(C, gnode->block); + uiDrawBlock(C, gnode->block); + gnode->block= NULL; + + /* links from groupsockets to the internal nodes */ node_draw_group_links(&ar->v2d, snode, gnode); @@ -1045,6 +1050,8 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) socket_circle_draw(sock, NODE_SOCKSIZE); + + /* and finally the whole tree */ node_draw_nodetree(C, ar, snode, ngroup); } -- cgit v1.2.3 From f7fb4e70b3517f6f3e2a0a4823143963fc93f1bf Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 9 Oct 2010 01:31:20 +0000 Subject: Fixing a memory leak with SCA_PythonKeyboard and SCA_PythonMouse. --- source/gameengine/Ketsji/KX_PythonInit.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index cc44be2654b..88993f20132 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -141,6 +141,8 @@ static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super static KX_Scene* gp_KetsjiScene = NULL; static KX_KetsjiEngine* gp_KetsjiEngine = NULL; static RAS_IRasterizer* gp_Rasterizer = NULL; +static SCA_PythonKeyboard* gp_PythonKeyboard = NULL; +static SCA_PythonMouse* gp_PythonMouse = NULL; void KX_SetActiveScene(class KX_Scene* scene) { @@ -1296,11 +1298,13 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item); // Add keyboard and mouse attributes to this module - SCA_PythonKeyboard* pykeyb = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice()); - PyDict_SetItemString(d, "keyboard", pykeyb->NewProxy(true)); + MT_assert(!gp_PythonKeyboard); + gp_PythonKeyboard = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice()); + PyDict_SetItemString(d, "keyboard", gp_PythonKeyboard->NewProxy(true)); - SCA_PythonMouse* pymouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas); - PyDict_SetItemString(d, "mouse", pymouse->NewProxy(true)); + MT_assert(!gp_PythonMouse); + gp_PythonMouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas); + PyDict_SetItemString(d, "mouse", gp_PythonMouse->NewProxy(true)); ErrorObject = PyUnicode_FromString("GameLogic.error"); PyDict_SetItemString(d, "error", ErrorObject); @@ -1926,6 +1930,13 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur void exitGamePlayerPythonScripting() { + /* Clean up the Python mouse and keyboard */ + delete gp_PythonKeyboard; + gp_PythonKeyboard = NULL; + + delete gp_PythonMouse; + gp_PythonMouse = NULL; + /* since python restarts we cant let the python backup of the sys.path hang around in a global pointer */ restorePySysObjects(); /* get back the original sys.path and clear the backup */ @@ -1962,6 +1973,13 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev void exitGamePythonScripting() { + /* Clean up the Python mouse and keyboard */ + delete gp_PythonKeyboard; + gp_PythonKeyboard = NULL; + + delete gp_PythonMouse; + gp_PythonMouse = NULL; + restorePySysObjects(); /* get back the original sys.path and clear the backup */ bpy_import_main_set(NULL); PyObjectPlus::ClearDeprecationWarning(); -- cgit v1.2.3 From bd00aa972727197daa4b891e7aee8146a706e68c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Oct 2010 10:45:25 +0000 Subject: patch [#23781] Dynamically Load Actions from Mitchell Stokes (moguri) --- .../Converter/KX_BlenderSceneConverter.cpp | 41 +++++++++++++++++++++- source/gameengine/GameLogic/SCA_LogicManager.h | 1 + source/gameengine/PyDoc/bge.logic.rst | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index f50fb6838e3..6f64f4e33af 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -40,6 +40,7 @@ #include "KX_KetsjiEngine.h" #include "KX_IPhysicsController.h" #include "BL_Material.h" +#include "BL_ActionActuator.h" #include "KX_BlenderMaterial.h" #include "KX_PolygonMaterial.h" @@ -960,7 +961,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha static char err_local[255]; /* only scene and mesh supported right now */ - if(idcode!=ID_SCE && idcode!=ID_ME) { + if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) { snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group); return false; } @@ -1018,6 +1019,16 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); } } + else if(idcode==ID_AC) { + /* Convert all actions */ + ID *action; + KX_Scene *kx_scene= m_currentScene; + + for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { + printf("ActionName: %s\n", action->name); + kx_scene->GetLogicManager()->RegisterActionName(action->name+2, action); + } + } else if(idcode==ID_SCE) { /* Merge all new linked in scene into the existing one */ ID *scene; @@ -1092,6 +1103,23 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) } } } + + /* Now unregister actions */ + { + GEN_Map &mapStringToActions = scene->GetLogicManager()->GetActionMap(); + + for(int i=0; iname+2; + mapStringToActions.remove(an); + i--; + } + } + } //scene->FreeTagged(); /* removed tagged objects and meshes*/ CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL}; @@ -1128,6 +1156,17 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) break; } } + + /* make sure action actuators are not referencing tagged actions */ + for (int act_idx=0; act_idxGetActuators().size(); act_idx++) + { + if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION)) + { + BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx]; + if(IS_TAGGED(act->GetAction())) + act->SetAction(NULL); + } + } } } } diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h index 9ddb62df361..f92b27f641a 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.h +++ b/source/gameengine/GameLogic/SCA_LogicManager.h @@ -127,6 +127,7 @@ public: void RegisterMeshName(const STR_String& meshname,void* mesh); void UnregisterMeshName(const STR_String& meshname,void* mesh); GEN_Map& GetMeshMap() { return m_mapStringToMeshes; }; + GEN_Map& GetActionMap() { return m_mapStringToActions; }; void RegisterActionName(const STR_String& actname,void* action); diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst index a7eb5635d0f..d3261f5747b 100644 --- a/source/gameengine/PyDoc/bge.logic.rst +++ b/source/gameengine/PyDoc/bge.logic.rst @@ -179,7 +179,7 @@ General functions :arg blend: The path to the blend file (or the name to use for the library if data is supplied) :type blend: string - :arg type: The datablock type (currently only "Scene" and "Mesh" are supported) + :arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported) :type type: string :arg data: Binary data from a blend file (optional) :type data: bytes -- cgit v1.2.3 From 6b8ca3ccdf7643002237fc59ef42ee1046ce2a70 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 9 Oct 2010 13:46:34 +0000 Subject: patch [#24178] bge.render.makeScreeshot - with help from Campbell(ideasman42) This patch brings back the old functionality from Blender 2.49. However we are forcing the format to be PNG only (as we had previously on blenderplayer). Note: If letterboxing is on, we are recording only the camera area of the canvas (cool hein?). Note2: I have a feeling that this is faster than what we had in 2.49 (which was really slow imo). Maybe it could be even faster if we disable PNG compression. Maybe an option for the future. * patch finalized and committed as part of the BlenderPRO 2010 - BGE development workshop :) * --- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 4 +- .../BlenderRoutines/KX_BlenderCanvas.cpp | 8 ++- source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 59 ++++++++++++++++++---- source/gameengine/BlenderRoutines/KX_BlenderGL.h | 2 +- 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 5a0522a9aa6..2bc24aab526 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -425,7 +425,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetAnimFrameRate(FPS); // the mainloop - printf("\nBlender Game Engine Started\n\n"); + printf("\nBlender Game Engine Started\n"); while (!exitrequested) { // first check if we want to exit @@ -472,7 +472,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c } } - printf("\nBlender Game Engine Finished\n\n"); + printf("Blender Game Engine Finished\n"); exitstring = ketsjiengine->GetExitString(); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index b04e951028d..f1e30ed4227 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -203,5 +203,11 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y) void KX_BlenderCanvas::MakeScreenShot(const char* filename) { -// BL_MakeScreenShot(m_ar, filename); + ScrArea area_dummy= {0}; + area_dummy.totrct.xmin = m_frame_rect.GetLeft(); + area_dummy.totrct.xmax = m_frame_rect.GetRight(); + area_dummy.totrct.ymin = m_frame_rect.GetBottom(); + area_dummy.totrct.ymax = m_frame_rect.GetTop(); + + BL_MakeScreenShot(&area_dummy, filename); } diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 55a687c0baa..662222bf990 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -49,6 +49,8 @@ extern "C" { #include "GL/glew.h" +#include "MEM_guardedalloc.h" + #include "BL_Material.h" // MAXTEX /* Data types encoding the game world: */ @@ -68,7 +70,11 @@ extern "C" { #include "BKE_bmfont.h" #include "BKE_image.h" +#include "BLI_path_util.h" + extern "C" { +#include "IMB_imbuf_types.h" +#include "IMB_imbuf.h" #include "WM_api.h" #include "WM_types.h" #include "wm_event_system.h" @@ -206,18 +212,53 @@ void BL_NormalMouse(wmWindow *win) } #define MAX_FILE_LENGTH 512 +/* get shot from frontbuffer sort of a copy from screendump.c */ +static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy) +{ + int x=0, y=0; + unsigned int *dumprect= NULL; + + x= curarea->totrct.xmin; + y= curarea->totrct.ymin; + *dumpsx= curarea->totrct.xmax-x; + *dumpsy= curarea->totrct.ymax-y; + + if (*dumpsx && *dumpsy) { + + dumprect= (unsigned int *)MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect"); + glReadBuffer(GL_FRONT); + glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect); + glFinish(); + glReadBuffer(GL_BACK); + } -void BL_MakeScreenShot(struct ARegion *ar, const char* filename) + return dumprect; +} + +/* based on screendump.c::screenshot_exec */ +void BL_MakeScreenShot(ScrArea *curarea, const char* filename) { - char copyfilename[MAX_FILE_LENGTH]; - strcpy(copyfilename,filename); + char path[MAX_FILE_LENGTH]; + strcpy(path,filename); - // filename read - only + unsigned int *dumprect; + int dumpsx, dumpsy; - /* XXX will need to change at some point */ - //XXX BIF_screendump(0); - - // write+read filename - //XXX write_screendump((char*) copyfilename); + dumprect= screenshot(curarea, &dumpsx, &dumpsy); + if(dumprect) { + ImBuf *ibuf; + BLI_path_abs(path, G.sce); + /* BKE_add_image_extension() checks for if extension was already set */ + BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */ + ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0, 0); + ibuf->rect= dumprect; + ibuf->ftype= PNG; + + IMB_saveiff(ibuf, path, IB_rect); + + ibuf->rect= NULL; + IMB_freeImBuf(ibuf); + MEM_freeN(dumprect); + } } diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h index 84d174cec68..9c5254dd661 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h @@ -41,7 +41,7 @@ void BL_SwapBuffers(struct wmWindow *win); void BL_warp_pointer(struct wmWindow *win,int x,int y); -void BL_MakeScreenShot(struct ARegion *ar, const char* filename); +void BL_MakeScreenShot(struct ScrArea *curarea, const char* filename); void BL_HideMouse(struct wmWindow *win); void BL_NormalMouse(struct wmWindow *win); -- cgit v1.2.3 From f72eef5de7fd109e9d71021adc0990b040b750b2 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 9 Oct 2010 21:17:14 +0000 Subject: COLLADA Import unit_settings to scene. Note: I use here RNA to do this, and I think I might slowly work on replacing low-level DNA usage with RNA where possible. --- source/blender/collada/DocumentImporter.cpp | 29 ++++++++++++++++++++++---- source/blender/collada/MeshImporter.cpp | 7 ++++--- source/blender/collada/MeshImporter.h | 4 +++- source/blender/collada/collada_internal.cpp | 32 ++++++++++++++++++++++++++--- source/blender/collada/collada_internal.h | 14 ++++++++++--- source/blender/makesrna/RNA_access.h | 4 ++++ 6 files changed, 76 insertions(+), 14 deletions(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 40e4d389b88..a406845c8a2 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -72,6 +72,8 @@ #include "DNA_camera_types.h" #include "DNA_lamp_types.h" +#include "RNA_access.h" + #include "MEM_guardedalloc.h" #include "DocumentImporter.h" @@ -130,7 +132,7 @@ public: /** Constructor. */ Writer(bContext *C, const char *filename) : mFilename(filename), mContext(C), armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)), - mesh_importer(&armature_importer, CTX_data_scene(C)), + mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)), anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C)) {} /** Destructor. */ @@ -172,8 +174,30 @@ public: { std::vector::iterator it; for (it = vscenes.begin(); it != vscenes.end(); it++) { + PointerRNA sceneptr, unit_settings; + PropertyRNA *system, *scale; // TODO: create a new scene except the selected - use current blender scene for it Scene *sce = CTX_data_scene(mContext); + + // for scene unit settings: system, scale_length + RNA_id_pointer_create(&sce->id, &sceneptr); + unit_settings = RNA_pointer_get(&sceneptr, "unit_settings"); + system = RNA_struct_find_property(&unit_settings, "system"); + scale = RNA_struct_find_property(&unit_settings, "scale_length"); + + switch(unit_converter.isMetricSystem()) { + case UnitConverter::Metric: + RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC); + break; + case UnitConverter::Imperial: + RNA_property_enum_set(&unit_settings, system, USER_UNIT_IMPERIAL); + break; + default: + RNA_property_enum_set(&unit_settings, system, USER_UNIT_NONE); + break; + } + RNA_property_float_set(&unit_settings, scale, unit_converter.getLinearMeter()); + const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { @@ -253,9 +277,6 @@ public: @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) { - // XXX take up_axis, unit into account - // COLLADAFW::FileInfo::Unit unit = asset->getUnit(); - // COLLADAFW::FileInfo::UpAxisType upAxis = asset->getUpAxisType(); unit_converter.read_asset(asset); return true; diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index df5136f1cb4..44ac310e353 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -323,8 +323,9 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) MVert *mvert; int i; - for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) + for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) { get_vector(mvert->co, pos, i); + } } int MeshImporter::triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector& tri) @@ -631,7 +632,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) } } - mat_prim_map[mp->getMaterialId()].push_back(prim); + mat_prim_map[mp->getMaterialId()].push_back(prim); } geom_uid_mat_mapping_map[mesh->getUniqueId()] = mat_prim_map; @@ -689,7 +690,7 @@ bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, return true; } -MeshImporter::MeshImporter(ArmatureImporter *arm, Scene *sce) : scene(sce), armature_importer(arm) {} +MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {} Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) { diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h index 1fa9ebfbabc..055c4798855 100644 --- a/source/blender/collada/MeshImporter.h +++ b/source/blender/collada/MeshImporter.h @@ -119,10 +119,12 @@ private: void get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i); bool flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count); + + UnitConverter *unitconverter; public: - MeshImporter(ArmatureImporter *arm, Scene *sce); + MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce); virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid); diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index 67ee4818f7e..6f401c1856f 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -28,12 +28,38 @@ UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} void UnitConverter::read_asset(const COLLADAFW::FileInfo* asset) { + unit = asset->getUnit(); + up_axis = asset->getUpAxisType(); } -// TODO -// convert vector vec from COLLADA format to Blender -void UnitConverter::convertVec3(float *vec) +UnitConverter::UnitSystem UnitConverter::isMetricSystem() { + switch(unit.getLinearUnitUnit()) { + case COLLADAFW::FileInfo::Unit::MILLIMETER: + case COLLADAFW::FileInfo::Unit::CENTIMETER: + case COLLADAFW::FileInfo::Unit::DECIMETER: + case COLLADAFW::FileInfo::Unit::METER: + case COLLADAFW::FileInfo::Unit::KILOMETER: + return UnitConverter::Metric; + case COLLADAFW::FileInfo::Unit::INCH: + case COLLADAFW::FileInfo::Unit::FOOT: + case COLLADAFW::FileInfo::Unit::YARD: + return UnitConverter::Imperial; + default: + return UnitConverter::None; + } +} + +float UnitConverter::getLinearMeter() +{ + return (float)unit.getLinearUnitMeter(); +} + +void UnitConverter::convertVector3(COLLADABU::Math::Vector3 &vec, float *v) +{ + v[0] = vec.x; + v[1] = vec.y; + v[2] = vec.z; } // TODO need also for angle conversion, time conversion... diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h index 1e3546263da..72b03a3d090 100644 --- a/source/blender/collada/collada_internal.h +++ b/source/blender/collada/collada_internal.h @@ -43,14 +43,22 @@ private: public: + enum UnitSystem { + None, + Metric, + Imperial + }; + // Initialize with Z_UP, since Blender uses right-handed, z-up UnitConverter(); void read_asset(const COLLADAFW::FileInfo* asset); - // TODO - // convert vector vec from COLLADA format to Blender - void convertVec3(float *vec); + void convertVector3(COLLADABU::Math::Vector3 &vec, float *v); + + UnitConverter::UnitSystem isMetricSystem(void); + + float getLinearMeter(void); // TODO need also for angle conversion, time conversion... diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index e454dda0ae6..ab1319653b8 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -834,7 +834,11 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in int RNA_string_length(PointerRNA *ptr, const char *name); void RNA_string_set(PointerRNA *ptr, const char *name, const char *value); +/** + * Retrieve the named property from PointerRNA. + */ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name); +/* Set the property name of PointerRNA ptr to ptr_value */ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value); void RNA_pointer_add(PointerRNA *ptr, const char *name); -- cgit v1.2.3 From d420d09da982e1a874ffe2b0612b8fdd0afc980e Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 9 Oct 2010 21:31:32 +0000 Subject: Fix compiling for MingW too. --- source/blender/collada/MeshImporter.cpp | 2 +- source/blender/collada/SkinInfo.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 44ac310e353..be7abc3ec4e 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -24,7 +24,7 @@ #include -#ifndef WIN32 +#if !defined(WIN32) || defined(FREE_WINDOWS) #include #endif diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index a3ac6a30c59..ba9451ecf84 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -24,7 +24,7 @@ #include -#ifndef WIN32 +#if !defined(WIN32) || defined(FREE_WINDOWS) #include #endif -- cgit v1.2.3 From f49fc58df63d42ab451380ea92e55b1265d14e4e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Oct 2010 07:01:56 +0000 Subject: enable building the game engine without bullet for scons & cmake --- CMakeLists.txt | 3 --- source/blender/blenkernel/intern/object.c | 3 ++- source/gameengine/CMakeLists.txt | 5 ++++- .../Converter/BL_BlenderDataConversion.cpp | 2 ++ source/gameengine/Converter/CMakeLists.txt | 4 ++++ source/gameengine/Converter/SConscript | 3 +++ .../gameengine/GameLogic/SCA_PythonController.cpp | 2 +- source/gameengine/Ketsji/CMakeLists.txt | 8 +++++-- .../Ketsji/KX_BulletPhysicsController.cpp | 2 +- .../gameengine/Ketsji/KX_BulletPhysicsController.h | 5 ++++- source/gameengine/Ketsji/KX_ConvertPhysicsObject.h | 13 ----------- .../gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 4 ++-- source/gameengine/Ketsji/KX_GameObject.cpp | 4 ++-- source/gameengine/Ketsji/KX_Light.cpp | 2 +- source/gameengine/Ketsji/KX_Scene.cpp | 25 ++++++++++++++++++---- source/gameengine/Ketsji/SConscript | 6 +++++- source/gameengine/Physics/Bullet/CMakeLists.txt | 4 ++++ source/gameengine/Physics/Bullet/SConscript | 3 +++ source/gameengine/SConscript | 4 +++- 19 files changed, 68 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ace8a771c5..b7d88ad0b47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,9 +126,6 @@ IF(APPLE) OPTION(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF) ENDIF(APPLE) -IF(NOT WITH_BULLET AND WITH_GAMEENGINE) - MESSAGE("WARNING: WITH_GAMEENGINE needs WITH_BULLET") -ENDIF(NOT WITH_BULLET AND WITH_GAMEENGINE) IF(NOT WITH_GAMEENGINE AND WITH_PLAYER) MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE") diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 0c437db335b..541e8e2b00e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1743,7 +1743,7 @@ int enable_cu_speed= 1; static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) { Curve *cu; - float q[4], vec[4], dir[3], quat[4], radius, x1, ctime; + float vec[4], dir[3], quat[4], radius, ctime; float timeoffs = 0.0, sf_orig = 0.0; unit_m4(mat); @@ -1795,6 +1795,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) if(cu->flag & CU_FOLLOW) { #if 0 + float x1, q[4]; vec_to_quat( quat,dir, ob->trackflag, ob->upflag); /* the tilt */ diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt index 7b58a2a6875..eea600cb0cb 100644 --- a/source/gameengine/CMakeLists.txt +++ b/source/gameengine/CMakeLists.txt @@ -37,7 +37,10 @@ ADD_SUBDIRECTORY(Physics/Dummy) ADD_SUBDIRECTORY(Rasterizer) ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer) ADD_SUBDIRECTORY(SceneGraph) -ADD_SUBDIRECTORY(Physics/Bullet) + +IF(WITH_BULLET) + ADD_SUBDIRECTORY(Physics/Bullet) +ENDIF(WITH_BULLET) IF(WITH_PYTHON) ADD_SUBDIRECTORY(VideoTexture) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index f9bca9a2cdd..69483aed1ec 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1766,9 +1766,11 @@ static KX_GameObject *gameobject_from_blenderobject( BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj, ob, meshobj); ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); +#ifdef USE_BULLET } else if (bHasSoftBody) { KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj); ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); +#endif } MT_Point3 min = MT_Point3(center) - MT_Vector3(extents); diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index c5b8128903b..87e413c3a44 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -69,4 +69,8 @@ ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_converter "${SRC}" "${INC}") diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index 7701d27730b..a276d1623df 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -35,4 +35,7 @@ else: if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 1f05846abe4..45f0684c02f 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -214,7 +214,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str)); Py_DECREF(value_str); - return false; + return NULL; } const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()"; diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index eaead261b2c..b128f33c6e4 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -51,13 +51,11 @@ SET(INC ../../../source/gameengine/Network ../../../source/gameengine/SceneGraph ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet ../../../source/gameengine/Network/LoopBackNetwork ../../../intern/audaspace/intern ../../../source/blender/misc ../../../source/blender/blenloader ../../../source/blender/gpu - ../../../extern/bullet2/src ../../../extern/glew/include ) @@ -79,4 +77,10 @@ IF(WITH_FFMPEG) ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) + LIST(APPEND INC ../../../extern/bullet2/src) + LIST(APPEND INC ../../../source/gameengine/Physics/Bullet ) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_ketsji "${SRC}" "${INC}") diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index 1b2ceae6560..c2fb21bf31a 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time) // return false; } -#endif //#ifdef USE_BULLET +#endif // USE_BULLET diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 48a3c98ff81..a3e8fafec1d 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -3,7 +3,9 @@ #include "KX_IPhysicsController.h" +#ifdef USE_BULLET #include "CcdPhysicsController.h" +#endif class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController { @@ -18,9 +20,10 @@ private: btCollisionShape* m_bulletChildShape; public: +#ifdef USE_BULLET KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound); virtual ~KX_BulletPhysicsController (); - +#endif /////////////////////////////////// // KX_IPhysicsController interface //////////////////////////////////// diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index ca20aa6b618..2bb3534bde7 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -29,19 +29,6 @@ #ifndef KX_CONVERTPHYSICSOBJECTS #define KX_CONVERTPHYSICSOBJECTS -/* These are defined by the build system... */ -//but the build system is broken, because it doesn't allow for 2 or more defines at once. -//Please leave Sumo _AND_ Bullet enabled -#define USE_BULLET - -//on visual studio 7/8, always enable BULLET for now -//you can have multiple physics engines running anyway, and -//the scons build system doesn't really support this at the moment. -//if you got troubles, just comment out USE_BULLET -#if 1300 <= _MSC_VER -#define USE_BULLET -#endif - class RAS_MeshObject; class KX_Scene; struct DerivedMesh; diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 061220ce0c1..1888e7cf7b8 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -38,7 +38,6 @@ #include "RAS_MeshObject.h" #include "KX_Scene.h" #include "SYS_System.h" -#include "BulletSoftBody/btSoftBody.h" #include "PHY_Pro.h" //todo cleanup #include "KX_ClientObjectInfo.h" @@ -56,6 +55,7 @@ extern "C"{ } #ifdef USE_BULLET +#include "BulletSoftBody/btSoftBody.h" #include "CcdPhysicsEnvironment.h" #include "CcdPhysicsController.h" @@ -561,4 +561,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro spc->ReplaceControllerShape(bm); return true; } -#endif +#endif // USE_BULLET diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 764691c379f..6d83284379e 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1574,11 +1574,11 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args) ) { return NULL; } - +#ifdef USE_BULLET /* gameobj and mesh can be NULL */ if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh)) Py_RETURN_TRUE; - +#endif Py_RETURN_FALSE; } diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index e282d7ac375..fdd325c46a1 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -180,7 +180,7 @@ GPULamp *KX_LightObject::GetGPULamp() if(m_glsl) return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject()); else - return false; + return NULL; } void KX_LightObject::Update() diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 863b73adc96..9e2545f41cc 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -82,7 +82,10 @@ #include "BL_ModifierDeformer.h" #include "BL_ShapeDeformer.h" #include "BL_DeformableGameObject.h" + +#ifdef USE_BULLET #include "KX_SoftBodyDeformer.h" +#endif // to get USE_BULLET! #include "KX_ConvertPhysicsObject.h" @@ -1163,11 +1166,13 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u ); newobj->SetDeformer(meshdeformer); } +#ifdef USE_BULLET else if (bHasSoftBody) { KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj); newobj->SetDeformer(softdeformer); } +#endif // release parent reference if its not being used if( releaseParent && parentobj) @@ -1177,10 +1182,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u gameobj->AddMeshUser(); } - + +#ifdef USE_BULLET if(use_phys) { /* update the new assigned mesh with the physics mesh */ KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh); } +#endif } KX_Camera* KX_Scene::FindCamera(KX_Camera* cam) @@ -1629,7 +1636,9 @@ double KX_Scene::getSuspendedDelta() return m_suspendeddelta; } +#ifdef USE_BULLET #include "KX_BulletPhysicsController.h" +#endif static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) { @@ -1644,16 +1653,19 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) } /* near sensors have physics controllers */ +#ifdef USE_BULLET KX_TouchSensor *touch_sensor = dynamic_cast(brick); if(touch_sensor) { touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } +#endif } +#ifdef USE_BULLET #include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); #include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); #include "KX_BulletPhysicsController.h" - +#endif static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from) { @@ -1713,7 +1725,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene if(sg->GetSGClientInfo() == from) { sg->SetSGClientInfo(to); } - +#ifdef USE_BULLET SGControllerList::iterator contit; SGControllerList& controllers = sg->GetSGControllerList(); for (contit = controllers.begin();contit!=controllers.end();++contit) @@ -1722,6 +1734,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene if (phys_ctrl) phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } +#endif // USE_BULLET } /* If the object is a light, update it's scene */ if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) @@ -1737,6 +1750,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene bool KX_Scene::MergeScene(KX_Scene *other) { +#ifdef USE_BULLET CcdPhysicsEnvironment *env= dynamic_cast(this->GetPhysicsEnvironment()); CcdPhysicsEnvironment *env_other= dynamic_cast(other->GetPhysicsEnvironment()); @@ -1746,6 +1760,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL)); return false; } +#endif // USE_BULLET if(GetSceneConverter() != other->GetSceneConverter()) { printf("KX_Scene::MergeScene: converters differ, aborting\n"); @@ -1788,9 +1803,11 @@ bool KX_Scene::MergeScene(KX_Scene *other) GetLightList()->MergeList(other->GetLightList()); other->GetLightList()->ReleaseAndRemoveAll(); +#ifdef USE_BULLET if(env) /* bullet scene? - dummy scenes dont need touching */ env->MergeEnvironment(env_other); - +#endif + /* merge logic */ { SCA_LogicManager *logicmgr= GetLogicManager(); diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 49e4528594f..6f06d0ff19c 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -16,7 +16,7 @@ incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/ incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include' incs += ' #source/blender/makesdna #source/blender/python #source/gameengine/Rasterizer' incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions #source/gameengine/Network' -incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #source/gameengine/Physics/Bullet' +incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common' incs += ' #source/gameengine/Physics/Dummy' incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu' @@ -43,4 +43,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + incs += ' #source/gameengine/Physics/Bullet' + env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index 95888967b78..ba6f3bef0db 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -46,4 +46,8 @@ SET(INC ${PYTHON_INC} ) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_bullet "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript index 6beb044671c..6cebe0638b0 100644 --- a/source/gameengine/Physics/Bullet/SConscript +++ b/source/gameengine/Physics/Bullet/SConscript @@ -30,4 +30,7 @@ else: if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/SConscript b/source/gameengine/SConscript index e7c9328688f..aebbf4d9fcf 100644 --- a/source/gameengine/SConscript +++ b/source/gameengine/SConscript @@ -14,7 +14,6 @@ SConscript(['BlenderRoutines/SConscript', 'Rasterizer/SConscript', 'Rasterizer/RAS_OpenGLRasterizer/SConscript', 'SceneGraph/SConscript', - 'Physics/Bullet/SConscript' ]) if env['WITH_BF_PYTHON']: @@ -22,3 +21,6 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_PLAYER']: SConscript(['GamePlayer/SConscript']) + +if env['WITH_BF_BULLET']: + SConscript(['Physics/Bullet/SConscript']) -- cgit v1.2.3 From a20843bf34e3f638016d1270d4c8b4d598f9cef8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Oct 2010 20:59:30 +0000 Subject: building without python works again for the BGE --- source/gameengine/Expressions/PyObjectPlus.h | 11 +++++++++++ source/gameengine/Ketsji/KX_PythonInit.cpp | 5 +++-- source/gameengine/Ketsji/KX_Scene.cpp | 5 ----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 625549a272e..b2688231a43 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -461,6 +461,7 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object #else // DISABLE_PYTHON +#ifdef WITH_CXX_GUARDEDALLOC #define Py_Header \ public: \ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); } \ @@ -471,6 +472,16 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); } \ void operator delete( void *mem ) { MEM_freeN(mem); } \ +#else // WITH_CXX_GUARDEDALLOC + +#define Py_Header \ + public: \ + +#define Py_HeaderPtr \ + public: \ + +#endif // WITH_CXX_GUARDEDALLOC + #endif diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 88993f20132..56ec61f9f4c 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -136,13 +136,14 @@ static RAS_ICanvas* gp_Canvas = NULL; static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = ""; static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save +static SCA_PythonKeyboard* gp_PythonKeyboard = NULL; +static SCA_PythonMouse* gp_PythonMouse = NULL; #endif // DISABLE_PYTHON static KX_Scene* gp_KetsjiScene = NULL; static KX_KetsjiEngine* gp_KetsjiEngine = NULL; static RAS_IRasterizer* gp_Rasterizer = NULL; -static SCA_PythonKeyboard* gp_PythonKeyboard = NULL; -static SCA_PythonMouse* gp_PythonMouse = NULL; + void KX_SetActiveScene(class KX_Scene* scene) { diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 9e2545f41cc..a30591d8da1 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -85,12 +85,7 @@ #ifdef USE_BULLET #include "KX_SoftBodyDeformer.h" -#endif - -// to get USE_BULLET! #include "KX_ConvertPhysicsObject.h" - -#ifdef USE_BULLET #include "CcdPhysicsEnvironment.h" #include "CcdPhysicsController.h" #endif -- cgit v1.2.3 From 52e6058bb4ee2916f440e7103e4067ec522a144e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Oct 2010 21:39:24 +0000 Subject: [#24204] Packing of image sequence does not work this isnt supported but at least display a warning. --- source/blender/blenkernel/intern/packedFile.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 919a724d1ec..5bbb3506a78 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -214,10 +214,17 @@ void packAll(Main *bmain, ReportList *reports) Image *ima; VFont *vf; bSound *sound; - - for(ima=bmain->image.first; ima; ima=ima->id.next) - if(ima->packedfile == NULL && ima->id.lib==NULL && ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) - ima->packedfile = newPackedFile(reports, ima->name); + + for(ima=bmain->image.first; ima; ima=ima->id.next) { + if(ima->packedfile == NULL && ima->id.lib==NULL) { + if(ima->source==IMA_SRC_FILE) { + ima->packedfile = newPackedFile(reports, ima->name); + } + else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { + BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2); + } + } + } for(vf=bmain->vfont.first; vf; vf=vf->id.next) if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "") != 0) -- cgit v1.2.3 From 1579c1a5c90219777e8291f39564739509c579d7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Oct 2010 22:15:48 +0000 Subject: weight-paint in solid draw mode would draw the wire twice, also change wire drawing to draw all edges and better visibility over yellow areas. --- source/blender/editors/space_view3d/drawobject.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d28813f7522..2206d744dc6 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2520,24 +2520,25 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D * rather then the shading, this is also forced in wire view */ GPU_enable_material(0, NULL); dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); - + bglPolygonOffset(rv3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better glEnable(GL_BLEND); - glColor4ub(196, 196, 196, 196); + glColor4ub(255, 255, 255, 96); glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x8888); + glLineStipple(1, 0xAAAA); - dm->drawEdges(dm, 1, 0); + dm->drawEdges(dm, 1, 1); bglPolygonOffset(rv3d->dist, 0.0); glDepthMask(1); glDisable(GL_LINE_STIPPLE); GPU_disable_material(); - - + + /* since we already draw wire as wp guide, dont draw over the top */ + draw_wire= 0; } else { Paint *p; -- cgit v1.2.3 From bf4075236fe2aa011d7bab26358e55883ffa0248 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Oct 2010 23:11:34 +0000 Subject: bugfix [#23412] Weightpaint and rotate around bones fixed by allowing an unselected armature to have its pose bones used in weightpaint mode. --- .../blender/editors/transform/transform_conversions.c | 18 +++++++++--------- source/blender/makesdna/DNA_scene_types.h | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 01404603b86..0c0912a4ad6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5318,19 +5318,19 @@ void createTransData(bContext *C, TransInfo *t) createTransPose(C, t, ob); } else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { - /* exception, we look for the one selected armature */ - CTX_DATA_BEGIN(C, Object*, ob_armature, selected_objects) - { - if(ob_armature->type==OB_ARMATURE) - { - if((ob_armature->mode & OB_MODE_POSE) && ob_armature == modifiers_isDeformedByArmature(ob)) - { + /* important that ob_armature can be set even when its not selected [#23412] + * lines below just check is also visible */ + Object *ob_armature= modifiers_isDeformedByArmature(ob); + if(ob_armature && ob_armature->mode & OB_MODE_POSE) { + Base *base_arm= object_in_scene(ob_armature, t->scene); + if(base_arm) { + View3D *v3d = t->view; + if(BASE_VISIBLE(v3d, base_arm)) { createTransPose(C, t, ob_armature); - break; } } + } - CTX_DATA_END; } else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) { diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index cc5d256615e..82eecca743c 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1038,6 +1038,7 @@ typedef struct Scene { #define TESTBASELIB_BGMODE(v3d, scene, base) ( ((base)->flag & SELECT) && ((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)) #define BASE_EDITABLE_BGMODE(v3d, scene, base) (((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)) #define BASE_SELECTABLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0) +#define BASE_VISIBLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & OB_RESTRICT_VIEW)==0) #define FIRSTBASE scene->base.first #define LASTBASE scene->base.last #define BASACT (scene->basact) -- cgit v1.2.3 From 159cf6e5ddf27f37f0e56d172a16b018d9c037ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Oct 2010 23:37:25 +0000 Subject: bugfix [#24214] F6 "last operator" panel repeatable segmentation fault --- source/blender/editors/interface/interface_handlers.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6d8c368db3f..654a089dafe 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5526,16 +5526,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) || ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP)) ) { - if(ui_but_first(block)->type & BUT) + if((bt= ui_but_first(block)) && (bt->type & BUT)) { bt= ui_but_last(block); - else - bt= ui_but_first(block); + } + else { + /* keep ui_but_first() */ + } } else { - if(ui_but_first(block)->type & BUT) - bt= ui_but_first(block); - else + if((bt= ui_but_first(block)) && (bt->type & BUT)) { + /* keep ui_but_first() */ + } + else { bt= ui_but_last(block); + } } if(bt) -- cgit v1.2.3 From 4ad2e4a3830535d62aadd035bd5a714bca20a816 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 00:15:49 +0000 Subject: [#24045] heat weight fails on specific geometry. The error for heat weighting was only being printed in the console, while the problem remains at least a warning is now given that there was a problem calculating the heat weight. also fixed a memory leak from the mesh octree not being freed after assigning vertex groups. (ModNode error) --- source/blender/editors/armature/editarmature.c | 18 +++++++++++++----- source/blender/editors/armature/meshlaplacian.c | 7 ++++--- source/blender/editors/armature/meshlaplacian.h | 2 +- source/blender/editors/include/ED_armature.h | 3 ++- source/blender/editors/object/object_relations.c | 6 +++--- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 26a89c4de02..49c3ac06b94 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4723,7 +4723,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i } } -void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int mirror) +void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror) { /* This functions implements the automatic computation of vertex group * weights, either through envelopes or using a heat equilibrium. @@ -4870,14 +4870,22 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* compute the weights based on gathered vertices and bones */ if (heat) { + const char *error= NULL; heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip, - root, tip, selected); + root, tip, selected, &error); + + if(error) { + BKE_report(reports, RPT_WARNING, error); + } } else { envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist, dgroupflip, root, tip, selected, mat4_to_scale(par->obmat)); } - + + /* only generated in some cases but can call anyway */ + mesh_octree_table(ob, NULL, NULL, 'e'); + /* free the memory allocated */ MEM_freeN(bonelist); MEM_freeN(dgrouplist); @@ -4888,7 +4896,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m MEM_freeN(verts); } -void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mode, int mirror) +void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, int mirror) { /* Lets try to create some vertex groups * based on the bones of the parent armature. @@ -4909,7 +4917,7 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod * that are populated with the vertices for which the * bone is closest. */ - add_verts_to_dgroups(scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); + add_verts_to_dgroups(reports, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); } } /* ************* Clear Pose *****************************/ diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 84b02b4796a..38372850ff8 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -642,13 +642,15 @@ static float heat_limit_weight(float weight) return weight; } -void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected) +void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, const char **err_str) { LaplacianSystem *sys; MFace *mface; float solution, weight; int *vertsflipped = NULL, *mask= NULL; int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0; + + *err_str= NULL; /* count triangles and create mask */ if(me->editflag & ME_EDIT_PAINT_MASK) @@ -760,8 +762,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, } } else if(!thrownerror) { - error("Bone Heat Weighting:" - " failed to find solution for one or more bones"); + *err_str= "Bone Heat Weighting: failed to find solution for one or more bones"; thrownerror= 1; break; } diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index 640eb33c945..cba43043e8d 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -66,7 +66,7 @@ float laplacian_system_get_solution(int v); void heat_bone_weighting(struct Object *ob, struct Mesh *me, float (*verts)[3], int numbones, struct bDeformGroup **dgrouplist, struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], - int *selected); + int *selected, const char **error); #ifdef RIGID_DEFORM /* As-Rigid-As-Possible Deformation */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 809b86d65f3..e91bafc9056 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -42,6 +42,7 @@ struct ListBase; struct MeshDeformModifierData; struct Object; struct RegionView3D; +struct ReportList; struct Scene; struct SK_Sketch; struct View3D; @@ -132,7 +133,7 @@ void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); #define ARM_GROUPS_ENVELOPE 2 #define ARM_GROUPS_AUTO 3 -void create_vgroups_from_armature(struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); +void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode); void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 11175958fba..6a107b8e204 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -641,11 +641,11 @@ static int parent_set_exec(bContext *C, wmOperator *op) } else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) { if(partype == PAR_ARMATURE_NAME) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_NAME, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_NAME, 0); else if(partype == PAR_ARMATURE_ENVELOPE) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_ENVELOPE, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0); else if(partype == PAR_ARMATURE_AUTO) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_AUTO, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_AUTO, 0); /* get corrected inverse */ ob->partype= PAROBJECT; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 399ba535e57..f033c2aac83 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1971,7 +1971,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op) Mesh *me= ob->data; int type= RNA_enum_get(op->ptr, "type"); - create_vgroups_from_armature(scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X)); + create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X)); DAG_id_flush_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, me); -- cgit v1.2.3 From db4a205fa0343f03eae4020f1beb3dcea4469337 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 02:05:44 +0000 Subject: bugfix [#24190] Extrude Faces called from Alt+ E_key menu don't works well --- release/scripts/ui/space_view3d.py | 81 ++++++++------------------------------ 1 file changed, 17 insertions(+), 64 deletions(-) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 5bd809fea7e..9299362cc05 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1394,82 +1394,35 @@ class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): bl_label = "Extrude" + _extrude_funcs = { \ + "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"), + "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"), + "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"), + "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"), + } + @staticmethod def extrude_options(context): mesh = context.object.data select_mode = context.tool_settings.mesh_select_mode - totface = mesh.total_face_sel - totedge = mesh.total_edge_sel - totvert = mesh.total_vert_sel - - # the following is dependent on selection modes - # we don't really want that -# if select_mode[0]: # vert -# if totvert == 0: -# return () -# elif totvert == 1: -# return (3,) -# elif totedge == 0: -# return (3,) -# elif totface == 0: -# return (2, 3) -# elif totface == 1: -# return (0, 2, 3) -# else: -# return (0, 1, 2, 3) -# elif select_mode[1]: # edge -# if totedge == 0: -# return () -# elif totedge == 1: -# return (2,) -# elif totface == 0: -# return (2,) -# elif totface == 1: -# return (0, 2) -# else: -# return (0, 1, 2) -# elif select_mode[2]: # face -# if totface == 0: -# return () -# elif totface == 1: -# return (0,) -# else: -# return (0, 1) - - if totvert == 0: - return () - elif totedge == 0: - return (0, 3) - elif totface == 0: - return (0, 2, 3) - else: - return (0, 1, 2, 3) + menu = [] + if mesh.total_face_sel: + menu += ["REGION", "FACE"] + if mesh.total_edge_sel and (select_mode[0] or select_mode[1]): + menu += ["EDGE"] + if mesh.total_vert_sel and select_mode[0]: + menu += ["VERT"] # should never get here - return () + return menu def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - def region_menu(): - layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region") - - def face_menu(): - layout.operator("mesh.extrude_faces_move", text="Individual Faces") - - def edge_menu(): - layout.operator("mesh.extrude_edges_move", text="Edges Only") - - def vert_menu(): - layout.operator("mesh.extrude_vertices_move", text="Vertices Only") - - menu_funcs = region_menu, face_menu, edge_menu, vert_menu - - for i in self.extrude_options(context): - func = menu_funcs[i] - func() + for menu_id in self.extrude_options(context): + self._extrude_funcs[menu_id](layout) class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): -- cgit v1.2.3 From fab8deb811d0e3cd36b379fd795d3191282f7825 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 04:00:33 +0000 Subject: bugfix [#20761] Bones/Armature: "Inherit Scale" doesn't work if "Inherit Rotation" is disabled --- source/blender/blenkernel/intern/armature.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 2e760f53155..f1f9fe08717 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2239,13 +2239,28 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti offs_bone[3][1]+= parbone->length; /* Compose the matrix for this bone */ - if(bone->flag & BONE_HINGE) { // uses restposition rotation, but actual position + if((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) { // uses restposition rotation, but actual position float tmat[4][4]; - /* the rotation of the parent restposition */ copy_m4_m4(tmat, parbone->arm_mat); mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL); } + else if(bone->flag & BONE_HINGE) { // same as above but apply parent scale + float tmat[4][4]; + + /* apply the parent matrix scale */ + float tsmat[4][4], tscale[3]; + + /* the rotation of the parent restposition */ + copy_m4_m4(tmat, parbone->arm_mat); + + /* extract the scale of the parent matrix */ + mat4_to_size(tscale, parchan->pose_mat); + size_to_mat4(tsmat, tscale); + mul_m4_m4m4(tmat, tmat, tsmat); + + mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL); + } else if(bone->flag & BONE_NO_SCALE) { float orthmat[4][4]; -- cgit v1.2.3 From 3d3d9bf23509e372843ae23f0c9f0fff2c3db7b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 04:52:40 +0000 Subject: bones were not being metaclassed properly so that custom rna prop's couldn't be set. --- release/scripts/modules/bpy_types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 261165d8830..6ecb8a2e207 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -258,15 +258,15 @@ class _GenericBone: return bones -class PoseBone(StructRNA, _GenericBone): +class PoseBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp): __slots__ = () -class Bone(StructRNA, _GenericBone): +class Bone(StructRNA, _GenericBone, metaclass=StructMetaIDProp): __slots__ = () -class EditBone(StructRNA, _GenericBone): +class EditBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp): __slots__ = () def align_orientation(self, other): -- cgit v1.2.3 From 67a1a871a9be8b62344efc3ba1c312dce535da09 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 11 Oct 2010 08:03:28 +0000 Subject: Revert r32330 and reopening #24184. The change breaks input where modifier key is used to create a character. --- source/blender/editors/space_console/console_ops.c | 8 ++++++-- source/blender/editors/space_text/text_ops.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 4e50b589bc6..a84a592279e 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -407,9 +407,13 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; + /* XXX NOTE: Reverting this change from r32330, since it + * breaks input for cases where modifierkey is needed to + * create characters. + */ /* if alt/ctrl/super are pressed pass through */ - if(event->alt || event->ctrl || event->oskey) - return OPERATOR_PASS_THROUGH; + //if(event->alt || event->ctrl || event->oskey) + // return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e3bf390dba8..f6a4488966d 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2323,9 +2323,13 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; + /* XXX NOTE: Reverting this change from r32330, since it + * breaks input for cases where modifierkey is needed to + * create characters. + */ /* if alt/ctrl/super are pressed pass through */ - if(event->alt || event->ctrl || event->oskey) - return OPERATOR_PASS_THROUGH; + //if(event->alt || event->ctrl || event->oskey) + // return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); } -- cgit v1.2.3 From 7ab02f1ec17b4a48aedb2ab4ec43d0fe2d62c565 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 11 Oct 2010 09:02:19 +0000 Subject: Fix for [#24195] Cloth modifier doesn't work after changing subsurf on the object * Cloth has to reset itself properly on vertex count changes as it can be after a constructive modifier (unlike softbody) --- source/blender/blenkernel/intern/cloth.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index be1552a882d..3f47676d7fd 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -446,7 +446,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return dm; } - if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)) + if(clmd->sim_parms->reset + || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) + || (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts)) { clmd->sim_parms->reset = 0; cache->flag |= PTCACHE_OUTDATED; @@ -457,17 +459,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return result; } - /* verify we still have the same number of vertices, if not do nothing. - * note that this should only happen if the number of vertices changes - * during an animation due to a preceding modifier, this should not - * happen because of object changes! */ - if(clmd->clothObject) { - if(result->getNumVerts(result) != clmd->clothObject->numverts) { - BKE_ptcache_invalidate(cache); - return result; - } - } - // unused in the moment, calculated separately in implicit.c clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame; -- cgit v1.2.3 From 737bc66f2aee939dc98adb4d6e9610a99c09059a Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 11 Oct 2010 09:52:25 +0000 Subject: Add note about Inv Quad falloff of lamp that there seems to be a hack in use. --- source/blender/render/intern/source/shadeoutput.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 81de553b209..4142522e003 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1141,6 +1141,11 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) visifac = lar->dist/(lar->dist + dist[0]); break; case LA_FALLOFF_INVSQUARE: + /* NOTE: This seems to be a hack since commit r12045 says this + * option is similar to old Quad, but with slight changes. + * Correct inv square would be (which would be old Quad): + * visifac = lar->distkw / (lar->distkw + dist[0]*dist[0]); + */ visifac = lar->dist / (lar->dist + dist[0]*dist[0]); break; case LA_FALLOFF_SLIDERS: -- cgit v1.2.3 From e444c777145ccf297bc00f8e4690b78ed4ea85c9 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 11 Oct 2010 10:40:34 +0000 Subject: Fix for [#20064] Cloth simulation doesn't stop when marker is set back to frame 1 after exiting mesh edit. * First frame was dropped some times when animation was running because clicking "go to start/end frame" changed the current frame directly. * Now only the animtimer changes the frame and clicking the "go to" queues the next frame for animtimer. --- source/blender/editors/include/ED_screen_types.h | 3 ++ source/blender/editors/screen/screen_ops.c | 40 +++++++++++++++++++----- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index c5abd5465d7..18d6a1a48cc 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -38,6 +38,7 @@ typedef struct ScreenAnimData { short refresh; short flag; /* flags for playback */ int sfra; /* frame that playback was started from */ + int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */ } ScreenAnimData; /* for animplayer */ @@ -50,6 +51,8 @@ enum { ANIMPLAY_FLAG_SYNC = (1<<2), /* don't drop frames (and ignore SCE_FRAME_DROP flag) */ ANIMPLAY_FLAG_NO_SYNC = (1<<3), + /* use nextfra at next timer update */ + ANIMPLAY_FLAG_USE_NEXT_FRAME, }; /* ----------------------------------------------------- */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 613c8bc0178..584112ccacd 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1553,15 +1553,32 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) static int frame_jump_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - - if (RNA_boolean_get(op->ptr, "end")) - CFRA= PEFRA; - else - CFRA= PSFRA; - - sound_seek_scene(C); + wmTimer *animtimer= CTX_wm_screen(C)->animtimer; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + /* Don't change CFRA directly if animtimer is running as this can cause + * first/last frame not to be actually shown (bad since for example physics + * simulations aren't reset properly). + */ + if(animtimer) { + ScreenAnimData *sad = animtimer->customdata; + + sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME; + + if (RNA_boolean_get(op->ptr, "end")) + sad->nextfra= PEFRA; + else + sad->nextfra= PSFRA; + } + else { + if (RNA_boolean_get(op->ptr, "end")) + CFRA= PEFRA; + else + CFRA= PSFRA; + + sound_seek_scene(C); + + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + } return OPERATOR_FINISHED; } @@ -2513,6 +2530,13 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) } } } + + /* next frame overriden by user action (pressed jump to first/last frame) */ + if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) { + scene->r.cfra = sad->nextfra; + sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME; + sad->flag |= ANIMPLAY_FLAG_JUMPED; + } if (sad->flag & ANIMPLAY_FLAG_JUMPED) sound_seek_scene(C); -- cgit v1.2.3 From 4814ffa07bbc8b55c60e540e7db70a18b2f3e992 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 11 Oct 2010 10:47:20 +0000 Subject: BGE object.life - gives you the life countdown for temporary objects. Whenever using AddObject actuator, this feature gives you control over morbid events (a.k.a. trigger events before the object ends). Demo file here: http://blenderecia.orgfree.com/blender/tmp/cube_life.blend Feature implemented as part of the BGE development workshop in BlenderPRO 2010 - Fortaleza, Brazil --- source/gameengine/Ketsji/KX_GameObject.cpp | 14 ++++++++++++++ source/gameengine/Ketsji/KX_GameObject.h | 1 + source/gameengine/Ketsji/KX_Scene.cpp | 2 ++ 3 files changed, 17 insertions(+) diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 6d83284379e..bbb17cd1df9 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1496,6 +1496,7 @@ PyMethodDef KX_GameObject::Methods[] = { PyAttributeDef KX_GameObject::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("name", KX_GameObject, pyattr_get_name), KX_PYATTRIBUTE_RO_FUNCTION("parent", KX_GameObject, pyattr_get_parent), + KX_PYATTRIBUTE_RO_FUNCTION("life", KX_GameObject, pyattr_get_life), KX_PYATTRIBUTE_RW_FUNCTION("mass", KX_GameObject, pyattr_get_mass, pyattr_set_mass), KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMin", KX_GameObject, pyattr_get_lin_vel_min, pyattr_set_lin_vel_min), KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMax", KX_GameObject, pyattr_get_lin_vel_max, pyattr_set_lin_vel_max), @@ -1787,6 +1788,19 @@ PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE Py_RETURN_NONE; } +PyObject* KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_GameObject* self= static_cast(self_v); + + CValue *life = self->GetProperty("::timebomb"); + if (life) + // this convert the timebomb seconds to frames, hard coded 50.0 (assuming 50fps) + // value hardcoded in KX_Scene::AddReplicaObject() + return PyFloat_FromDouble(life->GetNumber() * 50.0); + else + Py_RETURN_NONE; +} + PyObject* KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_GameObject* self= static_cast(self_v); diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 524c061b4d5..14587d25c7f 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -856,6 +856,7 @@ public: static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index a30591d8da1..3d7fcb25f2b 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -812,6 +812,8 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, // add a timebomb to this object // for now, convert between so called frames and realtime m_tempObjectList->Add(replica->AddRef()); + // this convert the life from frames to sort-of seconds, hard coded 0.02 that assumes we have 50 frames per second + // if you change this value, make sure you change it in KX_GameObject::pyattr_get_life property too CValue *fval = new CFloatValue(lifespan*0.02); replica->SetProperty("::timebomb",fval); fval->Release(); -- cgit v1.2.3 From 8ec87bb45f39cc4d8b667d8a474bcdc2b997d83b Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 11 Oct 2010 12:38:52 +0000 Subject: COLLADA Export unit system and scale instead of hard-coded 1 decimeter. --- source/blender/collada/DocumentExporter.cpp | 55 +++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index cbcb3984018..9062bd4ba9f 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -69,6 +69,8 @@ extern char build_rev[]; #include "BLI_string.h" #include "BLI_listbase.h" +#include "RNA_access.h" + #include "COLLADASWAsset.h" #include "COLLADASWLibraryVisualScenes.h" #include "COLLADASWNode.h" @@ -901,19 +903,66 @@ protected: void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) { + PointerRNA sceneptr, unit_settings; + PropertyRNA *system, *scale; + clear_global_id_map(); COLLADABU::NativeString native_filename = COLLADABU::NativeString(std::string(filename)); COLLADASW::StreamWriter sw(native_filename); - // open + // open sw.startDocument(); // COLLADASW::Asset asset(&sw); - // XXX ask blender devs about this? - asset.setUnit("decimetre", 0.1); + + RNA_id_pointer_create(&(sce->id), &sceneptr); + unit_settings = RNA_pointer_get(&sceneptr, "unit_settings"); + system = RNA_struct_find_property(&unit_settings, "system"); + //scale = RNA_struct_find_property(&unit_settings, "scale_length"); + + std::string unitname = "meter"; + float linearmeasure = 1.0f; + + linearmeasure = RNA_float_get(&unit_settings, "scale_length"); + + switch(RNA_property_enum_get(&unit_settings, system)) { + case USER_UNIT_NONE: + case USER_UNIT_METRIC: + if(linearmeasure == 0.001f) { + unitname = "millimeter"; + } + else if(linearmeasure == 0.01f) { + unitname = "centimeter"; + } + else if(linearmeasure == 0.1f) { + unitname = "decimeter"; + } + else if(linearmeasure == 1.0f) { + unitname = "meter"; + } + else if(linearmeasure == 1000.0f) { + unitname = "kilometer"; + } + break; + case USER_UNIT_IMPERIAL: + if(linearmeasure == 0.0254f) { + unitname = "inch"; + } + else if(linearmeasure == 0.3048f) { + unitname = "foot"; + } + else if(linearmeasure == 0.9144f) { + unitname = "yard"; + } + break; + default: + break; + } + + asset.setUnit(unitname, linearmeasure); asset.setUpAxisType(COLLADASW::Asset::Z_UP); // TODO: need an Author field in userpref if(strlen(U.author) > 0) { -- cgit v1.2.3 From 682740e7aaa21326103c35fb963d399b8de1497e Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 11 Oct 2010 18:47:28 +0000 Subject: make file update for recent bge.render.makeScreenshot commit --- source/gameengine/BlenderRoutines/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile index 3d0f5344c74..cc0c6cf11dd 100644 --- a/source/gameengine/BlenderRoutines/Makefile +++ b/source/gameengine/BlenderRoutines/Makefile @@ -41,6 +41,8 @@ CPPFLAGS += -I$(NAN_MOTO)/include CPPFLAGS += -I$(NAN_GLEW)/include CPPFLAGS += -I$(OPENGL_HEADERS) CPPFLAGS += -I$(NAN_AUDASPACE)/include +# path to the guarded memory allocator +CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include # because of kernel dependency on makesdna CPPFLAGS += -I../../blender/makesdna CPPFLAGS += -I../../blender/editors/include -- cgit v1.2.3 From 9fa74e5c59b2b1660ca1316c4c0e607faa522f18 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 11 Oct 2010 18:53:11 +0000 Subject: Fix #24215: Bad shorcut indication for Bezier curve handles. All existing handle type manipulation hotkeys replaced with unified V-menu where you could directoly set type you need. --- release/scripts/ui/space_info.py | 12 ++++++++++++ source/blender/editors/curve/curve_ops.c | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index bd33153d017..3fdd083bfaa 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -219,6 +219,18 @@ class INFO_MT_surface_add(bpy.types.Menu): layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere") layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus") +class INFO_MT_curve_handle_type_set(bpy.types.Menu): + bl_idname = "INFO_MT_curve_handle_type_set" + bl_label = "Handle Type" + + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("curve.handle_type_set", text="Automatic").type = "AUTOMATIC" + layout.operator("curve.handle_type_set", text="Vector").type = "VECTOR" + layout.operator("curve.handle_type_set", text="Align").type = "ALIGN" + layout.operator("curve.handle_type_set", text="Free Align").type = "FREE_ALIGN" + class INFO_MT_armature_add(bpy.types.Menu): bl_idname = "INFO_MT_armature_add" diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 4558827c619..80582c7f1b0 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -194,6 +194,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) keymap->poll= ED_operator_editsurfcurve; WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_menu(keymap, "INFO_MT_curve_handle_type_set", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0); @@ -214,9 +215,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2); WM_keymap_add_item(keymap, "CURVE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); -- cgit v1.2.3 From b0b7354d5ce3d57fac9ff5b263b860cb249b9b44 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 20:53:20 +0000 Subject: [#23709] Blur node on Flat blurs even at 0 by 0 pixel spread skip blur x/y when either is set to zero. --- source/blender/nodes/intern/CMP_nodes/CMP_blur.c | 164 ++++++++++++----------- 1 file changed, 87 insertions(+), 77 deletions(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index eb8b079f341..257b8354ea9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -93,105 +93,115 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca int x, y, pix= img->type; int i, bigstep; float *src, *dest; - + /* helper image */ work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */ - - /* horizontal */ - rad = scale*(float)nbd->sizex; - if(rad>imgx/2) - rad= imgx/2; - else if(rad<1) - rad= 1; - gausstab= make_gausstab(nbd->filtertype, rad); - gausstabcent= gausstab+rad; - - for (y = 0; y < imgy; y++) { - float *srcd= img->rect + pix*(y*img->x); + /* horizontal */ + if(nbd->sizex == 0) { + memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy); + } + else { + rad = scale*(float)nbd->sizex; + if(rad>imgx/2) + rad= imgx/2; + else if(rad<1) + rad= 1; - dest = work->rect + pix*(y * img->x); + gausstab= make_gausstab(nbd->filtertype, rad); + gausstabcent= gausstab+rad; - for (x = 0; x < imgx ; x++) { - int minr= x-rad<0?-x:-rad; - int maxr= x+rad>imgx?imgx-x:rad; + for (y = 0; y < imgy; y++) { + float *srcd= img->rect + pix*(y*img->x); - src= srcd + pix*(x+minr); + dest = work->rect + pix*(y * img->x); - sum= gval = rval= bval= aval= 0.0f; - for (i= minr; i < maxr; i++) { - val= gausstabcent[i]; - sum+= val; - rval += val * (*src++); + for (x = 0; x < imgx ; x++) { + int minr= x-rad<0?-x:-rad; + int maxr= x+rad>imgx?imgx-x:rad; + + src= srcd + pix*(x+minr); + + sum= gval = rval= bval= aval= 0.0f; + for (i= minr; i < maxr; i++) { + val= gausstabcent[i]; + sum+= val; + rval += val * (*src++); + if(pix==4) { + gval += val * (*src++); + bval += val * (*src++); + aval += val * (*src++); + } + } + sum= 1.0f/sum; + *dest++ = rval*sum; if(pix==4) { - gval += val * (*src++); - bval += val * (*src++); - aval += val * (*src++); + *dest++ = gval*sum; + *dest++ = bval*sum; + *dest++ = aval*sum; } } - sum= 1.0f/sum; - *dest++ = rval*sum; - if(pix==4) { - *dest++ = gval*sum; - *dest++ = bval*sum; - *dest++ = aval*sum; - } + if(node->exec & NODE_BREAK) + break; } - if(node->exec & NODE_BREAK) - break; + + /* vertical */ + MEM_freeN(gausstab); } - /* vertical */ - MEM_freeN(gausstab); - - rad = scale*(float)nbd->sizey; - if(rad>imgy/2) - rad= imgy/2; - else if(rad<1) - rad= 1; - - gausstab= make_gausstab(nbd->filtertype, rad); - gausstabcent= gausstab+rad; - - bigstep = pix*imgx; - for (x = 0; x < imgx; x++) { - float *srcd= work->rect + pix*x; - - dest = new->rect + pix*x; + if(nbd->sizey == 0) { + memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy); + } + else { + rad = scale*(float)nbd->sizey; + if(rad>imgy/2) + rad= imgy/2; + else if(rad<1) + rad= 1; + + gausstab= make_gausstab(nbd->filtertype, rad); + gausstabcent= gausstab+rad; - for (y = 0; y < imgy ; y++) { - int minr= y-rad<0?-y:-rad; - int maxr= y+rad>imgy?imgy-y:rad; + bigstep = pix*imgx; + for (x = 0; x < imgx; x++) { + float *srcd= work->rect + pix*x; - src= srcd + bigstep*(y+minr); + dest = new->rect + pix*x; - sum= gval = rval= bval= aval= 0.0f; - for (i= minr; i < maxr; i++) { - val= gausstabcent[i]; - sum+= val; - rval += val * src[0]; + for (y = 0; y < imgy ; y++) { + int minr= y-rad<0?-y:-rad; + int maxr= y+rad>imgy?imgy-y:rad; + + src= srcd + bigstep*(y+minr); + + sum= gval = rval= bval= aval= 0.0f; + for (i= minr; i < maxr; i++) { + val= gausstabcent[i]; + sum+= val; + rval += val * src[0]; + if(pix==4) { + gval += val * src[1]; + bval += val * src[2]; + aval += val * src[3]; + } + src += bigstep; + } + sum= 1.0f/sum; + dest[0] = rval*sum; if(pix==4) { - gval += val * src[1]; - bval += val * src[2]; - aval += val * src[3]; + dest[1] = gval*sum; + dest[2] = bval*sum; + dest[3] = aval*sum; } - src += bigstep; - } - sum= 1.0f/sum; - dest[0] = rval*sum; - if(pix==4) { - dest[1] = gval*sum; - dest[2] = bval*sum; - dest[3] = aval*sum; + dest+= bigstep; } - dest+= bigstep; + if(node->exec & NODE_BREAK) + break; } - if(node->exec & NODE_BREAK) - break; + MEM_freeN(gausstab); } - + free_compbuf(work); - MEM_freeN(gausstab); } /* reference has to be mapped 0-1, and equal in size */ -- cgit v1.2.3 From 3a369128b43a9d19846151de8a37e8a07ca2f423 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 11 Oct 2010 20:55:05 +0000 Subject: BGE Bugfix for [#22371] Alpha Planes affecting 2DFilters disabling GL_Blend at the 2dfilter drawing routine makes the trick here. there is not a clear function invoked before the 2dfilter drawing routine. Therefore I found better to disable alpha blending while we are setting the other OpenGl attributes/matrixes. We are not re-enabling GL_BLEND after we disable it. We could and it wouldn't hurt but I can't see why to. open to suggestions here of course. --- source/gameengine/Rasterizer/RAS_2DFilterManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index 4527850a8e9..0c16d6a29c2 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -431,6 +431,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glViewport(0,0, texturewidth, textureheight); glDisable(GL_DEPTH_TEST); + // if the last rendered face had alpha add it would messes with the color of the plane we apply 2DFilter to + glDisable(GL_BLEND); glPushMatrix(); //GL_MODELVIEW glLoadIdentity(); // GL_MODELVIEW glMatrixMode(GL_TEXTURE); -- cgit v1.2.3 From 544b3178f92618f0b5f450cd18ef9195556acd9f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 21:08:26 +0000 Subject: bugfix [#24225] Blur Node ignores gamma option when size has input. --- source/blender/nodes/intern/CMP_nodes/CMP_blur.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index 257b8354ea9..894cc20e999 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -582,7 +582,11 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN nbd->sizey= (int)(nbd->percenty*nbd->image_in_height); } - if (((NodeBlurData *)node->storage)->filtertype == R_FILTER_FAST_GAUSS) { + if (nbd->sizex==0 && nbd->sizey==0) { + new= pass_on_compbuf(img); + out[0]->data= new; + } + else if (nbd->filtertype == R_FILTER_FAST_GAUSS) { CompBuf *new, *img = in[0]->data; /*from eeshlo's original patch, removed to fit in with the existing blur node */ /*const float sx = in[1]->vec[0], sy = in[2]->vec[0];*/ @@ -622,6 +626,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN /* if fac input, we do it different */ if(in[1]->data) { + CompBuf *gammabuf; /* make output size of input image */ new= alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */ @@ -630,7 +635,18 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new->xof = img->xof; new->yof = img->yof; - blur_with_reference(node, new, img, in[1]->data); + if(nbd->gamma) { + gammabuf= dupalloc_compbuf(img); + gamma_correct_compbuf(gammabuf, 0); + } + else gammabuf= img; + + blur_with_reference(node, new, gammabuf, in[1]->data); + + if(nbd->gamma) { + gamma_correct_compbuf(new, 1); + free_compbuf(gammabuf); + } if(node->exec & NODE_BREAK) { free_compbuf(new); new= NULL; @@ -643,7 +659,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new= pass_on_compbuf(img); } else { - NodeBlurData *nbd= node->storage; CompBuf *gammabuf; /* make output size of input image */ -- cgit v1.2.3 From 6ebe7b8c5d7060e9ee33b0f30e84f6f62c8e8fef Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 22:05:45 +0000 Subject: [#24226] small inconsistency in user preferences also made setting the temp dir more consistent, slash is always added on the end and if the user-pref dir is invalid its not used. --- release/scripts/ui/space_info.py | 2 +- source/blender/makesrna/intern/rna_userdef.c | 3 +-- source/blender/windowmanager/intern/wm_files.c | 3 +-- source/blender/windowmanager/intern/wm_operators.c | 12 ++++++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 3fdd083bfaa..7b3ea18fcf9 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -119,7 +119,7 @@ class INFO_MT_file(bpy.types.Menu): layout.separator() layout.operator_context = 'EXEC_AREA' - layout.operator("wm.exit_blender", text="Quit", icon='QUIT') + layout.operator("wm.quit_blender", text="Quit", icon='QUIT') class INFO_MT_file_import(bpy.types.Menu): diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 18620617c87..4196b3585b3 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -221,8 +221,7 @@ static void rna_userdef_addon_remove(bAddon *bext) static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr) { extern char btempdir[]; - UserDef *userdef = (UserDef*)ptr->data; - strncpy(btempdir, userdef->tempdir, FILE_MAXDIR+FILE_MAXFILE); + BLI_where_is_temp(btempdir, 1); } #else diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 67decd6292e..0b8a4759bca 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -259,8 +259,7 @@ static void wm_init_userdef(bContext *C) /* set the python auto-execute setting from user prefs */ /* disabled by default, unless explicitly enabled in the command line */ if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; - - if(U.tempdir[0]) strncpy(btempdir, U.tempdir, FILE_MAXDIR+FILE_MAXFILE); + if(U.tempdir[0]) BLI_where_is_temp(btempdir, 1); } void WM_read_file(bContext *C, char *name, ReportList *reports) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f0962584801..3b342f440b3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1998,10 +1998,10 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void WM_OT_exit_blender(wmOperatorType *ot) +static void WM_OT_quit_blender(wmOperatorType *ot) { - ot->name= "Exit Blender"; - ot->idname= "WM_OT_exit_blender"; + ot->name= "Quit Blender"; + ot->idname= "WM_OT_quit_blender"; ot->description= "Quit Blender"; ot->invoke= WM_operator_confirm; @@ -3068,7 +3068,7 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_read_factory_settings); WM_operatortype_append(WM_OT_save_homefile); WM_operatortype_append(WM_OT_window_fullscreen_toggle); - WM_operatortype_append(WM_OT_exit_blender); + WM_operatortype_append(WM_OT_quit_blender); WM_operatortype_append(WM_OT_open_mainfile); WM_operatortype_append(WM_OT_link_append); WM_operatortype_append(WM_OT_recover_last_session); @@ -3270,7 +3270,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0); - WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_OSKEY, 0); + WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0); #endif WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0); @@ -3290,7 +3290,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "copy", 1); WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0); /* debug/testing */ WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); -- cgit v1.2.3 From 0143a8c6e546eeb63bbe90750fa6b628837e9903 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 22:25:28 +0000 Subject: update for gamelogic templates --- release/scripts/templates/gamelogic.py | 9 +++------ release/scripts/templates/gamelogic_basic.py | 3 ++- release/scripts/templates/gamelogic_module.py | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py index 21a901c091b..0a419955b81 100644 --- a/release/scripts/templates/gamelogic.py +++ b/release/scripts/templates/gamelogic.py @@ -1,10 +1,7 @@ # This script must be assigned to a python controller # where it can access the object that owns it and the sensors/actuators that it connects to. -# GameLogic has been added to the global namespace no need to import - -# for keyboard event comparison -# import GameKeys +import bge # support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...) # import mathutils @@ -13,7 +10,7 @@ # import Rasterizer def main(): - cont = GameLogic.getCurrentController() + cont = bge.logic.getCurrentController() # The KX_GameObject that owns this controller. own = cont.owner @@ -57,7 +54,7 @@ def main(): # Loop through all other objects in the scene - sce = GameLogic.getCurrentScene() + sce = bge.logic.getCurrentScene() print('Scene Objects:', sce.name) for ob in sce.objects: print(' ', ob.name, ob.worldPosition) diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_basic.py index 5e7d19672fe..c5578a0add9 100644 --- a/release/scripts/templates/gamelogic_basic.py +++ b/release/scripts/templates/gamelogic_basic.py @@ -1,7 +1,8 @@ +import bge def main(): - cont = GameLogic.getCurrentController() + cont = bge.logic.getCurrentController() own = cont.owner sens = cont.sensors['mySensor'] diff --git a/release/scripts/templates/gamelogic_module.py b/release/scripts/templates/gamelogic_module.py index 5a61a3592dc..70bd4d9b45b 100644 --- a/release/scripts/templates/gamelogic_module.py +++ b/release/scripts/templates/gamelogic_module.py @@ -5,7 +5,7 @@ # * External text modules are supported as long as they are at # the same location as the blendfile or one of its libraries. -import GameLogic +import bge # variables defined here will only be set once when the # module is first imported. Set object spesific vars @@ -23,4 +23,4 @@ def main(cont): else: cont.deactivate(actu) -# dont call main(GameLogic.getCurrentController()), the py controller will +# dont call main(bge.logic.getCurrentController()), the py controller will -- cgit v1.2.3 From 3a0e563feb08233217f937ac7040be66d062a73b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Oct 2010 03:23:44 +0000 Subject: bugfix [#23191] Ctrl-LMB quick extrude problem with non-perpendicular edges/faces. also remove is_mat4_flipped() from transform_manipulator.c. --- source/blender/editors/mesh/editmesh_add.c | 11 ++++++++++- .../editors/transform/transform_manipulator.c | 22 ++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 7dac8a465fa..90c5314bf3d 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -141,7 +141,16 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) done= 1; } } - if(done) normalize_v3(nor); + if(done) { + float view_vec[3], cross[3]; + + /* correct the normal to be aligned on the view plane */ + copy_v3_v3(view_vec, vc.rv3d->viewinv[2]); + mul_mat3_m4_v3(vc.obedit->imat, view_vec); + cross_v3_v3v3(cross, nor, view_vec); + cross_v3_v3v3(nor, view_vec, cross); + normalize_v3(nor); + } /* center */ add_v3_v3v3(cent, min, max); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 51698c27b37..1d32f893b80 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -101,16 +101,6 @@ #define MAN_GHOST 1 #define MAN_MOVECOL 2 - -static int is_mat4_flipped(float mat[][4]) -{ - float vec[3]; - - cross_v3_v3v3(vec, mat[0], mat[1]); - if( dot_v3v3(vec, mat[2]) < 0.0 ) return 1; - return 0; -} - /* transform widget center calc helper for below */ static void calc_tw_center(Scene *scene, float *co) { @@ -753,7 +743,7 @@ static void preOrthoFront(int ortho, float twmat[][4], int axis) orthogonalize_m4(omat, axis); glPushMatrix(); glMultMatrixf(omat); - glFrontFace( is_mat4_flipped(omat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(omat) ? GL_CW:GL_CCW); } } @@ -850,12 +840,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat); if (ortho) { glMultMatrixf(matt); - glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW); } } else { if (ortho) { - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); glMultMatrixf(rv3d->twmat); } } @@ -1116,11 +1106,11 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3] // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat); glMultMatrixf(matt); - glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW); } else { glMultMatrixf(rv3d->twmat); - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); } /* axis */ @@ -1327,7 +1317,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov glMultMatrixf(rv3d->twmat); } - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); /* axis */ if( (G.f & G_PICKSEL)==0 ) { -- cgit v1.2.3 From 7ef6836be497a6d1fd24e50f37556f92432fc5fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Oct 2010 08:32:53 +0000 Subject: bugfix [#24144] Small problem with texture (r32316) an extra pixel was being drawn on a tiled image texture. --- source/blender/render/intern/source/imagetexture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index f78031c9030..5321d71194f 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -157,8 +157,8 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre } } - x = (int)(fx*ibuf->x); - y = (int)(fy*ibuf->y); + x = (int)floorf(fx*ibuf->x); + y = (int)floorf(fy*ibuf->y); if(tex->extend == TEX_CLIPCUBE) { if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0 || texvec[2]>1.0) { -- cgit v1.2.3 From 4754d6a27d28eb0a244a49f147b588721fcecfbb Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Tue, 12 Oct 2010 10:30:29 +0000 Subject: Fix for [#24169] Sequencer segfaults often when scrubbing to frame zero --- source/blender/blenkernel/intern/sequencer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8c496fea3b0..040ca832a80 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1005,7 +1005,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se } } - for (;b <= chanshown; b++) { + for (;b <= chanshown && b >= 0; b++) { if (video_seq_is_rendered(seq_arr[b])) { seq_arr_out[cnt++] = seq_arr[b]; } -- cgit v1.2.3 From b64098a85af30a1d5f74fbb876e939905a2cc44f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Oct 2010 21:47:13 +0000 Subject: bugfix [#22407] Object level proxies ignore transform of original --- source/blender/blenkernel/intern/object.c | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 541e8e2b00e..861904335d7 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1264,6 +1264,17 @@ static void copy_object_pose(Object *obn, Object *ob) } } +static void copy_object_transform(Object *ob_tar, Object *ob_src) +{ + copy_v3_v3(ob_tar->loc, ob_src->loc); + copy_v3_v3(ob_tar->rot, ob_src->rot); + copy_v3_v3(ob_tar->quat, ob_src->quat); + copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis); + ob_tar->rotAngle= ob_src->rotAngle; + ob_tar->rotmode= ob_src->rotmode; + copy_v3_v3(ob_tar->size, ob_src->size); +} + Object *copy_object(Object *ob) { Object *obn; @@ -1530,23 +1541,23 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) ob->recalc= target->recalc= OB_RECALC_ALL; - /* copy transform */ + /* copy transform + * - gob means this proxy comes from a group, just apply the matrix + * so the object wont move from its dupli-transform. + * + * - no gob means this is being made from a linked object, + * this is closer to making a copy of the object - in-place. */ if(gob) { - VECCOPY(ob->loc, gob->loc); - VECCOPY(ob->rot, gob->rot); - VECCOPY(ob->size, gob->size); - - group_tag_recalc(gob->dup_group); + ob->rotmode= target->rotmode; + mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat); + object_apply_mat4(ob, ob->obmat); } else { - VECCOPY(ob->loc, target->loc); - VECCOPY(ob->rot, target->rot); - VECCOPY(ob->size, target->size); + copy_object_transform(ob, target); + ob->parent= target->parent; /* libdata */ + copy_m4_m4(ob->parentinv, target->parentinv); } - ob->parent= target->parent; /* libdata */ - copy_m4_m4(ob->parentinv, target->parentinv); - /* copy animdata stuff - drivers only for now... */ object_copy_proxy_drivers(ob, target); -- cgit v1.2.3 From 5790deb4df1d492f6018d5082280cb0246e3d833 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Oct 2010 22:20:10 +0000 Subject: bugfix [#23899] renderlayers are not working properly was missing button for single layer rendering. also renamed Object.show_shape_key to Object.show_only_shape_key since this pin's the shape key so others are disabled. --- release/scripts/ui/properties_data_mesh.py | 4 ++-- release/scripts/ui/properties_render.py | 5 +++-- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/makesrna/intern/rna_scene.c | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 38364139147..ebe34d1fe11 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -182,7 +182,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel): enable_edit = ob.mode != 'EDIT' enable_edit_value = False - if ob.show_shape_key is False: + if ob.show_only_shape_key is False: if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode): enable_edit_value = True @@ -218,7 +218,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel): sub = row.row(align=True) subsub = sub.row(align=True) subsub.active = enable_edit_value - subsub.prop(ob, "show_shape_key", text="") + subsub.prop(ob, "show_only_shape_key", text="") subsub.prop(kb, "mute", text="") sub.prop(ob, "use_shape_key_edit_mode", text="") diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py index dba9ff44d51..44f1223aa93 100644 --- a/release/scripts/ui/properties_render.py +++ b/release/scripts/ui/properties_render.py @@ -84,10 +84,11 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): col.operator("scene.render_layer_add", icon='ZOOMIN', text="") col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="") + row = layout.row() rl = rd.layers.active - if rl: - layout.prop(rl, "name") + row.prop(rl, "name") + row.prop(rd, "use_single_layer", text="", icon_only=True) split = layout.split() diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index e74bec566d5..c29ad0d9adf 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2152,7 +2152,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures"); /* shape keys */ - prop= RNA_def_property(srna, "show_shape_key", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK); RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object"); RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1bcaf490c8d..2cccf96c518 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2837,6 +2837,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); + RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* engine */ -- cgit v1.2.3 From 4a385adbf339f585cc1802a1e5d277ff99438146 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Oct 2010 23:47:43 +0000 Subject: python api: - bpy.app.debug can now be set, removed bpy.data.debug (since this is not blendfile data) - added bpy.app.tempdir, this is needed because the userpref temp dir isn't always set, $TEMP may be used instead and scripts need temp dir access. --- source/blender/makesrna/intern/rna_define.c | 3 +- source/blender/makesrna/intern/rna_main.c | 18 -------- source/blender/python/intern/bpy_app.c | 70 +++++++++++++++++++++++++---- source/blender/python/intern/bpy_rna.c | 2 +- 4 files changed, 64 insertions(+), 29 deletions(-) diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 1fed1663952..0a8e0bad7f0 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -474,11 +474,12 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) PropertyRNA *prop, *nextprop; PropertyRNA *parm, *nextparm; + /* if(srna->flag & STRUCT_RUNTIME) { if(RNA_struct_py_type_get(srna)) { fprintf(stderr, "RNA_struct_free '%s' freed while holding a python reference\n", srna->identifier); } - } + } */ for(prop=srna->cont.properties.first; prop; prop=nextprop) { nextprop= prop->next; diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 99758b8f0fe..e626abd85c7 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -36,19 +36,6 @@ #include "BKE_global.h" /* all the list begin functions are added manually here, Main is not in SDNA */ -static int rna_Main_debug_get(PointerRNA *ptr) -{ - return G.f & G_DEBUG; -} - - -static void rna_Main_debug_set(PointerRNA *ptr, const int value) -{ - if (value) - G.f |= G_DEBUG; - else - G.f &= ~G_DEBUG; -} static int rna_Main_is_dirty_get(PointerRNA *ptr) { @@ -317,11 +304,6 @@ void RNA_def_main(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL); RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file"); - prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_Main_debug_get", "rna_Main_debug_set"); - RNA_def_property_ui_text(prop, "Debug", "Print debugging information in console"); - - for(i=0; lists[i].name; i++) { prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 78658a611a3..f506f91292f 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -44,7 +44,6 @@ static PyStructSequence_Field app_info_fields[] = { {"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"}, {"version_string", "The Blender version formatted as a string"}, {"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"}, - {"debug", "Boolean, set when blender is running in debug mode (started with -d)"}, {"background", "Boolean, True when blender is running without a user interface (started with -b)"}, /* buildinfo */ @@ -85,7 +84,6 @@ static PyObject *make_app_info(void) SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); SetStrItem(bprogname); - SetObjItem(PyBool_FromLong(G.f & G_DEBUG)); SetObjItem(PyBool_FromLong(G.background)); /* build info */ @@ -96,11 +94,11 @@ static PyObject *make_app_info(void) SetStrItem(build_platform); SetStrItem(build_type); #else - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem @@ -114,10 +112,60 @@ static PyObject *make_app_info(void) return app_info; } +/* a few getsets because it makes sense for them to be in bpy.app even though + * they are not static */ +static PyObject *bpy_app_debug_get(PyObject *self, void *closure) +{ + (void)(self); + (void)(closure); + + return PyBool_FromLong(G.f & G_DEBUG); +} + +static int bpy_app_debug_set(PyObject *self, PyObject *value, void *closure) +{ + int param= PyObject_IsTrue(value); + + (void)(self); + (void)(closure); + + if(param < 0) { + PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); + return -1; + } + + if(param) G.f |= G_DEBUG; + else G.f &= ~G_DEBUG; + + return 0; +} + +static PyObject *bpy_app_tempdir_get(PyObject *self, void *closure) +{ + extern char btempdir[]; + (void)(self); + (void)(closure); + + return PyUnicode_FromString(btempdir); +} + +PyGetSetDef bpy_app_debug_getset= {"debug", bpy_app_debug_get, bpy_app_debug_set, "Boolean, set when blender is running in debug mode (started with -d)", NULL}; +PyGetSetDef bpy_app_tempdir_getset= {"tempdir", bpy_app_tempdir_get, NULL, "String, the temp directory used by blender (read-only)", NULL}; + +static void py_struct_seq_getset_init(void) +{ + /* tricky dynamic members, not to py-spec! */ + + PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_debug_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_debug_getset)); + PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_tempdir_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_tempdir_getset)); +} +/* end dynamic bpy.app */ + + PyObject *BPY_app_struct(void) { PyObject *ret; - + PyStructSequence_InitType(&BlenderAppType, &app_info_desc); ret= make_app_info(); @@ -125,6 +173,10 @@ PyObject *BPY_app_struct(void) /* prevent user from creating new instances */ BlenderAppType.tp_init = NULL; BlenderAppType.tp_new = NULL; - + + /* kindof a hack ontop of PyStructSequence */ + py_struct_seq_getset_init(); + return ret; } + diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 166213fa07c..b49a48699fa 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -964,7 +964,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p else param = PyLong_AsLong( value ); - if( param < 0 || param > 1) { + if(param < 0) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { -- cgit v1.2.3 From 118e0426f109fb41fa5d9c982ffdce2661b1157a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 00:08:24 +0000 Subject: patch [#24221] Creating graph from armature doesn't work with unsaved .blend files (with fix). from Sergej Reich (sergof) Made some corrections to the patch as well as using bpy.app.tempdir with tempfile python module. --- release/scripts/modules/rigify/__init__.py | 6 +++++- release/scripts/ui/properties_data_armature_rigify.py | 13 +++++++++++-- source/blender/python/intern/bpy_app.c | 10 +++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py index 98d9bb235a2..c4f18d51519 100644 --- a/release/scripts/modules/rigify/__init__.py +++ b/release/scripts/modules/rigify/__init__.py @@ -534,7 +534,11 @@ def generate_test_all(context, GRAPH=False): new_objects = rigify.generate_test(context) if GRAPH: - base_name = os.path.splitext(bpy.data.filepath)[0] + if(bpy.data.filepath): + base_name = os.path.splitext(bpy.data.filepath)[0] + else: + import tempfile + base_name = tempfile.mktemp(prefix=bpy.app.tempdir) for obj, obj_new in new_objects: for obj in (obj, obj_new): fn = base_name + "-" + bpy.path.clean_name(obj.name) diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py index f7961821277..6453ea9e038 100644 --- a/release/scripts/ui/properties_data_armature_rigify.py +++ b/release/scripts/ui/properties_data_armature_rigify.py @@ -211,14 +211,23 @@ class Graph(bpy.types.Operator): import bpy reload(graphviz_export) obj = bpy.context.object - path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + if(bpy.data.filepath): + path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + else: + import tempfile + path = tempfile.mktemp(prefix=bpy.app.tempdir) + "-" + bpy.path.clean_name(obj.name) path_dot = path + ".dot" path_png = path + ".png" saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False) if saved: # if we seriously want this working everywhere we'll need some new approach - os.system("dot -Tpng %s > %s; gnome-open %s &" % (path_dot, path_png, path_png)) + os.system("dot -Tpng %r > %r" % (path_dot, path_png)) + if not os.path.exists(path_png) or os.stat(path_png)[6] == 0: + self.report('ERROR', "Graphvis could not create %r check graphviz is installed" % path_png) + return {'CANCELLED'} + + bpy.ops.image.external_edit(filepath=path_png) #os.system("python /b/xdot.py '%s' &" % path_dot) return {'FINISHED'} diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index f506f91292f..6a6b5277d9f 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -94,11 +94,11 @@ static PyObject *make_app_info(void) SetStrItem(build_platform); SetStrItem(build_type); #else - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem -- cgit v1.2.3 From 9347dd04a30ea091df4cc5d54af5a84e83652afc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 01:10:56 +0000 Subject: bugfix [#24231] outliner not refreshed correctly also made world changes only redraw the 3d view if 'Render Only' option is set. --- CMakeLists.txt | 4 +-- .../editors/space_outliner/space_outliner.c | 1 + source/blender/editors/space_view3d/space_view3d.c | 33 ++++++++++++++++++---- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_world.c | 5 ++-- source/blender/windowmanager/WM_types.h | 1 + 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7d88ad0b47..fe23aacaabf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,7 @@ ENDIF(APPLE) IF(NOT WITH_GAMEENGINE AND WITH_PLAYER) - MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE") + MESSAGE(FATAL_ERROR "WITH_PLAYER needs WITH_GAMEENGINE") ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER) IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL) @@ -334,7 +334,7 @@ IF(WIN32) # Setup 64bit and 64bit windows systems IF(CMAKE_CL_64) - message("64 bit compiler detected.") + MESSAGE("64 bit compiler detected.") SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64) ENDIF(CMAKE_CL_64) diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index f0f9ac945ef..5667ae51ee4 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -104,6 +104,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_FRAME: case ND_RENDER_OPTIONS: case ND_LAYER: + case ND_WORLD: ED_region_tag_redraw(ar); break; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8a215834c38..629e0efe2ce 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -548,22 +548,36 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene base= base->next; } - sa= win->screen->areabase.first; - while(sa) { - if(sa->spacetype == SPACE_VIEW3D) - if(BLI_findindex(&sa->regionbase, ar) >= 0) { + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) { + if(BLI_findindex(&sa->regionbase, ar) != -1) { View3D *v3d= sa->spacedata.first; v3d->lay_used= lay_used; break; } + } + } +} - sa= sa->next; +static View3D *view3d_from_wmn(ARegion *ar, wmNotifier *wmn) +{ + wmWindow *win= wmn->wm->winactive; + ScrArea *sa; + + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) + if(BLI_findindex(&sa->regionbase, ar) != -1) { + return (View3D *)sa->spacedata.first; + } } + + return NULL; } static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) { bScreen *sc; + View3D *v3d; /* context changes */ switch(wmn->category) { @@ -600,6 +614,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: ED_region_tag_redraw(ar); break; + case ND_WORLD: + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); + break; } if (wmn->action == NA_EDITED) ED_region_tag_redraw(ar); @@ -650,7 +669,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_WORLD: switch(wmn->data) { case ND_WORLD_DRAW: - ED_region_tag_redraw(ar); + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); break; } break; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2cccf96c518..bc778ff3256 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3094,7 +3094,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "World", "World used for rendering the scene"); - RNA_def_property_update(prop, NC_SCENE|NC_WORLD, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_WORLD, NULL); prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_float_sdna(prop, NULL, "cursor"); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index ecf253acbce..726d64f26f4 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -478,9 +478,8 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon"); /* RNA_def_property_update(prop, 0, "rna_World_update"); */ - /* render-only uses this, the notifier could be made to be more spesific */ - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_World_update"); - + /* render-only uses this */ + RNA_def_property_update(prop, NC_WORLD|ND_WORLD_DRAW, "rna_World_update"); prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 0447524255f..7af6de6c86c 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -191,6 +191,7 @@ typedef struct wmNotifier { #define ND_TOOLSETTINGS (15<<16) #define ND_LAYER (16<<16) #define ND_FRAME_RANGE (17<<16) +#define ND_WORLD (92<<16) #define ND_LAYER_CONTENT (101<<16) /* NC_OBJECT Object */ -- cgit v1.2.3 From 74dd22a228db0312049f0b23f1ce63a766202272 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 01:30:42 +0000 Subject: re-enable fix from r32330 but without the alt key check because this can be used for input. --- source/blender/editors/space_console/console_ops.c | 9 ++------- source/blender/editors/space_text/text_ops.c | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index a84a592279e..c36cbc38640 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -406,14 +406,9 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; - - /* XXX NOTE: Reverting this change from r32330, since it - * breaks input for cases where modifierkey is needed to - * create characters. - */ /* if alt/ctrl/super are pressed pass through */ - //if(event->alt || event->ctrl || event->oskey) - // return OPERATOR_PASS_THROUGH; + if(event->ctrl || event->oskey) + return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index f6a4488966d..f8abe0f1900 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2322,14 +2322,9 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; - - /* XXX NOTE: Reverting this change from r32330, since it - * breaks input for cases where modifierkey is needed to - * create characters. - */ /* if alt/ctrl/super are pressed pass through */ - //if(event->alt || event->ctrl || event->oskey) - // return OPERATOR_PASS_THROUGH; + if(event->ctrl || event->oskey) + return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); } -- cgit v1.2.3 From 3a0bb75bacde30b08599a6a754fc6c9763352b84 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 01:43:03 +0000 Subject: [#24128] Rigid Body Joint Constraint min/max limits [patch] from Dan Eicher (dna) --- source/blender/makesrna/intern/rna_constraint.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index e4726f5e92c..dee12d43144 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1242,10 +1242,16 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - /* XXX not sure how to wrap the two 6 element arrays for the generic joint */ - //float minLimit[6]; - //float maxLimit[6]; - + prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit"); + RNA_def_property_array(prop, 6); + RNA_def_property_ui_text(prop, "Minimum Limit", ""); + + prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit"); + RNA_def_property_array(prop, 6); + RNA_def_property_ui_text(prop, "Maximum Limit", ""); + prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION); RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies"); -- cgit v1.2.3 From cbbb636813071c4c4d856dc0ee93972754e8f0fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 01:58:09 +0000 Subject: [#24171] Tab key no longer responds from UV / Image Editor --- source/blender/editors/mesh/mesh_ops.c | 2 +- source/blender/editors/space_image/space_image.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index fa055a385f3..51a4c67b19b 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -262,7 +262,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1); - WM_keymap_add_item(keymap, "view3d.edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */ WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_individual_move", EKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 66e27993532..a6deb73f2e7 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -485,6 +485,7 @@ void image_operatortypes(void) void image_keymap(struct wmKeyConfig *keyconf) { wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0); + wmKeyMapItem *kmi; WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0); @@ -524,6 +525,11 @@ void image_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1); WM_keymap_add_item(keymap, "IMAGE_OT_toolbox", SPACEKEY, KM_PRESS, 0, 0); + + /* toggle editmode is handy to have while UV unwrapping */ + kmi= WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT); + RNA_boolean_set(kmi->ptr, "toggle", 1); } /* dropboxes */ -- cgit v1.2.3 From 7c538107ead563475845d635b1f0f18af246b4d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 03:17:58 +0000 Subject: bugfix [#24030] Grease Pencil + Driver keys --- source/blender/editors/interface/interface_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 654a089dafe..a64dcecb929 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4266,7 +4266,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) if(but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; - if(data->state == BUTTON_STATE_HIGHLIGHT) { + if(data->state == BUTTON_STATE_HIGHLIGHT && event->prevval != KM_PRESS) { /* check prevval because of modal operators [#24016] */ /* handle copy-paste */ if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) { ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v'); -- cgit v1.2.3 From 554f4df542bd968d6384609a83bd5f6c840aceb3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 04:00:01 +0000 Subject: bugfix [#24210] Tiled textures can cause corruption of entire UI --- source/blender/editors/space_view3d/view3d_view.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 860f9f461c4..b49933cbb35 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1667,6 +1667,7 @@ static void RestoreState(bContext *C) win->queue= queue_back; GPU_state_init(); + GPU_set_tpage(NULL, 0); glPopAttrib(); } -- cgit v1.2.3 From 54ffc23cd59164180ea874b96ff9cd97753d6218 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 13 Oct 2010 06:06:39 +0000 Subject: Text space ========== Main changes: - lines could be partially shown when they starts somewhere behind the upper boundary of area but because of word-wrapping some part of line will be show - fixed caret navigatiog in area when tabs aren't replaced by spaces - highlight the whole current line not only it's wrapped segment with caret - when you're in replace mode cursor would be as long as the tab's width if it's under tab symbol This fixes: #22399: Text Editor: word-wrapped lines prevent navigating through text with up-arrow. #21163: Text editor scrollbar problem with word wrap --- source/blender/blenloader/intern/readfile.c | 3 + source/blender/editors/space_text/space_text.c | 12 +- source/blender/editors/space_text/text_draw.c | 629 ++++++++++++++++++++---- source/blender/editors/space_text/text_intern.h | 8 + source/blender/editors/space_text/text_ops.c | 536 +++++++++++++++----- source/blender/makesdna/DNA_space_types.h | 2 + 6 files changed, 960 insertions(+), 230 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0eb25a6b894..22641d51ed9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4646,6 +4646,7 @@ static void lib_link_screen(FileData *fd, Main *main) SpaceText *st= (SpaceText *)sl; st->text= newlibadr(fd, sc->id.lib, st->text); + st->drawcache= NULL; } else if(sl->spacetype==SPACE_SCRIPT) { @@ -4877,6 +4878,8 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1); if(st->text==NULL) st->text= newmain->text.first; + + st->drawcache= NULL; } else if(sl->spacetype==SPACE_SCRIPT) { SpaceScript *scpt= (SpaceScript *)sl; diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 7f7a07f8cf7..5ee7ca3c3ef 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -92,6 +92,7 @@ static void text_free(SpaceLink *sl) SpaceText *stext= (SpaceText*) sl; stext->text= NULL; + text_free_caches(stext); } @@ -104,9 +105,11 @@ static void text_init(struct wmWindowManager *wm, ScrArea *sa) static SpaceLink *text_duplicate(SpaceLink *sl) { SpaceText *stextn= MEM_dupallocN(sl); - + /* clear or remove stuff from old */ - + + stextn->drawcache= NULL; /* space need it's own cache */ + return (SpaceLink *)stextn; } @@ -132,8 +135,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->action) { case NA_EDITED: - if(st->text) + if(st->text) { + text_drawcache_tag_update(st, 1); text_update_edited(st->text); + } + ED_area_tag_redraw(sa); /* no break -- fall down to tag redraw */ case NA_ADDED: diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index be2d993dab5..c6036eb354b 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -10,7 +10,6 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -521,9 +520,22 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * linep= text->lines.first; i= st->top; while(i>0 && linep) { - if(linep == linein) return; /* Line before top */ - linep= linep->next; - i--; + int lines= text_get_visible_lines(st, ar, linep->line); + + /* Line before top */ + if(linep == linein) { + if(lines <= i) + /* no visible part of line */ + return; + } + + if (i-lines<0) { + break; + } else { + linep= linep->next; + (*offl)+= lines-1; + i-= lines; + } } max= wrap_width(st, ar); @@ -548,10 +560,18 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * while(chars--) { if(i-start>=max) { - if(chop && linep==linein && i >= cursin) + if(chop && linep==linein && i >= cursin) { + if (i==cursin) { + (*offl)++; + *offc -= end-start; + } + return; + } + (*offl)++; *offc -= end-start; + start= end; end += max; chop= 1; @@ -570,7 +590,66 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * } } -static int get_char_pos(SpaceText *st, char *line, int cur) +void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc) +{ + int i, j, start, end, chars, max, chop; + char ch; + + *offl= *offc= 0; + + if(!st->text) return; + if(!st->wordwrap) return; + + max= wrap_width(st, ar); + + start= 0; + end= max; + chop= 1; + chars= 0; + *offc= 0; + + for(i=0, j=0; linein->line[j]!='\0'; j++) { + + /* Mimic replacement of tabs */ + ch= linein->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + if(i=max) { + if(chop && i >= cursin) { + if (i==cursin) { + (*offl)++; + *offc -= end-start; + } + + return; + } + + (*offl)++; + *offc -= end-start; + + start= end; + end += max; + chop= 1; + } + else if(ch==' ' || ch=='-') { + end = i+1; + chop= 0; + if(i >= cursin) + return; + } + i++; + } + } +} + +int text_get_char_pos(SpaceText *st, char *line, int cur) { int a=0, i; @@ -583,7 +662,7 @@ static int get_char_pos(SpaceText *st, char *line, int cur) return a; } -static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format) +static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format, int skip) { FlattenString fs; int basex, i, a, len, start, end, max, lines; @@ -599,6 +678,14 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char end= max; for(i=0; i= max) { + /* skip hidden part of line */ + if(skip) { + skip--; + start= end; + end += max; + continue; + } + /* Draw the visible portion of text on the overshot line */ for(a=start; ashowsyntax && format) format_draw_color(format[a]); @@ -609,6 +696,8 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char lines++; start= end; end += max; + + if(y<=0) break; } else if(str[i]==' ' || str[i]=='-') { end = i+1; @@ -616,7 +705,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char } /* Draw the remaining text */ - for(a=start; a 0; a++) { if(st->showsyntax && format) format_draw_color(format[a]); @@ -631,7 +720,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format) { FlattenString fs; - int r=0, w= 0; + int r=0, w= 0, amount; int *acc; char *in; @@ -647,18 +736,26 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra if(draw) { if(st->showsyntax && format) { - int amount, a; + int a; format = format+cshift; amount = strlen(in); + if(maxwidth) + amount= MIN2(amount, maxwidth); for(a = 0; a < amount; a++) { format_draw_color(format[a]); x += text_font_draw_character(st, x, y, in[a]); } } - else + else { + amount = strlen(in); + if(maxwidth) + amount= MIN2(amount, maxwidth); + + in[amount]= 0; text_font_draw(st, x, y, in); + } } else { while(w-- && *acc++ < maxwidth) @@ -675,18 +772,307 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra return r+TXT_OFFSET; } +/************************ cache utilities *****************************/ + +typedef struct DrawCache { + int *line_height; + int total_lines, nlines; + + /* this is needed to check cache relevance */ + int winx, wordwrap, showlinenrs, tabnumber; + short lheight; + char cwidth; + char text_id[MAX_ID_NAME]; + + /* for partial lines recalculation */ + short update_flag; + int valid_head, valid_tail; /* amount of unchanged lines */ +} DrawCache; + +static void text_drawcache_init(SpaceText *st) +{ + DrawCache *drawcache= MEM_callocN(sizeof (DrawCache), "text draw cache"); + + drawcache->winx= -1; + drawcache->nlines= BLI_countlist(&st->text->lines); + drawcache->text_id[0]= '\0'; + + st->drawcache= drawcache; +} + +static void text_update_drawcache(SpaceText *st, ARegion *ar) +{ + DrawCache *drawcache; + int full_update= 0, nlines= 0; + Text *txt= st->text; + + if(!st->drawcache) text_drawcache_init(st); + + text_update_character_width(st); + + drawcache= (DrawCache *)st->drawcache; + nlines= drawcache->nlines; + + /* check if full cache update is needed */ + full_update|= drawcache->winx != ar->winx; /* area was resized */ + full_update|= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */ + full_update|= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */ + full_update|= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */ + full_update|= drawcache->lheight != st->lheight; /* word-wrapping option was toggled */ + full_update|= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */ + full_update|= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */ + + if(st->wordwrap) { + /* update line heights */ + if(full_update || !drawcache->line_height) { + drawcache->valid_head = 0; + drawcache->valid_tail = 0; + drawcache->update_flag = 1; + } + + if(drawcache->update_flag) { + TextLine *line= st->text->lines.first; + int lineno= 0, size, lines_count; + int *fp= drawcache->line_height, *new_tail, *old_tail; + + nlines= BLI_countlist(&txt->lines); + size= sizeof(int)*nlines; + + if(fp) fp= MEM_reallocN(fp, size); + else fp= MEM_callocN(size, "text drawcache line_height"); + + drawcache->valid_tail= drawcache->valid_head= 0; + old_tail= fp + drawcache->nlines - drawcache->valid_tail; + new_tail= fp + nlines - drawcache->valid_tail; + memmove(new_tail, old_tail, drawcache->valid_tail); + + drawcache->total_lines= 0; + + if(st->showlinenrs) + st->linenrs_tot= (int)floor(log10((float)nlines)) + 1; + + while(line) { + if(drawcache->valid_head) { /* we're inside valid head lines */ + lines_count= fp[lineno]; + drawcache->valid_head--; + } else if (lineno > new_tail - fp) { /* we-re inside valid tail lines */ + lines_count= fp[lineno]; + } else { + lines_count= text_get_visible_lines(st, ar, line->line); + } + + fp[lineno]= lines_count; + + line= line->next; + lineno++; + drawcache->total_lines+= lines_count; + } + + drawcache->line_height= fp; + } + } else { + if(drawcache->line_height) { + MEM_freeN(drawcache->line_height); + drawcache->line_height= NULL; + } + + if(full_update || drawcache->update_flag) { + nlines= BLI_countlist(&txt->lines); + + if(st->showlinenrs) + st->linenrs_tot= (int)floor(log10((float)nlines)) + 1; + } + + drawcache->total_lines= nlines; + } + + drawcache->nlines= nlines; + + /* store settings */ + drawcache->winx = ar->winx; + drawcache->wordwrap = st->wordwrap; + drawcache->lheight = st->lheight; + drawcache->cwidth = st->cwidth; + drawcache->showlinenrs = st->showlinenrs; + drawcache->tabnumber = st->tabnumber; + + strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME); + + /* clear update flag */ + drawcache->update_flag = 0; + drawcache->valid_head = 0; + drawcache->valid_tail = 0; +} + +void text_drawcache_tag_update(SpaceText *st, int full) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + if(drawcache) { + Text *txt= st->text; + + if(drawcache->update_flag) { + /* happens when tagging update from space listener */ + /* should do nothing to prevent locally tagged cache be fully recalculated */ + return; + } + + if(!full) { + int sellno= BLI_findindex(&txt->lines, txt->sell); + int curlno= BLI_findindex(&txt->lines, txt->curl); + + if(curlno < sellno) { + drawcache->valid_head= curlno; + drawcache->valid_tail= drawcache->nlines - sellno - 1; + } else { + drawcache->valid_head= sellno; + drawcache->valid_tail= drawcache->nlines - curlno - 1; + } + + /* quick cache recalculation is also used in delete operator, + which could merge lines which are adjusent to current selection lines + expand recalculate area to this lines */ + if(drawcache->valid_head>0) drawcache->valid_head--; + if(drawcache->valid_tail>0) drawcache->valid_tail--; + } else { + drawcache->valid_head= 0; + drawcache->valid_tail= 0; + } + + drawcache->update_flag= 1; + } +} + +void text_free_caches(SpaceText *st) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + if(drawcache) { + if(drawcache->line_height) + MEM_freeN(drawcache->line_height); + + MEM_freeN(drawcache); + } +} + +/************************ word-wrap utilities *****************************/ + +/* cache should be updated in caller */ +int text_get_visible_lines_no(SpaceText *st, int lineno) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + return drawcache->line_height[lineno]; +} + +int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str) +{ + int i, j, start, end, max, lines, chars; + char ch; + + max= wrap_width(st, ar); + lines= 1; + start= 0; + end= max; + for(i= 0, j= 0; str[j] != '\0'; j++) { + /* Mimic replacement of tabs */ + ch= str[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start >= max) { + lines++; + start= end; + end += max; + } + else if(ch==' ' || ch=='-') { + end= i+1; + } + + i++; + } + } + + return lines; +} + +int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to) +{ + if(st->wordwrap) { + int ret=0; + TextLine *tmp= from; + + /* Look forwards */ + while (tmp) { + if (tmp == to) return ret; + ret+= text_get_visible_lines(st, ar, tmp->line); + tmp= tmp->next; + } + + return ret; + } else return txt_get_span(from, to); +} + +int text_get_total_lines(SpaceText *st, ARegion *ar) +{ + DrawCache *drawcache; + + text_update_drawcache(st, ar); + drawcache= (DrawCache *)st->drawcache; + + return drawcache->total_lines; +} + +/* Move pointer to first visible line (top) */ +static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top) +{ + Text *text= st->text; + TextLine* pline= text->lines.first; + int i= st->top, lineno= 0; + DrawCache *drawcache; + + text_update_drawcache(st, ar); + drawcache= (DrawCache *)st->drawcache; + + if(wrap_top) *wrap_top= 0; + + if(st->wordwrap) { + while(i>0 && pline) { + int lines= text_get_visible_lines_no(st, lineno); + + if (i-lines<0) { + if(wrap_top) *wrap_top= i; + break; + } else { + pline= pline->next; + i-= lines; + lineno++; + } + } + } else { + for(i=st->top, pline= text->lines.first; pline->next && i>0; i--) + pline= pline->next; + } + + return pline; +} + /************************ draw scrollbar *****************************/ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) { - int lhlstart, lhlend, ltexth; + int lhlstart, lhlend, ltexth, sell_off, curl_off; short barheight, barstart, hlstart, hlend, blank_lines; short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff; pix_top_margin = 8; pix_bottom_margin = 4; pix_available = ar->winy - pix_top_margin - pix_bottom_margin; - ltexth= txt_get_span(st->text->lines.first, st->text->lines.last); + ltexth= text_get_total_lines(st, ar); blank_lines = st->viewlines / 2; /* nicer code: use scroll rect for entire bar */ @@ -722,10 +1108,10 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0; if(st->pix_per_line<.1) st->pix_per_line=.1f; - lhlstart = MIN2(txt_get_span(st->text->lines.first, st->text->curl), - txt_get_span(st->text->lines.first, st->text->sell)); - lhlend = MAX2(txt_get_span(st->text->lines.first, st->text->curl), - txt_get_span(st->text->lines.first, st->text->sell)); + curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl); + sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell); + lhlstart = MIN2(curl_off, sell_off); + lhlend = MAX2(curl_off, sell_off); if(ltexth > 0) { hlstart = (lhlstart * pix_available)/ltexth; @@ -811,78 +1197,80 @@ static void draw_markers(SpaceText *st, ARegion *ar) { Text *text= st->text; TextMarker *marker, *next; - TextLine *top, *bottom, *line; - int offl, offc, i, cy, x1, x2, y1, y2, x, y; + TextLine *top, *line; + int offl, offc, i, x1, x2, y1, y2, x, y; + int topi, topy; + + /* Move pointer to first visible line (top) */ + top= first_visible_line(st, ar, NULL); + topi= BLI_findindex(&text->lines, top); - for(i=st->top, top= text->lines.first; top->next && i>0; i--) - top= top->next; + topy= txt_get_span(text->lines.first, top); - for(i=st->viewlines-1, bottom=top; bottom->next && i>0; i--) - bottom= bottom->next; - for(marker= text->markers.first; marker; marker= next) { next= marker->next; - for(cy= 0, line= top; line; cy++, line= line->next) { - if(cy+st->top==marker->lineno) { - /* Remove broken markers */ - if(marker->end>line->len || marker->start>marker->end) { - BLI_freelinkN(&text->markers, marker); - break; - } + /* invisible line (before top) */ + if(marker->linenostart, &offl, &offc); - x1= get_char_pos(st, line->line, marker->start) - st->left + offc; - y1= cy + offl; - wrap_offset(st, ar, line, marker->end, &offl, &offc); - x2= get_char_pos(st, line->line, marker->end) - st->left + offc; - y2= cy + offl; - - glColor3ub(marker->color[0], marker->color[1], marker->color[2]); - x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - y= ar->winy-3; - - if(y1==y2) { - y -= y1*st->lheight; - glBegin(GL_LINE_LOOP); - glVertex2i(x+x2*st->cwidth+1, y); - glVertex2i(x+x1*st->cwidth-2, y); - glVertex2i(x+x1*st->cwidth-2, y-st->lheight); - glVertex2i(x+x2*st->cwidth+1, y-st->lheight); - glEnd(); - } - else { - y -= y1*st->lheight; - glBegin(GL_LINE_STRIP); - glVertex2i(ar->winx, y); - glVertex2i(x+x1*st->cwidth-2, y); - glVertex2i(x+x1*st->cwidth-2, y-st->lheight); - glVertex2i(ar->winx, y-st->lheight); - glEnd(); - y-=st->lheight; - - for(i=y1+1; iwinx, y); - glVertex2i(x, y-st->lheight); - glVertex2i(ar->winx, y-st->lheight); - glEnd(); - y-=st->lheight; - } + line= BLI_findlink(&text->lines, marker->lineno); - glBegin(GL_LINE_STRIP); - glVertex2i(x, y); - glVertex2i(x+x2*st->cwidth+1, y); - glVertex2i(x+x2*st->cwidth+1, y-st->lheight); - glVertex2i(x, y-st->lheight); - glEnd(); - } + /* Remove broken markers */ + if(marker->end>line->len || marker->start>marker->end) { + BLI_freelinkN(&text->markers, marker); + continue; + } - break; + wrap_offset(st, ar, line, marker->start, &offl, &offc); + y1 = txt_get_span(top, line) - st->top + offl + topy; + x1 = text_get_char_pos(st, line->line, marker->start) - st->left + offc; + + wrap_offset(st, ar, line, marker->end, &offl, &offc); + y2 = txt_get_span(top, line) - st->top + offl + topy; + x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc; + + /* invisible part of line (before top, after last visible line) */ + if(y2 < 0 || y1 > st->top+st->viewlines) continue; + + glColor3ub(marker->color[0], marker->color[1], marker->color[2]); + x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + y= ar->winy-3; + + if(y1==y2) { + y -= y1*st->lheight; + glBegin(GL_LINE_LOOP); + glVertex2i(x+x2*st->cwidth+1, y); + glVertex2i(x+x1*st->cwidth-2, y); + glVertex2i(x+x1*st->cwidth-2, y-st->lheight); + glVertex2i(x+x2*st->cwidth+1, y-st->lheight); + glEnd(); + } + else { + y -= y1*st->lheight; + glBegin(GL_LINE_STRIP); + glVertex2i(ar->winx, y); + glVertex2i(x+x1*st->cwidth-2, y); + glVertex2i(x+x1*st->cwidth-2, y-st->lheight); + glVertex2i(ar->winx, y-st->lheight); + glEnd(); + y-=st->lheight; + + for(i=y1+1; iwinx, y); + glVertex2i(x, y-st->lheight); + glVertex2i(ar->winx, y-st->lheight); + glEnd(); + y-=st->lheight; } - if(line==bottom) break; + glBegin(GL_LINE_STRIP); + glVertex2i(x, y); + glVertex2i(x+x2*st->cwidth+1, y); + glVertex2i(x+x2*st->cwidth+1, y-st->lheight); + glVertex2i(x, y-st->lheight); + glEnd(); } } } @@ -1058,16 +1446,16 @@ static void draw_cursor(SpaceText *st, ARegion *ar) Text *text= st->text; int vcurl, vcurc, vsell, vselc, hidden=0; int offl, offc, x, y, w, i; - + /* Draw the selection */ if(text->curl!=text->sell || text->curc!=text->selc) { /* Convert all to view space character coordinates */ wrap_offset(st, ar, text->curl, text->curc, &offl, &offc); vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl; - vcurc = get_char_pos(st, text->curl->line, text->curc) - st->left + offc; + vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc; wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl; - vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc; + vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc; if(vcurc<0) vcurc=0; if(vselc<0) vselc=0, hidden=1; @@ -1106,7 +1494,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar) else { wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl; - vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc; + vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc; if(vselc<0) { vselc= 0; @@ -1115,17 +1503,30 @@ static void draw_cursor(SpaceText *st, ARegion *ar) } if(st->line_hlight) { - y= ar->winy-2 - vsell*st->lheight; - if(!(y<0 || y > ar->winy)) { /* check we need to draw */ - int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - int x2= x1 + ar->winx; - y= ar->winy-2 - vsell*st->lheight; - + int x1, x2, y1, y2; + + if(st->wordwrap) { + int visible_lines = text_get_visible_lines(st, ar, text->sell->line); + int offl, offc; + + wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc); + + y1= ar->winy-2 - (vsell-offl)*st->lheight; + y2= y1-st->lheight*visible_lines+1; + } else { + y1= ar->winy-2 - vsell*st->lheight; + y2= y1-st->lheight+1; + } + + if(!(y1<0 || y2 > ar->winy)) { /* check we need to draw */ + x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + x2= x1 + ar->winx; + glColor4ub(255, 255, 255, 32); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glRecti(x1-4, y, x2, y-st->lheight+1); + glRecti(x1-4, y1, x2, y2); glDisable(GL_BLEND); } } @@ -1138,8 +1539,10 @@ static void draw_cursor(SpaceText *st, ARegion *ar) if(st->overwrite) { char ch= text->sell->line[text->selc]; - if(!ch) ch= ' '; + w= st->cwidth; + if(ch=='\t') w*= st->tabnumber-(vselc+st->left)%st->tabnumber; + UI_ThemeColor(TH_HILITE); glRecti(x, y-st->lheight-1, x+w, y-st->lheight+1); } @@ -1243,7 +1646,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) /* draw opening bracket */ ch= startl->line[startc]; wrap_offset(st, ar, startl, startc, &offl, &offc); - viewc= get_char_pos(st, startl->line, startc) - st->left + offc; + viewc= text_get_char_pos(st, startl->line, startc) - st->left + offc; if(viewc >= 0){ viewl= txt_get_span(text->lines.first, startl) - st->top + offl; @@ -1255,7 +1658,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) /* draw closing bracket */ ch= endl->line[endc]; wrap_offset(st, ar, endl, endc, &offl, &offc); - viewc= get_char_pos(st, endl->line, endc) - st->left + offc; + viewc= text_get_char_pos(st, endl->line, endc) - st->left + offc; if(viewc >= 0) { viewl= txt_get_span(text->lines.first, endl) - st->top + offl; @@ -1273,12 +1676,15 @@ void draw_text_main(SpaceText *st, ARegion *ar) TextLine *tmp; rcti scroll; char linenr[12]; - int i, x, y, winx, linecount= 0; + int i, x, y, winx, linecount= 0, lineno= 0; + int wraplinecount= 0, wrap_skip= 0; /* if no text, nothing to do */ if(!text) return; + text_update_drawcache(st, ar); + /* make sure all the positional pointers exist */ if(!text->curl || !text->sell || !text->lines.first || !text->lines.last) txt_clean_text(text); @@ -1291,12 +1697,28 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* update syntax formatting if needed */ tmp= text->lines.first; + lineno= 0; for(i= 0; itop && tmp; i++) { if(st->showsyntax && !tmp->format) txt_format_line(st, tmp, 0); - tmp= tmp->next; - linecount++; + if(st->wordwrap) { + int lines= text_get_visible_lines_no(st, lineno); + + if (wraplinecount+lines>st->top) { + wrap_skip= st->top-wraplinecount; + break; + } else { + wraplinecount+= lines; + tmp= tmp->next; + linecount++; + } + } else { + tmp= tmp->next; + linecount++; + } + + lineno++; } text_font_begin(st); @@ -1305,7 +1727,6 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* draw line numbers background */ if(st->showlinenrs) { - st->linenrs_tot = (int)floor(log10((float)(linecount + st->viewlines))) + 1; x= TXT_OFFSET + TEXTXLOC; UI_ThemeColor(TH_GRID); @@ -1328,7 +1749,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if(st->showsyntax && !tmp->format) txt_format_line(st, tmp, 0); - if(st->showlinenrs) { + if(st->showlinenrs && !wrap_skip) { /* draw line number */ if(tmp == text->curl) UI_ThemeColor(TH_HILITE); @@ -1344,14 +1765,16 @@ void draw_text_main(SpaceText *st, ARegion *ar) if(st->wordwrap) { /* draw word wrapped text */ - int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format); + int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format, wrap_skip); y -= lines*st->lheight; } else { /* draw unwrapped text */ - text_draw(st, tmp->line, st->left, 0, 1, x, y, tmp->format); + text_draw(st, tmp->line, st->left, ar->winx/st->cwidth, 1, x, y, tmp->format); y -= st->lheight; } + + wrap_skip= 0; } /* draw other stuff */ @@ -1398,6 +1821,12 @@ void text_update_cursor_moved(bContext *C) text_update_character_width(st); i= txt_get_span(text->lines.first, text->sell); + if(st->wordwrap) { + int offl, offc; + wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc); + i+= offl; + } + if(st->top+st->viewlines <= i || st->top > i) st->top= i - st->viewlines/2; diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index a93f30ac62a..81968221765 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -90,12 +90,20 @@ void flatten_string_free(FlattenString *fs); int wrap_width(struct SpaceText *st, struct ARegion *ar); void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc); +void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc); +int text_get_char_pos(struct SpaceText *st, char *line, int cur); + +void text_drawcache_tag_update(struct SpaceText *st, int full); +void text_free_caches(struct SpaceText *st); int text_file_modified(struct Text *text); int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar); void text_pop_suggest_list(); +int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, char *str); +int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to); +int text_get_total_lines(struct SpaceText *st, struct ARegion *ar); /* text_ops.c */ enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR, diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index f8abe0f1900..8ff82ce8be0 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -173,6 +173,7 @@ static int new_exec(bContext *C, wmOperator *op) st->top= 0; } + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text); return OPERATOR_FINISHED; @@ -254,6 +255,7 @@ static int open_exec(bContext *C, wmOperator *op) text->name = NULL; } + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text); MEM_freeN(op->customdata); @@ -315,6 +317,7 @@ static int reload_exec(bContext *C, wmOperator *op) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); return OPERATOR_FINISHED; @@ -357,6 +360,8 @@ static int unlink_exec(bContext *C, wmOperator *op) unlink_text(bmain, text); free_libblock(&bmain->text, text); + + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, NULL); return OPERATOR_FINISHED; @@ -738,6 +743,8 @@ static int paste_exec(bContext *C, wmOperator *op) if(!buf) return OPERATOR_CANCELLED; + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_insert_buf(text, buf); text_update_edited(text); @@ -809,6 +816,8 @@ static int cut_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_copy_clipboard(text); txt_delete_selected(text); @@ -840,6 +849,8 @@ static int indent_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + if(txt_has_sel(text)) { txt_order_cursors(text); indent(text); @@ -874,6 +885,8 @@ static int unindent_exec(bContext *C, wmOperator *op) Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); unindent(text); @@ -909,6 +922,8 @@ static int line_break_exec(bContext *C, wmOperator *op) int a, curts; int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1; + text_drawcache_tag_update(st, 0); + // double check tabs/spaces before splitting the line curts= setcurr_tab_spaces(text, space); txt_split_curline(text); @@ -952,6 +967,8 @@ static int comment_exec(bContext *C, wmOperator *op) Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); comment(text); text_update_edited(text); @@ -983,6 +1000,8 @@ static int uncomment_exec(bContext *C, wmOperator *op) Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); uncomment(text); text_update_edited(text); @@ -1130,6 +1149,7 @@ static int convert_whitespace_exec(bContext *C, wmOperator *op) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); return OPERATOR_FINISHED; @@ -1317,146 +1337,360 @@ static EnumPropertyItem move_type_items[]= { {NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""}, {0, NULL, 0, NULL, NULL}}; +/* get cursor position in line by relative wrapped line and column positions */ +static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int rell, int relc) +{ + int i, j, start, end, chars, max, chop, curs, loop, endj, found, selc; + char ch; + + max= wrap_width(st, ar); + + selc= start= chars= endj= curs= found= 0; + end= max; + chop= loop= 1; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= linein->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(rell==0 && i-start==relc) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ + selc= j; + found= 1; + } + else if(i-end==relc) { + curs= j; + } + if(i-start>=max) { + if(found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if(selc>endj && !chop) selc= endj; + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 1; + rell--; + + if(rell==0 && i-start>=relc) { + selc= curs; + loop= 0; + break; + } + } + else if (ch=='\0') { + if(!found) selc= linein->len; + loop= 0; + break; + } + else if(ch==' ' || ch=='-') { + if(found) { + loop= 0; + break; + } + + if(rell==0 && i-start>=relc) { + selc= curs; + loop= 0; + break; + } + end= i+1; + endj= j; + chop= 0; + } + i++; + } + } + + return selc; +} + +static int cursor_skip_find_line(SpaceText* st, ARegion *ar, Text *text, + int lines, TextLine **linep, int *charp, int *rell, int *relc) +{ + int offl, offc, visible_lines; + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + *relc= text_get_char_pos(st, (*linep)->line, *charp) + offc; + *rell= lines; + + /* handle current line */ + if(lines>0) { + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + + if(*rell-visible_lines+offl>=0) { + if(!(*linep)->next) { + if(offl < visible_lines-1) { + *rell= visible_lines-1; + return 1; + } + + *charp= (*linep)->len; + return 0; + } + + *rell-= visible_lines-offl; + *linep=(*linep)->next; + } else { + *rell+= offl; + return 1; + } + } else { + if(*rell+offl<=0) { + if(!(*linep)->prev) { + if(offl) { + *rell= 0; + return 1; + } + + *charp= 0; + return 0; + } + + *rell+= offl; + *linep=(*linep)->prev; + } else { + *rell+= offl; + return 1; + } + } + + /* skip lines and find destination line and offsets */ + while(*linep) { + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + + if(lines<0) { /* moving top */ + if(*rell+visible_lines >= 0) { + *rell+= visible_lines; + break; + } + + if(!(*linep)->prev) { + *rell= 0; + break; + } + + *rell+= visible_lines; + *linep=(*linep)->prev; + } else { /* moving bottom */ + if(*rell-visible_lines < 0) break; + + if(!(*linep)->next) { + *rell= visible_lines-1; + break; + } + + *rell-= visible_lines; + *linep=(*linep)->next; + } + } + + return 1; +} + static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offc, lin; + TextLine **linep; + int *charp; + int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop; + char ch; text_update_character_width(st); - lin= txt_get_span(text->lines.first, text->sell); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (sel) { - txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, -offc); - text->selc= -offc; - } else { - txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, -offc); - text->curc= -offc; - txt_pop_sel(text); + oldc= *charp; + oldl= txt_get_span(text->lines.first, *linep); + + max= wrap_width(st, ar); + + start= chars= endj= 0; + end= max; + chop= loop= 1; + *charp= 0; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= (*linep)->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start>=max) { + *charp= endj; + + if(j>=oldc) { + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 0; + } + else if(ch==' ' || ch=='-' || ch=='\0') { + if(j>=oldc) { + loop= 0; + break; + } + + end= i+1; + endj= j+1; + chop= 0; + } + i++; + } } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offc, lin, startl, c; + TextLine **linep; + int *charp; + int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop; + char ch; text_update_character_width(st); - lin= txt_get_span(text->lines.first, text->sell); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - startl= offl; - c= text->selc; - while (offl==startl && text->sell->line[c]!='\0') { - c++; - wrap_offset(st, ar, text->sell, c, &offl, &offc); - } if (offl!=startl) c--; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, c); - text->selc= c; - } else { - txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, c); - text->curc= c; - txt_pop_sel(text); + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; + + oldc= *charp; + oldl= txt_get_span(text->lines.first, *linep); + + max= wrap_width(st, ar); + + start= chars= endj= 0; + end= max; + chop= loop= 1; + *charp= 0; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= (*linep)->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start>=max) { + if(endj>=oldc) { + *charp= endj; + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 0; + } else if(ch=='\0') { + *charp= (*linep)->len; + loop= 0; + break; + } else if(ch==' ' || ch=='-') { + end= i+1; + endj= j; + chop= 0; + } + i++; + } } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } static void wrap_move_up(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offl_1, offc, fromline, toline, c, target; + TextLine **linep; + int *charp; + int oldl, oldc, offl, offc, col, newl; text_update_character_width(st); - wrap_offset(st, ar, text->sell, 0, &offl_1, &offc); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - fromline= toline= txt_get_span(text->lines.first, text->sell); - target= text->selc + offc; + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (offl==offl_1) { - if (!text->sell->prev) { - txt_move_bol(text, sel); - return; - } - toline--; - c= text->sell->prev->len; /* End of prev. line */ - wrap_offset(st, ar, text->sell->prev, c, &offl, &offc); - c= -offc+target; + /* store previous position */ + oldc= *charp; + newl= oldl= txt_get_span(text->lines.first, *linep); + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + col= text_get_char_pos(st, (*linep)->line, *charp) + offc; + if(offl) { + *charp= text_get_cursor_rel(st, ar, *linep, offl-1, col); } else { - c= -offc-1; /* End of prev. line */ - wrap_offset(st, ar, text->sell, c, &offl, &offc); - c= -offc+target; - } - if (c<0) c=0; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c); - if (tolinesell= text->sell->prev; - if(text->sell) { - if (c>text->sell->len) c= text->sell->len; - text->selc= c; - } - } - else if(text->curl) { - txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c); - if (tolinecurl= text->curl->prev; - if(text->curl) { - if (c>text->curl->len) c= text->curl->len; - text->curc= c; - txt_pop_sel(text); - } + if((*linep)->prev) { + int visible_lines; + + *linep= (*linep)->prev; + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + *charp= text_get_cursor_rel(st, ar, *linep, visible_lines-1, col); + } else *charp= 0; } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, startoff, offc, fromline, toline, c, target; + TextLine **linep; + int *charp; + int oldl, oldc, offl, offc, col, newl, visible_lines; text_update_character_width(st); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - fromline= toline= txt_get_span(text->lines.first, text->sell); - target= text->selc + offc; - startoff= offl; - c= text->selc; - while (offl==startoff && text->sell->line[c]!='\0') { - c++; - wrap_offset(st, ar, text->sell, c, &offl, &offc); - } + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (text->sell->line[c]=='\0') { - if (!text->sell->next) { - txt_move_eol(text, sel); - return; - } - toline++; - c= target; + /* store previous position */ + oldc= *charp; + newl= oldl= txt_get_span(text->lines.first, *linep); + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + col= text_get_char_pos(st, (*linep)->line, *charp) + offc; + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + if(offl text->sell->len) c= text->sell->len; - } - if (c<0) c=0; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c); - if (toline>fromline) text->sell= text->sell->next; - if(text->sell) { - if (c>text->sell->len) c= text->sell->len; - text->selc= c; - } - } - else if(text->curl) { - txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c); - if (toline>fromline) text->curl= text->curl->next; - if(text->curl) { - if (c > text->curl->len) c= text->curl->len; - text->curc= c; - txt_pop_sel(text); - } + if((*linep)->next) { + *linep= (*linep)->next; + *charp= text_get_cursor_rel(st, ar, *linep, 0, col); + } else *charp= (*linep)->len; } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } /* Moves the cursor vertically by the specified number of lines. @@ -1465,7 +1699,7 @@ static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) This is to replace screen_skip for PageUp/Down operations. */ -static void cursor_skip(Text *text, int lines, int sel) +static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int sel) { TextLine **linep; int oldl, oldc, *charp; @@ -1475,13 +1709,21 @@ static void cursor_skip(Text *text, int lines, int sel) oldl= txt_get_span(text->lines.first, *linep); oldc= *charp; - while (lines>0 && (*linep)->next) { - *linep= (*linep)->next; - lines--; - } - while (lines<0 && (*linep)->prev) { - *linep= (*linep)->prev; - lines++; + if(st && ar && st->wordwrap) { + int rell, relc; + + /* find line and offsets inside it needed to set cursor position */ + if(cursor_skip_find_line(st, ar, text, lines, linep, charp, &rell, &relc)) + *charp= text_get_cursor_rel (st, ar, *linep, rell, relc); + } else { + while (lines>0 && (*linep)->next) { + *linep= (*linep)->next; + lines--; + } + while (lines<0 && (*linep)->prev) { + *linep= (*linep)->prev; + lines++; + } } if (*charp > (*linep)->len) *charp= (*linep)->len; @@ -1546,18 +1788,18 @@ static int move_cursor(bContext *C, int type, int select) break; case PREV_PAGE: - if(st) cursor_skip(text, -st->viewlines, select); - else cursor_skip(text, -10, select); + if(st) cursor_skip(st, ar, st->text, -st->viewlines, select); + else cursor_skip(NULL, NULL, text, -10, select); break; case NEXT_PAGE: - if(st) cursor_skip(text, st->viewlines, select); - else cursor_skip(text, 10, select); + if(st) cursor_skip(st, ar, st->text, st->viewlines, select); + else cursor_skip(NULL, NULL, text, 10, select); break; } text_update_cursor_moved(C); - WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); return OPERATOR_FINISHED; } @@ -1665,6 +1907,8 @@ static int delete_exec(bContext *C, wmOperator *op) Text *text= CTX_data_edit_text(C); int type= RNA_enum_get(op->ptr, "type"); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + if(type == DEL_PREV_WORD) txt_backspace_word(text); else if(type == DEL_PREV_CHAR) @@ -1729,13 +1973,13 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot) /******************* scroll operator **********************/ /* Moves the view vertically by the specified number of lines */ -static void screen_skip(SpaceText *st, int lines) +static void screen_skip(SpaceText *st, ARegion *ar, int lines) { int last; - st->top += lines; + st->top += lines; - last= txt_get_span(st->text->lines.first, st->text->lines.last); + last= text_get_total_lines(st, ar); last= last - (st->viewlines/2); if(st->top>last) st->top= last; @@ -1756,12 +2000,14 @@ typedef struct TextScroll { static int scroll_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); + ARegion *ar= CTX_wm_region(C); + int lines= RNA_int_get(op->ptr, "lines"); if(lines == 0) return OPERATOR_CANCELLED; - screen_skip(st, lines*U.wheellinescroll); + screen_skip(st, ar, lines*U.wheellinescroll); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1771,6 +2017,7 @@ static int scroll_exec(bContext *C, wmOperator *op) static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); + ARegion *ar= CTX_wm_region(C); TextScroll *tsc= op->customdata; short *mval= event->mval; @@ -1792,7 +2039,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) tsc->delta[1]= (tsc->hold[1]-mval[1])*st->pix_per_line; if(tsc->delta[0] || tsc->delta[1]) { - screen_skip(st, tsc->delta[1]); + screen_skip(st, ar, tsc->delta[1]); tsc->lines += tsc->delta[1]; @@ -1969,7 +2216,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) Text *text= st->text; TextLine **linep; int *charp; - int w; + int w, tabs; text_update_character_width(st); @@ -1987,16 +2234,28 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) x = (x/st->cwidth) + st->left; if(st->wordwrap) { - int i, j, endj, curs, max, chop, start, end, chars, loop; + int i, j, endj, curs, max, chop, start, end, chars, loop, found; char ch; /* Point to first visible line */ *linep= text->lines.first; - for(i=0; itop && (*linep)->next; i++) *linep= (*linep)->next; + i= st->top; + while(i>0 && *linep) { + int lines= text_get_visible_lines(st, ar, (*linep)->line); + + if (i-lines<0) { + y+= i; + break; + } else { + *linep= (*linep)->next; + i-= lines; + } + } max= wrap_width(st, ar); loop= 1; + found= 0; while(loop && *linep) { start= 0; end= max; @@ -2004,12 +2263,14 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) chars= 0; curs= 0; endj= 0; + tabs= 0; for(i=0, j=0; loop; j++) { /* Mimic replacement of tabs */ ch= (*linep)->line[j]; if(ch=='\t') { chars= st->tabnumber-i%st->tabnumber; + tabs+= chars-1; ch= ' '; } else @@ -2021,22 +2282,34 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) *charp= endj; loop= 0; break; - /* Exactly at the cursor, done */ + /* Exactly at the cursor */ } else if(y==0 && i-start==x) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ *charp= curs= j; - loop= 0; - break; + found= 1; /* Prepare curs for next wrap */ } else if(i-end==x) { curs= j; } if(i-start>=max) { + if(found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if(*charp>endj && !chop) (*charp)= endj; + loop= 0; + break; + } + if(chop) endj= j; - y--; start= end; end += max; + + if(start-tabs<(*linep)->len) + y--; + chop= 1; if(y==0 && i-start>=x) { *charp= curs; @@ -2045,6 +2318,11 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) } } else if(ch==' ' || ch=='-' || ch=='\0') { + if(found) { + loop= 0; + break; + } + if(y==0 && i-start>=x) { *charp= curs; loop= 0; @@ -2102,7 +2380,7 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) if(event->mval[1]<0 || event->mval[1]>ar->winy) { int d= (scu->old[1]-event->mval[1])*st->pix_per_line; - if(d) screen_skip(st, d); + if(d) screen_skip(st, ar, d); set_cursor_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1); @@ -2290,6 +2568,8 @@ static int insert_exec(bContext *C, wmOperator *op) char *str; int done = 0, i; + text_drawcache_tag_update(st, 0); + str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); if(st && st->overwrite) { @@ -2396,6 +2676,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) } text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); } else if(mode==TEXT_MARK_ALL) { char color[4]; @@ -2741,6 +3022,7 @@ void ED_text_undo_step(bContext *C, int step) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index ce038ee4a95..0e2eea0b942 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -318,6 +318,8 @@ typedef struct SpaceText { char findstr[256]; /* ST_MAX_FIND_STR */ char replacestr[256]; /* ST_MAX_FIND_STR */ + + void *drawcache; /* cache for faster drawing */ } SpaceText; typedef struct Script { -- cgit v1.2.3 From d058a9c8c3d5481fa0c82c8118d207fda6b56830 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 07:43:39 +0000 Subject: bugfix [#23150] Creating Vertex with CTRL-LMB not snapping - Added EM_project_snap_verts so other functions can re-use this, similar to old retopo_do_all(). - Changed how the normal for selected geometry is calculated, was accumulating half selected edge's into normals which was OK with even surrounding geometry but could skew too easily if the surroundings were not so even. Now use the 2D screen space selected edge vector to calculate the normals in relation to the target mouse position. - Option to rotate initial selection, gives better results in some cases. (Ctrl+Shift+Click to disable) http://wiki.blender.org/index.php/File:ClickExtrudeFix.png --- source/blender/editors/include/ED_mesh.h | 2 + source/blender/editors/mesh/editmesh_add.c | 76 ++++++++++++++++++++++++------ source/blender/editors/mesh/editmesh_lib.c | 16 +++++++ source/blender/editors/mesh/mesh_ops.c | 3 +- 4 files changed, 81 insertions(+), 16 deletions(-) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index c4477ee5a8e..313df32fd6f 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -159,6 +159,8 @@ void EM_solidify(struct EditMesh *em, float dist); int EM_deselect_nth(struct EditMesh *em, int nth); +void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em); + /* editmesh_mods.c */ extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs; diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 90c5314bf3d..5850dc706b0 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -110,17 +110,20 @@ static short icoface[20][3] = { static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) { ViewContext vc; - EditVert *eve, *v1; + EditVert *eve; float min[3], max[3]; int done= 0; + int rot_src= RNA_boolean_get(op->ptr, "rotate_source"); em_setup_viewcontext(C, &vc); + invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + INIT_MINMAX(min, max); - for(v1= vc.em->verts.first;v1; v1=v1->next) { - if(v1->f & SELECT) { - DO_MINMAX(v1->co, min, max); + for(eve= vc.em->verts.first; eve; eve= eve->next) { + if(eve->f & SELECT) { + DO_MINMAX(eve->co, min, max); done= 1; } } @@ -131,25 +134,56 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) float vec[3], cent[3], mat[3][3]; float nor[3]= {0.0, 0.0, 0.0}; - /* check for edges that are half selected, use for rotation */ + /* 2D normal calc */ + float mval_f[2]= {(float)event->mval[0], (float)event->mval[1]}; + +#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) + done= 0; + + /* calculate the normal for selected edges */ for(eed= vc.em->edges.first; eed; eed= eed->next) { - if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) { - if(eed->v1->f & SELECT) sub_v3_v3v3(vec, eed->v1->co, eed->v2->co); - else sub_v3_v3v3(vec, eed->v2->co, eed->v1->co); - add_v3_v3(nor, vec); + if(eed->f & SELECT) { + float co1[3], co2[3]; + mul_v3_m4v3(co1, vc.obedit->obmat, eed->v1->co); + mul_v3_m4v3(co2, vc.obedit->obmat, eed->v2->co); + project_float_noclip(vc.ar, co1, co1); + project_float_noclip(vc.ar, co2, co2); + + /* 2D rotate by 90d while subtracting + * (x, y) = (y, -x) + * + * accumulate the screenspace normal in 2D, + * with screenspace edge length weighting the result. */ + if(SIDE_OF_LINE(co1, co2, mval_f) >= 0.0f) { + nor[0] += (co1[1] - co2[1]); + nor[1] += -(co1[0] - co2[0]); + } + else { + nor[0] += (co2[1] - co1[1]); + nor[1] += -(co2[0] - co1[0]); + } done= 1; } } + +#undef SIDE_OF_LINE + if(done) { float view_vec[3], cross[3]; + /* convert the 2D nomal into 3D */ + mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* worldspace */ + mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */ + /* correct the normal to be aligned on the view plane */ copy_v3_v3(view_vec, vc.rv3d->viewinv[2]); mul_mat3_m4_v3(vc.obedit->imat, view_vec); cross_v3_v3v3(cross, nor, view_vec); cross_v3_v3v3(nor, view_vec, cross); normalize_v3(nor); + + /* correct for flipping */ } /* center */ @@ -159,10 +193,9 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) mul_m4_v3(vc.obedit->obmat, min); // view space view3d_get_view_aligned_coordinate(&vc, min, event->mval); - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); mul_m4_v3(vc.obedit->imat, min); // back in object space - sub_v3_v3v3(min, min, cent); + sub_v3_v3(min, cent); /* calculate rotation */ unit_m3(mat); @@ -179,16 +212,22 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) cross_v3_v3v3(cross, nor, vec); normalize_v3(cross); dot= 0.5f*saacos(dot); + + /* halve the rotation if its applied twice */ + if(rot_src) dot *= 0.5f; + si= (float)sin(dot); q1[0]= (float)cos(dot); q1[1]= cross[0]*si; q1[2]= cross[1]*si; - q1[3]= cross[2]*si; - + q1[3]= cross[2]*si; quat_to_mat3( mat,q1); } } + if(rot_src) + rotateflag(vc.em, SELECT, cent, mat); + extrudeflag(vc.obedit, vc.em, SELECT, nor, 0); rotateflag(vc.em, SELECT, cent, mat); translateflag(vc.em, SELECT, min); @@ -213,8 +252,13 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) eve->f= SELECT; } - - //retopo_do_all(); + + if( ((vc.scene->toolsettings->snap_flag & (SCE_SNAP|SCE_SNAP_PROJECT))==(SCE_SNAP|SCE_SNAP_PROJECT)) && + (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE) + ) { + EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); + } + WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA); @@ -234,6 +278,8 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape"); } diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index d34cca0d358..209a7975357 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -58,6 +58,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data #include "ED_mesh.h" #include "ED_screen.h" #include "ED_view3d.h" +#include "ED_transform.h" #include "mesh_intern.h" @@ -2765,3 +2766,18 @@ int EM_deselect_nth(EditMesh *em, int nth) return 0; } +void EM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, EditMesh *em) +{ + EditVert *eve; + for(eve= em->verts.first;eve; eve=eve->next) { + if(eve->f & SELECT) { + float mval[2], vec[3], no_dummy[3]; + int dist_dummy; + mul_v3_m4v3(vec, obedit->obmat, eve->co); + project_float_noclip(ar, vec, mval); + if(snapObjectsContext(C, mval, &dist_dummy, vec, no_dummy, SNAP_NOT_OBEDIT)) { + mul_v3_m4v3(eve->co, obedit->imat, vec); + } + } + } +} diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 51a4c67b19b..2ff7095cfea 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -292,7 +292,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) /* use KM_CLICK because same key is used for tweaks */ WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); - + RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0)->ptr, "rotate_source", 0); + WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0); -- cgit v1.2.3 From 996efebbe36a06ba45b9a79328a0dadc87ea2ff9 Mon Sep 17 00:00:00 2001 From: Luca Bonavita Date: Wed, 13 Oct 2010 10:42:33 +0000 Subject: == python api doc == First commit to make some structure in doc/ directory. - moved source/blender/python/doc -> doc/python_api - moved source/gameengine/PyDoc/*.rst -> doc/python_api/rst - modified accordingly sphinx_doc_gen.py and sphinx_doc_gen.sh (later on I'll try alternative/ scripts by neXyon as promised :) - source/gameengine/PyDoc/ is still there because contains epydoc stuff for the bge, will ask more and look into it later --- doc/python_api/blender-org/layout.html | 201 + doc/python_api/blender-org/page.html | 4 + doc/python_api/blender-org/static/bg.png | Bin 0 -> 55840 bytes doc/python_api/blender-org/static/default.css_t | 654 +++ doc/python_api/blender-org/static/favicon.ico | Bin 0 -> 1150 bytes .../blender-org/static/jquery.sidebar.js | 26 + doc/python_api/blender-org/static/pygments.css | 61 + doc/python_api/blender-org/static/rnd.png | Bin 0 -> 173 bytes doc/python_api/blender-org/static/rndbl.png | Bin 0 -> 190 bytes doc/python_api/blender-org/static/rndbr.png | Bin 0 -> 188 bytes doc/python_api/blender-org/theme.conf | 30 + doc/python_api/epy/BGL.py | 1807 +++++++ doc/python_api/epy/Geometry.py | 189 + doc/python_api/epy/IDProp.py | 132 + doc/python_api/epy/Mathutils.py | 156 + doc/python_api/epy/testbgl.py | 45 + doc/python_api/examples/bpy.data.py | 29 + doc/python_api/examples/mathutils.Euler.py | 3 + doc/python_api/examples/mathutils.Matrix.py | 3 + doc/python_api/examples/mathutils.Quaternion.py | 3 + doc/python_api/examples/mathutils.Vector.py | 55 + doc/python_api/examples/mathutils.py | 18 + doc/python_api/rst/bge.events.rst | 250 + doc/python_api/rst/bge.logic.rst | 932 ++++ doc/python_api/rst/bge.render.rst | 242 + doc/python_api/rst/bge.types.rst | 5227 ++++++++++++++++++++ doc/python_api/sphinx_doc_gen.py | 872 ++++ doc/python_api/sphinx_doc_gen.sh | 37 + source/blender/python/doc/epy/BGL.py | 1807 ------- source/blender/python/doc/epy/Geometry.py | 189 - source/blender/python/doc/epy/IDProp.py | 132 - source/blender/python/doc/epy/Mathutils.py | 156 - source/blender/python/doc/epy/testbgl.py | 45 - source/blender/python/doc/examples/bpy.data.py | 29 - .../blender/python/doc/examples/mathutils.Euler.py | 3 - .../python/doc/examples/mathutils.Matrix.py | 3 - .../python/doc/examples/mathutils.Quaternion.py | 3 - .../python/doc/examples/mathutils.Vector.py | 55 - source/blender/python/doc/examples/mathutils.py | 18 - source/blender/python/doc/sphinx_doc_gen.py | 862 ---- source/blender/python/doc/sphinx_doc_gen.sh | 35 - source/gameengine/PyDoc/bge.events.rst | 250 - source/gameengine/PyDoc/bge.logic.rst | 932 ---- source/gameengine/PyDoc/bge.render.rst | 242 - source/gameengine/PyDoc/bge.types.rst | 5227 -------------------- 45 files changed, 10976 insertions(+), 9988 deletions(-) create mode 100644 doc/python_api/blender-org/layout.html create mode 100644 doc/python_api/blender-org/page.html create mode 100644 doc/python_api/blender-org/static/bg.png create mode 100644 doc/python_api/blender-org/static/default.css_t create mode 100644 doc/python_api/blender-org/static/favicon.ico create mode 100644 doc/python_api/blender-org/static/jquery.sidebar.js create mode 100644 doc/python_api/blender-org/static/pygments.css create mode 100644 doc/python_api/blender-org/static/rnd.png create mode 100644 doc/python_api/blender-org/static/rndbl.png create mode 100644 doc/python_api/blender-org/static/rndbr.png create mode 100644 doc/python_api/blender-org/theme.conf create mode 100644 doc/python_api/epy/BGL.py create mode 100644 doc/python_api/epy/Geometry.py create mode 100644 doc/python_api/epy/IDProp.py create mode 100644 doc/python_api/epy/Mathutils.py create mode 100644 doc/python_api/epy/testbgl.py create mode 100644 doc/python_api/examples/bpy.data.py create mode 100644 doc/python_api/examples/mathutils.Euler.py create mode 100644 doc/python_api/examples/mathutils.Matrix.py create mode 100644 doc/python_api/examples/mathutils.Quaternion.py create mode 100644 doc/python_api/examples/mathutils.Vector.py create mode 100644 doc/python_api/examples/mathutils.py create mode 100644 doc/python_api/rst/bge.events.rst create mode 100644 doc/python_api/rst/bge.logic.rst create mode 100644 doc/python_api/rst/bge.render.rst create mode 100644 doc/python_api/rst/bge.types.rst create mode 100644 doc/python_api/sphinx_doc_gen.py create mode 100755 doc/python_api/sphinx_doc_gen.sh delete mode 100644 source/blender/python/doc/epy/BGL.py delete mode 100644 source/blender/python/doc/epy/Geometry.py delete mode 100644 source/blender/python/doc/epy/IDProp.py delete mode 100644 source/blender/python/doc/epy/Mathutils.py delete mode 100644 source/blender/python/doc/epy/testbgl.py delete mode 100644 source/blender/python/doc/examples/bpy.data.py delete mode 100644 source/blender/python/doc/examples/mathutils.Euler.py delete mode 100644 source/blender/python/doc/examples/mathutils.Matrix.py delete mode 100644 source/blender/python/doc/examples/mathutils.Quaternion.py delete mode 100644 source/blender/python/doc/examples/mathutils.Vector.py delete mode 100644 source/blender/python/doc/examples/mathutils.py delete mode 100644 source/blender/python/doc/sphinx_doc_gen.py delete mode 100755 source/blender/python/doc/sphinx_doc_gen.sh delete mode 100644 source/gameengine/PyDoc/bge.events.rst delete mode 100644 source/gameengine/PyDoc/bge.logic.rst delete mode 100644 source/gameengine/PyDoc/bge.render.rst delete mode 100644 source/gameengine/PyDoc/bge.types.rst diff --git a/doc/python_api/blender-org/layout.html b/doc/python_api/blender-org/layout.html new file mode 100644 index 00000000000..a37ed730c22 --- /dev/null +++ b/doc/python_api/blender-org/layout.html @@ -0,0 +1,201 @@ +{%- block doctype -%} + +{%- endblock %} +{%- set script_files = script_files + [pathto("_static/jquery.sidebar.js", 1)] %} +{%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %} +{%- set reldelim2 = reldelim2 is not defined and ' •' or reldelim2 %} + +{%- macro relbar() %} + + +{%- endmacro %} + +{%- macro sidebar() %} + {%- if not embedded %}{% if not theme_nosidebar|tobool %} +
+
+ {%- block sidebarlogo %} + {%- if logo %} + + {%- endif %} + {%- endblock %} + {%- block sidebartoc %} + {%- if display_toc %} +

{{ _('Table Of Contents') }}

+ {{ toc }} + {%- endif %} + {%- endblock %} + {%- block sidebarrel %} + {%- if prev %} +

{{ _('Previous topic') }}

+

{{ prev.title }}

+ {%- endif %} + {%- if next %} +

{{ _('Next topic') }}

+

{{ next.title }}

+ {%- endif %} + {%- endblock %} + {%- block sidebarsourcelink %} + {%- if show_source and has_source and sourcename %} +

{{ _('This Page') }}

+ + {%- endif %} + {%- endblock %} + {%- if customsidebar %} + {% include customsidebar %} + {%- endif %} + {%- block sidebarsearch %} + {%- if pagename != "search" %} + + + {%- endif %} + {%- endblock %} +
+
+ {%- endif %}{% endif %} +{%- endmacro %} + + + + + {{ metatags }} + {%- if not embedded and docstitle %} + {%- set titlesuffix = " — "|safe + docstitle|e %} + {%- else %} + {%- set titlesuffix = "" %} + {%- endif %} + {{ title|striptags }}{{ titlesuffix }} + + + {%- if not embedded %} + + {%- for scriptfile in script_files %} + + {%- endfor %} + {%- if use_opensearch %} + + {%- endif %} + {%- if favicon %} + + {%- endif %} + {%- endif %} +{%- block linktags %} + {%- if hasdoc('about') %} + + {%- endif %} + {%- if hasdoc('genindex') %} + + {%- endif %} + {%- if hasdoc('search') %} + + {%- endif %} + {%- if hasdoc('copyright') %} + + {%- endif %} + + {%- if parents %} + + {%- endif %} + {%- if next %} + + {%- endif %} + {%- if prev %} + + {%- endif %} +{%- endblock %} +{%- block extrahead %} {% endblock %} + + +{%- block header %} + +{% endblock %} + +
+ +{%- block relbar1 %}{{ relbar() }}{% endblock %} + +{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %} + +{%- block document %} +
+ {%- if not embedded %}{% if not theme_nosidebar|tobool %} +
+ {%- endif %}{% endif %} +
+ {% block body %} {% endblock %} +
+ {%- if not embedded %}{% if not theme_nosidebar|tobool %} +
+ {%- endif %}{% endif %} +
+{%- endblock %} + +{%- block sidebar2 %}{{ sidebar() }}{% endblock %} +
+ +{%- block footer %} + +{%- endblock %} +
+ + diff --git a/doc/python_api/blender-org/page.html b/doc/python_api/blender-org/page.html new file mode 100644 index 00000000000..17a93016533 --- /dev/null +++ b/doc/python_api/blender-org/page.html @@ -0,0 +1,4 @@ +{% extends "layout.html" %} +{% block body %} + {{ body }} +{% endblock %} diff --git a/doc/python_api/blender-org/static/bg.png b/doc/python_api/blender-org/static/bg.png new file mode 100644 index 00000000000..5393d4aa58f Binary files /dev/null and b/doc/python_api/blender-org/static/bg.png differ diff --git a/doc/python_api/blender-org/static/default.css_t b/doc/python_api/blender-org/static/default.css_t new file mode 100644 index 00000000000..6f3f25d8a6a --- /dev/null +++ b/doc/python_api/blender-org/static/default.css_t @@ -0,0 +1,654 @@ +/** + * Sphinx stylesheet -- default theme + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +#navcontainer { + height: 50px; + margin: 0 auto; + position: relative; + width: 980px; +} + +#navcontainer img { + width: 140px; + height: 50px; +} + +#pageheader { + background-image:url("bg.png"); + height:80px; + position:relative; +} + +body { + font-family: {{ theme_bodyfont }}; + font-size: 12px; + line-height: 145%; + background-color: {{ theme_footerbgcolor }}; + color: {{ theme_textcolor }}; + min-width: 980px; + margin: 0; + padding: 0; +} + +div.document { + margin:20px auto 0; + position:relative; + text-align:left; + width:980px; +/* background-color: {{ theme_sidebarbgcolor }};*/ +} + +div.documentwrapper { + float: left; + width: 100%; + background-color: {{ theme_bgcolor }}; + border-color: {{ theme_bordercolor }}; + border-style:solid; + border-width:0 1px; + margin:0 auto; + min-height:30em; + padding:35px; +/* position:relative;*/ + text-align:left; + width:908px; + +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +div.body { + background-color: {{ theme_bgcolor }}; + color: {{ theme_textcolor }}; + padding: 0; + width: 640px; +} + +{%- if theme_rightsidebar|tobool %} +div.bodywrapper { + margin: 0 230px 0 0; +} +{%- endif %} + +div.footer { + background: #292929; + border-left: 1px solid #363636; + border-right: 1px solid #363636; + color: #ffffff; +/* width: 100%;*/ + margin: 0 auto; + padding: 20px 20px 15px 35px; + text-align: center; + font-size: 75%; +} + +div.footer+.round b { + display: block; + background: #292929; + width: auto; +} + +div.footer+.round #r1 { + border-left: 1px solid #363636; + border-right: 1px solid #363636; + height: 2px; + margin: 0 1px; +} + +div.footer+.round #r2 { + border-left: 1px solid #363636; + border-right: 1px solid #363636; + height: 1px; + margin: 0 2px; +} + +div.footer+.round #r3 { + border-left: 1px solid #363636; + border-right: 1px solid #363636; + height: 1px; + margin: 0 3px; +} + +div.footer+.round #r4 { + border-bottom: 1px solid #363636; + height: 0px; + margin: 0 5px; +} + +div.footer a { + color: {{ theme_footertextcolor }}; + text-decoration: underline; +} + +.boxheader { + background-color:#3E4D5E; +} + +.subnav { + height:auto !important; + min-height:15px; + padding:9px 0px 9px 37px; + position:relative; +} + +div.related { + width:auto; + font-size:100%; + font-weight:400; + background-color: {{ theme_relbarbgcolor }}; + line-height: 145%; + color: {{ theme_relbartextcolor }}; +} + +div.related li { + font-size:0.9em; +} + +div.related li.right { + margin: 0; + word-spacing: 3px; +} + +div.subnav li { + display:inline; + list-style-type:none; + margin:0; + padding:0 7px 0 0; +} + +div.subnav ul { + display:inline; + margin:0; + padding:0; +} + +.subnav a { + font-weight: bold; + color: #fff; +} + +.subnav li.subnav-active a { + color:#F39410; +} + +div.related a { + color: {{ theme_relbarlinkcolor }}; +} + +div.related a:active { + color: {{ theme_relbaractlinkcolor }}; +} + +div.sphinxsidebar { + width: 280px; + font-size: 100%; + {%- if theme_stickysidebar|tobool %} +/* top: 30px;*/ + margin: 0; + position: absolute; + overflow: auto; + height: 100%; + {%- endif %} + {%- if theme_rightsidebar|tobool %} + float: right; + {%- if theme_stickysidebar|tobool %} + right: 0; + {%- endif %} + {%- endif %} +} + +div.sphinxsidebarwrapper { + width: inherit; + padding: 0; + position: absolute; + margin-top: 35px; + font-size: 8pt; +} + +div.sphinxsidebarwrapper.fixed { + position:fixed; + top:10px; + margin-top: 0; +} + +{%- if theme_stickysidebar|tobool %} +/* this is nice, but it it leads to hidden headings when jumping + to an anchor */ +/* +div.related { + position: fixed; +} + +div.documentwrapper { + margin-top: 30px; +} +*/ +{%- endif %} + +div.sphinxsidebar h3 { + font-family: {{ theme_headfont }}; + color: {{ theme_sidebartextcolor }}; + font-size: 12px; + font-weight: bold; + background: #3E4D5E url("rnd.png") no-repeat top left; + height: 16px; + margin: 0; + padding: 10px 5px 10px 18px; +} + +div.sphinxsidebar h3 a { + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar h4 { + font-family: {{ theme_headfont }}; + color: {{ theme_sidebartextcolor }}; + background: #3E4D5E url("rnd.png") no-repeat top left; + height: 16px; + font-size: 12px; + font-weight: bold; + margin: 0; + padding: 10px 5px 10px 18px; +} + +div.sphinxsidebar form { + margin: 0; + padding: 10px; + background-color: #292929; + {%- if theme_rightsidebar|tobool %} + border-right: 1px solid {{ theme_bordercolor }}; + {%- endif %} +} + +div.sphinxsidebar p { + background-color: #292929; + padding: 5px 10px 10px 10px; + color: {{ theme_sidebartextcolor }}; + {%- if theme_rightsidebar|tobool %} + border-right: 1px solid {{ theme_bordercolor }}; + {%- endif %} + margin-top: 0; +} + +div.sphinxsidebar p.topless { + margin-bottom: 25px; +} + +div.sphinxsidebar ul { + background-color: #292929; + margin: 0; + padding: 0; + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar > div > ul { + margin-bottom: 25px; + padding:10px; +} + +div.sphinxsidebar a { + color: {{ theme_sidebarlinkcolor }}; +} + +div.sphinxsidebar input { + border: 1px solid {{ theme_sidebarlinkcolor }}; + font-family: sans-serif; + font-size: 1em; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: {{ theme_linkcolor }}; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +/*div.body h1,*/ +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: {{ theme_headfont }}; + background-color: {{ theme_headbgcolor }}; + font-weight: bold; + color: {{ theme_headtextcolor }}; +/* border-bottom: 1px solid #ccc;*/ + margin: 20px -20px 10px -20px; + padding: 3px 0 3px 10px; +} + +div.body h1 { margin-top: 0; font-size: 200%; + color:#FFFAE0; + font-family:"Helvetica","Arial",sans-serif; + font-size:34px; + font-weight:normal; + left:32px; + line-height:26px; + margin-top:0; + position:absolute; + top:36px; +} +div.body h2 { font-size: 160%; } +div.body h3 { font-size: 140%; } +div.body h4 { font-size: 120%; } +div.body h5 { font-size: 110%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: {{ theme_headlinkcolor }}; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +h1:hover > a.headerlink { + display:none; +} + +a.headerlink:hover { + background-color: {{ theme_headlinkcolor }}; + color: white; +} + +div.body p, div.body dd, div.body li { + text-align: justify; + line-height: 130%; +} + +div.note, div.seealso, div.topic, div.warning { + color:white; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.note { + background-color: #555; + border: 1px solid #ddd; +} + +div.seealso { + background-color: #525241; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #B64444; + border: 1px solid #990606; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +dl div.admonition { + border:medium none; + margin:0; + padding:2px 5px 2px 0; +} + +dl.class > dd > div.warning p.admonition-title, +dl.class > dd > div.note p.admonition-title { + display:none; +} + +dl.class > dd > div.admonition.warning p, +dl.class > dd > div.admonition.note p { + margin:0; +} + +dl.class > dd > div.admonition.warning, +dl.class > dd > div.admonition.note { + margin-bottom:12px; +} + +dl div.admonition.note p.admonition-title, dl div.admonition.warning p.admonition-title { + color:inherit; +} + +dl div.admonition.warning p { + font-weight:bold; + line-height:150%; +} + +dl div.admonition.warning p * { + font-weight:normal; +} + +dl div.admonition p.admonition-title { + color:#555555; + display:block; + float:left; + margin:0; + padding-right:12px; + text-align:right; + width:90px; +} + +dl div.admonition p.admonition-title+p, dl div.admonition p { + display:block; + margin:0 0 0 102px; +} + +dl div.note { + background:none; + color:#E8E481; +} + +dl div.warning { + background:none; + color:#FC3030; +} + +dl div.seealso { + background:none; +} + +dl div.admonition.seealso p+p { + color:#222; +} + +dl div.seealso a { + margin-left:-1.3ex; +} + +div.admonition.warning pre { + background: #0F0704; + color: #fc3030; +} + +div.admonition pre { + margin: 6px 0; + overflow: visible; + white-space: pre-wrap; +} + +pre { + padding: 10px; + background-color: #000; + color: #fff; + line-height: normal; + border: 0 solid white; +} + +dl.function>dt, dl.method>dt { + text-indent:-118px; + padding-left: 118px; +} + +dl.function>dt em, dl.method>dt em { + color: #97b9cf; +} + +dl.function>dd em, dl.method>dd em { + color: #97b9cf; + font-weight:bold; +} + +dl.function table.field-list tr:first-child td.field-body, dl.method table.field-list tr:first-child td.field-body { + color: #728c96; +} + +dl.function>dt em:before, dl.method>dt em:before { + content: " "; + display: block; +} + +dl.function>dd>p,dl.method>dd>p,dl.attribute>dd>p, +dl[class]>dd>ol,dl[class]>dd>ul { + color: #999; +} + +dl.data>dt { + color:#08C659; +} + +dl.data>dd>p { + color:#069643; +} + +dl.class>dt { + color: #82a3c7; +} + +dl.class>dd>p,dl.class>dd>ol,dl.class>dd>ul { + color: #637b96; +} + +dl.function>dt,dl.method>dt,dl.attribute>dt { + color: #fcb100; +} + +dl.function>dd>p,dl.method>dd>p,dl.attribute>dd>p, +dl.function>dd>p+ol,dl.method>dd>p+ol,dl.attribute>dd>p+ol, +dl.function>dd>p+ul,dl.method>dd>p+ul,dl.attribute>dd>p+ul { + color: #cb8f00; +} + +dl.function>dd>p, dl.method>dd>p, dl.attribute>dd>p { + margin: 0 0 3px 102px; +} + +dl.function>dd>p:first-child:before, dl.method>dd>p:first-child:before, dl.attribute>dd>p:first-child:before { + content:"Description:"; + color:#555; + font-weight:bold; + font-style:normal; + width:90px; + display:inline-block; + margin-left:-102px; + text-align:right; + padding-right:12px; +} + +dt:target, .highlight { + color: #444; + background: #333; +} + +.highlight { + background: #E2C788; +} + +h1 .highlight { + color:inherit; + background:inherit; +} + +dl { + margin-bottom: 25px; +} + +dd { + margin: 3px 0 10px 15px; +} + +.field-body tt.literal { + font-weight: normal; +} + +tt { + background-color: #444; + padding: 0 1px 0 1px; + font-size: 0.95em; +} + +.warning tt { + background: #cc6262; +} + +.note tt { + background: #444; +} + +dl .warning tt { + background:#0F0704; + display:block; +} + +dl .note tt { + background:#2C2A1B; +} + +table.indextable tr.cap { + background-color: transparent; +} + +col.field-name { + width:90px; +} + +dd table { + margin-bottom: 0; +} + +table.field-list th { + color:#555; + padding:0; + text-align:right; +} + +table.field-list td.field-body { + color:#999999; + padding-left:12px; +} + +table.field-list td.field-body ul.first { + padding-left:0; + list-style:none; + margin-left:0; +} + +dl.function>dd>ol, dl.method>dd>ol, dl.attribute>dd>ol, +dl.function>dd>ul, dl.method>dd>ul, dl.attribute>dd>ul, +dl.function>dd>div[class|="highlight"], dl.method>dd>div[class|="highlight"], +dl.attribute>dd>div[class|="highlight"] { + margin-left:102px; +} + +dl.function>dd>ol, dl.method>dd>ol, dl.attribute>dd>ol, +dl.function>dd>ul, dl.method>dd>ul, dl.attribute>dd>ul, +dl.class>dd>ol, dl.class>dd>ul { + padding-left:20px; +} diff --git a/doc/python_api/blender-org/static/favicon.ico b/doc/python_api/blender-org/static/favicon.ico new file mode 100644 index 00000000000..f125d24dcb6 Binary files /dev/null and b/doc/python_api/blender-org/static/favicon.ico differ diff --git a/doc/python_api/blender-org/static/jquery.sidebar.js b/doc/python_api/blender-org/static/jquery.sidebar.js new file mode 100644 index 00000000000..c22c61f2409 --- /dev/null +++ b/doc/python_api/blender-org/static/jquery.sidebar.js @@ -0,0 +1,26 @@ +$(document).ready(function () { + var top = $('.sphinxsidebarwrapper').offset().top - parseFloat($('.sphinxsidebarwrapper').css ('marginTop').replace(/auto/, 0)); + var colheight = parseFloat($('.sphinxsidebarwrapper').css('height').replace(/auto/, 0)); + + +$(window).scroll(function (event) { + // what the y position of the scroll is + var y = $(this).scrollTop(); + + // whether that's below the form + if (y >= top) { + //colheight is checked and according to its vaule the scrolling + //is triggered or not + if (colheight <= window.innerHeight) { + // if so, ad the fixed class + $('.sphinxsidebarwrapper').addClass('fixed'); + } else { + // otherwise remove it + $('.sphinxsidebarwrapper').removeClass('fixed'); + } + } else { + // otherwise remove it + $('.sphinxsidebarwrapper').removeClass('fixed'); + } +}); +}); diff --git a/doc/python_api/blender-org/static/pygments.css b/doc/python_api/blender-org/static/pygments.css new file mode 100644 index 00000000000..d67231e84ab --- /dev/null +++ b/doc/python_api/blender-org/static/pygments.css @@ -0,0 +1,61 @@ +.hll { background-color: #ffffcc } +.c { color: #7f7f7f; font-style: italic } /* Comment */ +.err { border: 1px solid #FF0000 } /* Error */ +.k { color: #0088ff; font-weight: bold } /* Keyword */ +.o { color: #993399 } /* Operator */ +.cm { color: #7f7f7f; font-style: italic } /* Comment.Multiline */ +.cp { color: #007020 } /* Comment.Preproc */ +.c1 { color: #408090; font-style: italic } /* Comment.Single */ +.cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.gd { color: #A00000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.gi { color: #00A000 } /* Generic.Inserted */ +.go { color: #303030 } /* Generic.Output */ +.gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.gt { color: #0040D0 } /* Generic.Traceback */ +.kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #FFFF32; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #007020 } /* Keyword.Pseudo */ +.kr { color: #FFFF32; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #902000 } /* Keyword.Type */ +.m { color: #00BAFF } /* Literal.Number */ +.s { color: #B7C274 } /* Literal.String */ +.na { color: #4070a0 } /* Name.Attribute */ +.nb { color: #007020 } /* Name.Builtin */ +.nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.no { color: #60add5 } /* Name.Constant */ +.nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.ne { color: #007020 } /* Name.Exception */ +.nf { color: #06287e } /* Name.Function */ +.nl { color: #002070; font-weight: bold } /* Name.Label */ +.nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.nt { color: #062873; font-weight: bold } /* Name.Tag */ +.nv { color: #bb60d5 } /* Name.Variable */ +.ow { color: #007020; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #00BAFF } /* Literal.Number.Float */ +.mh { color: #00BAFF } /* Literal.Number.Hex */ +.mi { color: #00BAFF } /* Literal.Number.Integer */ +.mo { color: #00BAFF } /* Literal.Number.Oct */ +.sb { color: #B7C274 } /* Literal.String.Backtick */ +.sc { color: #B7C274 } /* Literal.String.Char */ +.sd { color: #B7C274; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #B7C274 } /* Literal.String.Double */ +.se { color: #B7C274; font-weight: bold } /* Literal.String.Escape */ +.sh { color: #B7C274 } /* Literal.String.Heredoc */ +.si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.sx { color: #c65d09 } /* Literal.String.Other */ +.sr { color: #235388 } /* Literal.String.Regex */ +.s1 { color: #4070a0 } /* Literal.String.Single */ +.ss { color: #517918 } /* Literal.String.Symbol */ +.bp { color: #007020 } /* Name.Builtin.Pseudo */ +.vc { color: #bb60d5 } /* Name.Variable.Class */ +.vg { color: #bb60d5 } /* Name.Variable.Global */ +.vi { color: #bb60d5 } /* Name.Variable.Instance */ +.il { color: #00BAFF } /* Literal.Number.Integer.Long */ diff --git a/doc/python_api/blender-org/static/rnd.png b/doc/python_api/blender-org/static/rnd.png new file mode 100644 index 00000000000..95bc613c731 Binary files /dev/null and b/doc/python_api/blender-org/static/rnd.png differ diff --git a/doc/python_api/blender-org/static/rndbl.png b/doc/python_api/blender-org/static/rndbl.png new file mode 100644 index 00000000000..976161642fd Binary files /dev/null and b/doc/python_api/blender-org/static/rndbl.png differ diff --git a/doc/python_api/blender-org/static/rndbr.png b/doc/python_api/blender-org/static/rndbr.png new file mode 100644 index 00000000000..de94512ccc6 Binary files /dev/null and b/doc/python_api/blender-org/static/rndbr.png differ diff --git a/doc/python_api/blender-org/theme.conf b/doc/python_api/blender-org/theme.conf new file mode 100644 index 00000000000..a4356fd2690 --- /dev/null +++ b/doc/python_api/blender-org/theme.conf @@ -0,0 +1,30 @@ +[theme] +inherit = basic +stylesheet = default.css +pygments_style = sphinx + +[options] +rightsidebar = true +stickysidebar = true + +footerbgcolor = #000000 +footertextcolor = #ffffff +sidebarbgcolor = #1c4e63 +sidebartextcolor = #ffffff +sidebarlinkcolor = #97b9cf +relbarbgcolor = #2C3845 +relbartextcolor = #D3E0E9 +relbarlinkcolor = #D3E0E9 +relbaractlinkcolor = #f39410 +bgcolor = #232323 +bordercolor = #363636 +textcolor = #ffffff +headbgcolor = #232323 +headtextcolor = #ffffff +headlinkcolor = #97b9cf +linkcolor = #97b9cf +codebgcolor = #eeffcc +codetextcolor = #333333 + +bodyfont = "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif +headfont = "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif diff --git a/doc/python_api/epy/BGL.py b/doc/python_api/epy/BGL.py new file mode 100644 index 00000000000..ce148dc72ba --- /dev/null +++ b/doc/python_api/epy/BGL.py @@ -0,0 +1,1807 @@ +# Blender.BGL module (OpenGL wrapper) + +""" +The Blender.BGL submodule (the OpenGL wrapper). + +B{New}: some GLU functions: L{gluLookAt}, etc. + +The Blender.BGL submodule +========================= +(when accessing it from the Game Engine use BGL instead of Blender.BGL) + +This module wraps OpenGL constants and functions, making them available from +within Blender Python. + +The complete list can be retrieved from the module itself, by listing its +contents: dir(Blender.BGL). A simple search on the net can point to more +than enough material to teach OpenGL programming, from books to many +collections of tutorials. + +The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning +OpenGL}" and the online NeHe tutorials are two of the best resources. + +Example:: + import Blender + from Blender.BGL import * + from Blender import Draw + R = G = B = 0 + A = 1 + title = "Testing BGL + Draw" + instructions = "Use mouse buttons or wheel to change the background color." + quitting = " Press ESC or q to quit." + len1 = Draw.GetStringWidth(title) + len2 = Draw.GetStringWidth(instructions + quitting) + # + def show_win(): + glClearColor(R,G,B,A) # define color used to clear buffers + glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer + glColor3f(0.35,0.18,0.92) # define default color + glBegin(GL_POLYGON) # begin a vertex data list + glVertex2i(165, 158) + glVertex2i(252, 55) + glVertex2i(104, 128) + glEnd() + glColor3f(0.4,0.4,0.4) # change default color + glRecti(40, 96, 60+len1, 113) + glColor3f(1,1,1) + glRasterPos2i(50,100) # move cursor to x = 50, y = 100 + Draw.Text(title) # draw this text there + glRasterPos2i(350,40) # move cursor again + Draw.Text(instructions + quitting) # draw another msg + glBegin(GL_LINE_LOOP) # begin a vertex-data list + glVertex2i(46,92) + glVertex2i(120,92) + glVertex2i(120,115) + glVertex2i(46,115) + glEnd() # close this list + # + def ev(evt, val): # event callback for Draw.Register() + global R,G,B,A # ... it handles input events + if evt == Draw.ESCKEY or evt == Draw.QKEY: + Draw.Exit() # this quits the script + elif not val: return + elif evt == Draw.LEFTMOUSE: R = 1 - R + elif evt == Draw.MIDDLEMOUSE: G = 1 - G + elif evt == Draw.RIGHTMOUSE: B = 1 - B + elif evt == Draw.WHEELUPMOUSE: + R += 0.1 + if R > 1: R = 1 + elif evt == Draw.WHEELDOWNMOUSE: + R -= 0.1 + if R < 0: R = 0 + else: + return # don't redraw if nothing changed + Draw.Redraw(1) # make changes visible. + # + Draw.Register(show_win, ev, None) # start the main loop + +@note: you can use the L{Image} module and L{Image.Image} BPy object to load + and set textures. See L{Image.Image.glLoad} and L{Image.Image.glFree}, + for example. +@see: U{www.opengl.org} +@see: U{nehe.gamedev.net} +""" + +def glAccum(op, value): + """ + Operate on the accumulation buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html} + + @type op: Enumerated constant + @param op: The accumulation buffer operation. + @type value: float + @param value: a value used in the accumulation buffer operation. + """ + +def glAlphaFunc(func, ref): + """ + Specify the alpha test function + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html} + + @type func: Enumerated constant + @param func: Specifies the alpha comparison function. + @type ref: float + @param ref: The reference value that incoming alpha values are compared to. + Clamped between 0 and 1. + """ + +def glAreTexturesResident(n, textures, residences): + """ + Determine if textures are loaded in texture memory + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html} + + @type n: int + @param n: Specifies the number of textures to be queried. + @type textures: Buffer object I{type GL_INT} + @param textures: Specifies an array containing the names of the textures to be queried + @type residences: Buffer object I{type GL_INT}(boolean) + @param residences: An array in which the texture residence status in returned.The residence status of a + texture named by an element of textures is returned in the corresponding element of residences. + """ + +def glBegin(mode): + """ + Delimit the vertices of a primitive or a group of like primatives + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} + + @type mode: Enumerated constant + @param mode: Specifies the primitive that will be create from vertices between glBegin and + glEnd. + """ + +def glBindTexture(target, texture): + """ + Bind a named texture to a texturing target + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html} + + @type target: Enumerated constant + @param target: Specifies the target to which the texture is bound. + @type texture: unsigned int + @param texture: Specifies the name of a texture. + """ + +def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap): + """ + Draw a bitmap + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html} + + @type width, height: int + @param width, height: Specify the pixel width and height of the bitmap image. + @type xorig, yorig: float + @param xorig, yorig: Specify the location of the origin in the bitmap image. The origin is measured + from the lower left corner of the bitmap, with right and up being the positive axes. + @type xmove, ymove: float + @param xmove, ymove: Specify the x and y offsets to be added to the current raster position after + the bitmap is drawn. + @type bitmap: Buffer object I{type GL_BYTE} + @param bitmap: Specifies the address of the bitmap image. + """ + +def glBlendFunc(sfactor, dfactor): + """ + Specify pixel arithmetic + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html} + + @type sfactor: Enumerated constant + @param sfactor: Specifies how the red, green, blue, and alpha source blending factors are + computed. + @type dfactor: Enumerated constant + @param dfactor: Specifies how the red, green, blue, and alpha destination blending factors are + computed. + """ + +def glCallList(list): + """ + Execute a display list + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html} + + @type list: unsigned int + @param list: Specifies the integer name of the display list to be executed. + """ + +def glCallLists(n, type, lists): + """ + Execute a list of display lists + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html} + + @type n: int + @param n: Specifies the number of display lists to be executed. + @type type: Enumerated constant + @param type: Specifies the type of values in lists. + @type lists: Buffer object + @param lists: Specifies the address of an array of name offsets in the display list. + The pointer type is void because the offsets can be bytes, shorts, ints, or floats, + depending on the value of type. + """ + +def glClear(mask): + """ + Clear buffers to preset values + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html} + + @type mask: Enumerated constant(s) + @param mask: Bitwise OR of masks that indicate the buffers to be cleared. + """ + +def glClearAccum(red, green, blue, alpha): + """ + Specify clear values for the accumulation buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html} + + @type red, green, blue, alpha: float + @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the + accumulation buffer is cleared. The initial values are all 0. + """ + +def glClearColor(red, green, blue, alpha): + """ + Specify clear values for the color buffers + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html} + + @type red, green, blue, alpha: float + @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the + color buffers are cleared. The initial values are all 0. + """ + +def glClearDepth(depth): + """ + Specify the clear value for the depth buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html} + + @type depth: int + @param depth: Specifies the depth value used when the depth buffer is cleared. + The initial value is 1. + """ + +def glClearIndex(c): + """ + Specify the clear value for the color index buffers + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html} + + @type c: float + @param c: Specifies the index used when the color index buffers are cleared. + The initial value is 0. + """ + +def glClearStencil(s): + """ + Specify the clear value for the stencil buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html} + + @type s: int + @param s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. + """ + +def glClipPlane (plane, equation): + """ + Specify a plane against which all geometry is clipped + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html} + + @type plane: Enumerated constant + @param plane: Specifies which clipping plane is being positioned. + @type equation: Buffer object I{type GL_FLOAT}(double) + @param equation: Specifies the address of an array of four double- precision floating-point + values. These values are interpreted as a plane equation. + """ + +def glColor (red, green, blue, alpha): + """ + B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, + glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, + glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, + glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, + glColor4uiv, glColor4usv} + + Set a new color. + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html} + + @type red, green, blue, alpha: Depends on function prototype. + @param red, green, blue: Specify new red, green, and blue values for the current color. + @param alpha: Specifies a new alpha value for the current color. Included only in the + four-argument glColor4 commands. (With '4' colors only) + """ + +def glColorMask(red, green, blue, alpha): + """ + Enable and disable writing of frame buffer color components + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html} + + @type red, green, blue, alpha: int (boolean) + @param red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be + written into the frame buffer. The initial values are all GL_TRUE, indicating that the + color components can be written. + """ + +def glColorMaterial(face, mode): + """ + Cause a material color to track the current color + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html} + + @type face: Enumerated constant + @param face: Specifies whether front, back, or both front and back material parameters should + track the current color. + @type mode: Enumerated constant + @param mode: Specifies which of several material parameters track the current color. + """ + +def glCopyPixels(x, y, width, height, type): + """ + Copy pixels in the frame buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html} + + @type x, y: int + @param x, y: Specify the window coordinates of the lower left corner of the rectangular + region of pixels to be copied. + @type width, height: int + @param width,height: Specify the dimensions of the rectangular region of pixels to be copied. + Both must be non-negative. + @type type: Enumerated constant + @param type: Specifies whether color values, depth values, or stencil values are to be copied. + """ + + def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border): + """ + Copy pixels into a 2D texture image + @see: U{www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml} + + @type target: Enumerated constant + @param target: Specifies the target texture. + @type level: int + @param level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + @type internalformat: int + @param internalformat: Specifies the number of color components in the texture. + @type width: int + @type x, y: int + @param x, y:Specify the window coordinates of the first pixel that is copied + from the frame buffer. This location is the lower left corner of a rectangular + block of pixels. + @param width: Specifies the width of the texture image. Must be 2n+2(border) for + some integer n. All implementations support texture images that are at least 64 + texels wide. + @type height: int + @param height: Specifies the height of the texture image. Must be 2m+2(border) for + some integer m. All implementations support texture images that are at least 64 + texels high. + @type border: int + @param border: Specifies the width of the border. Must be either 0 or 1. + """ + +def glCullFace(mode): + """ + Specify whether front- or back-facing facets can be culled + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html} + + @type mode: Enumerated constant + @param mode: Specifies whether front- or back-facing facets are candidates for culling. + """ + +def glDeleteLists(list, range): + """ + Delete a contiguous group of display lists + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html} + + @type list: unsigned int + @param list: Specifies the integer name of the first display list to delete + @type range: int + @param range: Specifies the number of display lists to delete + """ + +def glDeleteTextures(n, textures): + """ + Delete named textures + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html} + + @type n: int + @param n: Specifies the number of textures to be deleted + @type textures: Buffer I{GL_INT} + @param textures: Specifies an array of textures to be deleted + """ + +def glDepthFunc(func): + """ + Specify the value used for depth buffer comparisons + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html} + + @type func: Enumerated constant + @param func: Specifies the depth comparison function. + """ + +def glDepthMask(flag): + """ + Enable or disable writing into the depth buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html} + + @type flag: int (boolean) + @param flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, + depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer + writing is enabled. + """ + +def glDepthRange(zNear, zFar): + """ + Specify mapping of depth values from normalized device coordinates to window coordinates + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html} + + @type zNear: int + @param zNear: Specifies the mapping of the near clipping plane to window coordinates. + The initial value is 0. + @type zFar: int + @param zFar: Specifies the mapping of the far clipping plane to window coordinates. + The initial value is 1. + """ + +def glDisable(cap): + """ + Disable server-side GL capabilities + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} + + @type cap: Enumerated constant + @param cap: Specifies a symbolic constant indicating a GL capability. + """ + +def glDrawBuffer(mode): + """ + Specify which color buffers are to be drawn into + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html} + + @type mode: Enumerated constant + @param mode: Specifies up to four color buffers to be drawn into. + """ + +def glDrawPixels(width, height, format, type, pixels): + """ + Write a block of pixels to the frame buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html} + + @type width, height: int + @param width, height: Specify the dimensions of the pixel rectangle to be + written into the frame buffer. + @type format: Enumerated constant + @param format: Specifies the format of the pixel data. + @type type: Enumerated constant + @param type: Specifies the data type for pixels. + @type pixels: Buffer object + @param pixels: Specifies a pointer to the pixel data. + """ + +def glEdgeFlag (flag): + """ + B{glEdgeFlag, glEdgeFlagv} + + Flag edges as either boundary or non-boundary + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html} + + @type flag: Depends of function prototype + @param flag: Specifies the current edge flag value.The initial value is GL_TRUE. + """ + +def glEnable(cap): + """ + Enable server-side GL capabilities + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} + + @type cap: Enumerated constant + @param cap: Specifies a symbolic constant indicating a GL capability. + """ + +def glEnd(): + """ + Delimit the vertices of a primitive or group of like primitives + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} + """ + +def glEndList(): + """ + Create or replace a display list + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} + """ + +def glEvalCoord (u,v): + """ + B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, + glEvalCoord2dv, glEvalCoord2fv} + + Evaluate enabled one- and two-dimensional maps + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html} + + @type u: Depends on function prototype. + @param u: Specifies a value that is the domain coordinate u to the basis function defined + in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then + u specifies a pointer to an array containing either one or two domain coordinates. The first + coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. + @type v: Depends on function prototype. (only with '2' prototypes) + @param v: Specifies a value that is the domain coordinate v to the basis function defined + in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. + """ + +def glEvalMesh (mode, i1, i2): + """ + B{glEvalMesh1 or glEvalMesh2} + + Compute a one- or two-dimensional grid of points or lines + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html} + + @type mode: Enumerated constant + @param mode: In glEvalMesh1, specifies whether to compute a one-dimensional + mesh of points or lines. + @type i1, i2: int + @param i1, i2: Specify the first and last integer values for the grid domain variable i. + """ + +def glEvalPoint (i, j): + """ + B{glEvalPoint1 and glEvalPoint2} + + Generate and evaluate a single point in a mesh + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html} + + @type i: int + @param i: Specifies the integer value for grid domain variable i. + @type j: int (only with '2' prototypes) + @param j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). + """ + +def glFeedbackBuffer (size, type, buffer): + """ + Controls feedback mode + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html} + + @type size: int + @param size:Specifies the maximum number of values that can be written into buffer. + @type type: Enumerated constant + @param type:Specifies a symbolic constant that describes the information that + will be returned for each vertex. + @type buffer: Buffer object I{GL_FLOAT} + @param buffer: Returns the feedback data. + """ + +def glFinish(): + """ + Block until all GL execution is complete + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html} + """ + +def glFlush(): + """ + Force Execution of GL commands in finite time + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html} + """ + +def glFog (pname, param): + """ + B{glFogf, glFogi, glFogfv, glFogiv} + + Specify fog parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html} + + @type pname: Enumerated constant + @param pname: Specifies a single-valued fog parameter. If the function prototype + ends in 'v' specifies a fog parameter. + @type param: Depends on function prototype. + @param param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR + requires an array of four values. All other parameters accept an array containing + only a single value. + """ + +def glFrontFace(mode): + """ + Define front- and back-facing polygons + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html} + + @type mode: Enumerated constant + @param mode: Specifies the orientation of front-facing polygons. + """ + +def glFrustum(left, right, bottom, top, zNear, zFar): + """ + Multiply the current matrix by a perspective matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html} + + @type left, right: double (float) + @param left, right: Specify the coordinates for the left and right vertical + clipping planes. + @type top, bottom: double (float) + @param top, bottom: Specify the coordinates for the bottom and top horizontal + clipping planes. + @type zNear, zFar: double (float) + @param zNear, zFar: Specify the distances to the near and far depth clipping planes. + Both distances must be positive. + """ + +def glGenLists(range): + """ + Generate a contiguous set of empty display lists + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html} + + @type range: int + @param range: Specifies the number of contiguous empty display lists to be generated. + """ + +def glGenTextures(n, textures): + """ + Generate texture names + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html} + + @type n: int + @param n: Specifies the number of textures name to be generated. + @type textures: Buffer object I{type GL_INT} + @param textures: Specifies an array in which the generated textures names are stored. + """ + +def glGet (pname, param): + """ + B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} + + Return the value or values of a selected parameter + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html} + + @type pname: Enumerated constant + @param pname: Specifies the parameter value to be returned. + @type param: Depends on function prototype. + @param param: Returns the value or values of the specified parameter. + """ + +def glGetClipPlane(plane, equation): + """ + Return the coefficients of the specified clipping plane + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html} + + @type plane: Enumerated constant + @param plane: Specifies a clipping plane. The number of clipping planes depends on the + implementation, but at least six clipping planes are supported. They are identified by + symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. + @type equation: Buffer object I{type GL_FLOAT} + @param equation: Returns four float (double)-precision values that are the coefficients of the + plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). + """ + +def glGetError(): + """ + Return error information + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html} + """ + +def glGetLight (light, pname, params): + """ + B{glGetLightfv and glGetLightiv} + + Return light source parameter values + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html} + + @type light: Enumerated constant + @param light: Specifies a light source. The number of possible lights depends on the + implementation, but at least eight lights are supported. They are identified by symbolic + names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. + @type pname: Enumerated constant + @param pname: Specifies a light source parameter for light. + @type params: Buffer object. Depends on function prototype. + @param params: Returns the requested data. + """ + +def glGetMap (target, query, v): + """ + B{glGetMapdv, glGetMapfv, glGetMapiv} + + Return evaluator parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html} + + @type target: Enumerated constant + @param target: Specifies the symbolic name of a map. + @type query: Enumerated constant + @param query: Specifies which parameter to return. + @type v: Buffer object. Depends on function prototype. + @param v: Returns the requested data. + """ + +def glGetMaterial (face, pname, params): + """ + B{glGetMaterialfv, glGetMaterialiv} + + Return material parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html} + + @type face: Enumerated constant + @param face: Specifies which of the two materials is being queried. + representing the front and back materials, respectively. + @type pname: Enumerated constant + @param pname: Specifies the material parameter to return. + @type params: Buffer object. Depends on function prototype. + @param params: Returns the requested data. + """ + +def glGetPixelMap (map, values): + """ + B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} + + Return the specified pixel map + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html} + + @type map: Enumerated constant + @param map: Specifies the name of the pixel map to return. + @type values: Buffer object. Depends on function prototype. + @param values: Returns the pixel map contents. + """ + +def glGetPolygonStipple(mask): + """ + Return the polygon stipple pattern + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html} + + @type mask: Buffer object I{type GL_BYTE} + @param mask: Returns the stipple pattern. The initial value is all 1's. + """ + +def glGetString(name): + """ + Return a string describing the current GL connection + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html} + + @type name: Enumerated constant + @param name: Specifies a symbolic constant. + + """ + +def glGetTexEnv (target, pname, params): + """ + B{glGetTexEnvfv, glGetTexEnviv} + + Return texture environment parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html} + + @type target: Enumerated constant + @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of a texture environment parameter. + @type params: Buffer object. Depends on function prototype. + @param params: Returns the requested data. + """ + +def glGetTexGen (coord, pname, params): + """ + B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} + + Return texture coordinate generation parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html} + + @type coord: Enumerated constant + @param coord: Specifies a texture coordinate. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of the value(s) to be returned. + @type params: Buffer object. Depends on function prototype. + @param params: Returns the requested data. + """ + +def glGetTexImage(target, level, format, type, pixels): + """ + Return a texture image + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html} + + @type target: Enumerated constant + @param target: Specifies which texture is to be obtained. + @type level: int + @param level: Specifies the level-of-detail number of the desired image. + Level 0 is the base image level. Level n is the nth mipmap reduction image. + @type format: Enumerated constant + @param format: Specifies a pixel format for the returned data. + @type type: Enumerated constant + @param type: Specifies a pixel type for the returned data. + @type pixels: Buffer object. + @param pixels: Returns the texture image. Should be a pointer to an array of the + type specified by type + """ + +def glGetTexLevelParameter (target, level, pname, params): + """ + B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} + + return texture parameter values for a specific level of detail + @see: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html} + + @type target: Enumerated constant + @param target: Specifies the symbolic name of the target texture. + @type level: int + @param level: Specifies the level-of-detail number of the desired image. + Level 0 is the base image level. Level n is the nth mipmap reduction image. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of a texture parameter. + @type params: Buffer object. Depends on function prototype. + @param params: Returns the requested data. + """ + +def glGetTexParameter (target, pname, params): + """ + B{glGetTexParameterfv, glGetTexParameteriv} + + Return texture parameter values + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html} + + @type target: Enumerated constant + @param target: Specifies the symbolic name of the target texture. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name the target texture. + @type params: Buffer object. Depends on function prototype. + @param params: Returns the texture parameters. + """ + +def glHint(target, mode): + """ + Specify implementation-specific hints + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html} + + @type target: Enumerated constant + @param target: Specifies a symbolic constant indicating the behavior to be + controlled. + @type mode: Enumerated constant + @param mode: Specifies a symbolic constant indicating the desired behavior. + """ + +def glIndex (c): + """ + B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} + + Set the current color index + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html} + + @type c: Buffer object. Depends on function prototype. + @param c: Specifies a pointer to a one element array that contains the new value for + the current color index. + """ + +def glInitNames(): + """ + Initialize the name stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html} + """ + +def glIsEnabled(cap): + """ + Test whether a capability is enabled + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html} + + @type cap: Enumerated constant + @param cap: Specifies a constant representing a GL capability. + """ + +def glIsList(list): + """ + Determine if a name corresponds to a display-list + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html} + + @type list: unsigned int + @param list: Specifies a potential display-list name. + """ + +def glIsTexture(texture): + """ + Determine if a name corresponds to a texture + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html} + + @type texture: unsigned int + @param texture: Specifies a value that may be the name of a texture. + """ + +def glLight (light, pname, param): + """ + B{glLightf,glLighti, glLightfv, glLightiv} + + Set the light source parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html} + + @type light: Enumerated constant + @param light: Specifies a light. The number of lights depends on the implementation, + but at least eight lights are supported. They are identified by symbolic names of the + form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. + @type pname: Enumerated constant + @param pname: Specifies a single-valued light source parameter for light. + @type param: Depends on function prototype. + @param param: Specifies the value that parameter pname of light source light will be set to. + If function prototype ends in 'v' specifies a pointer to the value or values that + parameter pname of light source light will be set to. + """ + +def glLightModel (pname, param): + """ + B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} + + Set the lighting model parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html} + + @type pname: Enumerated constant + @param pname: Specifies a single-value light model parameter. + @type param: Depends on function prototype. + @param param: Specifies the value that param will be set to. If function prototype ends in 'v' + specifies a pointer to the value or values that param will be set to. + """ + +def glLineStipple(factor, pattern): + """ + Specify the line stipple pattern + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html} + + @type factor: int + @param factor: Specifies a multiplier for each bit in the line stipple pattern. + If factor is 3, for example, each bit in the pattern is used three times before + the next bit in the pattern is used. factor is clamped to the range [1, 256] and + defaults to 1. + @type pattern: unsigned short int + @param pattern: Specifies a 16-bit integer whose bit pattern determines which fragments + of a line will be drawn when the line is rasterized. Bit zero is used first; the default + pattern is all 1's. + """ + +def glLineWidth(width): + """ + Specify the width of rasterized lines. + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html} + + @type width: float + @param width: Specifies the width of rasterized lines. The initial value is 1. + """ + +def glListBase(base): + """ + Set the display-list base for glCallLists + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html} + + @type base: unsigned int + @param base: Specifies an integer offset that will be added to glCallLists + offsets to generate display-list names. The initial value is 0. + """ + +def glLoadIdentity(): + """ + Replace the current matrix with the identity matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html} + """ + +def glLoadMatrix (m): + """ + B{glLoadMatrixd, glLoadMatixf} + + Replace the current matrix with the specified matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html} + + @type m: Buffer object. Depends on function prototype. + @param m: Specifies a pointer to 16 consecutive values, which are used as the elements + of a 4x4 column-major matrix. + """ + +def glLoadName(name): + """ + Load a name onto the name stack. + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html} + + @type name: unsigned int + @param name: Specifies a name that will replace the top value on the name stack. + """ + +def glLogicOp(opcode): + """ + Specify a logical pixel operation for color index rendering + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html} + + @type opcode: Enumerated constant + @param opcode: Specifies a symbolic constant that selects a logical operation. + """ + +def glMap1 (target, u1, u2, stride, order, points): + """ + B{glMap1d, glMap1f} + + Define a one-dimensional evaluator + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html} + + @type target: Enumerated constant + @param target: Specifies the kind of values that are generated by the evaluator. + @type u1, u2: Depends on function prototype. + @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t + he variable that is evaluated by the equations specified by this command. + @type stride: int + @param stride: Specifies the number of floats or float (double)s between the beginning + of one control point and the beginning of the next one in the data structure + referenced in points. This allows control points to be embedded in arbitrary data + structures. The only constraint is that the values for a particular control point must + occupy contiguous memory locations. + @type order: int + @param order: Specifies the number of control points. Must be positive. + @type points: Buffer object. Depends on function prototype. + @param points: Specifies a pointer to the array of control points. + """ + +def glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points): + """ + B{glMap2d, glMap2f} + + Define a two-dimensional evaluator + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html} + + @type target: Enumerated constant + @param target: Specifies the kind of values that are generated by the evaluator. + @type u1, u2: Depends on function prototype. + @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t + he variable that is evaluated by the equations specified by this command. Initially + u1 is 0 and u2 is 1. + @type ustride: int + @param ustride: Specifies the number of floats or float (double)s between the beginning + of control point R and the beginning of control point R ij, where i and j are the u + and v control point indices, respectively. This allows control points to be embedded + in arbitrary data structures. The only constraint is that the values for a particular + control point must occupy contiguous memory locations. The initial value of ustride is 0. + @type uorder: int + @param uorder: Specifies the dimension of the control point array in the u axis. + Must be positive. The initial value is 1. + @type v1, v2: Depends on function prototype. + @param v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, to ^, + one of the two variables that are evaluated by the equations specified by this command. + Initially, v1 is 0 and v2 is 1. + @type vstride: int + @param vstride: Specifies the number of floats or float (double)s between the beginning of control + point R and the beginning of control point R ij, where i and j are the u and v control + point(indices, respectively. This allows control points to be embedded in arbitrary data + structures. The only constraint is that the values for a particular control point must + occupy contiguous memory locations. The initial value of vstride is 0. + @type vorder: int + @param vorder: Specifies the dimension of the control point array in the v axis. + Must be positive. The initial value is 1. + @type points: Buffer object. Depends on function prototype. + @param points: Specifies a pointer to the array of control points. + """ + +def glMapGrid (un, u1,u2 ,vn, v1, v2): + """ + B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} + + Define a one- or two-dimensional mesh + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html} + + @type un: int + @param un: Specifies the number of partitions in the grid range interval + [u1, u2]. Must be positive. + @type u1, u2: Depends on function prototype. + @param u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. + @type vn: int + @param vn: Specifies the number of partitions in the grid range interval [v1, v2] + (glMapGrid2 only). + @type v1, v2: Depends on function prototype. + @param v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn + (glMapGrid2 only). + """ + +def glMaterial (face, pname, params): + """ + Specify material parameters for the lighting model. + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html} + + @type face: Enumerated constant + @param face: Specifies which face or faces are being updated. Must be one of: + @type pname: Enumerated constant + @param pname: Specifies the single-valued material parameter of the face + or faces that is being updated. Must be GL_SHININESS. + @type params: int + @param params: Specifies the value that parameter GL_SHININESS will be set to. + If function prototype ends in 'v' specifies a pointer to the value or values that + pname will be set to. + """ + +def glMatrixMode(mode): + """ + Specify which matrix is the current matrix. + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html} + + @type mode: Enumerated constant + @param mode: Specifies which matrix stack is the target for subsequent matrix operations. + """ + +def glMultMatrix (m): + """ + B{glMultMatrixd, glMultMatrixf} + + Multiply the current matrix with the specified matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html} + + @type m: Buffer object. Depends on function prototype. + @param m: Points to 16 consecutive values that are used as the elements of a 4x4 column + major matrix. + """ + +def glNewList(list, mode): + """ + Create or replace a display list + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} + + @type list: unsigned int + @param list: Specifies the display list name + @type mode: Enumerated constant + @param mode: Specifies the compilation mode. + """ + +def glNormal3 (nx, ny, nz, v): + """ + B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, + Normal3s, Normal3sv} + + Set the current normal vector + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html} + + @type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) + @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. + The initial value of the current normal is the unit vector, (0, 0, 1). + @type v: Buffer object. Depends on function prototype. ('v' prototypes) + @param v: Specifies a pointer to an array of three elements: the x, y, and z coordinates + of the new current normal. + """ + +def glOrtho(left, right, bottom, top, zNear, zFar): + """ + Multiply the current matrix with an orthographic matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html} + + @type left, right: double (float) + @param left, right: Specify the coordinates for the left and + right vertical clipping planes. + @type bottom, top: double (float) + @param bottom, top: Specify the coordinates for the bottom and top + horizontal clipping planes. + @type zNear, zFar: double (float) + @param zNear, zFar: Specify the distances to the nearer and farther + depth clipping planes. These values are negative if the plane is to be behind the viewer. + """ + +def glPassThrough(token): + """ + Place a marker in the feedback buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html} + + @type token: float + @param token: Specifies a marker value to be placed in the feedback + buffer following a GL_PASS_THROUGH_TOKEN. + """ + +def glPixelMap (map, mapsize, values): + """ + B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} + + Set up pixel transfer maps + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html} + + @type map: Enumerated constant + @param map: Specifies a symbolic map name. + @type mapsize: int + @param mapsize: Specifies the size of the map being defined. + @type values: Buffer object. Depends on function prototype. + @param values: Specifies an array of mapsize values. + """ + +def glPixelStore (pname, param): + """ + B{glPixelStoref, glPixelStorei} + + Set pixel storage modes + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html} + + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of the parameter to be set. + Six values affect the packing of pixel data into memory. + Six more affect the unpacking of pixel data from memory. + @type param: Depends on function prototype. + @param param: Specifies the value that pname is set to. + """ + +def glPixelTransfer (pname, param): + """ + B{glPixelTransferf, glPixelTransferi} + + Set pixel transfer modes + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html} + + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of the pixel transfer parameter to be set. + @type param: Depends on function prototype. + @param param: Specifies the value that pname is set to. + """ + +def glPixelZoom(xfactor, yfactor): + """ + Specify the pixel zoom factors + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html} + + @type xfactor, yfactor: float + @param xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. + """ + +def glPointSize(size): + """ + Specify the diameter of rasterized points + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html} + + @type size: float + @param size: Specifies the diameter of rasterized points. The initial value is 1. + """ + +def glPolygonMode(face, mode): + """ + Select a polygon rasterization mode + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html} + + @type face: Enumerated constant + @param face: Specifies the polygons that mode applies to. + Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing polygons, + or GL_FRONT_AND_BACK for front- and back-facing polygons. + @type mode: Enumerated constant + @param mode: Specifies how polygons will be rasterized. + The initial value is GL_FILL for both front- and back- facing polygons. + """ + +def glPolygonOffset(factor, units): + """ + Set the scale and units used to calculate depth values + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html} + + @type factor: float + @param factor: Specifies a scale factor that is used to create a variable depth + offset for each polygon. The initial value is 0. + @type units: float + @param units: Is multiplied by an implementation-specific value to create a constant + depth offset. The initial value is 0. + """ + +def glPolygonStipple(mask): + """ + Set the polygon stippling pattern + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html} + + @type mask: Buffer object I{type GL_BYTE} + @param mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked + from memory in the same way that glDrawPixels unpacks pixels. + """ + +def glPopAttrib(): + """ + Pop the server attribute stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} + """ + +def glPopClientAttrib(): + """ + Pop the client attribute stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} + """ + +def glPopMatrix(): + """ + Pop the current matrix stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} + """ + +def glPopName(): + """ + Pop the name stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} + """ + +def glPrioritizeTextures(n, textures, priorities): + """ + Set texture residence priority + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html} + + @type n: int + @param n:Specifies the number of textures to be prioritized. + @type textures: Buffer I{type GL_INT} + @param textures: Specifies an array containing the names of the textures to be prioritized. + @type priorities: Buffer I{type GL_FLOAT} + @param priorities: Specifies an array containing the texture priorities. A priority given + in an element of priorities applies to the texture named by the corresponding element of textures. + """ + +def glPushAttrib(mask): + """ + Push the server attribute stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} + + @type mask: Enumerated constant(s) + @param mask: Specifies a mask that indicates which attributes to save. + """ + +def glPushClientAttrib(mask): + """ + Push the client attribute stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} + + @type mask: Enumerated constant(s) + @param mask: Specifies a mask that indicates which attributes to save. + """ + +def glPushMatrix(): + """ + Push the current matrix stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} + """ + +def glPushName(name): + """ + Push the name stack + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} + + @type name: unsigned int + @param name: Specifies a name that will be pushed onto the name stack. + """ + +def glRasterPos (x,y,z,w): + """ + B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, + glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, + glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, + glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, + glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} + + Specify the raster position for pixel operations + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html} + + @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) + @param x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the + raster position. If function prototype ends in 'v' specifies a pointer to an array of two, + three, or four elements, specifying x, y, z, and w coordinates, respectively. + @note: + If you are drawing to the 3d view with a Scriptlink of a space handler + the zoom level of the panels will scale the glRasterPos by the view matrix. + so a X of 10 will not always offset 10 pixels as you would expect. + + To work around this get the scale value of the view matrix and use it to scale your pixel values. + + Workaround:: + + import Blender + from Blender.BGL import * + xval, yval= 100, 40 + # Get the scale of the view matrix + viewMatrix = Buffer(GL_FLOAT, 16) + glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix) + f = 1/viewMatrix[0] + glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval) + """ + +def glReadBuffer(mode): + """ + Select a color buffer source for pixels. + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html} + + @type mode: Enumerated constant + @param mode: Specifies a color buffer. + """ + +def glReadPixels(x, y, width, height, format, type, pixels): + """ + Read a block of pixels from the frame buffer + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html} + + @type x, y: int + @param x, y:Specify the window coordinates of the first pixel that is read + from the frame buffer. This location is the lower left corner of a rectangular + block of pixels. + @type width, height: int + @param width, height: Specify the dimensions of the pixel rectangle. width and + height of one correspond to a single pixel. + @type format: Enumerated constant + @param format: Specifies the format of the pixel data. + @type type: Enumerated constant + @param type: Specifies the data type of the pixel data. + @type pixels: Buffer object + @param pixels: Returns the pixel data. + """ + +def glRect (x1,y1,x2,y2,v1,v2): + """ + B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} + + Draw a rectangle + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html} + + @type x1, y1: Depends on function prototype. (for non 'v' prototypes only) + @param x1, y1: Specify one vertex of a rectangle + @type x2, y2: Depends on function prototype. (for non 'v' prototypes only) + @param x2, y2: Specify the opposite vertex of the rectangle + @type v1, v2: Depends on function prototype. (for 'v' prototypes only) + @param v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer + to the opposite vertex of the rectangle + """ + +def glRenderMode(mode): + """ + Set rasterization mode + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html} + + @type mode: Enumerated constant + @param mode: Specifies the rasterization mode. + """ + +def glRotate (angle, x, y, z): + """ + B{glRotated, glRotatef} + + Multiply the current matrix by a rotation matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html} + + @type angle: Depends on function prototype. + @param angle: Specifies the angle of rotation in degrees. + @type x, y, z: Depends on function prototype. + @param x, y, z: Specify the x, y, and z coordinates of a vector respectively. + """ + +def glScale (x,y,z): + """ + B{glScaled, glScalef} + + Multiply the current matrix by a general scaling matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html} + + @type x, y, z: Depends on function prototype. + @param x, y, z: Specify scale factors along the x, y, and z axes, respectively. + """ + +def glScissor(x,y,width,height): + """ + Define the scissor box + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html} + + @type x, y: int + @param x, y: Specify the lower left corner of the scissor box. Initially (0, 0). + @type width, height: int + @param width height: Specify the width and height of the scissor box. When a + GL context is first attached to a window, width and height are set to the + dimensions of that window. + """ + +def glSelectBuffer(size, buffer): + """ + Establish a buffer for selection mode values + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html} + + @type size: int + @param size: Specifies the size of buffer + @type buffer: Buffer I{type GL_INT} + @param buffer: Returns the selection data + """ + +def glShadeModel(mode): + """ + Select flat or smooth shading + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html} + + @type mode: Enumerated constant + @param mode: Specifies a symbolic value representing a shading technique. + """ + +def glStencilFuc(func, ref, mask): + """ + Set function and reference value for stencil testing + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html} + + @type func: Enumerated constant + @param func:Specifies the test function. + @type ref: int + @param ref:Specifies the reference value for the stencil test. ref is clamped to + the range [0,2n-1], where n is the number of bitplanes in the stencil buffer. + The initial value is 0. + @type mask: unsigned int + @param mask:Specifies a mask that is ANDed with both the reference value and + the stored stencil value when the test is done. The initial value is all 1's. + """ + +def glStencilMask(mask): + """ + Control the writing of individual bits in the stencil planes + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html} + + @type mask: unsigned int + @param mask: Specifies a bit mask to enable and disable writing of individual bits + in the stencil planes. Initially, the mask is all 1's. + """ + +def glStencilOp(fail, zfail, zpass): + """ + Set stencil test actions + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html} + + @type fail: Enumerated constant + @param fail: Specifies the action to take when the stencil test fails. + The initial value is GL_KEEP. + @type zfail: Enumerated constant + @param zfail: Specifies the stencil action when the stencil test passes, but the + depth test fails. zfail accepts the same symbolic constants as fail. + The initial value is GL_KEEP. + @type zpass: Enumerated constant + @param zpass: Specifies the stencil action when both the stencil test and the + depth test pass, or when the stencil test passes and either there is no depth + buffer or depth testing is not enabled. zpass accepts the same symbolic constants + as fail. The initial value is GL_KEEP. + """ + +def glTexCoord (s,t,r,q,v): + """ + B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, + glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, + glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, + glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, + glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, + glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} + + Set the current texture coordinates + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html} + + @type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) + @param s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are + present in all forms of the command. + @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only) + @param v: Specifies a pointer to an array of one, two, three, or four elements, + which in turn specify the s, t, r, and q texture coordinates. + """ + +def glTexEnv (target, pname, param): + """ + B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} + + Set texture environment parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html} + + @type target: Enumerated constant + @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of a single-valued texture environment + parameter. Must be GL_TEXTURE_ENV_MODE. + @type param: Depends on function prototype. + @param param: Specifies a single symbolic constant. If function prototype ends in 'v' + specifies a pointer to a parameter array that contains either a single symbolic + constant or an RGBA color + """ + +def glTexGen (coord, pname, param): + """ + B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} + + Control the generation of texture coordinates + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html} + + @type coord: Enumerated constant + @param coord: Specifies a texture coordinate. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of the texture- coordinate generation function. + @type param: Depends on function prototype. + @param param: Specifies a single-valued texture generation parameter. + If function prototype ends in 'v' specifies a pointer to an array of texture + generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must + contain a single symbolic constant. Otherwise, params holds the coefficients + for the texture-coordinate generation function specified by pname. + """ + +def glTexImage1D(target, level, internalformat, width, border, format, type, pixels): + """ + Specify a one-dimensional texture image + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html} + + @type target: Enumerated constant + @param target: Specifies the target texture. + @type level: int + @param level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + @type internalformat: int + @param internalformat: Specifies the number of color components in the texture. + @type width: int + @param width: Specifies the width of the texture image. Must be 2n+2(border) for + some integer n. All implementations support texture images that are at least 64 + texels wide. The height of the 1D texture image is 1. + @type border: int + @param border: Specifies the width of the border. Must be either 0 or 1. + @type format: Enumerated constant + @param format: Specifies the format of the pixel data. + @type type: Enumerated constant + @param type: Specifies the data type of the pixel data. + @type pixels: Buffer object. + @param pixels: Specifies a pointer to the image data in memory. + """ + +def glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels): + """ + Specify a two-dimensional texture image + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html} + + @type target: Enumerated constant + @param target: Specifies the target texture. + @type level: int + @param level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + @type internalformat: int + @param internalformat: Specifies the number of color components in the texture. + @type width: int + @param width: Specifies the width of the texture image. Must be 2n+2(border) for + some integer n. All implementations support texture images that are at least 64 + texels wide. + @type height: int + @param height: Specifies the height of the texture image. Must be 2m+2(border) for + some integer m. All implementations support texture images that are at least 64 + texels high. + @type border: int + @param border: Specifies the width of the border. Must be either 0 or 1. + @type format: Enumerated constant + @param format: Specifies the format of the pixel data. + @type type: Enumerated constant + @param type: Specifies the data type of the pixel data. + @type pixels: Buffer object. + @param pixels: Specifies a pointer to the image data in memory. + """ + +def glTexParameter (target, pname, param): + """ + B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} + + Set texture parameters + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html} + + @type target: Enumerated constant + @param target: Specifies the target texture. + @type pname: Enumerated constant + @param pname: Specifies the symbolic name of a single-valued texture parameter. + @type param: Depends on function prototype. + @param param: Specifies the value of pname. If function prototype ends in 'v' specifies + a pointer to an array where the value or values of pname are stored. + """ + +def glTranslate (x, y, z): + """ + B{glTranslatef, glTranslated} + + Multiply the current matrix by a translation matrix + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html} + + @type x, y, z: Depends on function prototype. + @param x, y, z: Specify the x, y, and z coordinates of a translation vector. + """ + +def glVertex (x,y,z,w,v): + """ + B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, + glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, + glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, + glVertex4fv, glVertex4iv, glVertex4sv} + + Specify a vertex + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html} + + @type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) + @param x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters + are present in all forms of the command. + @type v: Buffer object. Depends of function prototype (for 'v' prototypes only) + @param v: Specifies a pointer to an array of two, three, or four elements. The + elements of a two-element array are x and y; of a three-element array, x, y, and z; + and of a four-element array, x, y, z, and w. + """ + +def glViewport(x,y,width,height): + """ + Set the viewport + @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html} + + @type x, y: int + @param x, y: Specify the lower left corner of the viewport rectangle, + in pixels. The initial value is (0,0). + @type width, height: int + @param width, height: Specify the width and height of the viewport. When a GL context + is first attached to a window, width and height are set to the dimensions of that window. + """ + +def gluPerspective(fovY, aspect, zNear, zFar): + """ + Set up a perspective projection matrix. + @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288} + + @type fovY: double + @param fovY: Specifies the field of view angle, in degrees, in the y direction. + @type aspect: double + @param aspect: Specifies the aspect ratio that determines the field of view in the x direction. + The aspect ratio is the ratio of x (width) to y (height). + @type zNear: double + @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive). + @type zFar: double + @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive). + """ + +def gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz): + """ + Define a viewing transformation + @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042} + + @type eyex, eyey, eyez: double + @param eyex, eyey, eyez: Specifies the position of the eye point. + @type centerx, centery, centerz: double + @param centerx, centery, centerz: Specifies the position of the reference point. + @type upx, upy, upz: double + @param upx, upy, upz: Specifies the direction of the up vector. + """ + +def gluOrtho2D(left, right, bottom, top): + """ + Define a 2-D orthographic projection matrix + @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + @type left, right: double + @param left, right: Specify the coordinates for the left and right vertical clipping planes. + @type bottom, top: double + @param bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. + """ + +def gluPickMatrix(x, y, width, height, viewport): + """ + Define a picking region + @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + @type x, y: double + @param x, y: Specify the center of a picking region in window coordinates. + @type width, height: double + @param width, height: Specify the width and height, respectively, of the picking region in window coordinates. + @type viewport: Buffer object. [int] + @param viewport: Specifies the current viewport. + """ + +def gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz): + """ + Map object coordinates to window coordinates. + @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + @type objx, objy, objz: double + @param objx, objy, objz: Specify the object coordinates. + @type modelMatrix: Buffer object. [double] + @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). + @type projMatrix: Buffer object. [double] + @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). + @type viewport: Buffer object. [int] + @param viewport: Specifies the current viewport (as from a glGetIntegerv call). + @type winx, winy, winz: Buffer object. [double] + @param winx, winy, winz: Return the computed window coordinates. + """ + +def gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz): + """ + Map object coordinates to window + coordinates. + @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204} + + @type winx, winy, winz: double + @param winx, winy, winz: Specify the window coordinates to be mapped. + @type modelMatrix: Buffer object. [double] + @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). + @type projMatrix: Buffer object. [double] + @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). + @type viewport: Buffer object. [int] + @param viewport: Specifies the current viewport (as from a glGetIntegerv call). + @type objx, objy, objz: Buffer object. [double] + @param objx, objy, objz: Return the computed object coordinates. + """ + +class Buffer: + """ + The Buffer object is simply a block of memory that is delineated and initialized by the + user. Many OpenGL functions return data to a C-style pointer, however, because this + is not possible in python the Buffer object can be used to this end. Wherever pointer + notation is used in the OpenGL functions the Buffer object can be used in it's BGL + wrapper. In some instances the Buffer object will need to be initialized with the template + parameter, while in other instances the user will want to create just a blank buffer + which will be zeroed by default. + + Example with Buffer:: + import Blender + from Blender import BGL + myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32]) + BGL.glGetPolygonStipple(myByteBuffer) + print myByteBuffer.dimensions + print myByteBuffer.list + sliceBuffer = myByteBuffer[0:16] + print sliceBuffer + + @ivar list: The contents of the Buffer. + @ivar dimensions: The size of the Buffer. + """ + + def __init__(type, dimensions, template = None): + """ + This will create a new Buffer object for use with other BGL OpenGL commands. + Only the type of argument to store in the buffer and the dimensions of the buffer + are necessary. Buffers are zeroed by default unless a template is supplied, in + which case the buffer is initialized to the template. + + @type type: int + @param type: The format to store data in. The type should be one of + GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. + @type dimensions: An int or sequence object specifying the dimensions of the buffer. + @param dimensions: If the dimensions are specified as an int a linear array will + be created for the buffer. If a sequence is passed for the dimensions, the buffer + becomes n-Dimensional, where n is equal to the number of parameters passed in the + sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates + a three- dimensional buffer. You can think of each additional dimension as a sub-item + of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. + [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. + @type template: A python sequence object (optional) + @param template: A sequence of matching dimensions which will be used to initialize + the Buffer. If a template is not passed in all fields will be initialized to 0. + @rtype: Buffer object + @return: The newly created buffer as a PyObject. + """ diff --git a/doc/python_api/epy/Geometry.py b/doc/python_api/epy/Geometry.py new file mode 100644 index 00000000000..d0c4dfdfd8d --- /dev/null +++ b/doc/python_api/epy/Geometry.py @@ -0,0 +1,189 @@ +# Blender.Geometry module and its subtypes + +""" +The Blender.Geometry submodule. + +Geometry +======== +(when accessing it from the Game Engine use Geometry instead of Blender.Geometry) + +This new module provides access to a geometry function. +""" + +def Intersect(vec1, vec2, vec3, ray, orig, clip=1): + """ + Return the intersection between a ray and a triangle, if possible, return None otherwise. + @type vec1: Vector object. + @param vec1: A 3d vector, one corner of the triangle. + @type vec2: Vector object. + @param vec2: A 3d vector, one corner of the triangle. + @type vec3: Vector object. + @param vec3: A 3d vector, one corner of the triangle. + @type ray: Vector object. + @param ray: A 3d vector, the orientation of the ray. the length of the ray is not used, only the direction. + @type orig: Vector object. + @param orig: A 3d vector, the origin of the ray. + @type clip: integer + @param clip: if 0, don't restrict the intersection to the area of the triangle, use the infinite plane defined by the triangle. + @rtype: Vector object + @return: The intersection between a ray and a triangle, if possible, None otherwise. + """ + +def TriangleArea(vec1, vec2, vec3): + """ + Return the area size of the 2D or 3D triangle defined. + @type vec1: Vector object. + @param vec1: A 2d or 3d vector, one corner of the triangle. + @type vec2: Vector object. + @param vec2: A 2d or 3d vector, one corner of the triangle. + @type vec3: Vector object. + @param vec3: A 2d or 3d vector, one corner of the triangle. + @rtype: float + @return: The area size of the 2D or 3D triangle defined. + """ + +def TriangleNormal(vec1, vec2, vec3): + """ + Return the normal of the 3D triangle defined. + @type vec1: Vector object. + @param vec1: A 3d vector, one corner of the triangle. + @type vec2: Vector object. + @param vec2: A 3d vector, one corner of the triangle. + @type vec3: Vector object. + @param vec3: A 3d vector, one corner of the triangle. + @rtype: float + @return: The normal of the 3D triangle defined. + """ + +def QuadNormal(vec1, vec2, vec3, vec4): + """ + Return the normal of the 3D quad defined. + @type vec1: Vector object. + @param vec1: A 3d vector, the first vertex of the quad. + @type vec2: Vector object. + @param vec2: A 3d vector, the second vertex of the quad. + @type vec3: Vector object. + @param vec3: A 3d vector, the third vertex of the quad. + @type vec4: Vector object. + @param vec4: A 3d vector, the fourth vertex of the quad. + @rtype: float + @return: The normal of the 3D quad defined. + """ + +def LineIntersect(vec1, vec2, vec3, vec4): + """ + Return a tuple with the points on each line respectively closest to the other + (when both lines intersect, both vector hold the same value). + The lines are evaluated as infinite lines in space, the values returned may not be between the 2 points given for each line. + @type vec1: Vector object. + @param vec1: A 3d vector, one point on the first line. + @type vec2: Vector object. + @param vec2: A 3d vector, another point on the first line. + @type vec3: Vector object. + @param vec3: A 3d vector, one point on the second line. + @type vec4: Vector object. + @param vec4: A 3d vector, another point on the second line. + @rtype: (Vector object, Vector object) + @return: A tuple with the points on each line respectively closest to the other. + """ + +def PolyFill(polylines): + """ + Takes a list of polylines and calculates triangles that would fill in the polylines. + Multiple lines can be used to make holes inside a polyline, or fill in 2 separate lines at once. + @type polylines: List of lists containing vectors, each representing a closed polyline. + @rtype: list + @return: a list if tuples each a tuple of 3 ints representing a triangle indexing the points given. + @note: 2D Vectors will have an assumed Z axis of zero, 4D Vectors W axis is ignored. + @note: The order of points in a polyline effect the direction returned triangles face, reverse the order of a polyline to flip the normal of returned faces. + + I{B{Example:}} + + The example below creates 2 polylines and fills them in with faces, then makes a mesh in the current scene:: + import Blender + Vector= Blender.mathutils.Vector + + # Outline of 5 points + polyline1= [Vector(-2.0, 1.0, 1.0), Vector(-1.0, 2.0, 1.0), Vector(1.0, 2.0, 1.0), Vector(1.0, -1.0, 1.0), Vector(-1.0, -1.0, 1.0)] + polyline2= [Vector(-1, 1, 1.0), Vector(0, 1, 1.0), Vector(0, 0, 1.0), Vector(-1.0, 0.0, 1.0)] + fill= Blender.Geometry.PolyFill([polyline1, polyline2]) + + # Make a new mesh and add the truangles into it + me= Blender.Mesh.New() + me.verts.extend(polyline1) + me.verts.extend(polyline2) + me.faces.extend(fill) # Add the faces, they reference the verts in polyline 1 and 2 + + scn = Blender.Scene.GetCurrent() + ob = scn.objects.new(me) + Blender.Redraw() + """ + +def LineIntersect2D(vec1, vec2, vec3, vec4): + """ + Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line. + @rtype: Vector + @return: a 2D Vector for the intersection or None where there is no intersection. + """ + +def ClosestPointOnLine(pt, vec1, vec2): + """ + Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line. + @rtype: tuple + @return: a tuple containing a vector and a float, the vector is the closest point on the line, the float is the position on the line, between 0 and 1 the point is on the line. + """ + +def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3): + """ + Takes 4 vectors (one for the test point and 3 for the triangle) + This is a 2d function so only X and Y are used, Z and W will be ignored. + @rtype: int + @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection. + """ + +def PointInQuad2D(pt, quad_pt1, quad_pt2, quad_pt3): + """ + Takes 5 vectors (one for the test point and 5 for the quad) + This is a 2d function so only X and Y are used, Z and W will be ignored. + @rtype: int + @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection. + """ + +def BoxPack2D(boxlist): + """ + Takes a list of 2D boxes and packs them into a square. + Each box in boxlist must be a list of at least 4 items - [x,y,w,h], after running this script, + the X and Y values in each box will be moved to packed, non overlapping locations. + + Example:: + + # Make 500 random boxes, pack them and make a mesh from it + from Blender import Geometry, Scene, Mesh + import random + boxes = [] + for i in xrange(500): + boxes.append( [0,0, random.random()+0.1, random.random()+0.1] ) + boxsize = Geometry.BoxPack2D(boxes) + print 'BoxSize', boxsize + me = Mesh.New() + for x in boxes: + me.verts.extend([(x[0],x[1], 0), (x[0],x[1]+x[3], 0), (x[0]+x[2],x[1]+x[3], 0), (x[0]+x[2],x[1], 0) ]) + v1= me.verts[-1] + v2= me.verts[-2] + v3= me.verts[-3] + v4= me.verts[-4] + me.faces.extend([(v1,v2,v3,v4)]) + scn = Scene.GetCurrent() + scn.objects.new(me) + + @note: Each boxlist item can be longer then 4, the extra items are ignored and stay untouched. + @rtype: tuple + @return: a tuple pair - (width, height) of all the packed boxes. + """ +def BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution): + """ + Takes 4 vectors representing a bezier curve and returns a list of vector points. + @note: any vector size is supported, the largest dimension from the input will be used for all returned vectors/ + @rtype: list + @return: a list of vectors the size of resolution including the start and end points (vec_knot_1 and vec_knot_2) + """ diff --git a/doc/python_api/epy/IDProp.py b/doc/python_api/epy/IDProp.py new file mode 100644 index 00000000000..1fc26d7f65b --- /dev/null +++ b/doc/python_api/epy/IDProp.py @@ -0,0 +1,132 @@ +class IDGroup: + """ + The IDGroup Type + ================ + This type supports both iteration and the [] + operator to get child ID properties. + + You can also add new properties using the [] operator. + For example:: + + group['a float!'] = 0.0 + group['an int!'] = 0 + group['a string!'] = "hi!" + group['an array!'] = [0, 0, 1.0, 0] + + group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2], + "another subgroup": {"a": 0.0, "str": "bleh"}} + + Note that for arrays, the array type defaults to int unless a float is found + while scanning the template list; if any floats are found, then the whole + array is float. Note that double-precision floating point numbers are used for + python-created float ID properties and arrays (though the internal C api does + support single-precision floats, and the python code will read them). + + You can also delete properties with the del operator. For example: + + del group['property'] + + To get the type of a property, use the type() operator, for example:: + + if type(group['bleh']) == str: pass + + To tell if the property is a group or array type, import the Blender.Types module and test + against IDGroupType and IDArrayType, like so:: + + from Blender.Types import IDGroupType, IDArrayType. + + if type(group['bleghr']) == IDGroupType: + (do something) + + @ivar name: The name of the property + @type name: string + """ + + def pop(item): + """ + Pop an item from the group property. + @type item: string + @param item: The item name. + @rtype: can be dict, list, int, float or string. + @return: The removed property. + """ + + def update(updatedict): + """ + Updates items in the dict, similar to normal python + dictionary method .update(). + @type updatedict: dict + @param updatedict: A dict of simple types to derive updated/new IDProperties from. + @rtype: None + @return: None + """ + + def keys(): + """ + Returns a list of the keys in this property group. + @rtype: list of strings. + @return: a list of the keys in this property group. + """ + + def values(): + """ + Returns a list of the values in this property group. + + Note that unless a value is itself a property group or an array, you + cannot change it by changing the values in this list, you must change them + in the parent property group. + + For example, + + group['some_property'] = new_value + + . . .is correct, while, + + values = group.values() + values[0] = new_value + + . . .is wrong. + + @rtype: list of strings. + @return: a list of the values in this property group. + """ + + def iteritems(): + """ + Implements the python dictionary iteritmes method. + + For example:: + + for k, v in group.iteritems(): + print "Property name: " + k + print "Property value: " + str(v) + + @rtype: an iterator that spits out items of the form [key, value] + @return: an iterator. + """ + + def convert_to_pyobject(): + """ + Converts the entire property group to a purely python form. + + @rtype: dict + @return: A python dictionary representing the property group + """ + +class IDArray: + """ + The IDArray Type + ================ + + @ivar type: returns the type of the array, can be either IDP_Int or IDP_Float + """ + + def __getitem__(index): + pass + + def __setitem__(index, value): + pass + + def __len__(): + pass + diff --git a/doc/python_api/epy/Mathutils.py b/doc/python_api/epy/Mathutils.py new file mode 100644 index 00000000000..17a227f729a --- /dev/null +++ b/doc/python_api/epy/Mathutils.py @@ -0,0 +1,156 @@ +# Blender.mathutils module and its subtypes + + + +class Vector: + """ + + @attention: Vector data can be wrapped or non-wrapped. When a object is wrapped it + means that the object will give you direct access to the data inside of blender. Modification + of this object will directly change the data inside of blender. To copy a wrapped object + you need to use the object's constructor. If you copy and object by assignment you will not get + a second copy but a second reference to the same data. Only certain functions will return + wrapped data. This will be indicated in the method description. + """ + + def __init__(list = None): + """ + Create a new 2d, 3d, or 4d Vector object from a list of floating point numbers. + @note: that python uses higher precission floating point numbers, so values assigned to a vector may have some rounding error. + + + Example:: + v = Vector(1,0,0) + v = Vector(myVec) + v = Vector(list) + @type list: PyList of float or int + @param list: The list of values for the Vector object. Can be a sequence or raw numbers. + Must be 2, 3, or 4 values. The list is mapped to the parameters as [x,y,z,w]. + @rtype: Vector object. + @return: It depends wheter a parameter was passed: + - (list): Vector object initialized with the given values; + - (): An empty 3 dimensional vector. + """ + +class Euler: + """ + The Euler object + ================ + This object gives access to Eulers in Blender. + @note: You can access a euler object like a sequence + - x = euler[0] + @note: Comparison operators can be done: + - ==, != test numeric values within epsilon + @attention: Euler data can be wrapped or non-wrapped. When a object is wrapped it + means that the object will give you direct access to the data inside of blender. Modification + of this object will directly change the data inside of blender. To copy a wrapped object + you need to use the object's constructor. If you copy and object by assignment you will not get + a second copy but a second reference to the same data. Only certain functions will return + wrapped data. This will be indicated in the method description. + """ + + def __init__(list = None): + """ + Create a new euler object. + + Example:: + euler = Euler(45,0,0) + euler = Euler(myEuler) + euler = Euler(sequence) + @type list: PyList of float/int + @param list: 3d list to initialize euler + @rtype: Euler object + @return: Euler representing heading, pitch, bank. + @note: Values are in degrees. + """ + +class Quaternion: + """ + The Quaternion object + ===================== + This object gives access to Quaternions in Blender. + @note: Comparison operators can be done: + - ==, != test numeric values within epsilon + @note: Math can be performed on Quaternion classes + - quat + quat + - quat - quat + - quat * float/int + - quat * vec + - quat * quat + @note: You can access a quaternion object like a sequence + - x = quat[0] + @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it + means that the object will give you direct access to the data inside of blender. Modification + of this object will directly change the data inside of blender. To copy a wrapped object + you need to use the object's constructor. If you copy and object by assignment you will not get + a second copy but a second reference to the same data. Only certain functions will return + wrapped data. This will be indicated in the method description. + """ + + def __init__(list, angle = None): + """ + Create a new quaternion object from initialized values. + + Example:: + quat = Quaternion(1,2,3,4) + quat = Quaternion(axis, angle) + quat = Quaternion() + quat = Quaternion(180, list) + + @type list: PyList of int/float + @param list: A 3d or 4d list to initialize quaternion. + 4d if intializing [w,x,y,z], 3d if used as an axis of rotation. + @type angle: float (optional) + @param angle: An arbitrary rotation amount around 'list'. + List is used as an axis of rotation in this case. + @rtype: New quaternion object. + @return: It depends wheter a parameter was passed: + - (list/angle): Quaternion object initialized with the given values; + - (): An identity 4 dimensional quaternion. + """ + +class Matrix: + """ + The Matrix Object + ================= + @note: Math can be performed on Matrix classes + - mat + mat + - mat - mat + - mat * float/int + - mat * vec + - mat * mat + @note: Comparison operators can be done: + - ==, != test numeric values within epsilon + @note: You can access a quaternion object like a 2d sequence + - x = matrix[0][1] + - vector = matrix[2] + @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it + means that the object will give you direct access to the data inside of blender. Modification + of this object will directly change the data inside of blender. To copy a wrapped object + you need to use the object's constructor. If you copy and object by assignment you will not get + a second copy but a second reference to the same data. Only certain functions will return + wrapped data. This will be indicated in the method description. + """ + + def __init__(list1 = None, list2 = None, list3 = None, list4 = None): + """ + Create a new matrix object from initialized values. + + Example:: + matrix = Matrix([1,1,1],[0,1,0],[1,0,0]) + matrix = Matrix(mat) + matrix = Matrix(seq1, seq2, vector) + + @type list1: PyList of int/float + @param list1: A 2d,3d or 4d list. + @type list2: PyList of int/float + @param list2: A 2d,3d or 4d list. + @type list3: PyList of int/float + @param list3: A 2d,3d or 4d list. + @type list4: PyList of int/float + @param list4: A 2d,3d or 4d list. + @rtype: New matrix object. + @return: It depends wheter a parameter was passed: + - (list1, etc.): Matrix object initialized with the given values; + - (): An empty 3 dimensional matrix. + """ diff --git a/doc/python_api/epy/testbgl.py b/doc/python_api/epy/testbgl.py new file mode 100644 index 00000000000..e895d01df69 --- /dev/null +++ b/doc/python_api/epy/testbgl.py @@ -0,0 +1,45 @@ +# Testing the BGL module + +import Blender +from Blender.BGL import * +from Blender import Draw + +R = G = B = 0 +A = 1 + +instructions = "Hold mouse buttons to change the background color." +quitting = " Press ESC or q to quit." + +def show_win(): + glClearColor(R,G,B,A) # define color used to clear buffers + glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer + glColor3f(1,1,1) # change default color + glRasterPos2i(50,100) # move cursor to x = 50, y = 100 + Draw.Text("Testing BGL + Draw") # draw this text there + glRasterPos2i(350,20) # move cursor again + Draw.Text(instructions + quitting) # draw another msg + glBegin(GL_LINE_LOOP) # begin a vertex-data list + glVertex2i(46,92) + glVertex2i(120,92) + glVertex2i(120,115) + glVertex2i(46,115) + glEnd() # close this list + glColor3f(0.35,0.18,0.92) # change default color again + glBegin(GL_POLYGON) # another list, for a polygon + glVertex2i(315, 292) + glVertex2i(412, 200) + glVertex2i(264, 256) + glEnd() + Draw.Redraw(1) # make changes visible. + +def ev(evt, val): # this is a callback for Draw.Register() + global R,G,B,A # it handles input events + if evt == Draw.ESCKEY or evt == Draw.QKEY: + Draw.Exit() # this quits the script + elif evt == Draw.LEFTMOUSE: R = 1 - R + elif evt == Draw.MIDDLEMOUSE: G = 1 - G + elif evt == Draw.RIGHTMOUSE: B = 1 - B + else: + Draw.Register(show_win, ev, None) + +Draw.Register(show_win, ev, None) # start the main loop diff --git a/doc/python_api/examples/bpy.data.py b/doc/python_api/examples/bpy.data.py new file mode 100644 index 00000000000..fc1145a523f --- /dev/null +++ b/doc/python_api/examples/bpy.data.py @@ -0,0 +1,29 @@ +import bpy + + +# print all objects +for obj in bpy.data.objects: + print(obj.name) + + +# print all scene names in a list +print(bpy.data.scenes.keys()) + + +# remove mesh Cube +if "Cube" in bpy.data.meshes: + mesh = bpy.data.meshes["Cube"] + print("removing mesh", mesh) + bpy.data.meshes.unlink(mesh) + + +# write images into a file next to the blend +import os +file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w') + +for image in bpy.data.images: + file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1])) + +file.close() + + diff --git a/doc/python_api/examples/mathutils.Euler.py b/doc/python_api/examples/mathutils.Euler.py new file mode 100644 index 00000000000..bc7702c1d53 --- /dev/null +++ b/doc/python_api/examples/mathutils.Euler.py @@ -0,0 +1,3 @@ +import mathutils + +# todo diff --git a/doc/python_api/examples/mathutils.Matrix.py b/doc/python_api/examples/mathutils.Matrix.py new file mode 100644 index 00000000000..bc7702c1d53 --- /dev/null +++ b/doc/python_api/examples/mathutils.Matrix.py @@ -0,0 +1,3 @@ +import mathutils + +# todo diff --git a/doc/python_api/examples/mathutils.Quaternion.py b/doc/python_api/examples/mathutils.Quaternion.py new file mode 100644 index 00000000000..bc7702c1d53 --- /dev/null +++ b/doc/python_api/examples/mathutils.Quaternion.py @@ -0,0 +1,3 @@ +import mathutils + +# todo diff --git a/doc/python_api/examples/mathutils.Vector.py b/doc/python_api/examples/mathutils.Vector.py new file mode 100644 index 00000000000..fb00e8aead6 --- /dev/null +++ b/doc/python_api/examples/mathutils.Vector.py @@ -0,0 +1,55 @@ +import mathutils + +# zero length vector +vec = mathutils.Vector((0, 0, 1)) + +# unit length vector +vec_a = vec.copy().normalize() + +vec_b = mathutils.Vector((0, 1, 2)) + +vec2d = mathutils.Vector((1, 2)) +vec3d = mathutils.Vector((1, 0, 0)) +vec4d = vec_a.copy().resize4D() + +# other mathutuls types +quat = mathutils.Quaternion() +matrix = mathutils.Matrix() + +# Comparison operators can be done on Vector classes: + +# greater and less then test vector length. +vec_a > vec_b +vec_a >= vec_b +vec_a < vec_b +vec_a <= vec_b + +# ==, != test vector values e.g. 1,2,3 != 3,2,1 even if they are the same length +vec_a == vec_b +vec_a != vec_b + + +# Math can be performed on Vector classes +vec_a + vec_b +vec_a - vec_b +vec_a * vec_b +vec_a * 10.0 +vec_a * matrix +vec_a * vec_b +vec_a * quat +-vec_a + + +# You can access a vector object like a sequence +x = vec_a[0] +len(vec) +vec_a[:] = vec_b +vec2d[:] = vec3d[:2] + + +# Vectors support 'swizzle' operations +# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics) +vec.xyz = vec.zyx +vec.xy = vec4d.zw +vec.xyz = vec4d.wzz +vec4d.wxyz = vec.yxyx diff --git a/doc/python_api/examples/mathutils.py b/doc/python_api/examples/mathutils.py new file mode 100644 index 00000000000..02f69515f21 --- /dev/null +++ b/doc/python_api/examples/mathutils.py @@ -0,0 +1,18 @@ +import mathutils +from math import radians + +vec = mathutils.Vector((1.0, 2.0, 3.0)) + +mat_rot = mathutils.Matrix.Rotation(radians(90), 4, 'X') +mat_trans = mathutils.Matrix.Translation(vec) + +mat = mat_trans * mat_rot +mat.invert() + +mat3 = mat.rotation_part() +quat1 = mat.to_quat() +quat2 = mat3.to_quat() + +angle = quat1.difference(quat2) + +print(angle) diff --git a/doc/python_api/rst/bge.events.rst b/doc/python_api/rst/bge.events.rst new file mode 100644 index 00000000000..7215902a828 --- /dev/null +++ b/doc/python_api/rst/bge.events.rst @@ -0,0 +1,250 @@ + +Game Engine bge.events module +============================= + +***** +Intro +***** + +This module holds key constants for the SCA_KeyboardSensor. + +.. module:: bge.events + +.. code-block:: python + + # Set a connected keyboard sensor to accept F1 + import bge + + co = bge.logic.getCurrentController() + # 'Keyboard' is a keyboard sensor + sensor = co.sensors["Keyboard"] + sensor.key = bge.events.F1KEY + +.. code-block:: python + + # Do the all keys thing + import bge + + co = bge.logic.getCurrentController() + # 'Keyboard' is a keyboard sensor + sensor = co.sensors["Keyboard"] + + for key,status in sensor.events: + # key[0] == bge.events.keycode, key[1] = status + if status == bge.logic.KX_INPUT_JUST_ACTIVATED: + if key == bge.events.WKEY: + # Activate Forward! + if key == bge.events.SKEY: + # Activate Backward! + if key == bge.events.AKEY: + # Activate Left! + if key == bge.events.DKEY: + # Activate Right! + +.. code-block:: python + + # The all keys thing without a keyboard sensor (but you will + # need an always sensor with pulse mode on) + import bge + + # Just shortening names here + keyboard = bge.logic.keyboard + JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED + + if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED: + print("Activate Forward!") + if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED: + print("Activate Backward!") + if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED: + print("Activate Left!") + if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED: + print("Activate Right!") + + +********* +Functions +********* + +.. function:: EventToString(event) + + Return the string name of a key event. Will raise a ValueError error if its invalid. + + :arg event: key event from bge.keys or the keyboard sensor. + :type event: int + :rtype: string + +.. function:: EventToCharacter(event, shift) + + Return the string name of a key event. Returns an empty string if the event cant be represented as a character. + + :type event: int + :arg event: key event from :mod:`bge.keys` or the keyboard sensor. + :type shift: bool + :arg shift: set to true if shift is held. + :rtype: string + +**************** +Keys (Constants) +**************** + +.. _mouse-keys: + +========== +Mouse Keys +========== + +.. data:: LEFTMOUSE +.. data:: MIDDLEMOUSE +.. data:: RIGHTMOUSE +.. data:: WHEELUPMOUSE +.. data:: WHEELDOWNMOUSE +.. data:: MOUSEX +.. data:: MOUSEY + +.. _keyboard-keys: + +============= +Keyboard Keys +============= + +------------- +Alphabet keys +------------- + +.. data:: AKEY +.. data:: BKEY +.. data:: CKEY +.. data:: DKEY +.. data:: EKEY +.. data:: FKEY +.. data:: GKEY +.. data:: HKEY +.. data:: IKEY +.. data:: JKEY +.. data:: KKEY +.. data:: LKEY +.. data:: MKEY +.. data:: NKEY +.. data:: OKEY +.. data:: PKEY +.. data:: QKEY +.. data:: RKEY +.. data:: SKEY +.. data:: TKEY +.. data:: UKEY +.. data:: VKEY +.. data:: WKEY +.. data:: XKEY +.. data:: YKEY +.. data:: ZKEY + +----------- +Number keys +----------- + +.. data:: ZEROKEY +.. data:: ONEKEY +.. data:: TWOKEY +.. data:: THREEKEY +.. data:: FOURKEY +.. data:: FIVEKEY +.. data:: SIXKEY +.. data:: SEVENKEY +.. data:: EIGHTKEY +.. data:: NINEKEY + +-------------- +Modifiers Keys +-------------- + +.. data:: CAPSLOCKKEY +.. data:: LEFTCTRLKEY +.. data:: LEFTALTKEY +.. data:: RIGHTALTKEY +.. data:: RIGHTCTRLKEY +.. data:: RIGHTSHIFTKEY +.. data:: LEFTSHIFTKEY + +---------- +Arrow Keys +---------- + +.. data:: LEFTARROWKEY +.. data:: DOWNARROWKEY +.. data:: RIGHTARROWKEY +.. data:: UPARROWKEY + +-------------- +Numberpad Keys +-------------- + +.. data:: PAD0 +.. data:: PAD1 +.. data:: PAD2 +.. data:: PAD3 +.. data:: PAD4 +.. data:: PAD5 +.. data:: PAD6 +.. data:: PAD7 +.. data:: PAD8 +.. data:: PAD9 +.. data:: PADPERIOD +.. data:: PADSLASHKEY +.. data:: PADASTERKEY +.. data:: PADMINUS +.. data:: PADENTER +.. data:: PADPLUSKEY + +------------- +Function Keys +------------- + +.. data:: F1KEY +.. data:: F2KEY +.. data:: F3KEY +.. data:: F4KEY +.. data:: F5KEY +.. data:: F6KEY +.. data:: F7KEY +.. data:: F8KEY +.. data:: F9KEY +.. data:: F10KEY +.. data:: F11KEY +.. data:: F12KEY +.. data:: F13KEY +.. data:: F14KEY +.. data:: F15KEY +.. data:: F16KEY +.. data:: F17KEY +.. data:: F18KEY +.. data:: F19KEY + +---------- +Other Keys +---------- + +.. data:: ACCENTGRAVEKEY +.. data:: BACKSLASHKEY +.. data:: BACKSPACEKEY +.. data:: COMMAKEY +.. data:: DELKEY +.. data:: ENDKEY +.. data:: EQUALKEY +.. data:: ESCKEY +.. data:: HOMEKEY +.. data:: INSERTKEY +.. data:: LEFTBRACKETKEY +.. data:: LINEFEEDKEY +.. data:: MINUSKEY +.. data:: PAGEDOWNKEY +.. data:: PAGEUPKEY +.. data:: PAUSEKEY +.. data:: PERIODKEY +.. data:: QUOTEKEY +.. data:: RIGHTBRACKETKEY +.. data:: RETKEY (Deprecated: use bge.events.ENTERKEY) +.. data:: ENTERKEY +.. data:: SEMICOLONKEY +.. data:: SLASHKEY +.. data:: SPACEKEY +.. data:: TABKEY diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst new file mode 100644 index 00000000000..d3261f5747b --- /dev/null +++ b/doc/python_api/rst/bge.logic.rst @@ -0,0 +1,932 @@ + +Game Engine bge.logic Module +============================ +***** +Intro +***** + +Module to access logic functions, imported automatically into the python controllers namespace. + +.. module:: bge.logic + +.. code-block:: python + + # To get the controller thats running this python script: + cont = bge.logic.getCurrentController() # bge.logic is automatically imported + + # To get the game object this controller is on: + obj = cont.owner + +:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`bge.types.~KX_LightObject` methods are available depending on the type of object + +.. code-block:: python + + # To get a sensor linked to this controller. + # "sensorname" is the name of the sensor as defined in the Blender interface. + # +---------------------+ +--------+ + # | Sensor "sensorname" +--+ Python + + # +---------------------+ +--------+ + sens = cont.sensors["sensorname"] + + # To get a sequence of all sensors: + sensors = co.sensors + +See the sensor's reference for available methods: + +.. hlist:: + :columns: 3 + + * :class:`~bge.types.KX_MouseFocusSensor` + * :class:`~bge.types.KX_NearSensor` + * :class:`~bge.types.KX_NetworkMessageSensor` + * :class:`~bge.types.KX_RadarSensor` + * :class:`~bge.types.KX_RaySensor` + * :class:`~bge.types.KX_TouchSensor` + * :class:`~bge.types.SCA_DelaySensor` + * :class:`~bge.types.SCA_JoystickSensor` + * :class:`~bge.types.SCA_KeyboardSensor` + * :class:`~bge.types.SCA_MouseSensor` + * :class:`~bge.types.SCA_PropertySensor` + * :class:`~bge.types.SCA_RandomSensor` + +You can also access actuators linked to the controller + +.. code-block:: python + + # To get an actuator attached to the controller: + # +--------+ +-------------------------+ + # + Python +--+ Actuator "actuatorname" | + # +--------+ +-------------------------+ + actuator = co.actuators["actuatorname"] + + # Activate an actuator + controller.activate(actuator) + +See the actuator's reference for available methods + +.. hlist:: + :columns: 3 + + * :class:`~bge.types.BL_ActionActuator` + * :class:`~bge.types.BL_ShapeActionActuator` + * :class:`~bge.types.KX_CameraActuator` + * :class:`~bge.types.KX_ConstraintActuator` + * :class:`~bge.types.KX_GameActuator` + * :class:`~bge.types.KX_IpoActuator` + * :class:`~bge.types.KX_NetworkMessageActuator` + * :class:`~bge.types.KX_ObjectActuator` + * :class:`~bge.types.KX_ParentActuator` + * :class:`~bge.types.KX_SCA_AddObjectActuator` + * :class:`~bge.types.KX_SCA_DynamicActuator` + * :class:`~bge.types.KX_SCA_EndObjectActuator` + * :class:`~bge.types.KX_SCA_ReplaceMeshActuator` + * :class:`~bge.types.KX_SceneActuator` + * :class:`~bge.types.KX_SoundActuator` + * :class:`~bge.types.KX_StateActuator` + * :class:`~bge.types.KX_TrackToActuator` + * :class:`~bge.types.KX_VisibilityActuator` + * :class:`~bge.types.SCA_2DFilterActuator` + * :class:`~bge.types.SCA_PropertyActuator` + * :class:`~bge.types.SCA_RandomActuator` + +Most logic brick's methods are accessors for the properties available in the logic buttons. +Consult the logic bricks documentation for more information on how each logic brick works. + +There are also methods to access the current :class:`bge.types.KX_Scene` + +.. code-block:: python + + # Get the current scene + scene = bge.logic.getCurrentScene() + + # Get the current camera + cam = scene.active_camera + +Matricies as used by the game engine are **row major** +``matrix[row][col] = float`` + +:class:`bge.types.KX_Camera` has some examples using matricies. + +********* +Variables +********* + +.. data:: globalDict + + A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. + It can also be written to a file and loaded later on with the game load/save actuators. + + .. note:: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expected. + +.. data:: keyboard + + The current keyboard wrapped in an :class:`~bge.types.SCA_PythonKeyboard` object. + +.. data:: mouse + + The current mouse wrapped in an :class:`~bge.types.SCA_PythonMouse` object. + +***************** +General functions +***************** + +.. function:: getCurrentController() + + Gets the Python controller associated with this Python script. + + :rtype: :class:`bge.types.SCA_PythonController` + +.. function:: getCurrentScene() + + Gets the current Scene. + + :rtype: :class:`bge.types.KX_Scene` + +.. function:: getSceneList() + + Gets a list of the current scenes loaded in the game engine. + + :rtype: list of :class:`bge.types.KX_Scene` + + .. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes. + +.. function:: loadGlobalDict() + + Loads bge.logic.globalDict from a file. + +.. function:: saveGlobalDict() + + Saves bge.logic.globalDict to a file. + +.. function:: startGame(blend) + + Loads the blend file. + + :arg blend: The name of the blend file + :type blend: string + +.. function:: endGame() + + Ends the current game. + +.. function:: restartGame() + + Restarts the current game by reloading the .blend file (the last saved version, not what is currently running). + +.. function:: LibLoad(blend, type, data) + + Converts the all of the datablocks of the given type from the given blend. + + :arg blend: The path to the blend file (or the name to use for the library if data is supplied) + :type blend: string + :arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported) + :type type: string + :arg data: Binary data from a blend file (optional) + :type data: bytes + +.. function:: LibNew(name, type, data) + + Uses existing datablock data and loads in as a new library. + + :arg name: A unique library name used for removal later + :type name: string + :arg type: The datablock type (currently only "Mesh" is supported) + :type type: string + :arg data: A list of names of the datablocks to load + :type data: list of strings + +.. function:: LibFree(name) + + Frees a library, removing all objects and meshes from the currently active scenes. + + :arg name: The name of the library to free (the name used in LibNew) + :type name: string + +.. function:: addScene(name, overlay=1) + + Loads a scene into the game engine. + + :arg name: The name of the scene + :type name: string + :arg overlay: Overlay or underlay (optional) + :type overlay: integer + +.. function:: sendMessage(subject, body="", to="", message_from="") + + Sends a message to sensors in any active scene. + + :arg subject: The subject of the message + :type subject: string + :arg body: The body of the message (optional) + :type body: string + :arg to: The name of the object to send the message to (optional) + :type to: string + :arg message_from: The name of the object that the message is coming from (optional) + :type message_from: string + +.. function:: setGravity(gravity) + + Sets the world gravity. + + :type gravity: list [fx, fy, fz] + +.. function:: getSpectrum() + + Returns a 512 point list from the sound card. + This only works if the fmod sound driver is being used. + + :rtype: list [float], len(getSpectrum()) == 512 + +.. function:: stopDSP() + + Stops the sound driver using DSP effects. + + Only the fmod sound driver supports this. + DSP can be computationally expensive. + +.. function:: getMaxLogicFrame() + + Gets the maximum number of logic frames per render frame. + + :return: The maximum number of logic frames per render frame + :rtype: integer + +.. function:: setMaxLogicFrame(maxlogic) + + Sets the maximum number of logic frames that are executed per render frame. + This does not affect the physic system that still runs at full frame rate. + + :arg maxlogic: The new maximum number of logic frames per render frame. Valid values: 1..5 + :type maxlogic: integer + +.. function:: getMaxPhysicsFrame() + + Gets the maximum number of physics frames per render frame. + + :return: The maximum number of physics frames per render frame + :rtype: integer + +.. function:: setMaxPhysicsFrame(maxphysics) + + Sets the maximum number of physics timestep that are executed per render frame. + Higher value allows physics to keep up with realtime even if graphics slows down the game. + Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate) + maxphysics/ticrate is the maximum delay of the renderer that physics can compensate. + + :arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5. + :type maxphysics: integer + +.. function:: getLogicTicRate() + + Gets the logic update frequency. + + :return: The logic frequency in Hz + :rtype: float + +.. function:: setLogicTicRate(ticrate) + + Sets the logic update frequency. + + The logic update frequency is the number of times logic bricks are executed every second. + The default is 60 Hz. + + :arg ticrate: The new logic update frequency (in Hz). + :type ticrate: float + +.. function:: getPhysicsTicRate() + + Gets the physics update frequency + + :return: The physics update frequency in Hz + :rtype: float + + .. warning: Not implimented yet + +.. function:: setPhysicsTicRate(ticrate) + + Sets the physics update frequency + + The physics update frequency is the number of times the physics system is executed every second. + The default is 60 Hz. + + :arg ticrate: The new update frequency (in Hz). + :type ticrate: float + + .. warning: Not implimented yet + +***************** +Utility functions +***************** + +.. function:: expandPath(path) + + Converts a blender internal path into a proper file system path. + + Use / as directory separator in path + You can use '//' at the start of the string to define a relative path; + Blender replaces that string by the directory of the startup .blend or runtime file + to make a full path name (doesn't change during the game, even if you load other .blend). + The function also converts the directory separator to the local file system format. + + :arg path: The path string to be converted/expanded. + :type path: string + :return: The converted string + :rtype: string + +.. function:: getAverageFrameRate() + + Gets the estimated average framerate + + :return: The estimed average framerate in frames per second + :rtype: float + +.. function:: getBlendFileList(path = "//") + + Returns a list of blend files in the same directory as the open blend file, or from using the option argument. + + :arg path: Optional directory argument, will be expanded (like expandPath) into the full path. + :type path: string + :return: A list of filenames, with no directory prefix + :rtype: list + +.. function:: getRandomFloat() + + Returns a random floating point value in the range [0 - 1) + +.. function:: PrintGLInfo() + + Prints GL Extension Info into the console + +********* +Constants +********* + +.. data:: KX_TRUE + + True value used by some modules. + +.. data:: KX_FALSE + + False value used by some modules. + +======= +Sensors +======= + +.. _sensor-status: + +------------- +Sensor Status +------------- + +.. data:: KX_SENSOR_INACTIVE +.. data:: KX_SENSOR_JUST_ACTIVATED +.. data:: KX_SENSOR_ACTIVE +.. data:: KX_SENSOR_JUST_DEACTIVATED + +.. _logic-property-sensor: + +--------------- +Property Sensor +--------------- + +.. data:: KX_PROPSENSOR_EQUAL + + Activate when the property is equal to the sensor value. + + :value: 1 + +.. data:: KX_PROPSENSOR_NOTEQUAL + + Activate when the property is not equal to the sensor value. + + :value: 2 + +.. data:: KX_PROPSENSOR_INTERVAL + + Activate when the property is between the specified limits. + + :value: 3 + +.. data:: KX_PROPSENSOR_CHANGED + + Activate when the property changes + + :value: 4 + +.. data:: KX_PROPSENSOR_EXPRESSION + + Activate when the expression matches + + :value: 5 + +------------ +Radar Sensor +------------ + +See :class:`bge.types.KX_RadarSensor` + +.. data:: KX_RADAR_AXIS_POS_X +.. data:: KX_RADAR_AXIS_POS_Y +.. data:: KX_RADAR_AXIS_POS_Z +.. data:: KX_RADAR_AXIS_NEG_X +.. data:: KX_RADAR_AXIS_NEG_Y +.. data:: KX_RADAR_AXIS_NEG_Z + +---------- +Ray Sensor +---------- + +See :class:`bge.types.KX_RaySensor` + +.. data:: KX_RAY_AXIS_POS_X +.. data:: KX_RAY_AXIS_POS_Y +.. data:: KX_RAY_AXIS_POS_Z +.. data:: KX_RAY_AXIS_NEG_X +.. data:: KX_RAY_AXIS_NEG_Y +.. data:: KX_RAY_AXIS_NEG_Z + + +========= +Actuators +========= + +.. _action-actuator: + +--------------- +Action Actuator +--------------- + +See :class:`bge.types.BL_ActionActuator` + +.. data:: KX_ACTIONACT_PLAY +.. data:: KX_ACTIONACT_FLIPPER +.. data:: KX_ACTIONACT_LOOPSTOP +.. data:: KX_ACTIONACT_LOOPEND +.. data:: KX_ACTIONACT_PROPERTY + +------------------- +Constraint Actuator +------------------- + +.. _constraint-actuator-option: + +See :class:`bge.types.KX_ConstraintActuator.option` + +* Applicable to Distance constraint: + + .. data:: KX_ACT_CONSTRAINT_NORMAL + + Activate alignment to surface + + .. data:: KX_ACT_CONSTRAINT_DISTANCE + + Activate distance control + + .. data:: KX_ACT_CONSTRAINT_LOCAL + + Direction of the ray is along the local axis + +* Applicable to Force field constraint: + + .. data:: KX_ACT_CONSTRAINT_DOROTFH + + Force field act on rotation as well + +* Applicable to both: + + .. data:: KX_ACT_CONSTRAINT_MATERIAL + + Detect material rather than property + + .. data:: KX_ACT_CONSTRAINT_PERMANENT + + No deactivation if ray does not hit target + +.. _constraint-actuator-limit: + +See :class:`bge.types.KX_ConstraintActuator.limit` + +.. data:: KX_CONSTRAINTACT_LOCX + + Limit X coord. + +.. data:: KX_CONSTRAINTACT_LOCY + + Limit Y coord + +.. data:: KX_CONSTRAINTACT_LOCZ + + Limit Z coord + +.. data:: KX_CONSTRAINTACT_ROTX + + Limit X rotation + +.. data:: KX_CONSTRAINTACT_ROTY + + Limit Y rotation + +.. data:: KX_CONSTRAINTACT_ROTZ + + Limit Z rotation + +.. data:: KX_CONSTRAINTACT_DIRNX + + Set distance along negative X axis + +.. data:: KX_CONSTRAINTACT_DIRNY + + Set distance along negative Y axis + +.. data:: KX_CONSTRAINTACT_DIRNZ + + Set distance along negative Z axis + +.. data:: KX_CONSTRAINTACT_DIRPX + + Set distance along positive X axis + +.. data:: KX_CONSTRAINTACT_DIRPY + + Set distance along positive Y axis + +.. data:: KX_CONSTRAINTACT_DIRPZ + + Set distance along positive Z axis + +.. data:: KX_CONSTRAINTACT_ORIX + + Set orientation of X axis + +.. data:: KX_CONSTRAINTACT_ORIY + + Set orientation of Y axis + +.. data:: KX_CONSTRAINTACT_ORIZ + + Set orientation of Z axis + +.. data:: KX_ACT_CONSTRAINT_FHNX + + Set force field along negative X axis + +.. data:: KX_ACT_CONSTRAINT_FHNY + + Set force field along negative Y axis + +.. data:: KX_ACT_CONSTRAINT_FHNZ + + Set force field along negative Z axis + +.. data:: KX_ACT_CONSTRAINT_FHPX + + Set force field along positive X axis + +.. data:: KX_ACT_CONSTRAINT_FHPY + + Set force field along positive Y axis + +.. data:: KX_ACT_CONSTRAINT_FHPZ + + Set force field along positive Z axis + +---------------- +Dynamic Actuator +---------------- + +See :class:`bge.types.KX_SCA_DynamicActuator` + +.. data:: KX_DYN_RESTORE_DYNAMICS +.. data:: KX_DYN_DISABLE_DYNAMICS +.. data:: KX_DYN_ENABLE_RIGID_BODY +.. data:: KX_DYN_DISABLE_RIGID_BODY +.. data:: KX_DYN_SET_MASS + +.. _game-actuator: + +------------- +Game Actuator +------------- + +See :class:`bge.types.KX_GameActuator` + +.. data:: KX_GAME_LOAD +.. data:: KX_GAME_START +.. data:: KX_GAME_RESTART +.. data:: KX_GAME_QUIT +.. data:: KX_GAME_SAVECFG +.. data:: KX_GAME_LOADCFG + +.. _ipo-actuator: + +------------ +IPO Actuator +------------ + +See :class:`bge.types.KX_IpoActuator` + +.. data:: KX_IPOACT_PLAY +.. data:: KX_IPOACT_PINGPONG +.. data:: KX_IPOACT_FLIPPER +.. data:: KX_IPOACT_LOOPSTOP +.. data:: KX_IPOACT_LOOPEND +.. data:: KX_IPOACT_FROM_PROP + +--------------- +Parent Actuator +--------------- + +.. data:: KX_PARENT_REMOVE +.. data:: KX_PARENT_SET + +.. _logic-random-distributions: + +-------------------- +Random Distributions +-------------------- + +See :class:`bge.types.SCA_RandomActuator` + +.. data:: KX_RANDOMACT_BOOL_CONST +.. data:: KX_RANDOMACT_BOOL_UNIFORM +.. data:: KX_RANDOMACT_BOOL_BERNOUILLI +.. data:: KX_RANDOMACT_INT_CONST +.. data:: KX_RANDOMACT_INT_UNIFORM +.. data:: KX_RANDOMACT_INT_POISSON +.. data:: KX_RANDOMACT_FLOAT_CONST +.. data:: KX_RANDOMACT_FLOAT_UNIFORM +.. data:: KX_RANDOMACT_FLOAT_NORMAL +.. data:: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL + +-------------- +Scene Actuator +-------------- + +See :class:`bge.types.KX_SceneActuator` + +.. data:: KX_SCENE_RESTART +.. data:: KX_SCENE_SET_SCENE +.. data:: KX_SCENE_SET_CAMERA +.. data:: KX_SCENE_ADD_FRONT_SCENE +.. data:: KX_SCENE_ADD_BACK_SCENE +.. data:: KX_SCENE_REMOVE_SCENE +.. data:: KX_SCENE_SUSPEND +.. data:: KX_SCENE_RESUME + +.. _shape-action-actuator: + +--------------------- +Shape Action Actuator +--------------------- + +See :class:`bge.types.BL_ActionActuator` + +.. data:: KX_ACTIONACT_PLAY +.. data:: KX_ACTIONACT_FLIPPER +.. data:: KX_ACTIONACT_LOOPSTOP +.. data:: KX_ACTIONACT_LOOPEND +.. data:: KX_ACTIONACT_PROPERTY + +.. _logic-sound-actuator: + +-------------- +Sound Actuator +-------------- + +See :class:`bge.types.KX_SoundActuator` + +.. data:: KX_SOUNDACT_PLAYSTOP + + :value: 1 + +.. data:: KX_SOUNDACT_PLAYEND + + :value: 2 + +.. data:: KX_SOUNDACT_LOOPSTOP + + :value: 3 + +.. data:: KX_SOUNDACT_LOOPEND + + :value: 4 + +.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL + + :value: 5 + +.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP + + :value: 6 + + +======= +Various +======= + +.. _input-status: + +------------ +Input Status +------------ + +See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor` + +.. data:: KX_INPUT_NONE +.. data:: KX_INPUT_JUST_ACTIVATED +.. data:: KX_INPUT_ACTIVE +.. data:: KX_INPUT_JUST_RELEASED + +------------- +Mouse Buttons +------------- + +See :class:`bge.types.SCA_MouseSensor` + +.. data:: KX_MOUSE_BUT_LEFT +.. data:: KX_MOUSE_BUT_MIDDLE +.. data:: KX_MOUSE_BUT_RIGHT + +------ +States +------ + +See :class:`bge.types.KX_StateActuator` + +.. data:: KX_STATE1 +.. data:: KX_STATE2 +.. data:: KX_STATE3 +.. data:: KX_STATE4 +.. data:: KX_STATE5 +.. data:: KX_STATE6 +.. data:: KX_STATE7 +.. data:: KX_STATE8 +.. data:: KX_STATE9 +.. data:: KX_STATE10 +.. data:: KX_STATE11 +.. data:: KX_STATE12 +.. data:: KX_STATE13 +.. data:: KX_STATE14 +.. data:: KX_STATE15 +.. data:: KX_STATE16 +.. data:: KX_STATE17 +.. data:: KX_STATE18 +.. data:: KX_STATE19 +.. data:: KX_STATE20 +.. data:: KX_STATE21 +.. data:: KX_STATE22 +.. data:: KX_STATE23 +.. data:: KX_STATE24 +.. data:: KX_STATE25 +.. data:: KX_STATE26 +.. data:: KX_STATE27 +.. data:: KX_STATE28 +.. data:: KX_STATE29 +.. data:: KX_STATE30 + +.. _state-actuator-operation: + +See :class:`bge.types.KX_StateActuator.operation` + +.. data:: KX_STATE_OP_CLR + + Substract bits to state mask + + :value: 0 + +.. data:: KX_STATE_OP_CPY + + Copy state mask + + :value: 1 + +.. data:: KX_STATE_OP_NEG + + Invert bits to state mask + + :value: 2 + +.. data:: KX_STATE_OP_SET + + Add bits to state mask + + :value: 3 + +.. _Two-D-FilterActuator-mode: + +--------- +2D Filter +--------- + +.. data:: RAS_2DFILTER_BLUR + + :value: 2 + +.. data:: RAS_2DFILTER_CUSTOMFILTER + + Customer filter, the code code is set via shaderText property. + + :value: 12 + +.. data:: RAS_2DFILTER_DILATION + + :value: 4 + +.. data:: RAS_2DFILTER_DISABLED + + Disable the filter that is currently active + + :value: -1 + +.. data:: RAS_2DFILTER_ENABLED + + Enable the filter that was previously disabled + + :value: -2 + +.. data:: RAS_2DFILTER_EROSION + + :value: 5 + +.. data:: RAS_2DFILTER_GRAYSCALE + + :value: 9 + +.. data:: RAS_2DFILTER_INVERT + + :value: 11 + +.. data:: RAS_2DFILTER_LAPLACIAN + + :value: 6 + +.. data:: RAS_2DFILTER_MOTIONBLUR + + Create and enable preset filters + + :value: 1 + +.. data:: RAS_2DFILTER_NOFILTER + + Disable and destroy the filter that is currently active + + :value: 0 + +.. data:: RAS_2DFILTER_PREWITT + + :value: 8 + +.. data:: RAS_2DFILTER_SEPIA + + :value: 10 + +.. data:: RAS_2DFILTER_SHARPEN + + :value: 3 + +.. data:: RAS_2DFILTER_SOBEL + + :value: 7 + +------ +Shader +------ + +.. data:: VIEWMATRIX +.. data:: VIEWMATRIX_INVERSE +.. data:: VIEWMATRIX_INVERSETRANSPOSE +.. data:: VIEWMATRIX_TRANSPOSE +.. data:: MODELMATRIX +.. data:: MODELMATRIX_INVERSE +.. data:: MODELMATRIX_INVERSETRANSPOSE +.. data:: MODELMATRIX_TRANSPOSE +.. data:: MODELVIEWMATRIX +.. data:: MODELVIEWMATRIX_INVERSE +.. data:: MODELVIEWMATRIX_INVERSETRANSPOSE +.. data:: MODELVIEWMATRIX_TRANSPOSE +.. data:: CAM_POS + + Current camera position + +.. data:: CONSTANT_TIMER + + User a timer for the uniform value. + +.. data:: SHD_TANGENT + +---------------- +Blender Material +---------------- + +.. data:: BL_DST_ALPHA +.. data:: BL_DST_COLOR +.. data:: BL_ONE +.. data:: BL_ONE_MINUS_DST_ALPHA +.. data:: BL_ONE_MINUS_DST_COLOR +.. data:: BL_ONE_MINUS_SRC_ALPHA +.. data:: BL_ONE_MINUS_SRC_COLOR +.. data:: BL_SRC_ALPHA +.. data:: BL_SRC_ALPHA_SATURATE +.. data:: BL_SRC_COLOR +.. data:: BL_ZERO diff --git a/doc/python_api/rst/bge.render.rst b/doc/python_api/rst/bge.render.rst new file mode 100644 index 00000000000..9f17455601b --- /dev/null +++ b/doc/python_api/rst/bge.render.rst @@ -0,0 +1,242 @@ + +Game Engine bge.render Module +============================= + +***** +Intro +***** + +.. module:: bge.render + +.. code-block:: python + + # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook:: + # To use a mouse movement sensor "Mouse" and a + # motion actuator to mouse look: + import bge.render + import bge.logic + + # SCALE sets the speed of motion + SCALE=[1, 0.5] + + co = bge.logic.getCurrentController() + obj = co.getOwner() + mouse = co.getSensor("Mouse") + lmotion = co.getActuator("LMove") + wmotion = co.getActuator("WMove") + + # Transform the mouse coordinates to see how far the mouse has moved. + def mousePos(): + x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0] + y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1] + return (x, y) + + pos = mousePos() + + # Set the amount of motion: X is applied in world coordinates... + lmotion.setTorque(0.0, 0.0, pos[0], False) + # ...Y is applied in local coordinates + wmotion.setTorque(-pos[1], 0.0, 0.0, True) + + # Activate both actuators + bge.logic.addActiveActuator(lmotion, True) + bge.logic.addActiveActuator(wmotion, True) + + # Centre the mouse + bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2) + +********* +Constants +********* + +.. data:: KX_TEXFACE_MATERIAL + + Materials as defined by the texture face settings. + +.. data:: KX_BLENDER_MULTITEX_MATERIAL + + Materials approximating blender materials with multitexturing. + +.. data:: KX_BLENDER_GLSL_MATERIAL + + Materials approximating blender materials with GLSL. + +********* +Functions +********* + +.. function:: getWindowWidth() + + Gets the width of the window (in pixels) + + :rtype: integer + +.. function:: getWindowHeight() + + Gets the height of the window (in pixels) + + :rtype: integer + +.. function:: makeScreenshot(filename) + + Writes a screenshot to the given filename. + + If filename starts with // the image will be saved relative to the current directory. + If the filename contains # it will be replaced with the frame number. + + The standalone player saves .png files. It does not support colour space conversion + or gamma correction. + + When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg. + Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels. + + :type filename: string + + +.. function:: enableVisibility(visible) + + Doesn't really do anything... + + +.. function:: showMouse(visible) + + Enables or disables the operating system mouse cursor. + + :type visible: boolean + + +.. function:: setMousePosition(x, y) + + Sets the mouse cursor position. + + :type x: integer + :type y: integer + + +.. function:: setBackgroundColor(rgba) + + Sets the window background colour. + + :type rgba: list [r, g, b, a] + + +.. function:: setMistColor(rgb) + + Sets the mist colour. + + :type rgb: list [r, g, b] + + +.. function:: setAmbientColor(rgb) + + Sets the color of ambient light. + + :type rgb: list [r, g, b] + + +.. function:: setMistStart(start) + + Sets the mist start value. Objects further away than start will have mist applied to them. + + :type start: float + + +.. function:: setMistEnd(end) + + Sets the mist end value. Objects further away from this will be coloured solid with + the colour set by setMistColor(). + + :type end: float + + +.. function:: disableMist() + + Disables mist. + + .. note:: Set any of the mist properties to enable mist. + + +.. function:: setEyeSeparation(eyesep) + + Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value. + + :arg eyesep: The distance between the left and right eye. + :type eyesep: float + + +.. function:: getEyeSeparation() + + Gets the current eye separation for stereo mode. + + :rtype: float + + +.. function:: setFocalLength(focallength) + + Sets the focal length for stereo mode. It uses the current camera focal length as initial value. + + :arg focallength: The focal length. + :type focallength: float + +.. function:: getFocalLength() + + Gets the current focal length for stereo mode. + + :rtype: float + +.. function:: setMaterialMode(mode) + + Set the material mode to use for OpenGL rendering. + + :type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL + + .. note:: Changes will only affect newly created scenes. + + +.. function:: getMaterialMode(mode) + + Get the material mode to use for OpenGL rendering. + + :rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL + + +.. function:: setGLSLMaterialSetting(setting, enable) + + Enables or disables a GLSL material setting. + + :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) + :type enable: boolean + + +.. function:: getGLSLMaterialSetting(setting, enable) + + Get the state of a GLSL material setting. + + :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) + :rtype: boolean + + +.. function:: drawLine(fromVec,toVec,color) + + Draw a line in the 3D scene. + + :arg fromVec: the origin of the line + :type fromVec: list [x, y, z] + :arg toVec: the end of the line + :type toVec: list [x, y, z] + :arg color: the color of the line + :type color: list [r, g, b] + + +.. function:: enableMotionBlur(factor) + + Enable the motion blur effect. + + :arg factor: the ammount of motion blur to display. + :type factor: float [0.0 - 1.0] + + +.. function:: disableMotionBlur() + + Disable the motion blur effect. + diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst new file mode 100644 index 00000000000..6dc5488af32 --- /dev/null +++ b/doc/python_api/rst/bge.types.rst @@ -0,0 +1,5227 @@ + +Game Engine bge.types Module +============================= + +.. module:: bge.types + +.. class:: PyObjectPlus + + PyObjectPlus base class of most other types in the Game Engine. + + .. attribute:: invalid + + Test if the object has been freed by the game engine and is no longer valid. + + Normally this is not a problem but when storing game engine data in the GameLogic module, + KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data. + Calling an attribute or method on an invalid object will raise a SystemError. + + The invalid attribute allows testing for this case without exception handling. + + :type: boolean + + .. method:: isA(game_type) + + Check if this is a type or a subtype game_type. + + :arg game_type: the name of the type or the type its self from the :mod:`bge.types` module. + :type game_type: string or type + :return: True if this object is a type or a subtype of game_type. + :rtype: boolean + +.. class:: CValue(PyObjectPlus) + + This class is a basis for other classes. + + .. attribute:: name + + The name of this CValue derived object (read-only). + + :type: string + +.. class:: CPropValue(CValue) + + This class has no python functions + +.. class:: SCA_ILogicBrick(CValue) + + Base class for all logic bricks. + + .. attribute:: executePriority + + This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). + + :type: executePriority: int + + .. attribute:: owner + + The game object this logic brick is attached to (read-only). + + :type: :class:`KX_GameObject` or None in exceptional cases. + + .. attribute:: name + + The name of this logic brick (read-only). + + :type: string + +.. class:: SCA_PythonKeyboard(PyObjectPlus) + + The current keyboard. + + .. attribute:: events + + A dictionary containing the status of each keyboard event or key. (read-only). + + :type: dictionary {:ref:`keycode`::ref:`status`, ...} + +.. class:: SCA_PythonMouse(PyObjectPlus) + + The current mouse. + + .. attribute:: events + + a dictionary containing the status of each mouse event. (read-only). + + :type: dictionary {:ref:`keycode`::ref:`status`, ...} + + .. attribute:: position + + The normalized x and y position of the mouse cursor. + + :type: list [x, y] + + .. attribute:: visible + + The visibility of the mouse cursor. + + :type: boolean + +.. class:: SCA_IObject(CValue) + + This class has no python functions + +.. class:: SCA_ISensor(SCA_ILogicBrick) + + Base class for all sensor logic bricks. + + .. attribute:: usePosPulseMode + + Flag to turn positive pulse mode on and off. + + :type: boolean + + .. attribute:: useNegPulseMode + + Flag to turn negative pulse mode on and off. + + :type: boolean + + .. attribute:: frequency + + The frequency for pulse mode sensors. + + :type: integer + + .. attribute:: level + + level Option whether to detect level or edge transition when entering a state. + It makes a difference only in case of logic state transition (state actuator). + A level detector will immediately generate a pulse, negative or positive + depending on the sensor condition, as soon as the state is activated. + A edge detector will wait for a state change before generating a pulse. + note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`. + + :type: boolean + + .. attribute:: tap + + When enabled only sensors that are just activated will send a positive event, + after this they will be detected as negative by the controllers. + This will make a key thats held act as if its only tapped for an instant. + note: mutually exclusive with :data:`level`, enabling will disable :data:`level`. + + :type: boolean + + .. attribute:: invert + + Flag to set if this sensor activates on positive or negative events. + + :type: boolean + + .. attribute:: triggered + + True if this sensor brick is in a positive state. (read-only). + + :type: boolean + + .. attribute:: positive + + True if this sensor brick is in a positive state. (read-only). + + :type: boolean + + .. attribute:: status + + The status of the sensor (read-only): can be one of :ref:`these constants`. + + :type: int + + .. note:: + + This convenient attribute combines the values of triggered and positive attributes. + + .. method:: reset() + + Reset sensor internal state, effect depends on the type of sensor and settings. + + The sensor is put in its initial state as if it was just activated. + +.. class:: SCA_IController(SCA_ILogicBrick) + + Base class for all controller logic bricks. + + .. attribute:: state + + The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active. + + :type: int bitmask + + .. attribute:: sensors + + A list of sensors linked to this controller. + + :type: sequence supporting index/string lookups and iteration. + + .. note:: + + The sensors are not necessarily owned by the same object. + + .. note:: + + When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. + + .. attribute:: actuators + + A list of actuators linked to this controller. + + :type: sequence supporting index/string lookups and iteration. + + .. note:: + + The sensors are not necessarily owned by the same object. + + .. note:: + + When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. + + .. attribute:: useHighPriority + + When set the controller executes always before all other controllers that dont have this set. + + :type: boolen + + .. note:: + + Order of execution between high priority controllers is not guaranteed. + +.. class:: SCA_IActuator(SCA_ILogicBrick) + + Base class for all actuator logic bricks. + +.. class:: BL_ActionActuator(SCA_IActuator) + + Action Actuators apply an action to an actor. + + .. attribute:: action + + The name of the action to set as the current action. + + :type: string + + .. attribute:: channelNames + + A list of channel names that may be used with :data:`setChannel` and :data:`getChannel`. + + :type: list of strings + + .. attribute:: frameStart + + Specifies the starting frame of the animation. + + :type: float + + .. attribute:: frameEnd + + Specifies the ending frame of the animation. + + :type: float + + .. attribute:: blendIn + + Specifies the number of frames of animation to generate when making transitions between actions. + + :type: float + + .. attribute:: priority + + Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. + + :type: integer + + .. attribute:: frame + + Sets the current frame for the animation. + + :type: float + + .. attribute:: propName + + Sets the property to be used in FromProp playback mode. + + :type: string + + .. attribute:: blendTime + + Sets the internal frame timer. This property must be in the range from 0.0 to blendIn. + + :type: float + + .. attribute:: mode + + The operation mode of the actuator. Can be one of :ref:`these constants`. + + :type: integer + + .. attribute:: useContinue + + The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame. + + :type: boolean + + .. attribute:: framePropName + + The name of the property that is set to the current frame number. + + :type: string + + .. method:: setChannel(channel, matrix) + + Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported. + + :arg channel: A string specifying the name of the bone channel, error raised if not in :data:`channelNames`. + :type channel: string + :arg matrix: A 4x4 matrix specifying the overriding transformation as an offset from the bone's rest position. + :arg matrix: list [[float]] + + .. note:: + + These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation. + + .. method:: getChannel(channel) + + :arg channel: A string specifying the name of the bone channel. error raised if not in :data:`channelNames`. + :type channel: string + :return: (loc, size, quat) + :rtype: tuple + +.. class:: BL_Shader(PyObjectPlus) + + BL_Shader GLSL shaders. + + TODO - Description + + .. method:: setUniformfv(name, fList) + + Set a uniform with a list of float values + + :arg name: the uniform name + :type name: string + :arg fList: a list (2, 3 or 4 elements) of float values + :type fList: list[float] + + .. method:: delSource() + + Clear the shader. Use this method before the source is changed with :data:`setSource`. + + .. method:: getFragmentProg() + + Returns the fragment program. + + :return: The fragment program. + :rtype: string + + .. method:: getVertexProg() + + Get the vertex program. + + :return: The vertex program. + :rtype: string + + .. method:: isValid() + + Check if the shader is valid. + + :return: True if the shader is valid + :rtype: boolean + + .. method:: setAttrib(enum) + + Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.) + + :arg enum: attribute location value + :type enum: integer + + .. method:: setNumberOfPasses( max_pass ) + + Set the maximum number of passes. Not used a.t.m. + + :arg max_pass: the maximum number of passes + :type max_pass: integer + + .. method:: setSampler(name, index) + + Set uniform texture sample index. + + :arg name: Uniform name + :type name: string + :arg index: Texture sample index. + :type index: integer + + .. method:: setSource(vertexProgram, fragmentProgram) + + Set the vertex and fragment programs + + :arg vertexProgram: Vertex program + :type vertexProgram: string + :arg fragmentProgram: Fragment program + :type fragmentProgram: string + + .. method:: setUniform1f(name, fx) + + Set a uniform with 1 float value. + + :arg name: the uniform name + :type name: string + :arg fx: Uniform value + :type fx: float + + .. method:: setUniform1i(name, ix) + + Set a uniform with an integer value. + + :arg name: the uniform name + :type name: string + :arg ix: the uniform value + :type ix: integer + + .. method:: setUniform2f(name, fx, fy) + + Set a uniform with 2 float values + + :arg name: the uniform name + :type name: string + :arg fx: first float value + :type fx: float + + :arg fy: second float value + :type fy: float + + .. method:: setUniform2i(name, ix, iy) + + Set a uniform with 2 integer values + + :arg name: the uniform name + :type name: string + :arg ix: first integer value + :type ix: integer + :arg iy: second integer value + :type iy: integer + + .. method:: setUniform3f(name, fx, fy, fz) + + Set a uniform with 3 float values. + + :arg name: the uniform name + :type name: string + :arg fx: first float value + :type fx: float + :arg fy: second float value + :type fy: float + :arg fz: third float value + :type fz: float + + .. method:: setUniform3i(name, ix, iy, iz) + + Set a uniform with 3 integer values + + :arg name: the uniform name + :type name: string + :arg ix: first integer value + :type ix: integer + :arg iy: second integer value + :type iy: integer + :arg iz: third integer value + :type iz: integer + + .. method:: setUniform4f(name, fx, fy, fz, fw) + + Set a uniform with 4 float values. + + :arg name: the uniform name + :type name: string + :arg fx: first float value + :type fx: float + :arg fy: second float value + :type fy: float + :arg fz: third float value + :type fz: float + :arg fw: fourth float value + :type fw: float + + .. method:: setUniform4i(name, ix, iy, iz, iw) + + Set a uniform with 4 integer values + + :arg name: the uniform name + :type name: string + :arg ix: first integer value + :type ix: integer + :arg iy: second integer value + :type iy: integer + :arg iz: third integer value + :type iz: integer + :arg iw: fourth integer value + :type iw: integer + + .. method:: setUniformDef(name, type) + + Define a new uniform + + :arg name: the uniform name + :type name: string + :arg type: uniform type + :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX + + .. method:: setUniformMatrix3(name, mat, transpose) + + Set a uniform with a 3x3 matrix value + + :arg name: the uniform name + :type name: string + :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]] + :type mat: 3x3 matrix + :arg transpose: set to True to transpose the matrix + :type transpose: boolean + + .. method:: setUniformMatrix4(name, mat, transpose) + + Set a uniform with a 4x4 matrix value + + :arg name: the uniform name + :type name: string + :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]] + :type mat: 4x4 matrix + :arg transpose: set to True to transpose the matrix + :type transpose: boolean + + .. method:: setUniformiv(name, iList) + + Set a uniform with a list of integer values + + :arg name: the uniform name + :type name: string + :arg iList: a list (2, 3 or 4 elements) of integer values + :type iList: list[integer] + + .. method:: validate() + + Validate the shader object. + +.. class:: BL_ShapeActionActuator(SCA_IActuator) + + ShapeAction Actuators apply an shape action to an mesh object. + + .. attribute:: action + + The name of the action to set as the current shape action. + + :type: string + + .. attribute:: frameStart + + Specifies the starting frame of the shape animation. + + :type: float + + .. attribute:: frameEnd + + Specifies the ending frame of the shape animation. + + :type: float + + .. attribute:: blendIn + + Specifies the number of frames of animation to generate when making transitions between actions. + + :type: float + + .. attribute:: priority + + Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. + + :type: integer + + .. attribute:: frame + + Sets the current frame for the animation. + + :type: float + + .. attribute:: propName + + Sets the property to be used in FromProp playback mode. + + :type: string + + .. attribute:: blendTime + + Sets the internal frame timer. This property must be in the range from 0.0 to blendin. + + :type: float + + .. attribute:: mode + + The operation mode of the actuator. Can be one of :ref:`these constants`. + + :type: integer + + .. attribute:: framePropName + + The name of the property that is set to the current frame number. + + :type: string + +.. class:: CListValue(CPropValue) + + This is a list like object used in the game engine internally that behaves similar to a python list in most ways. + + As well as the normal index lookup (``val= clist[i]``), CListValue supports string lookups (``val= scene.objects["Cube"]``) + + Other operations such as ``len(clist)``, ``list(clist)``, ``clist[0:10]`` are also supported. + + .. method:: append(val) + + Add an item to the list (like pythons append) + + .. warning:: + + Appending values to the list can cause crashes when the list is used internally by the game engine. + + .. method:: count(val) + + Count the number of instances of a value in the list. + + :return: number of instances + :rtype: integer + + .. method:: index(val) + + Return the index of a value in the list. + + :return: The index of the value in the list. + :rtype: integer + + .. method:: reverse() + + Reverse the order of the list. + + .. method:: get(key, default=None) + + Return the value matching key, or the default value if its not found. + + :return: The key value or a default. + + .. method:: from_id(id) + + This is a funtion especially for the game engine to return a value with a spesific id. + + Since object names are not always unique, the id of an object can be used to get an object from the CValueList. + + Example: + + .. code-block:: python + + myObID=id(gameObject) + ob= scene.objects.from_id(myObID) + + Where ``myObID`` is an int or long from the id function. + + This has the advantage that you can store the id in places you could not store a gameObject. + + .. warning:: + + The id is derived from a memory location and will be different each time the game engine starts. + +.. class:: KX_BlenderMaterial(PyObjectPlus) + + KX_BlenderMaterial + + .. method:: getShader() + + Returns the material's shader. + + :return: the material's shader + :rtype: :class:`BL_Shader` + + .. method:: setBlending(src, dest) + + Set the pixel color arithmetic functions. + + :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed. + :type src: Value in... + + * GL_ZERO, + * GL_ONE, + * GL_SRC_COLOR, + * GL_ONE_MINUS_SRC_COLOR, + * GL_DST_COLOR, + * GL_ONE_MINUS_DST_COLOR, + * GL_SRC_ALPHA, + * GL_ONE_MINUS_SRC_ALPHA, + * GL_DST_ALPHA, + * GL_ONE_MINUS_DST_ALPHA, + * GL_SRC_ALPHA_SATURATE + + :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed. + :type dest: Value in... + + * GL_ZERO + * GL_ONE + * GL_SRC_COLOR + * GL_ONE_MINUS_SRC_COLOR + * GL_DST_COLOR + * GL_ONE_MINUS_DST_COLOR + * GL_SRC_ALPHA + * GL_ONE_MINUS_SRC_ALPHA + * GL_DST_ALPHA + * GL_ONE_MINUS_DST_ALPHA + * GL_SRC_ALPHA_SATURATE + + .. method:: getMaterialIndex() + + Returns the material's index. + + :return: the material's index + :rtype: integer + +.. class:: KX_CameraActuator(SCA_IActuator) + + Applies changes to a camera. + + .. attribute:: min + + minimum distance to the target object maintained by the actuator. + + :type: float + + .. attribute:: max + + maximum distance to stay from the target object. + + :type: float + + .. attribute:: height + + height to stay above the target object. + + :type: float + + .. attribute:: useXY + + axis this actuator is tracking, True=X, False=Y. + + :type: boolean + + .. attribute:: object + + the object this actuator tracks. + + :type: :class:`KX_GameObject` or None + +.. class:: KX_ConstraintActuator(SCA_IActuator) + + A constraint actuator limits the position, rotation, distance or orientation of an object. + + .. attribute:: damp + + Time constant of the constraint expressed in frame (not use by Force field constraint). + + :type: integer + + .. attribute:: rotDamp + + Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well. + + :type: integer + + .. attribute:: direction + + The reference direction in world coordinate for the orientation constraint. + + :type: 3-tuple of float: (x, y, z) + + .. attribute:: option + + Binary combination of :ref:`these constants ` + + :type: integer + + .. attribute:: time + + activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time. + + :type: integer + + .. attribute:: propName + + the name of the property or material for the ray detection of the distance constraint. + + :type: string + + .. attribute:: min + + The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant. + + :type: float + + .. attribute:: distance + + the target distance of the distance constraint. + + :type: float + + .. attribute:: max + + the upper bound of the constraint. For rotation and orientation constraints, it represents radiant. + + :type: float + + .. attribute:: rayLength + + the length of the ray of the distance constraint. + + :type: float + + .. attribute:: limit + + type of constraint. Use one of the :ref:`these constants ` + + :type: integer. + + +.. class:: KX_ConstraintWrapper(PyObjectPlus) + + KX_ConstraintWrapper + + .. method:: getConstraintId(val) + + Returns the contraint's ID + + :return: the constraint's ID + :rtype: integer + +.. class:: KX_GameActuator(SCA_IActuator) + + The game actuator loads a new .blend file, restarts the current .blend file or quits the game. + + .. attribute:: fileName + + the new .blend file to load. + + :type: string + + .. attribute:: mode + + The mode of this actuator. Can be on of :ref:`these constants ` + + :type: Int + +.. class:: KX_GameObject(SCA_IObject) + + All game objects are derived from this class. + + Properties assigned to game objects are accessible as attributes of this class. + + .. note:: + + Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check. + + .. attribute:: name + + The object's name. (read-only). + + :type: string + + .. attribute:: mass + + The object's mass + + :type: float + + .. note:: + + The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0. + + .. attribute:: linVelocityMin + + Enforces the object keeps moving at a minimum velocity. + + :type: float + + .. note:: + + Applies to dynamic and rigid body objects only. + + .. note:: + + A value of 0.0 disables this option. + + .. note:: + + While objects are stationary the minimum velocity will not be applied. + + .. attribute:: linVelocityMax + + Clamp the maximum linear velocity to prevent objects moving beyond a set speed. + + :type: float + + .. note:: + + Applies to dynamic and rigid body objects only. + + .. note:: + + A value of 0.0 disables this option (rather then setting it stationary). + + .. attribute:: localInertia + + the object's inertia vector in local coordinates. Read only. + + :type: list [ix, iy, iz] + + .. attribute:: parent + + The object's parent object. (read-only). + + :type: :class:`KX_GameObject` or None + + .. attribute:: visible + + visibility flag. + + :type: boolean + + .. note:: + + Game logic will still run for invisible objects. + + .. attribute:: color + + The object color of the object. [r, g, b, a] + + :type: :class:`mathutils.Vector` + + .. attribute:: occlusion + + occlusion capability flag. + + :type: boolean + + .. attribute:: position + + The object's position. [x, y, z] On write: local position, on read: world position + + .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. + + :type: :class:`mathurils.Vector` + + .. attribute:: orientation + + The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation + + .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`. + + :type: :class:`mathutils.Matrix` + + .. attribute:: scaling + + The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling + + .. deprecated:: use :data:`localScale` and :data:`worldScale`. + + :type: :class:`mathutils.Vector` + + .. attribute:: localOrientation + + The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. + + :type: :class:`mathutils.Matrix` + + .. attribute:: worldOrientation + + The object's world orientation. 3x3 Matrix. + + :type: :class:`mathutils.Matrix` + + .. attribute:: localScale + + The object's local scaling factor. [sx, sy, sz] + + :type: :class:`mathutils.Vector` + + .. attribute:: worldScale + + The object's world scaling factor. Read-only. [sx, sy, sz] + + :type: :class:`mathutils.Vector` + + .. attribute:: localPosition + + The object's local position. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: worldPosition + + The object's world position. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: localLinearVelocity + + The object's local linear velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: worldLinearVelocity + + The object's world linear velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: localAngularVelocity + + The object's local angular velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: worldAngularVelocity + + The object's world angular velocity. [x, y, z] + + :type: :class:`mathutils.Vector` + + .. attribute:: timeOffset + + adjust the slowparent delay at runtime. + + :type: float + + .. attribute:: state + + the game object's state bitmask, using the first 30 bits, one bit must always be set. + + :type: int + + .. attribute:: meshes + + a list meshes for this object. + + :type: list of :class:`KX_MeshProxy` + + .. note:: + + Most objects use only 1 mesh. + + .. note:: + + Changes to this list will not update the KX_GameObject. + + .. attribute:: sensors + + a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support. + + :type: list + + .. note:: + + This attribute is experemental and may be removed (but probably wont be). + + .. note:: + + Changes to this list will not update the KX_GameObject. + + .. attribute:: controllers + + a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support. + + :type: list of :class:`SCA_ISensor` + + .. note:: + + This attribute is experemental and may be removed (but probably wont be). + + .. note:: + + Changes to this list will not update the KX_GameObject. + + .. attribute:: actuators + + a list of :class:`SCA_IActuator` with string/index lookups and iterator support. + + :type: list + + .. note:: + + This attribute is experemental and may be removed (but probably wont be). + + .. note:: + + Changes to this list will not update the KX_GameObject. + + .. attribute:: attrDict + + get the objects internal python attribute dictionary for direct (faster) access. + + :type: dict + + .. attribute:: children + + direct children of this object, (read-only). + + :type: :class:`CListValue` of :class:`KX_GameObject`'s + + .. attribute:: childrenRecursive + + all children of this object including childrens children, (read-only). + + :type: :class:`CListValue` of :class:`KX_GameObject`'s + + .. method:: endObject() + + Delete this object, can be used in place of the EndObject Actuator. + + The actual removal of the object from the scene is delayed. + + .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False) + + Replace the mesh of this object with a new mesh. This works the same was as the actuator. + + :arg mesh: mesh to replace or the meshes name. + :type mesh: :class:`MeshProxy` or string + :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument). + :type useDisplayMesh: boolean + :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument). + :type usePhysicsMesh: boolean + + .. method:: setVisible(visible, recursive) + + Sets the game object's visible flag. + + :arg visible: the visible state to set. + :type visible: boolean + :arg recursive: optional argument to set all childrens visibility flag too. + :type recursive: boolean + + .. method:: setOcclusion(occlusion, recursive) + + Sets the game object's occlusion capability. + + :arg occlusion: the state to set the occlusion to. + :type occlusion: boolean + :arg recursive: optional argument to set all childrens occlusion flag too. + :type recursive: boolean + + .. method:: alignAxisToVect(vect, axis=2, factor=1.0) + + Aligns any of the game object's axis along the given vector. + + + :arg vect: a vector to align the axis. + :type vect: 3D vector + :arg axis: The axis you want to align + + * 0: X axis + * 1: Y axis + * 2: Z axis + + :type axis: integer + :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0) + :type factor: float + + .. method:: getAxisVect(vect) + + Returns the axis vector rotates by the objects worldspace orientation. + This is the equivalent of multiplying the vector by the orientation matrix. + + :arg vect: a vector to align the axis. + :type vect: 3D Vector + :return: The vector in relation to the objects rotation. + :rtype: 3d vector. + + .. method:: applyMovement(movement, local=False) + + Sets the game object's movement. + + :arg movement: movement vector. + :type movement: 3D Vector + :arg local: + * False: you get the "global" movement ie: relative to world orientation. + * True: you get the "local" movement ie: relative to object orientation. + :arg local: boolean + + .. method:: applyRotation(rotation, local=False) + + Sets the game object's rotation. + + :arg rotation: rotation vector. + :type rotation: 3D Vector + :arg local: + * False: you get the "global" rotation ie: relative to world orientation. + * True: you get the "local" rotation ie: relative to object orientation. + :arg local: boolean + + .. method:: applyForce(force, local=False) + + Sets the game object's force. + + This requires a dynamic object. + + :arg force: force vector. + :type force: 3D Vector + :arg local: + * False: you get the "global" force ie: relative to world orientation. + * True: you get the "local" force ie: relative to object orientation. + :type local: boolean + + .. method:: applyTorque(torque, local=False) + + Sets the game object's torque. + + This requires a dynamic object. + + :arg torque: torque vector. + :type torque: 3D Vector + :arg local: + * False: you get the "global" torque ie: relative to world orientation. + * True: you get the "local" torque ie: relative to object orientation. + :type local: boolean + + .. method:: getLinearVelocity(local=False) + + Gets the game object's linear velocity. + + This method returns the game object's velocity through it's centre of mass, ie no angular velocity component. + + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + :type local: boolean + :return: the object's linear velocity. + :rtype: list [vx, vy, vz] + + .. method:: setLinearVelocity(velocity, local=False) + + Sets the game object's linear velocity. + + This method sets game object's velocity through it's centre of mass, + ie no angular velocity component. + + This requires a dynamic object. + + :arg velocity: linear velocity vector. + :type velocity: 3D Vector + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + :type local: boolean + + .. method:: getAngularVelocity(local=False) + + Gets the game object's angular velocity. + + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + :type local: boolean + :return: the object's angular velocity. + :rtype: list [vx, vy, vz] + + .. method:: setAngularVelocity(velocity, local=False) + + Sets the game object's angular velocity. + + This requires a dynamic object. + + :arg velocity: angular velocity vector. + :type velocity: boolean + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + + .. method:: getVelocity(point=(0, 0, 0)) + + Gets the game object's velocity at the specified point. + + Gets the game object's velocity at the specified point, including angular + components. + + :arg point: optional point to return the velocity for, in local coordinates. + :type point: 3D Vector + :return: the velocity at the specified point. + :rtype: list [vx, vy, vz] + + .. method:: getReactionForce() + + Gets the game object's reaction force. + + The reaction force is the force applied to this object over the last simulation timestep. + This also includes impulses, eg from collisions. + + :return: the reaction force of this object. + :rtype: list [fx, fy, fz] + + .. note:: + + This is not implimented at the moment. + + .. method:: applyImpulse(point, impulse) + + Applies an impulse to the game object. + + This will apply the specified impulse to the game object at the specified point. + If point != position, applyImpulse will also change the object's angular momentum. + Otherwise, only linear momentum will change. + + :arg point: the point to apply the impulse to (in world coordinates) + :type point: the point to apply the impulse to (in world coordinates) + + .. method:: suspendDynamics() + + Suspends physics for this object. + + .. method:: restoreDynamics() + + Resumes physics for this object. + + .. note:: + + The objects linear velocity will be applied from when the dynamics were suspended. + + .. method:: enableRigidBody() + + Enables rigid body physics for this object. + + Rigid body physics allows the object to roll on collisions. + + .. note:: + + This is not working with bullet physics yet. + + .. method:: disableRigidBody() + + Disables rigid body physics for this object. + + .. note:: + + This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later. + + .. method:: setParent(parent, compound=True, ghost=True) + + Sets this object's parent. + Control the shape status with the optional compound and ghost parameters: + + In that case you can control if it should be ghost or not: + + :arg parent: new parent object. + :type parent: :class:`KX_GameObject` + :arg compound: whether the shape should be added to the parent compound shape. + + * True: the object shape should be added to the parent compound shape. + * False: the object should keep its individual shape. + + :type compound: boolean + :arg ghost: whether the object should be ghost while parented. + + * True: if the object should be made ghost while parented. + * False: if the object should be solid while parented. + + :type ghost: boolean + + .. note:: + + If the object type is sensor, it stays ghost regardless of ghost parameter + + .. method:: removeParent() + + Removes this objects parent. + + .. method:: getPhysicsId() + + Returns the user data object associated with this game object's physics controller. + + .. method:: getPropertyNames() + + Gets a list of all property names. + + :return: All property names for this object. + :rtype: list + + .. method:: getDistanceTo(other) + + :arg other: a point or another :class:`KX_GameObject` to measure the distance to. + :type other: :class:`KX_GameObject` or list [x, y, z] + :return: distance to another object or point. + :rtype: float + + .. method:: getVectTo(other) + + Returns the vector and the distance to another object or point. + The vector is normalized unless the distance is 0, in which a zero length vector is returned. + + :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to. + :type other: :class:`KX_GameObject` or list [x, y, z] + :return: (distance, globalVector(3), localVector(3)) + :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z)) + + .. method:: rayCastTo(other, dist, prop) + + Look towards another point/object and find first object hit within dist that matches prop. + + The ray is always casted from the center of the object, ignoring the object itself. + The ray is casted towards the center of another object or an explicit [x, y, z] point. + Use rayCast() if you need to retrieve the hit point + + :arg other: [x, y, z] or object towards which the ray is casted + :type other: :class:`KX_GameObject` or 3-tuple + :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other + :type dist: float + :arg prop: property name that object must have; can be omitted => detect any object + :type prop: string + :return: the first object hit or None if no object or object does not match prop + :rtype: :class:`KX_GameObject` + + .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly) + + Look from a point/object to another point/object and find first object hit within dist that matches prop. + if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit. + if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element. + if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element. + + .. code-block:: python + + # shoot along the axis gun-gunAim (gunAim should be collision-free) + obj, point, normal = gun.rayCast(gunAim, None, 50) + if obj: + # do something + pass + + The face paremeter determines the orientation of the normal. + + * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside) + * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect) + + The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray. + The prop and xray parameters interact as follow. + + * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray. + * prop off, xray on : idem. + * prop on, xray off: return closest hit if it matches prop, no hit otherwise. + * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray. + + The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray. + If there is no hit or the hit object is not a static mesh, None is returned as 4th element. + + The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects. + + :arg objto: [x, y, z] or object to which the ray is casted + :type objto: :class:`KX_GameObject` or 3-tuple + :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center + :type objfrom: :class:`KX_GameObject` or 3-tuple or None + :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to + :type dist: float + :arg prop: property name that object must have; can be omitted or "" => detect any object + :type prop: string + :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin + :type face: integer + :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object + :type xray: integer + :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit. + + * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit + * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape. + * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping. + + :type poly: integer + :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv). + + * object, hitpoint and hitnormal are None if no hit. + * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None + * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None + + :rtype: + + * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz)) + * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`) + * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v)) + + .. note:: + + The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points. + + .. method:: setCollisionMargin(margin) + + Set the objects collision margin. + + :arg margin: the collision margin distance in blender units. + :type margin: float + + .. note:: + + If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError. + + .. method:: sendMessage(subject, body="", to="") + + Sends a message. + + :arg subject: The subject of the message + :type subject: string + :arg body: The body of the message (optional) + :type body: string + :arg to: The name of the object to send the message to (optional) + :type to: string + + .. method:: reinstancePhysicsMesh(gameObject, meshObject) + + Updates the physics system with the changed mesh. + + If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object. + + :arg gameObject: optional argument, set the physics shape from this gameObjets mesh. + :type gameObject: string, :class:`KX_GameObject` or None + :arg meshObject: optional argument, set the physics shape from this mesh. + :type meshObject: string, :class:`MeshProxy` or None + + :return: True if reinstance succeeded, False if it failed. + :rtype: boolean + + .. note:: + + If this object has instances the other instances will be updated too. + + .. note:: + + The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf). + + .. warning:: + + Only triangle mesh type objects are supported currently (not convex hull) + + .. warning:: + + If the object is a part of a combound object it will fail (parent or child) + + .. warning:: + + Rebuilding the physics mesh can be slow, running many times per second will give a performance hit. + + .. method:: get(key, default=None) + + Return the value matching key, or the default value if its not found. + :return: The key value or a default. + +.. class:: KX_IpoActuator(SCA_IActuator) + + IPO actuator activates an animation. + + .. attribute:: frameStart + + Start frame. + + :type: float + + .. attribute:: frameEnd + + End frame. + + :type: float + + .. attribute:: propName + + Use this property to define the Ipo position. + + :type: string + + .. attribute:: framePropName + + Assign this property this action current frame number. + + :type: string + + .. attribute:: mode + + Play mode for the ipo. Can be on of :ref:`these constants ` + + :type: integer + + .. attribute:: useIpoAsForce + + Apply Ipo as a global or local force depending on the local option (dynamic objects only). + + :type: boolean + + .. attribute:: useIpoAdd + + Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag. + + :type: boolean + + .. attribute:: useIpoLocal + + Let the ipo acts in local coordinates, used in Force and Add mode. + + :type: boolean + + .. attribute:: useChildren + + Update IPO on all children Objects as well. + + :type: boolean + +.. class:: KX_LightObject(KX_GameObject) + + A Light object. + + .. code-block:: python + + # Turn on a red alert light. + import bge + + co = bge.logic.getCurrentController() + light = co.owner + + light.energy = 1.0 + light.colour = [1.0, 0.0, 0.0] + + .. data:: SPOT + + A spot light source. See attribute :data:`type` + + .. data:: SUN + + A point light source with no attenuation. See attribute :data:`type` + + .. data:: NORMAL + + A point light source. See attribute :data:`type` + + .. attribute:: type + + The type of light - must be SPOT, SUN or NORMAL + + .. attribute:: layer + + The layer mask that this light affects object on. + + :type: bitfield + + .. attribute:: energy + + The brightness of this light. + + :type: float + + .. attribute:: distance + + The maximum distance this light can illuminate. (SPOT and NORMAL lights only). + + :type: float + + .. attribute:: colour + + The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]. + + :type: list [r, g, b] + + .. attribute:: color + + Synonym for colour. + + .. attribute:: lin_attenuation + + The linear component of this light's attenuation. (SPOT and NORMAL lights only). + + :type: float + + .. attribute:: quad_attenuation + + The quadratic component of this light's attenuation (SPOT and NORMAL lights only). + + :type: float + + .. attribute:: spotsize + + The cone angle of the spot light, in degrees (SPOT lights only). + + :type: float in [0 - 180]. + + .. attribute:: spotblend + + Specifies the intensity distribution of the spot light (SPOT lights only). + + :type: float in [0 - 1] + + .. note:: + + Higher values result in a more focused light source. + +.. class:: KX_MeshProxy(SCA_IObject) + + A mesh object. + + You can only change the vertex properties of a mesh object, not the mesh topology. + + To use mesh objects effectively, you should know a bit about how the game engine handles them. + + #. Mesh Objects are converted from Blender at scene load. + #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds: + + #. The texture. + #. The Blender material. + #. The Tile properties + #. The face properties - (From the "Texture Face" panel) + #. Transparency & z sorting + #. Light layer + #. Polygon shape (triangle/quad) + #. Game Object + + #. Verticies will be split by face if necessary. Verticies can only be shared between faces if: + + #. They are at the same position + #. UV coordinates are the same + #. Their normals are the same (both polygons are "Set Smooth") + #. They are the same colour, for example: a cube has 24 verticies: 6 faces with 4 verticies per face. + + The correct method of iterating over every :class:`KX_VertexProxy` in a game object + + .. code-block:: python + + import GameLogic + + co = GameLogic.getCurrentController() + obj = co.owner + + m_i = 0 + mesh = obj.getMesh(m_i) # There can be more than one mesh... + while mesh != None: + for mat in range(mesh.getNumMaterials()): + for v_index in range(mesh.getVertexArrayLength(mat)): + vertex = mesh.getVertex(mat, v_index) + # Do something with vertex here... + # ... eg: colour the vertex red. + vertex.colour = [1.0, 0.0, 0.0, 1.0] + m_i += 1 + mesh = obj.getMesh(m_i) + + .. attribute:: materials + + :type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types + + .. attribute:: numPolygons + + :type: integer + + .. attribute:: numMaterials + + :type: integer + + .. method:: getNumMaterials() + + :return: number of materials associated with this object + :rtype: integer + + .. method:: getMaterialName(matid) + + Gets the name of the specified material. + + :arg matid: the specified material. + :type matid: integer + :return: the attached material name. + :rtype: string + + .. method:: getTextureName(matid) + + Gets the name of the specified material's texture. + + :arg matid: the specified material + :type matid: integer + :return: the attached material's texture name. + :rtype: string + + .. method:: getVertexArrayLength(matid) + + Gets the length of the vertex array associated with the specified material. + + There is one vertex array for each material. + + :arg matid: the specified material + :type matid: integer + :return: the number of verticies in the vertex array. + :rtype: integer + + .. method:: getVertex(matid, index) + + Gets the specified vertex from the mesh object. + + :arg matid: the specified material + :type matid: integer + :arg index: the index into the vertex array. + :type index: integer + :return: a vertex object. + :rtype: :class:`KX_VertexProxy` + + .. method:: getNumPolygons() + + :return: The number of polygon in the mesh. + :rtype: integer + + .. method:: getPolygon(index) + + Gets the specified polygon from the mesh. + + :arg index: polygon number + :type index: integer + :return: a polygon object. + :rtype: :class:`PolyProxy` + +.. class:: SCA_MouseSensor(SCA_ISensor) + + Mouse Sensor logic brick. + + .. attribute:: position + + current [x, y] coordinates of the mouse, in frame coordinates (pixels). + + :type: [integer, interger] + + .. attribute:: mode + + sensor mode. + + :type: integer + + * KX_MOUSESENSORMODE_LEFTBUTTON(1) + * KX_MOUSESENSORMODE_MIDDLEBUTTON(2) + * KX_MOUSESENSORMODE_RIGHTBUTTON(3) + * KX_MOUSESENSORMODE_WHEELUP(4) + * KX_MOUSESENSORMODE_WHEELDOWN(5) + * KX_MOUSESENSORMODE_MOVEMENT(6) + + .. method:: getButtonStatus(button) + + Get the mouse button status. + + :arg button: The code that represents the key you want to get the state of, use one of :ref:`these constants` + :type button: int + :return: The state of the given key, can be one of :ref:`these constants` + :rtype: int + +.. class:: KX_MouseFocusSensor(SCA_MouseSensor) + + The mouse focus sensor detects when the mouse is over the current game object. + + The mouse focus sensor works by transforming the mouse coordinates from 2d device + space to 3d space then raycasting away from the camera. + + .. attribute:: raySource + + The worldspace source of the ray (the view position). + + :type: list (vector of 3 floats) + + .. attribute:: rayTarget + + The worldspace target of the ray. + + :type: list (vector of 3 floats) + + .. attribute:: rayDirection + + The :data:`rayTarget` - :class:`raySource` normalized. + + :type: list (normalized vector of 3 floats) + + .. attribute:: hitObject + + the last object the mouse was over. + + :type: :class:`KX_GameObject` or None + + .. attribute:: hitPosition + + The worldspace position of the ray intersecton. + + :type: list (vector of 3 floats) + + .. attribute:: hitNormal + + the worldspace normal from the face at point of intersection. + + :type: list (normalized vector of 3 floats) + + .. attribute:: hitUV + + the UV coordinates at the point of intersection. + + :type: list (vector of 2 floats) + + If the object has no UV mapping, it returns [0, 0]. + + The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping. + + .. attribute:: usePulseFocus + + When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set). + + :type: boolean + +.. class:: KX_TouchSensor(SCA_ISensor) + + Touch sensor detects collisions between objects. + + .. attribute:: propName + + The property or material to collide with. + + :type: string + + .. attribute:: useMaterial + + Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property. + + :type: boolean + + .. attribute:: usePulseCollision + + When enabled, changes to the set of colliding objects generate a pulse. + + :type: boolean + + .. attribute:: hitObject + + The last collided object. (read-only). + + :type: :class:`KX_GameObject` or None + + .. attribute:: hitObjectList + + A list of colliding objects. (read-only). + + :type: :class:`CListValue` of :class:`KX_GameObject` + +.. class:: KX_NearSensor(KX_TouchSensor) + + A near sensor is a specialised form of touch sensor. + + .. attribute:: distance + + The near sensor activates when an object is within this distance. + + :type: float + + .. attribute:: resetDistance + + The near sensor deactivates when the object exceeds this distance. + + :type: float + +.. class:: KX_NetworkMessageActuator(SCA_IActuator) + + Message Actuator + + .. attribute:: propName + + Messages will only be sent to objects with the given property name. + + :type: string + + .. attribute:: subject + + The subject field of the message. + + :type: string + + .. attribute:: body + + The body of the message. + + :type: string + + .. attribute:: usePropBody + + Send a property instead of a regular body message. + + :type: boolean + +.. class:: KX_NetworkMessageSensor(SCA_ISensor) + + The Message Sensor logic brick. + + Currently only loopback (local) networks are supported. + + .. attribute:: subject + + The subject the sensor is looking for. + + :type: string + + .. attribute:: frameMessageCount + + The number of messages received since the last frame. (read-only). + + :type: integer + + .. attribute:: subjects + + The list of message subjects received. (read-only). + + :type: list of strings + + .. attribute:: bodies + + The list of message bodies received. (read-only). + + :type: list of strings + +.. class:: KX_ObjectActuator(SCA_IActuator) + + The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, + velocity, or angular velocity to an object. + Servo control allows to regulate force to achieve a certain speed target. + + .. attribute:: force + + The force applied by the actuator. + + :type: list [x, y, z] + + .. attribute:: useLocalForce + + A flag specifying if the force is local. + + :type: boolean + + .. attribute:: torque + + The torque applied by the actuator. + + :type: list [x, y, z] + + .. attribute:: useLocalTorque + + A flag specifying if the torque is local. + + :type: boolean + + .. attribute:: dLoc + + The displacement vector applied by the actuator. + + :type: list [x, y, z] + + .. attribute:: useLocalDLoc + + A flag specifying if the dLoc is local. + + :type: boolean + + .. attribute:: dRot + + The angular displacement vector applied by the actuator + + :type: list [x, y, z] + + .. note:: + + Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed. + + .. attribute:: useLocalDRot + + A flag specifying if the dRot is local. + + :type: boolean + + .. attribute:: linV + + The linear velocity applied by the actuator. + + :type: list [x, y, z] + + .. attribute:: useLocalLinV + + A flag specifying if the linear velocity is local. + + :type: boolean + + .. note:: + + This is the target speed for servo controllers. + + .. attribute:: angV + + The angular velocity applied by the actuator. + + :type: list [x, y, z] + + .. attribute:: useLocalAngV + + A flag specifying if the angular velocity is local. + + :type: boolean + + .. attribute:: damping + + The damping parameter of the servo controller. + + :type: short + + .. attribute:: forceLimitX + + The min/max force limit along the X axis and activates or deactivates the limits in the servo controller. + + :type: list [min(float), max(float), bool] + + .. attribute:: forceLimitY + + The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller. + + :type: list [min(float), max(float), bool] + + .. attribute:: forceLimitZ + + The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller. + + :type: list [min(float), max(float), bool] + + .. attribute:: pid + + The PID coefficients of the servo controller. + + :type: list of floats [proportional, integral, derivate] + + .. attribute:: reference + + The object that is used as reference to compute the velocity for the servo controller. + + :type: :class:`KX_GameObject` or None + +.. class:: KX_ParentActuator(SCA_IActuator) + + The parent actuator can set or remove an objects parent object. + + .. attribute:: object + + the object this actuator sets the parent too. + + :type: :class:`KX_GameObject` or None + + .. attribute:: mode + + The mode of this actuator. + + :type: integer from 0 to 1. + + .. attribute:: compound + + Whether the object shape should be added to the parent compound shape when parenting. + + Effective only if the parent is already a compound shape. + + :type: boolean + + .. attribute:: ghost + + Whether the object should be made ghost when parenting + Effective only if the shape is not added to the parent compound shape. + + :type: boolean + +.. class:: KX_PhysicsObjectWrapper(PyObjectPlus) + + KX_PhysicsObjectWrapper + + .. method:: setActive(active) + + Set the object to be active. + + :arg active: set to True to be active + :type active: boolean + + .. method:: setAngularVelocity(x, y, z, local) + + Set the angular velocity of the object. + + :arg x: angular velocity for the x-axis + :type x: float + + :arg y: angular velocity for the y-axis + :type y: float + + :arg z: angular velocity for the z-axis + :type z: float + + :arg local: set to True for local axis + :type local: boolean + + .. method:: setLinearVelocity(x, y, z, local) + + Set the linear velocity of the object. + + :arg x: linear velocity for the x-axis + :type x: float + + :arg y: linear velocity for the y-axis + :type y: float + + :arg z: linear velocity for the z-axis + :type z: float + + :arg local: set to True for local axis + :type local: boolean + +.. class:: KX_PolyProxy(SCA_IObject) + + A polygon holds the index of the vertex forming the poylgon. + + Note: + The polygon attributes are read-only, you need to retrieve the vertex proxy if you want + to change the vertex settings. + + .. attribute:: matname + + The name of polygon material, empty if no material. + + :type: string + + .. attribute:: material + + The material of the polygon. + + :type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` + + .. attribute:: texture + + The texture name of the polygon. + + :type: string + + .. attribute:: matid + + The material index of the polygon, use this to retrieve vertex proxy from mesh proxy. + + :type: integer + + .. attribute:: v1 + + vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy. + + :type: integer + + .. attribute:: v2 + + vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy. + + :type: integer + + .. attribute:: v3 + + vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy. + + :type: integer + + .. attribute:: v4 + + Vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex + Use this to retrieve vertex proxy from mesh proxy. + + :type: integer + + .. attribute:: visible + + visible state of the polygon: 1=visible, 0=invisible. + + :type: integer + + .. attribute:: collide + + collide state of the polygon: 1=receives collision, 0=collision free. + + :type: integer + + .. method:: getMaterialName() + + Returns the polygon material name with MA prefix + + :return: material name + :rtype: string + + .. method:: getMaterial() + + :return: The polygon material + :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` + + .. method:: getTextureName() + + :return: The texture name + :rtype: string + + .. method:: getMaterialIndex() + + Returns the material bucket index of the polygon. + This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. + + :return: the material index in the mesh + :rtype: integer + + .. method:: getNumVertex() + + Returns the number of vertex of the polygon. + + :return: number of vertex, 3 or 4. + :rtype: integer + + .. method:: isVisible() + + Returns whether the polygon is visible or not + + :return: 0=invisible, 1=visible + :rtype: boolean + + .. method:: isCollider() + + Returns whether the polygon is receives collision or not + + :return: 0=collision free, 1=receives collision + :rtype: integer + + .. method:: getVertexIndex(vertex) + + Returns the mesh vertex index of a polygon vertex + This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. + + :arg vertex: index of the vertex in the polygon: 0->3 + :arg vertex: integer + :return: mesh vertex index + :rtype: integer + + .. method:: getMesh() + + Returns a mesh proxy + + :return: mesh proxy + :rtype: :class:`MeshProxy` + +.. class:: KX_PolygonMaterial(PyObjectPlus) + + This is the interface to materials in the game engine. + + Materials define the render state to be applied to mesh objects. + + .. warning:: + + Some of the methods/variables are CObjects. If you mix these up, you will crash blender. + + This example requires `PyOpenGL `_ and `GLEWPy `_ + + .. code-block:: python + + import GameLogic + import OpenGL + from OpenGL.GL import * + from OpenGL.GLU import * + import glew + from glew import * + + glewInit() + + vertex_shader = """ + + void main(void) + { + gl_Position = ftransform(); + } + """ + + fragment_shader =""" + + void main(void) + { + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } + """ + + class MyMaterial: + def __init__(self): + self.pass_no = 0 + # Create a shader + self.m_program = glCreateProgramObjectARB() + # Compile the vertex shader + self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader)) + # Compile the fragment shader + self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader)) + # Link the shaders together + self.link() + + def PrintInfoLog(self, tag, object): + """ + PrintInfoLog prints the GLSL compiler log + """ + print "Tag: def PrintGLError(self, tag = ""): + + def PrintGLError(self, tag = ""): + """ + Prints the current GL error status + """ + if len(tag): + print tag + err = glGetError() + if err != GL_NO_ERROR: + print "GL Error: %s\\n"%(gluErrorString(err)) + + def shader(self, type, shaders): + """ + shader compiles a GLSL shader and attaches it to the current + program. + + type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB + shaders should be a sequence of shader source to compile. + """ + # Create a shader object + shader_object = glCreateShaderObjectARB(type) + + # Add the source code + glShaderSourceARB(shader_object, len(shaders), shaders) + + # Compile the shader + glCompileShaderARB(shader_object) + + # Print the compiler log + self.PrintInfoLog("vertex shader", shader_object) + + # Check if compiled, and attach if it did + compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB) + if compiled: + glAttachObjectARB(self.m_program, shader_object) + + # Delete the object (glAttachObjectARB makes a copy) + glDeleteObjectARB(shader_object) + + # print the gl error log + self.PrintGLError() + + def link(self): + """ + Links the shaders together. + """ + # clear error indicator + glGetError() + + glLinkProgramARB(self.m_program) + + self.PrintInfoLog("link", self.m_program) + + linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB) + if not linked: + print "Shader failed to link" + return + + glValidateProgramARB(self.m_program) + valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB) + if not valid: + print "Shader failed to validate" + return + + def activate(self, rasty, cachingInfo, mat): + self.pass_no+=1 + if (self.pass_no == 1): + glDisable(GL_COLOR_MATERIAL) + glUseProgramObjectARB(self.m_program) + return True + + glEnable(GL_COLOR_MATERIAL) + glUseProgramObjectARB(0) + self.pass_no = 0 + return False + + obj = GameLogic.getCurrentController().owner + + mesh = obj.meshes[0] + + for mat in mesh.materials: + mat.setCustomMaterial(MyMaterial()) + print mat.texture + + .. attribute:: texture + + Texture name. + + :type: string (read-only) + + .. attribute:: gl_texture + + OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture). + + :type: integer (read-only) + + .. attribute:: material + + Material name. + + :type: string (read-only) + + .. attribute:: tface + + Texture face properties. + + :type: CObject (read-only) + + .. attribute:: tile + + Texture is tiling. + + :type: boolean + + .. attribute:: tilexrep + + Number of tile repetitions in x direction. + + :type: integer + + .. attribute:: tileyrep + + Number of tile repetitions in y direction. + + :type: integer + + .. attribute:: drawingmode + + Drawing mode for the material. + - 2 (drawingmode & 4) Textured + - 4 (drawingmode & 16) Light + - 14 (drawingmode & 16384) 3d Polygon Text. + + :type: bitfield + + .. attribute:: transparent + + This material is transparent. All meshes with this + material will be rendered after non transparent meshes from back + to front. + + :type: boolean + + .. attribute:: zsort + + Transparent polygons in meshes with this material will be sorted back to + front before rendering. + Non-Transparent polygons will be sorted front to back before rendering. + + :type: boolean + + .. attribute:: lightlayer + + Light layers this material affects. + + :type: bitfield. + + .. attribute:: triangle + + Mesh data with this material is triangles. It's probably not safe to change this. + + :type: boolean + + .. attribute:: diffuse + + The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0]. + + :type: list [r, g, b] + + .. attribute:: specular + + The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0]. + + :type: list [r, g, b] + + .. attribute:: shininess + + The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0. + + :type: float + + .. attribute:: specularity + + The amount of specular of the material. 0.0 <= specularity <= 1.0. + + :type: float + + .. method:: updateTexture(tface, rasty) + + Updates a realtime animation. + + :arg tface: Texture face (eg mat.tface) + :type tface: CObject + :arg rasty: Rasterizer + :type rasty: CObject + + .. method:: setTexture(tface) + + Sets texture render state. + + :arg tface: Texture face + :type tface: CObject + + .. code-block:: python + + mat.setTexture(mat.tface) + + .. method:: activate(rasty, cachingInfo) + + Sets material parameters for this object for rendering. + + Material Parameters set: + + #. Texture + #. Backface culling + #. Line drawing + #. Specular Colour + #. Shininess + #. Diffuse Colour + #. Polygon Offset. + + :arg rasty: Rasterizer instance. + :type rasty: CObject + :arg cachingInfo: Material cache instance. + :type cachingInfo: CObject + + .. method:: setCustomMaterial(material) + + Sets the material state setup object. + + Using this method, you can extend or completely replace the gameengine material + to do your own advanced multipass effects. + + Use this method to register your material class. Instead of the normal material, + your class's activate method will be called just before rendering the mesh. + This should setup the texture, material, and any other state you would like. + It should return True to render the mesh, or False if you are finished. You should + clean up any state Blender does not set before returning False. + + Activate Method Definition: + + .. code-block:: python + + def activate(self, rasty, cachingInfo, material): + + :arg material: The material object. + :type material: instance + + .. code-block:: python + + class PyMaterial: + def __init__(self): + self.pass_no = -1 + + def activate(self, rasty, cachingInfo, material): + # Activate the material here. + # + # The activate method will be called until it returns False. + # Every time the activate method returns True the mesh will + # be rendered. + # + # rasty is a CObject for passing to material.updateTexture() + # and material.activate() + # cachingInfo is a CObject for passing to material.activate() + # material is the KX_PolygonMaterial instance this material + # was added to + + # default material properties: + self.pass_no += 1 + if self.pass_no == 0: + material.activate(rasty, cachingInfo) + # Return True to do this pass + return True + + # clean up and return False to finish. + self.pass_no = -1 + return False + + # Create a new Python Material and pass it to the renderer. + mat.setCustomMaterial(PyMaterial()) + +.. class:: KX_RadarSensor(KX_NearSensor) + + Radar sensor is a near sensor with a conical sensor object. + + .. attribute:: coneOrigin + + The origin of the cone with which to test. The origin is in the middle of the cone. (read-only). + + :type: list of floats [x, y, z] + + .. attribute:: coneTarget + + The center of the bottom face of the cone with which to test. (read-only). + + :type: list of floats [x, y, z] + + .. attribute:: distance + + The height of the cone with which to test. + + :type: float + + .. attribute:: angle + + The angle of the cone (in degrees) with which to test. + + :type: float from 0 to 360 + + .. attribute:: axis + + The axis on which the radar cone is cast. + + :type: integer from 0 to 5 + + KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z, + KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z + + .. method:: getConeHeight() + + :return: The height of the cone with which to test. + :rtype: float + +.. class:: KX_RaySensor(SCA_ISensor) + + A ray sensor detects the first object in a given direction. + + .. attribute:: propName + + The property the ray is looking for. + + :type: string + + .. attribute:: range + + The distance of the ray. + + :type: float + + .. attribute:: useMaterial + + Whether or not to look for a material (false = property). + + :type: boolean + + .. attribute:: useXRay + + Whether or not to use XRay. + + :type: boolean + + .. attribute:: hitObject + + The game object that was hit by the ray. (read-only). + + :type: :class:`KX_GameObject` + + .. attribute:: hitPosition + + The position (in worldcoordinates) where the object was hit by the ray. (read-only). + + :type: list [x, y, z] + + .. attribute:: hitNormal + + The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only). + + :type: list [x, y, z] + + .. attribute:: rayDirection + + The direction from the ray (in worldcoordinates). (read-only). + + :type: list [x, y, z] + + .. attribute:: axis + + The axis the ray is pointing on. + + :type: integer from 0 to 5 + + * KX_RAY_AXIS_POS_X + * KX_RAY_AXIS_POS_Y + * KX_RAY_AXIS_POS_Z + * KX_RAY_AXIS_NEG_X + * KX_RAY_AXIS_NEG_Y + * KX_RAY_AXIS_NEG_Z + +.. class:: KX_SCA_AddObjectActuator(SCA_IActuator) + + Edit Object Actuator (in Add Object Mode) + + .. warning:: + + An Add Object actuator will be ignored if at game start, the linked object doesn't exist (or is empty) or the linked object is in an active layer. + + .. code-block:: none + + Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer) + + .. attribute:: object + + the object this actuator adds. + + :type: :class:`KX_GameObject` or None + + .. attribute:: objectLastCreated + + the last added object from this actuator (read-only). + + :type: :class:`KX_GameObject` or None + + .. attribute:: time + + the lifetime of added objects, in frames. Set to 0 to disable automatic deletion. + + :type: integer + + .. attribute:: linearVelocity + + the initial linear velocity of added objects. + + :type: list [vx, vy, vz] + + .. attribute:: angularVelocity + + the initial angular velocity of added objects. + + :type: list [vx, vy, vz] + + .. method:: instantAddObject() + + adds the object without needing to calling SCA_PythonController.activate() + + .. note:: Use objectLastCreated to get the newly created object. + +.. class:: KX_SCA_DynamicActuator(SCA_IActuator) + + Dynamic Actuator. + + .. attribute:: mode + + :type: integer + + the type of operation of the actuator, 0-4 + + * KX_DYN_RESTORE_DYNAMICS(0) + * KX_DYN_DISABLE_DYNAMICS(1) + * KX_DYN_ENABLE_RIGID_BODY(2) + * KX_DYN_DISABLE_RIGID_BODY(3) + * KX_DYN_SET_MASS(4) + + .. attribute:: mass + + the mass value for the KX_DYN_SET_MASS operation. + + :type: float + +.. class:: KX_SCA_EndObjectActuator(SCA_IActuator) + + Edit Object Actuator (in End Object mode) + + This actuator has no python methods. + +.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator) + + Edit Object actuator, in Replace Mesh mode. + + .. warning:: + + Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist. + + This will generate a warning in the console + + .. code-block:: none + + Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object + + .. code-block:: python + + # Level-of-detail + # Switch a game object's mesh based on its depth in the camera view. + # +----------+ +-----------+ +-------------------------------------+ + # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh | + # +----------+ +-----------+ +-------------------------------------+ + import GameLogic + + # List detail meshes here + # Mesh (name, near, far) + # Meshes overlap so that they don't 'pop' when on the edge of the distance. + meshes = ((".Hi", 0.0, -20.0), + (".Med", -15.0, -50.0), + (".Lo", -40.0, -100.0) + ) + + co = GameLogic.getCurrentController() + obj = co.owner + act = co.actuators["LOD." + obj.name] + cam = GameLogic.getCurrentScene().active_camera + + def Depth(pos, plane): + return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3] + + # Depth is negative and decreasing further from the camera + depth = Depth(obj.position, cam.world_to_camera[2]) + + newmesh = None + curmesh = None + # Find the lowest detail mesh for depth + for mesh in meshes: + if depth < mesh[1] and depth > mesh[2]: + newmesh = mesh + if "ME" + obj.name + mesh[0] == act.getMesh(): + curmesh = mesh + + if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh(): + # The mesh is a different mesh - switch it. + # Check the current mesh is not a better fit. + if curmesh == None or curmesh[1] < depth or curmesh[2] > depth: + act.mesh = obj.getName() + newmesh[0] + GameLogic.addActiveActuator(act, True) + + .. attribute:: mesh + + :class:`MeshProxy` or the name of the mesh that will replace the current one. + + Set to None to disable actuator. + + :type: :class:`MeshProxy` or None if no mesh is set + + .. attribute:: useDisplayMesh + + when true the displayed mesh is replaced. + + :type: boolean + + .. attribute:: usePhysicsMesh + + when true the physics mesh is replaced. + + :type: boolean + + .. method:: instantReplaceMesh() + + Immediately replace mesh without delay. + +.. class:: KX_Scene(PyObjectPlus) + + An active scene that gives access to objects, cameras, lights and scene attributes. + + The activity culling stuff is supposed to disable logic bricks when their owner gets too far + from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows + what it does! + + .. code-block:: python + + import GameLogic + + # get the scene + scene = GameLogic.getCurrentScene() + + # print all the objects in the scene + for obj in scene.objects: + print obj.name + + # get an object named 'Cube' + obj = scene.objects["Cube"] + + # get the first object in the scene. + obj = scene.objects[0] + + .. code-block:: python + + # Get the depth of an object in the camera view. + import GameLogic + + obj = GameLogic.getCurrentController().owner + cam = GameLogic.getCurrentScene().active_camera + + # Depth is negative and decreasing further from the camera + depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3] + + @bug: All attributes are read only at the moment. + + .. attribute:: name + + The scene's name, (read-only). + + :type: string + + .. attribute:: objects + + A list of objects in the scene, (read-only). + + :type: :class:`CListValue` of :class:`KX_GameObject` + + .. attribute:: objectsInactive + + A list of objects on background layers (used for the addObject actuator), (read-only). + + :type: :class:`CListValue` of :class:`KX_GameObject` + + .. attribute:: lights + + A list of lights in the scene, (read-only). + + :type: :class:`CListValue` of :class:`KX_LightObject` + + .. attribute:: cameras + + A list of cameras in the scene, (read-only). + + :type: :class:`CListValue` of :class:`KX_Camera` + + .. attribute:: active_camera + + The current active camera. + + :type: :class:`KX_Camera` + + .. note:: + + This can be set directly from python to avoid using the :class:`KX_SceneActuator`. + + .. attribute:: suspended + + True if the scene is suspended, (read-only). + + :type: boolean + + .. attribute:: activity_culling + + True if the scene is activity culling. + + :type: boolean + + .. attribute:: activity_culling_radius + + The distance outside which to do activity culling. Measured in manhattan distance. + + :type: float + + .. attribute:: dbvt_culling + + True when Dynamic Bounding box Volume Tree is set (read-only). + + :type: boolean + + .. attribute:: pre_draw + + A list of callables to be run before the render step. + + :type: list + + .. attribute:: post_draw + + A list of callables to be run after the render step. + + :type: list + + .. method:: addObject(object, other, time=0) + + Adds an object to the scene like the Add Object Actuator would. + + :arg object: The object to add + :type object: :class:`KX_GameObject` or string + :arg other: The object's center to use when adding the object + :type other: :class:`KX_GameObject` or string + :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever. + :type time: integer + :return: The newly added object. + :rtype: :class:`KX_GameObject` + + .. method:: end() + + Removes the scene from the game. + + .. method:: restart() + + Restarts the scene. + + .. method:: replace(scene) + + Replaces this scene with another one. + + :arg scene: The name of the scene to replace this scene with. + :type scene: string + + .. method:: suspend() + + Suspends this scene. + + .. method:: resume() + + Resume this scene. + + .. method:: get(key, default=None) + + Return the value matching key, or the default value if its not found. + :return: The key value or a default. + +.. class:: KX_SceneActuator(SCA_IActuator) + + Scene Actuator logic brick. + + .. warning:: + + Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty + + This will generate a warning in the console: + + .. code-block:: none + + Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene + + .. attribute:: scene + + the name of the scene to change to/overlay/underlay/remove/suspend/resume. + + :type: string + + .. attribute:: camera + + the camera to change to. + + :type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write + + .. note:: + + When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera. + + .. attribute:: useRestart + + Set flag to True to restart the sene. + + :type: boolean + + .. attribute:: mode + + The mode of the actuator. + + :type: integer from 0 to 5. + +.. class:: KX_SoundActuator(SCA_IActuator) + + Sound Actuator. + + The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least. + + .. attribute:: fileName + + The filename of the sound this actuator plays. + + :type: string + + .. attribute:: volume + + The volume (gain) of the sound. + + :type: float + + .. attribute:: pitch + + The pitch of the sound. + + :type: float + + .. attribute:: rollOffFactor + + The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away. + + :type: float + + .. attribute:: looping + + The loop mode of the actuator. + + :type: integer + + .. attribute:: position + + The position of the sound as a list: [x, y, z]. + + :type: float array + + .. attribute:: velocity + + The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z]. + + :type: float array + + .. attribute:: orientation + + The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float]. + + :type: 3x3 matrix [[float]] + + .. attribute:: mode + + The operation mode of the actuator. Can be one of :ref:`these constants` + + :type: integer + +.. class:: KX_StateActuator(SCA_IActuator) + + State actuator changes the state mask of parent object. + + .. attribute:: operation + + Type of bit operation to be applied on object state mask. + + You can use one of :ref:`these constants ` + + :type: integer + + .. attribute:: mask + + Value that defines the bits that will be modified by the operation. + + The bits that are 1 in the mask will be updated in the object state. + + The bits that are 0 are will be left unmodified expect for the Copy operation which copies the mask to the object state. + + :type: integer + +.. class:: KX_TrackToActuator(SCA_IActuator) + + Edit Object actuator in Track To mode. + + .. warning:: + + Track To Actuators will be ignored if at game start, the object to track to is invalid. + + This will generate a warning in the console: + + .. code-block:: none + + GameObject 'Name' no object in EditObjectActuator 'ActuatorName' + + .. attribute:: object + + the object this actuator tracks. + + :type: :class:`KX_GameObject` or None + + .. attribute:: time + + the time in frames with which to delay the tracking motion. + + :type: integer + + .. attribute:: use3D + + the tracking motion to use 3D. + + :type: boolean + +.. class:: KX_VehicleWrapper(PyObjectPlus) + + KX_VehicleWrapper + + TODO - description + + .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering) + + Add a wheel to the vehicle + + :arg wheel: The object to use as a wheel. + :type wheel: :class:`KX_GameObject` or a KX_GameObject name + :arg attachPos: The position that this wheel will attach to. + :type attachPos: vector of 3 floats + :arg attachDir: The direction this wheel points. + :type attachDir: vector of 3 floats + :arg axleDir: The direction of this wheels axle. + :type axleDir: vector of 3 floats + :arg suspensionRestLength: TODO - Description + :type suspensionRestLength: float + :arg wheelRadius: The size of the wheel. + :type wheelRadius: float + + .. method:: applyBraking(force, wheelIndex) + + Apply a braking force to the specified wheel + + :arg force: the brake force + :type force: float + + :arg wheelIndex: index of the wheel where the force needs to be applied + :type wheelIndex: integer + + .. method:: applyEngineForce(force, wheelIndex) + + Apply an engine force to the specified wheel + + :arg force: the engine force + :type force: float + + :arg wheelIndex: index of the wheel where the force needs to be applied + :type wheelIndex: integer + + .. method:: getConstraintId() + + Get the constraint ID + + :return: the constraint id + :rtype: integer + + .. method:: getConstraintType() + + Returns the constraint type. + + :return: constraint type + :rtype: integer + + .. method:: getNumWheels() + + Returns the number of wheels. + + :return: the number of wheels for this vehicle + :rtype: integer + + .. method:: getWheelOrientationQuaternion(wheelIndex) + + Returns the wheel orientation as a quaternion. + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + :return: TODO Description + :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix + + .. method:: getWheelPosition(wheelIndex) + + Returns the position of the specified wheel + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + :return: position vector + :rtype: list[x, y, z] + + .. method:: getWheelRotation(wheelIndex) + + Returns the rotation of the specified wheel + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + :return: the wheel rotation + :rtype: float + + .. method:: setRollInfluence(rollInfluece, wheelIndex) + + Set the specified wheel's roll influence. + The higher the roll influence the more the vehicle will tend to roll over in corners. + + :arg rollInfluece: the wheel roll influence + :type rollInfluece: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSteeringValue(steering, wheelIndex) + + Set the specified wheel's steering + + :arg steering: the wheel steering + :type steering: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSuspensionCompression(compression, wheelIndex) + + Set the specified wheel's compression + + :arg compression: the wheel compression + :type compression: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSuspensionDamping(damping, wheelIndex) + + Set the specified wheel's damping + + :arg damping: the wheel damping + :type damping: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSuspensionStiffness(stiffness, wheelIndex) + + Set the specified wheel's stiffness + + :arg stiffness: the wheel stiffness + :type stiffness: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setTyreFriction(friction, wheelIndex) + + Set the specified wheel's tyre friction + + :arg friction: the tyre friction + :type friction: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + +.. class:: KX_VertexProxy(SCA_IObject) + + A vertex holds position, UV, colour and normal information. + + Note: + The physics simulation is NOT currently updated - physics will not respond + to changes in the vertex position. + + .. attribute:: XYZ + + The position of the vertex. + + :type: list [x, y, z] + + .. attribute:: UV + + The texture coordinates of the vertex. + + :type: list [u, v] + + .. attribute:: normal + + The normal of the vertex. + + :type: list [nx, ny, nz] + + .. attribute:: colour + + The colour of the vertex. + + :type: list [r, g, b, a] + + Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0] + + .. attribute:: color + + Synonym for colour. + + .. attribute:: x + + The x coordinate of the vertex. + + :type: float + + .. attribute:: y + + The y coordinate of the vertex. + + :type: float + + .. attribute:: z + + The z coordinate of the vertex. + + :type: float + + .. attribute:: u + + The u texture coordinate of the vertex. + + :type: float + + .. attribute:: v + + The v texture coordinate of the vertex. + + :type: float + + .. attribute:: u2 + + The second u texture coordinate of the vertex. + + :type: float + + .. attribute:: v2 + + The second v texture coordinate of the vertex. + + :type: float + + .. attribute:: r + + The red component of the vertex colour. 0.0 <= r <= 1.0. + + :type: float + + .. attribute:: g + + The green component of the vertex colour. 0.0 <= g <= 1.0. + + :type: float + + .. attribute:: b + + The blue component of the vertex colour. 0.0 <= b <= 1.0. + + :type: float + + .. attribute:: a + + The alpha component of the vertex colour. 0.0 <= a <= 1.0. + + :type: float + + .. method:: getXYZ() + + Gets the position of this vertex. + + :return: this vertexes position in local coordinates. + :rtype: list [x, y, z] + + .. method:: setXYZ(pos) + + Sets the position of this vertex. + + :type: list [x, y, z] + + :arg pos: the new position for this vertex in local coordinates. + + .. method:: getUV() + + Gets the UV (texture) coordinates of this vertex. + + :return: this vertexes UV (texture) coordinates. + :rtype: list [u, v] + + .. method:: setUV(uv) + + Sets the UV (texture) coordinates of this vertex. + + :type: list [u, v] + + .. method:: getUV2() + + Gets the 2nd UV (texture) coordinates of this vertex. + + :return: this vertexes UV (texture) coordinates. + :rtype: list [u, v] + + .. method:: setUV2(uv, unit) + + Sets the 2nd UV (texture) coordinates of this vertex. + + :type: list [u, v] + + :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV + :arg unit: integer + + .. method:: getRGBA() + + Gets the colour of this vertex. + + The colour is represented as four bytes packed into an integer value. The colour is + packed as RGBA. + + Since Python offers no way to get each byte without shifting, you must use the struct module to + access colour in an machine independent way. + + Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead. + + .. code-block:: python + + import struct; + col = struct.unpack('4B', struct.pack('I', v.getRGBA())) + # col = (r, g, b, a) + # black = ( 0, 0, 0, 255) + # white = (255, 255, 255, 255) + + :return: packed colour. 4 byte integer with one byte per colour channel in RGBA format. + :rtype: integer + + .. method:: setRGBA(col) + + Sets the colour of this vertex. + + See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes + or the colour attribute instead. + + setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a] + with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0] + + .. code-block:: python + + v.setRGBA(0xff0000ff) # Red + v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian + v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red + v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms. + + :arg col: the new colour of this vertex in packed RGBA format. + :type col: integer or list [r, g, b, a] + + .. method:: getNormal() + + Gets the normal vector of this vertex. + + :return: normalised normal vector. + :rtype: list [nx, ny, nz] + + .. method:: setNormal(normal) + + Sets the normal vector of this vertex. + + :type: sequence of floats [r, g, b] + + :arg normal: the new normal of this vertex. + +.. class:: KX_VisibilityActuator(SCA_IActuator) + + Visibility Actuator. + + .. attribute:: visibility + + whether the actuator makes its parent object visible or invisible. + + :type: boolean + + .. attribute:: useOcclusion + + whether the actuator makes its parent object an occluder or not. + + :type: boolean + + .. attribute:: useRecursion + + whether the visibility/occlusion should be propagated to all children of the object. + + :type: boolean + +.. class:: SCA_2DFilterActuator(SCA_IActuator) + + Create, enable and disable 2D filters + + The following properties don't have an immediate effect. + You must active the actuator to get the result. + The actuator is not persistent: it automatically stops itself after setting up the filter + but the filter remains active. To stop a filter you must activate the actuator with 'type' + set to :data:`~bge.logic.RAS_2DFILTER_DISABLED` or :data:`~bge.logic.RAS_2DFILTER_NOFILTER`. + + .. attribute:: shaderText + + shader source code for custom shader. + + :type: string + + .. attribute:: disableMotionBlur + + action on motion blur: 0=enable, 1=disable. + + :type: integer + + .. attribute:: mode + + Type of 2D filter, use one of :ref:`these constants ` + + :type: integer + + .. attribute:: passNumber + + order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb. + + Only be one filter can be defined per passNb. + + :type: integer (0-100) + + .. attribute:: value + + argument for motion blur filter. + + :type: float (0.0-100.0) + +.. class:: SCA_ANDController(SCA_IController) + + An AND controller activates only when all linked sensors are activated. + + There are no special python methods for this controller. + +.. class:: SCA_ActuatorSensor(SCA_ISensor) + + Actuator sensor detect change in actuator state of the parent object. + It generates a positive pulse if the corresponding actuator is activated + and a negative pulse if the actuator is deactivated. + + .. attribute:: actuator + + the name of the actuator that the sensor is monitoring. + + :type: string + +.. class:: SCA_AlwaysSensor(SCA_ISensor) + + This sensor is always activated. + +.. class:: SCA_DelaySensor(SCA_ISensor) + + The Delay sensor generates positive and negative triggers at precise time, + expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period. + + The duration parameter defines the length of the ON period following the OFF period. + There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger. + + The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0). + + Use :class:`SCA_ISensor.reset` at any time to restart sensor. + + .. attribute:: delay + + length of the initial OFF period as number of frame, 0 for immediate trigger. + + :type: integer. + + .. attribute:: duration + + length of the ON period in number of frame after the initial OFF period. + + If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. + + :type: integer + + .. attribute:: repeat + + 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. + + :type: integer + +.. class:: SCA_JoystickSensor(SCA_ISensor) + + This sensor detects player joystick events. + + .. attribute:: axisValues + + The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only). + + :type: list of ints. + + Each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. + The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. + + * left:[-32767, 0, ...] + * right:[32767, 0, ...] + * up:[0, -32767, ...] + * down:[0, 32767, ...] + + .. attribute:: axisSingle + + like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only). + + :type: integer + + .. note:: + + Only use this for "Single Axis" type sensors otherwise it will raise an error. + + .. attribute:: hatValues + + The state of the joysticks hats as a list of values :data:`numHats` long. (read-only). + + :type: list of ints + + Each spesifying the direction of the hat from 1 to 12, 0 when inactive. + + Hat directions are as follows... + + * 0:None + * 1:Up + * 2:Right + * 4:Down + * 8:Left + * 3:Up - Right + * 6:Down - Right + * 12:Down - Left + * 9:Up - Left + + .. attribute:: hatSingle + + Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only). + + :type: integer + + .. attribute:: numAxis + + The number of axes for the joystick at this index. (read-only). + + :type: integer + + .. attribute:: numButtons + + The number of buttons for the joystick at this index. (read-only). + + :type: integer + + .. attribute:: numHats + + The number of hats for the joystick at this index. (read-only). + + :type: integer + + .. attribute:: connected + + True if a joystick is connected at this joysticks index. (read-only). + + :type: boolean + + .. attribute:: index + + The joystick index to use (from 0 to 7). The first joystick is always 0. + + :type: integer + + .. attribute:: threshold + + Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. + + :type: integer + + .. attribute:: button + + The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect. + + :type: integer + + .. attribute:: axis + + The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection] + + * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control. + * axisDirection: 0=right, 1=up, 2=left, 3=down. + + :type: [integer, integer] + + .. attribute:: hat + + The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection] + + * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max). + * hatDirection: 1-12. + + :type: [integer, integer] + + .. method:: getButtonActiveList() + + :return: A list containing the indicies of the currently pressed buttons. + :rtype: list + + .. method:: getButtonStatus(buttonIndex) + + :arg buttonIndex: the button index, 0=first button + :type buttonIndex: integer + :return: The current pressed state of the specified button. + :rtype: boolean + +.. class:: SCA_KeyboardSensor(SCA_ISensor) + + A keyboard sensor detects player key presses. + + See module :mod:`bge.keys` for keycode values. + + .. attribute:: key + + The key code this sensor is looking for. + + :type: keycode from :mod:`bge.keys` module + + .. attribute:: hold1 + + The key code for the first modifier this sensor is looking for. + + :type: keycode from :mod:`bge.keys` module + + .. attribute:: hold2 + + The key code for the second modifier this sensor is looking for. + + :type: keycode from :mod:`bge.keys` module + + .. attribute:: toggleProperty + + The name of the property that indicates whether or not to log keystrokes as a string. + + :type: string + + .. attribute:: targetProperty + + The name of the property that receives keystrokes in case in case a string is logged. + + :type: string + + .. attribute:: useAllKeys + + Flag to determine whether or not to accept all keys. + + :type: boolean + + .. attribute:: events + + a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). + + :type: list [[:ref:`keycode`, :ref:`status`], ...] + + .. method:: getKeyStatus(keycode) + + Get the status of a key. + + :arg keycode: The code that represents the key you want to get the state of, use one of :ref:`these constants` + :type keycode: integer + :return: The state of the given key, can be one of :ref:`these constants` + :rtype: int + +.. class:: SCA_NANDController(SCA_IController) + + An NAND controller activates when all linked sensors are not active. + + There are no special python methods for this controller. + +.. class:: SCA_NORController(SCA_IController) + + An NOR controller activates only when all linked sensors are de-activated. + + There are no special python methods for this controller. + +.. class:: SCA_ORController(SCA_IController) + + An OR controller activates when any connected sensor activates. + + There are no special python methods for this controller. + +.. class:: SCA_PropertyActuator(SCA_IActuator) + + Property Actuator + + .. attribute:: propName + + the property on which to operate. + + :type: string + + .. attribute:: value + + the value with which the actuator operates. + + :type: string + + .. attribute:: mode + + TODO - add constants to game logic dict!. + + :type: integer + +.. class:: SCA_PropertySensor(SCA_ISensor) + + Activates when the game object property matches. + + .. attribute:: mode + + Type of check on the property. Can be one of :ref:`these constants ` + + :type: integer. + + .. attribute:: propName + + the property the sensor operates. + + :type: string + + .. attribute:: value + + the value with which the sensor compares to the value of the property. + + :type: string + + .. attribute:: min + + the minimum value of the range used to evaluate the property when in interval mode. + + :type: string + + .. attribute:: max + + the maximum value of the range used to evaluate the property when in interval mode. + + :type: string + +.. class:: SCA_PythonController(SCA_IController) + + A Python controller uses a Python script to activate it's actuators, + based on it's sensors. + + .. attribute:: script + + The value of this variable depends on the execution methid. + + * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts. + * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts. + + :type: string + + .. note:: + + Once this is set the script name given for warnings will remain unchanged. + + .. attribute:: mode + + the execution mode for this controller (read-only). + + * Script: 0, Execite the :data:`script` as a python code. + * Module: 1, Execite the :data:`script` as a module and function. + + :type: integer + + .. method:: activate(actuator) + + Activates an actuator attached to this controller. + + :arg actuator: The actuator to operate on. + :type actuator: actuator or the actuator name as a string + + .. method:: deactivate(actuator) + + Deactivates an actuator attached to this controller. + + :arg actuator: The actuator to operate on. + :type actuator: actuator or the actuator name as a string + +.. class:: SCA_RandomActuator(SCA_IActuator) + + Random Actuator + + .. attribute:: seed + + Seed of the random number generator. + + :type: integer. + + Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call. + + .. attribute:: para1 + + the first parameter of the active distribution. + + :type: float, read-only. + + Refer to the documentation of the generator types for the meaning of this value. + + .. attribute:: para2 + + the second parameter of the active distribution. + + :type: float, read-only + + Refer to the documentation of the generator types for the meaning of this value. + + .. attribute:: distribution + + Distribution type. (read-only). Can be one of :ref:`these constants ` + + :type: integer + + .. attribute:: propName + + the name of the property to set with the random value. + + :type: string + + If the generator and property types do not match, the assignment is ignored. + + .. method:: setBoolConst(value) + + Sets this generator to produce a constant boolean value. + + :arg value: The value to return. + :type value: boolean + + .. method:: setBoolUniform() + + Sets this generator to produce a uniform boolean distribution. + + The generator will generate True or False with 50% chance. + + .. method:: setBoolBernouilli(value) + + Sets this generator to produce a Bernouilli distribution. + + :arg value: Specifies the proportion of False values to produce. + + * 0.0: Always generate True + * 1.0: Always generate False + :type value: float + + .. method:: setIntConst(value) + + Sets this generator to always produce the given value. + + :arg value: the value this generator produces. + :type value: integer + + .. method:: setIntUniform(lower_bound, upper_bound) + + Sets this generator to produce a random value between the given lower and + upper bounds (inclusive). + + :type lower_bound: integer + :type upper_bound: integer + + .. method:: setIntPoisson(value) + + Generate a Poisson-distributed number. + + This performs a series of Bernouilli tests with parameter value. + It returns the number of tries needed to achieve succes. + + :type value: float + + .. method:: setFloatConst(value) + + Always generate the given value. + + :type value: float + + .. method:: setFloatUniform(lower_bound, upper_bound) + + Generates a random float between lower_bound and upper_bound with a + uniform distribution. + + :type lower_bound: float + :type upper_bound: float + + .. method:: setFloatNormal(mean, standard_deviation) + + Generates a random float from the given normal distribution. + + :arg mean: The mean (average) value of the generated numbers + :type mean: float + :arg standard_deviation: The standard deviation of the generated numbers. + :type standard_deviation: float + + .. method:: setFloatNegativeExponential(half_life) + + Generate negative-exponentially distributed numbers. + + The half-life 'time' is characterized by half_life. + + :type half_life: float + +.. class:: SCA_RandomSensor(SCA_ISensor) + + This sensor activates randomly. + + .. attribute:: lastDraw + + The seed of the random number generator. + + :type: integer + + .. attribute:: seed + + The seed of the random number generator. + + :type: integer + + .. method:: setSeed(seed) + + Sets the seed of the random number generator. + + If the seed is 0, the generator will produce the same value on every call. + + :type seed: integer + + .. method:: getSeed() + + :return: The initial seed of the generator. Equal seeds produce equal random series. + :rtype: integer + + .. method:: getLastDraw() + + :return: The last random number generated. + :rtype: integer + +.. class:: SCA_XNORController(SCA_IController) + + An XNOR controller activates when all linked sensors are the same (activated or inative). + + There are no special python methods for this controller. + +.. class:: SCA_XORController(SCA_IController) + + An XOR controller activates when there is the input is mixed, but not when all are on or off. + + There are no special python methods for this controller. + +.. class:: KX_Camera(KX_GameObject) + + A Camera object. + + .. data:: INSIDE + + See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` + + .. data:: INTERSECT + + See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` + + .. data:: OUTSIDE + + See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` + + .. attribute:: lens + + The camera's lens value. + + :type: float + + .. attribute:: ortho_scale + + The camera's view scale when in orthographic mode. + + :type: float + + .. attribute:: near + + The camera's near clip distance. + + :type: float + + .. attribute:: far + + The camera's far clip distance. + + :type: float + + .. attribute:: perspective + + True if this camera has a perspective transform, False for an orthographic projection. + + :type: boolean + + .. attribute:: frustum_culling + + True if this camera is frustum culling. + + :type: boolean + + .. attribute:: projection_matrix + + This camera's 4x4 projection matrix. + + :type: 4x4 Matrix [[float]] + + .. attribute:: modelview_matrix + + This camera's 4x4 model view matrix. (read-only). + + :type: 4x4 Matrix [[float]] + + .. note:: + + This matrix is regenerated every frame from the camera's position and orientation. + + .. attribute:: camera_to_world + + This camera's camera to world transform. (read-only). + + :type: 4x4 Matrix [[float]] + + .. note:: + + This matrix is regenerated every frame from the camera's position and orientation. + + .. attribute:: world_to_camera + + This camera's world to camera transform. (read-only). + + :type: 4x4 Matrix [[float]] + + .. note:: + + Regenerated every frame from the camera's position and orientation. + + .. note:: + + This is camera_to_world inverted. + + .. attribute:: useViewport + + True when the camera is used as a viewport, set True to enable a viewport for this camera. + + :type: boolean + + .. method:: sphereInsideFrustum(centre, radius) + + Tests the given sphere against the view frustum. + + :arg centre: The centre of the sphere (in world coordinates.) + :type centre: list [x, y, z] + :arg radius: the radius of the sphere + :type radius: float + :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT` + :rtype: integer + + .. note:: + + When the camera is first initialized the result will be invalid because the projection matrix has not been set. + + .. code-block:: python + + import GameLogic + co = GameLogic.getCurrentController() + cam = co.owner + + # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0] + if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE): + # Sphere is inside frustum ! + # Do something useful ! + else: + # Sphere is outside frustum + + .. method:: boxInsideFrustum(box) + + Tests the given box against the view frustum. + + :arg box: Eight (8) corner points of the box (in world coordinates.) + :type box: list of lists + :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT` + + .. note:: + + When the camera is first initialized the result will be invalid because the projection matrix has not been set. + + .. code-block:: python + + import GameLogic + co = GameLogic.getCurrentController() + cam = co.owner + + # Box to test... + box = [] + box.append([-1.0, -1.0, -1.0]) + box.append([-1.0, -1.0, 1.0]) + box.append([-1.0, 1.0, -1.0]) + box.append([-1.0, 1.0, 1.0]) + box.append([ 1.0, -1.0, -1.0]) + box.append([ 1.0, -1.0, 1.0]) + box.append([ 1.0, 1.0, -1.0]) + box.append([ 1.0, 1.0, 1.0]) + + if (cam.boxInsideFrustum(box) != cam.OUTSIDE): + # Box is inside/intersects frustum ! + # Do something useful ! + else: + # Box is outside the frustum ! + + .. method:: pointInsideFrustum(point) + + Tests the given point against the view frustum. + + :arg point: The point to test (in world coordinates.) + :type point: 3D Vector + :return: True if the given point is inside this camera's viewing frustum. + :rtype: boolean + + .. note:: + + When the camera is first initialized the result will be invalid because the projection matrix has not been set. + + .. code-block:: python + + import GameLogic + co = GameLogic.getCurrentController() + cam = co.owner + + # Test point [0.0, 0.0, 0.0] + if (cam.pointInsideFrustum([0.0, 0.0, 0.0])): + # Point is inside frustum ! + # Do something useful ! + else: + # Box is outside the frustum ! + + .. method:: getCameraToWorld() + + Returns the camera-to-world transform. + + :return: the camera-to-world transform matrix. + :rtype: matrix (4x4 list) + + .. method:: getWorldToCamera() + + Returns the world-to-camera transform. + + This returns the inverse matrix of getCameraToWorld(). + + :return: the world-to-camera transform matrix. + :rtype: matrix (4x4 list) + + .. method:: setOnTop() + + Set this cameras viewport ontop of all other viewport. + + .. method:: setViewport(left, bottom, right, top) + + Sets the region of this viewport on the screen in pixels. + + Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display. + + :arg left: left pixel coordinate of this viewport + :type left: integer + :arg bottom: bottom pixel coordinate of this viewport + :type bottom: integer + :arg right: right pixel coordinate of this viewport + :type right: integer + :arg top: top pixel coordinate of this viewport + :type top: integer + + .. method:: getScreenPosition(object) + + Gets the position of an object projected on screen space. + + .. code-block:: python + + # For an object in the middle of the screen, coord = [0.5, 0.5] + coord = camera.getScreenPosition(object) + + :arg object: object name or list [x, y, z] + :type object: :class:`KX_GameObject` or 3D Vector + :return: the object's position in screen coordinates. + :rtype: list [x, y] + + .. method:: getScreenVect(x, y) + + Gets the vector from the camera position in the screen coordinate direction. + + :arg x: X Axis + :type x: float + :arg y: Y Axis + :type y: float + :rtype: 3D Vector + :return: The vector from screen coordinate. + + .. code-block:: python + + # Gets the vector of the camera front direction: + m_vect = camera.getScreenVect(0.5, 0.5) + + .. method:: getScreenRay(x, y, dist=inf, property=None) + + Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop. + The ray is similar to KX_GameObject->rayCastTo. + + :arg x: X Axis + :type x: float + :arg y: Y Axis + :type y: float + :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other + :type dist: float + :arg property: property name that object must have; can be omitted => detect any object + :type property: string + :rtype: :class:`KX_GameObject` + :return: the first object hit or None if no object or object does not match prop + + .. code-block:: python + + # Gets an object with a property "wall" in front of the camera within a distance of 100: + target = camera.getScreenRay(0.5, 0.5, 100, "wall") + +.. class:: BL_ArmatureObject(KX_GameObject) + + An armature object. + + .. attribute:: constraints + + The list of armature constraint defined on this armature. + Elements of the list can be accessed by index or string. + The key format for string access is ':'. + + :type: list of :class:`BL_ArmatureConstraint` + + .. attribute:: channels + + The list of armature channels. + Elements of the list can be accessed by index or name the bone. + + :type: list of :class:`BL_ArmatureChannel` + + .. method:: update() + + Ensures that the armature will be updated on next graphic frame. + + This action is unecessary if a KX_ArmatureActuator with mode run is active + or if an action is playing. Use this function in other cases. It must be called + on each frame to ensure that the armature is updated continously. + +.. class:: BL_ArmatureActuator(SCA_IActuator) + + Armature Actuators change constraint condition on armatures. + + .. _armatureactuator-constants-type: + + Constants related to :data:`~bge.types.BL_ArmatureActuator.type` + + .. data:: KX_ACT_ARMATURE_RUN + + Just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller + + :value: 0 + + .. data:: KX_ACT_ARMATURE_ENABLE + + Enable the constraint. + + :value: 1 + + .. data:: KX_ACT_ARMATURE_DISABLE + + Disable the constraint (runtime constraint values are not updated). + + :value: 2 + + .. data:: KX_ACT_ARMATURE_SETTARGET + + Change target and subtarget of constraint. + + :value: 3 + + .. data:: KX_ACT_ARMATURE_SETWEIGHT + + Change weight of (only for IK constraint). + + :value: 4 + + .. attribute:: type + + The type of action that the actuator executes when it is active. + + Can be one of :ref:`these constants ` + + :type: integer + + .. attribute:: constraint + + The constraint object this actuator is controlling. + + :type: :class:`BL_ArmatureConstraint` + + .. attribute:: target + + The object that this actuator will set as primary target to the constraint it controls. + + :type: :class:`KX_GameObject` + + .. attribute:: subtarget + + The object that this actuator will set as secondary target to the constraint it controls. + + :type: :class:`KX_GameObject`. + + .. note:: + + Currently, the only secondary target is the pole target for IK constraint. + + .. attribute:: weight + + The weight this actuator will set on the constraint it controls. + + :type: float. + + .. note:: + + Currently only the IK constraint has a weight. It must be a value between 0 and 1. + + .. note:: + + A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`) + +.. class:: KX_ArmatureSensor(SCA_ISensor) + + Armature sensor detect conditions on armatures. + + .. _armaturesensor-type: + + Constants related to :data:`type` + + .. data:: KX_ARMSENSOR_STATE_CHANGED + + Detect that the constraint is changing state (active/inactive) + + :value: 0 + + .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW + + Detect that the constraint linear error is above a threshold + + :value: 1 + + .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE + + Detect that the constraint linear error is below a threshold + + :value: 2 + + .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW + + Detect that the constraint rotation error is above a threshold + + :value: 3 + + .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE + + Detect that the constraint rotation error is below a threshold + + :value: 4 + + .. attribute:: type + + The type of measurement that the sensor make when it is active. + + Can be one of :ref:`these constants ` + + :type: integer. + + .. attribute:: constraint + + The constraint object this sensor is watching. + + :type: :class:`BL_ArmatureConstraint` + + .. attribute:: value + + The threshold used in the comparison with the constraint error + The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver + The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver + The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone + The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations + The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller. + + :type: float + +.. class:: BL_ArmatureConstraint(PyObjectPlus) + + Proxy to Armature Constraint. Allows to change constraint on the fly. + Obtained through :class:`BL_ArmatureObject`.constraints. + + .. note:: + + Not all armature constraints are supported in the GE. + + .. _armatureconstraint-constants-type: + + Constants related to :data:`type` + + .. data:: CONSTRAINT_TYPE_TRACKTO + .. data:: CONSTRAINT_TYPE_KINEMATIC + .. data:: CONSTRAINT_TYPE_ROTLIKE + .. data:: CONSTRAINT_TYPE_LOCLIKE + .. data:: CONSTRAINT_TYPE_MINMAX + .. data:: CONSTRAINT_TYPE_SIZELIKE + .. data:: CONSTRAINT_TYPE_LOCKTRACK + .. data:: CONSTRAINT_TYPE_STRETCHTO + .. data:: CONSTRAINT_TYPE_CLAMPTO + .. data:: CONSTRAINT_TYPE_TRANSFORM + .. data:: CONSTRAINT_TYPE_DISTLIMIT + + .. _armatureconstraint-constants-ik-type: + + Constants related to :data:`ik_type` + + .. data:: CONSTRAINT_IK_COPYPOSE + + constraint is trying to match the position and eventually the rotation of the target. + + :value: 0 + + .. data:: CONSTRAINT_IK_DISTANCE + + Constraint is maintaining a certain distance to target subject to ik_mode + + :value: 1 + + .. _armatureconstraint-constants-ik-flag: + + Constants related to :data:`ik_flag` + + .. data:: CONSTRAINT_IK_FLAG_TIP + + Set when the constraint operates on the head of the bone and not the tail + + :value: 1 + + .. data:: CONSTRAINT_IK_FLAG_ROT + + Set when the constraint tries to match the orientation of the target + + :value: 2 + + .. data:: CONSTRAINT_IK_FLAG_STRETCH + + Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0) + + :value: 16 + + .. data:: CONSTRAINT_IK_FLAG_POS + + Set when the constraint tries to match the position of the target. + + :value: 32 + + .. _armatureconstraint-constants-ik-mode: + + Constants related to :data:`ik_mode` + + .. data:: CONSTRAINT_IK_MODE_INSIDE + + The constraint tries to keep the bone within ik_dist of target + + :value: 0 + + .. data:: CONSTRAINT_IK_MODE_OUTSIDE + + The constraint tries to keep the bone outside ik_dist of the target + + :value: 1 + + .. data:: CONSTRAINT_IK_MODE_ONSURFACE + + The constraint tries to keep the bone exactly at ik_dist of the target. + + :value: 2 + + .. attribute:: type + + Type of constraint, (read-only). + + Use one of :ref:`these constants`. + + :type: integer, one of CONSTRAINT_TYPE_* constants + + .. attribute:: name + + Name of constraint constructed as :. constraints list. + + :type: string + + This name is also the key subscript on :class:`BL_ArmatureObject`. + + .. attribute:: enforce + + fraction of constraint effect that is enforced. Between 0 and 1. + + :type: float + + .. attribute:: headtail + + Position of target between head and tail of the target bone: 0=head, 1=tail. + + :type: float. + + .. note:: + + Only used if the target is a bone (i.e target object is an armature. + + .. attribute:: lin_error + + runtime linear error (in Blender units) on constraint at the current frame. + + This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. + + :type: float + + .. attribute:: rot_error + + Runtime rotation error (in radiant) on constraint at the current frame. + + :type: float. + + This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. + + It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint. + + .. attribute:: target + + Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint. + + :type: :class:`KX_GameObject`. + + .. attribute:: subtarget + + Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint. + + :type: :class:`KX_GameObject`. + + Currently this is only used for pole target on IK constraint. + + .. attribute:: active + + True if the constraint is active. + + :type: boolean + + .. note:: + + An inactive constraint does not update lin_error and rot_error. + + .. attribute:: ik_weight + + Weight of the IK constraint between 0 and 1. + + Only defined for IK constraint. + + :type: float + + .. attribute:: ik_type + + Type of IK constraint, (read-only). + + Use one of :ref:`these constants`. + + :type: integer. + + .. attribute:: ik_flag + + Combination of IK constraint option flags, read-only. + + Use one of :ref:`these constants`. + + :type: integer + + .. attribute:: ik_dist + + Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE. + + :type: float + + .. attribute:: ik_mode + + Use one of :ref:`these constants`. + + Additional mode for IK constraint. Currently only used for Distance constraint: + + :type: integer + +.. class:: BL_ArmatureChannel(PyObjectPlus) + + Proxy to armature pose channel. Allows to read and set armature pose. + The attributes are identical to RNA attributes, but mostly in read-only mode. + + See :data:`rotation_mode` + + .. data:: PCHAN_ROT_QUAT + .. data:: PCHAN_ROT_XYZ + .. data:: PCHAN_ROT_XZY + .. data:: PCHAN_ROT_YXZ + .. data:: PCHAN_ROT_YZX + .. data:: PCHAN_ROT_ZXY + .. data:: PCHAN_ROT_ZYX + + .. attribute:: name + + channel name (=bone name), read-only. + + :type: string + + .. attribute:: bone + + return the bone object corresponding to this pose channel, read-only. + + :type: :class:`BL_ArmatureBone` + + .. attribute:: parent + + return the parent channel object, None if root channel, read-only. + + :type: :class:`BL_ArmatureChannel` + + .. attribute:: has_ik + + true if the bone is part of an active IK chain, read-only. + This flag is not set when an IK constraint is defined but not enabled (miss target information for example). + + :type: boolean + + .. attribute:: ik_dof_x + + true if the bone is free to rotation in the X axis, read-only. + + :type: boolean + + .. attribute:: ik_dof_y + + true if the bone is free to rotation in the Y axis, read-only. + + :type: boolean + + .. attribute:: ik_dof_z + + true if the bone is free to rotation in the Z axis, read-only. + + :type: boolean + + .. attribute:: ik_limit_x + + true if a limit is imposed on X rotation, read-only. + + :type: boolean + + .. attribute:: ik_limit_y + + true if a limit is imposed on Y rotation, read-only. + + :type: boolean + + .. attribute:: ik_limit_z + + true if a limit is imposed on Z rotation, read-only. + + :type: boolean + + .. attribute:: ik_rot_control + + true if channel rotation should applied as IK constraint, read-only. + + :type: boolean + + .. attribute:: ik_lin_control + + true if channel size should applied as IK constraint, read-only. + + :type: boolean + + .. attribute:: location + + displacement of the bone head in armature local space, read-write. + + :type: vector [X, Y, Z]. + + .. note:: + + You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. + + .. note:: + + Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`). + + .. attribute:: scale + + scale of the bone relative to its parent, read-write. + + :type: vector [sizeX, sizeY, sizeZ]. + + .. note:: + + An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. + + .. note:: + + Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) + + .. attribute:: rotation_quaternion + + rotation of the bone relative to its parent expressed as a quaternion, read-write. + + :type: vector [qr, qi, qj, qk]. + + .. note:: + + This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. + + .. note:: + + Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) + + .. attribute:: rotation_euler + + rotation of the bone relative to its parent expressed as a set of euler angles, read-write. + + :type: vector [X, Y, Z]. + + .. note:: + + This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation. + + .. note:: + + Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) + + .. attribute:: rotation_mode + + Method of updating the bone rotation, read-write. + + :type: integer + + Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed). + + * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation + * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively + * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively + * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively + * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively + * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively + * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively + + .. attribute:: channel_matrix + + pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only. + This field is updated after the graphic render, it represents the current pose. + + :type: matrix [4][4] + + .. attribute:: pose_matrix + + pose matrix in armature space, read-only, + This field is updated after the graphic render, it represents the current pose. + + :type: matrix [4][4] + + .. attribute:: pose_head + + position of bone head in armature space, read-only. + + :type: vector [x, y, z] + + .. attribute:: pose_tail + + position of bone tail in armature space, read-only. + + :type: vector [x, y, z] + + .. attribute:: ik_min_x + + minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only. + + :type: float + + .. attribute:: ik_max_x + + maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only. + + :type: float + + .. attribute:: ik_min_y + + minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only. + + :type: float + + .. attribute:: ik_max_y + + maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only. + + :type: float + + .. attribute:: ik_min_z + + minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only. + + :type: float + + .. attribute:: ik_max_z + + maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only. + + :type: float + + .. attribute:: ik_stiffness_x + + bone rotation stiffness in X axis, read-only. + + :type: float between 0 and 1 + + .. attribute:: ik_stiffness_y + + bone rotation stiffness in Y axis, read-only. + + :type: float between 0 and 1 + + .. attribute:: ik_stiffness_z + + bone rotation stiffness in Z axis, read-only. + + :type: float between 0 and 1 + + .. attribute:: ik_stretch + + ratio of scale change that is allowed, 0=bone can't change size, read-only. + + :type: float + + .. attribute:: ik_rot_weight + + weight of rotation constraint when ik_rot_control is set, read-write. + + :type: float between 0 and 1 + + .. attribute:: ik_lin_weight + + weight of size constraint when ik_lin_control is set, read-write. + + :type: float between 0 and 1 + + .. attribute:: joint_rotation + + Control bone rotation in term of joint angle (for robotic applications), read-write. + + When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode. + + When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles. + + The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes: + + * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant + * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants. + * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane. + * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose. + + :type: vector [x, y, z] + + .. note:: + + The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain. + + .. note:: + + [0, 0, 0] always corresponds to the rest pose. + + .. note:: + + You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`). + + .. note:: + + You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute. + +.. class:: BL_ArmatureBone(PyObjectPlus) + + Proxy to Blender bone structure. All fields are read-only and comply to RNA names. + All space attribute correspond to the rest pose. + + .. attribute:: name + + bone name. + + :type: string + + .. attribute:: connected + + true when the bone head is struck to the parent's tail. + + :type: boolean + + .. attribute:: hinge + + true when bone doesn't inherit rotation or scale from parent bone. + + :type: boolean + + .. attribute:: inherit_scale + + true when bone inherits scaling from parent bone. + + :type: boolean + + .. attribute:: bbone_segments + + number of B-bone segments. + + :type: integer + + .. attribute:: roll + + bone rotation around head-tail axis. + + :type: float + + .. attribute:: head + + location of head end of the bone in parent bone space. + + :type: vector [x, y, z] + + .. attribute:: tail + + location of head end of the bone in parent bone space. + + :type: vector [x, y, z] + + .. attribute:: length + + bone length. + + :type: float + + .. attribute:: arm_head + + location of head end of the bone in armature space. + + :type: vector [x, y, z] + + .. attribute:: arm_tail + + location of tail end of the bone in armature space. + + :type: vector [x, y, z] + + .. attribute:: arm_mat + + matrix of the bone head in armature space. + + :type: matrix [4][4] + + .. note:: + + This matrix has no scale part. + + .. attribute:: bone_mat + + rotation matrix of the bone in parent bone space. + + :type: matrix [3][3] + + .. attribute:: parent + + parent bone, or None for root bone. + + :type: :class:`BL_ArmatureBone` + + .. attribute:: children + + list of bone's children. + + :type: list of :class:`BL_ArmatureBone` diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py new file mode 100644 index 00000000000..7a78816a2db --- /dev/null +++ b/doc/python_api/sphinx_doc_gen.py @@ -0,0 +1,872 @@ + # ***** BEGIN GPL LICENSE BLOCK ***** + # + # This program is free software; you can redistribute it and/or + # modify it under the terms of the GNU General Public License + # as published by the Free Software Foundation; either version 2 + # of the License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software Foundation, + # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + # + # Contributor(s): Campbell Barton + # + # #**** END GPL LICENSE BLOCK #**** + +script_help_msg = ''' +Usage: + +For HTML generation +------------------- +- Run this script from blenders root path once you have compiled blender + + ./blender.bin -b -P doc/python_api/sphinx_doc_gen.py + + This will generate python files in doc/python_api/sphinx-in/, + assuming that ./blender.bin is or links to the blender executable + +- Generate html docs by running... + + sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out + + assuming that you have sphinx 0.6.7 installed + +For PDF generation +------------------ +- After you have built doc/python_api/sphinx-in (see above), run: + + sphinx-build -b latex doc/python_api/sphinx-in doc/python_api/sphinx-out + cd doc/python_api/sphinx-out + make +''' + +# import rpdb2; rpdb2.start_embedded_debugger('test') + +import os +import inspect +import bpy +import rna_info +reload(rna_info) + +# lame, python wont give some access +ClassMethodDescriptorType = type(dict.__dict__['fromkeys']) +MethodDescriptorType = type(dict.get) +GetSetDescriptorType = type(int.real) + +EXAMPLE_SET = set() +EXAMPLE_SET_USED = set() + +_BPY_STRUCT_FAKE = "bpy_struct" +_BPY_FULL_REBUILD = False + +def undocumented_message(module_name, type_name, identifier): + message = "Undocumented (`contribute " \ + "`_)\n\n" % (module_name, type_name, identifier) + return message + + +def range_str(val): + ''' + Converts values to strings for the range directive. + (unused function it seems) + ''' + if val < -10000000: return '-inf' + if val > 10000000: return 'inf' + if type(val)==float: + return '%g' % val + else: + return str(val) + + +def write_example_ref(ident, fw, example_id, ext="py"): + if example_id in EXAMPLE_SET: + fw("%s.. literalinclude:: ../examples/%s.%s\n\n" % (ident, example_id, ext)) + EXAMPLE_SET_USED.add(example_id) + else: + if bpy.app.debug: + print("\tskipping example:", example_id) + + +def write_indented_lines(ident, fn, text, strip=True): + ''' + Apply same indentation to all lines in a multilines text. + ''' + if text is None: + return + for l in text.split("\n"): + if strip: + fn(ident + l.strip() + "\n") + else: + fn(ident + l + "\n") + + +def pymethod2sphinx(ident, fw, identifier, py_func): + ''' + class method to sphinx + ''' + arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) + if arg_str.startswith("(self, "): + arg_str = "(" + arg_str[7:] + func_type = "method" + elif arg_str.startswith("(cls, "): + arg_str = "(" + arg_str[6:] + func_type = "classmethod" + else: + func_type = "staticmethod" + + fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) + if py_func.__doc__: + write_indented_lines(ident + " ", fw, py_func.__doc__) + fw("\n") + + +def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True): + ''' + function or class method to sphinx + ''' + arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) + + if not is_class: + func_type = "function" + + # ther rest are class methods + elif arg_str.startswith("(self, "): + arg_str = "(" + arg_str[7:] + func_type = "method" + elif arg_str.startswith("(cls, "): + arg_str = "(" + arg_str[6:] + func_type = "classmethod" + else: + func_type = "staticmethod" + + fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) + if py_func.__doc__: + write_indented_lines(ident + " ", fw, py_func.__doc__.strip()) + fw("\n") + + +def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): + if identifier.startswith("_"): + return + + doc = descr.__doc__ + if not doc: + doc = undocumented_message(module_name, type_name, identifier) + + if type(descr) == GetSetDescriptorType: + fw(ident + ".. attribute:: %s\n\n" % identifier) + write_indented_lines(ident + " ", fw, doc, False) + elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType): + write_indented_lines(ident, fw, doc, False) + else: + raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType") + + write_example_ref(ident, fw, module_name + "." + type_name + "." + identifier) + fw("\n") + + +def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_class=True): + ''' + c defined function to sphinx. + ''' + + # dump the docstring, assume its formatted correctly + if py_func.__doc__: + write_indented_lines(ident, fw, py_func.__doc__, False) + fw("\n") + else: + fw(ident + ".. function:: %s()\n\n" % identifier) + fw(ident + " " + undocumented_message(module_name, type_name, identifier)) + + +def pyprop2sphinx(ident, fw, identifier, py_prop): + ''' + python property to sphinx + ''' + # readonly properties use "data" directive, variables use "attribute" directive + if py_prop.fset is None: + fw(ident + ".. data:: %s\n\n" % identifier) + else: + fw(ident + ".. attribute:: %s\n\n" % identifier) + write_indented_lines(ident + " ", fw, py_prop.__doc__) + if py_prop.fset is None: + fw(ident + " (readonly)\n\n") + + +def pymodule2sphinx(BASEPATH, module_name, module, title): + import types + attribute_set = set() + filepath = os.path.join(BASEPATH, module_name + ".rst") + + file = open(filepath, "w") + + fw = file.write + + fw(title + "\n") + fw(("=" * len(title)) + "\n\n") + + fw(".. module:: %s\n\n" % module_name) + + if module.__doc__: + # Note, may contain sphinx syntax, dont mangle! + fw(module.__doc__.strip()) + fw("\n\n") + + write_example_ref("", fw, module_name) + + # write members of the module + # only tested with PyStructs which are not exactly modules + for key, descr in sorted(type(module).__dict__.items()): + if type(descr) == types.MemberDescriptorType: + if descr.__doc__: + fw(".. data:: %s\n\n" % key) + write_indented_lines(" ", fw, descr.__doc__, False) + attribute_set.add(key) + fw("\n") + del key, descr + + classes = [] + + for attribute in sorted(dir(module)): + if not attribute.startswith("_"): + + if attribute in attribute_set: + continue + + if attribute.startswith("n_"): # annoying exception, needed for bpy.app + continue + + value = getattr(module, attribute) + + value_type = type(value) + + if value_type == types.FunctionType: + pyfunc2sphinx("", fw, attribute, value, is_class=False) + elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType): # both the same at the moment but to be future proof + # note: can't get args from these, so dump the string as is + # this means any module used like this must have fully formatted docstrings. + py_c_func2sphinx("", fw, module_name, module, attribute, value, is_class=False) + elif value_type == type: + classes.append((attribute, value)) + elif value_type in (bool, int, float, str, tuple): + # constant, not much fun we can do here except to list it. + # TODO, figure out some way to document these! + fw(".. data:: %s\n\n" % attribute) + write_indented_lines(" ", fw, "constant value %s" % repr(value), False) + fw("\n") + else: + print("\tnot documenting %s.%s" % (module_name, attribute)) + continue + + attribute_set.add(attribute) + # TODO, more types... + + # write collected classes now + for (type_name, value) in classes: + # May need to be its own function + fw(".. class:: %s\n\n" % type_name) + if value.__doc__: + write_indented_lines(" ", fw, value.__doc__, False) + fw("\n") + write_example_ref(" ", fw, module_name + "." + type_name) + + descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")] + + for key, descr in descr_items: + if type(descr) == ClassMethodDescriptorType: + py_descr2sphinx(" ", fw, descr, module_name, type_name, key) + + for key, descr in descr_items: + if type(descr) == MethodDescriptorType: + py_descr2sphinx(" ", fw, descr, module_name, type_name, key) + + for key, descr in descr_items: + if type(descr) == GetSetDescriptorType: + py_descr2sphinx(" ", fw, descr, module_name, type_name, key) + + fw("\n\n") + + file.close() + + + +def rna2sphinx(BASEPATH): + + structs, funcs, ops, props = rna_info.BuildRNAInfo() + + try: + os.mkdir(BASEPATH) + except: + pass + + # conf.py - empty for now + filepath = os.path.join(BASEPATH, "conf.py") + file = open(filepath, "w") + fw = file.write + + + version_string = bpy.app.version_string.split("(")[0] + if bpy.app.build_revision != "Unknown": + version_string = version_string + " r" + bpy.app.build_revision + + # for use with files + version_string_fp = "_".join(str(v) for v in bpy.app.version) + + fw("project = 'Blender'\n") + # fw("master_doc = 'index'\n") + fw("copyright = u'Blender Foundation'\n") + fw("version = '%s - UNSTABLE API'\n" % version_string) + fw("release = '%s - UNSTABLE API'\n" % version_string) + fw("html_theme = 'blender-org'\n") + fw("html_theme_path = ['../']\n") + fw("html_favicon = 'favicon.ico'\n") + # not helpful since the source us generated, adds to upload size. + fw("html_copy_source = False\n") + fw("\n") + # needed for latex, pdf gen + fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n") + fw("latex_paper_size = 'a4paper'\n") + file.close() + + + filepath = os.path.join(BASEPATH, "contents.rst") + file = open(filepath, "w") + fw = file.write + + fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n") + fw(" Blender Documentation contents\n") + fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n") + fw("\n") + fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date)) + fw("\n") + fw("An introduction to Blender and Python can be found at \n") + fw("\n") + fw("`A PDF version of this document is also available `__\n" % version_string_fp) + fw("\n") + fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n") + fw(" \n") + fw(" The following areas are subject to change.\n") + fw(" * operator names and arguments\n") + fw(" * render api\n") + fw(" * function calls with the data api (any function calls with values accessed from bpy.data), including functions for importing and exporting meshes\n") + fw(" * class registration (Operator, Panels, Menus, Headers)\n") + fw(" * modules: bpy.props, blf)\n") + fw(" * members in the bpy.context have to be reviewed\n") + fw(" * python defined modal operators, especially drawing callbacks are highly experemental\n") + fw(" \n") + fw(" These parts of the API are relatively stable and are unlikely to change significantly\n") + fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n") + fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n") + fw(" * modules: bgl, mathutils and geometry\n") + fw(" * game engine modules\n") + fw("\n") + + fw("===================\n") + fw("Application Modules\n") + fw("===================\n") + fw("\n") + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + fw(" bpy.data.rst\n\n") # note: not actually a module + fw(" bpy.ops.rst\n\n") + fw(" bpy.types.rst\n\n") + + # py modules + fw(" bpy.utils.rst\n\n") + fw(" bpy.path.rst\n\n") + fw(" bpy.app.rst\n\n") + + # C modules + fw(" bpy.props.rst\n\n") + + fw("==================\n") + fw("Standalone Modules\n") + fw("==================\n") + fw("\n") + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + + + fw(" mathutils.rst\n\n") + fw(" blf.rst\n\n") + fw(" aud.rst\n\n") + + # game engine + fw("===================\n") + fw("Game Engine Modules\n") + fw("===================\n") + fw("\n") + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + fw(" bge.types.rst\n\n") + fw(" bge.logic.rst\n\n") + fw(" bge.render.rst\n\n") + fw(" bge.events.rst\n\n") + + file.close() + + + # internal modules + filepath = os.path.join(BASEPATH, "bpy.ops.rst") + file = open(filepath, "w") + fw = file.write + fw("Operators (bpy.ops)\n") + fw("===================\n\n") + fw(".. toctree::\n") + fw(" :glob:\n\n") + fw(" bpy.ops.*\n\n") + file.close() + + filepath = os.path.join(BASEPATH, "bpy.types.rst") + file = open(filepath, "w") + fw = file.write + fw("Types (bpy.types)\n") + fw("=================\n\n") + fw(".. toctree::\n") + fw(" :glob:\n\n") + fw(" bpy.types.*\n\n") + file.close() + + + # not actually a module, only write this file so we + # can reference in the TOC + filepath = os.path.join(BASEPATH, "bpy.data.rst") + file = open(filepath, "w") + fw = file.write + fw("Data Access (bpy.data)\n") + fw("======================\n\n") + fw(".. module:: bpy\n") + fw("\n") + fw("This module is used for all blender/python access.\n") + fw("\n") + fw(".. literalinclude:: ../examples/bpy.data.py\n") + fw("\n") + fw(".. data:: data\n") + fw("\n") + fw(" Access to blenders internal data\n") + fw("\n") + fw(" :type: :class:`bpy.types.BlendData`\n") + file.close() + + EXAMPLE_SET_USED.add("bpy.data") + + + # python modules + from bpy import utils as module + pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)") + + from bpy import path as module + pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)") + + # C modules + from bpy import app as module + pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)") + + from bpy import props as module + pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)") + + import mathutils as module + pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)") + del module + + import blf as module + pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)") + del module + + import aud as module + pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)") + del module + + ## game engine + import shutil + # copy2 keeps time/date stamps + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.types.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.logic.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.render.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.events.rst"), BASEPATH) + + + if 0: + filepath = os.path.join(BASEPATH, "bpy.rst") + file = open(filepath, "w") + fw = file.write + + fw("\n") + + title = ":mod:`bpy` --- Blender Python Module" + fw("%s\n%s\n\n" % (title, "=" * len(title))) + fw(".. module:: bpy.types\n\n") + file.close() + + def write_param(ident, fw, prop, is_return=False): + if is_return: + id_name = "return" + id_type = "rtype" + kwargs = {"as_ret": True, "class_fmt": ":class:`%s`"} + identifier = "" + else: + id_name = "arg" + id_type = "type" + kwargs = {"as_arg": True, "class_fmt": ":class:`%s`"} + identifier = " %s" % prop.identifier + + type_descr = prop.get_type_description(**kwargs) + if prop.name or prop.description: + fw(ident + ":%s%s: %s\n" % (id_name, identifier, ", ".join(val for val in (prop.name, prop.description) if val))) + fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr)) + + def write_struct(struct): + #if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"): + # return + + #if not struct.identifier == "Object": + # return + + filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier) + file = open(filepath, "w") + fw = file.write + + base_id = getattr(struct.base, "identifier", "") + + if _BPY_STRUCT_FAKE: + if not base_id: + base_id = _BPY_STRUCT_FAKE + + if base_id: + title = "%s(%s)" % (struct.identifier, base_id) + else: + title = struct.identifier + + fw("%s\n%s\n\n" % (title, "=" * len(title))) + + fw(".. module:: bpy.types\n\n") + + base_ids = [base.identifier for base in struct.get_bases()] + + if _BPY_STRUCT_FAKE: + base_ids.append(_BPY_STRUCT_FAKE) + + base_ids.reverse() + + if base_ids: + if len(base_ids) > 1: + fw("base classes --- ") + else: + fw("base class --- ") + + fw(", ".join((":class:`%s`" % base_id) for base_id in base_ids)) + fw("\n\n") + + subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)] + if subclass_ids: + fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n") + + base_id = getattr(struct.base, "identifier", "") + + if _BPY_STRUCT_FAKE: + if not base_id: + base_id = _BPY_STRUCT_FAKE + + if base_id: + fw(".. class:: %s(%s)\n\n" % (struct.identifier, base_id)) + else: + fw(".. class:: %s\n\n" % struct.identifier) + + fw(" %s\n\n" % struct.description) + + # properties sorted in alphabetical order + sorted_struct_properties = struct.properties[:] + sorted_struct_properties.sort(key=lambda prop: prop.identifier) + + for prop in sorted_struct_properties: + type_descr = prop.get_type_description(class_fmt=":class:`%s`") + # readonly properties use "data" directive, variables properties use "attribute" directive + if 'readonly' in type_descr: + fw(" .. data:: %s\n\n" % prop.identifier) + else: + fw(" .. attribute:: %s\n\n" % prop.identifier) + if prop.description: + fw(" %s\n\n" % prop.description) + fw(" :type: %s\n\n" % type_descr) + + # python attributes + py_properties = struct.get_py_properties() + py_prop = None + for identifier, py_prop in py_properties: + pyprop2sphinx(" ", fw, identifier, py_prop) + del py_properties, py_prop + + for func in struct.functions: + args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args) + + fw(" .. %s:: %s(%s)\n\n" % ("classmethod" if func.is_classmethod else "method", func.identifier, args_str)) + fw(" %s\n\n" % func.description) + + for prop in func.args: + write_param(" ", fw, prop) + + if len(func.return_values) == 1: + write_param(" ", fw, func.return_values[0], is_return=True) + elif func.return_values: # multiple return values + fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values)) + for prop in func.return_values: + type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`") + descr = prop.description + if not descr: + descr = prop.name + fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr)) + + fw("\n") + + + # python methods + py_funcs = struct.get_py_functions() + py_func = None + + for identifier, py_func in py_funcs: + pyfunc2sphinx(" ", fw, identifier, py_func, is_class=True) + del py_funcs, py_func + + lines = [] + + if struct.base or _BPY_STRUCT_FAKE: + bases = list(reversed(struct.get_bases())) + + # props + lines[:] = [] + + if _BPY_STRUCT_FAKE: + descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")] + + if _BPY_STRUCT_FAKE: + for key, descr in descr_items: + if type(descr) == GetSetDescriptorType: + lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key)) + + for base in bases: + for prop in base.properties: + lines.append(" * :class:`%s.%s`\n" % (base.identifier, prop.identifier)) + + for identifier, py_prop in base.get_py_properties(): + lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier)) + + for identifier, py_prop in base.get_py_properties(): + lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier)) + + if lines: + fw(".. rubric:: Inherited Properties\n\n") + + fw(".. hlist::\n") + fw(" :columns: 2\n\n") + + for line in lines: + fw(line) + fw("\n") + + + # funcs + lines[:] = [] + + if _BPY_STRUCT_FAKE: + for key, descr in descr_items: + if type(descr) == MethodDescriptorType: + lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key)) + + for base in bases: + for func in base.functions: + lines.append(" * :class:`%s.%s`\n" % (base.identifier, func.identifier)) + for identifier, py_func in base.get_py_functions(): + lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier)) + + if lines: + fw(".. rubric:: Inherited Functions\n\n") + + fw(".. hlist::\n") + fw(" :columns: 2\n\n") + + for line in lines: + fw(line) + fw("\n") + + lines[:] = [] + + + if struct.references: + # use this otherwise it gets in the index for a normal heading. + fw(".. rubric:: References\n\n") + + fw(".. hlist::\n") + fw(" :columns: 2\n\n") + + for ref in struct.references: + ref_split = ref.split(".") + if len(ref_split) > 2: + ref = ref_split[-2] + "." + ref_split[-1] + fw(" * :class:`%s`\n" % ref) + fw("\n") + + + for struct in structs.values(): + # TODO, rna_info should filter these out! + if "_OT_" in struct.identifier: + continue + write_struct(struct) + + # special case, bpy_struct + if _BPY_STRUCT_FAKE: + filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % _BPY_STRUCT_FAKE) + file = open(filepath, "w") + fw = file.write + + fw("%s\n" % _BPY_STRUCT_FAKE) + fw("=" * len(_BPY_STRUCT_FAKE) + "\n") + fw("\n") + fw(".. module:: bpy.types\n") + fw("\n") + + subclass_ids = [s.identifier for s in structs.values() if s.base is None if not rna_info.rna_id_ignore(s.identifier)] + if subclass_ids: + fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in sorted(subclass_ids)) + "\n\n") + + fw(".. class:: %s\n\n" % _BPY_STRUCT_FAKE) + fw(" built-in base class for all classes in bpy.types.\n\n") + fw(" .. note::\n\n") + fw(" Note that bpy.types.%s is not actually available from within blender, it only exists for the purpose of documentation.\n\n" % _BPY_STRUCT_FAKE) + + descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")] + + for key, descr in descr_items: + if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet + py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key) + + for key, descr in descr_items: + if type(descr) == GetSetDescriptorType: + py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key) + + + # operators + def write_ops(): + API_BASEURL='https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts' + fw = None + last_mod = '' + + for op_key in sorted(ops.keys()): + op = ops[op_key] + + if last_mod != op.module_name: + filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op.module_name) + file = open(filepath, "w") + fw = file.write + + title = "%s Operators" % (op.module_name[0].upper() + op.module_name[1:]) + fw("%s\n%s\n\n" % (title, "=" * len(title))) + + fw(".. module:: bpy.ops.%s\n\n" % op.module_name) + last_mod = op.module_name + + args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args) + fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str)) + + # if the description isn't valid, we output the standard warning + # with a link to the wiki so that people can help + if not op.description or op.description == "(undocumented operator)": + operator_description = undocumented_message('bpy.ops',op.module_name,op.func_name) + else: + operator_description = op.description + + fw(" %s\n\n" % operator_description) + for prop in op.args: + write_param(" ", fw, prop) + if op.args: + fw("\n") + + location = op.get_location() + if location != (None, None): + fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0],API_BASEURL,location[0],location[1])) + + write_ops() + + file.close() + +def main(): + import bpy + if 'bpy' not in dir(): + print("\nError, this script must run from inside blender2.5") + print(script_help_msg) + else: + import shutil + + script_dir = os.path.dirname(__file__) + path_in = os.path.join(script_dir,'sphinx-in') + path_out = os.path.join(script_dir,'sphinx-out') + path_examples = os.path.join(script_dir,'examples') + # only for partial updates + path_in_tmp = path_in + "-tmp" + + if not os.path.exists(path_in): + os.mkdir(path_in) + + for f in os.listdir(path_examples): + if f.endswith(".py"): + EXAMPLE_SET.add(os.path.splitext(f)[0]) + + + # only for full updates + if _BPY_FULL_REBUILD: + shutil.rmtree(path_in, True) + shutil.rmtree(path_out, True) + else: + # write here, then move + shutil.rmtree(path_in_tmp, True) + + rna2sphinx(path_in_tmp) + + if not _BPY_FULL_REBUILD: + import filecmp + + # now move changed files from 'path_in_tmp' --> 'path_in' + file_list_path_in = set(os.listdir(path_in)) + file_list_path_in_tmp = set(os.listdir(path_in_tmp)) + + # remove deprecated files that have been removed. + for f in sorted(file_list_path_in): + if f not in file_list_path_in_tmp: + print("\tdeprecated: %s" % f) + os.remove(os.path.join(path_in, f)) + + # freshen with new files. + for f in sorted(file_list_path_in_tmp): + f_from = os.path.join(path_in_tmp, f) + f_to = os.path.join(path_in, f) + + do_copy = True + if f in file_list_path_in: + if filecmp.cmp(f_from, f_to): + do_copy = False + + if do_copy: + print("\tupdating: %s" % f) + shutil.copy(f_from, f_to) + '''else: + print("\tkeeping: %s" % f) # eh, not that useful''' + + + EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED + if EXAMPLE_SET_UNUSED: + print("\nUnused examples found in '%s'..." % path_examples) + for f in EXAMPLE_SET_UNUSED: + print(" %s.py" % f) + print(" %d total\n" % len(EXAMPLE_SET_UNUSED)) + + import sys + sys.exit() + +if __name__ == '__main__': + main() diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh new file mode 100755 index 00000000000..49a2e4869d8 --- /dev/null +++ b/doc/python_api/sphinx_doc_gen.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# run from the blender source dir +# bash source/blender/python/doc/sphinx_doc_gen.sh +# ssh upload means you need an account on the server + +BLENDER="./blender.bin" +SSH_HOST="ideasman42@emo.blender.org" +SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api_VERSION, added after + +# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1' +# "_".join(str(v) for v in bpy.app.version) +# custom blender vars +blender_srcdir=$(dirname $0)/../../ +blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) +blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) +BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion + +BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'` +SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION + +SPHINXBASE=doc/python_api/ + +# dont delete existing docs, now partial updates are used for quick builds. +$BLENDER --background --python $SPHINXBASE/sphinx_doc_gen.py + +# html +sphinx-build $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out +cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html +ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' +rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ + +# pdf +sphinx-build -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out +cd $SPHINXBASE/sphinx-out +make +cd - +rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf diff --git a/source/blender/python/doc/epy/BGL.py b/source/blender/python/doc/epy/BGL.py deleted file mode 100644 index ce148dc72ba..00000000000 --- a/source/blender/python/doc/epy/BGL.py +++ /dev/null @@ -1,1807 +0,0 @@ -# Blender.BGL module (OpenGL wrapper) - -""" -The Blender.BGL submodule (the OpenGL wrapper). - -B{New}: some GLU functions: L{gluLookAt}, etc. - -The Blender.BGL submodule -========================= -(when accessing it from the Game Engine use BGL instead of Blender.BGL) - -This module wraps OpenGL constants and functions, making them available from -within Blender Python. - -The complete list can be retrieved from the module itself, by listing its -contents: dir(Blender.BGL). A simple search on the net can point to more -than enough material to teach OpenGL programming, from books to many -collections of tutorials. - -The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning -OpenGL}" and the online NeHe tutorials are two of the best resources. - -Example:: - import Blender - from Blender.BGL import * - from Blender import Draw - R = G = B = 0 - A = 1 - title = "Testing BGL + Draw" - instructions = "Use mouse buttons or wheel to change the background color." - quitting = " Press ESC or q to quit." - len1 = Draw.GetStringWidth(title) - len2 = Draw.GetStringWidth(instructions + quitting) - # - def show_win(): - glClearColor(R,G,B,A) # define color used to clear buffers - glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer - glColor3f(0.35,0.18,0.92) # define default color - glBegin(GL_POLYGON) # begin a vertex data list - glVertex2i(165, 158) - glVertex2i(252, 55) - glVertex2i(104, 128) - glEnd() - glColor3f(0.4,0.4,0.4) # change default color - glRecti(40, 96, 60+len1, 113) - glColor3f(1,1,1) - glRasterPos2i(50,100) # move cursor to x = 50, y = 100 - Draw.Text(title) # draw this text there - glRasterPos2i(350,40) # move cursor again - Draw.Text(instructions + quitting) # draw another msg - glBegin(GL_LINE_LOOP) # begin a vertex-data list - glVertex2i(46,92) - glVertex2i(120,92) - glVertex2i(120,115) - glVertex2i(46,115) - glEnd() # close this list - # - def ev(evt, val): # event callback for Draw.Register() - global R,G,B,A # ... it handles input events - if evt == Draw.ESCKEY or evt == Draw.QKEY: - Draw.Exit() # this quits the script - elif not val: return - elif evt == Draw.LEFTMOUSE: R = 1 - R - elif evt == Draw.MIDDLEMOUSE: G = 1 - G - elif evt == Draw.RIGHTMOUSE: B = 1 - B - elif evt == Draw.WHEELUPMOUSE: - R += 0.1 - if R > 1: R = 1 - elif evt == Draw.WHEELDOWNMOUSE: - R -= 0.1 - if R < 0: R = 0 - else: - return # don't redraw if nothing changed - Draw.Redraw(1) # make changes visible. - # - Draw.Register(show_win, ev, None) # start the main loop - -@note: you can use the L{Image} module and L{Image.Image} BPy object to load - and set textures. See L{Image.Image.glLoad} and L{Image.Image.glFree}, - for example. -@see: U{www.opengl.org} -@see: U{nehe.gamedev.net} -""" - -def glAccum(op, value): - """ - Operate on the accumulation buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html} - - @type op: Enumerated constant - @param op: The accumulation buffer operation. - @type value: float - @param value: a value used in the accumulation buffer operation. - """ - -def glAlphaFunc(func, ref): - """ - Specify the alpha test function - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html} - - @type func: Enumerated constant - @param func: Specifies the alpha comparison function. - @type ref: float - @param ref: The reference value that incoming alpha values are compared to. - Clamped between 0 and 1. - """ - -def glAreTexturesResident(n, textures, residences): - """ - Determine if textures are loaded in texture memory - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html} - - @type n: int - @param n: Specifies the number of textures to be queried. - @type textures: Buffer object I{type GL_INT} - @param textures: Specifies an array containing the names of the textures to be queried - @type residences: Buffer object I{type GL_INT}(boolean) - @param residences: An array in which the texture residence status in returned.The residence status of a - texture named by an element of textures is returned in the corresponding element of residences. - """ - -def glBegin(mode): - """ - Delimit the vertices of a primitive or a group of like primatives - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} - - @type mode: Enumerated constant - @param mode: Specifies the primitive that will be create from vertices between glBegin and - glEnd. - """ - -def glBindTexture(target, texture): - """ - Bind a named texture to a texturing target - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html} - - @type target: Enumerated constant - @param target: Specifies the target to which the texture is bound. - @type texture: unsigned int - @param texture: Specifies the name of a texture. - """ - -def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap): - """ - Draw a bitmap - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html} - - @type width, height: int - @param width, height: Specify the pixel width and height of the bitmap image. - @type xorig, yorig: float - @param xorig, yorig: Specify the location of the origin in the bitmap image. The origin is measured - from the lower left corner of the bitmap, with right and up being the positive axes. - @type xmove, ymove: float - @param xmove, ymove: Specify the x and y offsets to be added to the current raster position after - the bitmap is drawn. - @type bitmap: Buffer object I{type GL_BYTE} - @param bitmap: Specifies the address of the bitmap image. - """ - -def glBlendFunc(sfactor, dfactor): - """ - Specify pixel arithmetic - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html} - - @type sfactor: Enumerated constant - @param sfactor: Specifies how the red, green, blue, and alpha source blending factors are - computed. - @type dfactor: Enumerated constant - @param dfactor: Specifies how the red, green, blue, and alpha destination blending factors are - computed. - """ - -def glCallList(list): - """ - Execute a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html} - - @type list: unsigned int - @param list: Specifies the integer name of the display list to be executed. - """ - -def glCallLists(n, type, lists): - """ - Execute a list of display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html} - - @type n: int - @param n: Specifies the number of display lists to be executed. - @type type: Enumerated constant - @param type: Specifies the type of values in lists. - @type lists: Buffer object - @param lists: Specifies the address of an array of name offsets in the display list. - The pointer type is void because the offsets can be bytes, shorts, ints, or floats, - depending on the value of type. - """ - -def glClear(mask): - """ - Clear buffers to preset values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html} - - @type mask: Enumerated constant(s) - @param mask: Bitwise OR of masks that indicate the buffers to be cleared. - """ - -def glClearAccum(red, green, blue, alpha): - """ - Specify clear values for the accumulation buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html} - - @type red, green, blue, alpha: float - @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the - accumulation buffer is cleared. The initial values are all 0. - """ - -def glClearColor(red, green, blue, alpha): - """ - Specify clear values for the color buffers - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html} - - @type red, green, blue, alpha: float - @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the - color buffers are cleared. The initial values are all 0. - """ - -def glClearDepth(depth): - """ - Specify the clear value for the depth buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html} - - @type depth: int - @param depth: Specifies the depth value used when the depth buffer is cleared. - The initial value is 1. - """ - -def glClearIndex(c): - """ - Specify the clear value for the color index buffers - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html} - - @type c: float - @param c: Specifies the index used when the color index buffers are cleared. - The initial value is 0. - """ - -def glClearStencil(s): - """ - Specify the clear value for the stencil buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html} - - @type s: int - @param s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. - """ - -def glClipPlane (plane, equation): - """ - Specify a plane against which all geometry is clipped - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html} - - @type plane: Enumerated constant - @param plane: Specifies which clipping plane is being positioned. - @type equation: Buffer object I{type GL_FLOAT}(double) - @param equation: Specifies the address of an array of four double- precision floating-point - values. These values are interpreted as a plane equation. - """ - -def glColor (red, green, blue, alpha): - """ - B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, - glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, - glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, - glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, - glColor4uiv, glColor4usv} - - Set a new color. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html} - - @type red, green, blue, alpha: Depends on function prototype. - @param red, green, blue: Specify new red, green, and blue values for the current color. - @param alpha: Specifies a new alpha value for the current color. Included only in the - four-argument glColor4 commands. (With '4' colors only) - """ - -def glColorMask(red, green, blue, alpha): - """ - Enable and disable writing of frame buffer color components - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html} - - @type red, green, blue, alpha: int (boolean) - @param red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be - written into the frame buffer. The initial values are all GL_TRUE, indicating that the - color components can be written. - """ - -def glColorMaterial(face, mode): - """ - Cause a material color to track the current color - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html} - - @type face: Enumerated constant - @param face: Specifies whether front, back, or both front and back material parameters should - track the current color. - @type mode: Enumerated constant - @param mode: Specifies which of several material parameters track the current color. - """ - -def glCopyPixels(x, y, width, height, type): - """ - Copy pixels in the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html} - - @type x, y: int - @param x, y: Specify the window coordinates of the lower left corner of the rectangular - region of pixels to be copied. - @type width, height: int - @param width,height: Specify the dimensions of the rectangular region of pixels to be copied. - Both must be non-negative. - @type type: Enumerated constant - @param type: Specifies whether color values, depth values, or stencil values are to be copied. - """ - - def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border): - """ - Copy pixels into a 2D texture image - @see: U{www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @type x, y: int - @param x, y:Specify the window coordinates of the first pixel that is copied - from the frame buffer. This location is the lower left corner of a rectangular - block of pixels. - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. - @type height: int - @param height: Specifies the height of the texture image. Must be 2m+2(border) for - some integer m. All implementations support texture images that are at least 64 - texels high. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - """ - -def glCullFace(mode): - """ - Specify whether front- or back-facing facets can be culled - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html} - - @type mode: Enumerated constant - @param mode: Specifies whether front- or back-facing facets are candidates for culling. - """ - -def glDeleteLists(list, range): - """ - Delete a contiguous group of display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html} - - @type list: unsigned int - @param list: Specifies the integer name of the first display list to delete - @type range: int - @param range: Specifies the number of display lists to delete - """ - -def glDeleteTextures(n, textures): - """ - Delete named textures - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html} - - @type n: int - @param n: Specifies the number of textures to be deleted - @type textures: Buffer I{GL_INT} - @param textures: Specifies an array of textures to be deleted - """ - -def glDepthFunc(func): - """ - Specify the value used for depth buffer comparisons - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html} - - @type func: Enumerated constant - @param func: Specifies the depth comparison function. - """ - -def glDepthMask(flag): - """ - Enable or disable writing into the depth buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html} - - @type flag: int (boolean) - @param flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, - depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer - writing is enabled. - """ - -def glDepthRange(zNear, zFar): - """ - Specify mapping of depth values from normalized device coordinates to window coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html} - - @type zNear: int - @param zNear: Specifies the mapping of the near clipping plane to window coordinates. - The initial value is 0. - @type zFar: int - @param zFar: Specifies the mapping of the far clipping plane to window coordinates. - The initial value is 1. - """ - -def glDisable(cap): - """ - Disable server-side GL capabilities - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} - - @type cap: Enumerated constant - @param cap: Specifies a symbolic constant indicating a GL capability. - """ - -def glDrawBuffer(mode): - """ - Specify which color buffers are to be drawn into - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html} - - @type mode: Enumerated constant - @param mode: Specifies up to four color buffers to be drawn into. - """ - -def glDrawPixels(width, height, format, type, pixels): - """ - Write a block of pixels to the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html} - - @type width, height: int - @param width, height: Specify the dimensions of the pixel rectangle to be - written into the frame buffer. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type for pixels. - @type pixels: Buffer object - @param pixels: Specifies a pointer to the pixel data. - """ - -def glEdgeFlag (flag): - """ - B{glEdgeFlag, glEdgeFlagv} - - Flag edges as either boundary or non-boundary - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html} - - @type flag: Depends of function prototype - @param flag: Specifies the current edge flag value.The initial value is GL_TRUE. - """ - -def glEnable(cap): - """ - Enable server-side GL capabilities - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} - - @type cap: Enumerated constant - @param cap: Specifies a symbolic constant indicating a GL capability. - """ - -def glEnd(): - """ - Delimit the vertices of a primitive or group of like primitives - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} - """ - -def glEndList(): - """ - Create or replace a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} - """ - -def glEvalCoord (u,v): - """ - B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, - glEvalCoord2dv, glEvalCoord2fv} - - Evaluate enabled one- and two-dimensional maps - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html} - - @type u: Depends on function prototype. - @param u: Specifies a value that is the domain coordinate u to the basis function defined - in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then - u specifies a pointer to an array containing either one or two domain coordinates. The first - coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. - @type v: Depends on function prototype. (only with '2' prototypes) - @param v: Specifies a value that is the domain coordinate v to the basis function defined - in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. - """ - -def glEvalMesh (mode, i1, i2): - """ - B{glEvalMesh1 or glEvalMesh2} - - Compute a one- or two-dimensional grid of points or lines - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html} - - @type mode: Enumerated constant - @param mode: In glEvalMesh1, specifies whether to compute a one-dimensional - mesh of points or lines. - @type i1, i2: int - @param i1, i2: Specify the first and last integer values for the grid domain variable i. - """ - -def glEvalPoint (i, j): - """ - B{glEvalPoint1 and glEvalPoint2} - - Generate and evaluate a single point in a mesh - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html} - - @type i: int - @param i: Specifies the integer value for grid domain variable i. - @type j: int (only with '2' prototypes) - @param j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). - """ - -def glFeedbackBuffer (size, type, buffer): - """ - Controls feedback mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html} - - @type size: int - @param size:Specifies the maximum number of values that can be written into buffer. - @type type: Enumerated constant - @param type:Specifies a symbolic constant that describes the information that - will be returned for each vertex. - @type buffer: Buffer object I{GL_FLOAT} - @param buffer: Returns the feedback data. - """ - -def glFinish(): - """ - Block until all GL execution is complete - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html} - """ - -def glFlush(): - """ - Force Execution of GL commands in finite time - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html} - """ - -def glFog (pname, param): - """ - B{glFogf, glFogi, glFogfv, glFogiv} - - Specify fog parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html} - - @type pname: Enumerated constant - @param pname: Specifies a single-valued fog parameter. If the function prototype - ends in 'v' specifies a fog parameter. - @type param: Depends on function prototype. - @param param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR - requires an array of four values. All other parameters accept an array containing - only a single value. - """ - -def glFrontFace(mode): - """ - Define front- and back-facing polygons - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html} - - @type mode: Enumerated constant - @param mode: Specifies the orientation of front-facing polygons. - """ - -def glFrustum(left, right, bottom, top, zNear, zFar): - """ - Multiply the current matrix by a perspective matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html} - - @type left, right: double (float) - @param left, right: Specify the coordinates for the left and right vertical - clipping planes. - @type top, bottom: double (float) - @param top, bottom: Specify the coordinates for the bottom and top horizontal - clipping planes. - @type zNear, zFar: double (float) - @param zNear, zFar: Specify the distances to the near and far depth clipping planes. - Both distances must be positive. - """ - -def glGenLists(range): - """ - Generate a contiguous set of empty display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html} - - @type range: int - @param range: Specifies the number of contiguous empty display lists to be generated. - """ - -def glGenTextures(n, textures): - """ - Generate texture names - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html} - - @type n: int - @param n: Specifies the number of textures name to be generated. - @type textures: Buffer object I{type GL_INT} - @param textures: Specifies an array in which the generated textures names are stored. - """ - -def glGet (pname, param): - """ - B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} - - Return the value or values of a selected parameter - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html} - - @type pname: Enumerated constant - @param pname: Specifies the parameter value to be returned. - @type param: Depends on function prototype. - @param param: Returns the value or values of the specified parameter. - """ - -def glGetClipPlane(plane, equation): - """ - Return the coefficients of the specified clipping plane - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html} - - @type plane: Enumerated constant - @param plane: Specifies a clipping plane. The number of clipping planes depends on the - implementation, but at least six clipping planes are supported. They are identified by - symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. - @type equation: Buffer object I{type GL_FLOAT} - @param equation: Returns four float (double)-precision values that are the coefficients of the - plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). - """ - -def glGetError(): - """ - Return error information - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html} - """ - -def glGetLight (light, pname, params): - """ - B{glGetLightfv and glGetLightiv} - - Return light source parameter values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html} - - @type light: Enumerated constant - @param light: Specifies a light source. The number of possible lights depends on the - implementation, but at least eight lights are supported. They are identified by symbolic - names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. - @type pname: Enumerated constant - @param pname: Specifies a light source parameter for light. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetMap (target, query, v): - """ - B{glGetMapdv, glGetMapfv, glGetMapiv} - - Return evaluator parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of a map. - @type query: Enumerated constant - @param query: Specifies which parameter to return. - @type v: Buffer object. Depends on function prototype. - @param v: Returns the requested data. - """ - -def glGetMaterial (face, pname, params): - """ - B{glGetMaterialfv, glGetMaterialiv} - - Return material parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html} - - @type face: Enumerated constant - @param face: Specifies which of the two materials is being queried. - representing the front and back materials, respectively. - @type pname: Enumerated constant - @param pname: Specifies the material parameter to return. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetPixelMap (map, values): - """ - B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} - - Return the specified pixel map - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html} - - @type map: Enumerated constant - @param map: Specifies the name of the pixel map to return. - @type values: Buffer object. Depends on function prototype. - @param values: Returns the pixel map contents. - """ - -def glGetPolygonStipple(mask): - """ - Return the polygon stipple pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html} - - @type mask: Buffer object I{type GL_BYTE} - @param mask: Returns the stipple pattern. The initial value is all 1's. - """ - -def glGetString(name): - """ - Return a string describing the current GL connection - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html} - - @type name: Enumerated constant - @param name: Specifies a symbolic constant. - - """ - -def glGetTexEnv (target, pname, params): - """ - B{glGetTexEnvfv, glGetTexEnviv} - - Return texture environment parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html} - - @type target: Enumerated constant - @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a texture environment parameter. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexGen (coord, pname, params): - """ - B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} - - Return texture coordinate generation parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html} - - @type coord: Enumerated constant - @param coord: Specifies a texture coordinate. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the value(s) to be returned. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexImage(target, level, format, type, pixels): - """ - Return a texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html} - - @type target: Enumerated constant - @param target: Specifies which texture is to be obtained. - @type level: int - @param level: Specifies the level-of-detail number of the desired image. - Level 0 is the base image level. Level n is the nth mipmap reduction image. - @type format: Enumerated constant - @param format: Specifies a pixel format for the returned data. - @type type: Enumerated constant - @param type: Specifies a pixel type for the returned data. - @type pixels: Buffer object. - @param pixels: Returns the texture image. Should be a pointer to an array of the - type specified by type - """ - -def glGetTexLevelParameter (target, level, pname, params): - """ - B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} - - return texture parameter values for a specific level of detail - @see: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of the target texture. - @type level: int - @param level: Specifies the level-of-detail number of the desired image. - Level 0 is the base image level. Level n is the nth mipmap reduction image. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a texture parameter. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexParameter (target, pname, params): - """ - B{glGetTexParameterfv, glGetTexParameteriv} - - Return texture parameter values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of the target texture. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name the target texture. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the texture parameters. - """ - -def glHint(target, mode): - """ - Specify implementation-specific hints - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html} - - @type target: Enumerated constant - @param target: Specifies a symbolic constant indicating the behavior to be - controlled. - @type mode: Enumerated constant - @param mode: Specifies a symbolic constant indicating the desired behavior. - """ - -def glIndex (c): - """ - B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} - - Set the current color index - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html} - - @type c: Buffer object. Depends on function prototype. - @param c: Specifies a pointer to a one element array that contains the new value for - the current color index. - """ - -def glInitNames(): - """ - Initialize the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html} - """ - -def glIsEnabled(cap): - """ - Test whether a capability is enabled - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html} - - @type cap: Enumerated constant - @param cap: Specifies a constant representing a GL capability. - """ - -def glIsList(list): - """ - Determine if a name corresponds to a display-list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html} - - @type list: unsigned int - @param list: Specifies a potential display-list name. - """ - -def glIsTexture(texture): - """ - Determine if a name corresponds to a texture - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html} - - @type texture: unsigned int - @param texture: Specifies a value that may be the name of a texture. - """ - -def glLight (light, pname, param): - """ - B{glLightf,glLighti, glLightfv, glLightiv} - - Set the light source parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html} - - @type light: Enumerated constant - @param light: Specifies a light. The number of lights depends on the implementation, - but at least eight lights are supported. They are identified by symbolic names of the - form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. - @type pname: Enumerated constant - @param pname: Specifies a single-valued light source parameter for light. - @type param: Depends on function prototype. - @param param: Specifies the value that parameter pname of light source light will be set to. - If function prototype ends in 'v' specifies a pointer to the value or values that - parameter pname of light source light will be set to. - """ - -def glLightModel (pname, param): - """ - B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} - - Set the lighting model parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html} - - @type pname: Enumerated constant - @param pname: Specifies a single-value light model parameter. - @type param: Depends on function prototype. - @param param: Specifies the value that param will be set to. If function prototype ends in 'v' - specifies a pointer to the value or values that param will be set to. - """ - -def glLineStipple(factor, pattern): - """ - Specify the line stipple pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html} - - @type factor: int - @param factor: Specifies a multiplier for each bit in the line stipple pattern. - If factor is 3, for example, each bit in the pattern is used three times before - the next bit in the pattern is used. factor is clamped to the range [1, 256] and - defaults to 1. - @type pattern: unsigned short int - @param pattern: Specifies a 16-bit integer whose bit pattern determines which fragments - of a line will be drawn when the line is rasterized. Bit zero is used first; the default - pattern is all 1's. - """ - -def glLineWidth(width): - """ - Specify the width of rasterized lines. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html} - - @type width: float - @param width: Specifies the width of rasterized lines. The initial value is 1. - """ - -def glListBase(base): - """ - Set the display-list base for glCallLists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html} - - @type base: unsigned int - @param base: Specifies an integer offset that will be added to glCallLists - offsets to generate display-list names. The initial value is 0. - """ - -def glLoadIdentity(): - """ - Replace the current matrix with the identity matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html} - """ - -def glLoadMatrix (m): - """ - B{glLoadMatrixd, glLoadMatixf} - - Replace the current matrix with the specified matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html} - - @type m: Buffer object. Depends on function prototype. - @param m: Specifies a pointer to 16 consecutive values, which are used as the elements - of a 4x4 column-major matrix. - """ - -def glLoadName(name): - """ - Load a name onto the name stack. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html} - - @type name: unsigned int - @param name: Specifies a name that will replace the top value on the name stack. - """ - -def glLogicOp(opcode): - """ - Specify a logical pixel operation for color index rendering - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html} - - @type opcode: Enumerated constant - @param opcode: Specifies a symbolic constant that selects a logical operation. - """ - -def glMap1 (target, u1, u2, stride, order, points): - """ - B{glMap1d, glMap1f} - - Define a one-dimensional evaluator - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html} - - @type target: Enumerated constant - @param target: Specifies the kind of values that are generated by the evaluator. - @type u1, u2: Depends on function prototype. - @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t - he variable that is evaluated by the equations specified by this command. - @type stride: int - @param stride: Specifies the number of floats or float (double)s between the beginning - of one control point and the beginning of the next one in the data structure - referenced in points. This allows control points to be embedded in arbitrary data - structures. The only constraint is that the values for a particular control point must - occupy contiguous memory locations. - @type order: int - @param order: Specifies the number of control points. Must be positive. - @type points: Buffer object. Depends on function prototype. - @param points: Specifies a pointer to the array of control points. - """ - -def glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points): - """ - B{glMap2d, glMap2f} - - Define a two-dimensional evaluator - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html} - - @type target: Enumerated constant - @param target: Specifies the kind of values that are generated by the evaluator. - @type u1, u2: Depends on function prototype. - @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t - he variable that is evaluated by the equations specified by this command. Initially - u1 is 0 and u2 is 1. - @type ustride: int - @param ustride: Specifies the number of floats or float (double)s between the beginning - of control point R and the beginning of control point R ij, where i and j are the u - and v control point indices, respectively. This allows control points to be embedded - in arbitrary data structures. The only constraint is that the values for a particular - control point must occupy contiguous memory locations. The initial value of ustride is 0. - @type uorder: int - @param uorder: Specifies the dimension of the control point array in the u axis. - Must be positive. The initial value is 1. - @type v1, v2: Depends on function prototype. - @param v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, to ^, - one of the two variables that are evaluated by the equations specified by this command. - Initially, v1 is 0 and v2 is 1. - @type vstride: int - @param vstride: Specifies the number of floats or float (double)s between the beginning of control - point R and the beginning of control point R ij, where i and j are the u and v control - point(indices, respectively. This allows control points to be embedded in arbitrary data - structures. The only constraint is that the values for a particular control point must - occupy contiguous memory locations. The initial value of vstride is 0. - @type vorder: int - @param vorder: Specifies the dimension of the control point array in the v axis. - Must be positive. The initial value is 1. - @type points: Buffer object. Depends on function prototype. - @param points: Specifies a pointer to the array of control points. - """ - -def glMapGrid (un, u1,u2 ,vn, v1, v2): - """ - B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} - - Define a one- or two-dimensional mesh - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html} - - @type un: int - @param un: Specifies the number of partitions in the grid range interval - [u1, u2]. Must be positive. - @type u1, u2: Depends on function prototype. - @param u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. - @type vn: int - @param vn: Specifies the number of partitions in the grid range interval [v1, v2] - (glMapGrid2 only). - @type v1, v2: Depends on function prototype. - @param v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn - (glMapGrid2 only). - """ - -def glMaterial (face, pname, params): - """ - Specify material parameters for the lighting model. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html} - - @type face: Enumerated constant - @param face: Specifies which face or faces are being updated. Must be one of: - @type pname: Enumerated constant - @param pname: Specifies the single-valued material parameter of the face - or faces that is being updated. Must be GL_SHININESS. - @type params: int - @param params: Specifies the value that parameter GL_SHININESS will be set to. - If function prototype ends in 'v' specifies a pointer to the value or values that - pname will be set to. - """ - -def glMatrixMode(mode): - """ - Specify which matrix is the current matrix. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html} - - @type mode: Enumerated constant - @param mode: Specifies which matrix stack is the target for subsequent matrix operations. - """ - -def glMultMatrix (m): - """ - B{glMultMatrixd, glMultMatrixf} - - Multiply the current matrix with the specified matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html} - - @type m: Buffer object. Depends on function prototype. - @param m: Points to 16 consecutive values that are used as the elements of a 4x4 column - major matrix. - """ - -def glNewList(list, mode): - """ - Create or replace a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} - - @type list: unsigned int - @param list: Specifies the display list name - @type mode: Enumerated constant - @param mode: Specifies the compilation mode. - """ - -def glNormal3 (nx, ny, nz, v): - """ - B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, - Normal3s, Normal3sv} - - Set the current normal vector - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html} - - @type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) - @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. - The initial value of the current normal is the unit vector, (0, 0, 1). - @type v: Buffer object. Depends on function prototype. ('v' prototypes) - @param v: Specifies a pointer to an array of three elements: the x, y, and z coordinates - of the new current normal. - """ - -def glOrtho(left, right, bottom, top, zNear, zFar): - """ - Multiply the current matrix with an orthographic matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html} - - @type left, right: double (float) - @param left, right: Specify the coordinates for the left and - right vertical clipping planes. - @type bottom, top: double (float) - @param bottom, top: Specify the coordinates for the bottom and top - horizontal clipping planes. - @type zNear, zFar: double (float) - @param zNear, zFar: Specify the distances to the nearer and farther - depth clipping planes. These values are negative if the plane is to be behind the viewer. - """ - -def glPassThrough(token): - """ - Place a marker in the feedback buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html} - - @type token: float - @param token: Specifies a marker value to be placed in the feedback - buffer following a GL_PASS_THROUGH_TOKEN. - """ - -def glPixelMap (map, mapsize, values): - """ - B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} - - Set up pixel transfer maps - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html} - - @type map: Enumerated constant - @param map: Specifies a symbolic map name. - @type mapsize: int - @param mapsize: Specifies the size of the map being defined. - @type values: Buffer object. Depends on function prototype. - @param values: Specifies an array of mapsize values. - """ - -def glPixelStore (pname, param): - """ - B{glPixelStoref, glPixelStorei} - - Set pixel storage modes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html} - - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the parameter to be set. - Six values affect the packing of pixel data into memory. - Six more affect the unpacking of pixel data from memory. - @type param: Depends on function prototype. - @param param: Specifies the value that pname is set to. - """ - -def glPixelTransfer (pname, param): - """ - B{glPixelTransferf, glPixelTransferi} - - Set pixel transfer modes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html} - - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the pixel transfer parameter to be set. - @type param: Depends on function prototype. - @param param: Specifies the value that pname is set to. - """ - -def glPixelZoom(xfactor, yfactor): - """ - Specify the pixel zoom factors - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html} - - @type xfactor, yfactor: float - @param xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. - """ - -def glPointSize(size): - """ - Specify the diameter of rasterized points - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html} - - @type size: float - @param size: Specifies the diameter of rasterized points. The initial value is 1. - """ - -def glPolygonMode(face, mode): - """ - Select a polygon rasterization mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html} - - @type face: Enumerated constant - @param face: Specifies the polygons that mode applies to. - Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing polygons, - or GL_FRONT_AND_BACK for front- and back-facing polygons. - @type mode: Enumerated constant - @param mode: Specifies how polygons will be rasterized. - The initial value is GL_FILL for both front- and back- facing polygons. - """ - -def glPolygonOffset(factor, units): - """ - Set the scale and units used to calculate depth values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html} - - @type factor: float - @param factor: Specifies a scale factor that is used to create a variable depth - offset for each polygon. The initial value is 0. - @type units: float - @param units: Is multiplied by an implementation-specific value to create a constant - depth offset. The initial value is 0. - """ - -def glPolygonStipple(mask): - """ - Set the polygon stippling pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html} - - @type mask: Buffer object I{type GL_BYTE} - @param mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked - from memory in the same way that glDrawPixels unpacks pixels. - """ - -def glPopAttrib(): - """ - Pop the server attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} - """ - -def glPopClientAttrib(): - """ - Pop the client attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} - """ - -def glPopMatrix(): - """ - Pop the current matrix stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} - """ - -def glPopName(): - """ - Pop the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} - """ - -def glPrioritizeTextures(n, textures, priorities): - """ - Set texture residence priority - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html} - - @type n: int - @param n:Specifies the number of textures to be prioritized. - @type textures: Buffer I{type GL_INT} - @param textures: Specifies an array containing the names of the textures to be prioritized. - @type priorities: Buffer I{type GL_FLOAT} - @param priorities: Specifies an array containing the texture priorities. A priority given - in an element of priorities applies to the texture named by the corresponding element of textures. - """ - -def glPushAttrib(mask): - """ - Push the server attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} - - @type mask: Enumerated constant(s) - @param mask: Specifies a mask that indicates which attributes to save. - """ - -def glPushClientAttrib(mask): - """ - Push the client attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} - - @type mask: Enumerated constant(s) - @param mask: Specifies a mask that indicates which attributes to save. - """ - -def glPushMatrix(): - """ - Push the current matrix stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} - """ - -def glPushName(name): - """ - Push the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} - - @type name: unsigned int - @param name: Specifies a name that will be pushed onto the name stack. - """ - -def glRasterPos (x,y,z,w): - """ - B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, - glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, - glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, - glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, - glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} - - Specify the raster position for pixel operations - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html} - - @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) - @param x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the - raster position. If function prototype ends in 'v' specifies a pointer to an array of two, - three, or four elements, specifying x, y, z, and w coordinates, respectively. - @note: - If you are drawing to the 3d view with a Scriptlink of a space handler - the zoom level of the panels will scale the glRasterPos by the view matrix. - so a X of 10 will not always offset 10 pixels as you would expect. - - To work around this get the scale value of the view matrix and use it to scale your pixel values. - - Workaround:: - - import Blender - from Blender.BGL import * - xval, yval= 100, 40 - # Get the scale of the view matrix - viewMatrix = Buffer(GL_FLOAT, 16) - glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix) - f = 1/viewMatrix[0] - glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval) - """ - -def glReadBuffer(mode): - """ - Select a color buffer source for pixels. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html} - - @type mode: Enumerated constant - @param mode: Specifies a color buffer. - """ - -def glReadPixels(x, y, width, height, format, type, pixels): - """ - Read a block of pixels from the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html} - - @type x, y: int - @param x, y:Specify the window coordinates of the first pixel that is read - from the frame buffer. This location is the lower left corner of a rectangular - block of pixels. - @type width, height: int - @param width, height: Specify the dimensions of the pixel rectangle. width and - height of one correspond to a single pixel. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object - @param pixels: Returns the pixel data. - """ - -def glRect (x1,y1,x2,y2,v1,v2): - """ - B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} - - Draw a rectangle - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html} - - @type x1, y1: Depends on function prototype. (for non 'v' prototypes only) - @param x1, y1: Specify one vertex of a rectangle - @type x2, y2: Depends on function prototype. (for non 'v' prototypes only) - @param x2, y2: Specify the opposite vertex of the rectangle - @type v1, v2: Depends on function prototype. (for 'v' prototypes only) - @param v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer - to the opposite vertex of the rectangle - """ - -def glRenderMode(mode): - """ - Set rasterization mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html} - - @type mode: Enumerated constant - @param mode: Specifies the rasterization mode. - """ - -def glRotate (angle, x, y, z): - """ - B{glRotated, glRotatef} - - Multiply the current matrix by a rotation matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html} - - @type angle: Depends on function prototype. - @param angle: Specifies the angle of rotation in degrees. - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify the x, y, and z coordinates of a vector respectively. - """ - -def glScale (x,y,z): - """ - B{glScaled, glScalef} - - Multiply the current matrix by a general scaling matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html} - - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify scale factors along the x, y, and z axes, respectively. - """ - -def glScissor(x,y,width,height): - """ - Define the scissor box - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html} - - @type x, y: int - @param x, y: Specify the lower left corner of the scissor box. Initially (0, 0). - @type width, height: int - @param width height: Specify the width and height of the scissor box. When a - GL context is first attached to a window, width and height are set to the - dimensions of that window. - """ - -def glSelectBuffer(size, buffer): - """ - Establish a buffer for selection mode values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html} - - @type size: int - @param size: Specifies the size of buffer - @type buffer: Buffer I{type GL_INT} - @param buffer: Returns the selection data - """ - -def glShadeModel(mode): - """ - Select flat or smooth shading - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html} - - @type mode: Enumerated constant - @param mode: Specifies a symbolic value representing a shading technique. - """ - -def glStencilFuc(func, ref, mask): - """ - Set function and reference value for stencil testing - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html} - - @type func: Enumerated constant - @param func:Specifies the test function. - @type ref: int - @param ref:Specifies the reference value for the stencil test. ref is clamped to - the range [0,2n-1], where n is the number of bitplanes in the stencil buffer. - The initial value is 0. - @type mask: unsigned int - @param mask:Specifies a mask that is ANDed with both the reference value and - the stored stencil value when the test is done. The initial value is all 1's. - """ - -def glStencilMask(mask): - """ - Control the writing of individual bits in the stencil planes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html} - - @type mask: unsigned int - @param mask: Specifies a bit mask to enable and disable writing of individual bits - in the stencil planes. Initially, the mask is all 1's. - """ - -def glStencilOp(fail, zfail, zpass): - """ - Set stencil test actions - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html} - - @type fail: Enumerated constant - @param fail: Specifies the action to take when the stencil test fails. - The initial value is GL_KEEP. - @type zfail: Enumerated constant - @param zfail: Specifies the stencil action when the stencil test passes, but the - depth test fails. zfail accepts the same symbolic constants as fail. - The initial value is GL_KEEP. - @type zpass: Enumerated constant - @param zpass: Specifies the stencil action when both the stencil test and the - depth test pass, or when the stencil test passes and either there is no depth - buffer or depth testing is not enabled. zpass accepts the same symbolic constants - as fail. The initial value is GL_KEEP. - """ - -def glTexCoord (s,t,r,q,v): - """ - B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, - glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, - glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, - glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, - glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, - glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} - - Set the current texture coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html} - - @type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) - @param s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are - present in all forms of the command. - @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only) - @param v: Specifies a pointer to an array of one, two, three, or four elements, - which in turn specify the s, t, r, and q texture coordinates. - """ - -def glTexEnv (target, pname, param): - """ - B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} - - Set texture environment parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html} - - @type target: Enumerated constant - @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a single-valued texture environment - parameter. Must be GL_TEXTURE_ENV_MODE. - @type param: Depends on function prototype. - @param param: Specifies a single symbolic constant. If function prototype ends in 'v' - specifies a pointer to a parameter array that contains either a single symbolic - constant or an RGBA color - """ - -def glTexGen (coord, pname, param): - """ - B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} - - Control the generation of texture coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html} - - @type coord: Enumerated constant - @param coord: Specifies a texture coordinate. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the texture- coordinate generation function. - @type param: Depends on function prototype. - @param param: Specifies a single-valued texture generation parameter. - If function prototype ends in 'v' specifies a pointer to an array of texture - generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must - contain a single symbolic constant. Otherwise, params holds the coefficients - for the texture-coordinate generation function specified by pname. - """ - -def glTexImage1D(target, level, internalformat, width, border, format, type, pixels): - """ - Specify a one-dimensional texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. The height of the 1D texture image is 1. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object. - @param pixels: Specifies a pointer to the image data in memory. - """ - -def glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels): - """ - Specify a two-dimensional texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. - @type height: int - @param height: Specifies the height of the texture image. Must be 2m+2(border) for - some integer m. All implementations support texture images that are at least 64 - texels high. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object. - @param pixels: Specifies a pointer to the image data in memory. - """ - -def glTexParameter (target, pname, param): - """ - B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} - - Set texture parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a single-valued texture parameter. - @type param: Depends on function prototype. - @param param: Specifies the value of pname. If function prototype ends in 'v' specifies - a pointer to an array where the value or values of pname are stored. - """ - -def glTranslate (x, y, z): - """ - B{glTranslatef, glTranslated} - - Multiply the current matrix by a translation matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html} - - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify the x, y, and z coordinates of a translation vector. - """ - -def glVertex (x,y,z,w,v): - """ - B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, - glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, - glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, - glVertex4fv, glVertex4iv, glVertex4sv} - - Specify a vertex - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html} - - @type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) - @param x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters - are present in all forms of the command. - @type v: Buffer object. Depends of function prototype (for 'v' prototypes only) - @param v: Specifies a pointer to an array of two, three, or four elements. The - elements of a two-element array are x and y; of a three-element array, x, y, and z; - and of a four-element array, x, y, z, and w. - """ - -def glViewport(x,y,width,height): - """ - Set the viewport - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html} - - @type x, y: int - @param x, y: Specify the lower left corner of the viewport rectangle, - in pixels. The initial value is (0,0). - @type width, height: int - @param width, height: Specify the width and height of the viewport. When a GL context - is first attached to a window, width and height are set to the dimensions of that window. - """ - -def gluPerspective(fovY, aspect, zNear, zFar): - """ - Set up a perspective projection matrix. - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288} - - @type fovY: double - @param fovY: Specifies the field of view angle, in degrees, in the y direction. - @type aspect: double - @param aspect: Specifies the aspect ratio that determines the field of view in the x direction. - The aspect ratio is the ratio of x (width) to y (height). - @type zNear: double - @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive). - @type zFar: double - @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive). - """ - -def gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz): - """ - Define a viewing transformation - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042} - - @type eyex, eyey, eyez: double - @param eyex, eyey, eyez: Specifies the position of the eye point. - @type centerx, centery, centerz: double - @param centerx, centery, centerz: Specifies the position of the reference point. - @type upx, upy, upz: double - @param upx, upy, upz: Specifies the direction of the up vector. - """ - -def gluOrtho2D(left, right, bottom, top): - """ - Define a 2-D orthographic projection matrix - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} - - @type left, right: double - @param left, right: Specify the coordinates for the left and right vertical clipping planes. - @type bottom, top: double - @param bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. - """ - -def gluPickMatrix(x, y, width, height, viewport): - """ - Define a picking region - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} - - @type x, y: double - @param x, y: Specify the center of a picking region in window coordinates. - @type width, height: double - @param width, height: Specify the width and height, respectively, of the picking region in window coordinates. - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport. - """ - -def gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz): - """ - Map object coordinates to window coordinates. - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} - - @type objx, objy, objz: double - @param objx, objy, objz: Specify the object coordinates. - @type modelMatrix: Buffer object. [double] - @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). - @type projMatrix: Buffer object. [double] - @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport (as from a glGetIntegerv call). - @type winx, winy, winz: Buffer object. [double] - @param winx, winy, winz: Return the computed window coordinates. - """ - -def gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz): - """ - Map object coordinates to window - coordinates. - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204} - - @type winx, winy, winz: double - @param winx, winy, winz: Specify the window coordinates to be mapped. - @type modelMatrix: Buffer object. [double] - @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). - @type projMatrix: Buffer object. [double] - @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport (as from a glGetIntegerv call). - @type objx, objy, objz: Buffer object. [double] - @param objx, objy, objz: Return the computed object coordinates. - """ - -class Buffer: - """ - The Buffer object is simply a block of memory that is delineated and initialized by the - user. Many OpenGL functions return data to a C-style pointer, however, because this - is not possible in python the Buffer object can be used to this end. Wherever pointer - notation is used in the OpenGL functions the Buffer object can be used in it's BGL - wrapper. In some instances the Buffer object will need to be initialized with the template - parameter, while in other instances the user will want to create just a blank buffer - which will be zeroed by default. - - Example with Buffer:: - import Blender - from Blender import BGL - myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32]) - BGL.glGetPolygonStipple(myByteBuffer) - print myByteBuffer.dimensions - print myByteBuffer.list - sliceBuffer = myByteBuffer[0:16] - print sliceBuffer - - @ivar list: The contents of the Buffer. - @ivar dimensions: The size of the Buffer. - """ - - def __init__(type, dimensions, template = None): - """ - This will create a new Buffer object for use with other BGL OpenGL commands. - Only the type of argument to store in the buffer and the dimensions of the buffer - are necessary. Buffers are zeroed by default unless a template is supplied, in - which case the buffer is initialized to the template. - - @type type: int - @param type: The format to store data in. The type should be one of - GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. - @type dimensions: An int or sequence object specifying the dimensions of the buffer. - @param dimensions: If the dimensions are specified as an int a linear array will - be created for the buffer. If a sequence is passed for the dimensions, the buffer - becomes n-Dimensional, where n is equal to the number of parameters passed in the - sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates - a three- dimensional buffer. You can think of each additional dimension as a sub-item - of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. - [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. - @type template: A python sequence object (optional) - @param template: A sequence of matching dimensions which will be used to initialize - the Buffer. If a template is not passed in all fields will be initialized to 0. - @rtype: Buffer object - @return: The newly created buffer as a PyObject. - """ diff --git a/source/blender/python/doc/epy/Geometry.py b/source/blender/python/doc/epy/Geometry.py deleted file mode 100644 index d0c4dfdfd8d..00000000000 --- a/source/blender/python/doc/epy/Geometry.py +++ /dev/null @@ -1,189 +0,0 @@ -# Blender.Geometry module and its subtypes - -""" -The Blender.Geometry submodule. - -Geometry -======== -(when accessing it from the Game Engine use Geometry instead of Blender.Geometry) - -This new module provides access to a geometry function. -""" - -def Intersect(vec1, vec2, vec3, ray, orig, clip=1): - """ - Return the intersection between a ray and a triangle, if possible, return None otherwise. - @type vec1: Vector object. - @param vec1: A 3d vector, one corner of the triangle. - @type vec2: Vector object. - @param vec2: A 3d vector, one corner of the triangle. - @type vec3: Vector object. - @param vec3: A 3d vector, one corner of the triangle. - @type ray: Vector object. - @param ray: A 3d vector, the orientation of the ray. the length of the ray is not used, only the direction. - @type orig: Vector object. - @param orig: A 3d vector, the origin of the ray. - @type clip: integer - @param clip: if 0, don't restrict the intersection to the area of the triangle, use the infinite plane defined by the triangle. - @rtype: Vector object - @return: The intersection between a ray and a triangle, if possible, None otherwise. - """ - -def TriangleArea(vec1, vec2, vec3): - """ - Return the area size of the 2D or 3D triangle defined. - @type vec1: Vector object. - @param vec1: A 2d or 3d vector, one corner of the triangle. - @type vec2: Vector object. - @param vec2: A 2d or 3d vector, one corner of the triangle. - @type vec3: Vector object. - @param vec3: A 2d or 3d vector, one corner of the triangle. - @rtype: float - @return: The area size of the 2D or 3D triangle defined. - """ - -def TriangleNormal(vec1, vec2, vec3): - """ - Return the normal of the 3D triangle defined. - @type vec1: Vector object. - @param vec1: A 3d vector, one corner of the triangle. - @type vec2: Vector object. - @param vec2: A 3d vector, one corner of the triangle. - @type vec3: Vector object. - @param vec3: A 3d vector, one corner of the triangle. - @rtype: float - @return: The normal of the 3D triangle defined. - """ - -def QuadNormal(vec1, vec2, vec3, vec4): - """ - Return the normal of the 3D quad defined. - @type vec1: Vector object. - @param vec1: A 3d vector, the first vertex of the quad. - @type vec2: Vector object. - @param vec2: A 3d vector, the second vertex of the quad. - @type vec3: Vector object. - @param vec3: A 3d vector, the third vertex of the quad. - @type vec4: Vector object. - @param vec4: A 3d vector, the fourth vertex of the quad. - @rtype: float - @return: The normal of the 3D quad defined. - """ - -def LineIntersect(vec1, vec2, vec3, vec4): - """ - Return a tuple with the points on each line respectively closest to the other - (when both lines intersect, both vector hold the same value). - The lines are evaluated as infinite lines in space, the values returned may not be between the 2 points given for each line. - @type vec1: Vector object. - @param vec1: A 3d vector, one point on the first line. - @type vec2: Vector object. - @param vec2: A 3d vector, another point on the first line. - @type vec3: Vector object. - @param vec3: A 3d vector, one point on the second line. - @type vec4: Vector object. - @param vec4: A 3d vector, another point on the second line. - @rtype: (Vector object, Vector object) - @return: A tuple with the points on each line respectively closest to the other. - """ - -def PolyFill(polylines): - """ - Takes a list of polylines and calculates triangles that would fill in the polylines. - Multiple lines can be used to make holes inside a polyline, or fill in 2 separate lines at once. - @type polylines: List of lists containing vectors, each representing a closed polyline. - @rtype: list - @return: a list if tuples each a tuple of 3 ints representing a triangle indexing the points given. - @note: 2D Vectors will have an assumed Z axis of zero, 4D Vectors W axis is ignored. - @note: The order of points in a polyline effect the direction returned triangles face, reverse the order of a polyline to flip the normal of returned faces. - - I{B{Example:}} - - The example below creates 2 polylines and fills them in with faces, then makes a mesh in the current scene:: - import Blender - Vector= Blender.mathutils.Vector - - # Outline of 5 points - polyline1= [Vector(-2.0, 1.0, 1.0), Vector(-1.0, 2.0, 1.0), Vector(1.0, 2.0, 1.0), Vector(1.0, -1.0, 1.0), Vector(-1.0, -1.0, 1.0)] - polyline2= [Vector(-1, 1, 1.0), Vector(0, 1, 1.0), Vector(0, 0, 1.0), Vector(-1.0, 0.0, 1.0)] - fill= Blender.Geometry.PolyFill([polyline1, polyline2]) - - # Make a new mesh and add the truangles into it - me= Blender.Mesh.New() - me.verts.extend(polyline1) - me.verts.extend(polyline2) - me.faces.extend(fill) # Add the faces, they reference the verts in polyline 1 and 2 - - scn = Blender.Scene.GetCurrent() - ob = scn.objects.new(me) - Blender.Redraw() - """ - -def LineIntersect2D(vec1, vec2, vec3, vec4): - """ - Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line. - @rtype: Vector - @return: a 2D Vector for the intersection or None where there is no intersection. - """ - -def ClosestPointOnLine(pt, vec1, vec2): - """ - Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line. - @rtype: tuple - @return: a tuple containing a vector and a float, the vector is the closest point on the line, the float is the position on the line, between 0 and 1 the point is on the line. - """ - -def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3): - """ - Takes 4 vectors (one for the test point and 3 for the triangle) - This is a 2d function so only X and Y are used, Z and W will be ignored. - @rtype: int - @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection. - """ - -def PointInQuad2D(pt, quad_pt1, quad_pt2, quad_pt3): - """ - Takes 5 vectors (one for the test point and 5 for the quad) - This is a 2d function so only X and Y are used, Z and W will be ignored. - @rtype: int - @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection. - """ - -def BoxPack2D(boxlist): - """ - Takes a list of 2D boxes and packs them into a square. - Each box in boxlist must be a list of at least 4 items - [x,y,w,h], after running this script, - the X and Y values in each box will be moved to packed, non overlapping locations. - - Example:: - - # Make 500 random boxes, pack them and make a mesh from it - from Blender import Geometry, Scene, Mesh - import random - boxes = [] - for i in xrange(500): - boxes.append( [0,0, random.random()+0.1, random.random()+0.1] ) - boxsize = Geometry.BoxPack2D(boxes) - print 'BoxSize', boxsize - me = Mesh.New() - for x in boxes: - me.verts.extend([(x[0],x[1], 0), (x[0],x[1]+x[3], 0), (x[0]+x[2],x[1]+x[3], 0), (x[0]+x[2],x[1], 0) ]) - v1= me.verts[-1] - v2= me.verts[-2] - v3= me.verts[-3] - v4= me.verts[-4] - me.faces.extend([(v1,v2,v3,v4)]) - scn = Scene.GetCurrent() - scn.objects.new(me) - - @note: Each boxlist item can be longer then 4, the extra items are ignored and stay untouched. - @rtype: tuple - @return: a tuple pair - (width, height) of all the packed boxes. - """ -def BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution): - """ - Takes 4 vectors representing a bezier curve and returns a list of vector points. - @note: any vector size is supported, the largest dimension from the input will be used for all returned vectors/ - @rtype: list - @return: a list of vectors the size of resolution including the start and end points (vec_knot_1 and vec_knot_2) - """ diff --git a/source/blender/python/doc/epy/IDProp.py b/source/blender/python/doc/epy/IDProp.py deleted file mode 100644 index 1fc26d7f65b..00000000000 --- a/source/blender/python/doc/epy/IDProp.py +++ /dev/null @@ -1,132 +0,0 @@ -class IDGroup: - """ - The IDGroup Type - ================ - This type supports both iteration and the [] - operator to get child ID properties. - - You can also add new properties using the [] operator. - For example:: - - group['a float!'] = 0.0 - group['an int!'] = 0 - group['a string!'] = "hi!" - group['an array!'] = [0, 0, 1.0, 0] - - group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2], - "another subgroup": {"a": 0.0, "str": "bleh"}} - - Note that for arrays, the array type defaults to int unless a float is found - while scanning the template list; if any floats are found, then the whole - array is float. Note that double-precision floating point numbers are used for - python-created float ID properties and arrays (though the internal C api does - support single-precision floats, and the python code will read them). - - You can also delete properties with the del operator. For example: - - del group['property'] - - To get the type of a property, use the type() operator, for example:: - - if type(group['bleh']) == str: pass - - To tell if the property is a group or array type, import the Blender.Types module and test - against IDGroupType and IDArrayType, like so:: - - from Blender.Types import IDGroupType, IDArrayType. - - if type(group['bleghr']) == IDGroupType: - (do something) - - @ivar name: The name of the property - @type name: string - """ - - def pop(item): - """ - Pop an item from the group property. - @type item: string - @param item: The item name. - @rtype: can be dict, list, int, float or string. - @return: The removed property. - """ - - def update(updatedict): - """ - Updates items in the dict, similar to normal python - dictionary method .update(). - @type updatedict: dict - @param updatedict: A dict of simple types to derive updated/new IDProperties from. - @rtype: None - @return: None - """ - - def keys(): - """ - Returns a list of the keys in this property group. - @rtype: list of strings. - @return: a list of the keys in this property group. - """ - - def values(): - """ - Returns a list of the values in this property group. - - Note that unless a value is itself a property group or an array, you - cannot change it by changing the values in this list, you must change them - in the parent property group. - - For example, - - group['some_property'] = new_value - - . . .is correct, while, - - values = group.values() - values[0] = new_value - - . . .is wrong. - - @rtype: list of strings. - @return: a list of the values in this property group. - """ - - def iteritems(): - """ - Implements the python dictionary iteritmes method. - - For example:: - - for k, v in group.iteritems(): - print "Property name: " + k - print "Property value: " + str(v) - - @rtype: an iterator that spits out items of the form [key, value] - @return: an iterator. - """ - - def convert_to_pyobject(): - """ - Converts the entire property group to a purely python form. - - @rtype: dict - @return: A python dictionary representing the property group - """ - -class IDArray: - """ - The IDArray Type - ================ - - @ivar type: returns the type of the array, can be either IDP_Int or IDP_Float - """ - - def __getitem__(index): - pass - - def __setitem__(index, value): - pass - - def __len__(): - pass - diff --git a/source/blender/python/doc/epy/Mathutils.py b/source/blender/python/doc/epy/Mathutils.py deleted file mode 100644 index 17a227f729a..00000000000 --- a/source/blender/python/doc/epy/Mathutils.py +++ /dev/null @@ -1,156 +0,0 @@ -# Blender.mathutils module and its subtypes - - - -class Vector: - """ - - @attention: Vector data can be wrapped or non-wrapped. When a object is wrapped it - means that the object will give you direct access to the data inside of blender. Modification - of this object will directly change the data inside of blender. To copy a wrapped object - you need to use the object's constructor. If you copy and object by assignment you will not get - a second copy but a second reference to the same data. Only certain functions will return - wrapped data. This will be indicated in the method description. - """ - - def __init__(list = None): - """ - Create a new 2d, 3d, or 4d Vector object from a list of floating point numbers. - @note: that python uses higher precission floating point numbers, so values assigned to a vector may have some rounding error. - - - Example:: - v = Vector(1,0,0) - v = Vector(myVec) - v = Vector(list) - @type list: PyList of float or int - @param list: The list of values for the Vector object. Can be a sequence or raw numbers. - Must be 2, 3, or 4 values. The list is mapped to the parameters as [x,y,z,w]. - @rtype: Vector object. - @return: It depends wheter a parameter was passed: - - (list): Vector object initialized with the given values; - - (): An empty 3 dimensional vector. - """ - -class Euler: - """ - The Euler object - ================ - This object gives access to Eulers in Blender. - @note: You can access a euler object like a sequence - - x = euler[0] - @note: Comparison operators can be done: - - ==, != test numeric values within epsilon - @attention: Euler data can be wrapped or non-wrapped. When a object is wrapped it - means that the object will give you direct access to the data inside of blender. Modification - of this object will directly change the data inside of blender. To copy a wrapped object - you need to use the object's constructor. If you copy and object by assignment you will not get - a second copy but a second reference to the same data. Only certain functions will return - wrapped data. This will be indicated in the method description. - """ - - def __init__(list = None): - """ - Create a new euler object. - - Example:: - euler = Euler(45,0,0) - euler = Euler(myEuler) - euler = Euler(sequence) - @type list: PyList of float/int - @param list: 3d list to initialize euler - @rtype: Euler object - @return: Euler representing heading, pitch, bank. - @note: Values are in degrees. - """ - -class Quaternion: - """ - The Quaternion object - ===================== - This object gives access to Quaternions in Blender. - @note: Comparison operators can be done: - - ==, != test numeric values within epsilon - @note: Math can be performed on Quaternion classes - - quat + quat - - quat - quat - - quat * float/int - - quat * vec - - quat * quat - @note: You can access a quaternion object like a sequence - - x = quat[0] - @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it - means that the object will give you direct access to the data inside of blender. Modification - of this object will directly change the data inside of blender. To copy a wrapped object - you need to use the object's constructor. If you copy and object by assignment you will not get - a second copy but a second reference to the same data. Only certain functions will return - wrapped data. This will be indicated in the method description. - """ - - def __init__(list, angle = None): - """ - Create a new quaternion object from initialized values. - - Example:: - quat = Quaternion(1,2,3,4) - quat = Quaternion(axis, angle) - quat = Quaternion() - quat = Quaternion(180, list) - - @type list: PyList of int/float - @param list: A 3d or 4d list to initialize quaternion. - 4d if intializing [w,x,y,z], 3d if used as an axis of rotation. - @type angle: float (optional) - @param angle: An arbitrary rotation amount around 'list'. - List is used as an axis of rotation in this case. - @rtype: New quaternion object. - @return: It depends wheter a parameter was passed: - - (list/angle): Quaternion object initialized with the given values; - - (): An identity 4 dimensional quaternion. - """ - -class Matrix: - """ - The Matrix Object - ================= - @note: Math can be performed on Matrix classes - - mat + mat - - mat - mat - - mat * float/int - - mat * vec - - mat * mat - @note: Comparison operators can be done: - - ==, != test numeric values within epsilon - @note: You can access a quaternion object like a 2d sequence - - x = matrix[0][1] - - vector = matrix[2] - @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it - means that the object will give you direct access to the data inside of blender. Modification - of this object will directly change the data inside of blender. To copy a wrapped object - you need to use the object's constructor. If you copy and object by assignment you will not get - a second copy but a second reference to the same data. Only certain functions will return - wrapped data. This will be indicated in the method description. - """ - - def __init__(list1 = None, list2 = None, list3 = None, list4 = None): - """ - Create a new matrix object from initialized values. - - Example:: - matrix = Matrix([1,1,1],[0,1,0],[1,0,0]) - matrix = Matrix(mat) - matrix = Matrix(seq1, seq2, vector) - - @type list1: PyList of int/float - @param list1: A 2d,3d or 4d list. - @type list2: PyList of int/float - @param list2: A 2d,3d or 4d list. - @type list3: PyList of int/float - @param list3: A 2d,3d or 4d list. - @type list4: PyList of int/float - @param list4: A 2d,3d or 4d list. - @rtype: New matrix object. - @return: It depends wheter a parameter was passed: - - (list1, etc.): Matrix object initialized with the given values; - - (): An empty 3 dimensional matrix. - """ diff --git a/source/blender/python/doc/epy/testbgl.py b/source/blender/python/doc/epy/testbgl.py deleted file mode 100644 index e895d01df69..00000000000 --- a/source/blender/python/doc/epy/testbgl.py +++ /dev/null @@ -1,45 +0,0 @@ -# Testing the BGL module - -import Blender -from Blender.BGL import * -from Blender import Draw - -R = G = B = 0 -A = 1 - -instructions = "Hold mouse buttons to change the background color." -quitting = " Press ESC or q to quit." - -def show_win(): - glClearColor(R,G,B,A) # define color used to clear buffers - glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer - glColor3f(1,1,1) # change default color - glRasterPos2i(50,100) # move cursor to x = 50, y = 100 - Draw.Text("Testing BGL + Draw") # draw this text there - glRasterPos2i(350,20) # move cursor again - Draw.Text(instructions + quitting) # draw another msg - glBegin(GL_LINE_LOOP) # begin a vertex-data list - glVertex2i(46,92) - glVertex2i(120,92) - glVertex2i(120,115) - glVertex2i(46,115) - glEnd() # close this list - glColor3f(0.35,0.18,0.92) # change default color again - glBegin(GL_POLYGON) # another list, for a polygon - glVertex2i(315, 292) - glVertex2i(412, 200) - glVertex2i(264, 256) - glEnd() - Draw.Redraw(1) # make changes visible. - -def ev(evt, val): # this is a callback for Draw.Register() - global R,G,B,A # it handles input events - if evt == Draw.ESCKEY or evt == Draw.QKEY: - Draw.Exit() # this quits the script - elif evt == Draw.LEFTMOUSE: R = 1 - R - elif evt == Draw.MIDDLEMOUSE: G = 1 - G - elif evt == Draw.RIGHTMOUSE: B = 1 - B - else: - Draw.Register(show_win, ev, None) - -Draw.Register(show_win, ev, None) # start the main loop diff --git a/source/blender/python/doc/examples/bpy.data.py b/source/blender/python/doc/examples/bpy.data.py deleted file mode 100644 index fc1145a523f..00000000000 --- a/source/blender/python/doc/examples/bpy.data.py +++ /dev/null @@ -1,29 +0,0 @@ -import bpy - - -# print all objects -for obj in bpy.data.objects: - print(obj.name) - - -# print all scene names in a list -print(bpy.data.scenes.keys()) - - -# remove mesh Cube -if "Cube" in bpy.data.meshes: - mesh = bpy.data.meshes["Cube"] - print("removing mesh", mesh) - bpy.data.meshes.unlink(mesh) - - -# write images into a file next to the blend -import os -file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w') - -for image in bpy.data.images: - file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1])) - -file.close() - - diff --git a/source/blender/python/doc/examples/mathutils.Euler.py b/source/blender/python/doc/examples/mathutils.Euler.py deleted file mode 100644 index bc7702c1d53..00000000000 --- a/source/blender/python/doc/examples/mathutils.Euler.py +++ /dev/null @@ -1,3 +0,0 @@ -import mathutils - -# todo diff --git a/source/blender/python/doc/examples/mathutils.Matrix.py b/source/blender/python/doc/examples/mathutils.Matrix.py deleted file mode 100644 index bc7702c1d53..00000000000 --- a/source/blender/python/doc/examples/mathutils.Matrix.py +++ /dev/null @@ -1,3 +0,0 @@ -import mathutils - -# todo diff --git a/source/blender/python/doc/examples/mathutils.Quaternion.py b/source/blender/python/doc/examples/mathutils.Quaternion.py deleted file mode 100644 index bc7702c1d53..00000000000 --- a/source/blender/python/doc/examples/mathutils.Quaternion.py +++ /dev/null @@ -1,3 +0,0 @@ -import mathutils - -# todo diff --git a/source/blender/python/doc/examples/mathutils.Vector.py b/source/blender/python/doc/examples/mathutils.Vector.py deleted file mode 100644 index fb00e8aead6..00000000000 --- a/source/blender/python/doc/examples/mathutils.Vector.py +++ /dev/null @@ -1,55 +0,0 @@ -import mathutils - -# zero length vector -vec = mathutils.Vector((0, 0, 1)) - -# unit length vector -vec_a = vec.copy().normalize() - -vec_b = mathutils.Vector((0, 1, 2)) - -vec2d = mathutils.Vector((1, 2)) -vec3d = mathutils.Vector((1, 0, 0)) -vec4d = vec_a.copy().resize4D() - -# other mathutuls types -quat = mathutils.Quaternion() -matrix = mathutils.Matrix() - -# Comparison operators can be done on Vector classes: - -# greater and less then test vector length. -vec_a > vec_b -vec_a >= vec_b -vec_a < vec_b -vec_a <= vec_b - -# ==, != test vector values e.g. 1,2,3 != 3,2,1 even if they are the same length -vec_a == vec_b -vec_a != vec_b - - -# Math can be performed on Vector classes -vec_a + vec_b -vec_a - vec_b -vec_a * vec_b -vec_a * 10.0 -vec_a * matrix -vec_a * vec_b -vec_a * quat --vec_a - - -# You can access a vector object like a sequence -x = vec_a[0] -len(vec) -vec_a[:] = vec_b -vec2d[:] = vec3d[:2] - - -# Vectors support 'swizzle' operations -# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics) -vec.xyz = vec.zyx -vec.xy = vec4d.zw -vec.xyz = vec4d.wzz -vec4d.wxyz = vec.yxyx diff --git a/source/blender/python/doc/examples/mathutils.py b/source/blender/python/doc/examples/mathutils.py deleted file mode 100644 index 02f69515f21..00000000000 --- a/source/blender/python/doc/examples/mathutils.py +++ /dev/null @@ -1,18 +0,0 @@ -import mathutils -from math import radians - -vec = mathutils.Vector((1.0, 2.0, 3.0)) - -mat_rot = mathutils.Matrix.Rotation(radians(90), 4, 'X') -mat_trans = mathutils.Matrix.Translation(vec) - -mat = mat_trans * mat_rot -mat.invert() - -mat3 = mat.rotation_part() -quat1 = mat.to_quat() -quat2 = mat3.to_quat() - -angle = quat1.difference(quat2) - -print(angle) diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py deleted file mode 100644 index b20cd74f82a..00000000000 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ /dev/null @@ -1,862 +0,0 @@ - # ***** BEGIN GPL LICENSE BLOCK ***** - # - # This program is free software; you can redistribute it and/or - # modify it under the terms of the GNU General Public License - # as published by the Free Software Foundation; either version 2 - # of the License, or (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License - # along with this program; if not, write to the Free Software Foundation, - # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - # - # Contributor(s): Campbell Barton - # - # #**** END GPL LICENSE BLOCK #**** - -script_help_msg = ''' -Usage, -run this script from blenders root path once you have compiled blender - ./blender.bin -b -P /b/source/blender/python/doc/sphinx_doc_gen.py - -This will generate python files in "./source/blender/python/doc/sphinx-in" -Generate html docs by running... - - sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out - - -For PDF generation - - sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out - cd source/blender/python/doc/sphinx-out - make -''' - -# import rpdb2; rpdb2.start_embedded_debugger('test') - -import os -import inspect -import bpy -import rna_info -reload(rna_info) - -# lame, python wont give some access -ClassMethodDescriptorType = type(dict.__dict__['fromkeys']) -MethodDescriptorType = type(dict.get) -GetSetDescriptorType = type(int.real) - -EXAMPLE_SET = set() -EXAMPLE_SET_USED = set() - -_BPY_STRUCT_FAKE = "bpy_struct" -_BPY_FULL_REBUILD = False - -def undocumented_message(module_name, type_name, identifier): - message = "Undocumented (`contribute " \ - "`_)\n\n" % (module_name, type_name, identifier) - return message - - -def range_str(val): - ''' - Converts values to strings for the range directive. - (unused function it seems) - ''' - if val < -10000000: return '-inf' - if val > 10000000: return 'inf' - if type(val)==float: - return '%g' % val - else: - return str(val) - - -def write_example_ref(ident, fw, example_id, ext="py"): - if example_id in EXAMPLE_SET: - fw("%s.. literalinclude:: ../examples/%s.%s\n\n" % (ident, example_id, ext)) - EXAMPLE_SET_USED.add(example_id) - else: - if bpy.app.debug: - print("\tskipping example:", example_id) - - -def write_indented_lines(ident, fn, text, strip=True): - ''' - Apply same indentation to all lines in a multilines text. - ''' - if text is None: - return - for l in text.split("\n"): - if strip: - fn(ident + l.strip() + "\n") - else: - fn(ident + l + "\n") - - -def pymethod2sphinx(ident, fw, identifier, py_func): - ''' - class method to sphinx - ''' - arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) - if arg_str.startswith("(self, "): - arg_str = "(" + arg_str[7:] - func_type = "method" - elif arg_str.startswith("(cls, "): - arg_str = "(" + arg_str[6:] - func_type = "classmethod" - else: - func_type = "staticmethod" - - fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) - if py_func.__doc__: - write_indented_lines(ident + " ", fw, py_func.__doc__) - fw("\n") - - -def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True): - ''' - function or class method to sphinx - ''' - arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) - - if not is_class: - func_type = "function" - - # ther rest are class methods - elif arg_str.startswith("(self, "): - arg_str = "(" + arg_str[7:] - func_type = "method" - elif arg_str.startswith("(cls, "): - arg_str = "(" + arg_str[6:] - func_type = "classmethod" - else: - func_type = "staticmethod" - - fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) - if py_func.__doc__: - write_indented_lines(ident + " ", fw, py_func.__doc__.strip()) - fw("\n") - - -def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): - if identifier.startswith("_"): - return - - doc = descr.__doc__ - if not doc: - doc = undocumented_message(module_name, type_name, identifier) - - if type(descr) == GetSetDescriptorType: - fw(ident + ".. attribute:: %s\n\n" % identifier) - write_indented_lines(ident + " ", fw, doc, False) - elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType): - write_indented_lines(ident, fw, doc, False) - else: - raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType") - - write_example_ref(ident, fw, module_name + "." + type_name + "." + identifier) - fw("\n") - - -def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_class=True): - ''' - c defined function to sphinx. - ''' - - # dump the docstring, assume its formatted correctly - if py_func.__doc__: - write_indented_lines(ident, fw, py_func.__doc__, False) - fw("\n") - else: - fw(ident + ".. function:: %s()\n\n" % identifier) - fw(ident + " " + undocumented_message(module_name, type_name, identifier)) - - -def pyprop2sphinx(ident, fw, identifier, py_prop): - ''' - python property to sphinx - ''' - # readonly properties use "data" directive, variables use "attribute" directive - if py_prop.fset is None: - fw(ident + ".. data:: %s\n\n" % identifier) - else: - fw(ident + ".. attribute:: %s\n\n" % identifier) - write_indented_lines(ident + " ", fw, py_prop.__doc__) - if py_prop.fset is None: - fw(ident + " (readonly)\n\n") - - -def pymodule2sphinx(BASEPATH, module_name, module, title): - import types - attribute_set = set() - filepath = os.path.join(BASEPATH, module_name + ".rst") - - file = open(filepath, "w") - - fw = file.write - - fw(title + "\n") - fw(("=" * len(title)) + "\n\n") - - fw(".. module:: %s\n\n" % module_name) - - if module.__doc__: - # Note, may contain sphinx syntax, dont mangle! - fw(module.__doc__.strip()) - fw("\n\n") - - write_example_ref("", fw, module_name) - - # write members of the module - # only tested with PyStructs which are not exactly modules - for key, descr in sorted(type(module).__dict__.items()): - if type(descr) == types.MemberDescriptorType: - if descr.__doc__: - fw(".. data:: %s\n\n" % key) - write_indented_lines(" ", fw, descr.__doc__, False) - attribute_set.add(key) - fw("\n") - del key, descr - - classes = [] - - for attribute in sorted(dir(module)): - if not attribute.startswith("_"): - - if attribute in attribute_set: - continue - - if attribute.startswith("n_"): # annoying exception, needed for bpy.app - continue - - value = getattr(module, attribute) - - value_type = type(value) - - if value_type == types.FunctionType: - pyfunc2sphinx("", fw, attribute, value, is_class=False) - elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType): # both the same at the moment but to be future proof - # note: can't get args from these, so dump the string as is - # this means any module used like this must have fully formatted docstrings. - py_c_func2sphinx("", fw, module_name, module, attribute, value, is_class=False) - elif value_type == type: - classes.append((attribute, value)) - elif value_type in (bool, int, float, str, tuple): - # constant, not much fun we can do here except to list it. - # TODO, figure out some way to document these! - fw(".. data:: %s\n\n" % attribute) - write_indented_lines(" ", fw, "constant value %s" % repr(value), False) - fw("\n") - else: - print("\tnot documenting %s.%s" % (module_name, attribute)) - continue - - attribute_set.add(attribute) - # TODO, more types... - - # write collected classes now - for (type_name, value) in classes: - # May need to be its own function - fw(".. class:: %s\n\n" % type_name) - if value.__doc__: - write_indented_lines(" ", fw, value.__doc__, False) - fw("\n") - write_example_ref(" ", fw, module_name + "." + type_name) - - descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")] - - for key, descr in descr_items: - if type(descr) == ClassMethodDescriptorType: - py_descr2sphinx(" ", fw, descr, module_name, type_name, key) - - for key, descr in descr_items: - if type(descr) == MethodDescriptorType: - py_descr2sphinx(" ", fw, descr, module_name, type_name, key) - - for key, descr in descr_items: - if type(descr) == GetSetDescriptorType: - py_descr2sphinx(" ", fw, descr, module_name, type_name, key) - - fw("\n\n") - - file.close() - - - -def rna2sphinx(BASEPATH): - - structs, funcs, ops, props = rna_info.BuildRNAInfo() - - try: - os.mkdir(BASEPATH) - except: - pass - - # conf.py - empty for now - filepath = os.path.join(BASEPATH, "conf.py") - file = open(filepath, "w") - fw = file.write - - - version_string = bpy.app.version_string.split("(")[0] - if bpy.app.build_revision != "Unknown": - version_string = version_string + " r" + bpy.app.build_revision - - # for use with files - version_string_fp = "_".join(str(v) for v in bpy.app.version) - - fw("project = 'Blender'\n") - # fw("master_doc = 'index'\n") - fw("copyright = u'Blender Foundation'\n") - fw("version = '%s - UNSTABLE API'\n" % version_string) - fw("release = '%s - UNSTABLE API'\n" % version_string) - fw("html_theme = 'blender-org'\n") - fw("html_theme_path = ['../']\n") - fw("html_favicon = 'favicon.ico'\n") - # not helpful since the source us generated, adds to upload size. - fw("html_copy_source = False\n") - fw("\n") - # needed for latex, pdf gen - fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n") - fw("latex_paper_size = 'a4paper'\n") - file.close() - - - filepath = os.path.join(BASEPATH, "contents.rst") - file = open(filepath, "w") - fw = file.write - - fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n") - fw(" Blender Documentation contents\n") - fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n") - fw("\n") - fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date)) - fw("\n") - fw("An introduction to Blender and Python can be found at \n") - fw("\n") - fw("`A PDF version of this document is also available `__\n" % version_string_fp) - fw("\n") - fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n") - fw(" \n") - fw(" The following areas are subject to change.\n") - fw(" * operator names and arguments\n") - fw(" * render api\n") - fw(" * function calls with the data api (any function calls with values accessed from bpy.data), including functions for importing and exporting meshes\n") - fw(" * class registration (Operator, Panels, Menus, Headers)\n") - fw(" * modules: bpy.props, blf)\n") - fw(" * members in the bpy.context have to be reviewed\n") - fw(" * python defined modal operators, especially drawing callbacks are highly experemental\n") - fw(" \n") - fw(" These parts of the API are relatively stable and are unlikely to change significantly\n") - fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n") - fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n") - fw(" * modules: bgl, mathutils and geometry\n") - fw(" * game engine modules\n") - fw("\n") - - fw("===================\n") - fw("Application Modules\n") - fw("===================\n") - fw("\n") - fw(".. toctree::\n") - fw(" :maxdepth: 1\n\n") - fw(" bpy.data.rst\n\n") # note: not actually a module - fw(" bpy.ops.rst\n\n") - fw(" bpy.types.rst\n\n") - - # py modules - fw(" bpy.utils.rst\n\n") - fw(" bpy.path.rst\n\n") - fw(" bpy.app.rst\n\n") - - # C modules - fw(" bpy.props.rst\n\n") - - fw("==================\n") - fw("Standalone Modules\n") - fw("==================\n") - fw("\n") - fw(".. toctree::\n") - fw(" :maxdepth: 1\n\n") - - - fw(" mathutils.rst\n\n") - fw(" blf.rst\n\n") - fw(" aud.rst\n\n") - - # game engine - fw("===================\n") - fw("Game Engine Modules\n") - fw("===================\n") - fw("\n") - fw(".. toctree::\n") - fw(" :maxdepth: 1\n\n") - fw(" bge.types.rst\n\n") - fw(" bge.logic.rst\n\n") - fw(" bge.render.rst\n\n") - fw(" bge.events.rst\n\n") - - file.close() - - - # internal modules - filepath = os.path.join(BASEPATH, "bpy.ops.rst") - file = open(filepath, "w") - fw = file.write - fw("Operators (bpy.ops)\n") - fw("===================\n\n") - fw(".. toctree::\n") - fw(" :glob:\n\n") - fw(" bpy.ops.*\n\n") - file.close() - - filepath = os.path.join(BASEPATH, "bpy.types.rst") - file = open(filepath, "w") - fw = file.write - fw("Types (bpy.types)\n") - fw("=================\n\n") - fw(".. toctree::\n") - fw(" :glob:\n\n") - fw(" bpy.types.*\n\n") - file.close() - - - # not actually a module, only write this file so we - # can reference in the TOC - filepath = os.path.join(BASEPATH, "bpy.data.rst") - file = open(filepath, "w") - fw = file.write - fw("Data Access (bpy.data)\n") - fw("======================\n\n") - fw(".. module:: bpy\n") - fw("\n") - fw("This module is used for all blender/python access.\n") - fw("\n") - fw(".. literalinclude:: ../examples/bpy.data.py\n") - fw("\n") - fw(".. data:: data\n") - fw("\n") - fw(" Access to blenders internal data\n") - fw("\n") - fw(" :type: :class:`bpy.types.BlendData`\n") - file.close() - - EXAMPLE_SET_USED.add("bpy.data") - - - # python modules - from bpy import utils as module - pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)") - - from bpy import path as module - pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)") - - # C modules - from bpy import app as module - pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)") - - from bpy import props as module - pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)") - - import mathutils as module - pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)") - del module - - import blf as module - pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)") - del module - - import aud as module - pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)") - del module - - # game engine - import shutil - # copy2 keeps time/date stamps - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH) - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH) - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH) - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH) - - - if 0: - filepath = os.path.join(BASEPATH, "bpy.rst") - file = open(filepath, "w") - fw = file.write - - fw("\n") - - title = ":mod:`bpy` --- Blender Python Module" - fw("%s\n%s\n\n" % (title, "=" * len(title))) - fw(".. module:: bpy.types\n\n") - file.close() - - def write_param(ident, fw, prop, is_return=False): - if is_return: - id_name = "return" - id_type = "rtype" - kwargs = {"as_ret": True, "class_fmt": ":class:`%s`"} - identifier = "" - else: - id_name = "arg" - id_type = "type" - kwargs = {"as_arg": True, "class_fmt": ":class:`%s`"} - identifier = " %s" % prop.identifier - - type_descr = prop.get_type_description(**kwargs) - if prop.name or prop.description: - fw(ident + ":%s%s: %s\n" % (id_name, identifier, ", ".join(val for val in (prop.name, prop.description) if val))) - fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr)) - - def write_struct(struct): - #if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"): - # return - - #if not struct.identifier == "Object": - # return - - filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier) - file = open(filepath, "w") - fw = file.write - - base_id = getattr(struct.base, "identifier", "") - - if _BPY_STRUCT_FAKE: - if not base_id: - base_id = _BPY_STRUCT_FAKE - - if base_id: - title = "%s(%s)" % (struct.identifier, base_id) - else: - title = struct.identifier - - fw("%s\n%s\n\n" % (title, "=" * len(title))) - - fw(".. module:: bpy.types\n\n") - - base_ids = [base.identifier for base in struct.get_bases()] - - if _BPY_STRUCT_FAKE: - base_ids.append(_BPY_STRUCT_FAKE) - - base_ids.reverse() - - if base_ids: - if len(base_ids) > 1: - fw("base classes --- ") - else: - fw("base class --- ") - - fw(", ".join((":class:`%s`" % base_id) for base_id in base_ids)) - fw("\n\n") - - subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)] - if subclass_ids: - fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n") - - base_id = getattr(struct.base, "identifier", "") - - if _BPY_STRUCT_FAKE: - if not base_id: - base_id = _BPY_STRUCT_FAKE - - if base_id: - fw(".. class:: %s(%s)\n\n" % (struct.identifier, base_id)) - else: - fw(".. class:: %s\n\n" % struct.identifier) - - fw(" %s\n\n" % struct.description) - - # properties sorted in alphabetical order - sorted_struct_properties = struct.properties[:] - sorted_struct_properties.sort(key=lambda prop: prop.identifier) - - for prop in sorted_struct_properties: - type_descr = prop.get_type_description(class_fmt=":class:`%s`") - # readonly properties use "data" directive, variables properties use "attribute" directive - if 'readonly' in type_descr: - fw(" .. data:: %s\n\n" % prop.identifier) - else: - fw(" .. attribute:: %s\n\n" % prop.identifier) - if prop.description: - fw(" %s\n\n" % prop.description) - fw(" :type: %s\n\n" % type_descr) - - # python attributes - py_properties = struct.get_py_properties() - py_prop = None - for identifier, py_prop in py_properties: - pyprop2sphinx(" ", fw, identifier, py_prop) - del py_properties, py_prop - - for func in struct.functions: - args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args) - - fw(" .. %s:: %s(%s)\n\n" % ("classmethod" if func.is_classmethod else "method", func.identifier, args_str)) - fw(" %s\n\n" % func.description) - - for prop in func.args: - write_param(" ", fw, prop) - - if len(func.return_values) == 1: - write_param(" ", fw, func.return_values[0], is_return=True) - elif func.return_values: # multiple return values - fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values)) - for prop in func.return_values: - type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`") - descr = prop.description - if not descr: - descr = prop.name - fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr)) - - fw("\n") - - - # python methods - py_funcs = struct.get_py_functions() - py_func = None - - for identifier, py_func in py_funcs: - pyfunc2sphinx(" ", fw, identifier, py_func, is_class=True) - del py_funcs, py_func - - lines = [] - - if struct.base or _BPY_STRUCT_FAKE: - bases = list(reversed(struct.get_bases())) - - # props - lines[:] = [] - - if _BPY_STRUCT_FAKE: - descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")] - - if _BPY_STRUCT_FAKE: - for key, descr in descr_items: - if type(descr) == GetSetDescriptorType: - lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key)) - - for base in bases: - for prop in base.properties: - lines.append(" * :class:`%s.%s`\n" % (base.identifier, prop.identifier)) - - for identifier, py_prop in base.get_py_properties(): - lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier)) - - for identifier, py_prop in base.get_py_properties(): - lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier)) - - if lines: - fw(".. rubric:: Inherited Properties\n\n") - - fw(".. hlist::\n") - fw(" :columns: 2\n\n") - - for line in lines: - fw(line) - fw("\n") - - - # funcs - lines[:] = [] - - if _BPY_STRUCT_FAKE: - for key, descr in descr_items: - if type(descr) == MethodDescriptorType: - lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key)) - - for base in bases: - for func in base.functions: - lines.append(" * :class:`%s.%s`\n" % (base.identifier, func.identifier)) - for identifier, py_func in base.get_py_functions(): - lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier)) - - if lines: - fw(".. rubric:: Inherited Functions\n\n") - - fw(".. hlist::\n") - fw(" :columns: 2\n\n") - - for line in lines: - fw(line) - fw("\n") - - lines[:] = [] - - - if struct.references: - # use this otherwise it gets in the index for a normal heading. - fw(".. rubric:: References\n\n") - - fw(".. hlist::\n") - fw(" :columns: 2\n\n") - - for ref in struct.references: - ref_split = ref.split(".") - if len(ref_split) > 2: - ref = ref_split[-2] + "." + ref_split[-1] - fw(" * :class:`%s`\n" % ref) - fw("\n") - - - for struct in structs.values(): - # TODO, rna_info should filter these out! - if "_OT_" in struct.identifier: - continue - write_struct(struct) - - # special case, bpy_struct - if _BPY_STRUCT_FAKE: - filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % _BPY_STRUCT_FAKE) - file = open(filepath, "w") - fw = file.write - - fw("%s\n" % _BPY_STRUCT_FAKE) - fw("=" * len(_BPY_STRUCT_FAKE) + "\n") - fw("\n") - fw(".. module:: bpy.types\n") - fw("\n") - - subclass_ids = [s.identifier for s in structs.values() if s.base is None if not rna_info.rna_id_ignore(s.identifier)] - if subclass_ids: - fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in sorted(subclass_ids)) + "\n\n") - - fw(".. class:: %s\n\n" % _BPY_STRUCT_FAKE) - fw(" built-in base class for all classes in bpy.types.\n\n") - fw(" .. note::\n\n") - fw(" Note that bpy.types.%s is not actually available from within blender, it only exists for the purpose of documentation.\n\n" % _BPY_STRUCT_FAKE) - - descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")] - - for key, descr in descr_items: - if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet - py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key) - - for key, descr in descr_items: - if type(descr) == GetSetDescriptorType: - py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key) - - - # operators - def write_ops(): - API_BASEURL='https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts' - fw = None - last_mod = '' - - for op_key in sorted(ops.keys()): - op = ops[op_key] - - if last_mod != op.module_name: - filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op.module_name) - file = open(filepath, "w") - fw = file.write - - title = "%s Operators" % (op.module_name[0].upper() + op.module_name[1:]) - fw("%s\n%s\n\n" % (title, "=" * len(title))) - - fw(".. module:: bpy.ops.%s\n\n" % op.module_name) - last_mod = op.module_name - - args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args) - fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str)) - - # if the description isn't valid, we output the standard warning - # with a link to the wiki so that people can help - if not op.description or op.description == "(undocumented operator)": - operator_description = undocumented_message('bpy.ops',op.module_name,op.func_name) - else: - operator_description = op.description - - fw(" %s\n\n" % operator_description) - for prop in op.args: - write_param(" ", fw, prop) - if op.args: - fw("\n") - - location = op.get_location() - if location != (None, None): - fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0],API_BASEURL,location[0],location[1])) - - write_ops() - - file.close() - -def main(): - import bpy - if 'bpy' not in dir(): - print("\nError, this script must run from inside blender2.5") - print(script_help_msg) - else: - import shutil - - path_in = 'source/blender/python/doc/sphinx-in' - path_out = 'source/blender/python/doc/sphinx-out' - path_examples = 'source/blender/python/doc/examples' - # only for partial updates - path_in_tmp = path_in + "-tmp" - - if not os.path.exists(path_in): - os.mkdir(path_in) - - for f in os.listdir(path_examples): - if f.endswith(".py"): - EXAMPLE_SET.add(os.path.splitext(f)[0]) - - - # only for full updates - if _BPY_FULL_REBUILD: - shutil.rmtree(path_in, True) - shutil.rmtree(path_out, True) - else: - # write here, then move - shutil.rmtree(path_in_tmp, True) - - rna2sphinx(path_in_tmp) - - if not _BPY_FULL_REBUILD: - import filecmp - - # now move changed files from 'path_in_tmp' --> 'path_in' - file_list_path_in = set(os.listdir(path_in)) - file_list_path_in_tmp = set(os.listdir(path_in_tmp)) - - # remove deprecated files that have been removed. - for f in sorted(file_list_path_in): - if f not in file_list_path_in_tmp: - print("\tdeprecated: %s" % f) - os.remove(os.path.join(path_in, f)) - - # freshen with new files. - for f in sorted(file_list_path_in_tmp): - f_from = os.path.join(path_in_tmp, f) - f_to = os.path.join(path_in, f) - - do_copy = True - if f in file_list_path_in: - if filecmp.cmp(f_from, f_to): - do_copy = False - - if do_copy: - print("\tupdating: %s" % f) - shutil.copy(f_from, f_to) - '''else: - print("\tkeeping: %s" % f) # eh, not that useful''' - - - EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED - if EXAMPLE_SET_UNUSED: - print("\nUnused examples found in '%s'..." % path_examples) - for f in EXAMPLE_SET_UNUSED: - print(" %s.py" % f) - print(" %d total\n" % len(EXAMPLE_SET_UNUSED)) - - import sys - sys.exit() - -if __name__ == '__main__': - main() diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh deleted file mode 100755 index 607803d16d5..00000000000 --- a/source/blender/python/doc/sphinx_doc_gen.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# run from the blender source dir -# bash source/blender/python/doc/sphinx_doc_gen.sh -# ssh upload means you need an account on the server - -BLENDER="./blender.bin" -SSH_HOST="ideasman42@emo.blender.org" -SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api_VERSION, added after - -# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1' -# "_".join(str(v) for v in bpy.app.version) -# custom blender vars -blender_srcdir=$(dirname $0)/../../../../ -blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) -blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) -BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion - -BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'` -SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION - -# dont delete existing docs, now partial updates are used for quick builds. -$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py - -# html -sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out -cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html -ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' -rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ - -# pdf -sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out -cd source/blender/python/doc/sphinx-out -make -cd ../../../../../ -rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst deleted file mode 100644 index 7215902a828..00000000000 --- a/source/gameengine/PyDoc/bge.events.rst +++ /dev/null @@ -1,250 +0,0 @@ - -Game Engine bge.events module -============================= - -***** -Intro -***** - -This module holds key constants for the SCA_KeyboardSensor. - -.. module:: bge.events - -.. code-block:: python - - # Set a connected keyboard sensor to accept F1 - import bge - - co = bge.logic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - sensor.key = bge.events.F1KEY - -.. code-block:: python - - # Do the all keys thing - import bge - - co = bge.logic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - - for key,status in sensor.events: - # key[0] == bge.events.keycode, key[1] = status - if status == bge.logic.KX_INPUT_JUST_ACTIVATED: - if key == bge.events.WKEY: - # Activate Forward! - if key == bge.events.SKEY: - # Activate Backward! - if key == bge.events.AKEY: - # Activate Left! - if key == bge.events.DKEY: - # Activate Right! - -.. code-block:: python - - # The all keys thing without a keyboard sensor (but you will - # need an always sensor with pulse mode on) - import bge - - # Just shortening names here - keyboard = bge.logic.keyboard - JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED - - if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED: - print("Activate Forward!") - if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED: - print("Activate Backward!") - if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED: - print("Activate Left!") - if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED: - print("Activate Right!") - - -********* -Functions -********* - -.. function:: EventToString(event) - - Return the string name of a key event. Will raise a ValueError error if its invalid. - - :arg event: key event from bge.keys or the keyboard sensor. - :type event: int - :rtype: string - -.. function:: EventToCharacter(event, shift) - - Return the string name of a key event. Returns an empty string if the event cant be represented as a character. - - :type event: int - :arg event: key event from :mod:`bge.keys` or the keyboard sensor. - :type shift: bool - :arg shift: set to true if shift is held. - :rtype: string - -**************** -Keys (Constants) -**************** - -.. _mouse-keys: - -========== -Mouse Keys -========== - -.. data:: LEFTMOUSE -.. data:: MIDDLEMOUSE -.. data:: RIGHTMOUSE -.. data:: WHEELUPMOUSE -.. data:: WHEELDOWNMOUSE -.. data:: MOUSEX -.. data:: MOUSEY - -.. _keyboard-keys: - -============= -Keyboard Keys -============= - -------------- -Alphabet keys -------------- - -.. data:: AKEY -.. data:: BKEY -.. data:: CKEY -.. data:: DKEY -.. data:: EKEY -.. data:: FKEY -.. data:: GKEY -.. data:: HKEY -.. data:: IKEY -.. data:: JKEY -.. data:: KKEY -.. data:: LKEY -.. data:: MKEY -.. data:: NKEY -.. data:: OKEY -.. data:: PKEY -.. data:: QKEY -.. data:: RKEY -.. data:: SKEY -.. data:: TKEY -.. data:: UKEY -.. data:: VKEY -.. data:: WKEY -.. data:: XKEY -.. data:: YKEY -.. data:: ZKEY - ------------ -Number keys ------------ - -.. data:: ZEROKEY -.. data:: ONEKEY -.. data:: TWOKEY -.. data:: THREEKEY -.. data:: FOURKEY -.. data:: FIVEKEY -.. data:: SIXKEY -.. data:: SEVENKEY -.. data:: EIGHTKEY -.. data:: NINEKEY - --------------- -Modifiers Keys --------------- - -.. data:: CAPSLOCKKEY -.. data:: LEFTCTRLKEY -.. data:: LEFTALTKEY -.. data:: RIGHTALTKEY -.. data:: RIGHTCTRLKEY -.. data:: RIGHTSHIFTKEY -.. data:: LEFTSHIFTKEY - ----------- -Arrow Keys ----------- - -.. data:: LEFTARROWKEY -.. data:: DOWNARROWKEY -.. data:: RIGHTARROWKEY -.. data:: UPARROWKEY - --------------- -Numberpad Keys --------------- - -.. data:: PAD0 -.. data:: PAD1 -.. data:: PAD2 -.. data:: PAD3 -.. data:: PAD4 -.. data:: PAD5 -.. data:: PAD6 -.. data:: PAD7 -.. data:: PAD8 -.. data:: PAD9 -.. data:: PADPERIOD -.. data:: PADSLASHKEY -.. data:: PADASTERKEY -.. data:: PADMINUS -.. data:: PADENTER -.. data:: PADPLUSKEY - -------------- -Function Keys -------------- - -.. data:: F1KEY -.. data:: F2KEY -.. data:: F3KEY -.. data:: F4KEY -.. data:: F5KEY -.. data:: F6KEY -.. data:: F7KEY -.. data:: F8KEY -.. data:: F9KEY -.. data:: F10KEY -.. data:: F11KEY -.. data:: F12KEY -.. data:: F13KEY -.. data:: F14KEY -.. data:: F15KEY -.. data:: F16KEY -.. data:: F17KEY -.. data:: F18KEY -.. data:: F19KEY - ----------- -Other Keys ----------- - -.. data:: ACCENTGRAVEKEY -.. data:: BACKSLASHKEY -.. data:: BACKSPACEKEY -.. data:: COMMAKEY -.. data:: DELKEY -.. data:: ENDKEY -.. data:: EQUALKEY -.. data:: ESCKEY -.. data:: HOMEKEY -.. data:: INSERTKEY -.. data:: LEFTBRACKETKEY -.. data:: LINEFEEDKEY -.. data:: MINUSKEY -.. data:: PAGEDOWNKEY -.. data:: PAGEUPKEY -.. data:: PAUSEKEY -.. data:: PERIODKEY -.. data:: QUOTEKEY -.. data:: RIGHTBRACKETKEY -.. data:: RETKEY (Deprecated: use bge.events.ENTERKEY) -.. data:: ENTERKEY -.. data:: SEMICOLONKEY -.. data:: SLASHKEY -.. data:: SPACEKEY -.. data:: TABKEY diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst deleted file mode 100644 index d3261f5747b..00000000000 --- a/source/gameengine/PyDoc/bge.logic.rst +++ /dev/null @@ -1,932 +0,0 @@ - -Game Engine bge.logic Module -============================ -***** -Intro -***** - -Module to access logic functions, imported automatically into the python controllers namespace. - -.. module:: bge.logic - -.. code-block:: python - - # To get the controller thats running this python script: - cont = bge.logic.getCurrentController() # bge.logic is automatically imported - - # To get the game object this controller is on: - obj = cont.owner - -:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`bge.types.~KX_LightObject` methods are available depending on the type of object - -.. code-block:: python - - # To get a sensor linked to this controller. - # "sensorname" is the name of the sensor as defined in the Blender interface. - # +---------------------+ +--------+ - # | Sensor "sensorname" +--+ Python + - # +---------------------+ +--------+ - sens = cont.sensors["sensorname"] - - # To get a sequence of all sensors: - sensors = co.sensors - -See the sensor's reference for available methods: - -.. hlist:: - :columns: 3 - - * :class:`~bge.types.KX_MouseFocusSensor` - * :class:`~bge.types.KX_NearSensor` - * :class:`~bge.types.KX_NetworkMessageSensor` - * :class:`~bge.types.KX_RadarSensor` - * :class:`~bge.types.KX_RaySensor` - * :class:`~bge.types.KX_TouchSensor` - * :class:`~bge.types.SCA_DelaySensor` - * :class:`~bge.types.SCA_JoystickSensor` - * :class:`~bge.types.SCA_KeyboardSensor` - * :class:`~bge.types.SCA_MouseSensor` - * :class:`~bge.types.SCA_PropertySensor` - * :class:`~bge.types.SCA_RandomSensor` - -You can also access actuators linked to the controller - -.. code-block:: python - - # To get an actuator attached to the controller: - # +--------+ +-------------------------+ - # + Python +--+ Actuator "actuatorname" | - # +--------+ +-------------------------+ - actuator = co.actuators["actuatorname"] - - # Activate an actuator - controller.activate(actuator) - -See the actuator's reference for available methods - -.. hlist:: - :columns: 3 - - * :class:`~bge.types.BL_ActionActuator` - * :class:`~bge.types.BL_ShapeActionActuator` - * :class:`~bge.types.KX_CameraActuator` - * :class:`~bge.types.KX_ConstraintActuator` - * :class:`~bge.types.KX_GameActuator` - * :class:`~bge.types.KX_IpoActuator` - * :class:`~bge.types.KX_NetworkMessageActuator` - * :class:`~bge.types.KX_ObjectActuator` - * :class:`~bge.types.KX_ParentActuator` - * :class:`~bge.types.KX_SCA_AddObjectActuator` - * :class:`~bge.types.KX_SCA_DynamicActuator` - * :class:`~bge.types.KX_SCA_EndObjectActuator` - * :class:`~bge.types.KX_SCA_ReplaceMeshActuator` - * :class:`~bge.types.KX_SceneActuator` - * :class:`~bge.types.KX_SoundActuator` - * :class:`~bge.types.KX_StateActuator` - * :class:`~bge.types.KX_TrackToActuator` - * :class:`~bge.types.KX_VisibilityActuator` - * :class:`~bge.types.SCA_2DFilterActuator` - * :class:`~bge.types.SCA_PropertyActuator` - * :class:`~bge.types.SCA_RandomActuator` - -Most logic brick's methods are accessors for the properties available in the logic buttons. -Consult the logic bricks documentation for more information on how each logic brick works. - -There are also methods to access the current :class:`bge.types.KX_Scene` - -.. code-block:: python - - # Get the current scene - scene = bge.logic.getCurrentScene() - - # Get the current camera - cam = scene.active_camera - -Matricies as used by the game engine are **row major** -``matrix[row][col] = float`` - -:class:`bge.types.KX_Camera` has some examples using matricies. - -********* -Variables -********* - -.. data:: globalDict - - A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. - It can also be written to a file and loaded later on with the game load/save actuators. - - .. note:: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expected. - -.. data:: keyboard - - The current keyboard wrapped in an :class:`~bge.types.SCA_PythonKeyboard` object. - -.. data:: mouse - - The current mouse wrapped in an :class:`~bge.types.SCA_PythonMouse` object. - -***************** -General functions -***************** - -.. function:: getCurrentController() - - Gets the Python controller associated with this Python script. - - :rtype: :class:`bge.types.SCA_PythonController` - -.. function:: getCurrentScene() - - Gets the current Scene. - - :rtype: :class:`bge.types.KX_Scene` - -.. function:: getSceneList() - - Gets a list of the current scenes loaded in the game engine. - - :rtype: list of :class:`bge.types.KX_Scene` - - .. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes. - -.. function:: loadGlobalDict() - - Loads bge.logic.globalDict from a file. - -.. function:: saveGlobalDict() - - Saves bge.logic.globalDict to a file. - -.. function:: startGame(blend) - - Loads the blend file. - - :arg blend: The name of the blend file - :type blend: string - -.. function:: endGame() - - Ends the current game. - -.. function:: restartGame() - - Restarts the current game by reloading the .blend file (the last saved version, not what is currently running). - -.. function:: LibLoad(blend, type, data) - - Converts the all of the datablocks of the given type from the given blend. - - :arg blend: The path to the blend file (or the name to use for the library if data is supplied) - :type blend: string - :arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported) - :type type: string - :arg data: Binary data from a blend file (optional) - :type data: bytes - -.. function:: LibNew(name, type, data) - - Uses existing datablock data and loads in as a new library. - - :arg name: A unique library name used for removal later - :type name: string - :arg type: The datablock type (currently only "Mesh" is supported) - :type type: string - :arg data: A list of names of the datablocks to load - :type data: list of strings - -.. function:: LibFree(name) - - Frees a library, removing all objects and meshes from the currently active scenes. - - :arg name: The name of the library to free (the name used in LibNew) - :type name: string - -.. function:: addScene(name, overlay=1) - - Loads a scene into the game engine. - - :arg name: The name of the scene - :type name: string - :arg overlay: Overlay or underlay (optional) - :type overlay: integer - -.. function:: sendMessage(subject, body="", to="", message_from="") - - Sends a message to sensors in any active scene. - - :arg subject: The subject of the message - :type subject: string - :arg body: The body of the message (optional) - :type body: string - :arg to: The name of the object to send the message to (optional) - :type to: string - :arg message_from: The name of the object that the message is coming from (optional) - :type message_from: string - -.. function:: setGravity(gravity) - - Sets the world gravity. - - :type gravity: list [fx, fy, fz] - -.. function:: getSpectrum() - - Returns a 512 point list from the sound card. - This only works if the fmod sound driver is being used. - - :rtype: list [float], len(getSpectrum()) == 512 - -.. function:: stopDSP() - - Stops the sound driver using DSP effects. - - Only the fmod sound driver supports this. - DSP can be computationally expensive. - -.. function:: getMaxLogicFrame() - - Gets the maximum number of logic frames per render frame. - - :return: The maximum number of logic frames per render frame - :rtype: integer - -.. function:: setMaxLogicFrame(maxlogic) - - Sets the maximum number of logic frames that are executed per render frame. - This does not affect the physic system that still runs at full frame rate. - - :arg maxlogic: The new maximum number of logic frames per render frame. Valid values: 1..5 - :type maxlogic: integer - -.. function:: getMaxPhysicsFrame() - - Gets the maximum number of physics frames per render frame. - - :return: The maximum number of physics frames per render frame - :rtype: integer - -.. function:: setMaxPhysicsFrame(maxphysics) - - Sets the maximum number of physics timestep that are executed per render frame. - Higher value allows physics to keep up with realtime even if graphics slows down the game. - Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate) - maxphysics/ticrate is the maximum delay of the renderer that physics can compensate. - - :arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5. - :type maxphysics: integer - -.. function:: getLogicTicRate() - - Gets the logic update frequency. - - :return: The logic frequency in Hz - :rtype: float - -.. function:: setLogicTicRate(ticrate) - - Sets the logic update frequency. - - The logic update frequency is the number of times logic bricks are executed every second. - The default is 60 Hz. - - :arg ticrate: The new logic update frequency (in Hz). - :type ticrate: float - -.. function:: getPhysicsTicRate() - - Gets the physics update frequency - - :return: The physics update frequency in Hz - :rtype: float - - .. warning: Not implimented yet - -.. function:: setPhysicsTicRate(ticrate) - - Sets the physics update frequency - - The physics update frequency is the number of times the physics system is executed every second. - The default is 60 Hz. - - :arg ticrate: The new update frequency (in Hz). - :type ticrate: float - - .. warning: Not implimented yet - -***************** -Utility functions -***************** - -.. function:: expandPath(path) - - Converts a blender internal path into a proper file system path. - - Use / as directory separator in path - You can use '//' at the start of the string to define a relative path; - Blender replaces that string by the directory of the startup .blend or runtime file - to make a full path name (doesn't change during the game, even if you load other .blend). - The function also converts the directory separator to the local file system format. - - :arg path: The path string to be converted/expanded. - :type path: string - :return: The converted string - :rtype: string - -.. function:: getAverageFrameRate() - - Gets the estimated average framerate - - :return: The estimed average framerate in frames per second - :rtype: float - -.. function:: getBlendFileList(path = "//") - - Returns a list of blend files in the same directory as the open blend file, or from using the option argument. - - :arg path: Optional directory argument, will be expanded (like expandPath) into the full path. - :type path: string - :return: A list of filenames, with no directory prefix - :rtype: list - -.. function:: getRandomFloat() - - Returns a random floating point value in the range [0 - 1) - -.. function:: PrintGLInfo() - - Prints GL Extension Info into the console - -********* -Constants -********* - -.. data:: KX_TRUE - - True value used by some modules. - -.. data:: KX_FALSE - - False value used by some modules. - -======= -Sensors -======= - -.. _sensor-status: - -------------- -Sensor Status -------------- - -.. data:: KX_SENSOR_INACTIVE -.. data:: KX_SENSOR_JUST_ACTIVATED -.. data:: KX_SENSOR_ACTIVE -.. data:: KX_SENSOR_JUST_DEACTIVATED - -.. _logic-property-sensor: - ---------------- -Property Sensor ---------------- - -.. data:: KX_PROPSENSOR_EQUAL - - Activate when the property is equal to the sensor value. - - :value: 1 - -.. data:: KX_PROPSENSOR_NOTEQUAL - - Activate when the property is not equal to the sensor value. - - :value: 2 - -.. data:: KX_PROPSENSOR_INTERVAL - - Activate when the property is between the specified limits. - - :value: 3 - -.. data:: KX_PROPSENSOR_CHANGED - - Activate when the property changes - - :value: 4 - -.. data:: KX_PROPSENSOR_EXPRESSION - - Activate when the expression matches - - :value: 5 - ------------- -Radar Sensor ------------- - -See :class:`bge.types.KX_RadarSensor` - -.. data:: KX_RADAR_AXIS_POS_X -.. data:: KX_RADAR_AXIS_POS_Y -.. data:: KX_RADAR_AXIS_POS_Z -.. data:: KX_RADAR_AXIS_NEG_X -.. data:: KX_RADAR_AXIS_NEG_Y -.. data:: KX_RADAR_AXIS_NEG_Z - ----------- -Ray Sensor ----------- - -See :class:`bge.types.KX_RaySensor` - -.. data:: KX_RAY_AXIS_POS_X -.. data:: KX_RAY_AXIS_POS_Y -.. data:: KX_RAY_AXIS_POS_Z -.. data:: KX_RAY_AXIS_NEG_X -.. data:: KX_RAY_AXIS_NEG_Y -.. data:: KX_RAY_AXIS_NEG_Z - - -========= -Actuators -========= - -.. _action-actuator: - ---------------- -Action Actuator ---------------- - -See :class:`bge.types.BL_ActionActuator` - -.. data:: KX_ACTIONACT_PLAY -.. data:: KX_ACTIONACT_FLIPPER -.. data:: KX_ACTIONACT_LOOPSTOP -.. data:: KX_ACTIONACT_LOOPEND -.. data:: KX_ACTIONACT_PROPERTY - -------------------- -Constraint Actuator -------------------- - -.. _constraint-actuator-option: - -See :class:`bge.types.KX_ConstraintActuator.option` - -* Applicable to Distance constraint: - - .. data:: KX_ACT_CONSTRAINT_NORMAL - - Activate alignment to surface - - .. data:: KX_ACT_CONSTRAINT_DISTANCE - - Activate distance control - - .. data:: KX_ACT_CONSTRAINT_LOCAL - - Direction of the ray is along the local axis - -* Applicable to Force field constraint: - - .. data:: KX_ACT_CONSTRAINT_DOROTFH - - Force field act on rotation as well - -* Applicable to both: - - .. data:: KX_ACT_CONSTRAINT_MATERIAL - - Detect material rather than property - - .. data:: KX_ACT_CONSTRAINT_PERMANENT - - No deactivation if ray does not hit target - -.. _constraint-actuator-limit: - -See :class:`bge.types.KX_ConstraintActuator.limit` - -.. data:: KX_CONSTRAINTACT_LOCX - - Limit X coord. - -.. data:: KX_CONSTRAINTACT_LOCY - - Limit Y coord - -.. data:: KX_CONSTRAINTACT_LOCZ - - Limit Z coord - -.. data:: KX_CONSTRAINTACT_ROTX - - Limit X rotation - -.. data:: KX_CONSTRAINTACT_ROTY - - Limit Y rotation - -.. data:: KX_CONSTRAINTACT_ROTZ - - Limit Z rotation - -.. data:: KX_CONSTRAINTACT_DIRNX - - Set distance along negative X axis - -.. data:: KX_CONSTRAINTACT_DIRNY - - Set distance along negative Y axis - -.. data:: KX_CONSTRAINTACT_DIRNZ - - Set distance along negative Z axis - -.. data:: KX_CONSTRAINTACT_DIRPX - - Set distance along positive X axis - -.. data:: KX_CONSTRAINTACT_DIRPY - - Set distance along positive Y axis - -.. data:: KX_CONSTRAINTACT_DIRPZ - - Set distance along positive Z axis - -.. data:: KX_CONSTRAINTACT_ORIX - - Set orientation of X axis - -.. data:: KX_CONSTRAINTACT_ORIY - - Set orientation of Y axis - -.. data:: KX_CONSTRAINTACT_ORIZ - - Set orientation of Z axis - -.. data:: KX_ACT_CONSTRAINT_FHNX - - Set force field along negative X axis - -.. data:: KX_ACT_CONSTRAINT_FHNY - - Set force field along negative Y axis - -.. data:: KX_ACT_CONSTRAINT_FHNZ - - Set force field along negative Z axis - -.. data:: KX_ACT_CONSTRAINT_FHPX - - Set force field along positive X axis - -.. data:: KX_ACT_CONSTRAINT_FHPY - - Set force field along positive Y axis - -.. data:: KX_ACT_CONSTRAINT_FHPZ - - Set force field along positive Z axis - ----------------- -Dynamic Actuator ----------------- - -See :class:`bge.types.KX_SCA_DynamicActuator` - -.. data:: KX_DYN_RESTORE_DYNAMICS -.. data:: KX_DYN_DISABLE_DYNAMICS -.. data:: KX_DYN_ENABLE_RIGID_BODY -.. data:: KX_DYN_DISABLE_RIGID_BODY -.. data:: KX_DYN_SET_MASS - -.. _game-actuator: - -------------- -Game Actuator -------------- - -See :class:`bge.types.KX_GameActuator` - -.. data:: KX_GAME_LOAD -.. data:: KX_GAME_START -.. data:: KX_GAME_RESTART -.. data:: KX_GAME_QUIT -.. data:: KX_GAME_SAVECFG -.. data:: KX_GAME_LOADCFG - -.. _ipo-actuator: - ------------- -IPO Actuator ------------- - -See :class:`bge.types.KX_IpoActuator` - -.. data:: KX_IPOACT_PLAY -.. data:: KX_IPOACT_PINGPONG -.. data:: KX_IPOACT_FLIPPER -.. data:: KX_IPOACT_LOOPSTOP -.. data:: KX_IPOACT_LOOPEND -.. data:: KX_IPOACT_FROM_PROP - ---------------- -Parent Actuator ---------------- - -.. data:: KX_PARENT_REMOVE -.. data:: KX_PARENT_SET - -.. _logic-random-distributions: - --------------------- -Random Distributions --------------------- - -See :class:`bge.types.SCA_RandomActuator` - -.. data:: KX_RANDOMACT_BOOL_CONST -.. data:: KX_RANDOMACT_BOOL_UNIFORM -.. data:: KX_RANDOMACT_BOOL_BERNOUILLI -.. data:: KX_RANDOMACT_INT_CONST -.. data:: KX_RANDOMACT_INT_UNIFORM -.. data:: KX_RANDOMACT_INT_POISSON -.. data:: KX_RANDOMACT_FLOAT_CONST -.. data:: KX_RANDOMACT_FLOAT_UNIFORM -.. data:: KX_RANDOMACT_FLOAT_NORMAL -.. data:: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL - --------------- -Scene Actuator --------------- - -See :class:`bge.types.KX_SceneActuator` - -.. data:: KX_SCENE_RESTART -.. data:: KX_SCENE_SET_SCENE -.. data:: KX_SCENE_SET_CAMERA -.. data:: KX_SCENE_ADD_FRONT_SCENE -.. data:: KX_SCENE_ADD_BACK_SCENE -.. data:: KX_SCENE_REMOVE_SCENE -.. data:: KX_SCENE_SUSPEND -.. data:: KX_SCENE_RESUME - -.. _shape-action-actuator: - ---------------------- -Shape Action Actuator ---------------------- - -See :class:`bge.types.BL_ActionActuator` - -.. data:: KX_ACTIONACT_PLAY -.. data:: KX_ACTIONACT_FLIPPER -.. data:: KX_ACTIONACT_LOOPSTOP -.. data:: KX_ACTIONACT_LOOPEND -.. data:: KX_ACTIONACT_PROPERTY - -.. _logic-sound-actuator: - --------------- -Sound Actuator --------------- - -See :class:`bge.types.KX_SoundActuator` - -.. data:: KX_SOUNDACT_PLAYSTOP - - :value: 1 - -.. data:: KX_SOUNDACT_PLAYEND - - :value: 2 - -.. data:: KX_SOUNDACT_LOOPSTOP - - :value: 3 - -.. data:: KX_SOUNDACT_LOOPEND - - :value: 4 - -.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL - - :value: 5 - -.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP - - :value: 6 - - -======= -Various -======= - -.. _input-status: - ------------- -Input Status ------------- - -See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor` - -.. data:: KX_INPUT_NONE -.. data:: KX_INPUT_JUST_ACTIVATED -.. data:: KX_INPUT_ACTIVE -.. data:: KX_INPUT_JUST_RELEASED - -------------- -Mouse Buttons -------------- - -See :class:`bge.types.SCA_MouseSensor` - -.. data:: KX_MOUSE_BUT_LEFT -.. data:: KX_MOUSE_BUT_MIDDLE -.. data:: KX_MOUSE_BUT_RIGHT - ------- -States ------- - -See :class:`bge.types.KX_StateActuator` - -.. data:: KX_STATE1 -.. data:: KX_STATE2 -.. data:: KX_STATE3 -.. data:: KX_STATE4 -.. data:: KX_STATE5 -.. data:: KX_STATE6 -.. data:: KX_STATE7 -.. data:: KX_STATE8 -.. data:: KX_STATE9 -.. data:: KX_STATE10 -.. data:: KX_STATE11 -.. data:: KX_STATE12 -.. data:: KX_STATE13 -.. data:: KX_STATE14 -.. data:: KX_STATE15 -.. data:: KX_STATE16 -.. data:: KX_STATE17 -.. data:: KX_STATE18 -.. data:: KX_STATE19 -.. data:: KX_STATE20 -.. data:: KX_STATE21 -.. data:: KX_STATE22 -.. data:: KX_STATE23 -.. data:: KX_STATE24 -.. data:: KX_STATE25 -.. data:: KX_STATE26 -.. data:: KX_STATE27 -.. data:: KX_STATE28 -.. data:: KX_STATE29 -.. data:: KX_STATE30 - -.. _state-actuator-operation: - -See :class:`bge.types.KX_StateActuator.operation` - -.. data:: KX_STATE_OP_CLR - - Substract bits to state mask - - :value: 0 - -.. data:: KX_STATE_OP_CPY - - Copy state mask - - :value: 1 - -.. data:: KX_STATE_OP_NEG - - Invert bits to state mask - - :value: 2 - -.. data:: KX_STATE_OP_SET - - Add bits to state mask - - :value: 3 - -.. _Two-D-FilterActuator-mode: - ---------- -2D Filter ---------- - -.. data:: RAS_2DFILTER_BLUR - - :value: 2 - -.. data:: RAS_2DFILTER_CUSTOMFILTER - - Customer filter, the code code is set via shaderText property. - - :value: 12 - -.. data:: RAS_2DFILTER_DILATION - - :value: 4 - -.. data:: RAS_2DFILTER_DISABLED - - Disable the filter that is currently active - - :value: -1 - -.. data:: RAS_2DFILTER_ENABLED - - Enable the filter that was previously disabled - - :value: -2 - -.. data:: RAS_2DFILTER_EROSION - - :value: 5 - -.. data:: RAS_2DFILTER_GRAYSCALE - - :value: 9 - -.. data:: RAS_2DFILTER_INVERT - - :value: 11 - -.. data:: RAS_2DFILTER_LAPLACIAN - - :value: 6 - -.. data:: RAS_2DFILTER_MOTIONBLUR - - Create and enable preset filters - - :value: 1 - -.. data:: RAS_2DFILTER_NOFILTER - - Disable and destroy the filter that is currently active - - :value: 0 - -.. data:: RAS_2DFILTER_PREWITT - - :value: 8 - -.. data:: RAS_2DFILTER_SEPIA - - :value: 10 - -.. data:: RAS_2DFILTER_SHARPEN - - :value: 3 - -.. data:: RAS_2DFILTER_SOBEL - - :value: 7 - ------- -Shader ------- - -.. data:: VIEWMATRIX -.. data:: VIEWMATRIX_INVERSE -.. data:: VIEWMATRIX_INVERSETRANSPOSE -.. data:: VIEWMATRIX_TRANSPOSE -.. data:: MODELMATRIX -.. data:: MODELMATRIX_INVERSE -.. data:: MODELMATRIX_INVERSETRANSPOSE -.. data:: MODELMATRIX_TRANSPOSE -.. data:: MODELVIEWMATRIX -.. data:: MODELVIEWMATRIX_INVERSE -.. data:: MODELVIEWMATRIX_INVERSETRANSPOSE -.. data:: MODELVIEWMATRIX_TRANSPOSE -.. data:: CAM_POS - - Current camera position - -.. data:: CONSTANT_TIMER - - User a timer for the uniform value. - -.. data:: SHD_TANGENT - ----------------- -Blender Material ----------------- - -.. data:: BL_DST_ALPHA -.. data:: BL_DST_COLOR -.. data:: BL_ONE -.. data:: BL_ONE_MINUS_DST_ALPHA -.. data:: BL_ONE_MINUS_DST_COLOR -.. data:: BL_ONE_MINUS_SRC_ALPHA -.. data:: BL_ONE_MINUS_SRC_COLOR -.. data:: BL_SRC_ALPHA -.. data:: BL_SRC_ALPHA_SATURATE -.. data:: BL_SRC_COLOR -.. data:: BL_ZERO diff --git a/source/gameengine/PyDoc/bge.render.rst b/source/gameengine/PyDoc/bge.render.rst deleted file mode 100644 index 9f17455601b..00000000000 --- a/source/gameengine/PyDoc/bge.render.rst +++ /dev/null @@ -1,242 +0,0 @@ - -Game Engine bge.render Module -============================= - -***** -Intro -***** - -.. module:: bge.render - -.. code-block:: python - - # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook:: - # To use a mouse movement sensor "Mouse" and a - # motion actuator to mouse look: - import bge.render - import bge.logic - - # SCALE sets the speed of motion - SCALE=[1, 0.5] - - co = bge.logic.getCurrentController() - obj = co.getOwner() - mouse = co.getSensor("Mouse") - lmotion = co.getActuator("LMove") - wmotion = co.getActuator("WMove") - - # Transform the mouse coordinates to see how far the mouse has moved. - def mousePos(): - x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0] - y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1] - return (x, y) - - pos = mousePos() - - # Set the amount of motion: X is applied in world coordinates... - lmotion.setTorque(0.0, 0.0, pos[0], False) - # ...Y is applied in local coordinates - wmotion.setTorque(-pos[1], 0.0, 0.0, True) - - # Activate both actuators - bge.logic.addActiveActuator(lmotion, True) - bge.logic.addActiveActuator(wmotion, True) - - # Centre the mouse - bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2) - -********* -Constants -********* - -.. data:: KX_TEXFACE_MATERIAL - - Materials as defined by the texture face settings. - -.. data:: KX_BLENDER_MULTITEX_MATERIAL - - Materials approximating blender materials with multitexturing. - -.. data:: KX_BLENDER_GLSL_MATERIAL - - Materials approximating blender materials with GLSL. - -********* -Functions -********* - -.. function:: getWindowWidth() - - Gets the width of the window (in pixels) - - :rtype: integer - -.. function:: getWindowHeight() - - Gets the height of the window (in pixels) - - :rtype: integer - -.. function:: makeScreenshot(filename) - - Writes a screenshot to the given filename. - - If filename starts with // the image will be saved relative to the current directory. - If the filename contains # it will be replaced with the frame number. - - The standalone player saves .png files. It does not support colour space conversion - or gamma correction. - - When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg. - Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels. - - :type filename: string - - -.. function:: enableVisibility(visible) - - Doesn't really do anything... - - -.. function:: showMouse(visible) - - Enables or disables the operating system mouse cursor. - - :type visible: boolean - - -.. function:: setMousePosition(x, y) - - Sets the mouse cursor position. - - :type x: integer - :type y: integer - - -.. function:: setBackgroundColor(rgba) - - Sets the window background colour. - - :type rgba: list [r, g, b, a] - - -.. function:: setMistColor(rgb) - - Sets the mist colour. - - :type rgb: list [r, g, b] - - -.. function:: setAmbientColor(rgb) - - Sets the color of ambient light. - - :type rgb: list [r, g, b] - - -.. function:: setMistStart(start) - - Sets the mist start value. Objects further away than start will have mist applied to them. - - :type start: float - - -.. function:: setMistEnd(end) - - Sets the mist end value. Objects further away from this will be coloured solid with - the colour set by setMistColor(). - - :type end: float - - -.. function:: disableMist() - - Disables mist. - - .. note:: Set any of the mist properties to enable mist. - - -.. function:: setEyeSeparation(eyesep) - - Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value. - - :arg eyesep: The distance between the left and right eye. - :type eyesep: float - - -.. function:: getEyeSeparation() - - Gets the current eye separation for stereo mode. - - :rtype: float - - -.. function:: setFocalLength(focallength) - - Sets the focal length for stereo mode. It uses the current camera focal length as initial value. - - :arg focallength: The focal length. - :type focallength: float - -.. function:: getFocalLength() - - Gets the current focal length for stereo mode. - - :rtype: float - -.. function:: setMaterialMode(mode) - - Set the material mode to use for OpenGL rendering. - - :type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL - - .. note:: Changes will only affect newly created scenes. - - -.. function:: getMaterialMode(mode) - - Get the material mode to use for OpenGL rendering. - - :rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL - - -.. function:: setGLSLMaterialSetting(setting, enable) - - Enables or disables a GLSL material setting. - - :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) - :type enable: boolean - - -.. function:: getGLSLMaterialSetting(setting, enable) - - Get the state of a GLSL material setting. - - :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) - :rtype: boolean - - -.. function:: drawLine(fromVec,toVec,color) - - Draw a line in the 3D scene. - - :arg fromVec: the origin of the line - :type fromVec: list [x, y, z] - :arg toVec: the end of the line - :type toVec: list [x, y, z] - :arg color: the color of the line - :type color: list [r, g, b] - - -.. function:: enableMotionBlur(factor) - - Enable the motion blur effect. - - :arg factor: the ammount of motion blur to display. - :type factor: float [0.0 - 1.0] - - -.. function:: disableMotionBlur() - - Disable the motion blur effect. - diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst deleted file mode 100644 index 6dc5488af32..00000000000 --- a/source/gameengine/PyDoc/bge.types.rst +++ /dev/null @@ -1,5227 +0,0 @@ - -Game Engine bge.types Module -============================= - -.. module:: bge.types - -.. class:: PyObjectPlus - - PyObjectPlus base class of most other types in the Game Engine. - - .. attribute:: invalid - - Test if the object has been freed by the game engine and is no longer valid. - - Normally this is not a problem but when storing game engine data in the GameLogic module, - KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data. - Calling an attribute or method on an invalid object will raise a SystemError. - - The invalid attribute allows testing for this case without exception handling. - - :type: boolean - - .. method:: isA(game_type) - - Check if this is a type or a subtype game_type. - - :arg game_type: the name of the type or the type its self from the :mod:`bge.types` module. - :type game_type: string or type - :return: True if this object is a type or a subtype of game_type. - :rtype: boolean - -.. class:: CValue(PyObjectPlus) - - This class is a basis for other classes. - - .. attribute:: name - - The name of this CValue derived object (read-only). - - :type: string - -.. class:: CPropValue(CValue) - - This class has no python functions - -.. class:: SCA_ILogicBrick(CValue) - - Base class for all logic bricks. - - .. attribute:: executePriority - - This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). - - :type: executePriority: int - - .. attribute:: owner - - The game object this logic brick is attached to (read-only). - - :type: :class:`KX_GameObject` or None in exceptional cases. - - .. attribute:: name - - The name of this logic brick (read-only). - - :type: string - -.. class:: SCA_PythonKeyboard(PyObjectPlus) - - The current keyboard. - - .. attribute:: events - - A dictionary containing the status of each keyboard event or key. (read-only). - - :type: dictionary {:ref:`keycode`::ref:`status`, ...} - -.. class:: SCA_PythonMouse(PyObjectPlus) - - The current mouse. - - .. attribute:: events - - a dictionary containing the status of each mouse event. (read-only). - - :type: dictionary {:ref:`keycode`::ref:`status`, ...} - - .. attribute:: position - - The normalized x and y position of the mouse cursor. - - :type: list [x, y] - - .. attribute:: visible - - The visibility of the mouse cursor. - - :type: boolean - -.. class:: SCA_IObject(CValue) - - This class has no python functions - -.. class:: SCA_ISensor(SCA_ILogicBrick) - - Base class for all sensor logic bricks. - - .. attribute:: usePosPulseMode - - Flag to turn positive pulse mode on and off. - - :type: boolean - - .. attribute:: useNegPulseMode - - Flag to turn negative pulse mode on and off. - - :type: boolean - - .. attribute:: frequency - - The frequency for pulse mode sensors. - - :type: integer - - .. attribute:: level - - level Option whether to detect level or edge transition when entering a state. - It makes a difference only in case of logic state transition (state actuator). - A level detector will immediately generate a pulse, negative or positive - depending on the sensor condition, as soon as the state is activated. - A edge detector will wait for a state change before generating a pulse. - note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`. - - :type: boolean - - .. attribute:: tap - - When enabled only sensors that are just activated will send a positive event, - after this they will be detected as negative by the controllers. - This will make a key thats held act as if its only tapped for an instant. - note: mutually exclusive with :data:`level`, enabling will disable :data:`level`. - - :type: boolean - - .. attribute:: invert - - Flag to set if this sensor activates on positive or negative events. - - :type: boolean - - .. attribute:: triggered - - True if this sensor brick is in a positive state. (read-only). - - :type: boolean - - .. attribute:: positive - - True if this sensor brick is in a positive state. (read-only). - - :type: boolean - - .. attribute:: status - - The status of the sensor (read-only): can be one of :ref:`these constants`. - - :type: int - - .. note:: - - This convenient attribute combines the values of triggered and positive attributes. - - .. method:: reset() - - Reset sensor internal state, effect depends on the type of sensor and settings. - - The sensor is put in its initial state as if it was just activated. - -.. class:: SCA_IController(SCA_ILogicBrick) - - Base class for all controller logic bricks. - - .. attribute:: state - - The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active. - - :type: int bitmask - - .. attribute:: sensors - - A list of sensors linked to this controller. - - :type: sequence supporting index/string lookups and iteration. - - .. note:: - - The sensors are not necessarily owned by the same object. - - .. note:: - - When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. - - .. attribute:: actuators - - A list of actuators linked to this controller. - - :type: sequence supporting index/string lookups and iteration. - - .. note:: - - The sensors are not necessarily owned by the same object. - - .. note:: - - When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. - - .. attribute:: useHighPriority - - When set the controller executes always before all other controllers that dont have this set. - - :type: boolen - - .. note:: - - Order of execution between high priority controllers is not guaranteed. - -.. class:: SCA_IActuator(SCA_ILogicBrick) - - Base class for all actuator logic bricks. - -.. class:: BL_ActionActuator(SCA_IActuator) - - Action Actuators apply an action to an actor. - - .. attribute:: action - - The name of the action to set as the current action. - - :type: string - - .. attribute:: channelNames - - A list of channel names that may be used with :data:`setChannel` and :data:`getChannel`. - - :type: list of strings - - .. attribute:: frameStart - - Specifies the starting frame of the animation. - - :type: float - - .. attribute:: frameEnd - - Specifies the ending frame of the animation. - - :type: float - - .. attribute:: blendIn - - Specifies the number of frames of animation to generate when making transitions between actions. - - :type: float - - .. attribute:: priority - - Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. - - :type: integer - - .. attribute:: frame - - Sets the current frame for the animation. - - :type: float - - .. attribute:: propName - - Sets the property to be used in FromProp playback mode. - - :type: string - - .. attribute:: blendTime - - Sets the internal frame timer. This property must be in the range from 0.0 to blendIn. - - :type: float - - .. attribute:: mode - - The operation mode of the actuator. Can be one of :ref:`these constants`. - - :type: integer - - .. attribute:: useContinue - - The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame. - - :type: boolean - - .. attribute:: framePropName - - The name of the property that is set to the current frame number. - - :type: string - - .. method:: setChannel(channel, matrix) - - Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported. - - :arg channel: A string specifying the name of the bone channel, error raised if not in :data:`channelNames`. - :type channel: string - :arg matrix: A 4x4 matrix specifying the overriding transformation as an offset from the bone's rest position. - :arg matrix: list [[float]] - - .. note:: - - These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation. - - .. method:: getChannel(channel) - - :arg channel: A string specifying the name of the bone channel. error raised if not in :data:`channelNames`. - :type channel: string - :return: (loc, size, quat) - :rtype: tuple - -.. class:: BL_Shader(PyObjectPlus) - - BL_Shader GLSL shaders. - - TODO - Description - - .. method:: setUniformfv(name, fList) - - Set a uniform with a list of float values - - :arg name: the uniform name - :type name: string - :arg fList: a list (2, 3 or 4 elements) of float values - :type fList: list[float] - - .. method:: delSource() - - Clear the shader. Use this method before the source is changed with :data:`setSource`. - - .. method:: getFragmentProg() - - Returns the fragment program. - - :return: The fragment program. - :rtype: string - - .. method:: getVertexProg() - - Get the vertex program. - - :return: The vertex program. - :rtype: string - - .. method:: isValid() - - Check if the shader is valid. - - :return: True if the shader is valid - :rtype: boolean - - .. method:: setAttrib(enum) - - Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.) - - :arg enum: attribute location value - :type enum: integer - - .. method:: setNumberOfPasses( max_pass ) - - Set the maximum number of passes. Not used a.t.m. - - :arg max_pass: the maximum number of passes - :type max_pass: integer - - .. method:: setSampler(name, index) - - Set uniform texture sample index. - - :arg name: Uniform name - :type name: string - :arg index: Texture sample index. - :type index: integer - - .. method:: setSource(vertexProgram, fragmentProgram) - - Set the vertex and fragment programs - - :arg vertexProgram: Vertex program - :type vertexProgram: string - :arg fragmentProgram: Fragment program - :type fragmentProgram: string - - .. method:: setUniform1f(name, fx) - - Set a uniform with 1 float value. - - :arg name: the uniform name - :type name: string - :arg fx: Uniform value - :type fx: float - - .. method:: setUniform1i(name, ix) - - Set a uniform with an integer value. - - :arg name: the uniform name - :type name: string - :arg ix: the uniform value - :type ix: integer - - .. method:: setUniform2f(name, fx, fy) - - Set a uniform with 2 float values - - :arg name: the uniform name - :type name: string - :arg fx: first float value - :type fx: float - - :arg fy: second float value - :type fy: float - - .. method:: setUniform2i(name, ix, iy) - - Set a uniform with 2 integer values - - :arg name: the uniform name - :type name: string - :arg ix: first integer value - :type ix: integer - :arg iy: second integer value - :type iy: integer - - .. method:: setUniform3f(name, fx, fy, fz) - - Set a uniform with 3 float values. - - :arg name: the uniform name - :type name: string - :arg fx: first float value - :type fx: float - :arg fy: second float value - :type fy: float - :arg fz: third float value - :type fz: float - - .. method:: setUniform3i(name, ix, iy, iz) - - Set a uniform with 3 integer values - - :arg name: the uniform name - :type name: string - :arg ix: first integer value - :type ix: integer - :arg iy: second integer value - :type iy: integer - :arg iz: third integer value - :type iz: integer - - .. method:: setUniform4f(name, fx, fy, fz, fw) - - Set a uniform with 4 float values. - - :arg name: the uniform name - :type name: string - :arg fx: first float value - :type fx: float - :arg fy: second float value - :type fy: float - :arg fz: third float value - :type fz: float - :arg fw: fourth float value - :type fw: float - - .. method:: setUniform4i(name, ix, iy, iz, iw) - - Set a uniform with 4 integer values - - :arg name: the uniform name - :type name: string - :arg ix: first integer value - :type ix: integer - :arg iy: second integer value - :type iy: integer - :arg iz: third integer value - :type iz: integer - :arg iw: fourth integer value - :type iw: integer - - .. method:: setUniformDef(name, type) - - Define a new uniform - - :arg name: the uniform name - :type name: string - :arg type: uniform type - :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX - - .. method:: setUniformMatrix3(name, mat, transpose) - - Set a uniform with a 3x3 matrix value - - :arg name: the uniform name - :type name: string - :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]] - :type mat: 3x3 matrix - :arg transpose: set to True to transpose the matrix - :type transpose: boolean - - .. method:: setUniformMatrix4(name, mat, transpose) - - Set a uniform with a 4x4 matrix value - - :arg name: the uniform name - :type name: string - :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]] - :type mat: 4x4 matrix - :arg transpose: set to True to transpose the matrix - :type transpose: boolean - - .. method:: setUniformiv(name, iList) - - Set a uniform with a list of integer values - - :arg name: the uniform name - :type name: string - :arg iList: a list (2, 3 or 4 elements) of integer values - :type iList: list[integer] - - .. method:: validate() - - Validate the shader object. - -.. class:: BL_ShapeActionActuator(SCA_IActuator) - - ShapeAction Actuators apply an shape action to an mesh object. - - .. attribute:: action - - The name of the action to set as the current shape action. - - :type: string - - .. attribute:: frameStart - - Specifies the starting frame of the shape animation. - - :type: float - - .. attribute:: frameEnd - - Specifies the ending frame of the shape animation. - - :type: float - - .. attribute:: blendIn - - Specifies the number of frames of animation to generate when making transitions between actions. - - :type: float - - .. attribute:: priority - - Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. - - :type: integer - - .. attribute:: frame - - Sets the current frame for the animation. - - :type: float - - .. attribute:: propName - - Sets the property to be used in FromProp playback mode. - - :type: string - - .. attribute:: blendTime - - Sets the internal frame timer. This property must be in the range from 0.0 to blendin. - - :type: float - - .. attribute:: mode - - The operation mode of the actuator. Can be one of :ref:`these constants`. - - :type: integer - - .. attribute:: framePropName - - The name of the property that is set to the current frame number. - - :type: string - -.. class:: CListValue(CPropValue) - - This is a list like object used in the game engine internally that behaves similar to a python list in most ways. - - As well as the normal index lookup (``val= clist[i]``), CListValue supports string lookups (``val= scene.objects["Cube"]``) - - Other operations such as ``len(clist)``, ``list(clist)``, ``clist[0:10]`` are also supported. - - .. method:: append(val) - - Add an item to the list (like pythons append) - - .. warning:: - - Appending values to the list can cause crashes when the list is used internally by the game engine. - - .. method:: count(val) - - Count the number of instances of a value in the list. - - :return: number of instances - :rtype: integer - - .. method:: index(val) - - Return the index of a value in the list. - - :return: The index of the value in the list. - :rtype: integer - - .. method:: reverse() - - Reverse the order of the list. - - .. method:: get(key, default=None) - - Return the value matching key, or the default value if its not found. - - :return: The key value or a default. - - .. method:: from_id(id) - - This is a funtion especially for the game engine to return a value with a spesific id. - - Since object names are not always unique, the id of an object can be used to get an object from the CValueList. - - Example: - - .. code-block:: python - - myObID=id(gameObject) - ob= scene.objects.from_id(myObID) - - Where ``myObID`` is an int or long from the id function. - - This has the advantage that you can store the id in places you could not store a gameObject. - - .. warning:: - - The id is derived from a memory location and will be different each time the game engine starts. - -.. class:: KX_BlenderMaterial(PyObjectPlus) - - KX_BlenderMaterial - - .. method:: getShader() - - Returns the material's shader. - - :return: the material's shader - :rtype: :class:`BL_Shader` - - .. method:: setBlending(src, dest) - - Set the pixel color arithmetic functions. - - :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed. - :type src: Value in... - - * GL_ZERO, - * GL_ONE, - * GL_SRC_COLOR, - * GL_ONE_MINUS_SRC_COLOR, - * GL_DST_COLOR, - * GL_ONE_MINUS_DST_COLOR, - * GL_SRC_ALPHA, - * GL_ONE_MINUS_SRC_ALPHA, - * GL_DST_ALPHA, - * GL_ONE_MINUS_DST_ALPHA, - * GL_SRC_ALPHA_SATURATE - - :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed. - :type dest: Value in... - - * GL_ZERO - * GL_ONE - * GL_SRC_COLOR - * GL_ONE_MINUS_SRC_COLOR - * GL_DST_COLOR - * GL_ONE_MINUS_DST_COLOR - * GL_SRC_ALPHA - * GL_ONE_MINUS_SRC_ALPHA - * GL_DST_ALPHA - * GL_ONE_MINUS_DST_ALPHA - * GL_SRC_ALPHA_SATURATE - - .. method:: getMaterialIndex() - - Returns the material's index. - - :return: the material's index - :rtype: integer - -.. class:: KX_CameraActuator(SCA_IActuator) - - Applies changes to a camera. - - .. attribute:: min - - minimum distance to the target object maintained by the actuator. - - :type: float - - .. attribute:: max - - maximum distance to stay from the target object. - - :type: float - - .. attribute:: height - - height to stay above the target object. - - :type: float - - .. attribute:: useXY - - axis this actuator is tracking, True=X, False=Y. - - :type: boolean - - .. attribute:: object - - the object this actuator tracks. - - :type: :class:`KX_GameObject` or None - -.. class:: KX_ConstraintActuator(SCA_IActuator) - - A constraint actuator limits the position, rotation, distance or orientation of an object. - - .. attribute:: damp - - Time constant of the constraint expressed in frame (not use by Force field constraint). - - :type: integer - - .. attribute:: rotDamp - - Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well. - - :type: integer - - .. attribute:: direction - - The reference direction in world coordinate for the orientation constraint. - - :type: 3-tuple of float: (x, y, z) - - .. attribute:: option - - Binary combination of :ref:`these constants ` - - :type: integer - - .. attribute:: time - - activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time. - - :type: integer - - .. attribute:: propName - - the name of the property or material for the ray detection of the distance constraint. - - :type: string - - .. attribute:: min - - The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant. - - :type: float - - .. attribute:: distance - - the target distance of the distance constraint. - - :type: float - - .. attribute:: max - - the upper bound of the constraint. For rotation and orientation constraints, it represents radiant. - - :type: float - - .. attribute:: rayLength - - the length of the ray of the distance constraint. - - :type: float - - .. attribute:: limit - - type of constraint. Use one of the :ref:`these constants ` - - :type: integer. - - -.. class:: KX_ConstraintWrapper(PyObjectPlus) - - KX_ConstraintWrapper - - .. method:: getConstraintId(val) - - Returns the contraint's ID - - :return: the constraint's ID - :rtype: integer - -.. class:: KX_GameActuator(SCA_IActuator) - - The game actuator loads a new .blend file, restarts the current .blend file or quits the game. - - .. attribute:: fileName - - the new .blend file to load. - - :type: string - - .. attribute:: mode - - The mode of this actuator. Can be on of :ref:`these constants ` - - :type: Int - -.. class:: KX_GameObject(SCA_IObject) - - All game objects are derived from this class. - - Properties assigned to game objects are accessible as attributes of this class. - - .. note:: - - Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check. - - .. attribute:: name - - The object's name. (read-only). - - :type: string - - .. attribute:: mass - - The object's mass - - :type: float - - .. note:: - - The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0. - - .. attribute:: linVelocityMin - - Enforces the object keeps moving at a minimum velocity. - - :type: float - - .. note:: - - Applies to dynamic and rigid body objects only. - - .. note:: - - A value of 0.0 disables this option. - - .. note:: - - While objects are stationary the minimum velocity will not be applied. - - .. attribute:: linVelocityMax - - Clamp the maximum linear velocity to prevent objects moving beyond a set speed. - - :type: float - - .. note:: - - Applies to dynamic and rigid body objects only. - - .. note:: - - A value of 0.0 disables this option (rather then setting it stationary). - - .. attribute:: localInertia - - the object's inertia vector in local coordinates. Read only. - - :type: list [ix, iy, iz] - - .. attribute:: parent - - The object's parent object. (read-only). - - :type: :class:`KX_GameObject` or None - - .. attribute:: visible - - visibility flag. - - :type: boolean - - .. note:: - - Game logic will still run for invisible objects. - - .. attribute:: color - - The object color of the object. [r, g, b, a] - - :type: :class:`mathutils.Vector` - - .. attribute:: occlusion - - occlusion capability flag. - - :type: boolean - - .. attribute:: position - - The object's position. [x, y, z] On write: local position, on read: world position - - .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. - - :type: :class:`mathurils.Vector` - - .. attribute:: orientation - - The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation - - .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`. - - :type: :class:`mathutils.Matrix` - - .. attribute:: scaling - - The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling - - .. deprecated:: use :data:`localScale` and :data:`worldScale`. - - :type: :class:`mathutils.Vector` - - .. attribute:: localOrientation - - The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. - - :type: :class:`mathutils.Matrix` - - .. attribute:: worldOrientation - - The object's world orientation. 3x3 Matrix. - - :type: :class:`mathutils.Matrix` - - .. attribute:: localScale - - The object's local scaling factor. [sx, sy, sz] - - :type: :class:`mathutils.Vector` - - .. attribute:: worldScale - - The object's world scaling factor. Read-only. [sx, sy, sz] - - :type: :class:`mathutils.Vector` - - .. attribute:: localPosition - - The object's local position. [x, y, z] - - :type: :class:`mathutils.Vector` - - .. attribute:: worldPosition - - The object's world position. [x, y, z] - - :type: :class:`mathutils.Vector` - - .. attribute:: localLinearVelocity - - The object's local linear velocity. [x, y, z] - - :type: :class:`mathutils.Vector` - - .. attribute:: worldLinearVelocity - - The object's world linear velocity. [x, y, z] - - :type: :class:`mathutils.Vector` - - .. attribute:: localAngularVelocity - - The object's local angular velocity. [x, y, z] - - :type: :class:`mathutils.Vector` - - .. attribute:: worldAngularVelocity - - The object's world angular velocity. [x, y, z] - - :type: :class:`mathutils.Vector` - - .. attribute:: timeOffset - - adjust the slowparent delay at runtime. - - :type: float - - .. attribute:: state - - the game object's state bitmask, using the first 30 bits, one bit must always be set. - - :type: int - - .. attribute:: meshes - - a list meshes for this object. - - :type: list of :class:`KX_MeshProxy` - - .. note:: - - Most objects use only 1 mesh. - - .. note:: - - Changes to this list will not update the KX_GameObject. - - .. attribute:: sensors - - a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support. - - :type: list - - .. note:: - - This attribute is experemental and may be removed (but probably wont be). - - .. note:: - - Changes to this list will not update the KX_GameObject. - - .. attribute:: controllers - - a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support. - - :type: list of :class:`SCA_ISensor` - - .. note:: - - This attribute is experemental and may be removed (but probably wont be). - - .. note:: - - Changes to this list will not update the KX_GameObject. - - .. attribute:: actuators - - a list of :class:`SCA_IActuator` with string/index lookups and iterator support. - - :type: list - - .. note:: - - This attribute is experemental and may be removed (but probably wont be). - - .. note:: - - Changes to this list will not update the KX_GameObject. - - .. attribute:: attrDict - - get the objects internal python attribute dictionary for direct (faster) access. - - :type: dict - - .. attribute:: children - - direct children of this object, (read-only). - - :type: :class:`CListValue` of :class:`KX_GameObject`'s - - .. attribute:: childrenRecursive - - all children of this object including childrens children, (read-only). - - :type: :class:`CListValue` of :class:`KX_GameObject`'s - - .. method:: endObject() - - Delete this object, can be used in place of the EndObject Actuator. - - The actual removal of the object from the scene is delayed. - - .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False) - - Replace the mesh of this object with a new mesh. This works the same was as the actuator. - - :arg mesh: mesh to replace or the meshes name. - :type mesh: :class:`MeshProxy` or string - :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument). - :type useDisplayMesh: boolean - :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument). - :type usePhysicsMesh: boolean - - .. method:: setVisible(visible, recursive) - - Sets the game object's visible flag. - - :arg visible: the visible state to set. - :type visible: boolean - :arg recursive: optional argument to set all childrens visibility flag too. - :type recursive: boolean - - .. method:: setOcclusion(occlusion, recursive) - - Sets the game object's occlusion capability. - - :arg occlusion: the state to set the occlusion to. - :type occlusion: boolean - :arg recursive: optional argument to set all childrens occlusion flag too. - :type recursive: boolean - - .. method:: alignAxisToVect(vect, axis=2, factor=1.0) - - Aligns any of the game object's axis along the given vector. - - - :arg vect: a vector to align the axis. - :type vect: 3D vector - :arg axis: The axis you want to align - - * 0: X axis - * 1: Y axis - * 2: Z axis - - :type axis: integer - :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0) - :type factor: float - - .. method:: getAxisVect(vect) - - Returns the axis vector rotates by the objects worldspace orientation. - This is the equivalent of multiplying the vector by the orientation matrix. - - :arg vect: a vector to align the axis. - :type vect: 3D Vector - :return: The vector in relation to the objects rotation. - :rtype: 3d vector. - - .. method:: applyMovement(movement, local=False) - - Sets the game object's movement. - - :arg movement: movement vector. - :type movement: 3D Vector - :arg local: - * False: you get the "global" movement ie: relative to world orientation. - * True: you get the "local" movement ie: relative to object orientation. - :arg local: boolean - - .. method:: applyRotation(rotation, local=False) - - Sets the game object's rotation. - - :arg rotation: rotation vector. - :type rotation: 3D Vector - :arg local: - * False: you get the "global" rotation ie: relative to world orientation. - * True: you get the "local" rotation ie: relative to object orientation. - :arg local: boolean - - .. method:: applyForce(force, local=False) - - Sets the game object's force. - - This requires a dynamic object. - - :arg force: force vector. - :type force: 3D Vector - :arg local: - * False: you get the "global" force ie: relative to world orientation. - * True: you get the "local" force ie: relative to object orientation. - :type local: boolean - - .. method:: applyTorque(torque, local=False) - - Sets the game object's torque. - - This requires a dynamic object. - - :arg torque: torque vector. - :type torque: 3D Vector - :arg local: - * False: you get the "global" torque ie: relative to world orientation. - * True: you get the "local" torque ie: relative to object orientation. - :type local: boolean - - .. method:: getLinearVelocity(local=False) - - Gets the game object's linear velocity. - - This method returns the game object's velocity through it's centre of mass, ie no angular velocity component. - - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - :type local: boolean - :return: the object's linear velocity. - :rtype: list [vx, vy, vz] - - .. method:: setLinearVelocity(velocity, local=False) - - Sets the game object's linear velocity. - - This method sets game object's velocity through it's centre of mass, - ie no angular velocity component. - - This requires a dynamic object. - - :arg velocity: linear velocity vector. - :type velocity: 3D Vector - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - :type local: boolean - - .. method:: getAngularVelocity(local=False) - - Gets the game object's angular velocity. - - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - :type local: boolean - :return: the object's angular velocity. - :rtype: list [vx, vy, vz] - - .. method:: setAngularVelocity(velocity, local=False) - - Sets the game object's angular velocity. - - This requires a dynamic object. - - :arg velocity: angular velocity vector. - :type velocity: boolean - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - - .. method:: getVelocity(point=(0, 0, 0)) - - Gets the game object's velocity at the specified point. - - Gets the game object's velocity at the specified point, including angular - components. - - :arg point: optional point to return the velocity for, in local coordinates. - :type point: 3D Vector - :return: the velocity at the specified point. - :rtype: list [vx, vy, vz] - - .. method:: getReactionForce() - - Gets the game object's reaction force. - - The reaction force is the force applied to this object over the last simulation timestep. - This also includes impulses, eg from collisions. - - :return: the reaction force of this object. - :rtype: list [fx, fy, fz] - - .. note:: - - This is not implimented at the moment. - - .. method:: applyImpulse(point, impulse) - - Applies an impulse to the game object. - - This will apply the specified impulse to the game object at the specified point. - If point != position, applyImpulse will also change the object's angular momentum. - Otherwise, only linear momentum will change. - - :arg point: the point to apply the impulse to (in world coordinates) - :type point: the point to apply the impulse to (in world coordinates) - - .. method:: suspendDynamics() - - Suspends physics for this object. - - .. method:: restoreDynamics() - - Resumes physics for this object. - - .. note:: - - The objects linear velocity will be applied from when the dynamics were suspended. - - .. method:: enableRigidBody() - - Enables rigid body physics for this object. - - Rigid body physics allows the object to roll on collisions. - - .. note:: - - This is not working with bullet physics yet. - - .. method:: disableRigidBody() - - Disables rigid body physics for this object. - - .. note:: - - This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later. - - .. method:: setParent(parent, compound=True, ghost=True) - - Sets this object's parent. - Control the shape status with the optional compound and ghost parameters: - - In that case you can control if it should be ghost or not: - - :arg parent: new parent object. - :type parent: :class:`KX_GameObject` - :arg compound: whether the shape should be added to the parent compound shape. - - * True: the object shape should be added to the parent compound shape. - * False: the object should keep its individual shape. - - :type compound: boolean - :arg ghost: whether the object should be ghost while parented. - - * True: if the object should be made ghost while parented. - * False: if the object should be solid while parented. - - :type ghost: boolean - - .. note:: - - If the object type is sensor, it stays ghost regardless of ghost parameter - - .. method:: removeParent() - - Removes this objects parent. - - .. method:: getPhysicsId() - - Returns the user data object associated with this game object's physics controller. - - .. method:: getPropertyNames() - - Gets a list of all property names. - - :return: All property names for this object. - :rtype: list - - .. method:: getDistanceTo(other) - - :arg other: a point or another :class:`KX_GameObject` to measure the distance to. - :type other: :class:`KX_GameObject` or list [x, y, z] - :return: distance to another object or point. - :rtype: float - - .. method:: getVectTo(other) - - Returns the vector and the distance to another object or point. - The vector is normalized unless the distance is 0, in which a zero length vector is returned. - - :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to. - :type other: :class:`KX_GameObject` or list [x, y, z] - :return: (distance, globalVector(3), localVector(3)) - :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z)) - - .. method:: rayCastTo(other, dist, prop) - - Look towards another point/object and find first object hit within dist that matches prop. - - The ray is always casted from the center of the object, ignoring the object itself. - The ray is casted towards the center of another object or an explicit [x, y, z] point. - Use rayCast() if you need to retrieve the hit point - - :arg other: [x, y, z] or object towards which the ray is casted - :type other: :class:`KX_GameObject` or 3-tuple - :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other - :type dist: float - :arg prop: property name that object must have; can be omitted => detect any object - :type prop: string - :return: the first object hit or None if no object or object does not match prop - :rtype: :class:`KX_GameObject` - - .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly) - - Look from a point/object to another point/object and find first object hit within dist that matches prop. - if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit. - if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element. - if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element. - - .. code-block:: python - - # shoot along the axis gun-gunAim (gunAim should be collision-free) - obj, point, normal = gun.rayCast(gunAim, None, 50) - if obj: - # do something - pass - - The face paremeter determines the orientation of the normal. - - * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside) - * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect) - - The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray. - The prop and xray parameters interact as follow. - - * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray. - * prop off, xray on : idem. - * prop on, xray off: return closest hit if it matches prop, no hit otherwise. - * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray. - - The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray. - If there is no hit or the hit object is not a static mesh, None is returned as 4th element. - - The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects. - - :arg objto: [x, y, z] or object to which the ray is casted - :type objto: :class:`KX_GameObject` or 3-tuple - :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center - :type objfrom: :class:`KX_GameObject` or 3-tuple or None - :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to - :type dist: float - :arg prop: property name that object must have; can be omitted or "" => detect any object - :type prop: string - :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin - :type face: integer - :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object - :type xray: integer - :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit. - - * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit - * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape. - * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping. - - :type poly: integer - :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv). - - * object, hitpoint and hitnormal are None if no hit. - * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None - * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None - - :rtype: - - * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz)) - * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`) - * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v)) - - .. note:: - - The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points. - - .. method:: setCollisionMargin(margin) - - Set the objects collision margin. - - :arg margin: the collision margin distance in blender units. - :type margin: float - - .. note:: - - If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError. - - .. method:: sendMessage(subject, body="", to="") - - Sends a message. - - :arg subject: The subject of the message - :type subject: string - :arg body: The body of the message (optional) - :type body: string - :arg to: The name of the object to send the message to (optional) - :type to: string - - .. method:: reinstancePhysicsMesh(gameObject, meshObject) - - Updates the physics system with the changed mesh. - - If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object. - - :arg gameObject: optional argument, set the physics shape from this gameObjets mesh. - :type gameObject: string, :class:`KX_GameObject` or None - :arg meshObject: optional argument, set the physics shape from this mesh. - :type meshObject: string, :class:`MeshProxy` or None - - :return: True if reinstance succeeded, False if it failed. - :rtype: boolean - - .. note:: - - If this object has instances the other instances will be updated too. - - .. note:: - - The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf). - - .. warning:: - - Only triangle mesh type objects are supported currently (not convex hull) - - .. warning:: - - If the object is a part of a combound object it will fail (parent or child) - - .. warning:: - - Rebuilding the physics mesh can be slow, running many times per second will give a performance hit. - - .. method:: get(key, default=None) - - Return the value matching key, or the default value if its not found. - :return: The key value or a default. - -.. class:: KX_IpoActuator(SCA_IActuator) - - IPO actuator activates an animation. - - .. attribute:: frameStart - - Start frame. - - :type: float - - .. attribute:: frameEnd - - End frame. - - :type: float - - .. attribute:: propName - - Use this property to define the Ipo position. - - :type: string - - .. attribute:: framePropName - - Assign this property this action current frame number. - - :type: string - - .. attribute:: mode - - Play mode for the ipo. Can be on of :ref:`these constants ` - - :type: integer - - .. attribute:: useIpoAsForce - - Apply Ipo as a global or local force depending on the local option (dynamic objects only). - - :type: boolean - - .. attribute:: useIpoAdd - - Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag. - - :type: boolean - - .. attribute:: useIpoLocal - - Let the ipo acts in local coordinates, used in Force and Add mode. - - :type: boolean - - .. attribute:: useChildren - - Update IPO on all children Objects as well. - - :type: boolean - -.. class:: KX_LightObject(KX_GameObject) - - A Light object. - - .. code-block:: python - - # Turn on a red alert light. - import bge - - co = bge.logic.getCurrentController() - light = co.owner - - light.energy = 1.0 - light.colour = [1.0, 0.0, 0.0] - - .. data:: SPOT - - A spot light source. See attribute :data:`type` - - .. data:: SUN - - A point light source with no attenuation. See attribute :data:`type` - - .. data:: NORMAL - - A point light source. See attribute :data:`type` - - .. attribute:: type - - The type of light - must be SPOT, SUN or NORMAL - - .. attribute:: layer - - The layer mask that this light affects object on. - - :type: bitfield - - .. attribute:: energy - - The brightness of this light. - - :type: float - - .. attribute:: distance - - The maximum distance this light can illuminate. (SPOT and NORMAL lights only). - - :type: float - - .. attribute:: colour - - The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]. - - :type: list [r, g, b] - - .. attribute:: color - - Synonym for colour. - - .. attribute:: lin_attenuation - - The linear component of this light's attenuation. (SPOT and NORMAL lights only). - - :type: float - - .. attribute:: quad_attenuation - - The quadratic component of this light's attenuation (SPOT and NORMAL lights only). - - :type: float - - .. attribute:: spotsize - - The cone angle of the spot light, in degrees (SPOT lights only). - - :type: float in [0 - 180]. - - .. attribute:: spotblend - - Specifies the intensity distribution of the spot light (SPOT lights only). - - :type: float in [0 - 1] - - .. note:: - - Higher values result in a more focused light source. - -.. class:: KX_MeshProxy(SCA_IObject) - - A mesh object. - - You can only change the vertex properties of a mesh object, not the mesh topology. - - To use mesh objects effectively, you should know a bit about how the game engine handles them. - - #. Mesh Objects are converted from Blender at scene load. - #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds: - - #. The texture. - #. The Blender material. - #. The Tile properties - #. The face properties - (From the "Texture Face" panel) - #. Transparency & z sorting - #. Light layer - #. Polygon shape (triangle/quad) - #. Game Object - - #. Verticies will be split by face if necessary. Verticies can only be shared between faces if: - - #. They are at the same position - #. UV coordinates are the same - #. Their normals are the same (both polygons are "Set Smooth") - #. They are the same colour, for example: a cube has 24 verticies: 6 faces with 4 verticies per face. - - The correct method of iterating over every :class:`KX_VertexProxy` in a game object - - .. code-block:: python - - import GameLogic - - co = GameLogic.getCurrentController() - obj = co.owner - - m_i = 0 - mesh = obj.getMesh(m_i) # There can be more than one mesh... - while mesh != None: - for mat in range(mesh.getNumMaterials()): - for v_index in range(mesh.getVertexArrayLength(mat)): - vertex = mesh.getVertex(mat, v_index) - # Do something with vertex here... - # ... eg: colour the vertex red. - vertex.colour = [1.0, 0.0, 0.0, 1.0] - m_i += 1 - mesh = obj.getMesh(m_i) - - .. attribute:: materials - - :type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types - - .. attribute:: numPolygons - - :type: integer - - .. attribute:: numMaterials - - :type: integer - - .. method:: getNumMaterials() - - :return: number of materials associated with this object - :rtype: integer - - .. method:: getMaterialName(matid) - - Gets the name of the specified material. - - :arg matid: the specified material. - :type matid: integer - :return: the attached material name. - :rtype: string - - .. method:: getTextureName(matid) - - Gets the name of the specified material's texture. - - :arg matid: the specified material - :type matid: integer - :return: the attached material's texture name. - :rtype: string - - .. method:: getVertexArrayLength(matid) - - Gets the length of the vertex array associated with the specified material. - - There is one vertex array for each material. - - :arg matid: the specified material - :type matid: integer - :return: the number of verticies in the vertex array. - :rtype: integer - - .. method:: getVertex(matid, index) - - Gets the specified vertex from the mesh object. - - :arg matid: the specified material - :type matid: integer - :arg index: the index into the vertex array. - :type index: integer - :return: a vertex object. - :rtype: :class:`KX_VertexProxy` - - .. method:: getNumPolygons() - - :return: The number of polygon in the mesh. - :rtype: integer - - .. method:: getPolygon(index) - - Gets the specified polygon from the mesh. - - :arg index: polygon number - :type index: integer - :return: a polygon object. - :rtype: :class:`PolyProxy` - -.. class:: SCA_MouseSensor(SCA_ISensor) - - Mouse Sensor logic brick. - - .. attribute:: position - - current [x, y] coordinates of the mouse, in frame coordinates (pixels). - - :type: [integer, interger] - - .. attribute:: mode - - sensor mode. - - :type: integer - - * KX_MOUSESENSORMODE_LEFTBUTTON(1) - * KX_MOUSESENSORMODE_MIDDLEBUTTON(2) - * KX_MOUSESENSORMODE_RIGHTBUTTON(3) - * KX_MOUSESENSORMODE_WHEELUP(4) - * KX_MOUSESENSORMODE_WHEELDOWN(5) - * KX_MOUSESENSORMODE_MOVEMENT(6) - - .. method:: getButtonStatus(button) - - Get the mouse button status. - - :arg button: The code that represents the key you want to get the state of, use one of :ref:`these constants` - :type button: int - :return: The state of the given key, can be one of :ref:`these constants` - :rtype: int - -.. class:: KX_MouseFocusSensor(SCA_MouseSensor) - - The mouse focus sensor detects when the mouse is over the current game object. - - The mouse focus sensor works by transforming the mouse coordinates from 2d device - space to 3d space then raycasting away from the camera. - - .. attribute:: raySource - - The worldspace source of the ray (the view position). - - :type: list (vector of 3 floats) - - .. attribute:: rayTarget - - The worldspace target of the ray. - - :type: list (vector of 3 floats) - - .. attribute:: rayDirection - - The :data:`rayTarget` - :class:`raySource` normalized. - - :type: list (normalized vector of 3 floats) - - .. attribute:: hitObject - - the last object the mouse was over. - - :type: :class:`KX_GameObject` or None - - .. attribute:: hitPosition - - The worldspace position of the ray intersecton. - - :type: list (vector of 3 floats) - - .. attribute:: hitNormal - - the worldspace normal from the face at point of intersection. - - :type: list (normalized vector of 3 floats) - - .. attribute:: hitUV - - the UV coordinates at the point of intersection. - - :type: list (vector of 2 floats) - - If the object has no UV mapping, it returns [0, 0]. - - The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping. - - .. attribute:: usePulseFocus - - When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set). - - :type: boolean - -.. class:: KX_TouchSensor(SCA_ISensor) - - Touch sensor detects collisions between objects. - - .. attribute:: propName - - The property or material to collide with. - - :type: string - - .. attribute:: useMaterial - - Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property. - - :type: boolean - - .. attribute:: usePulseCollision - - When enabled, changes to the set of colliding objects generate a pulse. - - :type: boolean - - .. attribute:: hitObject - - The last collided object. (read-only). - - :type: :class:`KX_GameObject` or None - - .. attribute:: hitObjectList - - A list of colliding objects. (read-only). - - :type: :class:`CListValue` of :class:`KX_GameObject` - -.. class:: KX_NearSensor(KX_TouchSensor) - - A near sensor is a specialised form of touch sensor. - - .. attribute:: distance - - The near sensor activates when an object is within this distance. - - :type: float - - .. attribute:: resetDistance - - The near sensor deactivates when the object exceeds this distance. - - :type: float - -.. class:: KX_NetworkMessageActuator(SCA_IActuator) - - Message Actuator - - .. attribute:: propName - - Messages will only be sent to objects with the given property name. - - :type: string - - .. attribute:: subject - - The subject field of the message. - - :type: string - - .. attribute:: body - - The body of the message. - - :type: string - - .. attribute:: usePropBody - - Send a property instead of a regular body message. - - :type: boolean - -.. class:: KX_NetworkMessageSensor(SCA_ISensor) - - The Message Sensor logic brick. - - Currently only loopback (local) networks are supported. - - .. attribute:: subject - - The subject the sensor is looking for. - - :type: string - - .. attribute:: frameMessageCount - - The number of messages received since the last frame. (read-only). - - :type: integer - - .. attribute:: subjects - - The list of message subjects received. (read-only). - - :type: list of strings - - .. attribute:: bodies - - The list of message bodies received. (read-only). - - :type: list of strings - -.. class:: KX_ObjectActuator(SCA_IActuator) - - The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, - velocity, or angular velocity to an object. - Servo control allows to regulate force to achieve a certain speed target. - - .. attribute:: force - - The force applied by the actuator. - - :type: list [x, y, z] - - .. attribute:: useLocalForce - - A flag specifying if the force is local. - - :type: boolean - - .. attribute:: torque - - The torque applied by the actuator. - - :type: list [x, y, z] - - .. attribute:: useLocalTorque - - A flag specifying if the torque is local. - - :type: boolean - - .. attribute:: dLoc - - The displacement vector applied by the actuator. - - :type: list [x, y, z] - - .. attribute:: useLocalDLoc - - A flag specifying if the dLoc is local. - - :type: boolean - - .. attribute:: dRot - - The angular displacement vector applied by the actuator - - :type: list [x, y, z] - - .. note:: - - Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed. - - .. attribute:: useLocalDRot - - A flag specifying if the dRot is local. - - :type: boolean - - .. attribute:: linV - - The linear velocity applied by the actuator. - - :type: list [x, y, z] - - .. attribute:: useLocalLinV - - A flag specifying if the linear velocity is local. - - :type: boolean - - .. note:: - - This is the target speed for servo controllers. - - .. attribute:: angV - - The angular velocity applied by the actuator. - - :type: list [x, y, z] - - .. attribute:: useLocalAngV - - A flag specifying if the angular velocity is local. - - :type: boolean - - .. attribute:: damping - - The damping parameter of the servo controller. - - :type: short - - .. attribute:: forceLimitX - - The min/max force limit along the X axis and activates or deactivates the limits in the servo controller. - - :type: list [min(float), max(float), bool] - - .. attribute:: forceLimitY - - The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller. - - :type: list [min(float), max(float), bool] - - .. attribute:: forceLimitZ - - The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller. - - :type: list [min(float), max(float), bool] - - .. attribute:: pid - - The PID coefficients of the servo controller. - - :type: list of floats [proportional, integral, derivate] - - .. attribute:: reference - - The object that is used as reference to compute the velocity for the servo controller. - - :type: :class:`KX_GameObject` or None - -.. class:: KX_ParentActuator(SCA_IActuator) - - The parent actuator can set or remove an objects parent object. - - .. attribute:: object - - the object this actuator sets the parent too. - - :type: :class:`KX_GameObject` or None - - .. attribute:: mode - - The mode of this actuator. - - :type: integer from 0 to 1. - - .. attribute:: compound - - Whether the object shape should be added to the parent compound shape when parenting. - - Effective only if the parent is already a compound shape. - - :type: boolean - - .. attribute:: ghost - - Whether the object should be made ghost when parenting - Effective only if the shape is not added to the parent compound shape. - - :type: boolean - -.. class:: KX_PhysicsObjectWrapper(PyObjectPlus) - - KX_PhysicsObjectWrapper - - .. method:: setActive(active) - - Set the object to be active. - - :arg active: set to True to be active - :type active: boolean - - .. method:: setAngularVelocity(x, y, z, local) - - Set the angular velocity of the object. - - :arg x: angular velocity for the x-axis - :type x: float - - :arg y: angular velocity for the y-axis - :type y: float - - :arg z: angular velocity for the z-axis - :type z: float - - :arg local: set to True for local axis - :type local: boolean - - .. method:: setLinearVelocity(x, y, z, local) - - Set the linear velocity of the object. - - :arg x: linear velocity for the x-axis - :type x: float - - :arg y: linear velocity for the y-axis - :type y: float - - :arg z: linear velocity for the z-axis - :type z: float - - :arg local: set to True for local axis - :type local: boolean - -.. class:: KX_PolyProxy(SCA_IObject) - - A polygon holds the index of the vertex forming the poylgon. - - Note: - The polygon attributes are read-only, you need to retrieve the vertex proxy if you want - to change the vertex settings. - - .. attribute:: matname - - The name of polygon material, empty if no material. - - :type: string - - .. attribute:: material - - The material of the polygon. - - :type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` - - .. attribute:: texture - - The texture name of the polygon. - - :type: string - - .. attribute:: matid - - The material index of the polygon, use this to retrieve vertex proxy from mesh proxy. - - :type: integer - - .. attribute:: v1 - - vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy. - - :type: integer - - .. attribute:: v2 - - vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy. - - :type: integer - - .. attribute:: v3 - - vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy. - - :type: integer - - .. attribute:: v4 - - Vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex - Use this to retrieve vertex proxy from mesh proxy. - - :type: integer - - .. attribute:: visible - - visible state of the polygon: 1=visible, 0=invisible. - - :type: integer - - .. attribute:: collide - - collide state of the polygon: 1=receives collision, 0=collision free. - - :type: integer - - .. method:: getMaterialName() - - Returns the polygon material name with MA prefix - - :return: material name - :rtype: string - - .. method:: getMaterial() - - :return: The polygon material - :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` - - .. method:: getTextureName() - - :return: The texture name - :rtype: string - - .. method:: getMaterialIndex() - - Returns the material bucket index of the polygon. - This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. - - :return: the material index in the mesh - :rtype: integer - - .. method:: getNumVertex() - - Returns the number of vertex of the polygon. - - :return: number of vertex, 3 or 4. - :rtype: integer - - .. method:: isVisible() - - Returns whether the polygon is visible or not - - :return: 0=invisible, 1=visible - :rtype: boolean - - .. method:: isCollider() - - Returns whether the polygon is receives collision or not - - :return: 0=collision free, 1=receives collision - :rtype: integer - - .. method:: getVertexIndex(vertex) - - Returns the mesh vertex index of a polygon vertex - This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. - - :arg vertex: index of the vertex in the polygon: 0->3 - :arg vertex: integer - :return: mesh vertex index - :rtype: integer - - .. method:: getMesh() - - Returns a mesh proxy - - :return: mesh proxy - :rtype: :class:`MeshProxy` - -.. class:: KX_PolygonMaterial(PyObjectPlus) - - This is the interface to materials in the game engine. - - Materials define the render state to be applied to mesh objects. - - .. warning:: - - Some of the methods/variables are CObjects. If you mix these up, you will crash blender. - - This example requires `PyOpenGL `_ and `GLEWPy `_ - - .. code-block:: python - - import GameLogic - import OpenGL - from OpenGL.GL import * - from OpenGL.GLU import * - import glew - from glew import * - - glewInit() - - vertex_shader = """ - - void main(void) - { - gl_Position = ftransform(); - } - """ - - fragment_shader =""" - - void main(void) - { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - } - """ - - class MyMaterial: - def __init__(self): - self.pass_no = 0 - # Create a shader - self.m_program = glCreateProgramObjectARB() - # Compile the vertex shader - self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader)) - # Compile the fragment shader - self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader)) - # Link the shaders together - self.link() - - def PrintInfoLog(self, tag, object): - """ - PrintInfoLog prints the GLSL compiler log - """ - print "Tag: def PrintGLError(self, tag = ""): - - def PrintGLError(self, tag = ""): - """ - Prints the current GL error status - """ - if len(tag): - print tag - err = glGetError() - if err != GL_NO_ERROR: - print "GL Error: %s\\n"%(gluErrorString(err)) - - def shader(self, type, shaders): - """ - shader compiles a GLSL shader and attaches it to the current - program. - - type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB - shaders should be a sequence of shader source to compile. - """ - # Create a shader object - shader_object = glCreateShaderObjectARB(type) - - # Add the source code - glShaderSourceARB(shader_object, len(shaders), shaders) - - # Compile the shader - glCompileShaderARB(shader_object) - - # Print the compiler log - self.PrintInfoLog("vertex shader", shader_object) - - # Check if compiled, and attach if it did - compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB) - if compiled: - glAttachObjectARB(self.m_program, shader_object) - - # Delete the object (glAttachObjectARB makes a copy) - glDeleteObjectARB(shader_object) - - # print the gl error log - self.PrintGLError() - - def link(self): - """ - Links the shaders together. - """ - # clear error indicator - glGetError() - - glLinkProgramARB(self.m_program) - - self.PrintInfoLog("link", self.m_program) - - linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB) - if not linked: - print "Shader failed to link" - return - - glValidateProgramARB(self.m_program) - valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB) - if not valid: - print "Shader failed to validate" - return - - def activate(self, rasty, cachingInfo, mat): - self.pass_no+=1 - if (self.pass_no == 1): - glDisable(GL_COLOR_MATERIAL) - glUseProgramObjectARB(self.m_program) - return True - - glEnable(GL_COLOR_MATERIAL) - glUseProgramObjectARB(0) - self.pass_no = 0 - return False - - obj = GameLogic.getCurrentController().owner - - mesh = obj.meshes[0] - - for mat in mesh.materials: - mat.setCustomMaterial(MyMaterial()) - print mat.texture - - .. attribute:: texture - - Texture name. - - :type: string (read-only) - - .. attribute:: gl_texture - - OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture). - - :type: integer (read-only) - - .. attribute:: material - - Material name. - - :type: string (read-only) - - .. attribute:: tface - - Texture face properties. - - :type: CObject (read-only) - - .. attribute:: tile - - Texture is tiling. - - :type: boolean - - .. attribute:: tilexrep - - Number of tile repetitions in x direction. - - :type: integer - - .. attribute:: tileyrep - - Number of tile repetitions in y direction. - - :type: integer - - .. attribute:: drawingmode - - Drawing mode for the material. - - 2 (drawingmode & 4) Textured - - 4 (drawingmode & 16) Light - - 14 (drawingmode & 16384) 3d Polygon Text. - - :type: bitfield - - .. attribute:: transparent - - This material is transparent. All meshes with this - material will be rendered after non transparent meshes from back - to front. - - :type: boolean - - .. attribute:: zsort - - Transparent polygons in meshes with this material will be sorted back to - front before rendering. - Non-Transparent polygons will be sorted front to back before rendering. - - :type: boolean - - .. attribute:: lightlayer - - Light layers this material affects. - - :type: bitfield. - - .. attribute:: triangle - - Mesh data with this material is triangles. It's probably not safe to change this. - - :type: boolean - - .. attribute:: diffuse - - The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0]. - - :type: list [r, g, b] - - .. attribute:: specular - - The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0]. - - :type: list [r, g, b] - - .. attribute:: shininess - - The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0. - - :type: float - - .. attribute:: specularity - - The amount of specular of the material. 0.0 <= specularity <= 1.0. - - :type: float - - .. method:: updateTexture(tface, rasty) - - Updates a realtime animation. - - :arg tface: Texture face (eg mat.tface) - :type tface: CObject - :arg rasty: Rasterizer - :type rasty: CObject - - .. method:: setTexture(tface) - - Sets texture render state. - - :arg tface: Texture face - :type tface: CObject - - .. code-block:: python - - mat.setTexture(mat.tface) - - .. method:: activate(rasty, cachingInfo) - - Sets material parameters for this object for rendering. - - Material Parameters set: - - #. Texture - #. Backface culling - #. Line drawing - #. Specular Colour - #. Shininess - #. Diffuse Colour - #. Polygon Offset. - - :arg rasty: Rasterizer instance. - :type rasty: CObject - :arg cachingInfo: Material cache instance. - :type cachingInfo: CObject - - .. method:: setCustomMaterial(material) - - Sets the material state setup object. - - Using this method, you can extend or completely replace the gameengine material - to do your own advanced multipass effects. - - Use this method to register your material class. Instead of the normal material, - your class's activate method will be called just before rendering the mesh. - This should setup the texture, material, and any other state you would like. - It should return True to render the mesh, or False if you are finished. You should - clean up any state Blender does not set before returning False. - - Activate Method Definition: - - .. code-block:: python - - def activate(self, rasty, cachingInfo, material): - - :arg material: The material object. - :type material: instance - - .. code-block:: python - - class PyMaterial: - def __init__(self): - self.pass_no = -1 - - def activate(self, rasty, cachingInfo, material): - # Activate the material here. - # - # The activate method will be called until it returns False. - # Every time the activate method returns True the mesh will - # be rendered. - # - # rasty is a CObject for passing to material.updateTexture() - # and material.activate() - # cachingInfo is a CObject for passing to material.activate() - # material is the KX_PolygonMaterial instance this material - # was added to - - # default material properties: - self.pass_no += 1 - if self.pass_no == 0: - material.activate(rasty, cachingInfo) - # Return True to do this pass - return True - - # clean up and return False to finish. - self.pass_no = -1 - return False - - # Create a new Python Material and pass it to the renderer. - mat.setCustomMaterial(PyMaterial()) - -.. class:: KX_RadarSensor(KX_NearSensor) - - Radar sensor is a near sensor with a conical sensor object. - - .. attribute:: coneOrigin - - The origin of the cone with which to test. The origin is in the middle of the cone. (read-only). - - :type: list of floats [x, y, z] - - .. attribute:: coneTarget - - The center of the bottom face of the cone with which to test. (read-only). - - :type: list of floats [x, y, z] - - .. attribute:: distance - - The height of the cone with which to test. - - :type: float - - .. attribute:: angle - - The angle of the cone (in degrees) with which to test. - - :type: float from 0 to 360 - - .. attribute:: axis - - The axis on which the radar cone is cast. - - :type: integer from 0 to 5 - - KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z, - KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z - - .. method:: getConeHeight() - - :return: The height of the cone with which to test. - :rtype: float - -.. class:: KX_RaySensor(SCA_ISensor) - - A ray sensor detects the first object in a given direction. - - .. attribute:: propName - - The property the ray is looking for. - - :type: string - - .. attribute:: range - - The distance of the ray. - - :type: float - - .. attribute:: useMaterial - - Whether or not to look for a material (false = property). - - :type: boolean - - .. attribute:: useXRay - - Whether or not to use XRay. - - :type: boolean - - .. attribute:: hitObject - - The game object that was hit by the ray. (read-only). - - :type: :class:`KX_GameObject` - - .. attribute:: hitPosition - - The position (in worldcoordinates) where the object was hit by the ray. (read-only). - - :type: list [x, y, z] - - .. attribute:: hitNormal - - The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only). - - :type: list [x, y, z] - - .. attribute:: rayDirection - - The direction from the ray (in worldcoordinates). (read-only). - - :type: list [x, y, z] - - .. attribute:: axis - - The axis the ray is pointing on. - - :type: integer from 0 to 5 - - * KX_RAY_AXIS_POS_X - * KX_RAY_AXIS_POS_Y - * KX_RAY_AXIS_POS_Z - * KX_RAY_AXIS_NEG_X - * KX_RAY_AXIS_NEG_Y - * KX_RAY_AXIS_NEG_Z - -.. class:: KX_SCA_AddObjectActuator(SCA_IActuator) - - Edit Object Actuator (in Add Object Mode) - - .. warning:: - - An Add Object actuator will be ignored if at game start, the linked object doesn't exist (or is empty) or the linked object is in an active layer. - - .. code-block:: none - - Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer) - - .. attribute:: object - - the object this actuator adds. - - :type: :class:`KX_GameObject` or None - - .. attribute:: objectLastCreated - - the last added object from this actuator (read-only). - - :type: :class:`KX_GameObject` or None - - .. attribute:: time - - the lifetime of added objects, in frames. Set to 0 to disable automatic deletion. - - :type: integer - - .. attribute:: linearVelocity - - the initial linear velocity of added objects. - - :type: list [vx, vy, vz] - - .. attribute:: angularVelocity - - the initial angular velocity of added objects. - - :type: list [vx, vy, vz] - - .. method:: instantAddObject() - - adds the object without needing to calling SCA_PythonController.activate() - - .. note:: Use objectLastCreated to get the newly created object. - -.. class:: KX_SCA_DynamicActuator(SCA_IActuator) - - Dynamic Actuator. - - .. attribute:: mode - - :type: integer - - the type of operation of the actuator, 0-4 - - * KX_DYN_RESTORE_DYNAMICS(0) - * KX_DYN_DISABLE_DYNAMICS(1) - * KX_DYN_ENABLE_RIGID_BODY(2) - * KX_DYN_DISABLE_RIGID_BODY(3) - * KX_DYN_SET_MASS(4) - - .. attribute:: mass - - the mass value for the KX_DYN_SET_MASS operation. - - :type: float - -.. class:: KX_SCA_EndObjectActuator(SCA_IActuator) - - Edit Object Actuator (in End Object mode) - - This actuator has no python methods. - -.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator) - - Edit Object actuator, in Replace Mesh mode. - - .. warning:: - - Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist. - - This will generate a warning in the console - - .. code-block:: none - - Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object - - .. code-block:: python - - # Level-of-detail - # Switch a game object's mesh based on its depth in the camera view. - # +----------+ +-----------+ +-------------------------------------+ - # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh | - # +----------+ +-----------+ +-------------------------------------+ - import GameLogic - - # List detail meshes here - # Mesh (name, near, far) - # Meshes overlap so that they don't 'pop' when on the edge of the distance. - meshes = ((".Hi", 0.0, -20.0), - (".Med", -15.0, -50.0), - (".Lo", -40.0, -100.0) - ) - - co = GameLogic.getCurrentController() - obj = co.owner - act = co.actuators["LOD." + obj.name] - cam = GameLogic.getCurrentScene().active_camera - - def Depth(pos, plane): - return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3] - - # Depth is negative and decreasing further from the camera - depth = Depth(obj.position, cam.world_to_camera[2]) - - newmesh = None - curmesh = None - # Find the lowest detail mesh for depth - for mesh in meshes: - if depth < mesh[1] and depth > mesh[2]: - newmesh = mesh - if "ME" + obj.name + mesh[0] == act.getMesh(): - curmesh = mesh - - if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh(): - # The mesh is a different mesh - switch it. - # Check the current mesh is not a better fit. - if curmesh == None or curmesh[1] < depth or curmesh[2] > depth: - act.mesh = obj.getName() + newmesh[0] - GameLogic.addActiveActuator(act, True) - - .. attribute:: mesh - - :class:`MeshProxy` or the name of the mesh that will replace the current one. - - Set to None to disable actuator. - - :type: :class:`MeshProxy` or None if no mesh is set - - .. attribute:: useDisplayMesh - - when true the displayed mesh is replaced. - - :type: boolean - - .. attribute:: usePhysicsMesh - - when true the physics mesh is replaced. - - :type: boolean - - .. method:: instantReplaceMesh() - - Immediately replace mesh without delay. - -.. class:: KX_Scene(PyObjectPlus) - - An active scene that gives access to objects, cameras, lights and scene attributes. - - The activity culling stuff is supposed to disable logic bricks when their owner gets too far - from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows - what it does! - - .. code-block:: python - - import GameLogic - - # get the scene - scene = GameLogic.getCurrentScene() - - # print all the objects in the scene - for obj in scene.objects: - print obj.name - - # get an object named 'Cube' - obj = scene.objects["Cube"] - - # get the first object in the scene. - obj = scene.objects[0] - - .. code-block:: python - - # Get the depth of an object in the camera view. - import GameLogic - - obj = GameLogic.getCurrentController().owner - cam = GameLogic.getCurrentScene().active_camera - - # Depth is negative and decreasing further from the camera - depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3] - - @bug: All attributes are read only at the moment. - - .. attribute:: name - - The scene's name, (read-only). - - :type: string - - .. attribute:: objects - - A list of objects in the scene, (read-only). - - :type: :class:`CListValue` of :class:`KX_GameObject` - - .. attribute:: objectsInactive - - A list of objects on background layers (used for the addObject actuator), (read-only). - - :type: :class:`CListValue` of :class:`KX_GameObject` - - .. attribute:: lights - - A list of lights in the scene, (read-only). - - :type: :class:`CListValue` of :class:`KX_LightObject` - - .. attribute:: cameras - - A list of cameras in the scene, (read-only). - - :type: :class:`CListValue` of :class:`KX_Camera` - - .. attribute:: active_camera - - The current active camera. - - :type: :class:`KX_Camera` - - .. note:: - - This can be set directly from python to avoid using the :class:`KX_SceneActuator`. - - .. attribute:: suspended - - True if the scene is suspended, (read-only). - - :type: boolean - - .. attribute:: activity_culling - - True if the scene is activity culling. - - :type: boolean - - .. attribute:: activity_culling_radius - - The distance outside which to do activity culling. Measured in manhattan distance. - - :type: float - - .. attribute:: dbvt_culling - - True when Dynamic Bounding box Volume Tree is set (read-only). - - :type: boolean - - .. attribute:: pre_draw - - A list of callables to be run before the render step. - - :type: list - - .. attribute:: post_draw - - A list of callables to be run after the render step. - - :type: list - - .. method:: addObject(object, other, time=0) - - Adds an object to the scene like the Add Object Actuator would. - - :arg object: The object to add - :type object: :class:`KX_GameObject` or string - :arg other: The object's center to use when adding the object - :type other: :class:`KX_GameObject` or string - :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever. - :type time: integer - :return: The newly added object. - :rtype: :class:`KX_GameObject` - - .. method:: end() - - Removes the scene from the game. - - .. method:: restart() - - Restarts the scene. - - .. method:: replace(scene) - - Replaces this scene with another one. - - :arg scene: The name of the scene to replace this scene with. - :type scene: string - - .. method:: suspend() - - Suspends this scene. - - .. method:: resume() - - Resume this scene. - - .. method:: get(key, default=None) - - Return the value matching key, or the default value if its not found. - :return: The key value or a default. - -.. class:: KX_SceneActuator(SCA_IActuator) - - Scene Actuator logic brick. - - .. warning:: - - Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty - - This will generate a warning in the console: - - .. code-block:: none - - Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene - - .. attribute:: scene - - the name of the scene to change to/overlay/underlay/remove/suspend/resume. - - :type: string - - .. attribute:: camera - - the camera to change to. - - :type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write - - .. note:: - - When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera. - - .. attribute:: useRestart - - Set flag to True to restart the sene. - - :type: boolean - - .. attribute:: mode - - The mode of the actuator. - - :type: integer from 0 to 5. - -.. class:: KX_SoundActuator(SCA_IActuator) - - Sound Actuator. - - The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least. - - .. attribute:: fileName - - The filename of the sound this actuator plays. - - :type: string - - .. attribute:: volume - - The volume (gain) of the sound. - - :type: float - - .. attribute:: pitch - - The pitch of the sound. - - :type: float - - .. attribute:: rollOffFactor - - The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away. - - :type: float - - .. attribute:: looping - - The loop mode of the actuator. - - :type: integer - - .. attribute:: position - - The position of the sound as a list: [x, y, z]. - - :type: float array - - .. attribute:: velocity - - The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z]. - - :type: float array - - .. attribute:: orientation - - The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float]. - - :type: 3x3 matrix [[float]] - - .. attribute:: mode - - The operation mode of the actuator. Can be one of :ref:`these constants` - - :type: integer - -.. class:: KX_StateActuator(SCA_IActuator) - - State actuator changes the state mask of parent object. - - .. attribute:: operation - - Type of bit operation to be applied on object state mask. - - You can use one of :ref:`these constants ` - - :type: integer - - .. attribute:: mask - - Value that defines the bits that will be modified by the operation. - - The bits that are 1 in the mask will be updated in the object state. - - The bits that are 0 are will be left unmodified expect for the Copy operation which copies the mask to the object state. - - :type: integer - -.. class:: KX_TrackToActuator(SCA_IActuator) - - Edit Object actuator in Track To mode. - - .. warning:: - - Track To Actuators will be ignored if at game start, the object to track to is invalid. - - This will generate a warning in the console: - - .. code-block:: none - - GameObject 'Name' no object in EditObjectActuator 'ActuatorName' - - .. attribute:: object - - the object this actuator tracks. - - :type: :class:`KX_GameObject` or None - - .. attribute:: time - - the time in frames with which to delay the tracking motion. - - :type: integer - - .. attribute:: use3D - - the tracking motion to use 3D. - - :type: boolean - -.. class:: KX_VehicleWrapper(PyObjectPlus) - - KX_VehicleWrapper - - TODO - description - - .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering) - - Add a wheel to the vehicle - - :arg wheel: The object to use as a wheel. - :type wheel: :class:`KX_GameObject` or a KX_GameObject name - :arg attachPos: The position that this wheel will attach to. - :type attachPos: vector of 3 floats - :arg attachDir: The direction this wheel points. - :type attachDir: vector of 3 floats - :arg axleDir: The direction of this wheels axle. - :type axleDir: vector of 3 floats - :arg suspensionRestLength: TODO - Description - :type suspensionRestLength: float - :arg wheelRadius: The size of the wheel. - :type wheelRadius: float - - .. method:: applyBraking(force, wheelIndex) - - Apply a braking force to the specified wheel - - :arg force: the brake force - :type force: float - - :arg wheelIndex: index of the wheel where the force needs to be applied - :type wheelIndex: integer - - .. method:: applyEngineForce(force, wheelIndex) - - Apply an engine force to the specified wheel - - :arg force: the engine force - :type force: float - - :arg wheelIndex: index of the wheel where the force needs to be applied - :type wheelIndex: integer - - .. method:: getConstraintId() - - Get the constraint ID - - :return: the constraint id - :rtype: integer - - .. method:: getConstraintType() - - Returns the constraint type. - - :return: constraint type - :rtype: integer - - .. method:: getNumWheels() - - Returns the number of wheels. - - :return: the number of wheels for this vehicle - :rtype: integer - - .. method:: getWheelOrientationQuaternion(wheelIndex) - - Returns the wheel orientation as a quaternion. - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - :return: TODO Description - :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix - - .. method:: getWheelPosition(wheelIndex) - - Returns the position of the specified wheel - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - :return: position vector - :rtype: list[x, y, z] - - .. method:: getWheelRotation(wheelIndex) - - Returns the rotation of the specified wheel - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - :return: the wheel rotation - :rtype: float - - .. method:: setRollInfluence(rollInfluece, wheelIndex) - - Set the specified wheel's roll influence. - The higher the roll influence the more the vehicle will tend to roll over in corners. - - :arg rollInfluece: the wheel roll influence - :type rollInfluece: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSteeringValue(steering, wheelIndex) - - Set the specified wheel's steering - - :arg steering: the wheel steering - :type steering: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSuspensionCompression(compression, wheelIndex) - - Set the specified wheel's compression - - :arg compression: the wheel compression - :type compression: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSuspensionDamping(damping, wheelIndex) - - Set the specified wheel's damping - - :arg damping: the wheel damping - :type damping: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSuspensionStiffness(stiffness, wheelIndex) - - Set the specified wheel's stiffness - - :arg stiffness: the wheel stiffness - :type stiffness: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setTyreFriction(friction, wheelIndex) - - Set the specified wheel's tyre friction - - :arg friction: the tyre friction - :type friction: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - -.. class:: KX_VertexProxy(SCA_IObject) - - A vertex holds position, UV, colour and normal information. - - Note: - The physics simulation is NOT currently updated - physics will not respond - to changes in the vertex position. - - .. attribute:: XYZ - - The position of the vertex. - - :type: list [x, y, z] - - .. attribute:: UV - - The texture coordinates of the vertex. - - :type: list [u, v] - - .. attribute:: normal - - The normal of the vertex. - - :type: list [nx, ny, nz] - - .. attribute:: colour - - The colour of the vertex. - - :type: list [r, g, b, a] - - Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0] - - .. attribute:: color - - Synonym for colour. - - .. attribute:: x - - The x coordinate of the vertex. - - :type: float - - .. attribute:: y - - The y coordinate of the vertex. - - :type: float - - .. attribute:: z - - The z coordinate of the vertex. - - :type: float - - .. attribute:: u - - The u texture coordinate of the vertex. - - :type: float - - .. attribute:: v - - The v texture coordinate of the vertex. - - :type: float - - .. attribute:: u2 - - The second u texture coordinate of the vertex. - - :type: float - - .. attribute:: v2 - - The second v texture coordinate of the vertex. - - :type: float - - .. attribute:: r - - The red component of the vertex colour. 0.0 <= r <= 1.0. - - :type: float - - .. attribute:: g - - The green component of the vertex colour. 0.0 <= g <= 1.0. - - :type: float - - .. attribute:: b - - The blue component of the vertex colour. 0.0 <= b <= 1.0. - - :type: float - - .. attribute:: a - - The alpha component of the vertex colour. 0.0 <= a <= 1.0. - - :type: float - - .. method:: getXYZ() - - Gets the position of this vertex. - - :return: this vertexes position in local coordinates. - :rtype: list [x, y, z] - - .. method:: setXYZ(pos) - - Sets the position of this vertex. - - :type: list [x, y, z] - - :arg pos: the new position for this vertex in local coordinates. - - .. method:: getUV() - - Gets the UV (texture) coordinates of this vertex. - - :return: this vertexes UV (texture) coordinates. - :rtype: list [u, v] - - .. method:: setUV(uv) - - Sets the UV (texture) coordinates of this vertex. - - :type: list [u, v] - - .. method:: getUV2() - - Gets the 2nd UV (texture) coordinates of this vertex. - - :return: this vertexes UV (texture) coordinates. - :rtype: list [u, v] - - .. method:: setUV2(uv, unit) - - Sets the 2nd UV (texture) coordinates of this vertex. - - :type: list [u, v] - - :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV - :arg unit: integer - - .. method:: getRGBA() - - Gets the colour of this vertex. - - The colour is represented as four bytes packed into an integer value. The colour is - packed as RGBA. - - Since Python offers no way to get each byte without shifting, you must use the struct module to - access colour in an machine independent way. - - Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead. - - .. code-block:: python - - import struct; - col = struct.unpack('4B', struct.pack('I', v.getRGBA())) - # col = (r, g, b, a) - # black = ( 0, 0, 0, 255) - # white = (255, 255, 255, 255) - - :return: packed colour. 4 byte integer with one byte per colour channel in RGBA format. - :rtype: integer - - .. method:: setRGBA(col) - - Sets the colour of this vertex. - - See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes - or the colour attribute instead. - - setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a] - with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0] - - .. code-block:: python - - v.setRGBA(0xff0000ff) # Red - v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian - v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red - v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms. - - :arg col: the new colour of this vertex in packed RGBA format. - :type col: integer or list [r, g, b, a] - - .. method:: getNormal() - - Gets the normal vector of this vertex. - - :return: normalised normal vector. - :rtype: list [nx, ny, nz] - - .. method:: setNormal(normal) - - Sets the normal vector of this vertex. - - :type: sequence of floats [r, g, b] - - :arg normal: the new normal of this vertex. - -.. class:: KX_VisibilityActuator(SCA_IActuator) - - Visibility Actuator. - - .. attribute:: visibility - - whether the actuator makes its parent object visible or invisible. - - :type: boolean - - .. attribute:: useOcclusion - - whether the actuator makes its parent object an occluder or not. - - :type: boolean - - .. attribute:: useRecursion - - whether the visibility/occlusion should be propagated to all children of the object. - - :type: boolean - -.. class:: SCA_2DFilterActuator(SCA_IActuator) - - Create, enable and disable 2D filters - - The following properties don't have an immediate effect. - You must active the actuator to get the result. - The actuator is not persistent: it automatically stops itself after setting up the filter - but the filter remains active. To stop a filter you must activate the actuator with 'type' - set to :data:`~bge.logic.RAS_2DFILTER_DISABLED` or :data:`~bge.logic.RAS_2DFILTER_NOFILTER`. - - .. attribute:: shaderText - - shader source code for custom shader. - - :type: string - - .. attribute:: disableMotionBlur - - action on motion blur: 0=enable, 1=disable. - - :type: integer - - .. attribute:: mode - - Type of 2D filter, use one of :ref:`these constants ` - - :type: integer - - .. attribute:: passNumber - - order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb. - - Only be one filter can be defined per passNb. - - :type: integer (0-100) - - .. attribute:: value - - argument for motion blur filter. - - :type: float (0.0-100.0) - -.. class:: SCA_ANDController(SCA_IController) - - An AND controller activates only when all linked sensors are activated. - - There are no special python methods for this controller. - -.. class:: SCA_ActuatorSensor(SCA_ISensor) - - Actuator sensor detect change in actuator state of the parent object. - It generates a positive pulse if the corresponding actuator is activated - and a negative pulse if the actuator is deactivated. - - .. attribute:: actuator - - the name of the actuator that the sensor is monitoring. - - :type: string - -.. class:: SCA_AlwaysSensor(SCA_ISensor) - - This sensor is always activated. - -.. class:: SCA_DelaySensor(SCA_ISensor) - - The Delay sensor generates positive and negative triggers at precise time, - expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period. - - The duration parameter defines the length of the ON period following the OFF period. - There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger. - - The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0). - - Use :class:`SCA_ISensor.reset` at any time to restart sensor. - - .. attribute:: delay - - length of the initial OFF period as number of frame, 0 for immediate trigger. - - :type: integer. - - .. attribute:: duration - - length of the ON period in number of frame after the initial OFF period. - - If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. - - :type: integer - - .. attribute:: repeat - - 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. - - :type: integer - -.. class:: SCA_JoystickSensor(SCA_ISensor) - - This sensor detects player joystick events. - - .. attribute:: axisValues - - The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only). - - :type: list of ints. - - Each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. - The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. - - * left:[-32767, 0, ...] - * right:[32767, 0, ...] - * up:[0, -32767, ...] - * down:[0, 32767, ...] - - .. attribute:: axisSingle - - like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only). - - :type: integer - - .. note:: - - Only use this for "Single Axis" type sensors otherwise it will raise an error. - - .. attribute:: hatValues - - The state of the joysticks hats as a list of values :data:`numHats` long. (read-only). - - :type: list of ints - - Each spesifying the direction of the hat from 1 to 12, 0 when inactive. - - Hat directions are as follows... - - * 0:None - * 1:Up - * 2:Right - * 4:Down - * 8:Left - * 3:Up - Right - * 6:Down - Right - * 12:Down - Left - * 9:Up - Left - - .. attribute:: hatSingle - - Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only). - - :type: integer - - .. attribute:: numAxis - - The number of axes for the joystick at this index. (read-only). - - :type: integer - - .. attribute:: numButtons - - The number of buttons for the joystick at this index. (read-only). - - :type: integer - - .. attribute:: numHats - - The number of hats for the joystick at this index. (read-only). - - :type: integer - - .. attribute:: connected - - True if a joystick is connected at this joysticks index. (read-only). - - :type: boolean - - .. attribute:: index - - The joystick index to use (from 0 to 7). The first joystick is always 0. - - :type: integer - - .. attribute:: threshold - - Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. - - :type: integer - - .. attribute:: button - - The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect. - - :type: integer - - .. attribute:: axis - - The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection] - - * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control. - * axisDirection: 0=right, 1=up, 2=left, 3=down. - - :type: [integer, integer] - - .. attribute:: hat - - The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection] - - * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max). - * hatDirection: 1-12. - - :type: [integer, integer] - - .. method:: getButtonActiveList() - - :return: A list containing the indicies of the currently pressed buttons. - :rtype: list - - .. method:: getButtonStatus(buttonIndex) - - :arg buttonIndex: the button index, 0=first button - :type buttonIndex: integer - :return: The current pressed state of the specified button. - :rtype: boolean - -.. class:: SCA_KeyboardSensor(SCA_ISensor) - - A keyboard sensor detects player key presses. - - See module :mod:`bge.keys` for keycode values. - - .. attribute:: key - - The key code this sensor is looking for. - - :type: keycode from :mod:`bge.keys` module - - .. attribute:: hold1 - - The key code for the first modifier this sensor is looking for. - - :type: keycode from :mod:`bge.keys` module - - .. attribute:: hold2 - - The key code for the second modifier this sensor is looking for. - - :type: keycode from :mod:`bge.keys` module - - .. attribute:: toggleProperty - - The name of the property that indicates whether or not to log keystrokes as a string. - - :type: string - - .. attribute:: targetProperty - - The name of the property that receives keystrokes in case in case a string is logged. - - :type: string - - .. attribute:: useAllKeys - - Flag to determine whether or not to accept all keys. - - :type: boolean - - .. attribute:: events - - a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). - - :type: list [[:ref:`keycode`, :ref:`status`], ...] - - .. method:: getKeyStatus(keycode) - - Get the status of a key. - - :arg keycode: The code that represents the key you want to get the state of, use one of :ref:`these constants` - :type keycode: integer - :return: The state of the given key, can be one of :ref:`these constants` - :rtype: int - -.. class:: SCA_NANDController(SCA_IController) - - An NAND controller activates when all linked sensors are not active. - - There are no special python methods for this controller. - -.. class:: SCA_NORController(SCA_IController) - - An NOR controller activates only when all linked sensors are de-activated. - - There are no special python methods for this controller. - -.. class:: SCA_ORController(SCA_IController) - - An OR controller activates when any connected sensor activates. - - There are no special python methods for this controller. - -.. class:: SCA_PropertyActuator(SCA_IActuator) - - Property Actuator - - .. attribute:: propName - - the property on which to operate. - - :type: string - - .. attribute:: value - - the value with which the actuator operates. - - :type: string - - .. attribute:: mode - - TODO - add constants to game logic dict!. - - :type: integer - -.. class:: SCA_PropertySensor(SCA_ISensor) - - Activates when the game object property matches. - - .. attribute:: mode - - Type of check on the property. Can be one of :ref:`these constants ` - - :type: integer. - - .. attribute:: propName - - the property the sensor operates. - - :type: string - - .. attribute:: value - - the value with which the sensor compares to the value of the property. - - :type: string - - .. attribute:: min - - the minimum value of the range used to evaluate the property when in interval mode. - - :type: string - - .. attribute:: max - - the maximum value of the range used to evaluate the property when in interval mode. - - :type: string - -.. class:: SCA_PythonController(SCA_IController) - - A Python controller uses a Python script to activate it's actuators, - based on it's sensors. - - .. attribute:: script - - The value of this variable depends on the execution methid. - - * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts. - * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts. - - :type: string - - .. note:: - - Once this is set the script name given for warnings will remain unchanged. - - .. attribute:: mode - - the execution mode for this controller (read-only). - - * Script: 0, Execite the :data:`script` as a python code. - * Module: 1, Execite the :data:`script` as a module and function. - - :type: integer - - .. method:: activate(actuator) - - Activates an actuator attached to this controller. - - :arg actuator: The actuator to operate on. - :type actuator: actuator or the actuator name as a string - - .. method:: deactivate(actuator) - - Deactivates an actuator attached to this controller. - - :arg actuator: The actuator to operate on. - :type actuator: actuator or the actuator name as a string - -.. class:: SCA_RandomActuator(SCA_IActuator) - - Random Actuator - - .. attribute:: seed - - Seed of the random number generator. - - :type: integer. - - Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call. - - .. attribute:: para1 - - the first parameter of the active distribution. - - :type: float, read-only. - - Refer to the documentation of the generator types for the meaning of this value. - - .. attribute:: para2 - - the second parameter of the active distribution. - - :type: float, read-only - - Refer to the documentation of the generator types for the meaning of this value. - - .. attribute:: distribution - - Distribution type. (read-only). Can be one of :ref:`these constants ` - - :type: integer - - .. attribute:: propName - - the name of the property to set with the random value. - - :type: string - - If the generator and property types do not match, the assignment is ignored. - - .. method:: setBoolConst(value) - - Sets this generator to produce a constant boolean value. - - :arg value: The value to return. - :type value: boolean - - .. method:: setBoolUniform() - - Sets this generator to produce a uniform boolean distribution. - - The generator will generate True or False with 50% chance. - - .. method:: setBoolBernouilli(value) - - Sets this generator to produce a Bernouilli distribution. - - :arg value: Specifies the proportion of False values to produce. - - * 0.0: Always generate True - * 1.0: Always generate False - :type value: float - - .. method:: setIntConst(value) - - Sets this generator to always produce the given value. - - :arg value: the value this generator produces. - :type value: integer - - .. method:: setIntUniform(lower_bound, upper_bound) - - Sets this generator to produce a random value between the given lower and - upper bounds (inclusive). - - :type lower_bound: integer - :type upper_bound: integer - - .. method:: setIntPoisson(value) - - Generate a Poisson-distributed number. - - This performs a series of Bernouilli tests with parameter value. - It returns the number of tries needed to achieve succes. - - :type value: float - - .. method:: setFloatConst(value) - - Always generate the given value. - - :type value: float - - .. method:: setFloatUniform(lower_bound, upper_bound) - - Generates a random float between lower_bound and upper_bound with a - uniform distribution. - - :type lower_bound: float - :type upper_bound: float - - .. method:: setFloatNormal(mean, standard_deviation) - - Generates a random float from the given normal distribution. - - :arg mean: The mean (average) value of the generated numbers - :type mean: float - :arg standard_deviation: The standard deviation of the generated numbers. - :type standard_deviation: float - - .. method:: setFloatNegativeExponential(half_life) - - Generate negative-exponentially distributed numbers. - - The half-life 'time' is characterized by half_life. - - :type half_life: float - -.. class:: SCA_RandomSensor(SCA_ISensor) - - This sensor activates randomly. - - .. attribute:: lastDraw - - The seed of the random number generator. - - :type: integer - - .. attribute:: seed - - The seed of the random number generator. - - :type: integer - - .. method:: setSeed(seed) - - Sets the seed of the random number generator. - - If the seed is 0, the generator will produce the same value on every call. - - :type seed: integer - - .. method:: getSeed() - - :return: The initial seed of the generator. Equal seeds produce equal random series. - :rtype: integer - - .. method:: getLastDraw() - - :return: The last random number generated. - :rtype: integer - -.. class:: SCA_XNORController(SCA_IController) - - An XNOR controller activates when all linked sensors are the same (activated or inative). - - There are no special python methods for this controller. - -.. class:: SCA_XORController(SCA_IController) - - An XOR controller activates when there is the input is mixed, but not when all are on or off. - - There are no special python methods for this controller. - -.. class:: KX_Camera(KX_GameObject) - - A Camera object. - - .. data:: INSIDE - - See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` - - .. data:: INTERSECT - - See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` - - .. data:: OUTSIDE - - See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` - - .. attribute:: lens - - The camera's lens value. - - :type: float - - .. attribute:: ortho_scale - - The camera's view scale when in orthographic mode. - - :type: float - - .. attribute:: near - - The camera's near clip distance. - - :type: float - - .. attribute:: far - - The camera's far clip distance. - - :type: float - - .. attribute:: perspective - - True if this camera has a perspective transform, False for an orthographic projection. - - :type: boolean - - .. attribute:: frustum_culling - - True if this camera is frustum culling. - - :type: boolean - - .. attribute:: projection_matrix - - This camera's 4x4 projection matrix. - - :type: 4x4 Matrix [[float]] - - .. attribute:: modelview_matrix - - This camera's 4x4 model view matrix. (read-only). - - :type: 4x4 Matrix [[float]] - - .. note:: - - This matrix is regenerated every frame from the camera's position and orientation. - - .. attribute:: camera_to_world - - This camera's camera to world transform. (read-only). - - :type: 4x4 Matrix [[float]] - - .. note:: - - This matrix is regenerated every frame from the camera's position and orientation. - - .. attribute:: world_to_camera - - This camera's world to camera transform. (read-only). - - :type: 4x4 Matrix [[float]] - - .. note:: - - Regenerated every frame from the camera's position and orientation. - - .. note:: - - This is camera_to_world inverted. - - .. attribute:: useViewport - - True when the camera is used as a viewport, set True to enable a viewport for this camera. - - :type: boolean - - .. method:: sphereInsideFrustum(centre, radius) - - Tests the given sphere against the view frustum. - - :arg centre: The centre of the sphere (in world coordinates.) - :type centre: list [x, y, z] - :arg radius: the radius of the sphere - :type radius: float - :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT` - :rtype: integer - - .. note:: - - When the camera is first initialized the result will be invalid because the projection matrix has not been set. - - .. code-block:: python - - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0] - if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE): - # Sphere is inside frustum ! - # Do something useful ! - else: - # Sphere is outside frustum - - .. method:: boxInsideFrustum(box) - - Tests the given box against the view frustum. - - :arg box: Eight (8) corner points of the box (in world coordinates.) - :type box: list of lists - :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT` - - .. note:: - - When the camera is first initialized the result will be invalid because the projection matrix has not been set. - - .. code-block:: python - - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # Box to test... - box = [] - box.append([-1.0, -1.0, -1.0]) - box.append([-1.0, -1.0, 1.0]) - box.append([-1.0, 1.0, -1.0]) - box.append([-1.0, 1.0, 1.0]) - box.append([ 1.0, -1.0, -1.0]) - box.append([ 1.0, -1.0, 1.0]) - box.append([ 1.0, 1.0, -1.0]) - box.append([ 1.0, 1.0, 1.0]) - - if (cam.boxInsideFrustum(box) != cam.OUTSIDE): - # Box is inside/intersects frustum ! - # Do something useful ! - else: - # Box is outside the frustum ! - - .. method:: pointInsideFrustum(point) - - Tests the given point against the view frustum. - - :arg point: The point to test (in world coordinates.) - :type point: 3D Vector - :return: True if the given point is inside this camera's viewing frustum. - :rtype: boolean - - .. note:: - - When the camera is first initialized the result will be invalid because the projection matrix has not been set. - - .. code-block:: python - - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # Test point [0.0, 0.0, 0.0] - if (cam.pointInsideFrustum([0.0, 0.0, 0.0])): - # Point is inside frustum ! - # Do something useful ! - else: - # Box is outside the frustum ! - - .. method:: getCameraToWorld() - - Returns the camera-to-world transform. - - :return: the camera-to-world transform matrix. - :rtype: matrix (4x4 list) - - .. method:: getWorldToCamera() - - Returns the world-to-camera transform. - - This returns the inverse matrix of getCameraToWorld(). - - :return: the world-to-camera transform matrix. - :rtype: matrix (4x4 list) - - .. method:: setOnTop() - - Set this cameras viewport ontop of all other viewport. - - .. method:: setViewport(left, bottom, right, top) - - Sets the region of this viewport on the screen in pixels. - - Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display. - - :arg left: left pixel coordinate of this viewport - :type left: integer - :arg bottom: bottom pixel coordinate of this viewport - :type bottom: integer - :arg right: right pixel coordinate of this viewport - :type right: integer - :arg top: top pixel coordinate of this viewport - :type top: integer - - .. method:: getScreenPosition(object) - - Gets the position of an object projected on screen space. - - .. code-block:: python - - # For an object in the middle of the screen, coord = [0.5, 0.5] - coord = camera.getScreenPosition(object) - - :arg object: object name or list [x, y, z] - :type object: :class:`KX_GameObject` or 3D Vector - :return: the object's position in screen coordinates. - :rtype: list [x, y] - - .. method:: getScreenVect(x, y) - - Gets the vector from the camera position in the screen coordinate direction. - - :arg x: X Axis - :type x: float - :arg y: Y Axis - :type y: float - :rtype: 3D Vector - :return: The vector from screen coordinate. - - .. code-block:: python - - # Gets the vector of the camera front direction: - m_vect = camera.getScreenVect(0.5, 0.5) - - .. method:: getScreenRay(x, y, dist=inf, property=None) - - Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop. - The ray is similar to KX_GameObject->rayCastTo. - - :arg x: X Axis - :type x: float - :arg y: Y Axis - :type y: float - :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other - :type dist: float - :arg property: property name that object must have; can be omitted => detect any object - :type property: string - :rtype: :class:`KX_GameObject` - :return: the first object hit or None if no object or object does not match prop - - .. code-block:: python - - # Gets an object with a property "wall" in front of the camera within a distance of 100: - target = camera.getScreenRay(0.5, 0.5, 100, "wall") - -.. class:: BL_ArmatureObject(KX_GameObject) - - An armature object. - - .. attribute:: constraints - - The list of armature constraint defined on this armature. - Elements of the list can be accessed by index or string. - The key format for string access is ':'. - - :type: list of :class:`BL_ArmatureConstraint` - - .. attribute:: channels - - The list of armature channels. - Elements of the list can be accessed by index or name the bone. - - :type: list of :class:`BL_ArmatureChannel` - - .. method:: update() - - Ensures that the armature will be updated on next graphic frame. - - This action is unecessary if a KX_ArmatureActuator with mode run is active - or if an action is playing. Use this function in other cases. It must be called - on each frame to ensure that the armature is updated continously. - -.. class:: BL_ArmatureActuator(SCA_IActuator) - - Armature Actuators change constraint condition on armatures. - - .. _armatureactuator-constants-type: - - Constants related to :data:`~bge.types.BL_ArmatureActuator.type` - - .. data:: KX_ACT_ARMATURE_RUN - - Just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller - - :value: 0 - - .. data:: KX_ACT_ARMATURE_ENABLE - - Enable the constraint. - - :value: 1 - - .. data:: KX_ACT_ARMATURE_DISABLE - - Disable the constraint (runtime constraint values are not updated). - - :value: 2 - - .. data:: KX_ACT_ARMATURE_SETTARGET - - Change target and subtarget of constraint. - - :value: 3 - - .. data:: KX_ACT_ARMATURE_SETWEIGHT - - Change weight of (only for IK constraint). - - :value: 4 - - .. attribute:: type - - The type of action that the actuator executes when it is active. - - Can be one of :ref:`these constants ` - - :type: integer - - .. attribute:: constraint - - The constraint object this actuator is controlling. - - :type: :class:`BL_ArmatureConstraint` - - .. attribute:: target - - The object that this actuator will set as primary target to the constraint it controls. - - :type: :class:`KX_GameObject` - - .. attribute:: subtarget - - The object that this actuator will set as secondary target to the constraint it controls. - - :type: :class:`KX_GameObject`. - - .. note:: - - Currently, the only secondary target is the pole target for IK constraint. - - .. attribute:: weight - - The weight this actuator will set on the constraint it controls. - - :type: float. - - .. note:: - - Currently only the IK constraint has a weight. It must be a value between 0 and 1. - - .. note:: - - A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`) - -.. class:: KX_ArmatureSensor(SCA_ISensor) - - Armature sensor detect conditions on armatures. - - .. _armaturesensor-type: - - Constants related to :data:`type` - - .. data:: KX_ARMSENSOR_STATE_CHANGED - - Detect that the constraint is changing state (active/inactive) - - :value: 0 - - .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW - - Detect that the constraint linear error is above a threshold - - :value: 1 - - .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE - - Detect that the constraint linear error is below a threshold - - :value: 2 - - .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW - - Detect that the constraint rotation error is above a threshold - - :value: 3 - - .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE - - Detect that the constraint rotation error is below a threshold - - :value: 4 - - .. attribute:: type - - The type of measurement that the sensor make when it is active. - - Can be one of :ref:`these constants ` - - :type: integer. - - .. attribute:: constraint - - The constraint object this sensor is watching. - - :type: :class:`BL_ArmatureConstraint` - - .. attribute:: value - - The threshold used in the comparison with the constraint error - The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver - The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver - The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone - The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations - The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller. - - :type: float - -.. class:: BL_ArmatureConstraint(PyObjectPlus) - - Proxy to Armature Constraint. Allows to change constraint on the fly. - Obtained through :class:`BL_ArmatureObject`.constraints. - - .. note:: - - Not all armature constraints are supported in the GE. - - .. _armatureconstraint-constants-type: - - Constants related to :data:`type` - - .. data:: CONSTRAINT_TYPE_TRACKTO - .. data:: CONSTRAINT_TYPE_KINEMATIC - .. data:: CONSTRAINT_TYPE_ROTLIKE - .. data:: CONSTRAINT_TYPE_LOCLIKE - .. data:: CONSTRAINT_TYPE_MINMAX - .. data:: CONSTRAINT_TYPE_SIZELIKE - .. data:: CONSTRAINT_TYPE_LOCKTRACK - .. data:: CONSTRAINT_TYPE_STRETCHTO - .. data:: CONSTRAINT_TYPE_CLAMPTO - .. data:: CONSTRAINT_TYPE_TRANSFORM - .. data:: CONSTRAINT_TYPE_DISTLIMIT - - .. _armatureconstraint-constants-ik-type: - - Constants related to :data:`ik_type` - - .. data:: CONSTRAINT_IK_COPYPOSE - - constraint is trying to match the position and eventually the rotation of the target. - - :value: 0 - - .. data:: CONSTRAINT_IK_DISTANCE - - Constraint is maintaining a certain distance to target subject to ik_mode - - :value: 1 - - .. _armatureconstraint-constants-ik-flag: - - Constants related to :data:`ik_flag` - - .. data:: CONSTRAINT_IK_FLAG_TIP - - Set when the constraint operates on the head of the bone and not the tail - - :value: 1 - - .. data:: CONSTRAINT_IK_FLAG_ROT - - Set when the constraint tries to match the orientation of the target - - :value: 2 - - .. data:: CONSTRAINT_IK_FLAG_STRETCH - - Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0) - - :value: 16 - - .. data:: CONSTRAINT_IK_FLAG_POS - - Set when the constraint tries to match the position of the target. - - :value: 32 - - .. _armatureconstraint-constants-ik-mode: - - Constants related to :data:`ik_mode` - - .. data:: CONSTRAINT_IK_MODE_INSIDE - - The constraint tries to keep the bone within ik_dist of target - - :value: 0 - - .. data:: CONSTRAINT_IK_MODE_OUTSIDE - - The constraint tries to keep the bone outside ik_dist of the target - - :value: 1 - - .. data:: CONSTRAINT_IK_MODE_ONSURFACE - - The constraint tries to keep the bone exactly at ik_dist of the target. - - :value: 2 - - .. attribute:: type - - Type of constraint, (read-only). - - Use one of :ref:`these constants`. - - :type: integer, one of CONSTRAINT_TYPE_* constants - - .. attribute:: name - - Name of constraint constructed as :. constraints list. - - :type: string - - This name is also the key subscript on :class:`BL_ArmatureObject`. - - .. attribute:: enforce - - fraction of constraint effect that is enforced. Between 0 and 1. - - :type: float - - .. attribute:: headtail - - Position of target between head and tail of the target bone: 0=head, 1=tail. - - :type: float. - - .. note:: - - Only used if the target is a bone (i.e target object is an armature. - - .. attribute:: lin_error - - runtime linear error (in Blender units) on constraint at the current frame. - - This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. - - :type: float - - .. attribute:: rot_error - - Runtime rotation error (in radiant) on constraint at the current frame. - - :type: float. - - This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. - - It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint. - - .. attribute:: target - - Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint. - - :type: :class:`KX_GameObject`. - - .. attribute:: subtarget - - Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint. - - :type: :class:`KX_GameObject`. - - Currently this is only used for pole target on IK constraint. - - .. attribute:: active - - True if the constraint is active. - - :type: boolean - - .. note:: - - An inactive constraint does not update lin_error and rot_error. - - .. attribute:: ik_weight - - Weight of the IK constraint between 0 and 1. - - Only defined for IK constraint. - - :type: float - - .. attribute:: ik_type - - Type of IK constraint, (read-only). - - Use one of :ref:`these constants`. - - :type: integer. - - .. attribute:: ik_flag - - Combination of IK constraint option flags, read-only. - - Use one of :ref:`these constants`. - - :type: integer - - .. attribute:: ik_dist - - Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE. - - :type: float - - .. attribute:: ik_mode - - Use one of :ref:`these constants`. - - Additional mode for IK constraint. Currently only used for Distance constraint: - - :type: integer - -.. class:: BL_ArmatureChannel(PyObjectPlus) - - Proxy to armature pose channel. Allows to read and set armature pose. - The attributes are identical to RNA attributes, but mostly in read-only mode. - - See :data:`rotation_mode` - - .. data:: PCHAN_ROT_QUAT - .. data:: PCHAN_ROT_XYZ - .. data:: PCHAN_ROT_XZY - .. data:: PCHAN_ROT_YXZ - .. data:: PCHAN_ROT_YZX - .. data:: PCHAN_ROT_ZXY - .. data:: PCHAN_ROT_ZYX - - .. attribute:: name - - channel name (=bone name), read-only. - - :type: string - - .. attribute:: bone - - return the bone object corresponding to this pose channel, read-only. - - :type: :class:`BL_ArmatureBone` - - .. attribute:: parent - - return the parent channel object, None if root channel, read-only. - - :type: :class:`BL_ArmatureChannel` - - .. attribute:: has_ik - - true if the bone is part of an active IK chain, read-only. - This flag is not set when an IK constraint is defined but not enabled (miss target information for example). - - :type: boolean - - .. attribute:: ik_dof_x - - true if the bone is free to rotation in the X axis, read-only. - - :type: boolean - - .. attribute:: ik_dof_y - - true if the bone is free to rotation in the Y axis, read-only. - - :type: boolean - - .. attribute:: ik_dof_z - - true if the bone is free to rotation in the Z axis, read-only. - - :type: boolean - - .. attribute:: ik_limit_x - - true if a limit is imposed on X rotation, read-only. - - :type: boolean - - .. attribute:: ik_limit_y - - true if a limit is imposed on Y rotation, read-only. - - :type: boolean - - .. attribute:: ik_limit_z - - true if a limit is imposed on Z rotation, read-only. - - :type: boolean - - .. attribute:: ik_rot_control - - true if channel rotation should applied as IK constraint, read-only. - - :type: boolean - - .. attribute:: ik_lin_control - - true if channel size should applied as IK constraint, read-only. - - :type: boolean - - .. attribute:: location - - displacement of the bone head in armature local space, read-write. - - :type: vector [X, Y, Z]. - - .. note:: - - You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - - .. note:: - - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`). - - .. attribute:: scale - - scale of the bone relative to its parent, read-write. - - :type: vector [sizeX, sizeY, sizeZ]. - - .. note:: - - An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - - .. note:: - - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - - .. attribute:: rotation_quaternion - - rotation of the bone relative to its parent expressed as a quaternion, read-write. - - :type: vector [qr, qi, qj, qk]. - - .. note:: - - This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - - .. note:: - - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - - .. attribute:: rotation_euler - - rotation of the bone relative to its parent expressed as a set of euler angles, read-write. - - :type: vector [X, Y, Z]. - - .. note:: - - This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation. - - .. note:: - - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - - .. attribute:: rotation_mode - - Method of updating the bone rotation, read-write. - - :type: integer - - Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed). - - * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation - * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively - * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively - * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively - * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively - * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively - * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively - - .. attribute:: channel_matrix - - pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only. - This field is updated after the graphic render, it represents the current pose. - - :type: matrix [4][4] - - .. attribute:: pose_matrix - - pose matrix in armature space, read-only, - This field is updated after the graphic render, it represents the current pose. - - :type: matrix [4][4] - - .. attribute:: pose_head - - position of bone head in armature space, read-only. - - :type: vector [x, y, z] - - .. attribute:: pose_tail - - position of bone tail in armature space, read-only. - - :type: vector [x, y, z] - - .. attribute:: ik_min_x - - minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only. - - :type: float - - .. attribute:: ik_max_x - - maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only. - - :type: float - - .. attribute:: ik_min_y - - minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only. - - :type: float - - .. attribute:: ik_max_y - - maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only. - - :type: float - - .. attribute:: ik_min_z - - minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only. - - :type: float - - .. attribute:: ik_max_z - - maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only. - - :type: float - - .. attribute:: ik_stiffness_x - - bone rotation stiffness in X axis, read-only. - - :type: float between 0 and 1 - - .. attribute:: ik_stiffness_y - - bone rotation stiffness in Y axis, read-only. - - :type: float between 0 and 1 - - .. attribute:: ik_stiffness_z - - bone rotation stiffness in Z axis, read-only. - - :type: float between 0 and 1 - - .. attribute:: ik_stretch - - ratio of scale change that is allowed, 0=bone can't change size, read-only. - - :type: float - - .. attribute:: ik_rot_weight - - weight of rotation constraint when ik_rot_control is set, read-write. - - :type: float between 0 and 1 - - .. attribute:: ik_lin_weight - - weight of size constraint when ik_lin_control is set, read-write. - - :type: float between 0 and 1 - - .. attribute:: joint_rotation - - Control bone rotation in term of joint angle (for robotic applications), read-write. - - When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode. - - When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles. - - The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes: - - * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant - * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants. - * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane. - * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose. - - :type: vector [x, y, z] - - .. note:: - - The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain. - - .. note:: - - [0, 0, 0] always corresponds to the rest pose. - - .. note:: - - You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`). - - .. note:: - - You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute. - -.. class:: BL_ArmatureBone(PyObjectPlus) - - Proxy to Blender bone structure. All fields are read-only and comply to RNA names. - All space attribute correspond to the rest pose. - - .. attribute:: name - - bone name. - - :type: string - - .. attribute:: connected - - true when the bone head is struck to the parent's tail. - - :type: boolean - - .. attribute:: hinge - - true when bone doesn't inherit rotation or scale from parent bone. - - :type: boolean - - .. attribute:: inherit_scale - - true when bone inherits scaling from parent bone. - - :type: boolean - - .. attribute:: bbone_segments - - number of B-bone segments. - - :type: integer - - .. attribute:: roll - - bone rotation around head-tail axis. - - :type: float - - .. attribute:: head - - location of head end of the bone in parent bone space. - - :type: vector [x, y, z] - - .. attribute:: tail - - location of head end of the bone in parent bone space. - - :type: vector [x, y, z] - - .. attribute:: length - - bone length. - - :type: float - - .. attribute:: arm_head - - location of head end of the bone in armature space. - - :type: vector [x, y, z] - - .. attribute:: arm_tail - - location of tail end of the bone in armature space. - - :type: vector [x, y, z] - - .. attribute:: arm_mat - - matrix of the bone head in armature space. - - :type: matrix [4][4] - - .. note:: - - This matrix has no scale part. - - .. attribute:: bone_mat - - rotation matrix of the bone in parent bone space. - - :type: matrix [3][3] - - .. attribute:: parent - - parent bone, or None for root bone. - - :type: :class:`BL_ArmatureBone` - - .. attribute:: children - - list of bone's children. - - :type: list of :class:`BL_ArmatureBone` -- cgit v1.2.3 From 1eda2c85949ed0fa67d3026e078588d0820826ad Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 13 Oct 2010 11:40:59 +0000 Subject: Fix for [#24205] Multilayer EXR files used as input sequence are displayed incorrectly * Image buffer profile wasn't set to linear rgb for multilayer image sequences --- source/blender/blenkernel/intern/image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 6dd1d4280ec..e356e40c6fd 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1685,6 +1685,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f ibuf->flags |= IB_rectfloat; ibuf->mall= IB_rectfloat; ibuf->channels= rpass->channels; + ibuf->profile = IB_PROFILE_LINEAR_RGB; image_initialize_after_load(ima, ibuf); image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:0, frame); -- cgit v1.2.3 From 62f4d613d06fad1bad95b4ec5e5199425a23d684 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 13 Oct 2010 13:10:35 +0000 Subject: Fix for [#24208] ObjectId information is wrong when read from multilayer exr * non-rgba passes shouldn't use color correction --- source/blender/nodes/intern/CMP_nodes/CMP_image.c | 34 +++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index 9309d2939db..c99496d9664 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -77,25 +77,31 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i /* now we need a float buffer from the image * with matching color management */ - if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { - if(ibuf->profile != IB_PROFILE_NONE) { - rect= ibuf->rect_float; + if(ibuf->channels == 4) { + if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { + if(ibuf->profile != IB_PROFILE_NONE) { + rect= ibuf->rect_float; + } + else { + rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); + srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); + alloc= TRUE; + } } else { - rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); - srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); - alloc= TRUE; + if(ibuf->profile == IB_PROFILE_NONE) { + rect= ibuf->rect_float; + } + else { + rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); + linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); + alloc= TRUE; + } } } else { - if(ibuf->profile == IB_PROFILE_NONE) { - rect= ibuf->rect_float; - } - else { - rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); - linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); - alloc= TRUE; - } + /* non-rgba passes can't use color profiles */ + rect= ibuf->rect_float; } /* done coercing into the correct color management */ -- cgit v1.2.3 From 843d8859a718c1f9a8c0f7109b2cdf9bbeb46fa3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 13:53:49 +0000 Subject: bugfix [#23355] Square Color picker moving by itself and locking up --- source/blender/blenlib/BLI_math_color.h | 1 + source/blender/blenlib/intern/math_color.c | 20 ++++++++ source/blender/editors/interface/interface.c | 5 -- .../blender/editors/interface/interface_handlers.c | 45 +++++++++------- .../blender/editors/interface/interface_intern.h | 7 ++- .../blender/editors/interface/interface_regions.c | 60 ++++++++++++---------- .../editors/interface/interface_templates.c | 16 +++--- .../blender/editors/interface/interface_widgets.c | 22 ++++---- 8 files changed, 107 insertions(+), 69 deletions(-) diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 2f40520e59a..2095c40b5aa 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -61,6 +61,7 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b); void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv); void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace); void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); +void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv); unsigned int rgb_to_cpack(float r, float g, float b); unsigned int hsv_to_cpack(float h, float s, float v); diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index f0ef8b2c93d..09a6b5992db 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -232,6 +232,26 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv) *lv = v; } +void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv) +{ + float orig_h= *lh; + float orig_s= *ls; + + rgb_to_hsv(r, g, b, lh, ls, lv); + + if(*lv <= 0.0f) { + *lh= orig_h; + *ls= orig_s; + } + else if (*ls <= 0.0f) { + *lh= orig_h; + } + + if(*lh==0.0f && orig_h >= 1.0f) { + *lh= 1.0f; + } +} + /*http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html */ void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int colorspace) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f4866237f46..97a3225f5c6 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2136,11 +2136,6 @@ void ui_check_but(uiBut *but) case HSVCUBE: case HSVCIRCLE: - { - float rgb[3]; - ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2); - } break; default: strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index a64dcecb929..7487ed904e4 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2830,17 +2830,18 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm } else if(but->type==COL) { if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) { + float *hsv= ui_block_hsv_get(but->block); float col[3]; ui_get_but_vectorf(but, col); - rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2); + rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2); if(event->type==WHEELDOWNMOUSE) - but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f); + hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f); else - but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f); + hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], data->vec, data->vec+1, data->vec+2); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2); ui_set_but_vectorf(but, data->vec); button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2970,7 +2971,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my) { - float rgb[3], hsv[3]; + float rgb[3]; + float *hsv= ui_block_hsv_get(but->block); float x, y; int changed= 1; int color_profile = but->block->color_profile; @@ -2979,10 +2981,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = BLI_PR_NONE; } - + ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - + + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + /* relative position within box */ x= ((float)mx-but->x1)/(but->x2-but->x1); y= ((float)my-but->y1)/(but->y2-but->y1); @@ -3059,21 +3062,22 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu } else if (event->type == ZEROKEY && event->val == KM_PRESS) { if (but->a1==9){ - float rgb[3], hsv[3], def_hsv[3]; - float *def; int len; /* reset only value */ len= RNA_property_array_length(&but->rnapoin, but->rnaprop); if (len >= 3) { + float rgb[3], def_hsv[3]; + float *def; + float *hsv= ui_block_hsv_get(but->block); def= MEM_callocN(sizeof(float)*len, "reset_defaults - float"); RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2); ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb+1, rgb+2); ui_set_but_vectorf(but, rgb); @@ -3111,13 +3115,15 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx { rcti rect; int changed= 1; - float rgb[3], hsv[3]; + float rgb[3]; + float hsv[3]; rect.xmin= but->x1; rect.xmax= but->x2; rect.ymin= but->y1; rect.ymax= but->y2; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + copy_v3_v3(hsv, ui_block_hsv_get(but->block)); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); /* exception, when using color wheel in 'locked' value state: * allow choosing a hue for black values, by giving a tiny increment */ @@ -3176,21 +3182,22 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } else if (event->type == ZEROKEY && event->val == KM_PRESS) { - float rgb[3], hsv[3], def_hsv[3]; - float *def; int len; /* reset only saturation */ len= RNA_property_array_length(&but->rnapoin, but->rnaprop); if (len >= 3) { + float rgb[3], def_hsv[3]; + float *def; + float *hsv= ui_block_hsv_get(but->block); def= MEM_callocN(sizeof(float)*len, "reset_defaults - float"); RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2); ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb+1, rgb+2); ui_set_but_vectorf(but, rgb); @@ -3210,12 +3217,14 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* XXX hardcoded keymap check.... */ else if(event->type == WHEELDOWNMOUSE) { - but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f); + float *hsv= ui_block_hsv_get(but->block); + hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f); ui_set_but_hsv(but); // converts to rgb ui_numedit_apply(C, block, but, data); } else if(event->type == WHEELUPMOUSE) { - but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f); + float *hsv= ui_block_hsv_get(but->block); + hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f); ui_set_but_hsv(but); // converts to rgb ui_numedit_apply(C, block, but, data); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index eb28df54b13..8183617a9ba 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -171,8 +171,9 @@ struct uiBut { char *poin; float hardmin, hardmax, softmin, softmax; - float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons + float a1, a2; float aspect; + char col[4]; uiButHandleFunc func; void *func_arg1; @@ -396,7 +397,7 @@ struct uiPopupBlockHandle { int butretval; int menuretval; float retvalue; - float retvec[4]; + float retvec[8]; }; uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but); @@ -408,6 +409,8 @@ void ui_tooltip_free(struct bContext *C, struct ARegion *ar); uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but); +float *ui_block_hsv_get(uiBlock *block); + /* searchbox for string button */ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but); int ui_searchbox_inside(struct ARegion *ar, int x, int y); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a0f852239c4..c2b09750ee9 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1571,27 +1571,22 @@ static void ui_warp_pointer(short x, short y) void ui_set_but_hsv(uiBut *but) { float col[3]; + float *hsv= ui_block_hsv_get(but->block); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); ui_set_but_vectorf(but, col); } /* also used by small picker, be careful with name checks below... */ -void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) +void ui_update_block_buts_rgb(uiBlock *block, float *rgb) { uiBut *bt; - float hsv[3]; + float *hsv= ui_block_hsv_get(block); /* this is to keep the H and S value when V is equal to zero * and we are working in HSV mode, of course! */ - if (rhsv) { - hsv[0]= rhsv[0]; - hsv[1]= rhsv[1]; - hsv[2]= rhsv[2]; - } - else - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); // this updates button strings, is hackish... but button pointers are on stack of caller function for(bt= block->buttons.first; bt; bt= bt->next) { @@ -1657,23 +1652,23 @@ static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) if (prop) { RNA_property_float_get_array(&ptr, prop, rgb); - ui_update_block_buts_rgb(but->block, rgb, NULL); + ui_update_block_buts_rgb(but->block, rgb); } if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hsv_rna_cb(bContext *C, void *bt1, void *hsv_arg) +static void do_hsv_rna_cb(bContext *C, void *bt1, void *arg_dummy) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; - float *hsv = (float *)hsv_arg; float rgb[3]; + float *hsv= ui_block_hsv_get(but->block); hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2); - ui_update_block_buts_rgb(but->block, rgb, hsv); + ui_update_block_buts_rgb(but->block, rgb); if(popup) popup->menuretval= UI_RETURN_UPDATE; @@ -1694,7 +1689,7 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) srgb_to_linearrgb_v3_v3(rgb, rgb); } - ui_update_block_buts_rgb(but->block, rgb, NULL); + ui_update_block_buts_rgb(but->block, rgb); if(popup) popup->menuretval= UI_RETURN_UPDATE; @@ -1740,7 +1735,7 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) } } -static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv) +static void do_picker_new_mode_cb(bContext *C, void *bt1, void *dummy) { uiBut *bt= bt1; short colormode= ui_get_but_val(bt); @@ -1794,11 +1789,13 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR uiBut *bt; int width, butwidth; static char tip[50]; - static float hsv[3]; static char hexcol[128]; float rgb_gamma[3]; float min, max, step, precision; const char *propname = RNA_property_identifier(prop); + float *hsv= ui_block_hsv_get(block); + + ui_block_hsv_get(block); width= PICKER_TOTAL_W; butwidth = width - UI_UNIT_X - 10; @@ -1818,7 +1815,6 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision); RNA_property_float_get_array(ptr, prop, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); switch (U.color_picker_type) { case USER_CP_CIRCLE: @@ -1838,11 +1834,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* mode */ uiBlockBeginAlign(block); bt= uiDefButS(block, ROW, 0, "RGB", 0, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, rgb); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); bt= uiDefButS(block, ROW, 0, "HSV", width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); bt= uiDefButS(block, ROW, 0, "Hex", 2*width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); uiBlockEndAlign(block); bt= uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth+10, -60, UI_UNIT_X, UI_UNIT_Y, NULL); @@ -1878,14 +1874,14 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR rgb[3]= 1.0f; } - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + picker_new_hide_reveal(block, colormode); } @@ -1906,16 +1902,17 @@ static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *eve if(but->type==HSVCUBE && but->active==NULL) { uiPopupBlockHandle *popup= block->handle; float col[3]; + float *hsv= ui_block_hsv_get(block); ui_get_but_vectorf(but, col); - rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2); - but->hsv[2]= CLAMPIS(but->hsv[2]+add, 0.0f, 1.0f); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2); + rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2); + hsv[2]= CLAMPIS(hsv[2]+add, 0.0f, 1.0f); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); ui_set_but_vectorf(but, col); - ui_update_block_buts_rgb(block, col, NULL); + ui_update_block_buts_rgb(block, col); if(popup) popup->menuretval= UI_RETURN_UPDATE; @@ -1942,8 +1939,11 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); VECCOPY(handle->retvec, but->editvec); - + + block->handle= handle; /* XXX, only for ui_block_hsv_get */ uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop); + block->handle= NULL; + block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; uiBoundsBlock(block, 10); @@ -2438,3 +2438,7 @@ void uiPupBlockClose(bContext *C, uiBlock *block) } } +float *ui_block_hsv_get(uiBlock *block) +{ + return block->handle->retvec+4; +} diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index e0f57a259b5..77770452f84 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2327,7 +2327,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBut *but; uiStyle *style= U.uistyles.first; int width; - float hsv[3]; /* if the report display has timed out, don't show */ if (!reports->reporttimer) return; @@ -2338,8 +2337,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) abs = uiLayoutAbsolute(layout, 0); block= uiLayoutGetBlock(abs); - - rgb_to_hsv(rti->col[0], rti->col[1], rti->col[2], hsv+0, hsv+1, hsv+2); width = BLF_width(style->widget.uifont_id, report->message); width = MIN2(rti->widthfac*width, width); @@ -2348,11 +2345,16 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) /* make a box around the report to make it stand out */ uiBlockBeginAlign(block); but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - copy_v3_v3(but->hsv, hsv); /* set the report's bg colour in but->hsv - ROUNDBOX feature */ - + /* set the report's bg colour in but->col - ROUNDBOX feature */ + but->col[0]= FTOCHAR(rti->col[0]); + but->col[1]= FTOCHAR(rti->col[1]); + but->col[2]= FTOCHAR(rti->col[2]); + but->col[3]= 255; + but= uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - but->hsv[0] = but->hsv[1] = 0.0; /* set a greyscale bg colour in but->hsv - ROUNDBOX feature */ - but->hsv[2] = rti->greyscale; + but->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale); + but->col[3]= 255; + uiBlockEndAlign(block); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 134ab70e4ca..6a0e4feb946 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1646,7 +1646,7 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* gouraud triangle fan */ float radstep, ang= 0.0f; float centx, centy, radius; - float rgb[3], hsv[3], hsvo[3], col[3], colcent[3]; + float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; int a, tot= 32; int color_profile = but->block->color_profile; @@ -1664,7 +1664,8 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* color */ ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + copy_v3_v3(hsv, ui_block_hsv_get(but->block)); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); copy_v3_v3(hsvo, hsv); /* exception: if 'lock' is set @@ -1858,9 +1859,14 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) { float rgb[3], h,s,v; float x=0.0f, y=0.0f; + float *hsv= ui_block_hsv_get(but->block); + + h= hsv[0]; + s= hsv[1]; + v= hsv[2]; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v); ui_draw_gradient(rect, rgb, but->a1, 1.f); @@ -2481,12 +2487,10 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, VECCOPY(old_col, wcol->inner); /* abuse but->hsv - if it's non-zero, use this colour as the box's background */ - if ((but->hsv[0] != 0.0) || (but->hsv[1] != 0.0) || (but->hsv[2] != 0.0)) { - float rgb[3]; - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], rgb+0, rgb+1, rgb+2); - wcol->inner[0] = rgb[0] * 255; - wcol->inner[1] = rgb[1] * 255; - wcol->inner[2] = rgb[2] * 255; + if (but->col[3]) { + wcol->inner[0] = but->col[0]; + wcol->inner[1] = but->col[1]; + wcol->inner[2] = but->col[2]; } /* half rounded */ -- cgit v1.2.3 From bbc8cf9d247e2dec5f1b2e3d2f3e9e5cbd1ae6e9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 14:10:42 +0000 Subject: fix for remaining glitch in square color picker, the backdrop could change color because rgb_to_hsv() was used rather then rgb_to_hsv_compat() --- source/blender/editors/interface/interface_draw.c | 2 +- source/blender/editors/interface/interface_intern.h | 2 +- source/blender/editors/interface/interface_widgets.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index cf6970dc59f..093d175adce 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1404,7 +1404,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect if (but->a1 != -1) { if (but->a1 == UI_GRAD_H) { rcti grid; - float col[3]; + float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */ grid.xmin = rect->xmin + zoomx*(-offsx); grid.xmax = rect->xmax + zoomx*(-offsx); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 8183617a9ba..e58095d9c54 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -444,7 +444,7 @@ extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiB /* interface_draw.c */ extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); -void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha); +void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha); void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 6a0e4feb946..44fec4d4e07 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1725,16 +1725,14 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* ************ custom buttons, old stuff ************** */ /* draws in resolution of 20x4 colors */ -void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha) +void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) { int a; - float h, s, v; + float h= hsv[0], s= hsv[1], v= hsv[0]; float dx, dy, sx1, sx2, sy; float col0[4][3]; // left half, rect bottom to top float col1[4][3]; // right half, rect bottom to top - - rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v); - + /* draw series of gouraud rects */ glShadeModel(GL_SMOOTH); @@ -1860,6 +1858,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) float rgb[3], h,s,v; float x=0.0f, y=0.0f; float *hsv= ui_block_hsv_get(but->block); + float hsvn[3]; h= hsv[0]; s= hsv[1]; @@ -1867,8 +1866,12 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) ui_get_but_vectorf(but, rgb); rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v); + + hsvn[0]= h; + hsvn[1]= s; + hsvn[2]= v; - ui_draw_gradient(rect, rgb, but->a1, 1.f); + ui_draw_gradient(rect, hsvn, but->a1, 1.f); switch((int)but->a1) { case UI_GRAD_SV: -- cgit v1.2.3 From a81be2075f6304c18838fa2d26380342ba2f7894 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 14:14:22 +0000 Subject: use PyC_UnicodeFromByte for bpy.app.tempdir incase of non utf-8 filepath --- source/blender/python/intern/bpy_app.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 6a6b5277d9f..6c4e190673c 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -30,6 +30,8 @@ #include "BKE_global.h" #include "structseq.h" +#include "../generic/py_capi_utils.h" + #ifdef BUILD_DATE extern char build_date[]; extern char build_time[]; @@ -146,7 +148,7 @@ static PyObject *bpy_app_tempdir_get(PyObject *self, void *closure) (void)(self); (void)(closure); - return PyUnicode_FromString(btempdir); + return PyC_UnicodeFromByte(btempdir); } PyGetSetDef bpy_app_debug_getset= {"debug", bpy_app_debug_get, bpy_app_debug_set, "Boolean, set when blender is running in debug mode (started with -d)", NULL}; -- cgit v1.2.3 From 9f05cc59fab2cd3e82be759e46bf4dacd2dbad05 Mon Sep 17 00:00:00 2001 From: Luca Bonavita Date: Wed, 13 Oct 2010 14:44:22 +0000 Subject: == docs == - moved files in proper directories and adapted paths where needed - deleted doc/oldbugs.txt (asked confirmation to jesterking a week ago in irc) - still working on doxygen files, for now I'll leave them in doc/ - NOTE: while checking if other files were referring to these files, I noted that "GPL-license.txt" is also used in the files below: - release/windows/installer/00.sconsblender.nsi - release/windows/specific.sh but these files should't be affected by this commit, but please check :) --- CMakeLists.txt | 2 +- COPYING | 2 +- doc/BL-license.txt | 35 - doc/GPL-license.txt | 340 ----- doc/README.windows-gcc | 123 -- doc/bf-members.txt | 1393 -------------------- doc/blender-cmake.txt | 156 --- doc/blender-guardedalloc.txt | 57 - doc/blender-scons-dev.txt | 194 --- doc/blender-scons.txt | 231 ---- doc/blender.1 | 340 ----- doc/blender.1.py | 136 -- doc/build_systems/README.windows-gcc | 123 ++ doc/build_systems/cmake.txt | 156 +++ doc/build_systems/scons-dev.txt | 194 +++ doc/build_systems/scons.txt | 231 ++++ doc/guides/blender-guardedalloc.txt | 57 + doc/guides/interface_API.txt | 515 ++++++++ doc/guides/python-dev-guide.txt | 170 +++ doc/interface_API.txt | 515 -------- doc/license/BL-license.txt | 35 + doc/license/GPL-license.txt | 340 +++++ doc/license/bf-members.txt | 1393 ++++++++++++++++++++ doc/manpage/blender.1 | 340 +++++ doc/manpage/blender.1.py | 136 ++ source/blender/editors/interface/interface.c | 2 +- source/blender/editors/interface/interface_panel.c | 2 +- source/creator/CMakeLists.txt | 2 +- 28 files changed, 3695 insertions(+), 3525 deletions(-) delete mode 100644 doc/BL-license.txt delete mode 100644 doc/GPL-license.txt delete mode 100644 doc/README.windows-gcc delete mode 100644 doc/bf-members.txt delete mode 100644 doc/blender-cmake.txt delete mode 100644 doc/blender-guardedalloc.txt delete mode 100644 doc/blender-scons-dev.txt delete mode 100644 doc/blender-scons.txt delete mode 100644 doc/blender.1 delete mode 100644 doc/blender.1.py create mode 100644 doc/build_systems/README.windows-gcc create mode 100644 doc/build_systems/cmake.txt create mode 100644 doc/build_systems/scons-dev.txt create mode 100644 doc/build_systems/scons.txt create mode 100644 doc/guides/blender-guardedalloc.txt create mode 100644 doc/guides/interface_API.txt create mode 100644 doc/guides/python-dev-guide.txt delete mode 100644 doc/interface_API.txt create mode 100644 doc/license/BL-license.txt create mode 100644 doc/license/GPL-license.txt create mode 100644 doc/license/bf-members.txt create mode 100644 doc/manpage/blender.1 create mode 100644 doc/manpage/blender.1.py diff --git a/CMakeLists.txt b/CMakeLists.txt index fe23aacaabf..67dd7e40100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,7 @@ TEST_SSE_SUPPORT() # On Macs: # cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config -G Xcode ../blender # -# When changing any of this remember to update the notes in doc/blender-cmake.txt +# When changing any of this remember to update the notes in doc/build_systems/cmake.txt #----------------------------------------------------------------------------- #Platform specifics diff --git a/COPYING b/COPYING index 6e1e14ac224..3be7c91320a 100644 --- a/COPYING +++ b/COPYING @@ -2,7 +2,7 @@ Blender uses the GNU General Public License, which describes the rights to distribute or change the code. Please read this file for the full license. -doc/GPL-license.txt +doc/license/GPL-license.txt Apart from the GNU GPL, Blender is not available under other licenses. diff --git a/doc/BL-license.txt b/doc/BL-license.txt deleted file mode 100644 index 3f079767198..00000000000 --- a/doc/BL-license.txt +++ /dev/null @@ -1,35 +0,0 @@ -Blender License (the "BL", see http://www.blender.org/BL/ ). - -Copyright (C) 2002-2005 Blender Foundation. All Rights Reserved. - -This text supersedes the previous BL description, called Blender License 1.0. - -When the Blender source code was released in 2002, the Blender Foundation reserved -the right to offer licenses outside of the GNU GPL. This so-called "dual license" -model was chosen to provide potential revenues for the Blender Foundation. - -The BL has not been activated yet. Partially because; - -- there has to be a clear benefit for Blender itself and its community of - developers and users. -- the developers who have copyrighted additions to the source code need to approve - the decision. -- the (c) holder NaN Holding has to approve on a standard License Contract - -But most important; - -- the Blender Foundation is financially healthy, based on community support - (e-shop sales), sponsoring and subsidy grants -- current focus for the Blender Foundation is to not set up any commercial - activity related to Blender development. -- the GNU GPL provides sufficient freedom for third parties to conduct business - with Blender - -For these reasons we've decided to cancel the BL offering for an indefinite period. - -Third parties interested to discuss usage or exploitation of Blender can email -license@blender.org for further information. - -Ton Roosendaal -Chairman Blender Foundation. -June 2005 diff --git a/doc/GPL-license.txt b/doc/GPL-license.txt deleted file mode 100644 index 8860b2a8afa..00000000000 --- a/doc/GPL-license.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/doc/README.windows-gcc b/doc/README.windows-gcc deleted file mode 100644 index 78018eabbc0..00000000000 --- a/doc/README.windows-gcc +++ /dev/null @@ -1,123 +0,0 @@ -An updated version of this guide can be found at: - -http://www.blender3d.org/cms/Building_with_Cygwin.524.0.html - -Introduction ------------- - -Here are some basic instructions for building -blender for windows using gcc under cygwin. -Please note that the resulting executable does not -depend on cygwin and can be distrubuted to machines -that don't have cygwin installed. - -The instructions are: - -1. Download cygwin (www.cygwin.com) and use the setup program - to install packages for gcc, gcc-mingw, gcc-g++, w32api, make, cvs, - python, perl, gettext, and gettext-devel (and maybe others... the - dependency list is bound to change over time and hopefully these - instructions will keep up with the changes). All of the following - commands will be entered at the cygwin prompt so launch - cygwin now. - -2. Create a directory to put your sources and then enter that - directory, e.g.: - mkdir bf-blender - cd bf-blender - - *********WARNING: if the directory path you are in contains a space in - it you will get errors in trying to compile the code. Change directorys - to a one that does not contain a space in the path before creating the - above directory ********* - - -Please note that a backslash at the end of a line in the following -means that the command spans two lines. If you wish to type the command as -one line, exclude the '\'. - -3. Checkout the blender module from the bf-blender tree using cvs - (use password anonymous): - cvs -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender login - cvs -z3 -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender \ - co blender - -4. Checkout the lib/windows module from bf-blender using cvs: - cvs -z3 -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender \ - co lib/windows - -5. Enter the newly created blender directory: - cd blender - -6. To prepare the build system to use only the free tools we must - set some environment variables. This is done by creating a - file called "user-def.mk" in the blender directory and - inserting the following line with notepad or your favorite - text editor: - export FREE_WINDOWS=true - - The quickest way to do this though is to issue the following - command: - echo 'export FREE_WINDOWS=true' > user-def.mk - -7. Time to build... issue the command: - make - -8. Wait for it to finish (there is this mysterious place called - 'outside' that I am told is nice to go to while waiting for a - compile to finish). - -9. After it finishes compiling, if you would like to run your freshly compiled - blender, type make release. Then change directorys to obj/233.a/ and move - the zip file to where you want to use it, unzip the file, enter the directory - and run your brand new blender. - - -Getting Help ------------- -If you have problems, come by #blendercompilers on irc.freenode.net -or post questions to the "Compiling, Libraries, Modules" forum -at www.blender.org. There is also the very useful bf-committers -mailing list, what you can subscribe to here: - -http://www.blender.org/mailman/listinfo/bf-committers -(as a bonus you can get info about the most recent features that -are coming down the pipe ...) - -This said, the most common fix to a problem will -probably involve installing an additional cygwin package, -so keep that cygwin setup program close by ... - -Some final notes ----------------- - -- The build will take a long time, even on a fast machine - (a clean build takes almost an hour on my Athlon 1800+ - based laptop). -- If the build is successful you will find it has created - the program obj/windows/bin/blender.exe -- The executable generated by gcc will generally be slower - that an msvc++ generated executable at rendering, but the - OpenGL speed should be about the same. -- Sound is disabled -- If you want to clean your sources issue a 'make clean' - in the top blender directory. -- If you want to update your sources when somebody has - added a new awesome feature, you will want to go to the - topmost blender directory and issue the following command: - cvs -z3 update -P -d - It would probably be best to clean your sources before - re-building (see previous note). -- This is a work in progress, so some things may not be working - right or it may not support all of the cutting edge features. -- Want to make a fancy zipped up blender package to give - to your buddies? Try "make release" ... read the output - to find out where the zip file was placed (note: you will - probably need the zip/unzip packages from cygwin to do - this). -- You can make a debug executable using 'make debug'. The - debug executable will be larger and slower that the - regular executable, but when used with the gnu debugger - (gdb) it can help debug a blender problem (for example, - it can locate the line of code that caused blender to - crash). diff --git a/doc/bf-members.txt b/doc/bf-members.txt deleted file mode 100644 index 41aad8b7264..00000000000 --- a/doc/bf-members.txt +++ /dev/null @@ -1,1393 +0,0 @@ -Blender Foundation Members - -Special thanks to the following people, who have supported the Blender Foundation -by donating at least USD 50 to pay for opening the Blender sources: -(in chronological order): - -Bradley Keyes -Robert Knop -Thomas Brown -Adam Goodenough -Steven Tally -Jason Tally -Alan Taylor -Pascal COMPAGNON -Christopher Koppler -Matthew P. Carter -Gideon Vaala -F.O. Bossert -Frank Mayhar -Peter Volgyesi -Mark E. Nelmes -Peter Lammers -Craig Maloney -daniel e vertseegh -Freek Zijlmans -Anthony Ogden -Anders Dys -Gerald Saunders -Fernando Cordas -Joshua Smith -Max R. Huskins -imarend -Olaf Arnold -Eric Van Hensbergen -Christian Reichlin -brian moore -Anthony Walker -Carsten Hšfer -Raymond Fordham -David Megginson -Jason Schmidt -Christopher Walden -Robert van Straten -Daniel Schwartz -ekzakt -Jellybean -Streit Eric -Bob Ippolito -Keith Frederick -Ryan Heimbuch -Martin Hess -Shigeo Yoshida -Rens Houben -Jun IIO -Derek Gladding -Adam Wendt -Habib Loew -Jani Turkia -Warren Landon -Chip Lynch -Hans Ruedisueli -Keith Jones -Eugenio Mario Longo -Philippe Tanguay -nekurai -Ricardo Kustner -Peter Van Loock -Jun-ichi OKAMURA -alain dejoux -dario trombino -Kenneth Johansson -Felix Schwarz -Eugenio Diaz -Aoki Katsutoshi -Norman J. Harman Jr. -Ralf Habel -Ken Payne -DEBEUX Sylvain -Douglas Philips -Lai Che Hung -Johan Bolmsjš -Aaron Mitchell -Teinye Horsfall -Martin Marbach -Jason Poole -Cesar Delgado -Gareth Clay -Paul Wasserman -Joeri Sebrechts -Johannes Lehtinen -Marcio L. Teixeira -James A. Peltier -George E. Nimmer III -Matthew Fite -Ken Sedgwick -Gary Baltzell -lukas schroeder -Dan Lyke -Mark Thorpe -A.D. Arul Nirai Selvan -Herbert Pštzl -Andy Payne -LAFFITTE Benoit (KenjForce) -James Ertle -Tom Turelinckx -Rigo Ketelings -Bryan Green -Suzuki Akihiro -Mason Staugler -Guillaume Randon -francois Gombault -Harald Thelen -Graziano Roccon -Jonathan DuBois -Jason Luros -Drew M. Snyder -Jesse DeFer -Michael Keith -Gaetano Tinat -Ferris McCormick -Sherman Boyd -Thomas C Anth Jr -Joseph Catto -Damian Soto -John Walsh -Stephen Rosman -Ross Hopkins -Robert Wenzlaff -Joe Galat -LinuxFrench.NET -Thomas Erichsen -Gary E. Deschaines -Denis McCarthy -Michael Dowman -John (J5) Palmieri -alphawolf -Peter Paul Fink -Charles F. McKnight -Avi Schwartz -Jim Witte -Jens Ansorg -William Bate -Ron Romano -Marc Schraffenberger -Steve Thompson -Martin Whitaker -Kendall Dugger -Brice Due -Simon Vogl -Bernd Koestler -clŽment CORDIER -CreationAnimation.com -Pete Carss -HERSEN Antoine -Charles R. Tersteeg -James T Burnett -Shawn Legrand -David Choice -patrick amaru -David Eck -Gabriel Welsche -Henning von Zitzewitz -Chris Impink -Den Giles -Jon Cisewski -Ricki Myers -Luis Collado -Robert G. Watkins -Rainer Perl -YAGI, Toshiki -Bruno Nitrosso -Athalyba / Blender Brasil -Dave Whittington -Darryl Luscombe -Benjamin A Moore -Andreas Kollegger -Stamatis Logos -Ray Kelm -Albrecht Jacobs -Mirko Horstmann -Ranjit Mathew -Jaron Blackburn -Antonio Hui -Scott Moore -CSN media -Scott Carle -Ted Milker -Lars Brinkhoff -Louise Edwards -Alex Ruano -Art Rozenbaum -Manuel Hossfeld -Brandon Ehle -Lou Bruce -ROMASZEWSKI -cadic jean-yves -Ralf Pietersz -KAZY -serge Jadot -HervŽ LOUINET -Tom Houtman -Magnus Kššhler -Martin Sinnaeve -Kevin Yank -Tomoichi Iriyama -THIBAULT -Dr Steven J. Baines -Hans-Peter Berger -Jeffrey D. Holland -Philip XP Talbot -Peter Haight -Krister Bruhwel -the Smoos -Hohenegger Michael -Alejandro Gabriel y Galan -Boyer -Alwin Eilers -Tyberghein Jorrit -Jaroslav Benkovsky -Gianluigi Belli -Naoki Abe -NOTTE Jean-Pierre -Jack Way -Bjšrn Westlin -Mitch Magee -wizoptic -Jake Edge -David Hoover -Xabier Go–i -Daniel Fort -Erik Noteboom -Pavel Vostatek -Javier Belanche Alonso -Jeffrey Blank -Nathan Ryan -Peter Wrangell -Josef Sie§ -Timm Krumnack -Steve Martin -Shigeru Matsumoto -Marko Kohtala -Aleix Conchillo -Curtis Smith -Tatjana Svizensky -Matt Graham -Karo Launonen -Nikolaj Brandt Jensen -Jean-Michel Smith -Nathan Clegg -Joaquim Carvalho -Bomholt -Martin Imobersteg -Jordan -Justin Warwick -barussaud -Eric Molbert -Ben Berck -Jacco van Beek -Dominic Agoro-Ombaka -Colin Foster -Sascha Adler -Stuart Duncan -Brendon Smith -SŽbastien COLLETTE -Clemens Auer -Kay Fricke -Fabian Fagerholm -Norman Lin -Aaron Digulla -Camilo Moreno -Detlev Reppin -Denis NICOLAS -Armin Antons -Darren Heighington -Mario Latronico -Frank Meier -Joerg Frochte -Matthew Ingle -Anters -Bjoern C. Schaefer -STEMax -Jeff Cox -Trevor Ratliff -Matt Henley -Franois VALETTE -Rob Saunders -Mike Luethi -Rami Aubourg-Kaires -Matthew Thomas -Allan Jacobsen -Adam Lowe -David Hostetler -Lo•c Vigneras -Dan Reiland -Pedro D’az del Arco -Pierre Beyssac -Chris Davey -YOSHIAKI Nishino -Cyber Perk -Fabrizio Cali -Harunobu Yoda -Gerrit Jan Baarda -LarstiQ -Ico Doornekamp -Emiel den Biesen -Willem Zwarthoed -Carl Giesberts -Buzz -lieve vanderschaeve -Margreet de Brie -hans verwaal -Saskia van Dijk -Martin Gosch -Alexander Konopka -Thomas Gebert -Gerard de Vries -Hans Lambermont -Kim Beumer -Kay Thust -Alexander Jung -Tony Corlett -Olivier Thouverey -Hideo Nomoto -Giel Peters -Ray Poynter -Edoardo Galvagno -Pim Feijen -Hua-lun Li -William Reynish -Bryan Carpenter -Jim Scott -NGUYEN Fabien -Dave Stone -Andy Kugyelka -Andrew Ross -MerieJean-Christophe -Marko Mestrovic -Jack -Lars Gunnar West -Wile E. Coyote -Rick Clark -Carlos A. Duque -Franck Barnier -Matt Shirley -Viktor Zacek -Peter Williamson -Chema Celorio -Paul Cleveland -Guo-Rong Koh -Andrew Potter -Daniel Smeltzer -Cativo -Dmitri Bichko -Jeremy Brinkley -Stephen Saville -Michael Proto -Kurt Korbatits -Ruan Muller -Mike Beggs -Beat Schiess -Sven Marcel Buchholz -Enrique Monfort -Simon Posnjak -Steven Ahkim -theGyre -William Marble -Allen Smith -Joshua SS Miller -Mike Edwards (PinkFreud) -Mark D. Butala -Auriea Harvey&Michael Samyn -Randy Newman -Leslie Spring -Marc Schefer -Dean Edmonds -David Whitehouse -Tim Humphrey -Phillip Richdale -Jason McHugh -Claudio de Sario -Artur Kedzierski -Richard Garcia -Isaac Rivas Alvarez -Kiernan Holland -Holger Malessa -Masanori Okuda -Andrea Maracci -Kai-Peter BŠckman -Gregg Patton -Luis M Ibarra -Julian Green -Christian Bender -Mark Winkelman -Ebbe L. Nielsen -Carlos Orozco -magnetHead -KrŸckel Oliver -Thomas Ingham -Wes Devauld -Uwe Steinmann -Jesus Gonzalez -DenMeridiS -Marc Hofer -Marko Mestrovic -Leslie Owen Everett -Knut Bueltemann -Eric Garaventa -Wolfram Schwenzer -Edwin Brouwer -mauro ujetto -Franck Vibert -Daniel Pacheco -Justin Shumaker -Steve Wallace -Forensic Engineering Inc. -Steve Mackay -NDNWarrior -Christopher Gray -Darius Clarke (Socinian) -Jean-SŽbastien SEVESTRE -Douglas Fellows -Craig Symons -Quincin Gonjon -Brian B. Kelley -Kie Brooks -Scott Whitney -kwbrads -Keijiro Takahashi -Geno Ruffalo -Zzeb -Peter Dohnt -Jeff E Schram -ernst bunders -Nobutoshi Shigemori -Mariano Aured -Rab Gordon -Kurt Maurer -Ron Cavagnaro (doogs) -Johan Bjorklund -Cyril M. Hansen -JOSEPH GRACI -Rafael Rubio -fabrice meynard -Emilio Aguirre -Mark Lewis -Markus Q. Roberts -Christoher Bartak -Peter Truog -Eric Dynowski -Philipp GŸhring -Pierre-Yves RANNO -Jason Nollan (Cluh) -Launay Jean-Claude -Wayne Buckhanan -Jan Magne Landsvik -Douglas Dragan Njegovan -Brian David Hale -Randal Walser -Matthew A. Nicholson -Thomas -Phillip Kinsley -Jerome Zago -David Rosky -TROJANI Cedric -David Polston -Patrick Mullen -Tetsuya Okuno -Bodo JŠger -Leon Brooks -Cedric Adjih -Michael L. Fisher -Dan Tomalesky -Sky Schulz -Scott Brickert -James Purdon -Miles Langham -N Yiannakoulias -Stephen Swaney -www.artwave.nl -Take Vos -sspickle -Denis Oliver Kropp -Gustavo -rodgers whittington jr -George Dvorak -Norman J Davis, Jr. -Javier Velazquez -John Tougas -John Howland -Steve Organek -Jano Lukac -David Cardon -Mick Balaban -Michael Kaufman -Viper Expo -Chassoulier -Sjoerd Zaalberg van Zelst -B. Douglas Hilton -Benoit CANTAGREL -Kai Fischer -Mark Osborne -Michael Hollenbeck -iconjunky -luca de giorgi -Jonathan Mullen -Javier Fernandez-Ivern -Reuben Burgess -Olivier Scalbert -claudio luis Rogers -Jeremy Peterson -Mark Streutker -Lourens Veen -Neil Davis -John McGurk -Stephen Teegarden -Dave LeCompte -Michael Lang -Mortal_Enemy -Arigo Stanescu -Vincent Stoessel -Adrian Virnig -Chris Dixon -Travis Cole -MŒrten MŒrtensson -Evan Scott -Mark Coletti -Ken Burke -Karl Holland -ScRaze -Wilco Wilbrink -chris montijn -Michael Wagenmann -Viktor Pracht -henrik wilming -Jim Evins -Christophe Massaloux -Marc Sommer -Luc Stepniewski -Eric M. Clark -Iain Russell -Thomas Bleicher -Anthony Zishka -Jefferson Dubrule -Esa PiirilŠ -Bill Thiede -William Anderson -Alexander Kittel -Joe Tennies -Sam Cable -Christian Peper -Joshua Frederick -Steve Sutton -Pete Toscano -Michael Zucchi -Peter Degenhardt -Horizont Entertainment -Olivier Bornet -Richard D. Laudenslager -sha -John DiLauro -John Miller -Frederic Crozat -Matt Welland -Paul CalcŽ -Joe Prochilo -Justin Shafer -Joe Croft -Detlef Mueller -Raschbacher Thomas -Alain Gallo -Phuoc Ngo -Krabat -Derek Harmison -SŽbastien Devine -Kenneth P. Stox -Wade Felde -Kai Groshert -Michael Soibelman -janine dalisda-davis -Philippe Raxhon -Daniel Sheridan -Michael Pressler -Daniel Lundqvist -Tim Oertel -James Ahlschwede -William Henstrom -PETIT-PHAR Patrice -Marc-Aurele DARCHE -Wei-ju Wu -Robert Wilson -Gerald Severs -Alejandro Conty Estevez -Tetsuya Yatagai -David Dolder -Luigi Cristiano -Posse Press / Romain Canonge -Vania Smrkovski -Bartosch Pixa -Dr. Jens Rosenboom -Gunnar Stahl -Robert Kroeger -Martin Forisch -Guillermina Manon -Randal D. Adams -Kevin Reagh (kevin3D) -Wolfgang KŸhn -BEAUSOLEIL Arnaud -Stan Jakubek -Klaus Brand -Holger Mueller -Fankhauser -Jon McCallum -Rob Olsen -Joel Davis -Kenneth Bledsoe -James F. Campanella -Jens Kilian -wim hendrix -Karri Kaksonen -Luis Roldan -Jason L. Shiffer -Jacco Marks -Dale Schoeck -Agustin Catalan -A. T. Meinen -Kamiel Wanrooij -Samuel Seay -Mike Schaudies -Robert Sherwood -Fernando Villalon Panzano -Jšrg Roschke -Carl Symons -Peter Pichler -Alan Heckart -seth nagy -pelletier -Jeff Kowalczyk -LIONEL ALLORGE -Bhishma Patel -Richard Rowell -Barbara Seaton -Aschwin van der Woude -William J Black -Kars Meyboom -Glen Nakamura -Jim Belcher -Tim Scott -mea van amstel -Robert-Reinder Nederhoed -Neil Hunt -WizardNx -Brad Choate -scott schoen -Dan Merillat -Martin Krueger -Samuel Greenfeld -Damon Tkoch -Colin Millar -Mike Roseman -Patrick Trussell -Hans-Peter Bock -Daniel Haertle -Wiremu Te Kani -Joep Mathijssen -LATRY -Witold Hazuka -geoff marshall -dave howard -Jan Zielinski -Fernando Buelna Sanchez -Timo Mihaljov -Allard Willem van den Brul -T.J.T van Kooten -Thijs van der Vossen -Antonio de Santis -Jama Poulsen -Robert Emanuele -Timothy Lord -Tom Parker -Jarrod Willard -Leon Merts -Tom Dow -Eric Anholt -mercier -Marc van Kempen -wim van hoydonck -Joe Hacobian -Jose Luis Fresquet Febrer -toni calmardo -Sam Littlewood -Charles Wardlaw -Javier Rodriguez -Michael C. Schwab -Corey Bell -Emmanuel Preveraud de La Boutresse -Davide Desogus -Larry Phillips -Marko Teiste -John Roesink -Legrand Johan -Jeff Boody -James Turner -Peter Petrakis -Ravi Ravindran -dickie -Rene Geerlings -Richard Braakman -Arthur Frenslich -Carsten Schmidt -Ronny Martin -Erwin Kuiper -Lopez-Garcia, Juan-Carlos -Rau, Bernhard -Stephen Uithoven -Ken Beyer -Matjaz Jakopec -Eckhard M. JŠger -Mike Siebach -John Harger -Justin W. Carper -Markus Weber -Elena Grandi -Arndt Heuvel -Miguel Cancela Da Fonseca -Kirk Lancaster -Phillip Elliott -Chris Halsall -Andre Voitel -benjamin scheers -Robinder S. Bains -David Brunton -David Brown -Craig Duncan -du Song -Ben Wart -Eryk Kedzierski -Ronald Hayden -Raymond de Vries -David Johnson -Kenichi Fujihiro -WANG -Chris Weber -Christian Lehmann -DENDIEVEL Stephane -Bryan Jaycox -Karl Bartel -Ralph Howes -Matthew J. Stott -Omar Priego -ke Westerstršm -Imago Viva -James E Hill -Rune Myrland -James Hill -Nick -Ramiro Santos -Giuseppe Chiesa -Philippe Ney -Tom Woodyard -Jim Gray -Jim Newman -Robert I Black III -Peter Marouelli -Ian Roberts -Guy Van Rentergem -Jose Luis Perez Rubio -Gabriel Mainberger -Klein Poelhuis -Luke Sargeant -Edomaur -robert stok -Karl J. Smith -Harry Splinter -Paul Boese -Dave Mata -piet visser -Nicolas Christin -Erik Zidowecki -Markus Michael Egger -Edward R. Helwig -Alyx Flannery -raphael betemps -Masahiro Takahata -Claude Bilat -Mario Palomo -Neipi -Grethus Bode -Jan MŸller -Mark Pearson -Stanislav Osicka -DataCare Solutions AG -Russell Elliott -Antonio Campos -bordeaux samuel -Herman Vereycken -Sergio Avila -George Dobrozemsky -Ocie Mitchell -Ryuuji Kusajima -Nick Austin -Edward Wei -Gregg Tavares -Aaron Bredon -Hideki Suzuki -josef radinger -Robert Friemer -Jšrg Zastrau -Burton Bicksler -Kimmo Mšsš -Robert F Johnson -Mark Johnson -Avi Bercovich -Mike Armitage -Roy Jones -Kathleen Sinnott -Per-Erik Westerberg -Reid Ellis -Phillip J. Birmingham -Ken Jordan -Duffaud -Marco Ardito -Simon Suter -Tobias Huelsdau -Winfried EnglŠnder -Stephen Groundwater -Joel Ray Holveck -Mag. Tibor Rudas -Hartmut Wolf -Douglas Jones -brett hartshorn -Beat MŠgert -Javon Prince -bri -James Klicman -Harvey Fong -jeroen v.d. Meulen -Wim Vandersmissen -Carlos Moreno Rodr’guez -Trausti Kristjansson -Larry Snyder -olivier -jip -Thomas Hintz -Daan van der Munnik -gideon -jared -Erick I. Jimenez Alvarado -John Martinez -Daniel Stephens -Alaric Haag -Michael Edwards -Sam Tregillus -Joe Pribele -Jeffry Archambeault -robert schiffers -shane smith -elout de kok -Felix Esser -Dietrich Lange -Richard Clark -errol garner -Jose M Cerqueira Esteves -Jeroen Janssen -Sven Meyer -Mike Bayer -Arash Vahdat -Bernd Hoppe -Tobias Geiger -Ronnie Stevens -W. van Ophoven -Artem Baguinski -Peter Morse -Nicholas Phillips -Leo Mannhart -philippe eygonnet -Hans Klerk -wes uchida -Guido Winkelmann -Doug Ferguson -Robert Lindsay -John Lovgren -Rogers Cadenhead -Philippe Crassous -Dirk Krause -lexpattison -Fred Roberts -Njin-Zu Chen -GUILLON Marc -Felix Klock -Ernesto Salas Rodr’guez -Pavel Roskin -Jaap -Stefan Maass -Adam Bower -Gary Thomas -Chris Gottbrath -seyssel claude -Chris Winberry -Chip Collier -Balint Reczey -Nuno Sucena Almeida -Landon Bradshaw -Chua Mei Ling -JC Hythloday -Dustin Knie -artshow -Ralf Gauglitz -Ted Schundler -Bernard Hurley -delerue -Dirk Behrens -Doc Holiday -Wouter Kerkhoven -Andreas BŸttner -James Black -Nicholas Ward -David Oberbeck -The Shizit -Erich Moog -James Amendolagine -Alex Penner -Dieter Finkenzeller -giol franco -Tobias Regenbrecht -Ryan Dewalt -Spencer Cathey -Benoit SERRA -System Impuls -Jason Tranter -macherb -LCC Consulting AG -Ivan So -Cori Verschoor -Henauer Pascal -Chris Bilderback -Eddie Sheffield -DEHEN Pierre -henk van den toorn -Ian Whitworth -Ruud H.G. van Tol -Pierre Lo Cicero -Srinivas Digumarty -digitalvelocity¨ -Alan J Booth -Tony OBrien -Douglas Toltzman -Christophe BOUCHET -Paul Robertson -SCHNEIDER Philippe -Jason Cunliffe -Dick Damian -Charles Hakari -jeff knowlton -Kevyn Shortell -robin -Craig Spitzer -Jeffrey Van Ness -Lucas Vergnettes -Wolfgang Michaelis -Luis JimŽnez Linares -Julian Eden -Ms Lilo von Hanffstengel -Kurt B. Kaiser -Mark Ping -CombŽe -Diego Matho -MELIN Philippe -Damian Sobieralski -Luigino Masarati -Leonard Wikberg III -Tom Howsman -Christopher R Marquard -Claus Munk -Chris D'Iorio -Graphics Solutions Pty Ltd -Bernd Stein -Jose Angel Vallejo Pinto -Matthew William Turner -Kelly A. Flinn -Hai T. Nguyen -Tim Formica -Kevin Purrington -Andreas Lindenblatt -Brian Musker -Diego Silvio Novo -Close Pierre-Yves -Wayne Pierce -Hattan Lee -Didier PEYRET -Jacquelin GAZEAU -Kenneth Balmer -Robert Hwang -Gaertner, Klaus -Peter Gumieniak -Simon Pigot -Ian Thompson -Jason Southwell -Stephan -Robert Kuehn -IUT Mesures Physiques:gilbert Garnier CAEN France -Nigel I Phillip -powermacg4 -Joan Touzet -Mike Mormando -katsuhiko ebisawa -Baheux Tony -Randi Joseph -Rick Comeau -michiel van der kley -Thijs Seelen -Robert Roos -ton -david seccombe -Joshua Eckert -Joshua Newman -Paolo Sammicheli -Gentilini Bruno -Martin Herren -STRAPPAZON Mathias -Steven Gibbs -Florian Kruesch -Wesley Blijlevens -Fabianne Balvedi -Colin Henry -Mark Deepak Puttnam -LE GOULVEN -evolutie -Stephane Portha -Robert Gentner -David B. Camhy -RenŽ Foucart -Coyok Drio -Mark Ng -klein michael -Antonin Kral -Edward Jomisko -Wouter de Mik -Matteo De Simone -Gal Barak -Thomas Dyar -Nathan Allworth -Dean Giberson -Larry Cummings -Eric Augustine -IngieBee -Michael Velikanje -Andre M. Czausov -H@dj -Thorsten Burghaus -Renzo Lauper -Martin White -Ferdinand Strixner -Neil Mannall -Maxime Wacker -Gal Buki -Rene Christen -Andreas Neukoetter -DAVID JOHNSON -John Walton -Volker Mische -Michel Vilain -Luigi/Blender Brasil -Clifton A. Cross -Kent B. Mein (SirDude) -Anne Postma -Matt Runion -Bob Tackett -stanislas nanchen -Jorge Monteiro -S68 -Ville Kaajakari -Adrien Rebollo -Al Curatolo -Frank Rutten -Dierk Dohmann -Roel Spruit -Rob Coldwell -Yann Vernier -Haunt_House (PH) -Ravinder Singh Bhara -Erik Augustijns -Ryan Earle Freckleton -Andreas Sturm -matt mullin -MOREAUX Denis -Brendan Stromberger -Hideki Saito -Christian Ullrich -Courty Didier -Steve Newton -Brecht Van Lommel -Jasper Op de Coul -Stuart MacKinnon -Dietrich Dietz - the IMaGiNation project (IMGN) -Tina Hirsch -John R Thorp -FrŽdŽric Bouvier -LINETTE -Felix Rabe -Chay Adamou -nick harron -stephen john ford -Kino -Daniel Sjšlie -Matthias Derer -Alain VALLETON -Kervin Pierre -Mike Laughton -Frank van Puffelen -Andreas Dluzewski -Christofer Edvardsen -Maciek Szczyglowski -Rakesh Ravuri -Robert Schouwenburg -Bob Bayens -Devas73 -Mika Saari -Robert Ives -Adam McBride -IAN ROSS -Uriah Liggett -stefan fischer -Didac Miro -Tim Barlow -G. T. Blackwell -Tim Weaver -Dalet -Erwin Vervacke -Benjamin Eduardo Rodriguez Berumen -Ozono Multimedia s.l.l. -James Kersey -Michael DeLuca -Mark Swann -Andreas Altenburger -John Smith -Simon de Haan -David Gregory -Harald Krummeck -E Warren McNee -Marc-Andre Levesque -Satoshi Yamasaki -Rolf-Dieter Klein -J. Deetman -Helge Walter -Roland StrŒlberg -Nicolas Morenas (Caronte) -Simon Clarke -Maigrot Michel -Rod Robinson -Kevin Cozens -Germ‡n Alonso (taz) -Martin Stegeman -Henrik Jordfald Olsen -Mitchell Skinner -Michael Lei -Spiridon G. Kontarakis -Bas Denissen -Loic Dachary -Michael Rutter -Thorsten SchlŸter -hijothema -Andreas Hauser -Holger Haase -Danilo Duina -Matthias Thurau -Flavio Curti -Ian Beardslee -Cristina Lozano Ballester -Jason Roberson -Victor Lim -andreas palsson -Richard Charvat -James Ezell -Florian Eggenberger -John J. Marshall -Paul Lunneberg -Peter Wolkerstorfer -Gerhard Siegesmund -Nat Budin -NDNChief -Dave Leeak -Michael Siebecker -Jan Walter -John Aughey -Corey Rice -Darren F. Coolen -tony principali -Joe Kimmes -Pekka Karvonen -Rick Kimball -Christopher Capoccia -Bertram Zeller -Vanpoucke Alexandre -Bassam Kurdali -Michael Baker -Michael Schwemmle -Ford "fullback" Roberts -Lama Angelo -Kevin Roeder -oliv -pinhead_66 -Zach Millis -Ryan C. Stallings -Adam LaJeunesse -Satish Goda -Erik Haagsman -Lorenzo Moro -Nathan Letwory -stephan f. haupt -Alex Papadopoulos -Gianluigi Berrone -andrea casentini -David Randall Simpson -Jason Oppel -Mark Bloomfield -Alexander Ehrath -Owen Swerkstrom -Aurelio Caliaro -Karsten Dambekalns -Eddy MOUSSA -Bernd Roetter -Roland Hess -Luis Eduardo P. Gervasio -Pierre-Luc Robert (bedsitter) -Andreu Cuartiella -Nathan Vegdahl -Scott Ross -Jacob Kafka -Mario Bolte -Wolfgang Draxinger -Starr Kline -John Lullie -Chiffi Cosimo -Morgan McMillian -Stefan HŸbner -Loic de MONTAIGNAC -AndrŽs Castillo -Francesco Anselmo -Ingo Guenther -James C. Davis, Jr. -Claudio Andaur -Caleb Williams -Orest Dubay -Adam Casto -David -Joost Burger -Ken Hahn -Mark Herring -Stig Oeveraas -Robert Rainthorpe -Martin Middleton -Simon Sedgwick -Joseph Firestine -Miguel Melo -Wooster Dennis -Gary Lucas -Johannes Schwarz -Mark Dalton -Mike Norton -Michael Schardt -jean-michel soler -Chris Bracewell -Ross Dawson -Tim De Graeve -Adam Wiseman -Luiz Olsson Barbosa -Donna Carey -Auke van Balen -Mike Birdsong -Martin Curran -Shawn M. Murray -Roy Simmons -Malik -Teguh Pangestu -Mats Holmberg -Julien Jehannet -Michael A. Nelson -Axel Cushing -erik vogan -Datenflug GmbH -KC Roeyer -Ryan J. Parker -Robert E. Meuse -Alex Heizer -Netsail Ltd / Mats Holmberg -Jonathan Lawman -Seikoh Hokama -Perry Faulkner -Will Hanson -Lyubomir Pavlov Kovachev -Ennio Quattrini -Marcelo "xfer" Alves -Joseph Winston IV -Jorge Otero Rueda -Timothy Murakami -Matthew Johnson -Erik Rombouts -Petr Vlk -Thomas Dammann -Henrik Turkerud -Erlend Hamberg -Arnaud Lebegue -Kevin O'Brien -Michael Buettner -Engel A. Sanchez -Alexander Hilgert -FAUGE Thierry -Wulf Huesken -John M. Adams -Dell'Aiera Pol -Waylena McCully -Russell Smith -Luke Titley -marinus meijers -Henry Kaminski -Alistair Riddoch -Daniel NŸmm -Matthew Meadows -Bjoern Paschen -Paul Fredrickson -Gavin Baker -Jan Illetschko -Aaron C. McLeod -Thomas Muldowney -Cheyenne Cloud, LLC -Helmut A. Goettl -Martin A. Boegelund -Beno”t Cousson -Scott Brooks -Ferlet Patrice -Aaron Porterfield -Ivan Florentin -Scott Isaacson -Rui Paulo Sanguinheira Diogo -Jason Saville -Active-Websight GbR -Bryon Roche -Gustavo Mu–oz -Christopher Gillanders -Phil Frost Tate -Gilles Gonon -Kay -James C. Franklin -Luis Enrique Caama–o Navas -Alexander "estartu" Felder -Marc Ledermann -vrijschrift.org -Holger Weihe -Peter Cammaert -Andres Meyer -Tony Arnett -Adam Hughes -Tony Farley -Dmitriy Teresh -Maickel Swart -Peter den Bak -Steve Bennett -Romain Rubi -John Bolt -Michael Gaston -Philip Brown -Wasi -Mike Hirst -Lloyd J Robinson, Jr -Charles Rinker -Nick Vogtmann -Frank van Beek -Bruce Mitchener -ROBERTO A. RUIZ VIAL -Maurizio Sibaud -Ron Bolger -Nathan Parton -Andrew Fry -VINCENT StŽphane -Yan Yan -Justin L Graham -Wade Beasley -Salvador Mata Rodriguez -Jan Tiemersma -Luis A. R. Fernandez -Jacob Moy -Stefano Francesi -Jochen Hanne -David Stephenson -Brent O'Dell -Mike Kasprzak -Tom Thompson -David Fung -Radoslav Dejanovic -James H. Cloos, Jr. -Karl Erlandsen (LethalSideParting) -Kari Pulli -Dave Shemano diff --git a/doc/blender-cmake.txt b/doc/blender-cmake.txt deleted file mode 100644 index a49ff629b5b..00000000000 --- a/doc/blender-cmake.txt +++ /dev/null @@ -1,156 +0,0 @@ -$Id$ - - Blender CMake build system - ============================ - - Contents - --------------- - - 1. Introduction - 2. Obtaining CMake - 3. Obtaining Dependencies - 4. Deciding on a Build Environment - 5. Configuring the build for the first time - 6. Configuring the build after CVS updates - 7. Specify alternate Python library versions and locations - - - 1. Introduction - --------------- - - This document describes general usage of the new CMake scripts. The - inner workings will be described in blender-cmake-dev.txt (TODO). - - 2. Obtaining CMake - ------------------ - - CMake for can either be downloaded using your favorite package manager - or is also available from the CMake website at http://www.cmake.org - The website also contains some documentation on CMake usage but I found - the man page alone pretty helpful. - - 3. Obtaining Dependencies - ------------------------- - - Check from the page - http://www.blender.org/cms/Getting_Dependencies.135.0.html that you - have all dependencies needed for building Blender. Note that for - windows many of these dependencies already come in the lib/windows - module from CVS. - - 4. Deciding on a Build Environment - ---------------------------------- - - To build Blender with the CMake scripts you first need to decide which - build environment you feel comfortable with. This decision will also be - influenced by the platform you are developing on. The current implementation - have been successfully used to generate build files for the following - environments: - - 1. Microsoft Visual Studio 2005. There is a free version available - at http://msdn.microsoft.com/vstudio/express/visualc/. - - 2. Xcode on Mac OSX - - 3. Unix Makefiles (On Linux and Mac OSX): CMake actually creates make - files which generates nicely color coded output and a percentage - progress indicator. - - - 5. Configuring the build for the first time - ------------------------------------------- - - CMake allows one to generate the build project files and binary objects - outside the source tree which can be pretty handy in working and experimenting - with different Blender configurations (Audio/NoAudio, GameEngine/NoGameEngine etc.) - while maintaining a clean source tree. It also makes it possible to generate files - for different build systems on the same source tree. This also has benefits for - general CVS management for the developer as patches and submit logs are much cleaner. - - Create a directory outside the blender source tree where you would like to build - Blender (from now on called $BLENDERBUILD). On the commandline you can then run - the cmake command to generate your initial build files. First just run 'cmake' which - will inform you what the available generators are. Thn you can run - 'cmake -G generator $BLENDERSOURCE' to generate the build files. Here is an example - of all this for Xcode: - - % mkdir $BLENDERBUILD - % cd $BLENDERBUILD - % cmake - - ... - ... - --version [file] = Show program name/version banner and exit. - - Generators - - The following generators are available on this platform: - KDevelop3 = Generates KDevelop 3 project files. - Unix Makefiles = Generates standard UNIX makefiles. - Xcode = Generate XCode project files. - - - - % cmake -G Xcode $BLENDERSOURCE - ... - ... - -- Configuring blender - -- Configuring blenderplayer - -- Configuring done - -- Generating done - -- Build files have been written to: $BLENDERBUILD - - This will generate the build files with default values. Specific features can - be enabled or disabled by running the ccmake "GUI" from $BLENDERBUILD as follows: - - % ccmake $BLENDERSOURCE - - A number of options appear which can be changed depending on your needs and - available dependencies (e.g. setting WITH_OPENEXR to OFF will disable support - for OpenEXR). It will also allow you to override default and detected paths - (e.g. Python directories) and compile and link flags. When you are satisfied - used ccmake to re-configure the build files and exit. - - It is also possible to use the commandline of 'cmake' to override certain - of these settings. - - 6. Configuring the build after CVS updates - ------------------------------------------ - - The $BLENDERBUILD directory maintains a file called CMakeCache.txt which - remembers the initial run's settings for subsequent generation runs. After - every CVS update it may be a good idea to rerun the generation before building - Blender again. Just rerun the original 'cmake' run to do this, the settings - will be remembered. For the example above the following will do after every - 'cvs up': - - % cmake -G Xcode $BLENDERSOURCE - - 7. Specify alternate Python library versions and locations - ---------------------------------------------------------- - - The commandline can be used to override detected/default settings, e.g: - - On Unix: - cmake -D PYTHON_LIB=/usr/local/lib/python3.1/config/libpython3.1.so -D PYTHON_INC=/usr/local/include/python3.1 -G "Unix Makefiles" ../blender - On Macs: - cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -G Xcode ../blender - - Mote that this should only be needed once per build directory generation because it will keep the overrides in CMakeCache.txt for subsequent runs. - - - - To be continued... - - TODO's - ------ - - 1. Get CMake to create proper distribution directories for the various platforms - like scons does. - 2. Investigate the viability of using CPack to package installs automatically. - 3. Refine this document and write detailed developer's document. - 4. Make sure all options (ffmpeg, openexr, quicktime) has proper CMake support - on the various platforms. - - /Jacques Beaurain (jbinto) - diff --git a/doc/blender-guardedalloc.txt b/doc/blender-guardedalloc.txt deleted file mode 100644 index 44a9722a4e4..00000000000 --- a/doc/blender-guardedalloc.txt +++ /dev/null @@ -1,57 +0,0 @@ -MEMORY MANAGEMENT IN BLENDER (guardedalloc) -------------------------------------------- - -NOTE: This file does not cover memutil and smart pointers and rerefence counted - garbage collection, which are contained in the memutil module. - -Blender takes care of dynamic memory allocation using a set of own functions -which are recognizeable through their MEM_ prefix. All memory allocation and -deallocation in blender is done through these functions. - -The following functions are available through MEM_guardedalloc.h: - -For normal operation: ---------------------- - -void *MEM_[mc]allocN(unsigned int len, char * str); - -- nearest ANSI counterpart: malloc() -- str must be a static string describing the memory block (used for debugging -memory management problems) -- returns a memory block of length len -- MEM_callocN clears the memory block to 0 - -void *MEM_dupallocN(void *vmemh); - -- nearest ANSI counterpart: combination malloc() and memcpy() -- returns a pointer to a copy of the given memory area - -short MEM_freeN(void *vmemh); - -- nearest ANSI counterpart: free() -- frees the memory area given by the pointer -- returns 0 on success and !=0 on error - -int MEM_allocN_len(void *vmemh); - -- nearest ANSI counterpart: none known -- returns the length of the given memory area - -For debugging: --------------- - -void MEM_set_error_stream(FILE*); - -- this sets the file the memory manager should use to output debugging messages -- if the parameter is NULL the messages are suppressed -- default is that messages are suppressed - -void MEM_printmemlist(void); - -- if err_stream is set by MEM_set_error_stream() this function dumps a list of all -currently allocated memory blocks with length and name to the stream - -int MEM_check_memory_integrity(void); - -- this function tests if the internal structures of the memory manager are intact -- returns 0 on success and !=0 on error diff --git a/doc/blender-scons-dev.txt b/doc/blender-scons-dev.txt deleted file mode 100644 index d13ea7c036f..00000000000 --- a/doc/blender-scons-dev.txt +++ /dev/null @@ -1,194 +0,0 @@ -$Id$ - - - Internals of Blenders SCons scripts - =================================== - - Scope - ------ - This document describes the architecture of the SCons scripts for - Blender. An overview of available functionality and how to modify, - extend and maintain the system. - - Audience - -------- - This document is for developers who need to modify the system, - ie. add or remove new libraries, add new arguments for SCons, etc. - - Files and their meaning - ----------------------- - - The main entry point for the build system is the SConstruct-file in - $BLENDERHOME. This file creates the first BlenderEnvironment to work - with, reads in options, and sets up some directory structures. Further - it defines some targets. - - Platform-specific configurations are in $BLENDERHOME/config. The - filenames have the form (platform)-config.py, where platform one of: - - * darwin - * linux2 - * win32-mingw - * win32-vc - - The user can override options by creating a file - $BLENDERHOME/user-config.py. It can have any option from - (platform)-config.py. Options in this file will override the platform - defaults. - - Much of the actual functionality can be found in the python scripts - in the directory $BLENDERHOME/tools, with Blender.py defining the - bulk of the functionality. btools.py has some helper functions, and - bcolors.py is for the terminal colours. mstoolkit.py and crossmingw.py - are modules which set up SCons for the MS VC++ 2003 toolkit and - the cross-compile toolset for compiling Windows binaries on Linux - respectively. Note: the cross-compile doesn't work yet for Blender, - but is added in preparation for having it work in the distant future. - - BlenderEnvironment - ------------------ - - The module Blender.py implements a BlenderEnvironment class, derived - from the SConsEnvironment of SCons. This is done to wrap some often - used functionality. The BlenderEnvironment offers two important - wrappers: BlenderProg() and BlenderLib(). The first one is used to - specify a binary to be built, the second one is used to specify what - static library is built from given sources. - - Build a static library called "somelib". The system handles library - pre- and suffixes automatically, you don't need to bother yourself - with these details: - - env = BlenderEnvironment(ENV = os.environ) # create an environment - env.BlenderLib(libname="somelib", sources=['list.c','with.c','sources.c'], - includes=['/list/with/include/paths', '.', '..'], - defines=['LIST_WITH', 'CPP_DEFINES', 'TO_USE'], - libtype=['blender', 'common'] # this is a list with libtypes. Normally you don't - # need to specify this, but if you encounter linking - # problems you may need this - priority=[10, 20] # Priorities, list as long as libtype, priority per type - compileflags=['/O2'] # List of compile flags needed for this particular library. - # used only in rare cases, like SOLID, qhull and Bullet - ) - - There should be no need to ever add an extra BlenderProg to the - existing ones in SConstruct, see that file for its use, and Blender.py - for its implementation. - - The new system works so that using these wrappers, has all libraries - (and programs) register with a central repository. This means that - adding a new library is as easy as just creating the new SConscript - and making sure that it gets called properly. Linking and such will - then be handled automatically. - - If you want that adding new source files for a certain library - is handled automatically, you can use the Glob() function from - the BlenderEnvironment to create lists of needed files. See - $BLENDERHOME/source/blender/src/SConscript for an example. Keep in - mind that this will add any new file that complies to the rule given - to the Glob() function. There are a few (external) libraries with - which this can't be used, because it'd take files that shouldn't be - compiled, and create subsequentially problems during the linking stage - (like SOLID, qhull, Bullet). - - Linking order and priorities - ---------------------------- - - As shown above, you can give a library a priority in a certain - group. If you need to make sure that a Blender library is linked - before or after another one, you can give it a priority. To debug - the priorities us BF_PRIORITYLIST=1 on the command-line while running - a build. - - % scons BF_PRIORITYLIST=1 - - This will give a list with values suggested by the system. Make - changes to all SConscripts in question to reflect or change the - values given by this command. ALWAYS check this after adding a new - internal, external library or core library, and make sure there are - sane values. You can use large and negative numbers to test with, - but after you've got a working linking order, do change the system - to reflect BF_PRIORITYLIST values. - - Also, if you find that a library needs to be given multiple times to - the linker, you can do that by giving a python list with the names - of the available library types. They are currently: - - B.possible_types = ['core', 'common', 'blender', 'intern', - 'international', 'game', 'game2', - 'player', 'player2', 'system'] - - More groups can be added, but that should be carefully considered, - as it may lead to large-scale changes. The current amount of libraries - should suffice. - - The central repository is utilised in the SConstruct in two - ways. Firstly, it is used to determine the order of all static - libraries to link into the main Blender executable. Secondly, it - is used to keep track of all built binaries and their location, - so that they can be properly copied to BF_INSTALLDIR. - - The libraries can be fetched in their priority order with - create_blender_liblist from Blender.py, see the SConstruct on how - it is used. - - The program repository is the global list program_list from - Blender.py. See SConstruct for its usage. - - - Adding a new option and libraries - --------------------------------- - - Lets say we want to add WITH_BF_NEWLIB, which will - enable or disable a new feature library with sources in - $BLENDERHOME/source/blender/newlib. This 'newlib' needs external - headers from a 3rd party library '3rdparty'. For this we want to - add a set of options BF_3RDPARTY, BF_3RDPARTY_INC, BF_3RDPARTY_LIB, - BF_3RDPARTY_LIBPATH: - - 1) Add all mentiond options to all (platform)-config.py - files. WITH_BF_NEWLIB is a boolean option ('true', 'false'), - the rest are strings with paths and library names. See the - OpenEXR options for example. - - 2) Add all options to the argument checking function - validate_arguments() in btools.py. See again OpenEXR options - for example. - - 3) Add all options to the option reading function read_opts() - in btools.py. See again OpenEXR options for example. All default - values can be empty, as the actual default values are in the - (platform)-config.py files. - - 4) Add BF_3RDPARTY_LIB to the function setup_syslibs() - and BF_3RDPARTY_LIBPATH to the function setup_staticlibs() - in Blender.py - - At this stage we have prepared all option setting and linking needs, - but we still need to add in the compiling of the 'newlib'. - - 5) Create a SConscript in $BLENDERHOME/source/blender/newlib. Look - at ie. $BLENDERHOME/source/blender/src/SConscript for - template. The new SConscript will register the new library - like so: - - env.BlenderLib(libname='newlib', sources=sourcefiles, includes=incs) # the rest of the arguments get defaults = empty lists and values - - 6) Edit $BLENDERHOME/source/blender/SConscript with the following - addition: - - if env['WITH_BF_NEWLIB'] == 1: - SConscript(['newlib/SConscript']) - - After this you can see if this works by trying to build: - - % scons WITH_BF_NEWLIB=1 # build with newlib - % scons WITH_BF_NEWLIB=0 # disable newlib - - This is all what should be needed. Changing the library name doesn't - need changes elsewhere in the system, as it is handled automatically - with the central library repository. - - Enjoy the new system! - - /Nathan Letwory (jesterKing) diff --git a/doc/blender-scons.txt b/doc/blender-scons.txt deleted file mode 100644 index 016ba39fd09..00000000000 --- a/doc/blender-scons.txt +++ /dev/null @@ -1,231 +0,0 @@ -$Id$ - - Blenders SCons build scripts - ============================ - - Introduction - ------------ - - Since the beginning of 2004 Blender has had the SCons system as a - build option. SCons is a Python-based, accurate build system. The - scripts that were implemented in the first iteration worked, but - the system grew quickly into such a state that maintaining it became - a nightmare, and adding new features was just horrible, leading to - many hacks without much sense in the overall structure. - - The rewrite has been waiting for a long time. Jonathan Jacobs provided - a first overhaul of the scripts, which I used in the first phase of - the rewrite. To make the system as maintainable as possible I made - some radical changes, but thanks go to Jonathan for providing me - with the patch to get started. - - This document describes the usage of the new SCons scripts. The - inner workings are described in blender-scons-dev.txt. - - Building Blender - ---------------- - - To build Blender with the SCons scripts you need a full Python - install, version 2.4 or later (http://www.python.org). We already provide - a scons-local installation, which can be found in the scons/ subdirectory. - This document uses the scons-local installation for its examples. - - Check from the page - http://www.blender.org/development/building-blender/getting-dependencies/ - that you have all dependencies needed for building Blender. Note that for - windows many of these dependencies already come in the lib/windows module - from CVS. - - In the base directory of the sources (from now on called $BLENDERHOME) - you'll see a file named SConstruct. This is the entry point for the - SCons build system. In a terminal, change to this directory. To just - build, start the SCons entry script on Windows (will be used for the remainder - of this document): - - % python scons\scons.py - - On a Unix-compatible system it would be - - % python ./scons/scons.py - - This will start the build process with default values. Depending - on your platform you may see colour in your output (non-Windows - machines). In the the beginning an overview of targets and arguments - from the command-line is given, then all libraries and binaries to - build are configured. - - The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to - finally copy all needed files to get a proper setup. The BF_DOCDIR is - used to generate Blender Python documentation files to. These - variables have default values for every platform in - $BLENDERHOME/config/(platform)-config.py. After the build successfully - completes, you can find everything you need in BF_INSTALLDIR. - - If you want to create the installer package of Blender on Windows you'll - need to install nullsoft scriptable install system from http://nsis.sf.net. - As an extra dependency, you need the MoreInfo plugin too. The creation of - the installer is tied into the build process and can be triggered with: - - % python scons\scons.py nsis - - - Configuring the build - --------------------- - - The default values for your platform can be found in the directory - $BLENDERHOME/config. Your platform specific defaults are in - (platform)-config.py, where platform is one of: - - - linux2, for machines running Linux - - win32-vc, for Windows machines, compiling with a Microsoft compiler - - win32-mingw, for Windows machines, compiling with the MingW compiler - - darwin, for OS X machines - (TBD: add cygwin, solaris and freebsd support) - - These files you will normally not change. If you need to override - a default value, make a file called $BLENDERHOME/user-config.py, and copy - settings from the config/(platform)-config.py that you want to change. Don't - copy the entire file (unless explicitely stated in the configuration file), - because you may not get updated options you don't change yourself, which may - result in build errors. - - You can use BF_CONFIG argument to override the default user-config.py - check. This is just like the user-config.py, but just with another name: - - % python scons\scons.py BF_CONFIG=myownsettings - - If you want to quickly test a new setting, you can give the option - also on the command-line: - - % python scons\scons.py BF_BUILDDIR=../mybuilddir WITH_BF_OPENEXR=0 - - This command sets the build directory to BF_BUILDDIR and disables - OpenEXR support. - - If you need to know what can be set through the command-line, run - scons with -h: - - % python scons\scons.py -h - - This command will print a long list with settable options and what - every option means. Many of the default values will be empty, and - from a fresh checkout without a user-config.py the actual values - are the defaults as per $BLENDERHOME/config/(platform)-config.py - (unless you have overridden any of them in your - $BLENDERHOME/user-config.py). - - NOTE: The best way to avoid confusion is the - copy $BLENDERHOME/config/(platform)-config.py to - $BLENDERHOME/user-config.py. You should NEVER have to modify - $BLENDERHOME/config/(platform)-config.py - - Configuring the output - ---------------------- - - This rewrite features a cleaner output during the build process. If - you need to see the full command-line for compiles, then you can - change that behaviour. Also the use of colours can be changed: - - % python scons\scons.py BF_FANCY=0 - - This will disable the use of colours. - - % python scons\scons.py BF_QUIET=0 - - This will give the old, noisy output. Every command-line per - compile is printed out in its full glory. This is very useful when - debugging problems with compiling, because you can see what the - included paths are, what defines are given on the command-line, - what compiler switches are used, etc. - - Compiling Only Some Libraries - ----------------------------- - - Our implementation now has support for specifying a list of libraries that are - exclusively compiled, ignoring all other libraries. This is invoked - with the BF_QUICK arguments; for example: - - % python scons\scons.py BF_QUICK=src,bf_blenkernel - - Note that this not the same as passing a list of folders as in the - makefile's "quicky" command. In Scons, all of Blender's code modules - are in their own static library; this corresponds to one-lib-per-folder - in some cases (especially in blender/source/blender). - - To obtain a list of the libraries, simple fire up scons and CTRL-C out once - it finishes configuring (and printing to the console) the library list. - - Compiling Libraries With Debug Profiling - ---------------------------------------- - - Scons has support for specifying a list of libraries that are compiled - with debug profiling enabled. This is implemented in two commands: - BF_QUICKDEBUG which is a command-line argument and BF_DEBUG_LIBS, which goes - in your user-config.py - - BF_QUICKDEBUG is similar to BF_QUICK: - - % python scons\scons.py BF_QUICKDEBUG=src,bf_blenkernel,some-other-lib - - To use BF_DEBUG_LIBS, put something like the following in you user-config.py: - - BF_DEBUG_LIBS = ['bf_blenlib', 'src', 'some_lib'] - - For instructions on how to find the names of the libraries (folders) you - wish to use, see the above section. Note that the command BF_DEBUG - (see below) will override these settings and compile ALL of Blender with - debug symbols. Also note that BF_QUICKDEBUG and BF_DEBUG_LIBS are combined; - for example, setting BF_QUICKDEBUG won't overwrite the contents of BF_DEBUG_LIBS. - - Supported toolset - ----------------- - - WINDOWS - - * msvc, this is a full install of Microsoft Visual C++. You'll - likely have the .NET Framework SDK, Platform SDK and DX9 SDK - installed * mstoolkit, this is the free MS VC++ 2003 Toolkit. You - need to verify you have also the SDKs installed as mentioned - for msvc. * mingw, this is a minimal MingW install. TBD: write - proper instructions on getting needed packages. - - On Windows with all of the three toolset installed you need to - specify what toolset to use - - % python scons\scons.py BF_TOOLSET=msvc - % python scons\scons.py BF_TOOLSET=mingw - - LINUX and OS X - - Currently only the default toolsets are supported for these platforms, - so nothing special needs to be told to SCons when building. The - defaults should work fine in most cases. - - Examples - -------- - - Build Blender with the defaults: - - % python scons\scons.py - - Build Blender, but disable OpenEXR support: - - % python scons\scons.py WITH_BF_OPENEXR=0 - - Build Blender, enable debug symbols: - - % python scons\scons.py BF_DEBUG=1 - - Build Blender, install to different directory: - - % python scons\scons.py BF_INSTALLDIR=../myown/installdir - - Build Blender in ../myown/builddir and install to ../myown/installdir: - - % python scons\scons.py BF_BUILDDIR=../myown/builddir BF_INSTALLDIR=../myown/installdir - - Clean BF_BUILDDIR: - - % python scons\scons.py clean - - /Nathan Letwory (jesterKing) diff --git a/doc/blender.1 b/doc/blender.1 deleted file mode 100644 index dd5e60ff900..00000000000 --- a/doc/blender.1 +++ /dev/null @@ -1,340 +0,0 @@ -.TH "BLENDER" "1" "July 15, 2010" "Blender Blender 2\&.52 (sub 5) " - -.SH NAME -blender \- a 3D modelling and rendering package -.SH SYNOPSIS -.B blender [args ...] [file] [args ...] -.br -.SH DESCRIPTION -.PP -.B blender -is a 3D modelling and rendering package. It is the in-house software of a high quality animation studio, Blender has proven to be an extremely fast and versatile design instrument. The software has a personal touch, offering a unique approach to the world of Three Dimensions. - -Use Blender to create TV commercials, to make technical visualizations, business graphics, to do some morphing, or design user interfaces. You can easy build and manage complex environments. The renderer is versatile and extremely fast. All basic animation principles (curves & keys) are well implemented. - -http://www.blender.org -.SH OPTIONS - -Blender 2.52 (sub 5) Build -Usage: blender [args ...] [file] [args ...] -.br -.SS "Render Options:" - -.TP -.B \-b or \-\-background -.br -Load in background (often used for UI\-less rendering) -.br - -.TP -.B \-a or \-\-render\-anim -.br -Render frames from start to end (inclusive) -.br - -.TP -.B \-S or \-\-scene -.br -Set the active scene for rendering -.br - -.TP -.B \-f or \-\-render\-frame -.br -Render frame and save it. -.br -+ start frame relative, \- end frame relative. -.br - -.TP -.B \-s or \-\-frame\-start -.br -Set start to frame (use before the \-a argument) -.br - -.TP -.B \-e or \-\-frame\-end -.br -Set end to frame (use before the \-a argument) -.br - -.TP -.B \-j or \-\-frame\-jump -.br -Set number of frames to step forward after each rendered frame -.br - -.TP -.B \-o or \-\-render\-output -.br -Set the render path and file name. -.br -Use // at the start of the path to -.br - render relative to the blend file. -.br -The # characters are replaced by the frame number, and used to define zero padding. -.br - ani_##_test.png becomes ani_01_test.png -.br - test\-######.png becomes test\-000001.png -.br - When the filename does not contain #, The suffix #### is added to the filename -.br -The frame number will be added at the end of the filename. -.br - eg: blender \-b foobar.blend \-o //render_ \-F PNG \-x 1 \-a -.br - //render_ becomes //render_####, writing frames as //render_0001.png// -.br - -.TP -.B \-E or \-\-engine -.br -Specify the render engine -.br -use \-E help to list available engines -.br - -.IP - -.SS "Format Options:" - -.TP -.B \-F or \-\-render\-format -.br -Set the render format, Valid options are... -.br - TGA IRIS JPEG MOVIE IRIZ RAWTGA -.br - AVIRAW AVIJPEG PNG BMP FRAMESERVER -.br -(formats that can be compiled into blender, not available on all systems) -.br - HDR TIFF EXR MULTILAYER MPEG AVICODEC QUICKTIME CINEON DPX DDS -.br - -.TP -.B \-x or \-\-use\-extension -.br -Set option to add the file extension to the end of the file -.br - -.TP -.B \-t or \-\-threads -.br -Use amount of for rendering in background -.br -[1\-BLENDER_MAX_THREADS], 0 for systems processor count. -.br - -.IP - -.SS "Animation Playback Options:" - -.TP -.B \-a -.br -Playback , only operates this way when not running in background. -.br - \-p Open with lower left corner at , -.br - \-m Read from disk (Don't buffer) -.br - \-f Specify FPS to start with -.br - \-j Set frame step to -.br - -.IP - -.SS "Window Options:" - -.TP -.B \-w or \-\-window\-border -.br -Force opening with borders (default) -.br - -.TP -.B \-W or \-\-window\-borderless -.br -Force opening with without borders -.br - -.TP -.B \-p or \-\-window\-geometry -.br -Open with lower left corner at , and width and height as , -.br - -.IP - -.SS "Game Engine Specific Options:" - -.TP -.B \-g Game Engine specific options -.br -\-g fixedtime Run on 50 hertz without dropping frames -.br -\-g vertexarrays Use Vertex Arrays for rendering (usually faster) -.br -\-g nomipmap No Texture Mipmapping -.br -\-g linearmipmap Linear Texture Mipmapping instead of Nearest (default) -.br - -.IP - -.SS "Misc Options:" - -.TP -.B \-d or \-\-debug -.br -Turn debugging on -.br - -.IP -* Prints every operator call and their arguments -.br -* Disables mouse grab (to interact with a debugger in some cases) -.br -* Keeps python sys.stdin rather then setting it to None -.br - -.TP -.B \-\-debug\-fpe -.br -Enable floating point exceptions -.br - -.IP - -.TP -.B \-nojoystick -.br -Disable joystick support -.br - -.TP -.B \-noglsl -.br -Disable GLSL shading -.br - -.TP -.B \-noaudio -.br -Force sound system to None -.br - -.TP -.B \-setaudio -.br -Force sound system to a specific device -.br -NULL SDL OPENAL JACK -.br - -.IP - -.TP -.B \-h or \-\-help -.br -Print this help text and exit -.br - -.IP - -.TP -.B \-y or \-\-enable\-autoexec -.br -Enable automatic python script execution (default) -.br - -.TP -.B \-Y or \-\-disable\-autoexec -.br -Disable automatic python script execution (pydrivers, pyconstraints, pynodes) -.br - -.IP - -.TP -.B \-P or \-\-python -.br -Run the given Python script (filename or Blender Text) -.br - -.TP -.B \-\-python\-console -.br -Run blender with an interactive console -.br - -.TP -.B \-v or \-\-version -.br -Print Blender version and exit -.br - -.TP -.B \-\- -.br -Ends option processing, following arguments passed unchanged. Access via python's sys.argv -.br - -.SS "Other Options:" - -.TP -.B /? -.br -Print this help text and exit (windows only) -.br - -.TP -.B \-R -.br -Register .blend extension (windows only) -.br - -.SS "Argument Parsing:" - - arguments must be separated by white space. eg - "blender \-ba test.blend" - ...will ignore the 'a' - "blender \-b test.blend \-f8" - ...will ignore 8 because there is no space between the \-f and the frame value -.br -.SS "Argument Order:" - -Arguments are executed in the order they are given. eg - "blender \-\-background test.blend \-\-render\-frame 1 \-\-render\-output /tmp" - ...will not render to /tmp because '\-\-render\-frame 1' renders before the output path is set - "blender \-\-background \-\-render\-output /tmp test.blend \-\-render\-frame 1" - ...will not render to /tmp because loading the blend file overwrites the render output that was set - "blender \-\-background test.blend \-\-render\-output /tmp \-\-render\-frame 1" works as expected. -.br -.br -.SH "ENVIRONMENT VARIABLES" - \fIBLENDER_USER_CONFIG\fR Directory for user configuration files. - \fIBLENDER_SYSTEM_CONFIG\fR Directory for system wide configuration files. - \fIBLENDER_USER_SCRIPTS\fR Directory for user scripts. - \fIBLENDER_SYSTEM_SCRIPTS\fR Directory for system wide scripts. - \fIBLENDER_USER_DATAFILES\fR Directory for user data files (icons, translations, ..). - \fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files. - \fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries. - \fITMP\fR or \fITMPDIR\fR Store temporary files here. - \fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python. -.br -.br - -.br -.SH SEE ALSO -.B yafaray(1) - -.br -.SH AUTHORS -This manpage was written for a Debian GNU/Linux system by Daniel Mester - and updated by Cyril Brulebois - and Dan Eicher . diff --git a/doc/blender.1.py b/doc/blender.1.py deleted file mode 100644 index 086c99e70e5..00000000000 --- a/doc/blender.1.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/python - -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# - -import subprocess -import os - -import time -import datetime - - -def man_format(data): - data = data.replace("-", "\\-") - data = data.replace("\t", " ") - # data = data.replace("$", "\\fI") - - data_ls = [] - for w in data.split(): - if w.startswith("$"): - w = "\\fI" + w[1:] + "\\fR" - - data_ls.append(w) - - data = data[:len(data) - len(data.lstrip())] + " ".join(data_ls) - - return data - - -blender_bin = os.path.join(os.path.dirname(__file__), "../blender") - -blender_help = subprocess.Popen([blender_bin, "--help"], stdout=subprocess.PIPE).communicate()[0].decode() - -blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip() -blender_version = blender_version.split("Build")[0] - -date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y") - -filepath = os.path.splitext(__file__)[0] - -file = open(filepath, "w") - -fw = file.write - -fw('.TH "BLENDER" "1" "%s" "Blender %s"\n' % (date_string, blender_version.replace(".", "\\&."))) - -fw(''' -.SH NAME -blender \- a 3D modelling and rendering package''') - -fw(''' -.SH SYNOPSIS -.B blender [args ...] [file] [args ...]''') - -fw(''' -.br -.SH DESCRIPTION -.PP -.B blender -is a 3D modelling and rendering package. It is the in-house software of a high quality animation studio, Blender has proven to be an extremely fast and versatile design instrument. The software has a personal touch, offering a unique approach to the world of Three Dimensions. - -Use Blender to create TV commercials, to make technical visualizations, business graphics, to do some morphing, or design user interfaces. You can easy build and manage complex environments. The renderer is versatile and extremely fast. All basic animation principles (curves & keys) are well implemented. - -http://www.blender.org''') - -fw(''' -.SH OPTIONS''') - -fw("\n\n") - -lines = [line.rstrip() for line in blender_help.split("\n")] - -while lines: - l = lines.pop(0) - if l.startswith("Environment Variables:"): - fw('.SH "ENVIRONMENT VARIABLES"\n') - elif l.endswith(":"): # one line - fw('.SS "%s"\n\n' % l) - elif l.startswith("-") or l.startswith("/"): # can be multi line - - fw('.TP\n') - fw('.B %s\n' % man_format(l)) - - while lines: - # line with no - if lines[0].strip() and len(lines[0].lstrip()) == len(lines[0]): # no white space - break - - if not l: # second blank line - fw('.IP\n') - else: - fw('.br\n') - - l = lines.pop(0) - l = l[1:] # remove first whitespace (tab) - - fw('%s\n' % man_format(l)) - - else: - if not l.strip(): - fw('.br\n') - else: - fw('%s\n' % man_format(l)) - -# footer - -fw(''' -.br -.SH SEE ALSO -.B yafaray(1) - -.br -.SH AUTHORS -This manpage was written for a Debian GNU/Linux system by Daniel Mester - and updated by Cyril Brulebois - and Dan Eicher . -''') - -print("written:", filepath) diff --git a/doc/build_systems/README.windows-gcc b/doc/build_systems/README.windows-gcc new file mode 100644 index 00000000000..78018eabbc0 --- /dev/null +++ b/doc/build_systems/README.windows-gcc @@ -0,0 +1,123 @@ +An updated version of this guide can be found at: + +http://www.blender3d.org/cms/Building_with_Cygwin.524.0.html + +Introduction +------------ + +Here are some basic instructions for building +blender for windows using gcc under cygwin. +Please note that the resulting executable does not +depend on cygwin and can be distrubuted to machines +that don't have cygwin installed. + +The instructions are: + +1. Download cygwin (www.cygwin.com) and use the setup program + to install packages for gcc, gcc-mingw, gcc-g++, w32api, make, cvs, + python, perl, gettext, and gettext-devel (and maybe others... the + dependency list is bound to change over time and hopefully these + instructions will keep up with the changes). All of the following + commands will be entered at the cygwin prompt so launch + cygwin now. + +2. Create a directory to put your sources and then enter that + directory, e.g.: + mkdir bf-blender + cd bf-blender + + *********WARNING: if the directory path you are in contains a space in + it you will get errors in trying to compile the code. Change directorys + to a one that does not contain a space in the path before creating the + above directory ********* + + +Please note that a backslash at the end of a line in the following +means that the command spans two lines. If you wish to type the command as +one line, exclude the '\'. + +3. Checkout the blender module from the bf-blender tree using cvs + (use password anonymous): + cvs -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender login + cvs -z3 -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender \ + co blender + +4. Checkout the lib/windows module from bf-blender using cvs: + cvs -z3 -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender \ + co lib/windows + +5. Enter the newly created blender directory: + cd blender + +6. To prepare the build system to use only the free tools we must + set some environment variables. This is done by creating a + file called "user-def.mk" in the blender directory and + inserting the following line with notepad or your favorite + text editor: + export FREE_WINDOWS=true + + The quickest way to do this though is to issue the following + command: + echo 'export FREE_WINDOWS=true' > user-def.mk + +7. Time to build... issue the command: + make + +8. Wait for it to finish (there is this mysterious place called + 'outside' that I am told is nice to go to while waiting for a + compile to finish). + +9. After it finishes compiling, if you would like to run your freshly compiled + blender, type make release. Then change directorys to obj/233.a/ and move + the zip file to where you want to use it, unzip the file, enter the directory + and run your brand new blender. + + +Getting Help +------------ +If you have problems, come by #blendercompilers on irc.freenode.net +or post questions to the "Compiling, Libraries, Modules" forum +at www.blender.org. There is also the very useful bf-committers +mailing list, what you can subscribe to here: + +http://www.blender.org/mailman/listinfo/bf-committers +(as a bonus you can get info about the most recent features that +are coming down the pipe ...) + +This said, the most common fix to a problem will +probably involve installing an additional cygwin package, +so keep that cygwin setup program close by ... + +Some final notes +---------------- + +- The build will take a long time, even on a fast machine + (a clean build takes almost an hour on my Athlon 1800+ + based laptop). +- If the build is successful you will find it has created + the program obj/windows/bin/blender.exe +- The executable generated by gcc will generally be slower + that an msvc++ generated executable at rendering, but the + OpenGL speed should be about the same. +- Sound is disabled +- If you want to clean your sources issue a 'make clean' + in the top blender directory. +- If you want to update your sources when somebody has + added a new awesome feature, you will want to go to the + topmost blender directory and issue the following command: + cvs -z3 update -P -d + It would probably be best to clean your sources before + re-building (see previous note). +- This is a work in progress, so some things may not be working + right or it may not support all of the cutting edge features. +- Want to make a fancy zipped up blender package to give + to your buddies? Try "make release" ... read the output + to find out where the zip file was placed (note: you will + probably need the zip/unzip packages from cygwin to do + this). +- You can make a debug executable using 'make debug'. The + debug executable will be larger and slower that the + regular executable, but when used with the gnu debugger + (gdb) it can help debug a blender problem (for example, + it can locate the line of code that caused blender to + crash). diff --git a/doc/build_systems/cmake.txt b/doc/build_systems/cmake.txt new file mode 100644 index 00000000000..a49ff629b5b --- /dev/null +++ b/doc/build_systems/cmake.txt @@ -0,0 +1,156 @@ +$Id$ + + Blender CMake build system + ============================ + + Contents + --------------- + + 1. Introduction + 2. Obtaining CMake + 3. Obtaining Dependencies + 4. Deciding on a Build Environment + 5. Configuring the build for the first time + 6. Configuring the build after CVS updates + 7. Specify alternate Python library versions and locations + + + 1. Introduction + --------------- + + This document describes general usage of the new CMake scripts. The + inner workings will be described in blender-cmake-dev.txt (TODO). + + 2. Obtaining CMake + ------------------ + + CMake for can either be downloaded using your favorite package manager + or is also available from the CMake website at http://www.cmake.org + The website also contains some documentation on CMake usage but I found + the man page alone pretty helpful. + + 3. Obtaining Dependencies + ------------------------- + + Check from the page + http://www.blender.org/cms/Getting_Dependencies.135.0.html that you + have all dependencies needed for building Blender. Note that for + windows many of these dependencies already come in the lib/windows + module from CVS. + + 4. Deciding on a Build Environment + ---------------------------------- + + To build Blender with the CMake scripts you first need to decide which + build environment you feel comfortable with. This decision will also be + influenced by the platform you are developing on. The current implementation + have been successfully used to generate build files for the following + environments: + + 1. Microsoft Visual Studio 2005. There is a free version available + at http://msdn.microsoft.com/vstudio/express/visualc/. + + 2. Xcode on Mac OSX + + 3. Unix Makefiles (On Linux and Mac OSX): CMake actually creates make + files which generates nicely color coded output and a percentage + progress indicator. + + + 5. Configuring the build for the first time + ------------------------------------------- + + CMake allows one to generate the build project files and binary objects + outside the source tree which can be pretty handy in working and experimenting + with different Blender configurations (Audio/NoAudio, GameEngine/NoGameEngine etc.) + while maintaining a clean source tree. It also makes it possible to generate files + for different build systems on the same source tree. This also has benefits for + general CVS management for the developer as patches and submit logs are much cleaner. + + Create a directory outside the blender source tree where you would like to build + Blender (from now on called $BLENDERBUILD). On the commandline you can then run + the cmake command to generate your initial build files. First just run 'cmake' which + will inform you what the available generators are. Thn you can run + 'cmake -G generator $BLENDERSOURCE' to generate the build files. Here is an example + of all this for Xcode: + + % mkdir $BLENDERBUILD + % cd $BLENDERBUILD + % cmake + + ... + ... + --version [file] = Show program name/version banner and exit. + + Generators + + The following generators are available on this platform: + KDevelop3 = Generates KDevelop 3 project files. + Unix Makefiles = Generates standard UNIX makefiles. + Xcode = Generate XCode project files. + + + + % cmake -G Xcode $BLENDERSOURCE + ... + ... + -- Configuring blender + -- Configuring blenderplayer + -- Configuring done + -- Generating done + -- Build files have been written to: $BLENDERBUILD + + This will generate the build files with default values. Specific features can + be enabled or disabled by running the ccmake "GUI" from $BLENDERBUILD as follows: + + % ccmake $BLENDERSOURCE + + A number of options appear which can be changed depending on your needs and + available dependencies (e.g. setting WITH_OPENEXR to OFF will disable support + for OpenEXR). It will also allow you to override default and detected paths + (e.g. Python directories) and compile and link flags. When you are satisfied + used ccmake to re-configure the build files and exit. + + It is also possible to use the commandline of 'cmake' to override certain + of these settings. + + 6. Configuring the build after CVS updates + ------------------------------------------ + + The $BLENDERBUILD directory maintains a file called CMakeCache.txt which + remembers the initial run's settings for subsequent generation runs. After + every CVS update it may be a good idea to rerun the generation before building + Blender again. Just rerun the original 'cmake' run to do this, the settings + will be remembered. For the example above the following will do after every + 'cvs up': + + % cmake -G Xcode $BLENDERSOURCE + + 7. Specify alternate Python library versions and locations + ---------------------------------------------------------- + + The commandline can be used to override detected/default settings, e.g: + + On Unix: + cmake -D PYTHON_LIB=/usr/local/lib/python3.1/config/libpython3.1.so -D PYTHON_INC=/usr/local/include/python3.1 -G "Unix Makefiles" ../blender + On Macs: + cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -G Xcode ../blender + + Mote that this should only be needed once per build directory generation because it will keep the overrides in CMakeCache.txt for subsequent runs. + + + + To be continued... + + TODO's + ------ + + 1. Get CMake to create proper distribution directories for the various platforms + like scons does. + 2. Investigate the viability of using CPack to package installs automatically. + 3. Refine this document and write detailed developer's document. + 4. Make sure all options (ffmpeg, openexr, quicktime) has proper CMake support + on the various platforms. + + /Jacques Beaurain (jbinto) + diff --git a/doc/build_systems/scons-dev.txt b/doc/build_systems/scons-dev.txt new file mode 100644 index 00000000000..d13ea7c036f --- /dev/null +++ b/doc/build_systems/scons-dev.txt @@ -0,0 +1,194 @@ +$Id$ + + + Internals of Blenders SCons scripts + =================================== + + Scope + ------ + This document describes the architecture of the SCons scripts for + Blender. An overview of available functionality and how to modify, + extend and maintain the system. + + Audience + -------- + This document is for developers who need to modify the system, + ie. add or remove new libraries, add new arguments for SCons, etc. + + Files and their meaning + ----------------------- + + The main entry point for the build system is the SConstruct-file in + $BLENDERHOME. This file creates the first BlenderEnvironment to work + with, reads in options, and sets up some directory structures. Further + it defines some targets. + + Platform-specific configurations are in $BLENDERHOME/config. The + filenames have the form (platform)-config.py, where platform one of: + + * darwin + * linux2 + * win32-mingw + * win32-vc + + The user can override options by creating a file + $BLENDERHOME/user-config.py. It can have any option from + (platform)-config.py. Options in this file will override the platform + defaults. + + Much of the actual functionality can be found in the python scripts + in the directory $BLENDERHOME/tools, with Blender.py defining the + bulk of the functionality. btools.py has some helper functions, and + bcolors.py is for the terminal colours. mstoolkit.py and crossmingw.py + are modules which set up SCons for the MS VC++ 2003 toolkit and + the cross-compile toolset for compiling Windows binaries on Linux + respectively. Note: the cross-compile doesn't work yet for Blender, + but is added in preparation for having it work in the distant future. + + BlenderEnvironment + ------------------ + + The module Blender.py implements a BlenderEnvironment class, derived + from the SConsEnvironment of SCons. This is done to wrap some often + used functionality. The BlenderEnvironment offers two important + wrappers: BlenderProg() and BlenderLib(). The first one is used to + specify a binary to be built, the second one is used to specify what + static library is built from given sources. + + Build a static library called "somelib". The system handles library + pre- and suffixes automatically, you don't need to bother yourself + with these details: + + env = BlenderEnvironment(ENV = os.environ) # create an environment + env.BlenderLib(libname="somelib", sources=['list.c','with.c','sources.c'], + includes=['/list/with/include/paths', '.', '..'], + defines=['LIST_WITH', 'CPP_DEFINES', 'TO_USE'], + libtype=['blender', 'common'] # this is a list with libtypes. Normally you don't + # need to specify this, but if you encounter linking + # problems you may need this + priority=[10, 20] # Priorities, list as long as libtype, priority per type + compileflags=['/O2'] # List of compile flags needed for this particular library. + # used only in rare cases, like SOLID, qhull and Bullet + ) + + There should be no need to ever add an extra BlenderProg to the + existing ones in SConstruct, see that file for its use, and Blender.py + for its implementation. + + The new system works so that using these wrappers, has all libraries + (and programs) register with a central repository. This means that + adding a new library is as easy as just creating the new SConscript + and making sure that it gets called properly. Linking and such will + then be handled automatically. + + If you want that adding new source files for a certain library + is handled automatically, you can use the Glob() function from + the BlenderEnvironment to create lists of needed files. See + $BLENDERHOME/source/blender/src/SConscript for an example. Keep in + mind that this will add any new file that complies to the rule given + to the Glob() function. There are a few (external) libraries with + which this can't be used, because it'd take files that shouldn't be + compiled, and create subsequentially problems during the linking stage + (like SOLID, qhull, Bullet). + + Linking order and priorities + ---------------------------- + + As shown above, you can give a library a priority in a certain + group. If you need to make sure that a Blender library is linked + before or after another one, you can give it a priority. To debug + the priorities us BF_PRIORITYLIST=1 on the command-line while running + a build. + + % scons BF_PRIORITYLIST=1 + + This will give a list with values suggested by the system. Make + changes to all SConscripts in question to reflect or change the + values given by this command. ALWAYS check this after adding a new + internal, external library or core library, and make sure there are + sane values. You can use large and negative numbers to test with, + but after you've got a working linking order, do change the system + to reflect BF_PRIORITYLIST values. + + Also, if you find that a library needs to be given multiple times to + the linker, you can do that by giving a python list with the names + of the available library types. They are currently: + + B.possible_types = ['core', 'common', 'blender', 'intern', + 'international', 'game', 'game2', + 'player', 'player2', 'system'] + + More groups can be added, but that should be carefully considered, + as it may lead to large-scale changes. The current amount of libraries + should suffice. + + The central repository is utilised in the SConstruct in two + ways. Firstly, it is used to determine the order of all static + libraries to link into the main Blender executable. Secondly, it + is used to keep track of all built binaries and their location, + so that they can be properly copied to BF_INSTALLDIR. + + The libraries can be fetched in their priority order with + create_blender_liblist from Blender.py, see the SConstruct on how + it is used. + + The program repository is the global list program_list from + Blender.py. See SConstruct for its usage. + + + Adding a new option and libraries + --------------------------------- + + Lets say we want to add WITH_BF_NEWLIB, which will + enable or disable a new feature library with sources in + $BLENDERHOME/source/blender/newlib. This 'newlib' needs external + headers from a 3rd party library '3rdparty'. For this we want to + add a set of options BF_3RDPARTY, BF_3RDPARTY_INC, BF_3RDPARTY_LIB, + BF_3RDPARTY_LIBPATH: + + 1) Add all mentiond options to all (platform)-config.py + files. WITH_BF_NEWLIB is a boolean option ('true', 'false'), + the rest are strings with paths and library names. See the + OpenEXR options for example. + + 2) Add all options to the argument checking function + validate_arguments() in btools.py. See again OpenEXR options + for example. + + 3) Add all options to the option reading function read_opts() + in btools.py. See again OpenEXR options for example. All default + values can be empty, as the actual default values are in the + (platform)-config.py files. + + 4) Add BF_3RDPARTY_LIB to the function setup_syslibs() + and BF_3RDPARTY_LIBPATH to the function setup_staticlibs() + in Blender.py + + At this stage we have prepared all option setting and linking needs, + but we still need to add in the compiling of the 'newlib'. + + 5) Create a SConscript in $BLENDERHOME/source/blender/newlib. Look + at ie. $BLENDERHOME/source/blender/src/SConscript for + template. The new SConscript will register the new library + like so: + + env.BlenderLib(libname='newlib', sources=sourcefiles, includes=incs) # the rest of the arguments get defaults = empty lists and values + + 6) Edit $BLENDERHOME/source/blender/SConscript with the following + addition: + + if env['WITH_BF_NEWLIB'] == 1: + SConscript(['newlib/SConscript']) + + After this you can see if this works by trying to build: + + % scons WITH_BF_NEWLIB=1 # build with newlib + % scons WITH_BF_NEWLIB=0 # disable newlib + + This is all what should be needed. Changing the library name doesn't + need changes elsewhere in the system, as it is handled automatically + with the central library repository. + + Enjoy the new system! + + /Nathan Letwory (jesterKing) diff --git a/doc/build_systems/scons.txt b/doc/build_systems/scons.txt new file mode 100644 index 00000000000..b4d9a905885 --- /dev/null +++ b/doc/build_systems/scons.txt @@ -0,0 +1,231 @@ +$Id$ + + Blenders SCons build scripts + ============================ + + Introduction + ------------ + + Since the beginning of 2004 Blender has had the SCons system as a + build option. SCons is a Python-based, accurate build system. The + scripts that were implemented in the first iteration worked, but + the system grew quickly into such a state that maintaining it became + a nightmare, and adding new features was just horrible, leading to + many hacks without much sense in the overall structure. + + The rewrite has been waiting for a long time. Jonathan Jacobs provided + a first overhaul of the scripts, which I used in the first phase of + the rewrite. To make the system as maintainable as possible I made + some radical changes, but thanks go to Jonathan for providing me + with the patch to get started. + + This document describes the usage of the new SCons scripts. The + inner workings are described in scons-dev.txt. + + Building Blender + ---------------- + + To build Blender with the SCons scripts you need a full Python + install, version 2.4 or later (http://www.python.org). We already provide + a scons-local installation, which can be found in the scons/ subdirectory. + This document uses the scons-local installation for its examples. + + Check from the page + http://www.blender.org/development/building-blender/getting-dependencies/ + that you have all dependencies needed for building Blender. Note that for + windows many of these dependencies already come in the lib/windows module + from CVS. + + In the base directory of the sources (from now on called $BLENDERHOME) + you'll see a file named SConstruct. This is the entry point for the + SCons build system. In a terminal, change to this directory. To just + build, start the SCons entry script on Windows (will be used for the remainder + of this document): + + % python scons\scons.py + + On a Unix-compatible system it would be + + % python ./scons/scons.py + + This will start the build process with default values. Depending + on your platform you may see colour in your output (non-Windows + machines). In the the beginning an overview of targets and arguments + from the command-line is given, then all libraries and binaries to + build are configured. + + The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to + finally copy all needed files to get a proper setup. The BF_DOCDIR is + used to generate Blender Python documentation files to. These + variables have default values for every platform in + $BLENDERHOME/config/(platform)-config.py. After the build successfully + completes, you can find everything you need in BF_INSTALLDIR. + + If you want to create the installer package of Blender on Windows you'll + need to install nullsoft scriptable install system from http://nsis.sf.net. + As an extra dependency, you need the MoreInfo plugin too. The creation of + the installer is tied into the build process and can be triggered with: + + % python scons\scons.py nsis + + + Configuring the build + --------------------- + + The default values for your platform can be found in the directory + $BLENDERHOME/config. Your platform specific defaults are in + (platform)-config.py, where platform is one of: + + - linux2, for machines running Linux + - win32-vc, for Windows machines, compiling with a Microsoft compiler + - win32-mingw, for Windows machines, compiling with the MingW compiler + - darwin, for OS X machines + (TBD: add cygwin, solaris and freebsd support) + + These files you will normally not change. If you need to override + a default value, make a file called $BLENDERHOME/user-config.py, and copy + settings from the config/(platform)-config.py that you want to change. Don't + copy the entire file (unless explicitely stated in the configuration file), + because you may not get updated options you don't change yourself, which may + result in build errors. + + You can use BF_CONFIG argument to override the default user-config.py + check. This is just like the user-config.py, but just with another name: + + % python scons\scons.py BF_CONFIG=myownsettings + + If you want to quickly test a new setting, you can give the option + also on the command-line: + + % python scons\scons.py BF_BUILDDIR=../mybuilddir WITH_BF_OPENEXR=0 + + This command sets the build directory to BF_BUILDDIR and disables + OpenEXR support. + + If you need to know what can be set through the command-line, run + scons with -h: + + % python scons\scons.py -h + + This command will print a long list with settable options and what + every option means. Many of the default values will be empty, and + from a fresh checkout without a user-config.py the actual values + are the defaults as per $BLENDERHOME/config/(platform)-config.py + (unless you have overridden any of them in your + $BLENDERHOME/user-config.py). + + NOTE: The best way to avoid confusion is the + copy $BLENDERHOME/config/(platform)-config.py to + $BLENDERHOME/user-config.py. You should NEVER have to modify + $BLENDERHOME/config/(platform)-config.py + + Configuring the output + ---------------------- + + This rewrite features a cleaner output during the build process. If + you need to see the full command-line for compiles, then you can + change that behaviour. Also the use of colours can be changed: + + % python scons\scons.py BF_FANCY=0 + + This will disable the use of colours. + + % python scons\scons.py BF_QUIET=0 + + This will give the old, noisy output. Every command-line per + compile is printed out in its full glory. This is very useful when + debugging problems with compiling, because you can see what the + included paths are, what defines are given on the command-line, + what compiler switches are used, etc. + + Compiling Only Some Libraries + ----------------------------- + + Our implementation now has support for specifying a list of libraries that are + exclusively compiled, ignoring all other libraries. This is invoked + with the BF_QUICK arguments; for example: + + % python scons\scons.py BF_QUICK=src,bf_blenkernel + + Note that this not the same as passing a list of folders as in the + makefile's "quicky" command. In Scons, all of Blender's code modules + are in their own static library; this corresponds to one-lib-per-folder + in some cases (especially in blender/source/blender). + + To obtain a list of the libraries, simple fire up scons and CTRL-C out once + it finishes configuring (and printing to the console) the library list. + + Compiling Libraries With Debug Profiling + ---------------------------------------- + + Scons has support for specifying a list of libraries that are compiled + with debug profiling enabled. This is implemented in two commands: + BF_QUICKDEBUG which is a command-line argument and BF_DEBUG_LIBS, which goes + in your user-config.py + + BF_QUICKDEBUG is similar to BF_QUICK: + + % python scons\scons.py BF_QUICKDEBUG=src,bf_blenkernel,some-other-lib + + To use BF_DEBUG_LIBS, put something like the following in you user-config.py: + + BF_DEBUG_LIBS = ['bf_blenlib', 'src', 'some_lib'] + + For instructions on how to find the names of the libraries (folders) you + wish to use, see the above section. Note that the command BF_DEBUG + (see below) will override these settings and compile ALL of Blender with + debug symbols. Also note that BF_QUICKDEBUG and BF_DEBUG_LIBS are combined; + for example, setting BF_QUICKDEBUG won't overwrite the contents of BF_DEBUG_LIBS. + + Supported toolset + ----------------- + + WINDOWS + + * msvc, this is a full install of Microsoft Visual C++. You'll + likely have the .NET Framework SDK, Platform SDK and DX9 SDK + installed * mstoolkit, this is the free MS VC++ 2003 Toolkit. You + need to verify you have also the SDKs installed as mentioned + for msvc. * mingw, this is a minimal MingW install. TBD: write + proper instructions on getting needed packages. + + On Windows with all of the three toolset installed you need to + specify what toolset to use + + % python scons\scons.py BF_TOOLSET=msvc + % python scons\scons.py BF_TOOLSET=mingw + + LINUX and OS X + + Currently only the default toolsets are supported for these platforms, + so nothing special needs to be told to SCons when building. The + defaults should work fine in most cases. + + Examples + -------- + + Build Blender with the defaults: + + % python scons\scons.py + + Build Blender, but disable OpenEXR support: + + % python scons\scons.py WITH_BF_OPENEXR=0 + + Build Blender, enable debug symbols: + + % python scons\scons.py BF_DEBUG=1 + + Build Blender, install to different directory: + + % python scons\scons.py BF_INSTALLDIR=../myown/installdir + + Build Blender in ../myown/builddir and install to ../myown/installdir: + + % python scons\scons.py BF_BUILDDIR=../myown/builddir BF_INSTALLDIR=../myown/installdir + + Clean BF_BUILDDIR: + + % python scons\scons.py clean + + /Nathan Letwory (jesterKing) diff --git a/doc/guides/blender-guardedalloc.txt b/doc/guides/blender-guardedalloc.txt new file mode 100644 index 00000000000..44a9722a4e4 --- /dev/null +++ b/doc/guides/blender-guardedalloc.txt @@ -0,0 +1,57 @@ +MEMORY MANAGEMENT IN BLENDER (guardedalloc) +------------------------------------------- + +NOTE: This file does not cover memutil and smart pointers and rerefence counted + garbage collection, which are contained in the memutil module. + +Blender takes care of dynamic memory allocation using a set of own functions +which are recognizeable through their MEM_ prefix. All memory allocation and +deallocation in blender is done through these functions. + +The following functions are available through MEM_guardedalloc.h: + +For normal operation: +--------------------- + +void *MEM_[mc]allocN(unsigned int len, char * str); + +- nearest ANSI counterpart: malloc() +- str must be a static string describing the memory block (used for debugging +memory management problems) +- returns a memory block of length len +- MEM_callocN clears the memory block to 0 + +void *MEM_dupallocN(void *vmemh); + +- nearest ANSI counterpart: combination malloc() and memcpy() +- returns a pointer to a copy of the given memory area + +short MEM_freeN(void *vmemh); + +- nearest ANSI counterpart: free() +- frees the memory area given by the pointer +- returns 0 on success and !=0 on error + +int MEM_allocN_len(void *vmemh); + +- nearest ANSI counterpart: none known +- returns the length of the given memory area + +For debugging: +-------------- + +void MEM_set_error_stream(FILE*); + +- this sets the file the memory manager should use to output debugging messages +- if the parameter is NULL the messages are suppressed +- default is that messages are suppressed + +void MEM_printmemlist(void); + +- if err_stream is set by MEM_set_error_stream() this function dumps a list of all +currently allocated memory blocks with length and name to the stream + +int MEM_check_memory_integrity(void); + +- this function tests if the internal structures of the memory manager are intact +- returns 0 on success and !=0 on error diff --git a/doc/guides/interface_API.txt b/doc/guides/interface_API.txt new file mode 100644 index 00000000000..c98794444e6 --- /dev/null +++ b/doc/guides/interface_API.txt @@ -0,0 +1,515 @@ +--------------------------------------------------- +Blender interface.c API toolkit notes +(july 2003, Ton Roosendaal) +--------------------------------------------------- + +Contents + +1 General notes +1.1 C and H files + +2. Windows & Blocks +2.1 Memory allocation +2.2 And how it works internally + +3. API for uiBlock +3.1 uiBlock Controlling functions +3.2 Internal function to know + +4. API for uiButton +4.1 UiDefBut + 1. BUT + 2. TOG or TOGN or TOGR + TOG|BIT| + 3. TOG3|BIT| + 4. ROW + 5. SLI or NUMSLI or HSVSLI + 6. NUM + 7. TEX + 8. LABEL + 9 SEPR + 10. MENU + 11. COL +4.2 Icon buttons + 12. ICONROW + 13. ICONTEXTROW +4.3 pulldown menus / block buttons + 14. BLOCK +4.4 specials + 15. KEYEVT + 16. LINK and INLINK + 17. IDPOIN +4.5 uiButton control fuctions + + +----------------1. General notes + +- The API is built with Blender in mind, with some buttons acting on lists of Blender data. + It was not meant to be available as a separate SDK, nor to be used for other applications. + +- It works with only OpenGL calls, for the full 100%. This means that it has some quirks + built-in to work with all OS's and OpenGL versions. Especially frontbuffer drawing is + a continuous point of attention. Buttons can be drawn with any window matrix. However, + errors can still occor when buttons are created in windows with non-standard glViewports. + +- The code was written to replace the old 1.8 button system, but under high pressure. Quite + some button methods from the old system were copied for that reason. + +- I tried to design a unified GUI system, which equally works for pulldown menus, pop up menus, + and normal button layouts. Although it gives nice features and freedom in design, the code + looks quite hard to understand for that reason. Not all 'normal' pulldown menu features + could be hacked in easily, they just differ too much from other UI elements. Could be + looked at once... + +- During the past period of NaN (beginning of 2002) someone tried to make a more 'high' level + API for it, with less low level defines and structure info needed in calling code. I am not + really sure if this was done well... or even finished. In the bottom of interface.c you can + see the 'new' API which is now used in Blender code. It used to be so much more simple! + Nevertheless, I will use that convention in this doc. + +- Unfinished stuff: the code was scheduled to be expanded with 'floating blocks' which can + serve as permanent little button-fields in Blender windows. Think for example of having + an (optional) extra field in the 3d window displaying object loc/rot/size. + After that, the existing button windows can be reorganized in such blocks as well, allowing + a user to configure the genereal buttons layout (make vertical for example). + + +--------------1.1 C and H files + +blender/source/blender/src/interface.c /* almost all code */ +blender/source/blender/include/interface.h /* internals for previous code */ +blender/source/blender/include/BIF_interface.h /* externals for previous code */ + +(the previous 2 include files have not been separated fully yet) + +Color and icons stuff has been put in: (unfinished code, under development) +blender/source/blender/src/resources.c +blender/source/blender/include/BIF_resources.h + +Related code: +blender/source/blender/src/toolbox.c (extra GUI elements built on top of this API) + + +--------------2. Windows & Blocks + +All GUI elements are collected in uiBlocks, which in turn are linked together in a list that's +part of a Blender Area-window. + + uiBlock *block= uiNewBlock(&curarea->uiblocks, "stuff", UI_EMBOSSX, UI_HELV, curarea->win); + +The next code example makes a new block, and puts it in the list of blocks of the current active +Area: + + uiDoBlocks(&curarea->uiblocks, event); + +This code is usually available in each area-window event queue handler. You give uiDoBlocks +an event code, and the uiDoBlocks handles whatever is to be handled. Blocks can be +standard buttons or pull down menus. Can return immediately, or jump to an internal handling +loop. + +2.1 Memory allocation + +Important to know is that for this toolkit there's no difference in "creating blocks" or +"drawing blocks". In fact, for each window redraw all blocks are created again. Constructing +button interfaces in Blender always happens in the main drawing function itself. + +Memory allocation is handled as follows: +- if in this window a uiBlock with the same name existed, it is freed +- when you close a window (or blender) the uiBlocks get freed. +- when you duplicate (split) a window, the uiBlocks get copied + +2.2 And how it works internally + +With a call to uiDoblocks, all blocks in the current active window are evaluated. +It walks through the lists in a rather complex manner: + +- while(looping) + + /* the normal buttons handling */ + - for each block + - call uiDoBlock (handles buttons for single block) + - (end for) + + /* at this moment, a new block can be created, for a menu */ + /* so we create a 2nd loop for it */ + - while first block is a menu + - if block is a menu and not initialized: + - initalize 'saveunder' + - draw it + - get event from queue + - call uiDoBlock (handles buttons for single block) + /* here, a new block again can be created, for a sub menu */ + - if return "end" from uiDoBlock + restore 'saveunder's + free all menu blocks + exit from loop + - do tooltip if nothing has happened + - (end while) + + - if there was menu, it does this loop once more + (when you click outside a menu, at another button) + +- (end while) + +- do tooltip if nothing has happened + + + +-------------3. API for uiBlock + +Create a new buttons block, and link it to the window: + +uiBlock *uiNewBlock(ListBase *lb, char *name, short dt, short font, short win) + ListBase *lb pointer to list basis, where the block will be appended to (blenlib) + char *name unique name to identify the block. When the name exists in the list, + the old uiBlock gets freed. + short dt drawtype. See below + short font font id number + short win blender area-window id + +drawtype: + UI_EMBOSSX 0 /* Rounded embossed button (standard in Blender) */ + UI_EMBOSSW 1 /* Simpler embossed button */ + UI_EMBOSSN 2 /* Button with no border */ + UI_EMBOSSF 3 /* Square embossed button (file select) */ + UI_EMBOSSM 4 /* Colored, for pulldown menus */ + UI_EMBOSSP 5 /* Simple borderless coloured button (like blender sensors) */ + +font: + UI_HELV 0 /* normal font */ + UI_HELVB 1 /* bold font */ +With the new truetype option in Blender, this is used for all font families + +When a uiBlock is created, each uiButton that is defined gets the uiBlock properties. +Changing Block properties inbetween will affact uiButtons defined thereafter. + + + +----------3.1 uiBlock Controlling functions: + +void uiDrawBlock(block) + draws the block + +void uiBlockSetCol(uiBlock *block, int col) + +col: + BUTGREY, + BUTGREEN, + BUTBLUE, + BUTSALMON, + MIDGREY, + BUTPURPLE, + +void uiBlockSetEmboss(uiBlock *block, int emboss) + changes drawtype + +void uiBlockSetDirection(uiBlock *block, int direction) + for pop-up and pulldown menus: + +direction: + UI_TOP + UI_DOWN + UI_LEFT + UI_RIGHT + +void uiBlockSetXOfs(uiBlock *block, int xofs) + for menus, offset from parent + +void uiBlockSetButmFunc(uiBlock *block, void (*menufunc)(void *arg, int event), void *arg) + sets function to be handled when a menu-block is marked "OK" + +void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, UI_BLOCK_ROWS) + + Sets the buttons in this block to automatically align, and fit within boundaries. + Internally it allows multiple collums or rows as well. Only 'row order' has been implemented. + The uiDefBut definitions don't need coordinates as input here, but instead: + - first value (x1) to indicate row number + - width and height values (if filled in) will be used to define a relative width/height. + A call to uiDrawBlock will invoke the calculus to fit in all buttons. + + + +---------- 3.2 Internal function to know: + +These flags used to be accessible from outside of interface.c. Currently it is only +used elsewhere by toolbox.c, so it can be considered 'internal' somewhat. + +void uiBlockSetFlag(uiBlock *block, int flag) /* block types, can be 'OR'ed */ + UI_BLOCK_LOOP 1 a sublooping block, drawn in frontbuffer, i.e. menus + UI_BLOCK_REDRAW 2 block needs a redraw + UI_BLOCK_RET_1 4 block is closed when an event happens with value '1' (press key, not for mouse) + UI_BLOCK_BUSY 8 internal + UI_BLOCK_NUMSELECT 16 keys 1-2-...-9-0 can be used to select items + UI_BLOCK_ENTER_OK 32 enter key closes block with "OK" + +(these values are being set within the interface.c and toolbox.c code.) + + +-------------4. API for uiButton + +In Blender a button can do four things: + +- directly visualize data, and write to it. +- put event codes (shorts) back in the queue, to be handled +- call a user-defined function pointer (while being pressed, etc) +- create and call another block (i.e. menu) + +Internally, each button or menu item is a 'uiButton', with a generic API and handling: +ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); + +Beacause a lot of obscure generic (re-use) happens here, translation calls have been made +for each most button types individually. + + +-----------4.1 UiDefBut + +uiBut *UiDefBut[CSIF]( uiBlock *block, int type, int retval, char *str, + short x1, short y1, short x2, short y2, xxxx *poin, + float min, float max, float a1, float a2, char *tip) + +UiDefButC operatates on char +UiDefButS operatates on short +UiDefButI operatates on int +UiDefButF operatates on float + +*block: current uiBlock pointer +type: see below +retval: return value, which is put back in queue +*str: button name +x1, y1: coordinates of left-lower corner +x2, y2: width, height +*poin: pointer to char, short, int, float +min, max used for slider buttons +a1, a2 extra info for some buttons +*tip: tooltip string + +type: + +1. BUT + Activation button. (like "Render") + Passing on a pointer is not needed + +2. TOG or TOGN or TOGR + Toggle button (like "Lock") + The pointer value is set either at 0 or 1 + If pressed, it calls the optional function with arguments provided. + Type TOGN: works negative, when pressed it sets at 0 + Type TOGR: is part of a row, redraws automatically all buttons with same *poin + + "|BIT|" + When added to type, it works on a single bit (lowest order bit: nr = '0') + +3. TOG3|BIT| + A toggle with 3 values! + Can be only used for short *poin. + In the third toggle setting, the bit of *( poin+1) is set. + +4. ROW + Button that's part of a row. + in "min" you set a row-id number, in "max" the value you want *poin to be + assigned when you press the button. Always pass on these values as floats. + When this button is pressed, it sets the "max" value to *poin, and redraws + all buttons with the same row-id number. + +5. SLI or NUMSLI or HSVSLI + Slider, number-slider or hsv-slider button. + "min" and "max" are to clamp the value to. + If you want a button type "Col" to be updated, make 'a1' equal to 'retval' + from the COL button. + +6. NUM + Number button + Set the clamping values 'min' and 'max' always as float. + For UiDefButF, set a 'step' in 'a1', in 1/100's. The step value is the increment or + decrement when you click once on the right or left side of a button. + The optional button function is additionally called for each change of the *poin value. + +7. TEX + Text string button. + Pointertype is standard a char. Value 'max' is length of string (pass as float). + When button is left with ESC, it doesn't put the 'retval' at the queue. + +8. LABEL + Label button. + Only displays text. + If 'min' is set at 1.0, the text is printed in white. + +9 SEPR + A separator line, typically used within pulldown menus. + +10. MENU + Menu button. + The syntax of the string in *name defines the menu items: + - %t means the previous text becomes the title + - item separator is '|' + - return values are indicated with %x[nr] (i.e: %x12). + without returnvalues, the first item gets value 0 (incl. title!) + Example: "Do something %t| turn left %2| turn right %1| nothing %0" + +11. COL + A special button that only visualizes a RGB value + In 'retval' you can put a code, which is used to identify for sliders if it needs + redraws while using the sliders. Check button '5'. + As *poin you input the pointer to the 'r' value, 'g' and 'b' are supposed to be + next to that. + + +------------4.2 Icon buttons + +Instead of a 'name', all buttons as described for uiDefBut also can have an icon: + +uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, + short x1, short y1, short x2, short y2, void *poin, + float min, float max, float a1, float a2, char *tip) + + Same syntax and types available as previous uiDefBut, but now with an icon code + instead of a name. THe icons are numbered in resources.c + +uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, + short x1, short y1, short x2, short y2, float *poin, + float min, float max, float a1, float a2, char *tip) + + Same again, but now with an icon and string as button name. + +Two special icon buttons are available in Blender: + +12. ICONROW + (uiDefIconBut) + This button pops up a vertical menu with a row of icons to choose from. + 'max' = amount of icons. The icons are supposed to be ordered in a sequence + It writes in *poin which item in the menu was choosen (starting with 0). + +13. ICONTEXTROW + (uiDefIconTextBut) + Same as previous, but with the texts next to it. + + + +-----------4.3 pulldown menus / block buttons + +14. BLOCK +void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, + short x1, short y1, short x2, short y2, char *tip) + + This button creates a new block when pressed. The function argument 'func' is called + to take care of this. An example func: + + static uiBlock *info_file_importmenu(void *arg_unused) + { + uiBlock *block; + short yco= 0, xco = 20; + + block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSW, UI_HELV, G.curscreen->mainwin); + uiBlockSetXOfs(block, -40); // offset to parent button + + /* flags are defines */ + uiDefBut(block, LABEL, 0, "VRML 2.0 options", xco, yco, 125, 19, NULL, 0.0, 0.0, 0, 0, ""); + uiDefButS(block, TOG|BIT|0, 0, "SepLayers", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, ""); + uiDefButS(block, TOG|BIT|1, 0, "Scale 1/100", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, ""); + uiDefButS(block, TOG|BIT|2, 0, "Two Sided", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 50); // checks for fontsize + + return block; + } + + The uiDef coordinates here are only relative. When this function is called, the interface + code automatically makes sure the buttons fit in the menu nicely. + + Inside a menu uiBlock, other uiBlocks can be invoked to make a hierarchical menu. + + + +-----------4.4 specials + +15. KEYEVT + +void uiDefKeyevtButS(uiBlock *block, int retval, char *str, + short x1, short y1, short x2, short y2, short *spoin, char *tip) + + A special button, which stores a keyvalue in *spoin. When the button is pressed, + it displays the text 'Press any Key'. A keypress then stores the value. + +16. LINK and INLINK + + These button present a method of linking data in Blender, by drawing a line from one + icon to another. It consists of two button types: + + LINK, the 'linking from' part, can be: + - a single pointer to data (only one line allowed) + - an array of pointers to data. The LINK buttons system keeps track of allocating + space for the array, and set the correct pointers in it. + + INLINK, the 'linking to' part activates creating a link, when a user releases the mouse + cursor over it, while dragging a line from the LINK button. + + These buttons are defined as follows: + + +uiBut but= uiDefIconBut(block, LINK, 0, ICON_LINK, x1, y1, w, h, NULL, 0, 0, 0, 0, ""); + /* create the LINK icon */ + +uiSetButLink(but, void **pt, void ***ppt, short *totlink, short fromcode, short tocode); + **pt: pointer to pointer (only one link allowed) + ***ppt: pointer to pointerpointer (an array of pointers) + (Either one of these values should be NULL) + + fromcode: (currently unused) + tocode: a short indicating which blocks it can link to. + + +uiDefIconBut(block, INLINK, 0, ICON_INLINK, x1, y1, w, h, void *poin, short fromcode, 0, 0, 0, ""); + poin: the pointer of the datablock you want to create links to + fromcode: a short identifying which LINK buttons can connect to it + + + +17. IDPOIN +void uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, int retval, char *str, + short x1, short y1, short x2, short y2, void *idpp, char *tip) + + The ID struct is a generic part in structs like Object, Material, Mesh, etc. + Most linking options in Blender happens using ID's. (Mesh -> Material). + + This special button in Blender visualizes an ID pointer with its name. Typing in + a new name, changes the pointer. For most ID types in Blender functions have been + written already, needed by this button, to check validity of names, and assign the pointer. + + (BTW: the 'void *idpp' has to be a pointer to the ID pointer!) + + Example function that can be put in 'func': + + void test_scriptpoin_but(char *name, ID **idpp) + { + ID *id; + + id= G.main->text.first; + while(id) { + if( strcmp(name, id->name+2)==0 ) { + *idpp= id; + return; + } + id= id->next; + } + *idpp= 0; + } + + +------------- 4.5 uiButton control fuctions + + +void uiButSetFunc(uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2) + When the button is pressed and released, it calls this function, with the 2 arguments. + +void uiButSetFlag(uiBut *but, int flag) + set a flag for further control of button behaviour: + flag: + UI_TEXT_LEFT + +int uiButGetRetVal(uiBut *but) + gives return value + + + +


diff --git a/doc/guides/python-dev-guide.txt b/doc/guides/python-dev-guide.txt new file mode 100644 index 00000000000..75c9ccb57e5 --- /dev/null +++ b/doc/guides/python-dev-guide.txt @@ -0,0 +1,170 @@ +Simple Blender Python Developer's Guide +--------------------------------------- + +This is an outline for a future guide yet to be written. It is meant for +programmers wanting to understand and maybe help with the embedding of Python +inside Blender. + +I - Introduction + +We could praise Python here for its many qualities, but it's probably better +to just give some links: + +The main site is at www.python.org , with documentation at www.python.org/doc/ + +Also worth of mention: it's an interpreted language and is available for +many different systems. The download includes the interpreter, many modules +(think libs), good documentation and some programs / examples. If you use +linux, there's a high chance you already have Python installed, just try +"man python". + +The reason for embedding a language environment inside Blender is to give +users the ability to access the program's internal data and functionality. +This can be used to import / export (from / to other 2d / 3d formats) or +change the data (to create new objects procedurally, among many other +interesting possibilities). Script writers (Blender Python programmers) can +also expand Blender in new ways, adding new features on-the-fly, without having +to recompile it. It is usually much easier and faster to write scripts in +Python than to code the equivalent in C. + +II - Reference material: + +There are two important texts for us in the documentation that comes +with Python ( docs also available online at www.python.org ): + +- Extending and Embedding (tutorial for C/C++ programmers) + +and specially + +- Python/C API. + +You can read the first one to get a feel for how things are done +(reference counting is probably the most important part), but the second +doc is a must. Specially useful as a fast reference is its Index, at letter +P, where all commands are. + +Specially useful commands are Py_BuildValue and the family of parsing +functions, PyArg_Parse* (PyArg_Parse(), PyArg_ParseTuple(), +PyArg_ParseTupleAndKeywords()). Py_BuildValue is usually the best way to make +Python Objects (the 'variables' that the Python Interpreter understands) +out of C ones. The PyArg_Parse* functions do the opposite, they parse +Python Objects to C variables. + +So, understand PyArg_Parse* functions, Py_BuildValue and reference +counting. The first doc has a good discussion about them. + +- C knowledge is also necessary, of course, use your favorite resource. + +- The Blender 2.25 API documentation ( www.blender.org ) is, along with +the source, our basic API ref. + +III - Directories + +The previous Blender Python API's are spread in blender/intern/python +and the C part of the current one, bpython, is at +blender/source/blender/bpython/, specially in intern/. The current +solution is a Python wrapper on top of this bpython one, at +blender/intern/python/modules/Blender/ + +Note: since it's in Python, they needed the freeze Python utility, a +process/program that creates stand-alone executables out of Python +source files -- that is, it packs together an interpreter, the needed +modules and the source of a Python program so that users of this program +don't need to have the Python interpreter already installed in their +machines to run the program -- Blender, in this case. + +The new implementation is pure C, so we won't need to "freeze" it. + +Another important dir for starters is blender/source/blender/makesdna, +where the headers with Blender structs lie. + +IV - Experimental Python + +The new implementation, currently referred to as experimental python - +exppython - was started by Michel Selten. He chose to solve the mess in +Blender Python by starting over from scratch, in C, but keeping API +compatibility with the current 2.25 API used by Blender. + +It is in blender/source/blender/python , more specifically inside +api2_2x/ + +To make it clear, exppython is the new implementation being worked on. It +will possibly become the de-facto implementation in Blender 2.28, the next +Blender version. Currently, Blender still comes with the same implementation +found in the 2.25 version of the program. So we call that the 2.25 +implementation, or bpython. + +BPython had plenty of "macro magic", lot's of complicate #define's, etc., +since a lot of the embedding work is quite repetitive. But that makes it +much harder for newbies to jump in and learn, so the new files in exppython +avoid that. + +This means: Blender, Object, Camera, Lamp, Image, Text, Window modules +(the files have the same names, ending obviously with .c and .h) + +To speed things up, some independent parts of bpython are being +integrated directly into exppython. That already happened with Draw and +BGL, both taken from opy_draw.c in the bpython/intern dir. The same is +happening with NMesh (Mesh is written in Python and imports NMesh to +extend / change its functionality). + +For a good example of dexterity with macros (cheers to the NaN +programmer(s)!), look at BGL.[ch], the OpenGL API wrapper. The defines +are in the header. + +Besides keeping compatibility with the 2.25 API, there are already some +additions to exppython: + +- some modules have access to more variables than 2.25 had; +- there are more method functions and the access is safer; +- the file selector (or file browser, if you prefer) is back: + It's now in the Window module, along with an image selector, too. +- there are totally new modules, unavailable in 2.25: + Fellow new developers joining our team are contributing new modules + that have been requested by the community for a long time. + + +V - Coding + +The Camera module is a good reference, since it is like most others, in +terms of programming, but is smaller and simple. It's in Camera.c and +Camera.h . To have it working, it was also necessary to include a line to +the end of Blender.c (registering it as a Blender submodule) and another to +modules.h (declaring its init and CreateObject method) + +Currently, one of our conventions is to prepend M_ to module functions, +doc strings, etc. and C_ to the new types we had to create for Python, +like C_Camera, C_Lamp, etc. + +If you look at Camera.[ch], you'll find code for creating the Camera +module and the Camera "type", with all its methods and access policies. +It's really a new type defined in Python, like PyInt or PyFloat, +PyString, etc. In practice, it's a "thin" (because it doesn't make +copies of the variables) wrapper for the Blender Camera Data Object. + +A note about Blender: objects in Blender share a common base, the +Object, whose attributes are things like the matrix, the location, the +rotation, the size, etc. A Camera is actually an Object of type Camera +(which means that its "data" field points to a Camera Data obj) and a +Camera Data object, which is the specific camera part of the object +(attributes like lens, clip start, etc.). Same for other objects, like +Lamp, Mesh, etc. + +That's why C_Camera is a wrapper for the Blender Camera **Data** +object. The full wrapper is Object("Camera") linked with +Camera("camera_name"). + +How to write a new module for a simple object? Use Camera.[ch] as +templates, check the specifics of your object in the makesdna dir +(for example, the camera one is DNA_camera_types.h) and make the +necessary changes. + +If you want to help exppython and in the process possibly learn more about +embedding, the Python/C API and Blender internals, there's this mailing list: + +Bf-python mailing list +Bf-python@blender.org +http://www.blender.org/mailman/listinfo/bf-python + +There you can ask what hasn't been done yet, get help, make suggestions for +new features we should consider, send bug reports, etc. diff --git a/doc/interface_API.txt b/doc/interface_API.txt deleted file mode 100644 index c98794444e6..00000000000 --- a/doc/interface_API.txt +++ /dev/null @@ -1,515 +0,0 @@ ---------------------------------------------------- -Blender interface.c API toolkit notes -(july 2003, Ton Roosendaal) ---------------------------------------------------- - -Contents - -1 General notes -1.1 C and H files - -2. Windows & Blocks -2.1 Memory allocation -2.2 And how it works internally - -3. API for uiBlock -3.1 uiBlock Controlling functions -3.2 Internal function to know - -4. API for uiButton -4.1 UiDefBut - 1. BUT - 2. TOG or TOGN or TOGR - TOG|BIT| - 3. TOG3|BIT| - 4. ROW - 5. SLI or NUMSLI or HSVSLI - 6. NUM - 7. TEX - 8. LABEL - 9 SEPR - 10. MENU - 11. COL -4.2 Icon buttons - 12. ICONROW - 13. ICONTEXTROW -4.3 pulldown menus / block buttons - 14. BLOCK -4.4 specials - 15. KEYEVT - 16. LINK and INLINK - 17. IDPOIN -4.5 uiButton control fuctions - - -----------------1. General notes - -- The API is built with Blender in mind, with some buttons acting on lists of Blender data. - It was not meant to be available as a separate SDK, nor to be used for other applications. - -- It works with only OpenGL calls, for the full 100%. This means that it has some quirks - built-in to work with all OS's and OpenGL versions. Especially frontbuffer drawing is - a continuous point of attention. Buttons can be drawn with any window matrix. However, - errors can still occor when buttons are created in windows with non-standard glViewports. - -- The code was written to replace the old 1.8 button system, but under high pressure. Quite - some button methods from the old system were copied for that reason. - -- I tried to design a unified GUI system, which equally works for pulldown menus, pop up menus, - and normal button layouts. Although it gives nice features and freedom in design, the code - looks quite hard to understand for that reason. Not all 'normal' pulldown menu features - could be hacked in easily, they just differ too much from other UI elements. Could be - looked at once... - -- During the past period of NaN (beginning of 2002) someone tried to make a more 'high' level - API for it, with less low level defines and structure info needed in calling code. I am not - really sure if this was done well... or even finished. In the bottom of interface.c you can - see the 'new' API which is now used in Blender code. It used to be so much more simple! - Nevertheless, I will use that convention in this doc. - -- Unfinished stuff: the code was scheduled to be expanded with 'floating blocks' which can - serve as permanent little button-fields in Blender windows. Think for example of having - an (optional) extra field in the 3d window displaying object loc/rot/size. - After that, the existing button windows can be reorganized in such blocks as well, allowing - a user to configure the genereal buttons layout (make vertical for example). - - ---------------1.1 C and H files - -blender/source/blender/src/interface.c /* almost all code */ -blender/source/blender/include/interface.h /* internals for previous code */ -blender/source/blender/include/BIF_interface.h /* externals for previous code */ - -(the previous 2 include files have not been separated fully yet) - -Color and icons stuff has been put in: (unfinished code, under development) -blender/source/blender/src/resources.c -blender/source/blender/include/BIF_resources.h - -Related code: -blender/source/blender/src/toolbox.c (extra GUI elements built on top of this API) - - ---------------2. Windows & Blocks - -All GUI elements are collected in uiBlocks, which in turn are linked together in a list that's -part of a Blender Area-window. - - uiBlock *block= uiNewBlock(&curarea->uiblocks, "stuff", UI_EMBOSSX, UI_HELV, curarea->win); - -The next code example makes a new block, and puts it in the list of blocks of the current active -Area: - - uiDoBlocks(&curarea->uiblocks, event); - -This code is usually available in each area-window event queue handler. You give uiDoBlocks -an event code, and the uiDoBlocks handles whatever is to be handled. Blocks can be -standard buttons or pull down menus. Can return immediately, or jump to an internal handling -loop. - -2.1 Memory allocation - -Important to know is that for this toolkit there's no difference in "creating blocks" or -"drawing blocks". In fact, for each window redraw all blocks are created again. Constructing -button interfaces in Blender always happens in the main drawing function itself. - -Memory allocation is handled as follows: -- if in this window a uiBlock with the same name existed, it is freed -- when you close a window (or blender) the uiBlocks get freed. -- when you duplicate (split) a window, the uiBlocks get copied - -2.2 And how it works internally - -With a call to uiDoblocks, all blocks in the current active window are evaluated. -It walks through the lists in a rather complex manner: - -- while(looping) - - /* the normal buttons handling */ - - for each block - - call uiDoBlock (handles buttons for single block) - - (end for) - - /* at this moment, a new block can be created, for a menu */ - /* so we create a 2nd loop for it */ - - while first block is a menu - - if block is a menu and not initialized: - - initalize 'saveunder' - - draw it - - get event from queue - - call uiDoBlock (handles buttons for single block) - /* here, a new block again can be created, for a sub menu */ - - if return "end" from uiDoBlock - restore 'saveunder's - free all menu blocks - exit from loop - - do tooltip if nothing has happened - - (end while) - - - if there was menu, it does this loop once more - (when you click outside a menu, at another button) - -- (end while) - -- do tooltip if nothing has happened - - - --------------3. API for uiBlock - -Create a new buttons block, and link it to the window: - -uiBlock *uiNewBlock(ListBase *lb, char *name, short dt, short font, short win) - ListBase *lb pointer to list basis, where the block will be appended to (blenlib) - char *name unique name to identify the block. When the name exists in the list, - the old uiBlock gets freed. - short dt drawtype. See below - short font font id number - short win blender area-window id - -drawtype: - UI_EMBOSSX 0 /* Rounded embossed button (standard in Blender) */ - UI_EMBOSSW 1 /* Simpler embossed button */ - UI_EMBOSSN 2 /* Button with no border */ - UI_EMBOSSF 3 /* Square embossed button (file select) */ - UI_EMBOSSM 4 /* Colored, for pulldown menus */ - UI_EMBOSSP 5 /* Simple borderless coloured button (like blender sensors) */ - -font: - UI_HELV 0 /* normal font */ - UI_HELVB 1 /* bold font */ -With the new truetype option in Blender, this is used for all font families - -When a uiBlock is created, each uiButton that is defined gets the uiBlock properties. -Changing Block properties inbetween will affact uiButtons defined thereafter. - - - -----------3.1 uiBlock Controlling functions: - -void uiDrawBlock(block) - draws the block - -void uiBlockSetCol(uiBlock *block, int col) - -col: - BUTGREY, - BUTGREEN, - BUTBLUE, - BUTSALMON, - MIDGREY, - BUTPURPLE, - -void uiBlockSetEmboss(uiBlock *block, int emboss) - changes drawtype - -void uiBlockSetDirection(uiBlock *block, int direction) - for pop-up and pulldown menus: - -direction: - UI_TOP - UI_DOWN - UI_LEFT - UI_RIGHT - -void uiBlockSetXOfs(uiBlock *block, int xofs) - for menus, offset from parent - -void uiBlockSetButmFunc(uiBlock *block, void (*menufunc)(void *arg, int event), void *arg) - sets function to be handled when a menu-block is marked "OK" - -void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, UI_BLOCK_ROWS) - - Sets the buttons in this block to automatically align, and fit within boundaries. - Internally it allows multiple collums or rows as well. Only 'row order' has been implemented. - The uiDefBut definitions don't need coordinates as input here, but instead: - - first value (x1) to indicate row number - - width and height values (if filled in) will be used to define a relative width/height. - A call to uiDrawBlock will invoke the calculus to fit in all buttons. - - - ----------- 3.2 Internal function to know: - -These flags used to be accessible from outside of interface.c. Currently it is only -used elsewhere by toolbox.c, so it can be considered 'internal' somewhat. - -void uiBlockSetFlag(uiBlock *block, int flag) /* block types, can be 'OR'ed */ - UI_BLOCK_LOOP 1 a sublooping block, drawn in frontbuffer, i.e. menus - UI_BLOCK_REDRAW 2 block needs a redraw - UI_BLOCK_RET_1 4 block is closed when an event happens with value '1' (press key, not for mouse) - UI_BLOCK_BUSY 8 internal - UI_BLOCK_NUMSELECT 16 keys 1-2-...-9-0 can be used to select items - UI_BLOCK_ENTER_OK 32 enter key closes block with "OK" - -(these values are being set within the interface.c and toolbox.c code.) - - --------------4. API for uiButton - -In Blender a button can do four things: - -- directly visualize data, and write to it. -- put event codes (shorts) back in the queue, to be handled -- call a user-defined function pointer (while being pressed, etc) -- create and call another block (i.e. menu) - -Internally, each button or menu item is a 'uiButton', with a generic API and handling: -ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); - -Beacause a lot of obscure generic (re-use) happens here, translation calls have been made -for each most button types individually. - - ------------4.1 UiDefBut - -uiBut *UiDefBut[CSIF]( uiBlock *block, int type, int retval, char *str, - short x1, short y1, short x2, short y2, xxxx *poin, - float min, float max, float a1, float a2, char *tip) - -UiDefButC operatates on char -UiDefButS operatates on short -UiDefButI operatates on int -UiDefButF operatates on float - -*block: current uiBlock pointer -type: see below -retval: return value, which is put back in queue -*str: button name -x1, y1: coordinates of left-lower corner -x2, y2: width, height -*poin: pointer to char, short, int, float -min, max used for slider buttons -a1, a2 extra info for some buttons -*tip: tooltip string - -type: - -1. BUT - Activation button. (like "Render") - Passing on a pointer is not needed - -2. TOG or TOGN or TOGR - Toggle button (like "Lock") - The pointer value is set either at 0 or 1 - If pressed, it calls the optional function with arguments provided. - Type TOGN: works negative, when pressed it sets at 0 - Type TOGR: is part of a row, redraws automatically all buttons with same *poin - - "|BIT|" - When added to type, it works on a single bit (lowest order bit: nr = '0') - -3. TOG3|BIT| - A toggle with 3 values! - Can be only used for short *poin. - In the third toggle setting, the bit of *( poin+1) is set. - -4. ROW - Button that's part of a row. - in "min" you set a row-id number, in "max" the value you want *poin to be - assigned when you press the button. Always pass on these values as floats. - When this button is pressed, it sets the "max" value to *poin, and redraws - all buttons with the same row-id number. - -5. SLI or NUMSLI or HSVSLI - Slider, number-slider or hsv-slider button. - "min" and "max" are to clamp the value to. - If you want a button type "Col" to be updated, make 'a1' equal to 'retval' - from the COL button. - -6. NUM - Number button - Set the clamping values 'min' and 'max' always as float. - For UiDefButF, set a 'step' in 'a1', in 1/100's. The step value is the increment or - decrement when you click once on the right or left side of a button. - The optional button function is additionally called for each change of the *poin value. - -7. TEX - Text string button. - Pointertype is standard a char. Value 'max' is length of string (pass as float). - When button is left with ESC, it doesn't put the 'retval' at the queue. - -8. LABEL - Label button. - Only displays text. - If 'min' is set at 1.0, the text is printed in white. - -9 SEPR - A separator line, typically used within pulldown menus. - -10. MENU - Menu button. - The syntax of the string in *name defines the menu items: - - %t means the previous text becomes the title - - item separator is '|' - - return values are indicated with %x[nr] (i.e: %x12). - without returnvalues, the first item gets value 0 (incl. title!) - Example: "Do something %t| turn left %2| turn right %1| nothing %0" - -11. COL - A special button that only visualizes a RGB value - In 'retval' you can put a code, which is used to identify for sliders if it needs - redraws while using the sliders. Check button '5'. - As *poin you input the pointer to the 'r' value, 'g' and 'b' are supposed to be - next to that. - - -------------4.2 Icon buttons - -Instead of a 'name', all buttons as described for uiDefBut also can have an icon: - -uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, - short x1, short y1, short x2, short y2, void *poin, - float min, float max, float a1, float a2, char *tip) - - Same syntax and types available as previous uiDefBut, but now with an icon code - instead of a name. THe icons are numbered in resources.c - -uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, - short x1, short y1, short x2, short y2, float *poin, - float min, float max, float a1, float a2, char *tip) - - Same again, but now with an icon and string as button name. - -Two special icon buttons are available in Blender: - -12. ICONROW - (uiDefIconBut) - This button pops up a vertical menu with a row of icons to choose from. - 'max' = amount of icons. The icons are supposed to be ordered in a sequence - It writes in *poin which item in the menu was choosen (starting with 0). - -13. ICONTEXTROW - (uiDefIconTextBut) - Same as previous, but with the texts next to it. - - - ------------4.3 pulldown menus / block buttons - -14. BLOCK -void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, - short x1, short y1, short x2, short y2, char *tip) - - This button creates a new block when pressed. The function argument 'func' is called - to take care of this. An example func: - - static uiBlock *info_file_importmenu(void *arg_unused) - { - uiBlock *block; - short yco= 0, xco = 20; - - block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSW, UI_HELV, G.curscreen->mainwin); - uiBlockSetXOfs(block, -40); // offset to parent button - - /* flags are defines */ - uiDefBut(block, LABEL, 0, "VRML 2.0 options", xco, yco, 125, 19, NULL, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, TOG|BIT|0, 0, "SepLayers", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, TOG|BIT|1, 0, "Scale 1/100", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, TOG|BIT|2, 0, "Two Sided", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 50); // checks for fontsize - - return block; - } - - The uiDef coordinates here are only relative. When this function is called, the interface - code automatically makes sure the buttons fit in the menu nicely. - - Inside a menu uiBlock, other uiBlocks can be invoked to make a hierarchical menu. - - - ------------4.4 specials - -15. KEYEVT - -void uiDefKeyevtButS(uiBlock *block, int retval, char *str, - short x1, short y1, short x2, short y2, short *spoin, char *tip) - - A special button, which stores a keyvalue in *spoin. When the button is pressed, - it displays the text 'Press any Key'. A keypress then stores the value. - -16. LINK and INLINK - - These button present a method of linking data in Blender, by drawing a line from one - icon to another. It consists of two button types: - - LINK, the 'linking from' part, can be: - - a single pointer to data (only one line allowed) - - an array of pointers to data. The LINK buttons system keeps track of allocating - space for the array, and set the correct pointers in it. - - INLINK, the 'linking to' part activates creating a link, when a user releases the mouse - cursor over it, while dragging a line from the LINK button. - - These buttons are defined as follows: - - -uiBut but= uiDefIconBut(block, LINK, 0, ICON_LINK, x1, y1, w, h, NULL, 0, 0, 0, 0, ""); - /* create the LINK icon */ - -uiSetButLink(but, void **pt, void ***ppt, short *totlink, short fromcode, short tocode); - **pt: pointer to pointer (only one link allowed) - ***ppt: pointer to pointerpointer (an array of pointers) - (Either one of these values should be NULL) - - fromcode: (currently unused) - tocode: a short indicating which blocks it can link to. - - -uiDefIconBut(block, INLINK, 0, ICON_INLINK, x1, y1, w, h, void *poin, short fromcode, 0, 0, 0, ""); - poin: the pointer of the datablock you want to create links to - fromcode: a short identifying which LINK buttons can connect to it - - - -17. IDPOIN -void uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, int retval, char *str, - short x1, short y1, short x2, short y2, void *idpp, char *tip) - - The ID struct is a generic part in structs like Object, Material, Mesh, etc. - Most linking options in Blender happens using ID's. (Mesh -> Material). - - This special button in Blender visualizes an ID pointer with its name. Typing in - a new name, changes the pointer. For most ID types in Blender functions have been - written already, needed by this button, to check validity of names, and assign the pointer. - - (BTW: the 'void *idpp' has to be a pointer to the ID pointer!) - - Example function that can be put in 'func': - - void test_scriptpoin_but(char *name, ID **idpp) - { - ID *id; - - id= G.main->text.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - return; - } - id= id->next; - } - *idpp= 0; - } - - -------------- 4.5 uiButton control fuctions - - -void uiButSetFunc(uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2) - When the button is pressed and released, it calls this function, with the 2 arguments. - -void uiButSetFlag(uiBut *but, int flag) - set a flag for further control of button behaviour: - flag: - UI_TEXT_LEFT - -int uiButGetRetVal(uiBut *but) - gives return value - - - -


diff --git a/doc/license/BL-license.txt b/doc/license/BL-license.txt new file mode 100644 index 00000000000..3f079767198 --- /dev/null +++ b/doc/license/BL-license.txt @@ -0,0 +1,35 @@ +Blender License (the "BL", see http://www.blender.org/BL/ ). + +Copyright (C) 2002-2005 Blender Foundation. All Rights Reserved. + +This text supersedes the previous BL description, called Blender License 1.0. + +When the Blender source code was released in 2002, the Blender Foundation reserved +the right to offer licenses outside of the GNU GPL. This so-called "dual license" +model was chosen to provide potential revenues for the Blender Foundation. + +The BL has not been activated yet. Partially because; + +- there has to be a clear benefit for Blender itself and its community of + developers and users. +- the developers who have copyrighted additions to the source code need to approve + the decision. +- the (c) holder NaN Holding has to approve on a standard License Contract + +But most important; + +- the Blender Foundation is financially healthy, based on community support + (e-shop sales), sponsoring and subsidy grants +- current focus for the Blender Foundation is to not set up any commercial + activity related to Blender development. +- the GNU GPL provides sufficient freedom for third parties to conduct business + with Blender + +For these reasons we've decided to cancel the BL offering for an indefinite period. + +Third parties interested to discuss usage or exploitation of Blender can email +license@blender.org for further information. + +Ton Roosendaal +Chairman Blender Foundation. +June 2005 diff --git a/doc/license/GPL-license.txt b/doc/license/GPL-license.txt new file mode 100644 index 00000000000..8860b2a8afa --- /dev/null +++ b/doc/license/GPL-license.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/doc/license/bf-members.txt b/doc/license/bf-members.txt new file mode 100644 index 00000000000..41aad8b7264 --- /dev/null +++ b/doc/license/bf-members.txt @@ -0,0 +1,1393 @@ +Blender Foundation Members + +Special thanks to the following people, who have supported the Blender Foundation +by donating at least USD 50 to pay for opening the Blender sources: +(in chronological order): + +Bradley Keyes +Robert Knop +Thomas Brown +Adam Goodenough +Steven Tally +Jason Tally +Alan Taylor +Pascal COMPAGNON +Christopher Koppler +Matthew P. Carter +Gideon Vaala +F.O. Bossert +Frank Mayhar +Peter Volgyesi +Mark E. Nelmes +Peter Lammers +Craig Maloney +daniel e vertseegh +Freek Zijlmans +Anthony Ogden +Anders Dys +Gerald Saunders +Fernando Cordas +Joshua Smith +Max R. Huskins +imarend +Olaf Arnold +Eric Van Hensbergen +Christian Reichlin +brian moore +Anthony Walker +Carsten Hšfer +Raymond Fordham +David Megginson +Jason Schmidt +Christopher Walden +Robert van Straten +Daniel Schwartz +ekzakt +Jellybean +Streit Eric +Bob Ippolito +Keith Frederick +Ryan Heimbuch +Martin Hess +Shigeo Yoshida +Rens Houben +Jun IIO +Derek Gladding +Adam Wendt +Habib Loew +Jani Turkia +Warren Landon +Chip Lynch +Hans Ruedisueli +Keith Jones +Eugenio Mario Longo +Philippe Tanguay +nekurai +Ricardo Kustner +Peter Van Loock +Jun-ichi OKAMURA +alain dejoux +dario trombino +Kenneth Johansson +Felix Schwarz +Eugenio Diaz +Aoki Katsutoshi +Norman J. Harman Jr. +Ralf Habel +Ken Payne +DEBEUX Sylvain +Douglas Philips +Lai Che Hung +Johan Bolmsjš +Aaron Mitchell +Teinye Horsfall +Martin Marbach +Jason Poole +Cesar Delgado +Gareth Clay +Paul Wasserman +Joeri Sebrechts +Johannes Lehtinen +Marcio L. Teixeira +James A. Peltier +George E. Nimmer III +Matthew Fite +Ken Sedgwick +Gary Baltzell +lukas schroeder +Dan Lyke +Mark Thorpe +A.D. Arul Nirai Selvan +Herbert Pštzl +Andy Payne +LAFFITTE Benoit (KenjForce) +James Ertle +Tom Turelinckx +Rigo Ketelings +Bryan Green +Suzuki Akihiro +Mason Staugler +Guillaume Randon +francois Gombault +Harald Thelen +Graziano Roccon +Jonathan DuBois +Jason Luros +Drew M. Snyder +Jesse DeFer +Michael Keith +Gaetano Tinat +Ferris McCormick +Sherman Boyd +Thomas C Anth Jr +Joseph Catto +Damian Soto +John Walsh +Stephen Rosman +Ross Hopkins +Robert Wenzlaff +Joe Galat +LinuxFrench.NET +Thomas Erichsen +Gary E. Deschaines +Denis McCarthy +Michael Dowman +John (J5) Palmieri +alphawolf +Peter Paul Fink +Charles F. McKnight +Avi Schwartz +Jim Witte +Jens Ansorg +William Bate +Ron Romano +Marc Schraffenberger +Steve Thompson +Martin Whitaker +Kendall Dugger +Brice Due +Simon Vogl +Bernd Koestler +clŽment CORDIER +CreationAnimation.com +Pete Carss +HERSEN Antoine +Charles R. Tersteeg +James T Burnett +Shawn Legrand +David Choice +patrick amaru +David Eck +Gabriel Welsche +Henning von Zitzewitz +Chris Impink +Den Giles +Jon Cisewski +Ricki Myers +Luis Collado +Robert G. Watkins +Rainer Perl +YAGI, Toshiki +Bruno Nitrosso +Athalyba / Blender Brasil +Dave Whittington +Darryl Luscombe +Benjamin A Moore +Andreas Kollegger +Stamatis Logos +Ray Kelm +Albrecht Jacobs +Mirko Horstmann +Ranjit Mathew +Jaron Blackburn +Antonio Hui +Scott Moore +CSN media +Scott Carle +Ted Milker +Lars Brinkhoff +Louise Edwards +Alex Ruano +Art Rozenbaum +Manuel Hossfeld +Brandon Ehle +Lou Bruce +ROMASZEWSKI +cadic jean-yves +Ralf Pietersz +KAZY +serge Jadot +HervŽ LOUINET +Tom Houtman +Magnus Kššhler +Martin Sinnaeve +Kevin Yank +Tomoichi Iriyama +THIBAULT +Dr Steven J. Baines +Hans-Peter Berger +Jeffrey D. Holland +Philip XP Talbot +Peter Haight +Krister Bruhwel +the Smoos +Hohenegger Michael +Alejandro Gabriel y Galan +Boyer +Alwin Eilers +Tyberghein Jorrit +Jaroslav Benkovsky +Gianluigi Belli +Naoki Abe +NOTTE Jean-Pierre +Jack Way +Bjšrn Westlin +Mitch Magee +wizoptic +Jake Edge +David Hoover +Xabier Go–i +Daniel Fort +Erik Noteboom +Pavel Vostatek +Javier Belanche Alonso +Jeffrey Blank +Nathan Ryan +Peter Wrangell +Josef Sie§ +Timm Krumnack +Steve Martin +Shigeru Matsumoto +Marko Kohtala +Aleix Conchillo +Curtis Smith +Tatjana Svizensky +Matt Graham +Karo Launonen +Nikolaj Brandt Jensen +Jean-Michel Smith +Nathan Clegg +Joaquim Carvalho +Bomholt +Martin Imobersteg +Jordan +Justin Warwick +barussaud +Eric Molbert +Ben Berck +Jacco van Beek +Dominic Agoro-Ombaka +Colin Foster +Sascha Adler +Stuart Duncan +Brendon Smith +SŽbastien COLLETTE +Clemens Auer +Kay Fricke +Fabian Fagerholm +Norman Lin +Aaron Digulla +Camilo Moreno +Detlev Reppin +Denis NICOLAS +Armin Antons +Darren Heighington +Mario Latronico +Frank Meier +Joerg Frochte +Matthew Ingle +Anters +Bjoern C. Schaefer +STEMax +Jeff Cox +Trevor Ratliff +Matt Henley +Franois VALETTE +Rob Saunders +Mike Luethi +Rami Aubourg-Kaires +Matthew Thomas +Allan Jacobsen +Adam Lowe +David Hostetler +Lo•c Vigneras +Dan Reiland +Pedro D’az del Arco +Pierre Beyssac +Chris Davey +YOSHIAKI Nishino +Cyber Perk +Fabrizio Cali +Harunobu Yoda +Gerrit Jan Baarda +LarstiQ +Ico Doornekamp +Emiel den Biesen +Willem Zwarthoed +Carl Giesberts +Buzz +lieve vanderschaeve +Margreet de Brie +hans verwaal +Saskia van Dijk +Martin Gosch +Alexander Konopka +Thomas Gebert +Gerard de Vries +Hans Lambermont +Kim Beumer +Kay Thust +Alexander Jung +Tony Corlett +Olivier Thouverey +Hideo Nomoto +Giel Peters +Ray Poynter +Edoardo Galvagno +Pim Feijen +Hua-lun Li +William Reynish +Bryan Carpenter +Jim Scott +NGUYEN Fabien +Dave Stone +Andy Kugyelka +Andrew Ross +MerieJean-Christophe +Marko Mestrovic +Jack +Lars Gunnar West +Wile E. Coyote +Rick Clark +Carlos A. Duque +Franck Barnier +Matt Shirley +Viktor Zacek +Peter Williamson +Chema Celorio +Paul Cleveland +Guo-Rong Koh +Andrew Potter +Daniel Smeltzer +Cativo +Dmitri Bichko +Jeremy Brinkley +Stephen Saville +Michael Proto +Kurt Korbatits +Ruan Muller +Mike Beggs +Beat Schiess +Sven Marcel Buchholz +Enrique Monfort +Simon Posnjak +Steven Ahkim +theGyre +William Marble +Allen Smith +Joshua SS Miller +Mike Edwards (PinkFreud) +Mark D. Butala +Auriea Harvey&Michael Samyn +Randy Newman +Leslie Spring +Marc Schefer +Dean Edmonds +David Whitehouse +Tim Humphrey +Phillip Richdale +Jason McHugh +Claudio de Sario +Artur Kedzierski +Richard Garcia +Isaac Rivas Alvarez +Kiernan Holland +Holger Malessa +Masanori Okuda +Andrea Maracci +Kai-Peter BŠckman +Gregg Patton +Luis M Ibarra +Julian Green +Christian Bender +Mark Winkelman +Ebbe L. Nielsen +Carlos Orozco +magnetHead +KrŸckel Oliver +Thomas Ingham +Wes Devauld +Uwe Steinmann +Jesus Gonzalez +DenMeridiS +Marc Hofer +Marko Mestrovic +Leslie Owen Everett +Knut Bueltemann +Eric Garaventa +Wolfram Schwenzer +Edwin Brouwer +mauro ujetto +Franck Vibert +Daniel Pacheco +Justin Shumaker +Steve Wallace +Forensic Engineering Inc. +Steve Mackay +NDNWarrior +Christopher Gray +Darius Clarke (Socinian) +Jean-SŽbastien SEVESTRE +Douglas Fellows +Craig Symons +Quincin Gonjon +Brian B. Kelley +Kie Brooks +Scott Whitney +kwbrads +Keijiro Takahashi +Geno Ruffalo +Zzeb +Peter Dohnt +Jeff E Schram +ernst bunders +Nobutoshi Shigemori +Mariano Aured +Rab Gordon +Kurt Maurer +Ron Cavagnaro (doogs) +Johan Bjorklund +Cyril M. Hansen +JOSEPH GRACI +Rafael Rubio +fabrice meynard +Emilio Aguirre +Mark Lewis +Markus Q. Roberts +Christoher Bartak +Peter Truog +Eric Dynowski +Philipp GŸhring +Pierre-Yves RANNO +Jason Nollan (Cluh) +Launay Jean-Claude +Wayne Buckhanan +Jan Magne Landsvik +Douglas Dragan Njegovan +Brian David Hale +Randal Walser +Matthew A. Nicholson +Thomas +Phillip Kinsley +Jerome Zago +David Rosky +TROJANI Cedric +David Polston +Patrick Mullen +Tetsuya Okuno +Bodo JŠger +Leon Brooks +Cedric Adjih +Michael L. Fisher +Dan Tomalesky +Sky Schulz +Scott Brickert +James Purdon +Miles Langham +N Yiannakoulias +Stephen Swaney +www.artwave.nl +Take Vos +sspickle +Denis Oliver Kropp +Gustavo +rodgers whittington jr +George Dvorak +Norman J Davis, Jr. +Javier Velazquez +John Tougas +John Howland +Steve Organek +Jano Lukac +David Cardon +Mick Balaban +Michael Kaufman +Viper Expo +Chassoulier +Sjoerd Zaalberg van Zelst +B. Douglas Hilton +Benoit CANTAGREL +Kai Fischer +Mark Osborne +Michael Hollenbeck +iconjunky +luca de giorgi +Jonathan Mullen +Javier Fernandez-Ivern +Reuben Burgess +Olivier Scalbert +claudio luis Rogers +Jeremy Peterson +Mark Streutker +Lourens Veen +Neil Davis +John McGurk +Stephen Teegarden +Dave LeCompte +Michael Lang +Mortal_Enemy +Arigo Stanescu +Vincent Stoessel +Adrian Virnig +Chris Dixon +Travis Cole +MŒrten MŒrtensson +Evan Scott +Mark Coletti +Ken Burke +Karl Holland +ScRaze +Wilco Wilbrink +chris montijn +Michael Wagenmann +Viktor Pracht +henrik wilming +Jim Evins +Christophe Massaloux +Marc Sommer +Luc Stepniewski +Eric M. Clark +Iain Russell +Thomas Bleicher +Anthony Zishka +Jefferson Dubrule +Esa PiirilŠ +Bill Thiede +William Anderson +Alexander Kittel +Joe Tennies +Sam Cable +Christian Peper +Joshua Frederick +Steve Sutton +Pete Toscano +Michael Zucchi +Peter Degenhardt +Horizont Entertainment +Olivier Bornet +Richard D. Laudenslager +sha +John DiLauro +John Miller +Frederic Crozat +Matt Welland +Paul CalcŽ +Joe Prochilo +Justin Shafer +Joe Croft +Detlef Mueller +Raschbacher Thomas +Alain Gallo +Phuoc Ngo +Krabat +Derek Harmison +SŽbastien Devine +Kenneth P. Stox +Wade Felde +Kai Groshert +Michael Soibelman +janine dalisda-davis +Philippe Raxhon +Daniel Sheridan +Michael Pressler +Daniel Lundqvist +Tim Oertel +James Ahlschwede +William Henstrom +PETIT-PHAR Patrice +Marc-Aurele DARCHE +Wei-ju Wu +Robert Wilson +Gerald Severs +Alejandro Conty Estevez +Tetsuya Yatagai +David Dolder +Luigi Cristiano +Posse Press / Romain Canonge +Vania Smrkovski +Bartosch Pixa +Dr. Jens Rosenboom +Gunnar Stahl +Robert Kroeger +Martin Forisch +Guillermina Manon +Randal D. Adams +Kevin Reagh (kevin3D) +Wolfgang KŸhn +BEAUSOLEIL Arnaud +Stan Jakubek +Klaus Brand +Holger Mueller +Fankhauser +Jon McCallum +Rob Olsen +Joel Davis +Kenneth Bledsoe +James F. Campanella +Jens Kilian +wim hendrix +Karri Kaksonen +Luis Roldan +Jason L. Shiffer +Jacco Marks +Dale Schoeck +Agustin Catalan +A. T. Meinen +Kamiel Wanrooij +Samuel Seay +Mike Schaudies +Robert Sherwood +Fernando Villalon Panzano +Jšrg Roschke +Carl Symons +Peter Pichler +Alan Heckart +seth nagy +pelletier +Jeff Kowalczyk +LIONEL ALLORGE +Bhishma Patel +Richard Rowell +Barbara Seaton +Aschwin van der Woude +William J Black +Kars Meyboom +Glen Nakamura +Jim Belcher +Tim Scott +mea van amstel +Robert-Reinder Nederhoed +Neil Hunt +WizardNx +Brad Choate +scott schoen +Dan Merillat +Martin Krueger +Samuel Greenfeld +Damon Tkoch +Colin Millar +Mike Roseman +Patrick Trussell +Hans-Peter Bock +Daniel Haertle +Wiremu Te Kani +Joep Mathijssen +LATRY +Witold Hazuka +geoff marshall +dave howard +Jan Zielinski +Fernando Buelna Sanchez +Timo Mihaljov +Allard Willem van den Brul +T.J.T van Kooten +Thijs van der Vossen +Antonio de Santis +Jama Poulsen +Robert Emanuele +Timothy Lord +Tom Parker +Jarrod Willard +Leon Merts +Tom Dow +Eric Anholt +mercier +Marc van Kempen +wim van hoydonck +Joe Hacobian +Jose Luis Fresquet Febrer +toni calmardo +Sam Littlewood +Charles Wardlaw +Javier Rodriguez +Michael C. Schwab +Corey Bell +Emmanuel Preveraud de La Boutresse +Davide Desogus +Larry Phillips +Marko Teiste +John Roesink +Legrand Johan +Jeff Boody +James Turner +Peter Petrakis +Ravi Ravindran +dickie +Rene Geerlings +Richard Braakman +Arthur Frenslich +Carsten Schmidt +Ronny Martin +Erwin Kuiper +Lopez-Garcia, Juan-Carlos +Rau, Bernhard +Stephen Uithoven +Ken Beyer +Matjaz Jakopec +Eckhard M. JŠger +Mike Siebach +John Harger +Justin W. Carper +Markus Weber +Elena Grandi +Arndt Heuvel +Miguel Cancela Da Fonseca +Kirk Lancaster +Phillip Elliott +Chris Halsall +Andre Voitel +benjamin scheers +Robinder S. Bains +David Brunton +David Brown +Craig Duncan +du Song +Ben Wart +Eryk Kedzierski +Ronald Hayden +Raymond de Vries +David Johnson +Kenichi Fujihiro +WANG +Chris Weber +Christian Lehmann +DENDIEVEL Stephane +Bryan Jaycox +Karl Bartel +Ralph Howes +Matthew J. Stott +Omar Priego +ke Westerstršm +Imago Viva +James E Hill +Rune Myrland +James Hill +Nick +Ramiro Santos +Giuseppe Chiesa +Philippe Ney +Tom Woodyard +Jim Gray +Jim Newman +Robert I Black III +Peter Marouelli +Ian Roberts +Guy Van Rentergem +Jose Luis Perez Rubio +Gabriel Mainberger +Klein Poelhuis +Luke Sargeant +Edomaur +robert stok +Karl J. Smith +Harry Splinter +Paul Boese +Dave Mata +piet visser +Nicolas Christin +Erik Zidowecki +Markus Michael Egger +Edward R. Helwig +Alyx Flannery +raphael betemps +Masahiro Takahata +Claude Bilat +Mario Palomo +Neipi +Grethus Bode +Jan MŸller +Mark Pearson +Stanislav Osicka +DataCare Solutions AG +Russell Elliott +Antonio Campos +bordeaux samuel +Herman Vereycken +Sergio Avila +George Dobrozemsky +Ocie Mitchell +Ryuuji Kusajima +Nick Austin +Edward Wei +Gregg Tavares +Aaron Bredon +Hideki Suzuki +josef radinger +Robert Friemer +Jšrg Zastrau +Burton Bicksler +Kimmo Mšsš +Robert F Johnson +Mark Johnson +Avi Bercovich +Mike Armitage +Roy Jones +Kathleen Sinnott +Per-Erik Westerberg +Reid Ellis +Phillip J. Birmingham +Ken Jordan +Duffaud +Marco Ardito +Simon Suter +Tobias Huelsdau +Winfried EnglŠnder +Stephen Groundwater +Joel Ray Holveck +Mag. Tibor Rudas +Hartmut Wolf +Douglas Jones +brett hartshorn +Beat MŠgert +Javon Prince +bri +James Klicman +Harvey Fong +jeroen v.d. Meulen +Wim Vandersmissen +Carlos Moreno Rodr’guez +Trausti Kristjansson +Larry Snyder +olivier +jip +Thomas Hintz +Daan van der Munnik +gideon +jared +Erick I. Jimenez Alvarado +John Martinez +Daniel Stephens +Alaric Haag +Michael Edwards +Sam Tregillus +Joe Pribele +Jeffry Archambeault +robert schiffers +shane smith +elout de kok +Felix Esser +Dietrich Lange +Richard Clark +errol garner +Jose M Cerqueira Esteves +Jeroen Janssen +Sven Meyer +Mike Bayer +Arash Vahdat +Bernd Hoppe +Tobias Geiger +Ronnie Stevens +W. van Ophoven +Artem Baguinski +Peter Morse +Nicholas Phillips +Leo Mannhart +philippe eygonnet +Hans Klerk +wes uchida +Guido Winkelmann +Doug Ferguson +Robert Lindsay +John Lovgren +Rogers Cadenhead +Philippe Crassous +Dirk Krause +lexpattison +Fred Roberts +Njin-Zu Chen +GUILLON Marc +Felix Klock +Ernesto Salas Rodr’guez +Pavel Roskin +Jaap +Stefan Maass +Adam Bower +Gary Thomas +Chris Gottbrath +seyssel claude +Chris Winberry +Chip Collier +Balint Reczey +Nuno Sucena Almeida +Landon Bradshaw +Chua Mei Ling +JC Hythloday +Dustin Knie +artshow +Ralf Gauglitz +Ted Schundler +Bernard Hurley +delerue +Dirk Behrens +Doc Holiday +Wouter Kerkhoven +Andreas BŸttner +James Black +Nicholas Ward +David Oberbeck +The Shizit +Erich Moog +James Amendolagine +Alex Penner +Dieter Finkenzeller +giol franco +Tobias Regenbrecht +Ryan Dewalt +Spencer Cathey +Benoit SERRA +System Impuls +Jason Tranter +macherb +LCC Consulting AG +Ivan So +Cori Verschoor +Henauer Pascal +Chris Bilderback +Eddie Sheffield +DEHEN Pierre +henk van den toorn +Ian Whitworth +Ruud H.G. van Tol +Pierre Lo Cicero +Srinivas Digumarty +digitalvelocity¨ +Alan J Booth +Tony OBrien +Douglas Toltzman +Christophe BOUCHET +Paul Robertson +SCHNEIDER Philippe +Jason Cunliffe +Dick Damian +Charles Hakari +jeff knowlton +Kevyn Shortell +robin +Craig Spitzer +Jeffrey Van Ness +Lucas Vergnettes +Wolfgang Michaelis +Luis JimŽnez Linares +Julian Eden +Ms Lilo von Hanffstengel +Kurt B. Kaiser +Mark Ping +CombŽe +Diego Matho +MELIN Philippe +Damian Sobieralski +Luigino Masarati +Leonard Wikberg III +Tom Howsman +Christopher R Marquard +Claus Munk +Chris D'Iorio +Graphics Solutions Pty Ltd +Bernd Stein +Jose Angel Vallejo Pinto +Matthew William Turner +Kelly A. Flinn +Hai T. Nguyen +Tim Formica +Kevin Purrington +Andreas Lindenblatt +Brian Musker +Diego Silvio Novo +Close Pierre-Yves +Wayne Pierce +Hattan Lee +Didier PEYRET +Jacquelin GAZEAU +Kenneth Balmer +Robert Hwang +Gaertner, Klaus +Peter Gumieniak +Simon Pigot +Ian Thompson +Jason Southwell +Stephan +Robert Kuehn +IUT Mesures Physiques:gilbert Garnier CAEN France +Nigel I Phillip +powermacg4 +Joan Touzet +Mike Mormando +katsuhiko ebisawa +Baheux Tony +Randi Joseph +Rick Comeau +michiel van der kley +Thijs Seelen +Robert Roos +ton +david seccombe +Joshua Eckert +Joshua Newman +Paolo Sammicheli +Gentilini Bruno +Martin Herren +STRAPPAZON Mathias +Steven Gibbs +Florian Kruesch +Wesley Blijlevens +Fabianne Balvedi +Colin Henry +Mark Deepak Puttnam +LE GOULVEN +evolutie +Stephane Portha +Robert Gentner +David B. Camhy +RenŽ Foucart +Coyok Drio +Mark Ng +klein michael +Antonin Kral +Edward Jomisko +Wouter de Mik +Matteo De Simone +Gal Barak +Thomas Dyar +Nathan Allworth +Dean Giberson +Larry Cummings +Eric Augustine +IngieBee +Michael Velikanje +Andre M. Czausov +H@dj +Thorsten Burghaus +Renzo Lauper +Martin White +Ferdinand Strixner +Neil Mannall +Maxime Wacker +Gal Buki +Rene Christen +Andreas Neukoetter +DAVID JOHNSON +John Walton +Volker Mische +Michel Vilain +Luigi/Blender Brasil +Clifton A. Cross +Kent B. Mein (SirDude) +Anne Postma +Matt Runion +Bob Tackett +stanislas nanchen +Jorge Monteiro +S68 +Ville Kaajakari +Adrien Rebollo +Al Curatolo +Frank Rutten +Dierk Dohmann +Roel Spruit +Rob Coldwell +Yann Vernier +Haunt_House (PH) +Ravinder Singh Bhara +Erik Augustijns +Ryan Earle Freckleton +Andreas Sturm +matt mullin +MOREAUX Denis +Brendan Stromberger +Hideki Saito +Christian Ullrich +Courty Didier +Steve Newton +Brecht Van Lommel +Jasper Op de Coul +Stuart MacKinnon +Dietrich Dietz - the IMaGiNation project (IMGN) +Tina Hirsch +John R Thorp +FrŽdŽric Bouvier +LINETTE +Felix Rabe +Chay Adamou +nick harron +stephen john ford +Kino +Daniel Sjšlie +Matthias Derer +Alain VALLETON +Kervin Pierre +Mike Laughton +Frank van Puffelen +Andreas Dluzewski +Christofer Edvardsen +Maciek Szczyglowski +Rakesh Ravuri +Robert Schouwenburg +Bob Bayens +Devas73 +Mika Saari +Robert Ives +Adam McBride +IAN ROSS +Uriah Liggett +stefan fischer +Didac Miro +Tim Barlow +G. T. Blackwell +Tim Weaver +Dalet +Erwin Vervacke +Benjamin Eduardo Rodriguez Berumen +Ozono Multimedia s.l.l. +James Kersey +Michael DeLuca +Mark Swann +Andreas Altenburger +John Smith +Simon de Haan +David Gregory +Harald Krummeck +E Warren McNee +Marc-Andre Levesque +Satoshi Yamasaki +Rolf-Dieter Klein +J. Deetman +Helge Walter +Roland StrŒlberg +Nicolas Morenas (Caronte) +Simon Clarke +Maigrot Michel +Rod Robinson +Kevin Cozens +Germ‡n Alonso (taz) +Martin Stegeman +Henrik Jordfald Olsen +Mitchell Skinner +Michael Lei +Spiridon G. Kontarakis +Bas Denissen +Loic Dachary +Michael Rutter +Thorsten SchlŸter +hijothema +Andreas Hauser +Holger Haase +Danilo Duina +Matthias Thurau +Flavio Curti +Ian Beardslee +Cristina Lozano Ballester +Jason Roberson +Victor Lim +andreas palsson +Richard Charvat +James Ezell +Florian Eggenberger +John J. Marshall +Paul Lunneberg +Peter Wolkerstorfer +Gerhard Siegesmund +Nat Budin +NDNChief +Dave Leeak +Michael Siebecker +Jan Walter +John Aughey +Corey Rice +Darren F. Coolen +tony principali +Joe Kimmes +Pekka Karvonen +Rick Kimball +Christopher Capoccia +Bertram Zeller +Vanpoucke Alexandre +Bassam Kurdali +Michael Baker +Michael Schwemmle +Ford "fullback" Roberts +Lama Angelo +Kevin Roeder +oliv +pinhead_66 +Zach Millis +Ryan C. Stallings +Adam LaJeunesse +Satish Goda +Erik Haagsman +Lorenzo Moro +Nathan Letwory +stephan f. haupt +Alex Papadopoulos +Gianluigi Berrone +andrea casentini +David Randall Simpson +Jason Oppel +Mark Bloomfield +Alexander Ehrath +Owen Swerkstrom +Aurelio Caliaro +Karsten Dambekalns +Eddy MOUSSA +Bernd Roetter +Roland Hess +Luis Eduardo P. Gervasio +Pierre-Luc Robert (bedsitter) +Andreu Cuartiella +Nathan Vegdahl +Scott Ross +Jacob Kafka +Mario Bolte +Wolfgang Draxinger +Starr Kline +John Lullie +Chiffi Cosimo +Morgan McMillian +Stefan HŸbner +Loic de MONTAIGNAC +AndrŽs Castillo +Francesco Anselmo +Ingo Guenther +James C. Davis, Jr. +Claudio Andaur +Caleb Williams +Orest Dubay +Adam Casto +David +Joost Burger +Ken Hahn +Mark Herring +Stig Oeveraas +Robert Rainthorpe +Martin Middleton +Simon Sedgwick +Joseph Firestine +Miguel Melo +Wooster Dennis +Gary Lucas +Johannes Schwarz +Mark Dalton +Mike Norton +Michael Schardt +jean-michel soler +Chris Bracewell +Ross Dawson +Tim De Graeve +Adam Wiseman +Luiz Olsson Barbosa +Donna Carey +Auke van Balen +Mike Birdsong +Martin Curran +Shawn M. Murray +Roy Simmons +Malik +Teguh Pangestu +Mats Holmberg +Julien Jehannet +Michael A. Nelson +Axel Cushing +erik vogan +Datenflug GmbH +KC Roeyer +Ryan J. Parker +Robert E. Meuse +Alex Heizer +Netsail Ltd / Mats Holmberg +Jonathan Lawman +Seikoh Hokama +Perry Faulkner +Will Hanson +Lyubomir Pavlov Kovachev +Ennio Quattrini +Marcelo "xfer" Alves +Joseph Winston IV +Jorge Otero Rueda +Timothy Murakami +Matthew Johnson +Erik Rombouts +Petr Vlk +Thomas Dammann +Henrik Turkerud +Erlend Hamberg +Arnaud Lebegue +Kevin O'Brien +Michael Buettner +Engel A. Sanchez +Alexander Hilgert +FAUGE Thierry +Wulf Huesken +John M. Adams +Dell'Aiera Pol +Waylena McCully +Russell Smith +Luke Titley +marinus meijers +Henry Kaminski +Alistair Riddoch +Daniel NŸmm +Matthew Meadows +Bjoern Paschen +Paul Fredrickson +Gavin Baker +Jan Illetschko +Aaron C. McLeod +Thomas Muldowney +Cheyenne Cloud, LLC +Helmut A. Goettl +Martin A. Boegelund +Beno”t Cousson +Scott Brooks +Ferlet Patrice +Aaron Porterfield +Ivan Florentin +Scott Isaacson +Rui Paulo Sanguinheira Diogo +Jason Saville +Active-Websight GbR +Bryon Roche +Gustavo Mu–oz +Christopher Gillanders +Phil Frost Tate +Gilles Gonon +Kay +James C. Franklin +Luis Enrique Caama–o Navas +Alexander "estartu" Felder +Marc Ledermann +vrijschrift.org +Holger Weihe +Peter Cammaert +Andres Meyer +Tony Arnett +Adam Hughes +Tony Farley +Dmitriy Teresh +Maickel Swart +Peter den Bak +Steve Bennett +Romain Rubi +John Bolt +Michael Gaston +Philip Brown +Wasi +Mike Hirst +Lloyd J Robinson, Jr +Charles Rinker +Nick Vogtmann +Frank van Beek +Bruce Mitchener +ROBERTO A. RUIZ VIAL +Maurizio Sibaud +Ron Bolger +Nathan Parton +Andrew Fry +VINCENT StŽphane +Yan Yan +Justin L Graham +Wade Beasley +Salvador Mata Rodriguez +Jan Tiemersma +Luis A. R. Fernandez +Jacob Moy +Stefano Francesi +Jochen Hanne +David Stephenson +Brent O'Dell +Mike Kasprzak +Tom Thompson +David Fung +Radoslav Dejanovic +James H. Cloos, Jr. +Karl Erlandsen (LethalSideParting) +Kari Pulli +Dave Shemano diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 new file mode 100644 index 00000000000..dd5e60ff900 --- /dev/null +++ b/doc/manpage/blender.1 @@ -0,0 +1,340 @@ +.TH "BLENDER" "1" "July 15, 2010" "Blender Blender 2\&.52 (sub 5) " + +.SH NAME +blender \- a 3D modelling and rendering package +.SH SYNOPSIS +.B blender [args ...] [file] [args ...] +.br +.SH DESCRIPTION +.PP +.B blender +is a 3D modelling and rendering package. It is the in-house software of a high quality animation studio, Blender has proven to be an extremely fast and versatile design instrument. The software has a personal touch, offering a unique approach to the world of Three Dimensions. + +Use Blender to create TV commercials, to make technical visualizations, business graphics, to do some morphing, or design user interfaces. You can easy build and manage complex environments. The renderer is versatile and extremely fast. All basic animation principles (curves & keys) are well implemented. + +http://www.blender.org +.SH OPTIONS + +Blender 2.52 (sub 5) Build +Usage: blender [args ...] [file] [args ...] +.br +.SS "Render Options:" + +.TP +.B \-b or \-\-background +.br +Load in background (often used for UI\-less rendering) +.br + +.TP +.B \-a or \-\-render\-anim +.br +Render frames from start to end (inclusive) +.br + +.TP +.B \-S or \-\-scene +.br +Set the active scene for rendering +.br + +.TP +.B \-f or \-\-render\-frame +.br +Render frame and save it. +.br ++ start frame relative, \- end frame relative. +.br + +.TP +.B \-s or \-\-frame\-start +.br +Set start to frame (use before the \-a argument) +.br + +.TP +.B \-e or \-\-frame\-end +.br +Set end to frame (use before the \-a argument) +.br + +.TP +.B \-j or \-\-frame\-jump +.br +Set number of frames to step forward after each rendered frame +.br + +.TP +.B \-o or \-\-render\-output +.br +Set the render path and file name. +.br +Use // at the start of the path to +.br + render relative to the blend file. +.br +The # characters are replaced by the frame number, and used to define zero padding. +.br + ani_##_test.png becomes ani_01_test.png +.br + test\-######.png becomes test\-000001.png +.br + When the filename does not contain #, The suffix #### is added to the filename +.br +The frame number will be added at the end of the filename. +.br + eg: blender \-b foobar.blend \-o //render_ \-F PNG \-x 1 \-a +.br + //render_ becomes //render_####, writing frames as //render_0001.png// +.br + +.TP +.B \-E or \-\-engine +.br +Specify the render engine +.br +use \-E help to list available engines +.br + +.IP + +.SS "Format Options:" + +.TP +.B \-F or \-\-render\-format +.br +Set the render format, Valid options are... +.br + TGA IRIS JPEG MOVIE IRIZ RAWTGA +.br + AVIRAW AVIJPEG PNG BMP FRAMESERVER +.br +(formats that can be compiled into blender, not available on all systems) +.br + HDR TIFF EXR MULTILAYER MPEG AVICODEC QUICKTIME CINEON DPX DDS +.br + +.TP +.B \-x or \-\-use\-extension +.br +Set option to add the file extension to the end of the file +.br + +.TP +.B \-t or \-\-threads +.br +Use amount of for rendering in background +.br +[1\-BLENDER_MAX_THREADS], 0 for systems processor count. +.br + +.IP + +.SS "Animation Playback Options:" + +.TP +.B \-a +.br +Playback , only operates this way when not running in background. +.br + \-p Open with lower left corner at , +.br + \-m Read from disk (Don't buffer) +.br + \-f Specify FPS to start with +.br + \-j Set frame step to +.br + +.IP + +.SS "Window Options:" + +.TP +.B \-w or \-\-window\-border +.br +Force opening with borders (default) +.br + +.TP +.B \-W or \-\-window\-borderless +.br +Force opening with without borders +.br + +.TP +.B \-p or \-\-window\-geometry +.br +Open with lower left corner at , and width and height as , +.br + +.IP + +.SS "Game Engine Specific Options:" + +.TP +.B \-g Game Engine specific options +.br +\-g fixedtime Run on 50 hertz without dropping frames +.br +\-g vertexarrays Use Vertex Arrays for rendering (usually faster) +.br +\-g nomipmap No Texture Mipmapping +.br +\-g linearmipmap Linear Texture Mipmapping instead of Nearest (default) +.br + +.IP + +.SS "Misc Options:" + +.TP +.B \-d or \-\-debug +.br +Turn debugging on +.br + +.IP +* Prints every operator call and their arguments +.br +* Disables mouse grab (to interact with a debugger in some cases) +.br +* Keeps python sys.stdin rather then setting it to None +.br + +.TP +.B \-\-debug\-fpe +.br +Enable floating point exceptions +.br + +.IP + +.TP +.B \-nojoystick +.br +Disable joystick support +.br + +.TP +.B \-noglsl +.br +Disable GLSL shading +.br + +.TP +.B \-noaudio +.br +Force sound system to None +.br + +.TP +.B \-setaudio +.br +Force sound system to a specific device +.br +NULL SDL OPENAL JACK +.br + +.IP + +.TP +.B \-h or \-\-help +.br +Print this help text and exit +.br + +.IP + +.TP +.B \-y or \-\-enable\-autoexec +.br +Enable automatic python script execution (default) +.br + +.TP +.B \-Y or \-\-disable\-autoexec +.br +Disable automatic python script execution (pydrivers, pyconstraints, pynodes) +.br + +.IP + +.TP +.B \-P or \-\-python +.br +Run the given Python script (filename or Blender Text) +.br + +.TP +.B \-\-python\-console +.br +Run blender with an interactive console +.br + +.TP +.B \-v or \-\-version +.br +Print Blender version and exit +.br + +.TP +.B \-\- +.br +Ends option processing, following arguments passed unchanged. Access via python's sys.argv +.br + +.SS "Other Options:" + +.TP +.B /? +.br +Print this help text and exit (windows only) +.br + +.TP +.B \-R +.br +Register .blend extension (windows only) +.br + +.SS "Argument Parsing:" + + arguments must be separated by white space. eg + "blender \-ba test.blend" + ...will ignore the 'a' + "blender \-b test.blend \-f8" + ...will ignore 8 because there is no space between the \-f and the frame value +.br +.SS "Argument Order:" + +Arguments are executed in the order they are given. eg + "blender \-\-background test.blend \-\-render\-frame 1 \-\-render\-output /tmp" + ...will not render to /tmp because '\-\-render\-frame 1' renders before the output path is set + "blender \-\-background \-\-render\-output /tmp test.blend \-\-render\-frame 1" + ...will not render to /tmp because loading the blend file overwrites the render output that was set + "blender \-\-background test.blend \-\-render\-output /tmp \-\-render\-frame 1" works as expected. +.br +.br +.SH "ENVIRONMENT VARIABLES" + \fIBLENDER_USER_CONFIG\fR Directory for user configuration files. + \fIBLENDER_SYSTEM_CONFIG\fR Directory for system wide configuration files. + \fIBLENDER_USER_SCRIPTS\fR Directory for user scripts. + \fIBLENDER_SYSTEM_SCRIPTS\fR Directory for system wide scripts. + \fIBLENDER_USER_DATAFILES\fR Directory for user data files (icons, translations, ..). + \fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files. + \fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries. + \fITMP\fR or \fITMPDIR\fR Store temporary files here. + \fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python. +.br +.br + +.br +.SH SEE ALSO +.B yafaray(1) + +.br +.SH AUTHORS +This manpage was written for a Debian GNU/Linux system by Daniel Mester + and updated by Cyril Brulebois + and Dan Eicher . diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py new file mode 100644 index 00000000000..805de1f24a1 --- /dev/null +++ b/doc/manpage/blender.1.py @@ -0,0 +1,136 @@ +#!/usr/bin/python + +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import subprocess +import os + +import time +import datetime + + +def man_format(data): + data = data.replace("-", "\\-") + data = data.replace("\t", " ") + # data = data.replace("$", "\\fI") + + data_ls = [] + for w in data.split(): + if w.startswith("$"): + w = "\\fI" + w[1:] + "\\fR" + + data_ls.append(w) + + data = data[:len(data) - len(data.lstrip())] + " ".join(data_ls) + + return data + + +blender_bin = os.path.join(os.path.dirname(__file__), "../../blender") + +blender_help = subprocess.Popen([blender_bin, "--help"], stdout=subprocess.PIPE).communicate()[0].decode() + +blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip() +blender_version = blender_version.split("Build")[0] + +date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y") + +filepath = os.path.splitext(__file__)[0] + +file = open(filepath, "w") + +fw = file.write + +fw('.TH "BLENDER" "1" "%s" "Blender %s"\n' % (date_string, blender_version.replace(".", "\\&."))) + +fw(''' +.SH NAME +blender \- a 3D modelling and rendering package''') + +fw(''' +.SH SYNOPSIS +.B blender [args ...] [file] [args ...]''') + +fw(''' +.br +.SH DESCRIPTION +.PP +.B blender +is a 3D modelling and rendering package. It is the in-house software of a high quality animation studio, Blender has proven to be an extremely fast and versatile design instrument. The software has a personal touch, offering a unique approach to the world of Three Dimensions. + +Use Blender to create TV commercials, to make technical visualizations, business graphics, to do some morphing, or design user interfaces. You can easy build and manage complex environments. The renderer is versatile and extremely fast. All basic animation principles (curves & keys) are well implemented. + +http://www.blender.org''') + +fw(''' +.SH OPTIONS''') + +fw("\n\n") + +lines = [line.rstrip() for line in blender_help.split("\n")] + +while lines: + l = lines.pop(0) + if l.startswith("Environment Variables:"): + fw('.SH "ENVIRONMENT VARIABLES"\n') + elif l.endswith(":"): # one line + fw('.SS "%s"\n\n' % l) + elif l.startswith("-") or l.startswith("/"): # can be multi line + + fw('.TP\n') + fw('.B %s\n' % man_format(l)) + + while lines: + # line with no + if lines[0].strip() and len(lines[0].lstrip()) == len(lines[0]): # no white space + break + + if not l: # second blank line + fw('.IP\n') + else: + fw('.br\n') + + l = lines.pop(0) + l = l[1:] # remove first whitespace (tab) + + fw('%s\n' % man_format(l)) + + else: + if not l.strip(): + fw('.br\n') + else: + fw('%s\n' % man_format(l)) + +# footer + +fw(''' +.br +.SH SEE ALSO +.B yafaray(1) + +.br +.SH AUTHORS +This manpage was written for a Debian GNU/Linux system by Daniel Mester + and updated by Cyril Brulebois + and Dan Eicher . +''') + +print("written:", filepath) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 97a3225f5c6..55428a4a241 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -67,7 +67,7 @@ #define MENU_SEP_HEIGHT 6 /* - * a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt + * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt * * uiBlahBlah() external function * ui_blah_blah() internal function diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9d22f3c5212..ca7065ca636 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/* a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt */ +/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */ #include #include diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index dbd2f817204..0433f76c846 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -212,7 +212,7 @@ IF(WITH_INSTALL) DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) INSTALL( - FILES ${CMAKE_SOURCE_DIR}/doc/blender.1 + FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 ) INSTALL( -- cgit v1.2.3 From 32ac21ab023ad90d994bac6a76aba0fa2da88176 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 13 Oct 2010 19:56:53 +0000 Subject: Fix #24234: Object deletion doesn't take into account its users (causes segfault) Clear SELECT flag when deleting object -- object could be used in other scenes, and some stuff (like translation) would be confused due to relations --- source/blender/editors/object/object_add.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 3ae1941035d..8661cbc680a 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -817,6 +817,10 @@ static int object_delete_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_bases) { if(base->object->type==OB_LAMP) islamp= 1; + + /* deselect object -- it could be used in other scenes */ + base->object->flag &= ~SELECT; + /* remove from current scene only */ ED_base_object_free_and_unlink(bmain, scene, base); } -- cgit v1.2.3 From a97af1449c60219f7a7647fd029e623427632c22 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 13 Oct 2010 21:53:37 +0000 Subject: Fix UnicodeEncodingError, which prevents netrender, reprojection and playback from working on Windows in certain situations. Users can set their machine name to something containing non-ascii characters. In Python this currently causes problem due to socket.gethostname() throwing UnicodeEncodingError. Work around this by not using platform.system() (which uses internally socket.gethostname()). See http://www.pasteall.org/16215 for backtrace --- release/scripts/io/netrender/slave.py | 7 ++++++- release/scripts/op/image.py | 8 ++++++-- release/scripts/op/screen_play_rendered_anim.py | 8 ++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py index 526bd0b254f..7b5ae5e1d3d 100644 --- a/release/scripts/io/netrender/slave.py +++ b/release/scripts/io/netrender/slave.py @@ -32,8 +32,13 @@ BLENDER_PATH = sys.argv[0] CANCEL_POLL_SPEED = 2 MAX_TIMEOUT = 10 INCREMENT_TIMEOUT = 1 +try: + system = platform.system() +except UnicodeEncodingError: + import sys + system = sys.platform -if platform.system() == 'Windows' and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5 +if system in ('Windows', 'win32') and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5 import ctypes def SetErrorMode(): val = ctypes.windll.kernel32.SetErrorMode(0x0002) diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index b897e7955a0..c6fbe7daf5f 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -32,13 +32,17 @@ class EditExternally(bpy.types.Operator): def _editor_guess(self, context): import platform - system = platform.system() + try: + system = platform.system() + except UnicodeEncodingError: + import sys + system = sys.platform image_editor = context.user_preferences.filepaths.image_editor # use image editor in the preferences when available. if not image_editor: - if system == 'Windows': + if system in ('Windows', 'win32'): image_editor = ["start"] # not tested! elif system == 'Darwin': image_editor = ["open"] diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 53421642129..7b0a81b859d 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -30,14 +30,18 @@ import os def guess_player_path(preset): import platform - system = platform.system() + try: + system = platform.system() + except UnicodeEncodingError: + import sys + system = sys.platform if preset == 'BLENDER24': player_path = "blender" if system == 'Darwin': test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender" - elif system == 'Windows': + elif system in ('Windows', 'win32'): test_path = "/Program Files/Blender Foundation/Blender/blender.exe" if os.path.exists(test_path): -- cgit v1.2.3 From a90f876948715be65354721fe0d244c739f81da4 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 13 Oct 2010 22:20:34 +0000 Subject: Fix for fix, not UnicodeEncodingError (where did I get that from?) but UnicodeDecodeError. --- release/scripts/io/netrender/slave.py | 2 +- release/scripts/op/image.py | 2 +- release/scripts/op/screen_play_rendered_anim.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py index 7b5ae5e1d3d..8629a38c04a 100644 --- a/release/scripts/io/netrender/slave.py +++ b/release/scripts/io/netrender/slave.py @@ -34,7 +34,7 @@ MAX_TIMEOUT = 10 INCREMENT_TIMEOUT = 1 try: system = platform.system() -except UnicodeEncodingError: +except UnicodeDecodeError: import sys system = sys.platform diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index c6fbe7daf5f..011b42b32e5 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -34,7 +34,7 @@ class EditExternally(bpy.types.Operator): import platform try: system = platform.system() - except UnicodeEncodingError: + except UnicodeDecodeError: import sys system = sys.platform diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 7b0a81b859d..244c3d4b332 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -32,7 +32,7 @@ def guess_player_path(preset): import platform try: system = platform.system() - except UnicodeEncodingError: + except UnicodeDecodeError: import sys system = sys.platform -- cgit v1.2.3 From be32cf8b3218eb0d52eadc99d31f12ed0bbc2ec7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 23:25:08 +0000 Subject: UNUSED() macro so -Wunused-parameter can be used with GCC without so many warnings. applied to python api and exotic.c, removed some args being passed down which were not needed. keyword args for new mathutils types were being ignored when they should raise an error. --- source/blender/blenkernel/BKE_utildefines.h | 6 ++ source/blender/blenkernel/intern/exotic.c | 14 ++--- source/blender/python/generic/IDProp.c | 9 +-- source/blender/python/generic/bgl.c | 10 ++-- source/blender/python/generic/blf_api.c | 27 ++++----- .../blender/python/generic/bpy_internal_import.c | 5 +- source/blender/python/generic/geometry.c | 26 ++++----- source/blender/python/generic/mathutils.c | 6 +- source/blender/python/generic/mathutils_color.c | 19 ++++--- source/blender/python/generic/mathutils_euler.c | 25 ++++---- source/blender/python/generic/mathutils_matrix.c | 17 ++++-- source/blender/python/generic/mathutils_quat.c | 21 ++++--- source/blender/python/generic/mathutils_vector.c | 4 +- source/blender/python/generic/noise.c | 66 +++++++++++----------- source/blender/python/intern/bpy.c | 10 ++-- source/blender/python/intern/bpy_app.c | 16 ++---- source/blender/python/intern/bpy_array.c | 10 ++-- source/blender/python/intern/bpy_interface.c | 4 +- source/blender/python/intern/bpy_operator.c | 10 ++-- source/blender/python/intern/bpy_operator_wrap.c | 2 +- source/blender/python/intern/bpy_rna.c | 54 +++++++++--------- source/blender/python/intern/bpy_rna.h | 2 +- source/blender/python/intern/bpy_rna_callback.c | 3 +- 23 files changed, 198 insertions(+), 168 deletions(-) diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 5a6a151afee..7450e31e263 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -44,6 +44,12 @@ #define STRINGIFY_ARG(x) #x #define STRINGIFY(x) STRINGIFY_ARG(x) +#ifdef __GNUC__ +# define UNUSED(x) x __attribute__((__unused__)) +#else +# define UNUSED(x) x +#endif + /* these values need to be hardcoded in structs, dna does not recognize defines */ /* also defined in DNA_space_types.h */ #ifndef FILE_MAXDIR diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 9dac409226b..c5431005b18 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -557,7 +557,7 @@ static int write_derivedmesh_stl(FILE *fpSTL, Object *ob, DerivedMesh *dm) return numfacets; } -static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me) +static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob) { int numfacets = 0; DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); @@ -572,7 +572,6 @@ static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me) void write_stl(Scene *scene, char *str) { Object *ob; - Mesh *me; Base *base; FILE *fpSTL; int numfacets = 0; @@ -605,9 +604,8 @@ void write_stl(Scene *scene, char *str) if (base->flag & SELECT) { ob = base->object; if (ob->type == OB_MESH) { - me = ob->data; - if (me) - numfacets += write_object_stl(fpSTL, scene, ob, me); + if(ob->data) + numfacets += write_object_stl(fpSTL, scene, ob); } } base= base->next; @@ -978,7 +976,7 @@ static int all_digits(char *str) return 1; } -static int dxf_get_layer_col(char *layer) +static int dxf_get_layer_col(char *UNUSED(layer)) { return 1; } @@ -1016,8 +1014,8 @@ static void myfgets(char *str, int len, FILE *fp) /* three types of enters, \n \r and \r\n */ if(c == '\n') break; if(c=='\r') { - c= getc(dxf_fp); // read the linefeed from stream - if(c != 10) ungetc(c, dxf_fp); // put back, if it's not one... + c= getc(fp); // read the linefeed from stream + if(c != 10) ungetc(c, fp); // put back, if it's not one... break; } } diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 9d865b1c63e..c64be00093c 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -24,6 +24,7 @@ */ #include "BKE_idprop.h" +#include "BKE_utildefines.h" #include "IDProp.h" #include "MEM_guardedalloc.h" @@ -177,12 +178,12 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) return 0; } -PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh) +PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure)) { return PyUnicode_FromString(self->prop->name); } -static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh) +static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUSED(closure)) { char *st; if (!PyUnicode_Check(value)) { @@ -860,7 +861,7 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent) static PyObject *IDArray_repr(BPy_IDArray *self) { - return PyUnicode_FromString("(ID Array)"); + return PyUnicode_FromFormat("(ID Array [%d])", self->prop->len); } @@ -1071,7 +1072,7 @@ static PyObject *IDGroup_Iter_iterself(PyObject *self) static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self) { - return PyUnicode_FromString("(ID Property Group)"); + return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name); } static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self) diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 8ac2107f8d2..86b7bc522fe 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -35,6 +35,8 @@ #include #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" + static char Method_Buffer_doc[] = "(type, dimensions, [template]) - Create a new Buffer object\n\n\ (type) - The format to store data in\n\ @@ -51,7 +53,7 @@ For example, passing [100, 100] will create a 2 dimensional\n\ square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\ buffer which is twice as deep as it is wide or high."; -static PyObject *Method_Buffer( PyObject * self, PyObject * args ); +static PyObject *Method_Buffer( PyObject * self, PyObject *args ); /* Buffer sequence methods */ @@ -99,7 +101,7 @@ PyTypeObject BGL_bufferType = { /* #ifndef __APPLE__ */ #define BGL_Wrap(nargs, funcname, ret, arg_list) \ -static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ +static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ @@ -108,7 +110,7 @@ static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ } #define BGLU_Wrap(nargs, funcname, ret, arg_list) \ -static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ +static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ @@ -181,7 +183,7 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf } #define MAX_DIMENSIONS 256 -static PyObject *Method_Buffer (PyObject *self, PyObject *args) +static PyObject *Method_Buffer (PyObject *UNUSED(self), PyObject *args) { PyObject *length_ob= NULL, *template= NULL; Buffer *buffer; diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c index a5f5f8815c7..66d8cdd923a 100644 --- a/source/blender/python/generic/blf_api.c +++ b/source/blender/python/generic/blf_api.c @@ -26,6 +26,7 @@ #include "blf_api.h" #include "../../blenfont/BLF_api.h" +#include "BKE_utildefines.h" static char py_blf_position_doc[] = ".. function:: position(fontid, x, y, z)\n" @@ -41,7 +42,7 @@ static char py_blf_position_doc[] = " :arg z: Z axis position to draw the text.\n" " :type z: float\n"; -static PyObject *py_blf_position(PyObject *self, PyObject *args) +static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args) { int fontid; float x, y, z; @@ -67,7 +68,7 @@ static char py_blf_size_doc[] = " :arg dpi: dots per inch value to use for drawing.\n" " :type dpi: int\n"; -static PyObject *py_blf_size(PyObject *self, PyObject *args) +static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args) { int fontid, size, dpi; @@ -90,7 +91,7 @@ static char py_blf_aspect_doc[] = " :arg aspect: The aspect ratio for text drawing to use.\n" " :type aspect: float\n"; -static PyObject *py_blf_aspect(PyObject *self, PyObject *args) +static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args) { float aspect; int fontid; @@ -114,7 +115,7 @@ static char py_blf_blur_doc[] = " :arg radius: The radius for blurring text (in pixels).\n" " :type radius: int\n"; -static PyObject *py_blf_blur(PyObject *self, PyObject *args) +static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args) { int blur, fontid; @@ -137,7 +138,7 @@ static char py_blf_draw_doc[] = " :arg text: the text to draw.\n" " :type text: string\n"; -static PyObject *py_blf_draw(PyObject *self, PyObject *args) +static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args) { char *text; int fontid; @@ -162,7 +163,7 @@ static char py_blf_dimensions_doc[] = " :return: the width and height of the text.\n" " :rtype: tuple of 2 floats\n"; -static PyObject *py_blf_dimensions(PyObject *self, PyObject *args) +static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args) { char *text; float r_width, r_height; @@ -196,7 +197,7 @@ static char py_blf_clipping_doc[] = " :arg ymax: Clip the drawing area by these bounds.\n" " :type ymax: float\n"; -static PyObject *py_blf_clipping(PyObject *self, PyObject *args) +static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args) { float xmin, ymin, xmax, ymax; int fontid; @@ -219,7 +220,7 @@ static char py_blf_disable_doc[] = " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n"; -static PyObject *py_blf_disable(PyObject *self, PyObject *args) +static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args) { int option, fontid; @@ -241,7 +242,7 @@ static char py_blf_enable_doc[] = " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n"; -static PyObject *py_blf_enable(PyObject *self, PyObject *args) +static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args) { int option, fontid; @@ -263,7 +264,7 @@ static char py_blf_rotation_doc[] = " :arg angle: The angle for text drawing to use.\n" " :type angle: float\n"; -static PyObject *py_blf_rotation(PyObject *self, PyObject *args) +static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args) { float angle; int fontid; @@ -294,7 +295,7 @@ static char py_blf_shadow_doc[] = " :arg a: Shadow color (alpha channel 0.0 - 1.0).\n" " :type a: float\n"; -static PyObject *py_blf_shadow(PyObject *self, PyObject *args) +static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args) { int level, fontid; float r, g, b, a; @@ -324,7 +325,7 @@ static char py_blf_shadow_offset_doc[] = " :arg y: Horizontal shadow offset value in pixels.\n" " :type y: float\n"; -static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args) +static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args) { int x, y, fontid; @@ -346,7 +347,7 @@ static char py_blf_load_doc[] = " :return: the new font's fontid or -1 if there was an error.\n" " :rtype: integer\n"; -static PyObject *py_blf_load(PyObject *self, PyObject *args) +static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) { char* filename; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 394c388394a..568cef0f676 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -30,6 +30,7 @@ #include "DNA_text_types.h" #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" /* UNUSED */ #include "BKE_text.h" /* txt_to_buf */ #include "BKE_main.h" #include "BKE_global.h" /* grr, only for G.sce */ @@ -191,7 +192,7 @@ PyObject *bpy_text_reimport( PyObject *module, int *found ) } -static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw) +static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw) { PyObject *exception, *err, *tb; char *name; @@ -244,7 +245,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k * our reload() module, to handle reloading in-memory scripts */ -static PyObject *blender_reload( PyObject * self, PyObject * module ) +static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module) { PyObject *exception, *err, *tb; PyObject *newmodule = NULL; diff --git a/source/blender/python/generic/geometry.c b/source/blender/python/generic/geometry.c index 0e98760314d..e0583cc0028 100644 --- a/source/blender/python/generic/geometry.c +++ b/source/blender/python/generic/geometry.c @@ -60,7 +60,7 @@ static char M_Geometry_BezierInterp_doc[] = ""; //---------------------------------INTERSECTION FUNCTIONS-------------------- //----------------------------------geometry.Intersect() ------------------- -static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_Intersect(PyObject *UNUSED(self), PyObject* args) { VectorObject *ray, *ray_off, *vec1, *vec2, *vec3; float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3]; @@ -133,7 +133,7 @@ static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args ) } //----------------------------------geometry.LineIntersect() ------------------- /* Line-Line intersection using algorithm from mathworld.wolfram.com */ -static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args) { PyObject * tuple; VectorObject *vec1, *vec2, *vec3, *vec4; @@ -201,7 +201,7 @@ static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args ) //---------------------------------NORMALS FUNCTIONS-------------------- //----------------------------------geometry.QuadNormal() ------------------- -static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_QuadNormal(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1; VectorObject *vec2; @@ -252,7 +252,7 @@ static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args ) } //----------------------------geometry.TriangleNormal() ------------------- -static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_TriangleNormal(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; float v1[3], v2[3], v3[3], e1[3], e2[3], n[3]; @@ -289,7 +289,7 @@ static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args ) //--------------------------------- AREA FUNCTIONS-------------------- //----------------------------------geometry.TriangleArea() ------------------- -static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; float v1[3], v2[3], v3[3]; @@ -335,7 +335,7 @@ static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args ) /*----------------------------------geometry.PolyFill() -------------------*/ /* PolyFill function, uses Blenders scanfill to fill multiple poly lines */ -static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq ) +static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLineSeq ) { PyObject *tri_list; /*return this list of tri's */ PyObject *polyLine, *polyVec; @@ -450,7 +450,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq ) } -static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_LineIntersect2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *line_a1, *line_a2, *line_b1, *line_b2; float a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y, xi, yi, a1,a2,b1,b2, newvec[2]; @@ -548,7 +548,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args ) Py_RETURN_NONE; } -static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_ClosestPointOnLine(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt, *line_1, *line_2; float pt_in[3], pt_out[3], l1[3], l2[3]; @@ -586,7 +586,7 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args return ret; } -static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_PointInTriangle2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3; @@ -606,7 +606,7 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)); } -static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_PointInQuad2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4; @@ -690,7 +690,7 @@ static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray) } -static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist ) +static PyObject *M_Geometry_BoxPack2D(PyObject *UNUSED(self), PyObject * boxlist ) { boxPack *boxarray = NULL; float tot_width, tot_height; @@ -718,7 +718,7 @@ static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist ) return Py_BuildValue( "ff", tot_width, tot_height); } -static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_BezierInterp(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2; int resolu; @@ -767,7 +767,7 @@ static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args ) return list; } -static PyObject *M_Geometry_BarycentricTransform(PyObject * self, PyObject * args) +static PyObject *M_Geometry_BarycentricTransform(PyObject *UNUSED(self), PyObject *args) { VectorObject *vec_pt; VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar; diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index e81bc0cf239..540a9831dce 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -61,6 +61,8 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" + //-------------------------DOC STRINGS --------------------------- static char M_Mathutils_doc[] = "This module provides access to matrices, eulers, quaternions and vectors."; @@ -203,7 +205,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) /* BaseMathObject generic functions for all mathutils types */ char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly)."; -PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type ) +PyObject *BaseMathObject_getOwner(BaseMathObject *UNUSED(self), void *UNUSED(type)) { PyObject *ret= self->cb_user ? self->cb_user : Py_None; Py_INCREF(ret); @@ -211,7 +213,7 @@ PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type ) } char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean"; -PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void *type ) +PyObject *BaseMathObject_getWrapped(BaseMathObject *UNUSED(self), void *UNUSED(type)) { return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0); } diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 57d2838238c..8380adef496 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -31,10 +31,15 @@ //----------------------------------mathutils.Color() ------------------- //makes a new color for you to play with -static PyObject *Color_new(PyTypeObject * type, PyObject * args, PyObject * kwargs) +static PyObject *Color_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { float col[3]= {0.0f, 0.0f, 0.0f}; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Color(): takes no keyword args"); + return NULL; + } + switch(PyTuple_GET_SIZE(args)) { case 0: break; @@ -83,7 +88,7 @@ static char Color_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n"; -static PyObject *Color_copy(ColorObject * self, PyObject *args) +static PyObject *Color_copy(ColorObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -158,7 +163,7 @@ static PyObject* Color_richcmpr(PyObject *objectA, PyObject *objectB, int compar //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Color_len(ColorObject * self) +static int Color_len(ColorObject *UNUSED(self)) { return COLOR_SIZE; } @@ -394,7 +399,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type } /* color channel (HSV), color.h/s/v */ -static PyObject *Color_getHSV(ColorObject * self, void *type) +static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure)) { float hsv[3]; PyObject *ret; @@ -411,7 +416,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *type) return ret; } -static int Color_setHSV(ColorObject * self, PyObject * value, void * type) +static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure)) { float hsv[3]; @@ -452,8 +457,8 @@ static PyGetSetDef Color_getseters[] = { //-----------------------METHOD DEFINITIONS ---------------------- static struct PyMethodDef Color_methods[] = { - {"__copy__", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc}, - {"copy", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc}, + {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, + {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index f85578dd31d..c7091347493 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -39,7 +39,7 @@ //----------------------------------mathutils.Euler() ------------------- //makes a new euler for you to play with -static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwargs) +static PyObject *Euler_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *seq= NULL; char *order_str= NULL; @@ -47,6 +47,11 @@ static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwar float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f}; short order= EULER_ORDER_XYZ; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Euler(): takes no keyword args"); + return NULL; + } + if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) return NULL; @@ -313,7 +318,7 @@ static char Euler_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n"; -static PyObject *Euler_copy(EulerObject * self, PyObject *args) +static PyObject *Euler_copy(EulerObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -388,7 +393,7 @@ static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int compar //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Euler_len(EulerObject * self) +static int Euler_len(EulerObject *UNUSED(self)) { return EULER_SIZE; } @@ -411,7 +416,7 @@ static PyObject *Euler_item(EulerObject * self, int i) } //----------------------------object[]------------------------- //sequence accessor (set) -static int Euler_ass_item(EulerObject * self, int i, PyObject * value) +static int Euler_ass_item(EulerObject * self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); @@ -577,18 +582,18 @@ static PyMappingMethods Euler_AsMapping = { /* * euler axis, euler.x/y/z */ -static PyObject *Euler_getAxis( EulerObject * self, void *type ) +static PyObject *Euler_getAxis(EulerObject *self, void *type ) { return Euler_item(self, GET_INT_FROM_POINTER(type)); } -static int Euler_setAxis( EulerObject * self, PyObject * value, void * type ) +static int Euler_setAxis(EulerObject *self, PyObject *value, void *type) { return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value); } /* rotation order */ -static PyObject *Euler_getOrder(EulerObject *self, void *type) +static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure)) { const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"}; @@ -598,7 +603,7 @@ static PyObject *Euler_getOrder(EulerObject *self, void *type) return PyUnicode_FromString(order[self->order-EULER_ORDER_XYZ]); } -static int Euler_setOrder( EulerObject * self, PyObject * value, void * type ) +static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closure)) { char *order_str= _PyUnicode_AsString(value); short order= euler_order_from_string(order_str, "euler.order"); @@ -634,8 +639,8 @@ static struct PyMethodDef Euler_methods[] = { {"to_quat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc}, {"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc}, {"make_compatible", (PyCFunction) Euler_MakeCompatible, METH_O, Euler_MakeCompatible_doc}, - {"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc}, - {"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc}, + {"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc}, + {"copy", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index 3b8c7d3122a..9476e8127b6 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -108,7 +108,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = { //----------------------------------mathutils.Matrix() ----------------- //mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. //create a new matrix type -static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *argObject, *m, *s; MatrixObject *mat; @@ -117,6 +117,11 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; float scalar; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): takes no keyword args"); + return NULL; + } + argSize = PyTuple_GET_SIZE(args); if(argSize > MATRIX_MAX_DIM) { //bad arg nums PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n"); @@ -1142,7 +1147,7 @@ static char Matrix_copy_doc[] = " :return: an instance of itself\n" " :rtype: :class:`Matrix`\n"; -PyObject *Matrix_copy(MatrixObject * self) +PyObject *Matrix_copy(MatrixObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -1680,17 +1685,17 @@ static PyNumberMethods Matrix_NumMethods = { 0, /* nb_index */ }; -static PyObject *Matrix_getRowSize( MatrixObject * self, void *type ) +static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure)) { return PyLong_FromLong((long) self->rowSize); } -static PyObject *Matrix_getColSize( MatrixObject * self, void *type ) +static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure)) { return PyLong_FromLong((long) self->colSize); } -static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type ) +static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)) { float mat[3][3]; @@ -1710,7 +1715,7 @@ static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type ) return PyFloat_FromDouble(mat3_to_scale(mat)); } -static PyObject *Matrix_getIsNegative( MatrixObject * self, void *type ) +static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index 553844b6ee5..37f20ebbe31 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -352,7 +352,7 @@ static char Quaternion_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n"; -static PyObject *Quaternion_copy(QuaternionObject * self) +static PyObject *Quaternion_copy(QuaternionObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -429,7 +429,7 @@ static PyObject* Quaternion_richcmpr(PyObject *objectA, PyObject *objectB, int c //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Quaternion_len(QuaternionObject * self) +static int Quaternion_len(QuaternionObject *UNUSED(self)) { return QUAT_SIZE; } @@ -772,7 +772,7 @@ static int Quaternion_setAxis( QuaternionObject * self, PyObject * value, void * return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value); } -static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type ) +static PyObject *Quaternion_getMagnitude(QuaternionObject * self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -780,7 +780,7 @@ static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type ) return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat))); } -static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type ) +static PyObject *Quaternion_getAngle(QuaternionObject * self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -788,7 +788,7 @@ static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type ) return PyFloat_FromDouble(2.0 * (saacos(self->quat[0]))); } -static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * type) +static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *UNUSED(closure)) { float axis[3]; float angle; @@ -821,7 +821,7 @@ static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * return 0; } -static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type) +static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(closure)) { float axis[3]; float angle; @@ -842,7 +842,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type) return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL); } -static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *type) +static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure)) { float axis[3]; float angle; @@ -872,12 +872,17 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void * } //----------------------------------mathutils.Quaternion() -------------- -static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Quaternion_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *seq= NULL; float angle = 0.0f; float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f}; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Quaternion(): takes no keyword args"); + return NULL; + } + if(!PyArg_ParseTuple(args, "|Of:mathutils.Quaternion", &seq, &angle)) return NULL; diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index 1fe2518c6ef..84f41b6e66a 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -45,7 +45,7 @@ static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits); //----------------------------------mathutils.Vector() ------------------ // Supports 2D, 3D, and 4D vector objects both int and float values // accepted. Mixed float and int values accepted. Ints are parsed to float -static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f}; int size= 3; /* default to a 3D vector */ @@ -1445,7 +1445,7 @@ static int Vector_setAxis(VectorObject *self, PyObject * value, void * type ) } /* vector.length */ -static PyObject *Vector_getLength(VectorObject *self, void *type ) +static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) { double dot = 0.0f; int i; diff --git a/source/blender/python/generic/noise.c b/source/blender/python/generic/noise.c index 4a09cbb58d8..a9bbc016a54 100644 --- a/source/blender/python/generic/noise.c +++ b/source/blender/python/generic/noise.c @@ -39,6 +39,8 @@ #include "BLI_blenlib.h" #include "DNA_texture_types.h" + +#include "BKE_utildefines.h" /*-----------------------------------------*/ /* 'mersenne twister' random number generator */ @@ -207,12 +209,12 @@ static void randuvec(float v[3]) v[2] = 1.f; } -static PyObject *Noise_random(PyObject * self) +static PyObject *Noise_random(PyObject *UNUSED(self)) { return PyFloat_FromDouble(frand()); } -static PyObject *Noise_random_unit_vector(PyObject * self) +static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)) { float v[3] = {0.0f, 0.0f, 0.0f}; randuvec(v); @@ -223,7 +225,7 @@ static PyObject *Noise_random_unit_vector(PyObject * self) /* Random seed init. Only used for MT random() & randuvec() */ -static PyObject *Noise_seed_set(PyObject * self, PyObject * args) +static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args) { int s; if(!PyArg_ParseTuple(args, "i:seed_set", &s)) @@ -236,7 +238,7 @@ static PyObject *Noise_seed_set(PyObject * self, PyObject * args) /* General noise */ -static PyObject *Noise_noise(PyObject * self, PyObject * args) +static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int nb = 1; @@ -260,7 +262,7 @@ static void noise_vector(float x, float y, float z, int nb, float v[3]) nb) - 1.0); } -static PyObject *Noise_vector(PyObject * self, PyObject * args) +static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int nb = 1; @@ -296,7 +298,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, return out; } -static PyObject *Noise_turbulence(PyObject * self, PyObject * args) +static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int oct, hd, nb = 1; @@ -340,7 +342,7 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb, } } -static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args) +static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int oct, hd, nb = 1; @@ -355,7 +357,7 @@ static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args) /* F. Kenton Musgrave's fractal functions */ -static PyObject *Noise_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; @@ -366,7 +368,7 @@ static PyObject *Noise_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; @@ -378,7 +380,7 @@ static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_vl_vector(PyObject * self, PyObject * args) +static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, d; int nt1 = 1, nt2 = 1; @@ -389,7 +391,7 @@ static PyObject *Noise_vl_vector(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args) +static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs; int nb = 1; @@ -401,7 +403,7 @@ static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; @@ -413,7 +415,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; @@ -424,7 +426,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_voronoi(PyObject * self, PyObject * args) +static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) { float x, y, z, da[4], pa[12]; int dtype = 0; @@ -441,7 +443,7 @@ static PyObject *Noise_voronoi(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_cell(PyObject * self, PyObject * args) +static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args) { float x, y, z; if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z)) @@ -452,7 +454,7 @@ static PyObject *Noise_cell(PyObject * self, PyObject * args) /*--------------------------------------------------------------------------*/ -static PyObject *Noise_cell_vector(PyObject * self, PyObject * args) +static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, ca[3]; if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z)) @@ -603,22 +605,22 @@ look like anything from an earthquake to a very nervous or maybe even drunk came /* Just in case, declarations for a header file */ /* -static PyObject *Noise_random(PyObject *self); -static PyObject *Noise_random_unit_vector(PyObject *self); -static PyObject *Noise_seed_set(PyObject *self, PyObject *args); -static PyObject *Noise_noise(PyObject *self, PyObject *args); -static PyObject *Noise_vector(PyObject *self, PyObject *args); -static PyObject *Noise_turbulence(PyObject *self, PyObject *args); -static PyObject *Noise_turbulence_vector(PyObject *self, PyObject *args); -static PyObject *Noise_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_vl_vector(PyObject *self, PyObject *args); -static PyObject *Noise_hetero_terrain(PyObject *self, PyObject *args); -static PyObject *Noise_hybrid_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_ridged_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_voronoi(PyObject *self, PyObject *args); -static PyObject *Noise_cell(PyObject *self, PyObject *args); -static PyObject *Noise_cell_vector(PyObject *self, PyObject *args); +static PyObject *Noise_random(PyObject *UNUSED(self)); +static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)); +static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args); */ static PyMethodDef NoiseMethods[] = { diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 69b5faceca0..afcf7e757e6 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -34,7 +34,9 @@ #include "BLI_path_util.h" #include "BLI_bpath.h" - + +#include "BKE_utildefines.h" + /* external util modules */ #include "../generic/geometry.h" #include "../generic/bgl.h" @@ -51,7 +53,7 @@ static char bpy_script_paths_doc[] = " :return: (system, user) strings will be empty when not found.\n" " :rtype: tuple of strigs\n"; -PyObject *bpy_script_paths(PyObject *self) +PyObject *bpy_script_paths(PyObject *UNUSED(self)) { PyObject *ret= PyTuple_New(2); char *path; @@ -73,7 +75,7 @@ static char bpy_blend_paths_doc[] = " :type absolute: boolean\n" " :return: path list.\n" " :rtype: list of strigs\n"; -static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw) +static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { struct BPathIterator bpi; PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */ @@ -124,7 +126,7 @@ static char bpy_user_resource_doc[] = " :type subdir: string\n" " :return: a path.\n" " :rtype: string\n"; -static PyObject *bpy_user_resource(PyObject * self, PyObject *args, PyObject *kw) +static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { char *type; char *subdir= NULL; diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 6c4e190673c..46a3c93292b 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -26,6 +26,7 @@ #include "BLI_path_util.h" +#include "BKE_utildefines.h" #include "BKE_blender.h" #include "BKE_global.h" #include "structseq.h" @@ -116,21 +117,15 @@ static PyObject *make_app_info(void) /* a few getsets because it makes sense for them to be in bpy.app even though * they are not static */ -static PyObject *bpy_app_debug_get(PyObject *self, void *closure) +static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)) { - (void)(self); - (void)(closure); - return PyBool_FromLong(G.f & G_DEBUG); } -static int bpy_app_debug_set(PyObject *self, PyObject *value, void *closure) +static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) { int param= PyObject_IsTrue(value); - (void)(self); - (void)(closure); - if(param < 0) { PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); return -1; @@ -142,12 +137,9 @@ static int bpy_app_debug_set(PyObject *self, PyObject *value, void *closure) return 0; } -static PyObject *bpy_app_tempdir_get(PyObject *self, void *closure) +static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) { extern char btempdir[]; - (void)(self); - (void)(closure); - return PyC_UnicodeFromByte(btempdir); } diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c index 6d971d8708e..d219757b777 100644 --- a/source/blender/python/intern/bpy_array.c +++ b/source/blender/python/intern/bpy_array.c @@ -237,7 +237,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int return data; } -static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) +static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) { int totdim, dim_size[MAX_ARRAY_DIMENSION]; int totitem; @@ -358,18 +358,18 @@ static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void * RNA_property_boolean_set_index(ptr, prop, index, *(int*)value); } -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix) +int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix) { int ret; switch (RNA_property_type(prop)) { case PROP_FLOAT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); break; case PROP_INT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); break; case PROP_BOOLEAN: - ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); break; default: PyErr_SetString(PyExc_TypeError, "not an array type"); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index bc79ba94756..3ff0d86b433 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -43,6 +43,7 @@ #include "BLI_math_base.h" #include "BLI_string.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" #include "BKE_font.h" /* only for utf8towchar */ @@ -104,7 +105,8 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) } } -void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate) +/* context should be used but not now because it causes some bugs */ +void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) { py_call_level--; diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 2b475a57de6..3ffa78dab70 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -40,7 +40,7 @@ #include "MEM_guardedalloc.h" #include "BKE_report.h" -static PyObject *pyop_poll( PyObject * self, PyObject * args) +static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; char *opname; @@ -80,7 +80,7 @@ static PyObject *pyop_poll( PyObject * self, PyObject * args) return ret; } -static PyObject *pyop_call( PyObject * self, PyObject * args) +static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; int error_val = 0; @@ -196,7 +196,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) } -static PyObject *pyop_as_string( PyObject * self, PyObject * args) +static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; PointerRNA ptr; @@ -248,7 +248,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args) return pybuf; } -static PyObject *pyop_dir(PyObject *self) +static PyObject *pyop_dir(PyObject *UNUSED(self)) { PyObject *list = PyList_New(0), *name; wmOperatorType *ot; @@ -262,7 +262,7 @@ static PyObject *pyop_dir(PyObject *self) return list; } -static PyObject *pyop_getrna(PyObject *self, PyObject *value) +static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value) { wmOperatorType *ot; PointerRNA ptr; diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 6d16896fb16..fa1aeacbc42 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -84,7 +84,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata) operator_properties_init(ot); } -PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args) +PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; wmOperatorTypeMacro *otmacro; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b49a48699fa..a3b0c4739c4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -58,7 +58,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix); +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix); static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length); static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self); static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self); @@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int return 1; } -static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = { /* bpyrna matrix callbacks */ static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */ -static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha break; } } else { - if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) { + if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) { error_val= -1; break; } @@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func) -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix) +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix) { /* XXX hard limits should be checked here */ int type = RNA_property_type(prop); @@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p return -1; } /* done getting the length */ - ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix); + ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix); if (!ok) { /* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */ @@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons } /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */ -static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length) +static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop) { PointerRNA newptr; PyObject *list = PyList_New(stop - start); @@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject return PyList_New(0); } else if (step == 1) { - return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len); + return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop); } else { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna"); @@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] = " :return: a new instance of this object with the type initialized again.\n" " :rtype: subclass of :class:`bpy_struct`"; -static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args) +static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { PointerRNA r_ptr; RNA_pointer_recast(&self->ptr, &r_ptr); @@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported"); return -1; } - return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:"); + return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:"); } else { return PyObject_GenericSetAttr((PyObject *)self, pyname, value); @@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { if ((prop = RNA_struct_find_property(&r_ptr, name))) { /* pyrna_py_to_prop sets its own exceptions */ - return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); + return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); } } @@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = { /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_StructRNA *base; @@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_PropertyRNA *base; @@ -3454,7 +3454,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k } } -PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data) +PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) { PyObject *ret; int type = RNA_property_type(prop); @@ -3704,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) continue; } - err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, ""); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, ""); if(err!=0) { /* the error generated isnt that useful, so generate it again with a useful prefix @@ -3717,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) else snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id); - pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix); + pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix); break; } @@ -3822,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) flag= RNA_property_flag(parm); if (flag & PROP_OUTPUT) - PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data)); + PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data)); } RNA_parameter_list_end(&iter); } else - ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single); + ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single); /* possible there is an error in conversion */ if(ret==NULL) @@ -5012,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if(strcmp(identifier, rna_attr) == 0) { \ item= PyObject_GetAttrString(py_class, py_attr); \ if(item && item != Py_None) { \ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \ + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \ Py_DECREF(item); \ return -1; \ } \ @@ -5036,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun else { Py_DECREF(item); /* no need to keep a ref, the class owns it */ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) return -1; } } @@ -5156,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par continue; } - parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data); + parmitem= pyrna_param_to_py(&funcptr, parm, iter.data); PyTuple_SET_ITEM(args, i, parmitem); i++; } @@ -5191,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par err= -1; } else if(ret_len==1) { - err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:"); + err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:"); } else if (ret_len > 1) { @@ -5214,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par /* only useful for single argument returns, we'll need another list loop for multiple */ if (flag & PROP_OUTPUT) { - err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); if(err) break; } @@ -5328,7 +5328,7 @@ void pyrna_free_types(void) * - Should still be fixed - Campbell * */ -static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; ReportList reports; @@ -5425,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN return 0; } -static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; StructUnregisterFunc unreg; diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 7f750f94242..77b602b6f83 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -99,7 +99,7 @@ void pyrna_alloc_types(void); void pyrna_free_types(void); /* primitive type conversion */ -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix); +int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix); int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix); PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index); diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index b2a7511f998..81d6e0cd4da 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -27,6 +27,7 @@ #include "bpy_util.h" #include "DNA_screen_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_space_api.h" @@ -34,7 +35,7 @@ #define RNA_CAPSULE_ID "RNA_HANDLE" #define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED" -void cb_region_draw(const bContext *C, ARegion *ar, void *customdata) +void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata) { PyObject *cb_func, *cb_args, *result; PyGILState_STATE gilstate; -- cgit v1.2.3 From 99711586482f2b23651983ed7dd69e138e616480 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 23:46:42 +0000 Subject: use UNUSED() macro for the console space + minor changes to args. --- .../blender/editors/space_console/console_draw.c | 8 ++++---- .../blender/editors/space_console/console_intern.h | 4 ++-- source/blender/editors/space_console/console_ops.c | 24 +++++++++++----------- .../blender/editors/space_console/console_report.c | 10 ++++----- .../blender/editors/space_console/space_console.c | 10 ++++----- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index d5ffb34b3a2..edbb539e836 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -133,7 +133,7 @@ typedef struct ConsoleDrawContext { int draw; } ConsoleDrawContext; -static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int console_width, int lheight) +static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { if(sel[0] <= str_len_draw && sel[1] >= 0) { int sta = MAX2(sel[0], 0); @@ -222,7 +222,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { STEP_SEL(-initial_offset); // glColor4ub(255, 0, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); glColor3ubv(fg); } @@ -240,7 +240,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { // glColor4ub(0, 255, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); glColor3ubv(fg); } @@ -272,7 +272,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { int isel[2]= {str_len - cdc->sel[1], str_len - cdc->sel[0]}; // glColor4ub(255, 255, 0, 96); // debug - console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); STEP_SEL(-(str_len + 1)); } diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index 0e2c35bcf83..1a48dd408bd 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -47,8 +47,8 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dumm /* console_ops.c */ void console_history_free(SpaceConsole *sc, ConsoleLine *cl); void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl); -ConsoleLine *console_history_add_str(const struct bContext *C, char *str, int own); -ConsoleLine *console_scrollback_add_str(const struct bContext *C, char *str, int own); +ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, int own); +ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, int own); ConsoleLine *console_history_verify(const struct bContext *C); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index c36cbc38640..2b419b0a833 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -194,7 +194,7 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from) } #endif -static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C, char *str, int own) +static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own) { ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add"); if(own) ci->line= str; @@ -205,14 +205,13 @@ static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C BLI_addtail(lb, ci); return ci; } -ConsoleLine *console_history_add_str(const bContext *C, char *str, int own) +ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, int own) { - return console_lb_add_str__internal(&CTX_wm_space_console(C)->history, C, str, own); + return console_lb_add_str__internal(&sc->history, str, own); } -ConsoleLine *console_scrollback_add_str(const bContext *C, char *str, int own) +ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, int own) { - SpaceConsole *sc= CTX_wm_space_console(C); - ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, C, str, own); + ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, str, own); console_select_offset(sc, ci->len + 1); return ci; } @@ -627,7 +626,7 @@ static int history_append_exec(bContext *C, wmOperator *op) } } - ci= console_history_add_str(C, str, 1); /* own the string */ + ci= console_history_add_str(sc, str, 1); /* own the string */ console_select_offset(sc, ci->len - prev_len); console_line_cursor_set(ci, cursor); @@ -663,7 +662,7 @@ static int scrollback_append_exec(bContext *C, wmOperator *op) char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */ int type= RNA_enum_get(op->ptr, "type"); - ci= console_scrollback_add_str(C, str, 1); /* own the string */ + ci= console_scrollback_add_str(sc, str, 1); /* own the string */ ci->type= type; console_scrollback_limit(sc); @@ -698,7 +697,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot) } -static int copy_exec(bContext *C, wmOperator *op) +static int copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); int buf_len; @@ -779,7 +778,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot) /* properties */ } -static int paste_exec(bContext *C, wmOperator *op) +static int paste_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ConsoleLine *ci= console_history_verify(C); @@ -834,7 +833,8 @@ typedef struct SetConsoleCursor { int sel_init; } SetConsoleCursor; -static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int sel) +// TODO, cursor placement without selection +static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel)) { int pos; pos= console_char_pick(sc, ar, NULL, mval); @@ -869,7 +869,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve ED_area_tag_redraw(CTX_wm_area(C)); } -static void set_cursor_exit(bContext *C, wmOperator *op) +static void set_cursor_exit(bContext *UNUSED(C), wmOperator *op) { // SpaceConsole *sc= CTX_wm_space_console(C); SetConsoleCursor *scu= op->customdata; diff --git a/source/blender/editors/space_console/console_report.c b/source/blender/editors/space_console/console_report.c index 51bffa5b981..6483177a045 100644 --- a/source/blender/editors/space_console/console_report.c +++ b/source/blender/editors/space_console/console_report.c @@ -72,7 +72,7 @@ static int console_report_poll(bContext *C) return 1; } -static int report_replay_exec(bContext *C, wmOperator *op) +static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -83,7 +83,7 @@ static int report_replay_exec(bContext *C, wmOperator *op) for(report=reports->list.last; report; report=report->prev) { if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) { - console_history_add_str(C, report->message, 0); + console_history_add_str(sc, report->message, 0); WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); ED_area_tag_redraw(CTX_wm_area(C)); @@ -165,7 +165,7 @@ void CONSOLE_OT_select_pick(wmOperatorType *ot) -static int report_select_all_toggle_exec(bContext *C, wmOperator *op) +static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -314,7 +314,7 @@ void CONSOLE_OT_select_border(wmOperatorType *ot) -static int report_delete_exec(bContext *C, wmOperator *op) +static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -359,7 +359,7 @@ void CONSOLE_OT_report_delete(wmOperatorType *ot) } -static int report_copy_exec(bContext *C, wmOperator *op) +static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index c30897bbb87..7a913fc28c0 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -67,7 +67,7 @@ static void console_update_rect(const bContext *C, ARegion *ar) /* ******************** default callbacks for console space ***************** */ -static SpaceLink *console_new(const bContext *C) +static SpaceLink *console_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceConsole *sconsole; @@ -121,7 +121,7 @@ static void console_free(SpaceLink *sl) /* spacetype; init callback */ -static void console_init(struct wmWindowManager *wm, ScrArea *sa) +static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -162,7 +162,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) /* ************* dropboxes ************* */ -static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event)) { SpaceConsole *sc= CTX_wm_space_console(C); if(sc->type==CONSOLE_TYPE_PYTHON) @@ -182,7 +182,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "text", text); } -static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event)) { SpaceConsole *sc= CTX_wm_space_console(C); if(sc->type==CONSOLE_TYPE_PYTHON) @@ -361,7 +361,7 @@ void console_keymap(struct wmKeyConfig *keyconf) /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void console_header_area_init(wmWindowManager *wm, ARegion *ar) +static void console_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } -- cgit v1.2.3 From f6a7205be50237c769933f070ad439ab283e5f8c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 00:33:39 +0000 Subject: bugfix [#22161] Drawing of custom shapes in bones --- source/blender/blenloader/intern/readfile.c | 4 ++-- source/blender/editors/space_view3d/drawarmature.c | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 22641d51ed9..b6c1bd1c7bc 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1384,8 +1384,8 @@ static void test_pointer_array(FileData *fd, void **mat) /* ************ READ ID Properties *************** */ -void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); -void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); +static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); +static void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData *fd) { diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index c6aa4656191..71e52e723c5 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1565,7 +1565,7 @@ static void bone_matrix_translate_y(float mat[][4], float y) } /* assumes object is Armature with pose */ -static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt) +static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, short ghost) { RegionView3D *rv3d= ar->regiondata; Object *ob= base->object; @@ -1706,9 +1706,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* prepare colors */ - if (arm->flag & ARM_POSEMODE) + if(ghost) { + /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */ + } + else if (arm->flag & ARM_POSEMODE) set_pchan_colorset(ob, pchan); -#if 0 // XXX - 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) else { if ((scene->basact)==base) { if (base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE); @@ -1719,7 +1721,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, else UI_ThemeColor(TH_WIRE); } } -#endif /* catch exception for bone with hidden parent */ flag= bone->flag; @@ -2211,7 +2212,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2290,7 +2291,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2360,7 +2361,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } } @@ -2375,7 +2376,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } } } @@ -2409,7 +2410,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in /* we use color for solid lighting */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); - glColor3ub(0,0,0); // clear spec + glColor3ub(255,0,255); // clear spec glDisable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); @@ -2458,7 +2459,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in } } } - draw_pose_bones(scene, v3d, ar, base, dt); + draw_pose_bones(scene, v3d, ar, base, dt, FALSE); arm->flag &= ~ARM_POSEMODE; if(ob->mode & OB_MODE_POSE) -- cgit v1.2.3 From a9197c3aa21a5b5368e03feffd5b8d27c156b8fb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 01:22:14 +0000 Subject: remove unused args in draw*.c and some in view*.c, tag some as UNUSED(). --- source/blender/editors/animation/anim_draw.c | 2 +- source/blender/editors/gpencil/drawgpencil.c | 4 +- source/blender/editors/include/UI_view2d.h | 10 +- source/blender/editors/interface/view2d.c | 31 +++--- source/blender/editors/screen/area.c | 6 +- source/blender/editors/space_action/space_action.c | 12 +-- .../blender/editors/space_buttons/space_buttons.c | 2 +- .../blender/editors/space_console/space_console.c | 2 +- source/blender/editors/space_file/space_file.c | 4 +- source/blender/editors/space_graph/space_graph.c | 12 +-- source/blender/editors/space_image/space_image.c | 2 +- source/blender/editors/space_logic/space_logic.c | 2 +- source/blender/editors/space_nla/space_nla.c | 14 +-- source/blender/editors/space_node/drawnode.c | 112 ++++++++++----------- source/blender/editors/space_node/node_draw.c | 4 +- source/blender/editors/space_outliner/outliner.c | 2 +- source/blender/editors/space_script/space_script.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 12 +-- source/blender/editors/space_sound/space_sound.c | 4 +- source/blender/editors/space_text/space_text.c | 2 +- source/blender/editors/space_time/space_time.c | 8 +- source/blender/editors/space_view3d/drawanimviz.c | 6 +- source/blender/editors/space_view3d/drawarmature.c | 54 +++++----- source/blender/editors/space_view3d/drawmesh.c | 4 +- source/blender/editors/space_view3d/drawobject.c | 79 +++++++-------- source/blender/editors/space_view3d/drawvolume.c | 2 +- .../blender/editors/space_view3d/view3d_header.c | 2 +- .../blender/editors/space_view3d/view3d_intern.h | 10 +- 28 files changed, 202 insertions(+), 204 deletions(-) diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index b564780f6c0..373ad5472ab 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -256,7 +256,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) /* Draw current frame number in a little box */ if (flag & DRAWCFRA_SHOW_NUMBOX) { - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1); draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS)); } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index e6a1f58096a..e19f774412b 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -199,7 +199,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl } /* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */ -static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy) +static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short debug) { bGPDspoint *pt; float oldpressure = 0.0f; @@ -501,7 +501,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int if (gps->totpoints == 1) gp_draw_stroke_point(gps->points, lthick, gps->flag, offsx, offsy, winx, winy); else if (dflag & GP_DRAWDATA_ONLY3D) - gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy); + gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug); else if (gps->totpoints > 1) gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy); } diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index bf4a3de9cc6..9afa7dd012a 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -156,14 +156,14 @@ void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, int int UI_view2d_tab_set(struct View2D *v2d, int tab); /* view matrix operations */ -void UI_view2d_view_ortho(const struct bContext *C, struct View2D *v2d); -void UI_view2d_view_orthoSpecial(const struct bContext *C, struct View2D *v2d, short xaxis); +void UI_view2d_view_ortho(struct View2D *v2d); +void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short xaxis); void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ -View2DGrid *UI_view2d_grid_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); -void UI_view2d_grid_draw(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag); -void UI_view2d_constant_grid_draw(const struct bContext *C, struct View2D *v2d); +View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); +void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag); +void UI_view2d_constant_grid_draw(struct View2D *v2d); void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy); void UI_view2d_grid_free(View2DGrid *grid); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 14ec7c6d0d6..e0dc702bda0 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -967,7 +967,7 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked) } /* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */ -void UI_view2d_view_ortho(const bContext *C, View2D *v2d) +void UI_view2d_view_ortho(View2D *v2d) { rctf curmasked; float xofs, yofs; @@ -997,9 +997,8 @@ void UI_view2d_view_ortho(const bContext *C, View2D *v2d) /* Set view matrices to only use one axis of 'cur' only * - xaxis = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x) */ -void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis) +void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis) { - ARegion *ar= CTX_wm_region(C); rctf curmasked; float xofs, yofs; @@ -1098,12 +1097,12 @@ static void step_to_grid(float *step, int *power, int unit) * * - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames * - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals - * - winx = width of region we're drawing to + * - winx = width of region we're drawing to, note: not used but keeping for compleateness. * - winy = height of region we're drawing into */ -View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy) +View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) { - Scene *scene= CTX_data_scene(C); + View2DGrid *grid; float space, pixels, seconddiv; int secondgrid; @@ -1174,7 +1173,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh } /* Draw gridlines in the given 2d-region */ -void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int flag) +void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) { float vec1[2], vec2[2]; int a, step; @@ -1283,7 +1282,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f } /* Draw a constant grid in given 2d-region */ -void UI_view2d_constant_grid_draw(const bContext *C, View2D *v2d) +void UI_view2d_constant_grid_draw(View2D *v2d) { float start, step= 25.0f; @@ -1481,7 +1480,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short scrollers->yclamp= yclamp; scrollers->yunits= yunits; - scrollers->grid= UI_view2d_grid_calc(C, v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin)); + scrollers->grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin)); } /* return scrollers */ @@ -1489,7 +1488,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short } /* Print scale marking along a time scrollbar */ -static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, float y, float val, int power, short unit, char dir) +static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir) { int len; char str[32]; @@ -1614,16 +1613,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v switch (vs->xunits) { case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); break; case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); break; case V2D_UNIT_SECONDS: /* seconds */ fac2= val/(float)FPS; - scroll_printstr(vs, scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); + scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); break; case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */ @@ -1634,13 +1633,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v time= (float)floor(fac2); fac2= fac2-time; - scroll_printstr(vs, scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); + scroll_printstr(scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); } break; case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); break; } } @@ -1719,7 +1718,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v if(fac < vert.ymin+10) continue; - scroll_printstr(vs, scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); + scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); } BLF_disable_default(BLF_ROTATION); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7f5485ae8b6..e8fd2be324c 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1244,7 +1244,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex uiBeginPanels(C, ar); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); for(pt= ar->type->paneltypes.first; pt; pt= pt->next) { /* verify context */ @@ -1365,7 +1365,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT); /* set the view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* this does the actual drawing! */ uiEndPanels(C, ar); @@ -1414,7 +1414,7 @@ void ED_region_header(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); xco= maxco= 8; yco= HEADERY-3; diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 7b96618d923..01ae28a20d6 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -169,12 +169,12 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* time grid */ unit= (saction->flag & SACTION_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); /* data */ @@ -188,11 +188,11 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -228,7 +228,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data */ if (ANIM_animdata_get_context(C, &ac)) { diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index fcd66c43321..5927a7473e2 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -203,7 +203,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); buttons_header_buttons(C, ar); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 7a913fc28c0..70263788b13 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -227,7 +227,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar) console_update_rect(C, ar); /* worlks best with no view2d matrix set */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 0cd721964bd..52805c39816 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -335,7 +335,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) file_calc_previews(C, ar); /* set view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* on first read, find active file */ if (params->active_file == -1) { @@ -505,7 +505,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); file_draw_buttons(C, ar); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ca372d74da6..994d9725762 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -229,12 +229,12 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* grid */ unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE; - grid= UI_view2d_grid_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); /* draw data */ if (ANIM_animdata_get_context(C, &ac)) { @@ -282,11 +282,11 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -325,7 +325,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* draw channels */ if (ANIM_animdata_get_context(C, &ac)) { diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index a6deb73f2e7..250ece6d92a 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -768,7 +768,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) draw_image_main(sima, ar, scene); /* and uvs in 0.0-1.0 space */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); draw_uvedit_main(sima, ar, scene, obedit); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 01af324334b..5af5b5ee6c0 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -251,7 +251,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); logic_buttons((bContext *)C, ar); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 92c5ef6c410..2ae47ddbc7f 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -227,7 +227,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data */ if (ANIM_animdata_get_context(C, &ac)) { @@ -272,12 +272,12 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* time grid */ unit= (snla->flag & SNLA_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); /* data */ @@ -289,7 +289,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_text_cache_draw(ar); } - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* current frame */ if (snla->flag & SNLA_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; @@ -297,11 +297,11 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5e0926da216..16a2ac3c52e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -72,12 +72,12 @@ /* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */ -void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr) +void node_buts_group(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, ""); } -static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA sockptr; PropertyRNA *prop; @@ -89,7 +89,7 @@ static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(layout, &sockptr, "default_value", 0, "", 0); } -static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; PointerRNA sockptr; @@ -104,7 +104,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(col, &sockptr, "default_value", 0, "", 0); } -static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -116,7 +116,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA); } -static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; #if 0 @@ -138,12 +138,12 @@ static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(row, ptr, "frame_end", 0, "End", 0); } -static void node_buts_colorramp(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateColorRamp(layout, ptr, "color_ramp", 0); } -static void node_buts_curvevec(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0); } @@ -154,7 +154,7 @@ void node_curvemap_sample(float *col) _sample_col= col; } -static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; CurveMapping *cumap= node->storage; @@ -169,7 +169,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr) uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0); } -static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiBlock *block= uiLayoutAbsoluteBlock(layout); bNode *node= ptr->data; @@ -212,7 +212,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) node->menunr= 0; } #endif -static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) +static void node_dynamic_update_cb(bContext *C, void *UNUSED(ntree_v), void *node_v) { Main *bmain= CTX_data_main(C); Material *ma; @@ -244,7 +244,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) // XXX BIF_preview_changed(ID_MA); } -static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; @@ -263,7 +263,7 @@ static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr) } } -static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", 0); } @@ -297,7 +297,7 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v) node->menunr= 0; } -static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_material(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; uiLayout *col; @@ -312,7 +312,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "invert_normal", 0, NULL, 0); } -static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -338,12 +338,12 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA * } -static void node_shader_buts_vect_math(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", 0); } -static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_geometry(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA obptr= CTX_data_pointer_get(C, "active_object"); uiLayout *col; @@ -362,7 +362,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA } } -static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_dynamic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { Main *bmain= CTX_data_main(C); uiBlock *block= uiLayoutAbsoluteBlock(layout); @@ -457,7 +457,7 @@ static void node_shader_set_butfunc(bNodeType *ntype) /* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */ -static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_image(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; bNode *node= ptr->data; @@ -491,7 +491,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * uiItemR(col, ptr, "layer", 0, NULL, 0); } -static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_renderlayers(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; uiLayout *col, *row; @@ -524,7 +524,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point } -static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -548,7 +548,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *p } } -static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -572,7 +572,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA * uiItemR(layout, ptr, "zoom", 0, NULL, 0); } -static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -582,7 +582,7 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, Poin uiItemR(col, ptr, "sigma_space", 0, NULL, 0); } -static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *sub, *col; @@ -614,7 +614,7 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA } /* qdn: glare node */ -static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "glare_type", 0, "", 0); uiItemR(layout, ptr, "quality", 0, "", 0); @@ -644,7 +644,7 @@ static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA * } } -static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -663,7 +663,7 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA } } -static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -676,7 +676,7 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRN uiItemR(col, ptr, "use_fit", 0, NULL, 0); } -static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -692,17 +692,17 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA uiItemR(layout, ptr, "use_curved", 0, NULL, 0); } -static void node_composit_buts_filter(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filter_type", 0, "", 0); } -static void node_composit_buts_flip(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "axis", 0, "", 0); } -static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -723,7 +723,7 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p } } -static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; @@ -733,7 +733,7 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, Pointe uiItemR(col, ptr, "factor", 0, NULL, 0); } -static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *sub, *col; @@ -754,7 +754,7 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerR uiItemR(sub, ptr, "max", 0, "", 0); } -static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -763,7 +763,7 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerR uiItemR(col, ptr, "premul", 0, NULL, 0); } -static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -773,12 +773,12 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "distance", 0, NULL, 0); } -static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -787,7 +787,7 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, Pointer uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -796,7 +796,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, Poi uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; @@ -822,7 +822,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, Pointe } } -static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -836,7 +836,7 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, Point /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, 0); Removed for now*/ } -static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -846,7 +846,7 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, Pointe uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; @@ -872,7 +872,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, Poin uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -881,17 +881,17 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, Pointer uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_map_uv(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "alpha", 0, NULL, 0); } -static void node_composit_buts_id_mask(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "index", 0, NULL, 0); } -static void node_composit_buts_file_output(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; @@ -916,17 +916,17 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *C, Pointe uiItemR(row, ptr, "frame_end", 0, "End", 0); } -static void node_composit_buts_scale(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "space", 0, "", 0); } -static void node_composit_buts_rotate(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filter_type", 0, "", 0); } -static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -935,17 +935,17 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "invert_alpha", 0, NULL, 0); } -static void node_composit_buts_premulkey(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "mapping", 0, "", 0); } -static void node_composit_buts_view_levels(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "channel", UI_ITEM_R_EXPAND, NULL, 0); } -static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *split, *col, *row; @@ -990,7 +990,7 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, Point } -static void node_composit_buts_huecorrect(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0); } @@ -1143,7 +1143,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */ -static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -1156,7 +1156,7 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA * uiItemR(col, ptr, "squash_frequency", 0, "Frequency", 0); } -static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA tex_ptr; bNode *node= ptr->data; @@ -1210,12 +1210,12 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *pt } } -static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_image(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); } -static void node_texture_buts_output(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filepath", 0, "", 0); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index dfc63e032d9..8316d79c9f0 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1066,7 +1066,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); //uiFreeBlocksWin(&sa->uiblocks, sa->win); @@ -1078,7 +1078,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx); // XXX snode->curfont= uiSetCurFont_ext(snode->aspect); - UI_view2d_constant_grid_draw(C, v2d); + UI_view2d_constant_grid_draw(v2d); /* backdrop */ draw_nodespace_back_pix(ar, snode, color_manage); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 20b5ad7a34f..dc6b9f342b3 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -5659,7 +5659,7 @@ void draw_outliner(const bContext *C) UI_view2d_totRect_set(v2d, sizex, sizey); /* set matrix for 2d-view controls */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* draw outliner stuff (background, hierachy lines and names) */ outliner_back(ar, soops); diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index f93ddc6efbe..ce6edc3a565 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -145,7 +145,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py", NULL); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7c6fd83c6aa..eb61633d44c 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -772,7 +772,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq } /* setting up the view - actual drawing starts here */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); last_texid= glaGetOneInteger(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); @@ -1016,7 +1016,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* calculate extents of sequencer strips/data @@ -1029,7 +1029,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) draw_seq_backdrop(v2d); /* regular grid-pattern over the rest of the view (i.e. frame grid lines) */ - UI_view2d_constant_grid_draw(C, v2d); + UI_view2d_constant_grid_draw(v2d); seq_draw_sfra_efra(C, sseq, ar); @@ -1043,17 +1043,17 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) } /* current frame */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); if ((sseq->flag & SEQ_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS; if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX; ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, DRAW_MARKERS_LINES); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* overlap playhead */ diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c index 905e1d6cdd9..919395f3bff 100644 --- a/source/blender/editors/space_sound/space_sound.c +++ b/source/blender/editors/space_sound/space_sound.c @@ -153,7 +153,7 @@ static void sound_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ @@ -194,7 +194,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); sound_header_buttons(C, ar); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 5ee7ca3c3ef..4e1bc818ce4 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -384,7 +384,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - // UI_view2d_view_ortho(C, v2d); + // UI_view2d_view_ortho(v2d); /* data... */ draw_text_main(st, ar); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 0d3b0514122..37867890c15 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -467,15 +467,15 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* start and end frame */ time_draw_sfra_efra(C, stime, ar); /* grid */ unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); UI_view2d_grid_free(grid); /* keyframes */ @@ -488,7 +488,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* caches */ diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index fb271556a9c..4cce166b36b 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -64,7 +64,7 @@ // - include support for editing the path verts /* Set up drawing environment for drawing motion paths */ -void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar) +void draw_motion_paths_init(View3D *v3d, ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -79,7 +79,7 @@ void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar) * i.e. draw_motion_paths_init() has been called */ // FIXME: the text is still drawn in the wrong space - it includes the current transforms of the object still... -void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, +void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) { //RegionView3D *rv3d= ar->regiondata; @@ -283,7 +283,7 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, } /* Clean up drawing environment after drawing motion paths */ -void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, ARegion *ar) +void draw_motion_paths_cleanup(View3D *v3d) { if (v3d->zbuf) glEnable(GL_DEPTH_TEST); glPopMatrix(); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 71e52e723c5..6cbfc2cffe4 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -140,7 +140,7 @@ static void cp_shade_color3ub (char cp[], int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor (short colCode, int armflag, int boneflag, int constflag) +static short set_pchan_glColor (short colCode, int boneflag, int constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -551,7 +551,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) } else { if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0); else UI_ThemeColor(TH_BONE_SOLID); } @@ -574,7 +574,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) } else { if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0); else UI_ThemeColor(TH_BONE_SOLID); } @@ -616,7 +616,7 @@ static float co[16] ={ /* smat, imat = mat & imat to draw screenaligned */ -static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel *pchan, EditBone *ebone) { float head, tail, length, dist; float *headvec, *tailvec, dirvec[3]; @@ -782,7 +782,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, else UI_ThemeColor(TH_VERTEX); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); /* Draw root point if we are not connected */ if ((boneflag & BONE_CONNECTED)==0) { @@ -903,7 +903,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u else UI_ThemeColorShade(TH_BONE_SOLID, -30); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, boneflag, constflag); else if (dt==OB_SOLID) UI_ThemeColorShade(TH_BONE_SOLID, -30); @@ -933,7 +933,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u else UI_ThemeColor(TH_BONE_SOLID); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, boneflag, constflag); else if (dt == OB_SOLID) UI_ThemeColor(TH_BONE_SOLID); @@ -1003,7 +1003,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) { glLineWidth(4.0f); if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else if (armflag & ARM_EDITMODE) { UI_ThemeColor(TH_WIRE); } @@ -1048,7 +1048,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in glLoadName(id & 0xFFFF); /* object tag, for bordersel optim */ if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_LINEBONE, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_LINEBONE, boneflag, constflag); } glLineWidth(2.0); @@ -1147,9 +1147,9 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign /* colors for modes */ if (armflag & ARM_POSEMODE) { if (dt <= OB_WIRE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); } else if (armflag & ARM_EDITMODE) { if (dt==OB_WIRE) { @@ -1171,7 +1171,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign glEnable(GL_LIGHTING); if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); else UI_ThemeColor(TH_BONE_SOLID); @@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign if (armflag & ARM_POSEMODE) { if (constflag) { /* set constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth); @@ -1195,7 +1195,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign } /* restore colors */ - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } } @@ -1221,9 +1221,9 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned /* colors for posemode */ if (armflag & ARM_POSEMODE) { if (dt <= OB_WIRE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); } @@ -1245,7 +1245,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned else if (armflag & ARM_POSEMODE) { if (constflag) { /* draw constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_bone_solid_octahedral(); @@ -1254,7 +1254,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned } /* restore colors */ - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } } draw_bone_octahedral(); @@ -1262,7 +1262,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned else { /* solid */ if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); else UI_ThemeColor(TH_BONE_SOLID); draw_bone_solid_octahedral(); @@ -1283,7 +1283,7 @@ static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obje /* colors for posemode */ if (armflag & ARM_POSEMODE) { - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, 0); } if (id != -1) { @@ -1602,7 +1602,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) { if (bone->flag & (BONE_SELECTED)) { if (bone->layer & arm->layer) - draw_sphere_bone_dist(smat, imat, bone->flag, pchan, NULL); + draw_sphere_bone_dist(smat, imat, pchan, NULL); } } } @@ -1902,7 +1902,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); + drawaxes(pchan->bone->length*0.25f, OB_ARROWS); glPopMatrix(); } @@ -1958,7 +1958,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) if (eBone->layer & arm->layer) { if ((eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM))==0) { if (eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL)) - draw_sphere_bone_dist(smat, imat, eBone->flag, NULL, eBone); + draw_sphere_bone_dist(smat, imat, NULL, eBone); } } } @@ -2095,7 +2095,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - drawaxes(eBone->length*0.25f, 0, OB_ARROWS); + drawaxes(eBone->length*0.25f, OB_ARROWS); glPopMatrix(); } @@ -2123,16 +2123,16 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob) bPoseChannel *pchan; /* setup drawing environment for paths */ - draw_motion_paths_init(scene, v3d, ar); + draw_motion_paths_init(v3d, ar); /* draw paths where they exist and they releated bone is visible */ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if ((pchan->bone->layer & arm->layer) && (pchan->mpath)) - draw_motion_path_instance(scene, v3d, ar, ob, pchan, avs, pchan->mpath); + draw_motion_path_instance(scene, ob, pchan, avs, pchan->mpath); } /* cleanup after drawing */ - draw_motion_paths_cleanup(scene, v3d, ar); + draw_motion_paths_cleanup(v3d); } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index cf511a8ad9b..0df2888f4a0 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -192,7 +192,7 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index) return 0; } -static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh *dm) +static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { struct { Mesh *me; EdgeHash *eh; } data; @@ -671,7 +671,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* draw edges and selected faces over textured mesh */ if(!(ob == scene->obedit) && faceselect) - draw_tfaces3D(rv3d, ob, me, dm); + draw_tfaces3D(rv3d, me, dm); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 2206d744dc6..c9b8a086d22 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -398,8 +398,7 @@ static void draw_xyz_wire(float *c, float size, int axis) } -/* flag is same as for draw_object */ -void drawaxes(float size, int flag, char drawtype) +void drawaxes(float size, char drawtype) { int axis; float v1[3]= {0.0, 0.0, 0.0}; @@ -1463,7 +1462,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) * if not, ED_view3d_init_mats_rv3d() can be used for selection tools * but would not give correct results with dupli's for eg. which dont * use the object matrix in the useual way */ -static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData; EditVert *eve = EM_get_vert_for_index(index); @@ -1547,7 +1546,7 @@ void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, EditEd dm->release(dm); } -static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no) +static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no)) { struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; } *data = userData; EditFace *efa = EM_get_face_for_index(index); @@ -1658,7 +1657,7 @@ static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm) glEnd(); } -static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *no) +static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *UNUSED(no)) { EditFace *efa = EM_get_face_for_index(index); int sel = *((int*) userData); @@ -1702,7 +1701,7 @@ static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm) } /* Draw verts with color set based on selection */ -static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { struct { int sel; EditVert *eve_act; } * data = userData; EditVert *eve = EM_get_vert_for_index(index); @@ -1779,7 +1778,7 @@ static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned } /* Draw edges */ -static int draw_dm_edges__setDrawOptions(void *userData, int index) +static int draw_dm_edges__setDrawOptions(void *UNUSED(userData), int index) { return EM_get_edge_for_index(index)->h==0; } @@ -1789,7 +1788,7 @@ static void draw_dm_edges(DerivedMesh *dm) } /* Draw edges with color interpolated based on selection */ -static int draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index) +static int draw_dm_edges_sel_interp__setDrawOptions(void *UNUSED(userData), int index) { return EM_get_edge_for_index(index)->h==0; } @@ -1814,7 +1813,7 @@ static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, un } /* Draw only seam edges */ -static int draw_dm_edges_seams__setDrawOptions(void *userData, int index) +static int draw_dm_edges_seams__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1826,7 +1825,7 @@ static void draw_dm_edges_seams(DerivedMesh *dm) } /* Draw only sharp edges */ -static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index) +static int draw_dm_edges_sharp__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1840,7 +1839,7 @@ static void draw_dm_edges_sharp(DerivedMesh *dm) /* Draw faces with color set based on selection * return 2 for the active face so it renders with stipple enabled */ -static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *drawSmooth_r) +static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r)) { struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData; EditFace *efa = EM_get_face_for_index(index); @@ -1872,7 +1871,7 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material); } -static int draw_dm_creases__setDrawOptions(void *userData, int index) +static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1890,7 +1889,7 @@ static void draw_dm_creases(DerivedMesh *dm) glLineWidth(1.0); } -static int draw_dm_bweights__setDrawOptions(void *userData, int index) +static int draw_dm_bweights__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1901,7 +1900,7 @@ static int draw_dm_bweights__setDrawOptions(void *userData, int index) return 0; } } -static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void draw_dm_bweights__mapFunc(void *UNUSED(userData), int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { EditVert *eve = EM_get_vert_for_index(index); @@ -1936,7 +1935,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm) /* EditMesh drawing routines*/ -static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act) +static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, DerivedMesh *cageDM, EditVert *eve_act) { ToolSettings *ts= scene->toolsettings; int sel; @@ -2227,7 +2226,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E } } -static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth_r) +static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r)) { EditFace *efa = EM_get_face_for_index(index); @@ -2239,7 +2238,7 @@ static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth return 0; } -static int draw_em_fancy__setGLSLFaceOpts(void *userData, int index) +static int draw_em_fancy__setGLSLFaceOpts(void *UNUSED(userData), int index) { EditFace *efa = EM_get_face_for_index(index); @@ -2385,7 +2384,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object if(em) { // XXX retopo_matrix_update(v3d); - draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act); + draw_em_fancy_verts(scene, v3d, ob, cageDM, eve_act); if(me->drawflag & ME_DRAWNORMALS) { UI_ThemeColor(TH_NORMAL); @@ -2435,7 +2434,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) } } -static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) +static int wpaint__setSolidDrawOptions(void *UNUSED(userData), int UNUSED(index), int *drawSmooth_r) { *drawSmooth_r = 1; return 1; @@ -4030,7 +4029,7 @@ static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit psys_cache_edit_paths(scene, ob, edit, CFRA); } -static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, PTCacheEdit *edit, int dt) +static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) { ParticleCacheKey **cache, *path, *pkey; PTCacheEditPoint *point; @@ -4824,9 +4823,9 @@ static void draw_empty_cone (float size) } /* draw points on curve speed handles */ +#if 0 // XXX old animation system stuff static void curve_draw_speed(Scene *scene, Object *ob) { -#if 0 // XXX old animation system stuff Curve *cu= ob->data; IpoCurve *icu; BezTriple *bezt; @@ -4852,8 +4851,8 @@ static void curve_draw_speed(Scene *scene, Object *ob) glPointSize(1.0); bglEnd(); -#endif // XXX old animation system stuff } +#endif // XXX old animation system stuff static void draw_textcurs(float textcurs[][2]) @@ -5649,13 +5648,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) bAnimVizSettings *avs= &ob->avs; /* setup drawing environment for paths */ - draw_motion_paths_init(scene, v3d, ar); + draw_motion_paths_init(v3d, ar); /* draw motion path for object */ - draw_motion_path_instance(scene, v3d, ar, ob, NULL, avs, ob->mpath); + draw_motion_path_instance(scene, ob, NULL, avs, ob->mpath); /* cleanup after drawing */ - draw_motion_paths_cleanup(scene, v3d, ar); + draw_motion_paths_cleanup(v3d); } /* multiply view with object matrix. @@ -5879,9 +5878,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); - - if(cu->path) - curve_draw_speed(scene, ob); + +//XXX old animsys if(cu->path) +// curve_draw_speed(scene, ob); } break; case OB_MBALL: @@ -5900,7 +5899,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } case OB_EMPTY: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, ob->empty_drawtype); break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -5926,7 +5925,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; default: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - drawaxes(1.0, flag, OB_ARROWS); + drawaxes(1.0, OB_ARROWS); } } @@ -5998,7 +5997,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) PTCacheEdit *edit = PE_create_current(scene, ob); if(edit) { glLoadMatrixf(rv3d->viewmat); - draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt); + draw_ptcache_edit(scene, v3d, edit); glMultMatrixf(ob->obmat); } } @@ -6052,7 +6051,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) // #if 0 smd->domain->tex = NULL; GPU_create_smoke(smd, 0); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); + draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); GPU_free_smoke(smd); // #endif #if 0 @@ -6103,7 +6102,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) { smd->domain->tex = NULL; GPU_create_smoke(smd, 1); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); + draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); GPU_free_smoke(smd); } } @@ -6126,7 +6125,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx && (G.f & G_RENDER_OGL)==0) { if(dtx & OB_AXIS) { - drawaxes(1.0f, flag, OB_ARROWS); + drawaxes(1.0f, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) @@ -6266,7 +6265,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* ***************** BACKBUF SEL (BBS) ********* */ -static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { int offset = (intptr_t) userData; EditVert *eve = EM_get_vert_for_index(index); @@ -6302,7 +6301,7 @@ static void bbs_mesh_wire(DerivedMesh *dm, int offset) dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset); } -static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r)) { if (EM_get_face_for_index(index)->h==0) { if (userData) { @@ -6314,7 +6313,7 @@ static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *d } } -static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, float *no) +static void bbs_mesh_solid__drawCenter(void *UNUSED(userData), int index, float *cent, float *UNUSED(no)) { EditFace *efa = EM_get_face_for_index(index); @@ -6346,13 +6345,13 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh } } -static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r)) { WM_set_framebuffer_index_color(index+1); return 1; } -static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r)) { Mesh *me = userData; @@ -6499,7 +6498,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, ob->empty_drawtype); break; } } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 678920f8173..611cf68d81c 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -175,7 +175,7 @@ static int larger_pow2(int n) return n*2; } -void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) +void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) { RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index d7ab8034286..5ca8843b658 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -304,7 +304,7 @@ static char *view3d_modeselect_pup(Scene *scene) } -static void do_view3d_header_buttons(bContext *C, void *arg, int event) +static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event) { wmWindow *win= CTX_wm_window(C); ToolSettings *ts= CTX_data_tool_settings(C); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 4065b159ccf..49ef803b1af 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -93,11 +93,11 @@ void VIEW3D_OT_drawtype(struct wmOperatorType *ot); void view3d_boxview_copy(ScrArea *sa, ARegion *ar); /* drawanim.c */ -void draw_motion_paths_init(Scene *scene, View3D *v3d, struct ARegion *ar); -void draw_motion_path_instance(Scene *scene, View3D *v3d, struct ARegion *ar, +void draw_motion_paths_init(View3D *v3d, struct ARegion *ar); +void draw_motion_path_instance(Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct bAnimVizSettings *avs, struct bMotionPath *mpath); -void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, struct ARegion *ar); +void draw_motion_paths_cleanup(View3D *v3d); @@ -106,7 +106,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, int dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, int dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); -void drawaxes(float size, int flag, char drawtype); +void drawaxes(float size, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); @@ -189,7 +189,7 @@ ARegion *view3d_has_buttons_region(ScrArea *sa); ARegion *view3d_has_tools_region(ScrArea *sa); /* draw_volume.c */ -void draw_volume(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct Base *base, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); +void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); #endif /* ED_VIEW3D_INTERN_H */ -- cgit v1.2.3 From 266811368b620ee6609be8c07a1d0037b244b9b1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 02:05:37 +0000 Subject: bugfix [#21959] 'Apply rotation' to scaled object behaves wrong --- source/blender/editors/object/object_transform.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index d4644847a5c..1551db73e74 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -457,8 +457,18 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo object_to_mat3(ob, rsmat); else if(apply_scale) object_scale_to_mat3(ob, rsmat); - else if(apply_rot) + else if(apply_rot) { + float tmat[3][3], timat[3][3]; + + /* simple rotation matrix */ object_rot_to_mat3(ob, rsmat); + + /* correct for scale, note mul_m3_m3m3 has swapped args! */ + object_scale_to_mat3(ob, tmat); + invert_m3_m3(timat, tmat); + mul_m3_m3m3(rsmat, timat, rsmat); + mul_m3_m3m3(rsmat, rsmat, tmat); + } else unit_m3(rsmat); -- cgit v1.2.3 From b0b8e93f7f3264e690eae68bf15e4239e146485e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 03:57:15 +0000 Subject: bugfix [#24238] "M" (move) selects wrong action when with armature --- source/blender/editors/screen/screen_ops.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 584112ccacd..6d4aa3ebe64 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -262,11 +262,16 @@ int ED_operator_editarmature(bContext *C) int ED_operator_posemode(bContext *C) { Object *obact= CTX_data_active_object(C); - Object *obedit= CTX_data_edit_object(C); - - if ((obact != obedit) && ED_object_pose_armature(obact)) - return 1; - + + if ((obact != CTX_data_edit_object(C))) { + Object *obpose; + if(obpose= ED_object_pose_armature(obact)) { + if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) { + return 1; + } + } + } + return 0; } -- cgit v1.2.3 From fbf208d63fe0ba9770cb225726eb94888aa0994d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 06:29:17 +0000 Subject: add UNUSED() to modifiers, also removed some unused args. --- source/blender/blenkernel/BKE_modifier.h | 2 +- source/blender/blenkernel/intern/modifier.c | 4 +-- .../editors/transform/transform_conversions.c | 2 +- source/blender/modifiers/MOD_modifiertypes.h | 2 +- source/blender/modifiers/intern/MOD_armature.c | 21 +++++++----- source/blender/modifiers/intern/MOD_array.c | 8 ++--- source/blender/modifiers/intern/MOD_bevel.c | 15 +++++---- source/blender/modifiers/intern/MOD_boolean.c | 19 ++++++----- source/blender/modifiers/intern/MOD_build.c | 7 ++-- source/blender/modifiers/intern/MOD_cast.c | 25 +++++++++------ source/blender/modifiers/intern/MOD_cloth.c | 5 +-- source/blender/modifiers/intern/MOD_collision.c | 12 ++++--- source/blender/modifiers/intern/MOD_curve.c | 21 +++++++----- source/blender/modifiers/intern/MOD_decimate.c | 8 +++-- source/blender/modifiers/intern/MOD_displace.c | 25 +++++++++------ source/blender/modifiers/intern/MOD_edgesplit.c | 37 ++++++++++------------ source/blender/modifiers/intern/MOD_explode.c | 23 +++++++------- source/blender/modifiers/intern/MOD_fluidsim.c | 3 +- .../blender/modifiers/intern/MOD_fluidsim_util.c | 14 +++++--- source/blender/modifiers/intern/MOD_hook.c | 20 ++++++++---- source/blender/modifiers/intern/MOD_lattice.c | 20 ++++++++---- source/blender/modifiers/intern/MOD_mask.c | 13 +++++--- source/blender/modifiers/intern/MOD_meshdeform.c | 35 ++++++++++++-------- source/blender/modifiers/intern/MOD_mirror.c | 19 ++++++----- source/blender/modifiers/intern/MOD_none.c | 3 +- .../modifiers/intern/MOD_particleinstance.c | 19 ++++++----- .../blender/modifiers/intern/MOD_particlesystem.c | 12 ++++--- source/blender/modifiers/intern/MOD_screw.c | 19 +++++++---- source/blender/modifiers/intern/MOD_shapekey.c | 28 ++++++++++------ source/blender/modifiers/intern/MOD_shrinkwrap.c | 21 ++++++++---- source/blender/modifiers/intern/MOD_simpledeform.c | 24 ++++++++++---- source/blender/modifiers/intern/MOD_smoke.c | 21 +++++++----- source/blender/modifiers/intern/MOD_smooth.c | 11 ++++--- source/blender/modifiers/intern/MOD_softbody.c | 12 ++++--- source/blender/modifiers/intern/MOD_solidify.c | 13 ++++---- source/blender/modifiers/intern/MOD_subsurf.c | 14 ++++---- source/blender/modifiers/intern/MOD_surface.c | 14 +++++--- source/blender/modifiers/intern/MOD_util.c | 12 +++---- source/blender/modifiers/intern/MOD_util.h | 6 ++-- source/blender/modifiers/intern/MOD_uvproject.c | 22 +++++++------ source/blender/modifiers/intern/MOD_wave.c | 29 ++++++++++------- source/blender/render/intern/source/voxeldata.c | 4 +-- 42 files changed, 385 insertions(+), 259 deletions(-) diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 51120a61e69..0225a402fb8 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -315,7 +315,7 @@ int modifiers_isParticleEnabled(struct Object *ob); struct Object *modifiers_isDeformedByArmature(struct Object *ob); struct Object *modifiers_isDeformedByLattice(struct Object *ob); int modifiers_usesArmature(struct Object *ob, struct bArmature *arm); -int modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob); +int modifiers_isCorrectableDeformed(struct Object *ob); void modifier_freeTemporaryData(struct ModifierData *md); int modifiers_indexInObject(struct Object *ob, struct ModifierData *md); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index d7c95a007e5..dc2992662c9 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -59,7 +59,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) static int types_init = 1; if (types_init) { - modifier_type_init(types, type); /* MOD_utils.c */ + modifier_type_init(types); /* MOD_utils.c */ types_init= 0; } @@ -492,7 +492,7 @@ int modifier_isCorrectableDeformed(ModifierData *md) return 0; } -int modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob) +int modifiers_isCorrectableDeformed(Object *ob) { ModifierData *md = modifiers_getVirtualModifierList(ob); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0c0912a4ad6..fd97406652e 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2145,7 +2145,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* detect CrazySpace [tm] */ if(propmode==0) { if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) { - if(modifiers_isCorrectableDeformed(t->scene, t->obedit)) { + if(modifiers_isCorrectableDeformed(t->obedit)) { /* check if we can use deform matrices for modifier from the start up to stack, they are more accurate than quats */ totleft= editmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos); diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index a792b163eea..6063acf47f4 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -69,6 +69,6 @@ extern ModifierTypeInfo modifierType_Solidify; extern ModifierTypeInfo modifierType_Screw; /* MOD_util.c */ -void modifier_type_init(ModifierTypeInfo *types[], ModifierType type); +void modifier_type_init(ModifierTypeInfo *types[]); #endif //MOD_MODIFIERTYPES_H diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 6d2a3e7098f..2f802ee67c8 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -35,6 +35,7 @@ #include "DNA_armature_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" #include "BKE_modifier.h" @@ -63,7 +64,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tamd->defgrp_name, amd->defgrp_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { CustomDataMask dataMask = 0; @@ -73,7 +74,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { ArmatureModifierData *amd = (ArmatureModifierData*) md; @@ -90,9 +91,10 @@ static void foreachObjectLink( walk(userData, ob, &amd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ArmatureModifierData *amd = (ArmatureModifierData*) md; @@ -104,9 +106,12 @@ static void updateDepgraph( } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { ArmatureModifierData *amd = (ArmatureModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 8331c3474b2..839bfef6226 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -101,8 +101,8 @@ static void foreachObjectLink( walk(userData, ob, &amd->offset_ob); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { ArrayModifierData *amd = (ArrayModifierData*) md; @@ -731,7 +731,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, static DerivedMesh *applyModifier( ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { DerivedMesh *result; ArrayModifierData *amd = (ArrayModifierData*) md; @@ -745,7 +745,7 @@ static DerivedMesh *applyModifier( } static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, + ModifierData *md, Object *ob, struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 68274fbfd78..937c8cd7eac 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -66,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { BevelModifierData *bmd = (BevelModifierData *)md; CustomDataMask dataMask = 0; @@ -77,9 +77,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; BME_Mesh *bm; @@ -107,9 +108,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 496523a310b..dfcfd55f3d9 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -32,6 +32,7 @@ #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -49,7 +50,7 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->operation = bmd->operation; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { BooleanModifierData *bmd = (BooleanModifierData*) md; @@ -66,9 +67,10 @@ static void foreachObjectLink( walk(userData, ob, &bmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { BooleanModifierData *bmd = (BooleanModifierData*) md; @@ -81,9 +83,10 @@ static void updateDepgraph( } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { BooleanModifierData *bmd = (BooleanModifierData*) md; DerivedMesh *dm = bmd->object->derivedFinal; @@ -105,7 +108,7 @@ static DerivedMesh *applyModifier( return derivedData; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { CustomDataMask dataMask = (1 << CD_MTFACE) + (1 << CD_MEDGE); diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index de913d79f01..960db7fa925 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -65,14 +65,15 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->seed = bmd->seed; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 1872263848b..c39aa288b18 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_deform.h" #include "BKE_DerivedMesh.h" #include "BKE_modifier.h" @@ -73,7 +74,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { CastModifierData *cmd = (CastModifierData*) md; short flag; @@ -85,7 +86,7 @@ static int isDisabled(ModifierData *md, int useRenderParams) return 0; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { CastModifierData *cmd = (CastModifierData *)md; CustomDataMask dataMask = 0; @@ -106,9 +107,10 @@ static void foreachObjectLink( walk (userData, ob, &cmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { CastModifierData *cmd = (CastModifierData*) md; @@ -566,14 +568,17 @@ static void cuboid_do( } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = NULL; CastModifierData *cmd = (CastModifierData *)md; - dm = get_dm(md->scene, ob, NULL, derivedData, NULL, 0); + dm = get_dm(ob, NULL, derivedData, NULL, 0); if (cmd->type == MOD_CAST_TYPE_CUBOID) { cuboid_do(cmd, ob, dm, vertexCos, numVerts); @@ -589,7 +594,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_dm(md->scene, ob, editData, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0); CastModifierData *cmd = (CastModifierData *)md; if (cmd->type == MOD_CAST_TYPE_CUBOID) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1c0ab34f15c..0c6c1e87a72 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" #include "BKE_cloth.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" @@ -111,7 +112,7 @@ static void updateDepgraph( } } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { CustomDataMask dataMask = 0; ClothModifierData *clmd = (ClothModifierData*)md; @@ -150,7 +151,7 @@ static void copyData(ModifierData *md, ModifierData *target) tclmd->clothObject = NULL; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 2651122231c..20319b8c65f 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -38,6 +38,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_collision.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" @@ -94,14 +95,17 @@ static void freeData(ModifierData *md) } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { CollisionModifierData *collmd = (CollisionModifierData*) md; DerivedMesh *dm = NULL; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 998bf375e79..8009ad0589c 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -35,6 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" #include "BKE_modifier.h" @@ -59,7 +60,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tcmd->name, cmd->name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { CurveModifierData *cmd = (CurveModifierData *)md; CustomDataMask dataMask = 0; @@ -70,7 +71,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int userRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(userRenderParams)) { CurveModifierData *cmd = (CurveModifierData*) md; @@ -87,9 +88,10 @@ static void foreachObjectLink( walk(userData, ob, &cmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { CurveModifierData *cmd = (CurveModifierData*) md; @@ -101,9 +103,12 @@ static void updateDepgraph( } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { CurveModifierData *cmd = (CurveModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 03307934e00..8df0c0be3eb 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -34,6 +34,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_modifier.h" @@ -59,9 +60,10 @@ static void copyData(ModifierData *md, ModifierData *target) tdmd->percent = dmd->percent; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DecimateModifierData *dmd = (DecimateModifierData*) md; DerivedMesh *dm = derivedData, *result = NULL; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 2e811eb742d..95e8a9ce4cc 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_texture.h" @@ -75,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { DisplaceModifierData *dmd = (DisplaceModifierData *)md; CustomDataMask dataMask = 0; @@ -127,16 +128,17 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; return (!dmd->texture || dmd->strength == 0.0f); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; @@ -308,11 +310,14 @@ static void displaceModifier_do( MEM_freeN(tex_co); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos); + DerivedMesh *dm= get_cddm(ob, NULL, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); @@ -325,7 +330,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm= get_cddm(md->scene, ob, editData, derivedData, vertexCos); + DerivedMesh *dm= get_cddm(ob, editData, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index e80b80abdb5..daf9d76cf51 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -40,6 +40,7 @@ #include "BLI_edgehash.h" #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_particle.h" @@ -730,8 +731,7 @@ static int edge_is_loose(SmoothEdge *edge) return !(edge->faces && edge->faces->next); } -static int edge_is_sharp(SmoothEdge *edge, int flags, - float threshold) +static int edge_is_sharp(SmoothEdge *edge) { #ifdef EDGESPLIT_DEBUG_1 printf("edge %d: ", edge->newIndex); @@ -761,8 +761,7 @@ static int edge_is_sharp(SmoothEdge *edge, int flags, * - hits a sharp edge (the edge is returned) * - returns to the start edge (NULL is returned) */ -static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, - LinkNode **visited_faces, float threshold, int flags) +static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, LinkNode **visited_faces) { SmoothFace *face = NULL; SmoothEdge *edge2 = NULL; @@ -790,7 +789,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, /* search until we hit a loose edge or a sharp edge or an edge we've * seen before */ - while(face && !edge_is_sharp(edge2, flags, threshold) + while(face && !edge_is_sharp(edge2) && !linklist_contains(visited_edges, edge2)) { #ifdef EDGESPLIT_DEBUG_3 printf("current face %4d; current edge %4d\n", face->newIndex, @@ -902,8 +901,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, edge->newIndex, vert->newIndex); #endif - edge2 = find_other_sharp_edge(vert, edge, &visited_faces, - mesh->threshold, mesh->flags); + edge2 = find_other_sharp_edge(vert, edge, &visited_faces); if(!edge2) { /* didn't find a sharp or loose edge, so we've hit a dead end */ @@ -912,7 +910,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, if(edge_is_loose(edge)) { /* edge is loose, so we can split edge2 at this vert */ split_edge(edge2, vert, mesh); - } else if(edge_is_sharp(edge, mesh->flags, mesh->threshold)) { + } else if(edge_is_sharp(edge)) { /* both edges are sharp, so we can split the pair at vert */ split_edge(edge, vert, mesh); } else { @@ -961,8 +959,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) edge->newIndex, vert->newIndex); #endif - edge2 = find_other_sharp_edge(vert, edge, &visited_faces, - mesh->threshold, mesh->flags); + edge2 = find_other_sharp_edge(vert, edge, &visited_faces); if(!edge2) { /* didn't find a sharp or loose edge, so try the other vert */ @@ -1111,7 +1108,7 @@ static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags) for(i = 0; i < mesh->num_edges; i++) { SmoothEdge *edge = &mesh->edges[i]; - if(edge_is_sharp(edge, flags, mesh->threshold)) { + if(edge_is_sharp(edge)) { split_edge(edge, edge->verts[0], mesh); do { @@ -1190,8 +1187,7 @@ static void split_bridge_verts(SmoothMesh *mesh) } } -static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, - Object *ob, DerivedMesh *dm) +static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, DerivedMesh *dm) { SmoothMesh *mesh; DerivedMesh *result; @@ -1244,14 +1240,15 @@ static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, return result; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md; - result = edgesplitModifier_do(emd, ob, derivedData); + result = edgesplitModifier_do(emd, derivedData); if(result != derivedData) CDDM_calc_normals(result); @@ -1259,9 +1256,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index cbf5f3c3b98..67f1f2a3e59 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -74,11 +74,11 @@ static void copyData(ModifierData *md, ModifierData *target) temd->protect = emd->protect; temd->vgroup = emd->vgroup; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { ExplodeModifierData *emd= (ExplodeModifierData*) md; CustomDataMask dataMask = 0; @@ -90,8 +90,8 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) } static void createFacepa(ExplodeModifierData *emd, - ParticleSystemModifierData *psmd, - Object *ob, DerivedMesh *dm) + ParticleSystemModifierData *psmd, + DerivedMesh *dm) { ParticleSystem *psys=psmd->psys; MFace *fa=0, *mface=0; @@ -833,9 +833,10 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi } return psmd; } -static DerivedMesh * applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh * applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; ExplodeModifierData *emd= (ExplodeModifierData*) md; @@ -852,16 +853,16 @@ static DerivedMesh * applyModifier( if(emd->facepa==0 || psmd->flag&eParticleSystemFlag_Pars || emd->flag&eExplodeFlag_CalcFaces - || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm)){ + || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm)) + { if(psmd->flag & eParticleSystemFlag_Pars) psmd->flag &= ~eParticleSystemFlag_Pars; if(emd->flag & eExplodeFlag_CalcFaces) emd->flag &= ~eExplodeFlag_CalcFaces; - createFacepa(emd,psmd,ob,derivedData); - } - + createFacepa(emd,psmd,derivedData); + } /* 2. create new mesh */ if(emd->flag & eExplodeFlag_EdgeSplit){ int *facepa = emd->facepa; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 619891e136f..14fb09f1c1f 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -34,6 +34,7 @@ #include "DNA_object_fluidsim.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -125,7 +126,7 @@ static void updateDepgraph( } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 0c5428cc9d8..42c2fc5bbe4 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -443,7 +443,7 @@ void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, cha gzclose(gzf); } -DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) +DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int displaymode = 0; int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */ @@ -537,7 +537,11 @@ DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifie #endif // DISABLE_ELBEEM -DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) +DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, + Object *UNUSED(ob), + DerivedMesh *dm, + int useRenderParams, + int UNUSED(isFinalCalc)) { #ifndef DISABLE_ELBEEM DerivedMesh *result = NULL; @@ -567,7 +571,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob } /* try to read from cache */ - if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) + if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams))) { // fss->lastgoodframe = framenr; // set also in src/fluidsim.c return result; @@ -577,7 +581,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob // display last known good frame if(fss->lastgoodframe >= 0) { - if((result = fluidsim_read_cache(ob, dm, fluidmd, fss->lastgoodframe, useRenderParams))) + if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams))) { return result; } @@ -587,7 +591,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob // this could be likely the case when you load an old fluidsim - if((result = fluidsim_read_cache(ob, dm, fluidmd, fss->lastgoodframe, useRenderParams))) + if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams))) { return result; } diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index f2ffd486aa5..8ad3c9aaf5b 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -40,6 +40,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_deform.h" +#include "BKE_utildefines.h" #include "depsgraph_private.h" #include "MEM_guardedalloc.h" @@ -68,7 +69,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(thmd->subtarget, hmd->subtarget, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { HookModifierData *hmd = (HookModifierData *)md; CustomDataMask dataMask = 0; @@ -86,7 +87,7 @@ static void freeData(ModifierData *md) if (hmd->indexar) MEM_freeN(hmd->indexar); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { HookModifierData *hmd = (HookModifierData*) md; @@ -103,8 +104,10 @@ static void foreachObjectLink( walk(userData, ob, &hmd->object); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { HookModifierData *hmd = (HookModifierData*) md; @@ -118,9 +121,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { HookModifierData *hmd = (HookModifierData*) md; bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 532475a3466..fdbc3fa0a50 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -34,6 +34,7 @@ #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" #include "BKE_modifier.h" @@ -52,7 +53,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tlmd->name, lmd->name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { LatticeModifierData *lmd = (LatticeModifierData *)md; CustomDataMask dataMask = 0; @@ -63,7 +64,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int userRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(userRenderParams)) { LatticeModifierData *lmd = (LatticeModifierData*) md; @@ -80,8 +81,10 @@ static void foreachObjectLink( walk(userData, ob, &lmd->object); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { LatticeModifierData *lmd = (LatticeModifierData*) md; @@ -93,9 +96,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { LatticeModifierData *lmd = (LatticeModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index c1565352133..eddb21596a6 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -55,7 +55,7 @@ static void copyData(ModifierData *md, ModifierData *target) strcpy(tmmd->vgroup, mmd->vgroup); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { return (1 << CD_MDEFORMVERT); } @@ -69,8 +69,10 @@ static void foreachObjectLink( walk(userData, ob, &mmd->ob_arm); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { MaskModifierData *mmd = (MaskModifierData *)md; @@ -84,8 +86,9 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { MaskModifierData *mmd= (MaskModifierData *)md; DerivedMesh *dm= derivedData, *result= NULL; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index af87fb6ef74..587b3b8f053 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" #include "BKE_mesh.h" @@ -76,7 +77,7 @@ static void copyData(ModifierData *md, ModifierData *target) tmmd->object = mmd->object; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; CustomDataMask dataMask = 0; @@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; @@ -104,9 +105,10 @@ static void foreachObjectLink( walk(userData, ob, &mmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; @@ -204,7 +206,7 @@ static void meshdeformModifier_do( /* if we don't have one computed, use derivedmesh from data * without any modifiers */ if(!cagedm) { - cagedm= get_dm(md->scene, mmd->object, NULL, NULL, NULL, 0); + cagedm= get_dm(mmd->object, NULL, NULL, NULL, 0); if(cagedm) cagedm->needsFree= 1; } @@ -338,11 +340,14 @@ static void meshdeformModifier_do( cagedm->release(cagedm); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);; + DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);; modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ @@ -352,11 +357,13 @@ static void deformVerts( dm->release(dm); } -static void deformVertsEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +static void deformVertsEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts) { - DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);; + DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);; meshdeformModifier_do(md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 9289c44c414..6405f0e9d76 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -74,8 +74,10 @@ static void foreachObjectLink( walk(userData, ob, &mmd->mirror_ob); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { MirrorModifierData *mmd = (MirrorModifierData*) md; @@ -298,9 +300,10 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd, return result; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; MirrorModifierData *mmd = (MirrorModifierData*) md; @@ -313,9 +316,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 8cfb2a59376..1b6a709e7f4 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -34,13 +34,14 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include "BKE_utildefines.h" #include "MOD_modifiertypes.h" /* We only need to define isDisabled; because it always returns 1, * no other functions will be called */ -static int isDisabled(ModifierData *md, int userRenderParams) +static int isDisabled(ModifierData *UNUSED(md), int UNUSED(userRenderParams)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index bbd0219d3f8..9fcefdba49a 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -72,12 +72,14 @@ static void copyData(ModifierData *md, ModifierData *target) tpimd->random_position = pimd->random_position; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 0; } static void updateDepgraph(ModifierData *md, DagForest *forest, - struct Scene *scene,Object *ob, DagNode *obNode) + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData*) md; @@ -98,9 +100,10 @@ static void foreachObjectLink(ModifierData *md, Object *ob, walk(userData, ob, &pimd->ob); } -static DerivedMesh * applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh * applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData, *result; ParticleInstanceModifierData *pimd= (ParticleInstanceModifierData*) md; @@ -306,9 +309,9 @@ static DerivedMesh * applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 602b6dd1d56..0feea3b6bf5 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -34,6 +34,7 @@ #include "DNA_material_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_material.h" #include "BKE_modifier.h" @@ -119,9 +120,12 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) } /* saves the current emitter state for a particle system and calculates particles */ -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; @@ -137,7 +141,7 @@ static void deformVerts( return; if(dm==0) { - dm= get_dm(md->scene, ob, NULL, NULL, vertexCos, 1); + dm= get_dm(ob, NULL, NULL, vertexCos, 1); if(!dm) return; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 0016fd2d266..668f0a086d1 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -37,6 +37,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "depsgraph_private.h" @@ -128,8 +129,9 @@ static void copyData(ModifierData *md, ModifierData *target) } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + DerivedMesh *derivedData, + int useRenderParams, + int UNUSED(isFinalCalc)) { DerivedMesh *dm= derivedData; DerivedMesh *result; @@ -832,9 +834,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } -static void updateDepgraph( - ModifierData *md, DagForest *forest, - struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ScrewModifierData *ltmd= (ScrewModifierData*) md; @@ -859,13 +862,15 @@ static void foreachObjectLink( /* This dosnt work with material*/ static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, + ModifierData *md, + Object *ob, + struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 0; } diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index bf675b874f6..3a3150022d8 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -34,6 +34,7 @@ #include "DNA_key_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_key.h" #include "BKE_particle.h" @@ -42,9 +43,12 @@ #include "MEM_guardedalloc.h" -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *UNUSED(derivedData), + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { KeyBlock *kb= ob_get_keyblock(ob); float (*deformedVerts)[3]; @@ -58,9 +62,11 @@ static void deformVerts( } } -static void deformVertsEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +static void deformVertsEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts) { Key *key= ob_get_key(ob); @@ -68,10 +74,12 @@ static void deformVertsEM( deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0); } -static void deformMatricesEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData, float (*vertexCos)[3], - float (*defMats)[3][3], int numVerts) +static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *UNUSED(derivedData), + float UNUSED((*vertexCos)[3]), + float (*defMats)[3][3], + int numVerts) { Key *key= ob_get_key(ob); KeyBlock *kb= ob_get_keyblock(ob); diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 6baee9f0d98..6eebe9b5e5e 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -32,6 +32,7 @@ #include +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_shrinkwrap.h" @@ -71,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->subsurfLevels = smd->subsurfLevels; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md; CustomDataMask dataMask = 0; @@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md; return !smd->target; @@ -102,14 +103,19 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, &smd->auxTarget); } -static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); /* ensure we get a CDDM with applied vertex coords */ if(dataMask) - dm= get_cddm(md->scene, ob, NULL, dm, vertexCos); + dm= get_cddm(ob, NULL, dm, vertexCos); shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, md->scene, ob, dm, vertexCos, numVerts); @@ -124,7 +130,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat /* ensure we get a CDDM with applied vertex coords */ if(dataMask) - dm= get_cddm(md->scene, ob, editData, dm, vertexCos); + dm= get_cddm(ob, editData, dm, vertexCos); shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, md->scene, ob, dm, vertexCos, numVerts); @@ -132,7 +138,10 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat dm->release(dm); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index ab580781351..7c47ab02157 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -290,7 +290,7 @@ static void copyData(ModifierData *md, ModifierData *target) strcpy(tsmd->vgroup_name, smd->vgroup_name); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md; CustomDataMask dataMask = 0; @@ -308,7 +308,10 @@ static void foreachObjectLink(ModifierData *md, Object *ob, void (*walk)(void *u walk(userData, ob, &smd->origin); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { SimpleDeformModifierData *smd = (SimpleDeformModifierData*)md; @@ -316,7 +319,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc dag_add_relation(forest, dag_get_node(forest, smd->origin), obNode, DAG_RL_OB_DATA, "SimpleDeform Modifier"); } -static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); @@ -324,7 +332,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, /* we implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) - dm= get_dm(md->scene, ob, NULL, dm, NULL, 0); + dm= get_dm(ob, NULL, dm, NULL, 0); SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts); @@ -332,7 +340,11 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, dm->release(dm); } -static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +static void deformVertsEM(ModifierData *md, Object *ob, + struct EditMesh *editData, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); @@ -340,7 +352,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat /* we implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) - dm= get_dm(md->scene, ob, editData, dm, NULL, 0); + dm= get_dm(ob, editData, dm, NULL, 0); SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index f89ff0bb1b5..aee466802ca 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -36,6 +36,7 @@ #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_smoke.h" @@ -71,12 +72,15 @@ static void freeData(ModifierData *md) smokeModifier_free (smd); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int useRenderParams, + int isFinalCalc) { SmokeModifierData *smd = (SmokeModifierData*) md; - DerivedMesh *dm = dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos); + DerivedMesh *dm = dm= get_cddm(ob, NULL, derivedData, vertexCos); smokeModifier_do(smd, md->scene, ob, dm, useRenderParams, isFinalCalc); @@ -84,14 +88,15 @@ static void deformVerts( dm->release(dm); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *UNUSED(md), DagForest *UNUSED(forest), + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *UNUSED(obNode)) { /*SmokeModifierData *smd = (SmokeModifierData *) md; if(smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 96269c092c9..db7013f53ce 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -37,6 +37,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" #include "BKE_deform.h" +#include "BKE_utildefines.h" #include "MEM_guardedalloc.h" @@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { SmoothModifierData *smd = (SmoothModifierData*) md; short flag; @@ -78,7 +79,7 @@ static int isDisabled(ModifierData *md, int useRenderParams) return 0; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { SmoothModifierData *smd = (SmoothModifierData *)md; CustomDataMask dataMask = 0; @@ -219,9 +220,9 @@ static void smoothModifier_do( static void deformVerts( ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) + float (*vertexCos)[3], int numVerts, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0); + DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0); smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); @@ -234,7 +235,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm= get_dm(md->scene, ob, editData, derivedData, NULL, 0); + DerivedMesh *dm= get_dm(ob, editData, derivedData, NULL, 0); smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 931cfe2e2d3..8d962395d01 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -32,20 +32,24 @@ #include "DNA_scene_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" #include "BKE_softbody.h" #include "MOD_modifiertypes.h" -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *UNUSED(derivedData), + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { sbObjectStep(md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 57155c4e1dc..6abe1262c0b 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -179,7 +179,7 @@ static void copyData(ModifierData *md, ModifierData *target) strcpy(tsmd->defgrp_name, smd->defgrp_name); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { SolidifyModifierData *smd = (SolidifyModifierData*) md; CustomDataMask dataMask = 0; @@ -191,11 +191,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) } -static DerivedMesh *applyModifier(ModifierData *md, - Object *ob, - DerivedMesh *dm, - int useRenderParams, - int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *dm, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { int i; DerivedMesh *result; @@ -630,7 +629,7 @@ static DerivedMesh *applyModifier(ModifierData *md, static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, - struct EditMesh *editData, + struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index cd3657b9674..3264717c97a 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -35,6 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_scene.h" #include "BKE_subsurf.h" @@ -83,9 +84,10 @@ static int isDisabled(ModifierData *md, int useRenderParams) return get_render_subsurf_level(&md->scene->r, levels) == 0; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int useRenderParams, + int isFinalCalc) { SubsurfModifierData *smd = (SubsurfModifierData*) md; DerivedMesh *result; @@ -102,9 +104,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *UNUSED(ob), + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { SubsurfModifierData *smd = (SubsurfModifierData*) md; DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index b2f55bde360..a1593df0ffa 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -36,6 +36,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "MOD_modifiertypes.h" @@ -76,14 +77,17 @@ static void freeData(ModifierData *md) } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { SurfaceModifierData *surmd = (SurfaceModifierData*) md; unsigned int numverts = 0, i = 0; @@ -93,7 +97,7 @@ static void deformVerts( /* if possible use/create DerivedMesh */ if(derivedData) surmd->dm = CDDM_copy(derivedData); - else surmd->dm = get_dm(md->scene, ob, NULL, NULL, NULL, 0); + else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0); if(!ob->pd) { diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 754b18bc282..de96684a2dd 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -84,13 +84,13 @@ void validate_layer_name(const CustomData *data, int type, char *name, char *out /* if a layer name was given, try to find that layer */ if(name[0]) - index = CustomData_get_named_layer_index(data, CD_MTFACE, name); + index = CustomData_get_named_layer_index(data, type, name); if(index < 0) { /* either no layer was specified, or the layer we want has been * deleted, so assign the active layer to name */ - index = CustomData_get_active_layer_index(data, CD_MTFACE); + index = CustomData_get_active_layer_index(data, type); strcpy(outname, data->layers[index].name); } else @@ -98,13 +98,13 @@ void validate_layer_name(const CustomData *data, int type, char *name, char *out } /* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */ -DerivedMesh *get_cddm(struct Scene *scene, Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3]) +DerivedMesh *get_cddm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3]) { if(dm && dm->type == DM_TYPE_CDDM) return dm; if(!dm) { - dm= get_dm(scene, ob, em, dm, vertexCos, 0); + dm= get_dm(ob, em, dm, vertexCos, 0); } else { dm= CDDM_copy(dm); @@ -118,7 +118,7 @@ DerivedMesh *get_cddm(struct Scene *scene, Object *ob, struct EditMesh *em, Deri } /* returns a derived mesh if dm == NULL, for deforming modifiers that need it */ -DerivedMesh *get_dm(struct Scene *scene, Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco) +DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco) { if(dm) return dm; @@ -143,7 +143,7 @@ DerivedMesh *get_dm(struct Scene *scene, Object *ob, struct EditMesh *em, Derive } /* only called by BKE_modifier.h/modifier.c */ -void modifier_type_init(ModifierTypeInfo *types[], ModifierType type) +void modifier_type_init(ModifierTypeInfo *types[]) { memset(types, 0, sizeof(types)); #define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &modifierType_##typeName) diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 5750e042199..6abc29417b5 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -40,9 +40,9 @@ struct ModifierData; void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres); void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]); void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname); -struct DerivedMesh *get_cddm(struct Scene *scene, struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]); -struct DerivedMesh *get_dm(struct Scene *scene, struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco); +struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]); +struct DerivedMesh *get_dm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco); -void modifier_type_init(struct ModifierTypeInfo *types[], ModifierType type); +void modifier_type_init(struct ModifierTypeInfo *types[]); #endif /* MOD_UTIL_H */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 211640ad777..942b4b0b597 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_uvproject.h" +#include "BKE_utildefines.h" #include "BKE_DerivedMesh.h" #include "MOD_modifiertypes.h" @@ -78,7 +79,7 @@ static void copyData(ModifierData *md, ModifierData *target) tumd->scaley = umd->scaley; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { CustomDataMask dataMask = 0; @@ -109,8 +110,10 @@ static void foreachIDLink(ModifierData *md, Object *ob, userData); } -static void updateDepgraph(ModifierData *md, - DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { UVProjectModifierData *umd = (UVProjectModifierData*) md; int i; @@ -376,9 +379,10 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, return dm; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; UVProjectModifierData *umd = (UVProjectModifierData*) md; @@ -388,9 +392,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 42cbddce233..acd8c29a6dd 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -36,6 +36,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_DerivedMesh.h" #include "BKE_object.h" #include "BKE_deform.h" @@ -93,7 +94,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } @@ -118,9 +119,10 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { WaveModifierData *wmd = (WaveModifierData*) md; @@ -139,7 +141,7 @@ static void updateDepgraph( } } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { WaveModifierData *wmd = (WaveModifierData *)md; CustomDataMask dataMask = 0; @@ -399,17 +401,20 @@ static void waveModifier_do(WaveModifierData *md, if(wmd->texture) MEM_freeN(tex_co); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm= derivedData; WaveModifierData *wmd = (WaveModifierData *)md; if(wmd->flag & MOD_WAVE_NORM) - dm= get_cddm(md->scene, ob, NULL, dm, vertexCos); + dm= get_cddm(ob, NULL, dm, vertexCos); else if(wmd->texture || wmd->defgrp_name[0]) - dm= get_dm(md->scene, ob, NULL, dm, NULL, 0); + dm= get_dm(ob, NULL, dm, NULL, 0); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); @@ -425,9 +430,9 @@ static void deformVertsEM( WaveModifierData *wmd = (WaveModifierData *)md; if(wmd->flag & MOD_WAVE_NORM) - dm= get_cddm(md->scene, ob, editData, dm, vertexCos); + dm= get_cddm(ob, editData, dm, vertexCos); else if(wmd->texture || wmd->defgrp_name[0]) - dm= get_dm(md->scene, ob, editData, dm, NULL, 0); + dm= get_dm(ob, editData, dm, NULL, 0); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 076d6355585..0a2ea54c5b0 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -178,7 +178,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd) return 1; } -static void init_frame_smoke(VoxelData *vd, Tex *tex) +static void init_frame_smoke(VoxelData *vd) { Object *ob; ModifierData *md; @@ -282,7 +282,7 @@ static void cache_voxeldata(struct Render *re,Tex *tex) load_frame_image_sequence(vd, tex); return; case TEX_VD_SMOKE: - init_frame_smoke(vd, tex); + init_frame_smoke(vd); return; case TEX_VD_BLENDERVOXEL: if (!BLI_exists(vd->source_path)) return; -- cgit v1.2.3 From 3d73a37b64774ce246c0151f952b83a6fc78f2ac Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 08:15:10 +0000 Subject: hex color input wasnt clamped. --- source/blender/blenlib/intern/math_color.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 09a6b5992db..c481744156a 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -177,13 +177,16 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in void hex_to_rgb(char *hexcol, float *r, float *g, float *b) { unsigned int ri, gi, bi; - + if (hexcol[0] == '#') hexcol++; - - if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)) { + + if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)==3) { *r = ri / 255.0f; *g = gi / 255.0f; *b = bi / 255.0f; + CLAMP(*r, 0.0f, 1.0f); + CLAMP(*g, 0.0f, 1.0f); + CLAMP(*b, 0.0f, 1.0f); } } -- cgit v1.2.3 From d3bf6b7224d63420232464381203d51125dd3374 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 14 Oct 2010 09:01:03 +0000 Subject: Fix for [#24237] Hair dynamics with zero particles generates a segmentation fault --- source/blender/blenkernel/intern/particle.c | 1 + source/blender/blenkernel/intern/particle_system.c | 7 ++++++- source/blender/blenkernel/intern/pointcache.c | 14 +++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 723ff7faed3..ebbb3ea1020 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -402,6 +402,7 @@ void free_hair(Object *ob, ParticleSystem *psys, int dynamics) modifier_free((ModifierData*)psys->clmd); psys->clmd = NULL; + psys->pointcache = BKE_ptcache_add(&psys->ptcaches); } else { cloth_free_modifier(ob, psys->clmd); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 47a220dcefb..fa82d2c5359 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4016,8 +4016,13 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) switch(part->type) { case PART_HAIR: { + /* nothing to do so bail out early */ + if(psys->totpart == 0 && part->totpart == 0) { + psys_free_path_cache(psys, NULL); + free_hair(ob, psys, 0); + } /* (re-)create hair */ - if(hair_needs_recalc(psys)) { + else if(hair_needs_recalc(psys)) { float hcfra=0.0f; int i, recalc = psys->recalc; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a15e66ed843..f9d2c1c3fec 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2993,13 +2993,17 @@ void BKE_ptcache_update_info(PTCacheID *pid) void BKE_ptcache_validate(PointCache *cache, int framenr) { - cache->flag |= PTCACHE_SIMULATION_VALID; - cache->simframe = framenr; + if(cache) { + cache->flag |= PTCACHE_SIMULATION_VALID; + cache->simframe = framenr; + } } void BKE_ptcache_invalidate(PointCache *cache) { - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe = 0; - cache->last_exact = MIN2(cache->startframe, 0); + if(cache) { + cache->flag &= ~PTCACHE_SIMULATION_VALID; + cache->simframe = 0; + cache->last_exact = MIN2(cache->startframe, 0); + } } -- cgit v1.2.3 From 01733ecd6e2bdcaabfc38022a24cf298c27a1cad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 09:09:41 +0000 Subject: [#24243] wavefront animation export fix from dan grauer (kromar) --- release/scripts/op/io_scene_obj/export_obj.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/op/io_scene_obj/export_obj.py b/release/scripts/op/io_scene_obj/export_obj.py index abdb07c1a8e..49bc098ee54 100644 --- a/release/scripts/op/io_scene_obj/export_obj.py +++ b/release/scripts/op/io_scene_obj/export_obj.py @@ -750,7 +750,7 @@ def _write(context, filepath, # Export an animation? if EXPORT_ANIMATION: - scene_frames = range(scene.frame_start, context.frame_end + 1) # Up to and including the end frame. + scene_frames = range(scene.frame_start, scene.frame_end + 1) # Up to and including the end frame. else: scene_frames = [orig_frame] # Dont export an animation. -- cgit v1.2.3 From 3488b5dd6fae79788b916dba2ffb3d3157f7af8e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 14 Oct 2010 09:24:25 +0000 Subject: Update outliner when vertex group was added/removed --- source/blender/editors/space_outliner/space_outliner.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 5667ae51ee4..cb51b609a31 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -163,6 +163,14 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_TEXTURE: ED_region_tag_redraw(ar); break; + case NC_GEOM: + switch(wmn->data) { + case ND_DATA: + /* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */ + ED_region_tag_redraw(ar); + break; + } + break; } } -- cgit v1.2.3 From 380929624ca1d3d48de6e93ba321742bced3ee12 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 14 Oct 2010 09:31:14 +0000 Subject: Move MAXFLOAT to BLI_math_base.h --- source/blender/blenlib/BLI_math_base.h | 5 +++++ source/blender/editors/include/ED_types.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 48ad46282c2..77266e2e9d8 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -70,6 +70,11 @@ extern "C" { #define M_LN10 2.30258509299404568402 #endif +/* non-standard defines, used in some places */ +#ifndef MAXFLOAT +#define MAXFLOAT ((float)3.40282347e+38) +#endif + #ifndef sqrtf #define sqrtf(a) ((float)sqrt(a)) #endif diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 96a5d5857fa..1887a97e635 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -35,11 +35,6 @@ #define SELECT 1 #define ACTIVE 2 -/* nonstandard define, sometimes in math.h */ -#ifndef MAXFLOAT -#define MAXFLOAT ((float)3.40282347e+38) -#endif - /* buttons */ #define XIC 20 #define YIC 20 -- cgit v1.2.3 From 097a926d943c3b482305c295c60eaff7a85600d8 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 14 Oct 2010 09:40:56 +0000 Subject: Fix [#24201] COLLADA Exporter: Light source energy incorrect lamp->energy and lamp->distance are now taken in account by calculating the constant, linear and quadratic attenuations based on this. The import tries to do the reverse. Note: this will work only properly for lamps that have att1 and att2 set to 1.0 or 0.0, other lamptypes won't import correctly again. --- source/blender/collada/DocumentImporter.cpp | 47 ++++++++++++++++++++++++----- source/blender/collada/LightExporter.cpp | 47 ++++++++++++++++++++++++----- 2 files changed, 79 insertions(+), 15 deletions(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a406845c8a2..25787e18b06 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -29,9 +29,6 @@ #include #include // sort() -#include -#include - #include "COLLADAFWRoot.h" #include "COLLADAFWIWriter.h" #include "COLLADAFWStableHeaders.h" @@ -67,6 +64,7 @@ #include "BKE_image.h" #include "BLI_listbase.h" +#include "BLI_math.h" #include "BLI_string.h" #include "DNA_camera_types.h" @@ -841,6 +839,38 @@ public: lamp->g = col.getGreen(); lamp->b = col.getBlue(); } + float constatt = light->getConstantAttenuation().getValue(); + float linatt = light->getLinearAttenuation().getValue(); + float quadatt = light->getQuadraticAttenuation().getValue(); + float d = 25.0f; + float att1 = 0.0f; + float att2 = 0.0f; + + float e = 1.0f/constatt; + + /* NOTE: We assume for now that inv square is used for quadratic light + * and inv linear for linear light. Exported blender lin/quad weighted + * most likely will result in wrong import. */ + /* quadratic light */ + if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) { + //quadatt = att2/(d*d*(e*2)); + float invquadatt = 1.0f/quadatt; + float d2 = invquadatt / (2 * e); + d = sqrtf(d2); + } + // linear light + else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) { + //linatt = att1/(d*e); + float invlinatt = 1.0f/linatt; + d = invlinatt / e; + } else { + printf("no linear nor quad light, using defaults for attenuation, import will be incorrect: Lamp %s\n", lamp->id.name); + att2 = 1.0f; + } + + lamp->dist = d; + lamp->energy = e; + COLLADAFW::Light::LightType type = light->getLightType(); switch(type) { case COLLADAFW::Light::AMBIENT_LIGHT: @@ -851,9 +881,9 @@ public: case COLLADAFW::Light::SPOT_LIGHT: { lamp->type = LA_SPOT; - lamp->falloff_type = LA_FALLOFF_SLIDERS; - lamp->att1 = light->getLinearAttenuation().getValue(); - lamp->att2 = light->getQuadraticAttenuation().getValue(); + lamp->falloff_type = LA_FALLOFF_INVSQUARE; + lamp->att1 = att1; + lamp->att2 = att2; lamp->spotsize = light->getFallOffAngle().getValue(); lamp->spotblend = light->getFallOffExponent().getValue(); } @@ -866,8 +896,9 @@ public: case COLLADAFW::Light::POINT_LIGHT: { lamp->type = LA_LOCAL; - lamp->att1 = light->getLinearAttenuation().getValue(); - lamp->att2 = light->getQuadraticAttenuation().getValue(); + lamp->falloff_type = LA_FALLOFF_INVSQUARE; + lamp->att1 = att1; + lamp->att2 = att2; } break; case COLLADAFW::Light::UNDEFINED: diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index 7327b309889..5786c682d6a 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -30,6 +30,8 @@ #include "DNA_lamp_types.h" +#include "BLI_math.h" + #include "LightExporter.h" #include "collada_internal.h" @@ -48,6 +50,7 @@ void forEachLampObjectInScene(Scene *sce, Functor &f) } LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){} + void LightsExporter::exportLights(Scene *sce) { openLibrary(); @@ -62,18 +65,45 @@ void LightsExporter::operator()(Object *ob) std::string la_id(get_light_id(ob)); std::string la_name(id_name(la)); COLLADASW::Color col(la->r, la->g, la->b); - float e = la->energy; + float att1, att2; + float e, d, constatt, linatt, quadatt; + att1 = att2 = 0.0f; + + if(la->falloff_type==LA_FALLOFF_INVLINEAR) { + att1 = 1.0f; + att2 = 0.0f; + } + else if(la->falloff_type==LA_FALLOFF_INVSQUARE) { + att1 = 0.0f; + att2 = 1.0f; + } + else if(la->falloff_type==LA_FALLOFF_SLIDERS) { + att1 = la->att1; + att2 = la->att2; + } + + e = la->energy; + d = la->dist; + + constatt = linatt = quadatt = MAXFLOAT; + if(e > 0.0f) { + constatt = 1.0f/e; + linatt = att1/(d*e); + quadatt = att2/(d*d*(e*2)); + } // sun if (la->type == LA_SUN) { COLLADASW::DirectionalLight cla(mSW, la_id, la_name, e); cla.setColor(col); + cla.setConstantAttenuation(constatt); addLight(cla); } // hemi else if (la->type == LA_HEMI) { COLLADASW::AmbientLight cla(mSW, la_id, la_name, e); cla.setColor(col); + cla.setConstantAttenuation(constatt); addLight(cla); } // spot @@ -82,16 +112,18 @@ void LightsExporter::operator()(Object *ob) cla.setColor(col); cla.setFallOffAngle(la->spotsize); cla.setFallOffExponent(la->spotblend); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); + cla.setConstantAttenuation(constatt); + cla.setLinearAttenuation(linatt); + cla.setQuadraticAttenuation(quadatt); addLight(cla); } // lamp else if (la->type == LA_LOCAL) { COLLADASW::PointLight cla(mSW, la_id, la_name, e); cla.setColor(col); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); + cla.setConstantAttenuation(constatt); + cla.setLinearAttenuation(linatt); + cla.setQuadraticAttenuation(quadatt); addLight(cla); } // area lamp is not supported @@ -99,8 +131,9 @@ void LightsExporter::operator()(Object *ob) else { COLLADASW::PointLight cla(mSW, la_id, la_name, e); cla.setColor(col); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); + cla.setConstantAttenuation(constatt); + cla.setLinearAttenuation(linatt); + cla.setQuadraticAttenuation(quadatt); addLight(cla); } } -- cgit v1.2.3 From 6e2e7c00c1ca2f5053ef989b4d1564c4a1b24e6f Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 14 Oct 2010 10:34:04 +0000 Subject: fix potential crasher: malloc->calloc --- source/blender/blenkernel/intern/mesh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6f1cdefbcad..3e9287dd511 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1221,7 +1221,7 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r) { float (*tnorms)[3]= MEM_callocN(numVerts*sizeof(*tnorms), "tnorms"); - float *fnors= MEM_mallocN(sizeof(*fnors)*3*numFaces, "meshnormals"); + float *fnors= MEM_callocN(sizeof(*fnors)*3*numFaces, "meshnormals"); int i; for (i=0; i Date: Thu, 14 Oct 2010 11:33:51 +0000 Subject: fix for crash in own recent color picker commit, store the hsv color in block->_hsv, which is only accessed via a function so it can be moved to a better place later. also fix cineon define for scons/cmake. --- source/blender/editors/interface/interface_intern.h | 16 +++++++++------- source/blender/editors/interface/interface_regions.c | 4 +--- source/blender/editors/space_image/CMakeLists.txt | 4 ++++ source/blender/editors/space_image/SConscript | 2 ++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index e58095d9c54..91776b41817 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -303,15 +303,16 @@ struct uiBlock { short auto_open; double auto_open_last; - char active; // to keep blocks while drawing and free them afterwards - char tooltipdisabled; // to avoid tooltip after click - short lock; char *lockstr; + + char lock; + char active; // to keep blocks while drawing and free them afterwards + char tooltipdisabled; // to avoid tooltip after click + char endblock; // uiEndBlock done? float xofs, yofs; // offset to parent button int dobounds, mx, my; // for doing delayed int bounds, minbounds; // for doing delayed - int endblock; // uiEndBlock done? rctf safety; // pulldowns, to detect outside, can differ per case how it is created ListBase saferct; // uiSafetyRct list @@ -320,9 +321,10 @@ struct uiBlock { int puphash; // popup menu hash for memory - int color_profile; // color profile for correcting linear colors for display - void *evil_C; // XXX hack for dynamic operator enums + + float _hsv[3]; // XXX, only access via ui_block_hsv_get() + char color_profile; // color profile for correcting linear colors for display }; typedef struct uiSafetyRct { @@ -397,7 +399,7 @@ struct uiPopupBlockHandle { int butretval; int menuretval; float retvalue; - float retvec[8]; + float retvec[4]; }; uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c2b09750ee9..f6a13dae71c 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1940,9 +1940,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu VECCOPY(handle->retvec, but->editvec); - block->handle= handle; /* XXX, only for ui_block_hsv_get */ uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop); - block->handle= NULL; block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; uiBoundsBlock(block, 10); @@ -2440,5 +2438,5 @@ void uiPupBlockClose(bContext *C, uiBlock *block) float *ui_block_hsv_get(uiBlock *block) { - return block->handle->retvec+4; + return block->_hsv; } diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index d47f5a9820e..750c4b324d6 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -41,6 +41,10 @@ IF(WITH_IMAGE_TIFF) ADD_DEFINITIONS(-DWITH_TIFF) ENDIF(WITH_IMAGE_TIFF) +IF(WITH_IMAGE_CINEON) + ADD_DEFINITIONS(-DWITH_CINEON) +ENDIF(WITH_IMAGE_CINEON) + IF(WITH_LCMS) SET(INC ${INC} ${LCMS_INCLUDE_DIR}) ADD_DEFINITIONS(-DWITH_LCMS) diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index c7c31352185..15a7aeb828f 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -16,6 +16,8 @@ if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') +if env['WITH_BF_CINEON']: + defs.append('WITH_CINEON') if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] -- cgit v1.2.3 From f8d7451c737bb4a2c75cd2112934b7339733f67b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 12:24:08 +0000 Subject: remove unused args or tag as unused for image and screen editors, uiItemEnumR_string was ignoring name and icon args. --- source/blender/editors/include/ED_screen.h | 2 +- .../blender/editors/interface/interface_layout.c | 12 ++--- source/blender/editors/interface/interface_panel.c | 2 +- source/blender/editors/interface/view2d.c | 2 +- source/blender/editors/screen/area.c | 14 +++--- source/blender/editors/screen/glutil.c | 3 +- source/blender/editors/screen/screen_edit.c | 16 +++---- source/blender/editors/screen/screen_intern.h | 4 +- source/blender/editors/screen/screen_ops.c | 56 +++++++++++----------- source/blender/editors/screen/screendump.c | 4 +- source/blender/editors/space_image/image_buttons.c | 13 ++--- source/blender/editors/space_image/image_draw.c | 12 ++--- source/blender/editors/space_image/image_header.c | 2 +- source/blender/editors/space_image/image_ops.c | 30 ++++++------ source/blender/editors/space_image/space_image.c | 10 ++-- source/blender/windowmanager/intern/wm_draw.c | 8 ++-- source/blender/windowmanager/intern/wm_files.c | 4 +- 17 files changed, 98 insertions(+), 96 deletions(-) diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 7059e607218..62243a0e53e 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -69,7 +69,7 @@ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco); void ED_area_overdraw(struct bContext *C); -void ED_area_overdraw_flush(struct bContext *C, struct ScrArea *sa, struct ARegion *ar); +void ED_area_overdraw_flush(struct ScrArea *sa, struct ARegion *ar); /* areas */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 45b38a8c9a9..3db68fd89c0 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -472,7 +472,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt } /* callback for keymap item change button */ -static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v) +static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_v)) { uiBut *but= but_v; @@ -1026,7 +1026,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname for(a=0; item[a].identifier; a++) { if(item[a].value == ivalue) { - uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, (char*)item[a].name, item[a].icon); + uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : (char*)item[a].name, icon ? icon : item[a].icon); break; } } @@ -1324,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun } } -void uiItemM(uiLayout *layout, bContext *C, char *menuname, char *name, int icon) +void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon) { MenuType *mt; @@ -1434,7 +1434,7 @@ typedef struct MenuItemLevel { PointerRNA rnapoin; } MenuItemLevel; -static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg) +static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) { MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN); @@ -1465,7 +1465,7 @@ void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name, ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl); } -static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg) +static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) { MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN); @@ -1674,7 +1674,7 @@ static void ui_litem_layout_column(uiLayout *litem) } /* root layout */ -static void ui_litem_estimate_root(uiLayout *litem) +static void ui_litem_estimate_root(uiLayout *UNUSED(litem)) { /* nothing to do */ } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ca7065ca636..a7b74900a21 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -772,7 +772,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) } } -void uiBeginPanels(const bContext *C, ARegion *ar) +void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar) { Panel *pa; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index e0dc702bda0..a17d578fc06 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1097,7 +1097,7 @@ static void step_to_grid(float *step, int *power, int unit) * * - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames * - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals - * - winx = width of region we're drawing to, note: not used but keeping for compleateness. + * - winx = width of region we're drawing to, note: not used but keeping for completeness. * - winy = height of region we're drawing into */ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index e8fd2be324c..ae1388fb7f2 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -144,7 +144,7 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa) /* based on screen region draw tags, set draw tags in azones, and future region tabs etc */ /* only exported for WM */ -void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar) +void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) { AZone *az; @@ -187,7 +187,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) } -static void region_draw_azone(ScrArea *sa, AZone *az) +static void region_draw_azone(AZone *az) { GLUquadricObj *qobj = NULL; short midx = az->x1 + (az->x2 - az->x1)/2; @@ -247,7 +247,7 @@ void ED_area_overdraw(bContext *C) if(az->type==AZONE_AREA) { area_draw_azone(az->x1, az->y1, az->x2, az->y2); } else if(az->type==AZONE_REGION) { - region_draw_azone(sa, az); + region_draw_azone(az); } az->do_draw= 0; @@ -817,7 +817,7 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey) /* used for area initialize below */ -static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar) +static void region_subwindow(wmWindow *win, ARegion *ar) { if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) { if(ar->swinid) @@ -908,7 +908,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) /* region windows, default and own handlers */ for(ar= sa->regionbase.first; ar; ar= ar->next) { - region_subwindow(wm, win, ar); + region_subwindow(win, ar); if(ar->swinid) { /* default region handlers */ @@ -931,7 +931,7 @@ void ED_region_init(bContext *C, ARegion *ar) // ARegionType *at= ar->type; /* refresh can be called before window opened */ - region_subwindow(CTX_wm_manager(C), CTX_wm_window(C), ar); + region_subwindow(CTX_wm_window(C), ar); ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1; ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1; @@ -1156,7 +1156,7 @@ static char *editortype_pup(void) ); } -static void spacefunc(struct bContext *C, void *arg1, void *arg2) +static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype); ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 06da91c3e37..a6c4c77e468 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -527,7 +527,8 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void * glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f); } -void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct) +/* row_w is unused but kept for completeness */ +void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int UNUSED(row_w), float *rectf, int gamma_correct) { unsigned char *rect32; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 32e82571609..138ce19951d 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -309,7 +309,7 @@ static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa) /* return 0: no split possible */ /* else return (integer) screencoordinate split point */ -static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac) +static short testsplitpoint(ScrArea *sa, char dir, float fac) { short x, y; @@ -345,7 +345,7 @@ static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac) } } -ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac) +ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac) { ScrArea *newa=NULL; ScrVert *sv1, *sv2; @@ -353,7 +353,7 @@ ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac if(sa==NULL) return NULL; - split= testsplitpoint(win, sa, dir, fac); + split= testsplitpoint(sa, dir, fac); if(split==0) return NULL; if(dir=='h') { @@ -484,7 +484,7 @@ static void screen_copy(bScreen *to, bScreen *from) /* with sa as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ /* -1 = not valid check */ /* used with join operator */ -int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb) +int area_getorientation(ScrArea *sa, ScrArea *sb) { ScrVert *sav1, *sav2, *sav3, *sav4; ScrVert *sbv1, *sbv2, *sbv3, *sbv4; @@ -523,7 +523,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) { int dir; - dir = area_getorientation(scr, sa1, sa2); + dir = area_getorientation(sa1, sa2); /*printf("dir is : %i \n", dir);*/ if (dir < 0) @@ -861,7 +861,7 @@ static void scrarea_draw_shape_dark(ScrArea *sa, char dir) } /* draw screen area ligher with arrow shape ("eraser" of previous dark shape) */ -static void scrarea_draw_shape_light(ScrArea *sa, char dir) +static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir)) { glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); glEnable(GL_BLEND); @@ -993,7 +993,7 @@ void ED_screen_draw(wmWindow *win) /* blended join arrow */ if (sa1 && sa2) { - dir = area_getorientation(win->screen, sa1, sa2); + dir = area_getorientation(sa1, sa2); if (dir >= 0) { switch(dir) { case 0: /* W */ @@ -1613,7 +1613,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa) oldscreen->animtimer= NULL; /* returns the top small area */ - newa= area_split(win, sc, (ScrArea *)sc->areabase.first, 'h', 0.99f); + newa= area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f); ED_area_newspace(C, newa, SPACE_INFO); /* use random area when we have no active one, e.g. when the diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 79789b1876e..b20daf9a0c8 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -37,9 +37,9 @@ void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space); /* screen_edit.c */ ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2); -ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac); +ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac); int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2); -int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb); +int area_getorientation(ScrArea *sa, ScrArea *sb); void select_connected_scredge(bScreen *sc, ScrEdge *edge); void removenotused_scrverts(bScreen *sc); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6d4aa3ebe64..9ae16b1bfa6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -265,7 +265,7 @@ int ED_operator_posemode(bContext *C) if ((obact != CTX_data_edit_object(C))) { Object *obpose; - if(obpose= ED_object_pose_armature(obact)) { + if((obpose= ED_object_pose_armature(obact))) { if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) { return 1; } @@ -443,7 +443,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) } -static void actionzone_exit(bContext *C, wmOperator *op) +static void actionzone_exit(wmOperator *op) { if(op->customdata) MEM_freeN(op->customdata); @@ -489,7 +489,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event) /* region azone directly reacts on mouse clicks */ if(sad->az->type==AZONE_REGION) { actionzone_apply(C, op, AZONE_REGION); - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } else { @@ -529,16 +529,16 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event) sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* apply sends event */ actionzone_apply(C, op, sad->az->type); - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } break; case ESCKEY: - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; case LEFTMOUSE: - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; } @@ -589,7 +589,7 @@ typedef struct sAreaSwapData { ScrArea *sa1, *sa2; } sAreaSwapData; -static int area_swap_init(bContext *C, wmOperator *op, wmEvent *event) +static int area_swap_init(wmOperator *op, wmEvent *event) { sAreaSwapData *sd= NULL; sActionzoneData *sad= event->customdata; @@ -623,7 +623,7 @@ static int area_swap_cancel(bContext *C, wmOperator *op) static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(!area_swap_init(C, op, event)) + if(!area_swap_init(op, event)) return OPERATOR_PASS_THROUGH; /* add modal handler */ @@ -709,7 +709,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) /* poll() checks area context, but we don't accept full-area windows */ if(sc->full != SCREENNORMAL) { if(event->type==EVT_ACTIONZONE_AREA) - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; } @@ -731,7 +731,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); if(event->type==EVT_ACTIONZONE_AREA) - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } @@ -1125,7 +1125,7 @@ static int area_split_apply(bContext *C, wmOperator *op) fac= RNA_float_get(op->ptr, "factor"); dir= RNA_enum_get(op->ptr, "direction"); - sd->narea= area_split(CTX_wm_window(C), sc, sd->sarea, dir, fac); + sd->narea= area_split(sc, sd->sarea, dir, fac); if(sd->narea) { ScrVert *sv; @@ -1741,7 +1741,7 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ -static int screen_full_area_exec(bContext *C, wmOperator *op) +static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op)) { ED_screen_full_toggle(C, CTX_wm_window(C), CTX_wm_area(C)); return OPERATOR_FINISHED; @@ -1948,7 +1948,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) if (sa) { if (jd->sa1 != sa) { - dir = area_getorientation(sc, jd->sa1, sa); + dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; @@ -1959,7 +1959,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) we check if area has common border with the one marked for removal in this case we can swap areas. */ - dir = area_getorientation(sc, sa, jd->sa2); + dir = area_getorientation(sa, jd->sa2); if (dir >= 0) { if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; @@ -1985,13 +1985,13 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) jd->sa2 = sa; if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO; - dir = area_getorientation(sc, jd->sa1, jd->sa2); + dir = area_getorientation(jd->sa1, jd->sa2); if (dir < 0) { printf("oops, didn't expect that!\n"); } } else { - dir = area_getorientation(sc, jd->sa1, sa); + dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; @@ -2048,7 +2048,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) /* ************** repeat last operator ***************************** */ -static int repeat_last_exec(bContext *C, wmOperator *op) +static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) { wmOperator *lastop= CTX_wm_manager(C)->operators.last; @@ -2072,7 +2072,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) } -static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *lastop; @@ -2129,7 +2129,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) /* ********************** redo operator ***************************** */ -static int redo_last_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *lastop; @@ -2257,7 +2257,7 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) /* ************** region flip operator ***************************** */ /* flip a region alignment */ -static int region_flip_exec(bContext *C, wmOperator *op) +static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); @@ -2295,7 +2295,7 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) /* ************** header flip operator ***************************** */ /* flip a header region alignment */ -static int header_flip_exec(bContext *C, wmOperator *op) +static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); @@ -2349,7 +2349,7 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot) /* ************** header tools operator ***************************** */ -static int header_toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); @@ -2463,7 +2463,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) return 0; } -static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) +static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { bScreen *screen= CTX_wm_screen(C); @@ -2672,7 +2672,7 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate"); } -static int screen_animation_cancel_exec(bContext *C, wmOperator *op) +static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *screen= CTX_wm_screen(C); @@ -2800,7 +2800,7 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) /* *********** show user pref window ****** */ -static int userpref_show_invoke(bContext *C, wmOperator *unused, wmEvent *event) +static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ScrArea *sa; rcti rect; @@ -2839,7 +2839,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) /********************* new screen operator *********************/ -static int screen_new_exec(bContext *C, wmOperator *op) +static int screen_new_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *win= CTX_wm_window(C); bScreen *sc= CTX_wm_screen(C); @@ -2866,7 +2866,7 @@ void SCREEN_OT_new(wmOperatorType *ot) /********************* delete screen operator *********************/ -static int screen_delete_exec(bContext *C, wmOperator *op) +static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *sc= CTX_wm_screen(C); @@ -2937,7 +2937,7 @@ void SCENE_OT_new(wmOperatorType *ot) /********************* delete scene operator *********************/ -static int scene_delete_exec(bContext *C, wmOperator *op) +static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 56efa0a5a83..f1e11430573 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -132,7 +132,7 @@ static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy, int fscre } -static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { unsigned int *dumprect; int dumpsx, dumpsy; @@ -214,7 +214,7 @@ static void screenshot_updatejob(void *sjv) /* only this runs inside thread */ -static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *progress) +static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress)) { ScreenshotJob *sj= sjv; RenderData rd= sj->scene->r; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 840d4943c56..353d741fe27 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -97,7 +97,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block); -static void do_image_panel_events(bContext *C, void *arg, int event) +static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event) { SpaceImage *sima= CTX_wm_space_image(C); @@ -300,7 +300,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block) /* is used for both read and write... */ -static int image_panel_poll(const bContext *C, PanelType *pt) +static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; @@ -493,6 +493,7 @@ static char *slot_menu() return str; } +/* TODO, curlay should be removed? */ static char *layer_menu(RenderResult *rr, short *curlay) { RenderLayer *rl; @@ -739,7 +740,7 @@ typedef struct RNAUpdateCb { ImageUser *iuser; } RNAUpdateCb; -static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) +static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb; @@ -951,7 +952,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser } } -static int image_panel_uv_poll(const bContext *C, PanelType *pt) +static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt)) { Object *obedit= CTX_data_edit_object(C); return ED_uvedit_test(obedit); @@ -996,7 +997,7 @@ void image_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int image_properties(bContext *C, wmOperator *op) +static int image_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= image_has_buttons_region(sa); @@ -1019,7 +1020,7 @@ void IMAGE_OT_properties(wmOperatorType *ot) ot->flag= 0; } -static int image_scopes(bContext *C, wmOperator *op) +static int image_scopes(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= image_has_scope_region(sa); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f29d1bc033f..48524d2728f 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -70,7 +70,7 @@ #define HEADER_HEIGHT 18 -static void image_verify_buffer_float(SpaceImage *sima, Image *ima, ImBuf *ibuf, int color_manage) +static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage) { /* detect if we need to redo the curve map. ibuf->rect is zero for compositor and render results after change @@ -367,7 +367,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image } #ifdef WITH_LCMS else if(sima->flag & SI_COLOR_CORRECTION) { - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) { unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */ @@ -387,7 +387,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image /* we don't draw floats buffers directly but * convert them, and optionally apply curves */ - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); if(ibuf->rect) glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); @@ -440,7 +440,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, sima->curtile = ima->xrep*ima->yrep - 1; /* create char buffer from float if needed */ - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); /* retrieve part of image buffer */ dx= ibuf->x/ima->xrep; @@ -579,7 +579,7 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh return rect; } -static void draw_image_paint_helpers(SpaceImage *sima, ARegion *ar, Scene *scene, float zoomx, float zoomy) +static void draw_image_paint_helpers(ARegion *ar, Scene *scene, float zoomx, float zoomy) { Brush *brush; int x, y, w, h; @@ -658,7 +658,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy); /* paint helpers */ - draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy); + draw_image_paint_helpers(ar, scene, zoomx, zoomy); /* XXX integrate this code */ diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index 7ecb2565e72..498b3b80bd5 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -53,7 +53,7 @@ /********************** toolbox operator *********************/ -static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0bcc2439756..3e33fef6904 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -432,7 +432,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) * Default behavior is to reset the position of the image and set the zoom to 1 * If the image will not fit within the window rectangle, the zoom is adjusted */ -static int view_all_exec(bContext *C, wmOperator *op) +static int view_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -486,7 +486,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot) /********************** view selected operator *********************/ -static int view_selected_exec(bContext *C, wmOperator *op) +static int view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -543,7 +543,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) /********************** view zoom in/out operator *********************/ -static int view_zoom_in_exec(bContext *C, wmOperator *op) +static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -566,7 +566,7 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot) ot->poll= space_image_main_area_poll; } -static int view_zoom_out_exec(bContext *C, wmOperator *op) +static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -679,7 +679,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; @@ -736,7 +736,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); char *path=U.textudir; @@ -806,7 +806,7 @@ static int replace_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int replace_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); @@ -961,7 +961,7 @@ static int save_as_exec(bContext *C, wmOperator *op) } -static int save_as_check(bContext *C, wmOperator *op) +static int save_as_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -972,7 +972,7 @@ static int save_as_check(bContext *C, wmOperator *op) return FALSE; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Image *ima = ED_space_image(sima); @@ -1188,7 +1188,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) /******************** reload image operator ********************/ -static int reload_exec(bContext *C, wmOperator *op) +static int reload_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); SpaceImage *sima= CTX_wm_space_image(C); @@ -1347,7 +1347,7 @@ static int pack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); @@ -1507,7 +1507,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); @@ -1570,7 +1570,7 @@ typedef struct ImageSampleInfo { int draw; } ImageSampleInfo; -static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) +static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) { ImageSampleInfo *info= arg_info; @@ -1985,7 +1985,7 @@ static int record_composite_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RecordCompositeData *rcd= op->customdata; @@ -2052,7 +2052,7 @@ static int cycle_render_slot_poll(bContext *C) return (ima && ima->type == IMA_TYPE_R_RESULT); } -static int cycle_render_slot_exec(bContext *C, wmOperator *op) +static int cycle_render_slot_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); int a, slot, cur= ima->render_slot; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 250ece6d92a..d77d153a324 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -369,7 +369,7 @@ ARegion *image_has_scope_region(ScrArea *sa) /* ******************** default callbacks for image space ***************** */ -static SpaceLink *image_new(const bContext *C) +static SpaceLink *image_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceImage *simage; @@ -429,7 +429,7 @@ static void image_free(SpaceLink *sl) /* spacetype; init callback, add handlers */ -static void image_init(struct wmWindowManager *wm, ScrArea *sa) +static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { ListBase *lb= WM_dropboxmap_find("Image", SPACE_IMAGE, 0); @@ -533,7 +533,7 @@ void image_keymap(struct wmKeyConfig *keyconf) } /* dropboxes */ -static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int image_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? */ @@ -557,7 +557,7 @@ static void image_dropboxes(void) -static void image_refresh(const bContext *C, ScrArea *sa) +static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) { SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); @@ -884,7 +884,7 @@ static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn) /************************* header region **************************/ /* add handlers, stuff you only do once or on area/region changes */ -static void image_header_area_init(wmWindowManager *wm, ARegion *ar) +static void image_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 81417e8f8f1..9123cdeef20 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -127,7 +127,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); } } @@ -242,7 +242,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); if(exchange) @@ -253,7 +253,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); ar->swap= WIN_BOTH_OK; @@ -592,7 +592,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) if(ar->swinid && ar->do_draw) { CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); copytex= 1; } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 0b8a4759bca..74a8310c2b3 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -526,7 +526,7 @@ static void do_history(char *name, ReportList *reports) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); } -static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt) +static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) { /* will be scaled down, but gives some nice oversampling */ ImBuf *ibuf; @@ -627,7 +627,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re ED_sculpt_force_update(C); /* blend file thumbnail */ - ibuf_thumb= blend_file_thumb(di, CTX_data_scene(C), &thumb); + ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); /* rename to .blend1, do this as last before write */ do_history(di, reports); -- cgit v1.2.3 From f8e7ad91e99de278beaee3ff42efdf95a89f857e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 13:17:34 +0000 Subject: fix unused args warnings and remove some unused args. --- .../blender/editors/interface/interface_handlers.c | 44 +++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 7487ed904e4..71695693568 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -429,7 +429,7 @@ static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data data->applied= 1; } -static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data) +static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) { double value; int w, lvalue, push; @@ -896,7 +896,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case BUT_TOGDUAL: case OPTION: case OPTIONN: - ui_apply_but_TOG(C, block, but, data); + ui_apply_but_TOG(C, but, data); break; case ROW: case LISTROW: @@ -3567,7 +3567,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt return WM_UI_HANDLER_CONTINUE; } -static int in_scope_resize_zone(uiBut *but, int x, int y) +static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y) { // bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD); return (y < but->y1 + SCOPE_RESIZE_PAD); @@ -3944,13 +3944,13 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE return WM_UI_HANDLER_CONTINUE; } -static void but_shortcut_name_func(bContext *C, void *arg1, int event) +static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) { uiBut *but = (uiBut *)arg1; - - char buf[512], *butstr, *cpoin; - + if (but->optype) { + char buf[512], *butstr, *cpoin; + IDProperty *prop= (but->opptr)? but->opptr->data: NULL; /* complex code to change name of button */ @@ -4033,7 +4033,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) uiBlockSetHandleFunc(block, but_shortcut_name_func, but); uiBlockSetFlag(block, UI_BLOCK_RET_1); uiBlockSetDirection(block, UI_CENTER); - + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); @@ -4044,14 +4044,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) return block; } -static void popup_change_shortcut_func(bContext *C, void *arg1, void *arg2) +static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); uiPupBlock(C, menu_change_shortcut, but); } -static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) +static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; wmKeyMap *km; @@ -4065,7 +4065,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) but_shortcut_name_func(C, but, 0); } -static void popup_add_shortcut_func(bContext *C, void *arg1, void *arg2) +static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); @@ -4573,7 +4573,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) return 1; } -static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) +static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but, *butover= NULL; @@ -4605,7 +4605,7 @@ static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) return butover; } -static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) +static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but; @@ -5026,11 +5026,10 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event) static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar) { - wmWindow *win= CTX_wm_window(C); uiBut *but; if(event->type == MOUSEMOVE) { - but= ui_but_find_mouse_over(win, ar, event->x, event->y); + but= ui_but_find_mouse_over(ar, event->x, event->y); if(but) button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); } @@ -5108,7 +5107,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) data->cancel= 1; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) { + else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) { data->cancel= 1; button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -5206,7 +5205,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) else if(data->state == BUTTON_STATE_MENU_OPEN) { switch(event->type) { case MOUSEMOVE: { - uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y); + uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y); if(bt && bt->active != data) { if(but->type != COL) /* exception */ @@ -5241,8 +5240,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar) { - wmWindow *win= CTX_wm_window(C); - uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y); + uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y); int retval= WM_UI_HANDLER_CONTINUE; int value, min, max; @@ -5429,7 +5427,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men return menu->dotowards; } -int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int topmenu) +int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu)) { ARegion *ar; uiBlock *block; @@ -5793,7 +5791,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa /* *************** UI event handlers **************** */ -static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) +static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; @@ -5831,7 +5829,7 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) return retval; } -static void ui_handler_remove_region(bContext *C, void *userdata) +static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata)) { bScreen *sc; ARegion *ar; @@ -5851,7 +5849,7 @@ static void ui_handler_remove_region(bContext *C, void *userdata) ui_apply_but_funcs_after(C); } -static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata) +static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; -- cgit v1.2.3 From 2a7f585fbaa943a15ac757b466da096eaf163fbe Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 13:18:42 +0000 Subject: bugfix [#23070] some shortcuts cannot be saved in a usual way --- source/blender/editors/interface/interface_handlers.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 71695693568..c450b41b183 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3955,7 +3955,8 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) /* complex code to change name of button */ if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { - + wmKeyMap *km= NULL; + butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps"); // XXX but->str changed... should not, remove the hotkey from it @@ -3971,6 +3972,11 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) MEM_freeN(butstr); ui_check_but(but); + + /* set the keymap editable else the key wont save */ + WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); + WM_keymap_copy_to_user(km); + } else { /* shortcut was removed */ cpoin= strchr(but->str, '|'); -- cgit v1.2.3 From 8ce2c26da36608873f8d674024dfd40b3de19756 Mon Sep 17 00:00:00 2001 From: Stefan Gartner Date: Thu, 14 Oct 2010 19:30:55 +0000 Subject: darwin Makefiles: copy release scripts and python modules to where blender looks for them, i.e. blender.app/Content/MacOS/$(VERSION) instead if blender.app/Content/MacOS/.blender --- source/darwin/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/darwin/Makefile b/source/darwin/Makefile index 5c68f43f606..a9d9d7f2f20 100644 --- a/source/darwin/Makefile +++ b/source/darwin/Makefile @@ -30,6 +30,7 @@ include nan_definitions.mk DIR = $(OCGDIR)/$(DEBUG_DIR) +VERSION = $(shell $(NANBLENDERHOME)/release/getversion.py) PYARCHIVE = python_$(MACOSX_ARCHITECTURE).zip @@ -38,22 +39,25 @@ all:: @echo "---> creating directory structure for $(APPLICATION)" @rm -rf $(DIR)/bin/$(APPLICATION).app @cp -R $(APPLICATION).app $(DIR)/bin - @cat $(APPLICATION).app/Contents/Info.plist | sed s/VERSION/`cat ../../release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > $(DIR)/bin/$(APPLICATION).app/Contents/Info.plist + @cat $(APPLICATION).app/Contents/Info.plist | sed s/VERSION/$(VERSION)/ | sed s/DATE/`date +'%Y-%b-%d'`/ > $(DIR)/bin/$(APPLICATION).app/Contents/Info.plist @echo "---> copying binary" @cp $(DIR)/bin/$(APPLICATION) $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/ @echo "---> adding excutable attributes" @chmod +x $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(APPLICATION) ifeq ($(APPLICATION), blender) + @mkdir -p $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION) @echo "---> copying message files" @cp -R $(NANBLENDERHOME)/release/bin/.blender/locale $(DIR)/bin/$(APPLICATION).app/Contents/Resources @echo "---> copying .Blanguages" @cp $(NANBLENDERHOME)/release/bin/.blender/.Blanguages $(DIR)/bin/$(APPLICATION).app/Contents/Resources - @echo "---> copying .blender/ scripts" - @cp -R $(NANBLENDERHOME)/release/bin/.blender $(DIR)/bin/$(APPLICATION).app/Contents/MacOS - @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/ + @echo "---> copying bfont.ttf" + @cp $(NANBLENDERHOME)/release/datafiles/bfont.ttf $(DIR)/bin/$(APPLICATION).app/Contents/Resources/ + @cp $(NANBLENDERHOME)/release/datafiles/bmonofont.ttf $(DIR)/bin/$(APPLICATION).app/Contents/Resources/ + @echo "---> copying release scripts" + @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/ @echo "---> copying python modules" - @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python - @unzip -q $(LCGDIR)/release/$(PYARCHIVE) -d $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python/ + @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/python + @unzip -q $(LCGDIR)/release/$(PYARCHIVE) -d $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/python/ endif @echo "---> removing SVN directories and Mac hidden files from distribution" @find $(DIR)/bin/$(APPLICATION).app -name CVS -prune -exec rm -rf {} \; -- cgit v1.2.3 From 7eaf56a97bf56905e2613c883694f710c7b9e472 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 14 Oct 2010 20:19:52 +0000 Subject: Fix #24257: Last shape key not applied as Basis shape. --- source/blender/editors/object/object_shapekey.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 7b1ab933e28..0effa01553b 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -53,6 +53,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_curve.h" #include "BLO_sys_types.h" // for intptr_t support @@ -100,8 +101,25 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) BLI_remlink(&key->block, kb); key->totkey--; - if(key->refkey== kb) + if(key->refkey== kb) { key->refkey= key->block.first; + + if(key->refkey) { + /* apply new basis key on original data */ + switch(ob->type) { + case OB_MESH: + key_to_mesh(key->refkey, ob->data); + break; + case OB_CURVE: + case OB_SURF: + key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data)); + break; + case OB_LATTICE: + key_to_latt(key->refkey, ob->data); + break; + } + } + } if(kb->data) MEM_freeN(kb->data); MEM_freeN(kb); -- cgit v1.2.3 From f81248265d0792029000bb53d23130f88c27a20a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 01:36:14 +0000 Subject: tag UNUSED() for operator exec() and invoke() functions. --- .../blender/editors/animation/anim_channels_edit.c | 6 +-- source/blender/editors/animation/anim_markers.c | 6 +-- source/blender/editors/animation/anim_ops.c | 4 +- source/blender/editors/animation/drivers.c | 4 +- source/blender/editors/animation/keyframing.c | 2 +- source/blender/editors/animation/keyingsets.c | 4 +- source/blender/editors/armature/editarmature.c | 38 +++++++++--------- .../blender/editors/armature/editarmature_sketch.c | 10 ++--- source/blender/editors/armature/poseSlide.c | 6 +-- source/blender/editors/armature/poselib.c | 6 +-- source/blender/editors/armature/poseobject.c | 22 +++++------ source/blender/editors/curve/editcurve.c | 44 ++++++++++----------- source/blender/editors/curve/editfont.c | 18 ++++----- source/blender/editors/interface/interface_ops.c | 6 +-- source/blender/editors/interface/view2d_ops.c | 2 +- source/blender/editors/mesh/editmesh_add.c | 4 +- source/blender/editors/mesh/editmesh_mods.c | 14 +++---- source/blender/editors/mesh/editmesh_tools.c | 26 ++++++------ source/blender/editors/mesh/mesh_data.c | 12 +++--- source/blender/editors/mesh/meshtools.c | 2 +- source/blender/editors/metaball/mball_edit.c | 10 ++--- source/blender/editors/object/object_add.c | 8 ++-- source/blender/editors/object/object_bake.c | 4 +- source/blender/editors/object/object_constraint.c | 24 +++++------ source/blender/editors/object/object_edit.c | 20 +++++----- source/blender/editors/object/object_group.c | 6 +-- source/blender/editors/object/object_hook.c | 2 +- source/blender/editors/object/object_lattice.c | 2 +- source/blender/editors/object/object_modifier.c | 26 ++++++------ source/blender/editors/object/object_relations.c | 6 +-- source/blender/editors/object/object_select.c | 2 +- source/blender/editors/object/object_shapekey.c | 6 +-- source/blender/editors/object/object_transform.c | 10 ++--- source/blender/editors/object/object_vgroup.c | 16 ++++---- source/blender/editors/physics/particle_boids.c | 14 +++---- source/blender/editors/physics/particle_edit.c | 20 +++++----- source/blender/editors/physics/particle_object.c | 22 +++++------ .../blender/editors/physics/physics_pointcache.c | 10 ++--- source/blender/editors/render/render_internal.c | 6 +-- source/blender/editors/render/render_shading.c | 36 ++++++++--------- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_ops.c | 6 +-- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 8 ++-- source/blender/editors/sound/sound_ops.c | 2 +- source/blender/editors/space_action/action_edit.c | 16 ++++---- .../blender/editors/space_action/action_select.c | 6 +-- source/blender/editors/space_buttons/buttons_ops.c | 4 +- source/blender/editors/space_file/file_ops.c | 30 +++++++------- source/blender/editors/space_graph/graph_buttons.c | 2 +- source/blender/editors/space_graph/graph_edit.c | 24 +++++------ source/blender/editors/space_graph/graph_ops.c | 2 +- source/blender/editors/space_graph/graph_select.c | 6 +-- source/blender/editors/space_info/info_ops.c | 16 ++++---- source/blender/editors/space_logic/logic_buttons.c | 2 +- source/blender/editors/space_logic/logic_ops.c | 12 +++--- source/blender/editors/space_nla/nla_buttons.c | 2 +- source/blender/editors/space_nla/nla_channels.c | 2 +- source/blender/editors/space_nla/nla_edit.c | 26 ++++++------ source/blender/editors/space_node/node_buttons.c | 2 +- source/blender/editors/space_node/node_edit.c | 24 +++++------ source/blender/editors/space_node/node_select.c | 12 +++--- source/blender/editors/space_node/node_state.c | 2 +- source/blender/editors/space_outliner/outliner.c | 24 +++++------ source/blender/editors/space_script/script_edit.c | 2 +- .../editors/space_sequencer/sequencer_buttons.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 36 ++++++++--------- .../editors/space_sequencer/sequencer_select.c | 10 ++--- source/blender/editors/space_text/text_header.c | 2 +- source/blender/editors/space_text/text_ops.c | 46 +++++++++++----------- source/blender/editors/space_time/time_ops.c | 6 +-- .../blender/editors/space_view3d/view3d_buttons.c | 2 +- source/blender/editors/space_view3d/view3d_edit.c | 14 +++---- source/blender/editors/space_view3d/view3d_snap.c | 12 +++--- .../blender/editors/space_view3d/view3d_toolbar.c | 2 +- source/blender/editors/space_view3d/view3d_view.c | 10 ++--- source/blender/editors/transform/transform_ops.c | 8 ++-- source/blender/editors/util/undo.c | 4 +- source/blender/editors/uvedit/uvedit_ops.c | 8 ++-- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 8 ++-- 80 files changed, 446 insertions(+), 446 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 4414da222a6..1ac17aee871 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -922,7 +922,7 @@ void ANIM_OT_channels_move_bottom (wmOperatorType *ot) /* ******************** Delete Channel Operator *********************** */ -static int animchannels_delete_exec(bContext *C, wmOperator *op) +static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1023,7 +1023,7 @@ void ANIM_OT_channels_delete (wmOperatorType *ot) /* ******************** Set Channel Visibility Operator *********************** */ /* NOTE: this operator is only valid in the Graph Editor channels region */ -static int animchannels_visibility_set_exec(bContext *C, wmOperator *op) +static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1101,7 +1101,7 @@ void ANIM_OT_channels_visibility_set (wmOperatorType *ot) /* ******************** Toggle Channel Visibility Operator *********************** */ /* NOTE: this operator is only valid in the Graph Editor channels region */ -static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op) +static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 5c4d231fd3a..0f9ef45ac94 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -336,7 +336,7 @@ void draw_markers_time(const bContext *C, int flag) /* ************************** add markers *************************** */ /* add TimeMarker at curent frame */ -static int ed_marker_add(bContext *C, wmOperator *op) +static int ed_marker_add(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers= context_get_markers(C); TimeMarker *marker; @@ -1033,7 +1033,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot) /* ******************************* remove marker ***************** */ /* remove selected TimeMarkers */ -static int ed_marker_delete_exec(bContext *C, wmOperator *op) +static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers= context_get_markers(C); TimeMarker *marker, *nmarker; @@ -1130,7 +1130,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot) /* ******************************* camera bind marker ***************** */ /* remove selected TimeMarkers */ -static int ed_marker_camera_bind_exec(bContext *C, wmOperator *op) +static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ListBase *markers= context_get_markers(C); diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9b9c9435518..a80ea3e12bf 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -233,7 +233,7 @@ void ANIM_OT_previewrange_set(wmOperatorType *ot) /* ****************** clear preview range operator ****************************/ -static int previewrange_clear_exec(bContext *C, wmOperator *op) +static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ScrArea *curarea= CTX_wm_area(C); @@ -269,7 +269,7 @@ void ANIM_OT_previewrange_clear(wmOperatorType *ot) /* ****************** time display toggle operator ****************************/ -static int toggle_time_exec(bContext *C, wmOperator *op) +static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *curarea= CTX_wm_area(C); diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 898d7db89fc..28b51ad0602 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -472,7 +472,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot) /* Copy Driver Button Operator ------------------------ */ -static int copy_driver_button_exec (bContext *C, wmOperator *op) +static int copy_driver_button_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop= NULL; @@ -518,7 +518,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot) /* Paste Driver Button Operator ------------------------ */ -static int paste_driver_button_exec (bContext *C, wmOperator *op) +static int paste_driver_button_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop= NULL; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index e92065eea91..160116bb1a3 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1146,7 +1146,7 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot) * then calls the menu if necessary before */ -static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 77e0c84d2f3..55c14411328 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -107,7 +107,7 @@ static int keyingset_poll_activePath_edit (bContext *C) /* Add a Default (Empty) Keying Set ------------------------- */ -static int add_default_keyingset_exec (bContext *C, wmOperator *op) +static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); short flag=0, keyingflag=0; @@ -464,7 +464,7 @@ void ANIM_OT_keyingset_button_remove (wmOperatorType *ot) /* Change Active KeyingSet Operator ------------------------ */ /* This operator checks if a menu should be shown for choosing the KeyingSet to make the active one */ -static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* call the menu, which will call this operator again, hence the cancelled */ ANIM_keying_sets_menu_setup(C, op->type->name, "ANIM_OT_keying_set_active_set"); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 49c3ac06b94..f786b50fcf9 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -655,7 +655,7 @@ void POSE_OT_armature_apply (wmOperatorType *ot) /* set the current pose as the restpose */ -static int pose_visual_transform_apply_exec (bContext *C, wmOperator *op) +static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object @@ -817,7 +817,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } /* join armature exec is exported for use in object->join objects operator... */ -int join_armature_exec(bContext *C, wmOperator *op) +int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1127,7 +1127,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel) } /* separate selected bones into their armature */ -static int separate_armature_exec (bContext *C, wmOperator *op) +static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1787,7 +1787,7 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo) /* previously delete_armature */ /* only editmode! */ -static int armature_delete_selected_exec(bContext *C, wmOperator *op) +static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) { bArmature *arm; EditBone *curBone, *next; @@ -2377,7 +2377,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) /* previously addvert_armature */ /* the ctrl-click method */ -static int armature_click_extrude_exec(bContext *C, wmOperator *op) +static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d; bArmature *arm; @@ -2691,7 +2691,7 @@ EditBone *duplicateEditBone(EditBone *curBone, char *name, ListBase *editbones, } /* previously adduplicate_armature */ -static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) +static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op)) { bArmature *arm; EditBone *eBone = NULL; @@ -3262,7 +3262,7 @@ void ARMATURE_OT_merge (wmOperatorType *ot) /* ************** END Add/Remove stuff in editmode ************ */ /* *************** Tools in editmode *********** */ -static int armature_hide_exec(bContext *C, wmOperator *op) +static int armature_hide_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -3302,7 +3302,7 @@ void ARMATURE_OT_hide(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int armature_reveal_exec(bContext *C, wmOperator *op) +static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -3724,7 +3724,7 @@ void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) -static int armature_subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int armature_subdivs_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; @@ -3788,7 +3788,7 @@ void ARMATURE_OT_subdivs(wmOperatorType *ot) * this to be done easily. */ -static int armature_switch_direction_exec(bContext *C, wmOperator *op) +static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); bArmature *arm= (bArmature *)ob->data; @@ -4009,7 +4009,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int armature_parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { EditBone *actbone = CTX_data_active_bone(C); uiPopupMenu *pup= uiPupMenuBegin(C, "Make Parent ", 0); @@ -4106,7 +4106,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot) /* **************** Selections ******************/ -static int armature_select_inverse_exec(bContext *C, wmOperator *op) +static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { /* Set the flags */ CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) { @@ -4922,7 +4922,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, } /* ************* Clear Pose *****************************/ -static int pose_clear_scale_exec(bContext *C, wmOperator *op) +static int pose_clear_scale_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -4990,7 +4990,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_clear_loc_exec(bContext *C, wmOperator *op) +static int pose_clear_loc_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -5059,7 +5059,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_clear_rot_exec(bContext *C, wmOperator *op) +static int pose_clear_rot_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -5215,7 +5215,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot) /* ***************** selections ********************** */ -static int pose_select_inverse_exec(bContext *C, wmOperator *op) +static int pose_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { /* Set the flags */ @@ -5312,7 +5312,7 @@ void POSE_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } -static int pose_select_parent_exec(bContext *C, wmOperator *op) +static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan,*parent; @@ -5437,7 +5437,7 @@ static int show_pose_bone(Object *ob, Bone *bone, void *ptr) } /* active object is armature in posemode, poll checked */ -static int pose_reveal_exec(bContext *C, wmOperator *op) +static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; @@ -5634,7 +5634,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) } -static int armature_flip_names_exec (bContext *C, wmOperator *op) +static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); bArmature *arm; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 241301b8ee1..84f8513878c 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -2452,7 +2452,7 @@ void BDR_drawSketch(const bContext *C) } } -static int sketch_delete(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch) @@ -2558,7 +2558,7 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create) return sketch; } -static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2569,7 +2569,7 @@ static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } -static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2581,7 +2581,7 @@ static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } -static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2595,7 +2595,7 @@ static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } -static int sketch_select(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_select(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch) diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 482d97811a3..64426b7dc6b 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -612,7 +612,7 @@ static void pose_slide_opdef_properties (wmOperatorType *ot) /* ------------------------------------ */ /* invoke() - for 'push' mode */ -static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; @@ -669,7 +669,7 @@ void POSE_OT_push (wmOperatorType *ot) /* ........................ */ /* invoke() - for 'relax' mode */ -static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; @@ -726,7 +726,7 @@ void POSE_OT_relax (wmOperatorType *ot) /* ........................ */ /* invoke() - for 'breakdown' mode */ -static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 9292c92294b..3a90f75d2a1 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -290,7 +290,7 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, } } -static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -1034,7 +1034,7 @@ static void poselib_preview_handle_search (tPoseLib_PreviewData *pld, unsigned s } /* handle events for poselib_preview_poses */ -static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *event) +static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wmEvent *event) { tPoseLib_PreviewData *pld= op->customdata; int ret = OPERATOR_RUNNING_MODAL; @@ -1411,7 +1411,7 @@ static int poselib_preview_modal (bContext *C, wmOperator *op, wmEvent *event) } /* Modal Operator init */ -static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { tPoseLib_PreviewData *pld; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 4aff2f1e915..fa7f01da7b9 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -242,7 +242,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) /* 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 *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); @@ -319,7 +319,7 @@ void ED_pose_clear_paths(Object *ob) } /* operator callback for this */ -static int pose_clear_paths_exec (bContext *C, wmOperator *op) +static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -360,7 +360,7 @@ void POSE_OT_paths_clear (wmOperatorType *ot) /* ******************* Select Constraint Target Operator ************* */ -static int pose_select_constraint_target_exec(bContext *C, wmOperator *op) +static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; @@ -1100,7 +1100,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* ********************************************** */ -static int pose_group_add_exec (bContext *C, wmOperator *op) +static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1140,7 +1140,7 @@ void POSE_OT_group_add (wmOperatorType *ot) } -static int pose_group_remove_exec (bContext *C, wmOperator *op) +static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1182,7 +1182,7 @@ void POSE_OT_group_remove (wmOperatorType *ot) /* ------------ */ /* invoke callback which presents a list of bone-groups for the user to choose from */ -static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1300,7 +1300,7 @@ void POSE_OT_group_assign (wmOperatorType *ot) } -static int pose_group_unassign_exec (bContext *C, wmOperator *op) +static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1375,7 +1375,7 @@ static void pose_group_select(bContext *C, Object *ob, int select) CTX_DATA_END; } -static int pose_group_select_exec (bContext *C, wmOperator *op) +static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1413,7 +1413,7 @@ void POSE_OT_group_select (wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_group_deselect_exec (bContext *C, wmOperator *op) +static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1453,7 +1453,7 @@ void POSE_OT_group_deselect (wmOperatorType *ot) /* ********************************************** */ -static int pose_flip_names_exec (bContext *C, wmOperator *op) +static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm; @@ -1827,7 +1827,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot) /* ********************************************** */ -static int pose_flip_quats_exec (bContext *C, wmOperator *op) +static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4c869d25869..9fa7ba44c58 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1343,7 +1343,7 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w) } } -static int deleteflagNurb(bContext *C, wmOperator *op, int flag) +static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -1765,7 +1765,7 @@ static void adduplicateflagNurb(Object *obedit, short flag) /**************** switch direction operator ***************/ -static int switch_direction_exec(bContext *C, wmOperator *op) +static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= (Curve*)obedit->data; @@ -1902,7 +1902,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot) /********************* smooth operator ********************/ -static int smooth_exec(bContext *C, wmOperator *op) +static int smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -1974,7 +1974,7 @@ void CURVE_OT_smooth(wmOperatorType *ot) /**************** smooth curve radius operator *************/ /* TODO, make smoothing distance based */ -static int smooth_radius_exec(bContext *C, wmOperator *op) +static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -2265,7 +2265,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu } } -static int de_select_first_exec(bContext *C, wmOperator *op) +static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -2289,7 +2289,7 @@ void CURVE_OT_de_select_first(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int de_select_last_exec(bContext *C, wmOperator *op) +static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -2470,7 +2470,7 @@ void CURVE_OT_hide(wmOperatorType *ot) /********************** reveal operator *********************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -2527,7 +2527,7 @@ void CURVE_OT_reveal(wmOperatorType *ot) /********************** select invert operator *********************/ -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4071,7 +4071,7 @@ static int spin_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int spin_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -4271,7 +4271,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) /***************** extrude operator **********************/ -static int extrude_exec(bContext *C, wmOperator *op) +static int extrude_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4296,7 +4296,7 @@ static int extrude_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(extrude_exec(C, op) == OPERATOR_FINISHED) { RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); @@ -4406,7 +4406,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4531,7 +4531,7 @@ void CURVE_OT_select_linked(wmOperatorType *ot) /***************** select row operator **********************/ -static int select_row_exec(bContext *C, wmOperator *op) +static int select_row_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4606,7 +4606,7 @@ void CURVE_OT_select_row(wmOperatorType *ot) /***************** select next operator **********************/ -static int select_next_exec(bContext *C, wmOperator *op) +static int select_next_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4633,7 +4633,7 @@ void CURVE_OT_select_next(wmOperatorType *ot) /***************** select previous operator **********************/ -static int select_previous_exec(bContext *C, wmOperator *op) +static int select_previous_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4660,7 +4660,7 @@ void CURVE_OT_select_previous(wmOperatorType *ot) /***************** select more operator **********************/ -static int select_more_exec(bContext *C, wmOperator *op) +static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4748,7 +4748,7 @@ void CURVE_OT_select_more(wmOperatorType *ot) /******************** select less operator *****************/ /* basic method: deselect if control point doesn't have all neighbours selected */ -static int select_less_exec(bContext *C, wmOperator *op) +static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -5099,7 +5099,7 @@ void CURVE_OT_select_nth(wmOperatorType *ot) /********************** add duplicate operator *********************/ -static int duplicate_exec(bContext *C, wmOperator *op) +static int duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -5109,7 +5109,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { duplicate_exec(C, op); @@ -5432,7 +5432,7 @@ static int delete_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int delete_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; @@ -5534,7 +5534,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) /************** join operator, to be used externally? ****************/ -int join_curve_exec(bContext *C, wmOperator *op) +int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -6308,7 +6308,7 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot) /***************** clear tilt operator ********************/ -static int clear_tilt_exec(bContext *C, wmOperator *op) +static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index ae79c0b0053..44a664b5f30 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -271,7 +271,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re /********************** insert lorem operator *********************/ -static int insert_lorem_exec(bContext *C, wmOperator *op) +static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); char *p, *p2; @@ -383,7 +383,7 @@ static int paste_file_exec(bContext *C, wmOperator *op) return retval; } -static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(RNA_property_is_set(op->ptr, "filepath")) return paste_file_exec(C, op); @@ -414,7 +414,7 @@ void FONT_OT_file_paste(wmOperatorType *ot) /******************* paste buffer operator ********************/ -static int paste_buffer_exec(bContext *C, wmOperator *op) +static int paste_buffer_exec(bContext *C, wmOperator *UNUSED(op)) { char *filename; @@ -714,7 +714,7 @@ static void copy_selection(Object *obedit) } } -static int copy_text_exec(bContext *C, wmOperator *op) +static int copy_text_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -737,7 +737,7 @@ void FONT_OT_text_copy(wmOperatorType *ot) /******************* cut text operator ********************/ -static int cut_text_exec(bContext *C, wmOperator *op) +static int cut_text_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -1367,7 +1367,7 @@ static int textbox_poll(bContext *C) return 1; } -static int textbox_add_exec(bContext *C, wmOperator *op) +static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_active_object(C); Curve *cu= obedit->data; @@ -1585,7 +1585,7 @@ void FONT_OT_case_set(wmOperatorType *ot) /********************** toggle case operator *********************/ -static int toggle_case_exec(bContext *C, wmOperator *op) +static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -1633,7 +1633,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; @@ -1686,7 +1686,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); Curve *cu; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index bcde54f473a..10458a763e6 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -134,7 +134,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event) } /* Modal Operator init */ -static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* init */ if (eyedropper_init(C, op)) { @@ -195,7 +195,7 @@ void UI_OT_eyedropper(wmOperatorType *ot) /* Reset Default Theme ------------------------ */ -static int reset_default_theme_exec(bContext *C, wmOperator *op) +static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op)) { ui_theme_init_default(); WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -219,7 +219,7 @@ void UI_OT_reset_default_theme(wmOperatorType *ot) /* Copy Data Path Operator ------------------------ */ -static int copy_data_path_button_exec(bContext *C, wmOperator *op) +static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index e10f0f20938..c155aff8d70 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1512,7 +1512,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot) /* ********************************************************* */ /* RESET */ -static int reset_exec(bContext *C, wmOperator *op) +static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { uiStyle *style= U.uistyles.first; ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 5850dc706b0..2501a01d0e6 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1712,7 +1712,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) /****************** add duplicate operator ***************/ -static int mesh_duplicate_exec(bContext *C, wmOperator *op) +static int mesh_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(ob->data); @@ -1727,7 +1727,7 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { WM_cursor_wait(1); mesh_duplicate_exec(C, op); diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 164e8980b83..c4ca6166f02 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -2207,7 +2207,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) } -static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { view3d_operator_needs_opengl(C); @@ -2618,7 +2618,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { linked_limit_default(C, op); return select_linked_exec(C, op); @@ -2815,7 +2815,7 @@ void EM_reveal_mesh(EditMesh *em) // DAG_id_flush_update(obedit->data, OB_RECALC_DATA); } -static int reveal_mesh_exec(bContext *C, wmOperator *op) +static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3360,7 +3360,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */ } -static int select_inverse_mesh_exec(bContext *C, wmOperator *op) +static int select_inverse_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3493,7 +3493,7 @@ void EM_select_more(EditMesh *em) } } -static int select_more(bContext *C, wmOperator *op) +static int select_more(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)) ; @@ -3584,7 +3584,7 @@ void EM_select_less(EditMesh *em) } } -static int select_less(bContext *C, wmOperator *op) +static int select_less(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -4490,7 +4490,7 @@ void flipface(EditMesh *em, EditFace *efa) } -static int flip_normals(bContext *C, wmOperator *op) +static int flip_normals(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index eadf0ca120f..fc8a713230f 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -664,7 +664,7 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, sh } // XXX should be a menu item -static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -796,7 +796,7 @@ void MESH_OT_extrude(wmOperatorType *ot) ot->prop= prop; } -static int split_mesh(bContext *C, wmOperator *op) +static int split_mesh(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -1000,7 +1000,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) } /* get center and axis, in global coords */ -static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -1108,7 +1108,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) } /* get center and axis, in global coords */ -static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -6144,7 +6144,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) /********************** Region/Loop Operators *************************/ -static int region_to_loop(bContext *C, wmOperator *op) +static int region_to_loop(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -6325,7 +6325,7 @@ static int loop_bisect(EditMesh *em, Collection *edgecollection){ else return(2); } -static int loop_to_region(bContext *C, wmOperator *op) +static int loop_to_region(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7022,7 +7022,7 @@ static void fill_mesh(EditMesh *em) } -static int fill_mesh_exec(bContext *C, wmOperator *op) +static int fill_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7053,7 +7053,7 @@ void MESH_OT_fill(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int beautify_fill_exec(bContext *C, wmOperator *op) +static int beautify_fill_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7263,7 +7263,7 @@ void MESH_OT_sort_faces(wmOperatorType *ot) /********************** Quad/Tri Operators *************************/ -static int quads_convert_to_tris_exec(bContext *C, wmOperator *op) +static int quads_convert_to_tris_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7292,7 +7292,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int tris_convert_to_quads_exec(bContext *C, wmOperator *op) +static int tris_convert_to_quads_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7321,7 +7321,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int edge_flip_exec(bContext *C, wmOperator *op) +static int edge_flip_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7366,7 +7366,7 @@ static void mesh_set_smooth_faces(EditMesh *em, short smooth) } } -static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op) +static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7396,7 +7396,7 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *op) +static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index d1c6ff4c4ae..f45786d3abe 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -286,7 +286,7 @@ static int layers_poll(bContext *C) return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib); } -static int uv_texture_add_exec(bContext *C, wmOperator *op) +static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -392,7 +392,7 @@ void MESH_OT_drop_named_image(wmOperatorType *ot) RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file"); } -static int uv_texture_remove_exec(bContext *C, wmOperator *op) +static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; @@ -420,7 +420,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot) /*********************** vertex color operators ************************/ -static int vertex_color_add_exec(bContext *C, wmOperator *op) +static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -447,7 +447,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_color_remove_exec(bContext *C, wmOperator *op) +static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; @@ -475,7 +475,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot) /*********************** sticky operators ************************/ -static int sticky_add_exec(bContext *C, wmOperator *op) +static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); @@ -508,7 +508,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int sticky_remove_exec(bContext *C, wmOperator *op) +static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index e8c787b168f..0f1efbcf7cf 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -84,7 +84,7 @@ /* join selected meshes into the active mesh, context sensitive return 0 if no join is made (error) and 1 of the join is done */ -int join_mesh_exec(bContext *C, wmOperator *op) +int join_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 80cea4eea1c..c110222a109 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -177,7 +177,7 @@ void MBALL_OT_select_all(wmOperatorType *ot) /***************************** Select inverse operator *****************************/ /* Invert metaball selection */ -static int select_inverse_metaelems_exec(bContext *C, wmOperator *op) +static int select_inverse_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -266,7 +266,7 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) /***************************** Duplicate operator *****************************/ /* Duplicate selected MetaElements */ -static int duplicate_metaelems_exec(bContext *C, wmOperator *op) +static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -290,7 +290,7 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retv= duplicate_metaelems_exec(C, op); @@ -325,7 +325,7 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot) /***************************** Delete operator *****************************/ /* Delete all selected MetaElems (not MetaBall) */ -static int delete_metaelems_exec(bContext *C, wmOperator *op) +static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; @@ -420,7 +420,7 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot) /***************************** Unhide operator *****************************/ /* Unhide all edited MetaElems */ -static int reveal_metaelems_exec(bContext *C, wmOperator *op) +static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 8661cbc680a..9de6d002a43 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -218,7 +218,7 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op) } } -int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *event) +int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { object_add_generic_invoke_options(C, op); return op->type->exec(C, op); @@ -537,7 +537,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; @@ -805,7 +805,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) MEM_freeN(base); } -static int object_delete_exec(bContext *C, wmOperator *op) +static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1005,7 +1005,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) base->object->transflag &= ~OB_DUPLI; } -static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) +static int object_duplicates_make_real_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index f81e73faf73..a921620fa71 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -241,7 +241,7 @@ static void bake_freejob(void *bkv) } /* catch esc */ -static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event) +static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { /* no running blender, remove handler and pass through */ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) @@ -256,7 +256,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event return OPERATOR_PASS_THROUGH; } -static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_event) +static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index fd3c8b165c0..ab3c649299c 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -562,7 +562,7 @@ static int stretchto_reset_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return stretchto_reset_exec(C, op); @@ -605,7 +605,7 @@ static int limitdistance_reset_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return limitdistance_reset_exec(C, op); @@ -692,7 +692,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_set_inverse_exec(C, op); @@ -731,7 +731,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_clear_inverse_exec(C, op); @@ -794,7 +794,7 @@ static int constraint_poll(bContext *C) return (ptr.id.data && ptr.data); } -static int constraint_delete_exec (bContext *C, wmOperator *op) +static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); Object *ob= ptr.id.data; @@ -855,7 +855,7 @@ static int constraint_move_down_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_down_exec(C, op); @@ -903,7 +903,7 @@ static int constraint_move_up_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_up_exec(C, op); @@ -932,7 +932,7 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot) /************************ remove constraint operators *********************/ -static int pose_constraints_clear_exec(bContext *C, wmOperator *op) +static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -969,7 +969,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) } -static int object_constraints_clear_exec(bContext *C, wmOperator *op) +static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1047,7 +1047,7 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_constraint_copy_exec(bContext *C, wmOperator *op) +static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -1466,7 +1466,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) // TODO: should these be here, or back in editors/armature/poseobject.c again? /* present menu with options + validation for targets to use */ -static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan= get_active_posechannel(ob); @@ -1550,7 +1550,7 @@ void POSE_OT_ik_add(wmOperatorType *ot) /* ------------------ */ /* remove IK constraints from selected bones */ -static int pose_ik_clear_exec(bContext *C, wmOperator *op) +static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index b7f05a2e332..5882478f05e 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -120,7 +120,7 @@ Object *ED_object_active_context(bContext *C) /* ********* clear/set restrict view *********/ -static int object_hide_view_clear_exec(bContext *C, wmOperator *op) +static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); ScrArea *sa= CTX_wm_area(C); @@ -219,7 +219,7 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot) } /* 99% same as above except no need for scene refreshing (TODO, update render preview) */ -static int object_hide_render_clear_exec(bContext *C, wmOperator *op) +static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op)) { short changed= 0; @@ -506,7 +506,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(flag & EM_WAITCURSOR) waitcursor(0); } -static int editmode_toggle_exec(bContext *C, wmOperator *op) +static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { if(!CTX_data_edit_object(C)) ED_object_enter_editmode(C, EM_WAITCURSOR); @@ -549,7 +549,7 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot) /* *************************** */ -static int posemode_exec(bContext *C, wmOperator *op) +static int posemode_exec(bContext *C, wmOperator *UNUSED(op)) { Base *base= CTX_data_active_base(C); @@ -1525,7 +1525,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) /* 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 object_calculate_paths_exec (bContext *C, wmOperator *op) +static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -1580,7 +1580,7 @@ void ED_objects_clear_paths(bContext *C, Scene *scene) } /* operator callback for this */ -static int object_clear_paths_exec (bContext *C, wmOperator *op) +static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -1890,7 +1890,7 @@ static const char *object_mode_op_string(int mode) /* checks the mode to be set is compatible with the object * should be made into a generic function */ -static int object_mode_set_compat(bContext *C, wmOperator *op, Object *ob) +static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *ob) { ObjectMode mode = RNA_enum_get(op->ptr, "mode"); @@ -1999,7 +1999,7 @@ void ED_object_toggle_modes(bContext *C, int mode) /************************ Game Properties ***********************/ -static int game_property_new(bContext *C, wmOperator *op) +static int game_property_new(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); bProperty *prop; @@ -2164,7 +2164,7 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot) ot->prop=prop; } -static int game_property_clear_exec(bContext *C, wmOperator *op) +static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { free_properties(&ob_iter->prop); @@ -2190,7 +2190,7 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot) /************************ Copy Logic Bricks ***********************/ -static int logicbricks_copy_exec(bContext *C, wmOperator *op) +static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob=ED_object_active_context(C); diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index f000485466f..99e27d8a286 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -149,7 +149,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int group_objects_remove_exec(bContext *C, wmOperator *op) +static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -224,7 +224,7 @@ void GROUP_OT_create(wmOperatorType *ot) /****************** properties window operators *********************/ -static int group_add_exec(bContext *C, wmOperator *op) +static int group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -293,7 +293,7 @@ void OBJECT_OT_group_link(wmOperatorType *ot) ot->prop= prop; } -static int group_remove_exec(bContext *C, wmOperator *op) +static int group_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 75e22d5356f..e6511b82eeb 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -504,7 +504,7 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_add_hook_newob_exec(bContext *C, wmOperator *op) +static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 9f82a1209cf..708aa38d3ea 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -259,7 +259,7 @@ int make_regular_poll(bContext *C) return (ob && ob->type==OB_LATTICE); } -int make_regular_exec(bContext *C, wmOperator *op) +int make_regular_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); Lattice *lt; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index aac5129c6a9..1c22c1820ce 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -667,7 +667,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_remove_exec(C, op); @@ -706,7 +706,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_move_up_exec(C, op); @@ -745,7 +745,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_move_down_exec(C, op); @@ -787,7 +787,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_apply_exec(C, op); @@ -835,7 +835,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_convert_exec(C, op); @@ -874,7 +874,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_copy_exec(C, op); @@ -919,7 +919,7 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_higher_levels_delete_exec(C, op); @@ -959,7 +959,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_subdivide_exec(C, op); @@ -1017,7 +1017,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_reshape_exec(C, op); @@ -1066,7 +1066,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = ED_object_active_context(C); MultiresModifierData *mmd; @@ -1120,7 +1120,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot) /****************** multires pack operator *********************/ -static int multires_external_pack_exec(bContext *C, wmOperator *op) +static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_active_context(C); Mesh *me= ob->data; @@ -1210,7 +1210,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return meshdeform_bind_exec(C, op); @@ -1258,7 +1258,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return explode_refresh_exec(C, op); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 6a107b8e204..2a01c870ad6 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -672,7 +672,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { Object *ob= CTX_data_active_object(C); uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0); @@ -779,7 +779,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) /************************ Clear Slow Parent Operator *********************/ -static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) +static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -821,7 +821,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) /********************** Make Slow Parent Operator *********************/ -static int object_slow_parent_set_exec(bContext *C, wmOperator *op) +static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 20346ab080e..a3c65851d3a 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -679,7 +679,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) /************************** Select Inverse *************************/ -static int object_select_inverse_exec(bContext *C, wmOperator *op) +static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Base*, base, visible_bases) { if (base->flag & SELECT) diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 0effa01553b..33f3534bb3b 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -267,7 +267,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot) RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys."); } -static int shape_key_remove_exec(bContext *C, wmOperator *op) +static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -292,7 +292,7 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int shape_key_clear_exec(bContext *C, wmOperator *op) +static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Key *key= ob_get_key(ob); @@ -325,7 +325,7 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int shape_key_mirror_exec(bContext *C, wmOperator *op) +static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 1551db73e74..66c5ab4ec4b 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -64,7 +64,7 @@ /*************************** Clear Transformation ****************************/ -static int object_location_clear_exec(bContext *C, wmOperator *op) +static int object_location_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -125,7 +125,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_rotation_clear_exec(bContext *C, wmOperator *op) +static int object_rotation_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -270,7 +270,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_scale_clear_exec(bContext *C, wmOperator *op) +static int object_scale_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -336,7 +336,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_origin_clear_exec(bContext *C, wmOperator *op) +static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); float *v1, *v3, mat[3][3]; @@ -567,7 +567,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo return OPERATOR_FINISHED; } -static int visual_transform_apply_exec(bContext *C, wmOperator *op) +static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int change = 0; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 76af8feda82..c8c5492c966 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1438,7 +1438,7 @@ static int vertex_group_poll_edit(bContext *C) return vgroup_object_in_edit_mode(ob); } -static int vertex_group_add_exec(bContext *C, wmOperator *op) +static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1561,7 +1561,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot) RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups."); } -static int vertex_group_select_exec(bContext *C, wmOperator *op) +static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); @@ -1588,7 +1588,7 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_deselect_exec(bContext *C, wmOperator *op) +static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); @@ -1612,7 +1612,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1671,7 +1671,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot) RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by.", 0.0f, 10.f); } -static int vertex_group_normalize_exec(bContext *C, wmOperator *op) +static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1760,7 +1760,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) } -static int vertex_group_blend_exec(bContext *C, wmOperator *op) +static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1860,7 +1860,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) } -static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1901,7 +1901,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obact= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index a18890881a8..0ba76bbe34c 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -98,7 +98,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", ""); } -static int rule_del_exec(bContext *C, wmOperator *op) +static int rule_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -149,7 +149,7 @@ void BOID_OT_rule_del(wmOperatorType *ot) } /************************ move up/down boid rule operators *********************/ -static int rule_move_up_exec(bContext *C, wmOperator *op) +static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -187,7 +187,7 @@ void BOID_OT_rule_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int rule_move_down_exec(bContext *C, wmOperator *op) +static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -227,7 +227,7 @@ void BOID_OT_rule_move_down(wmOperatorType *ot) /************************ add/del boid state operators *********************/ -static int state_add_exec(bContext *C, wmOperator *op) +static int state_add_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -266,7 +266,7 @@ void BOID_OT_state_add(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int state_del_exec(bContext *C, wmOperator *op) +static int state_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -322,7 +322,7 @@ void BOID_OT_state_del(wmOperatorType *ot) } /************************ move up/down boid state operators *********************/ -static int state_move_up_exec(bContext *C, wmOperator *op) +static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -359,7 +359,7 @@ void BOID_OT_state_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int state_move_down_exec(bContext *C, wmOperator *op) +static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 132533fc123..610f6d95d42 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1387,7 +1387,7 @@ static void select_root(PEData *data, int point_index) data->edit->points[point_index].flag |= PEP_EDIT_RECALC; /* redraw selection only */ } -static int select_roots_exec(bContext *C, wmOperator *op) +static int select_roots_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1427,7 +1427,7 @@ static void select_tip(PEData *data, int point_index) point->flag |= PEP_EDIT_RECALC; /* redraw selection only */ } -static int select_tips_exec(bContext *C, wmOperator *op) +static int select_tips_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1690,7 +1690,7 @@ void PARTICLE_OT_hide(wmOperatorType *ot) /*************************** reveal operator **************************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); @@ -1758,7 +1758,7 @@ static void select_less_keys(PEData *data, int point_index) } } -static int select_less_exec(bContext *C, wmOperator *op) +static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1819,7 +1819,7 @@ static void select_more_keys(PEData *data, int point_index) } } -static int select_more_exec(bContext *C, wmOperator *op) +static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1846,7 +1846,7 @@ void PARTICLE_OT_select_more(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; PTCacheEdit *edit; @@ -2260,7 +2260,7 @@ static void subdivide_particle(PEData *data, int pa_index) pa->flag &= ~PARS_REKEY; } -static int subdivide_exec(bContext *C, wmOperator *op) +static int subdivide_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -2734,7 +2734,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) MEM_freeN(mirrorfaces); } -static int mirror_exec(bContext *C, wmOperator *op) +static int mirror_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -4084,7 +4084,7 @@ static int particle_edit_toggle_poll(bContext *C) return (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)); } -static int particle_edit_toggle_exec(bContext *C, wmOperator *op) +static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -4130,7 +4130,7 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot) /************************ set editable operator ************************/ -static int clear_edited_exec(bContext *C, wmOperator *op) +static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); ParticleSystem *psys = psys_get_current(ob); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index e364a881601..428d8ce6b82 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -60,7 +60,7 @@ /********************** particle system slot operators *********************/ -static int particle_system_add_exec(bContext *C, wmOperator *op) +static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -91,7 +91,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int particle_system_remove_exec(bContext *C, wmOperator *op) +static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -138,7 +138,7 @@ static int psys_poll(bContext *C) return (ptr.data != NULL); } -static int new_particle_settings_exec(bContext *C, wmOperator *op) +static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Main *bmain= CTX_data_main(C); @@ -191,7 +191,7 @@ void PARTICLE_OT_new(wmOperatorType *ot) /********************** keyed particle target operators *********************/ -static int new_particle_target_exec(bContext *C, wmOperator *op) +static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -237,7 +237,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int remove_particle_target_exec(bContext *C, wmOperator *op) +static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -288,7 +288,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot) /************************ move up particle target operator *********************/ -static int target_move_up_exec(bContext *C, wmOperator *op) +static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -327,7 +327,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot) /************************ move down particle target operator *********************/ -static int target_move_down_exec(bContext *C, wmOperator *op) +static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -365,7 +365,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot) /************************ move up particle dupliweight operator *********************/ -static int dupliob_move_up_exec(bContext *C, wmOperator *op) +static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -403,7 +403,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot) /********************** particle dupliweight operators *********************/ -static int copy_particle_dupliob_exec(bContext *C, wmOperator *op) +static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -442,7 +442,7 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int remove_particle_dupliob_exec(bContext *C, wmOperator *op) +static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -487,7 +487,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot) /************************ move down particle dupliweight operator *********************/ -static int dupliob_move_down_exec(bContext *C, wmOperator *op) +static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 35f86a49aa7..6664dd624b2 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -120,7 +120,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_free_bake_all_exec(bContext *C, wmOperator *op) +static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Base *base; @@ -221,7 +221,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_free_bake_exec(bContext *C, wmOperator *op) +static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; @@ -241,7 +241,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op) +static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; @@ -295,7 +295,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int ptcache_add_new_exec(bContext *C, wmOperator *op) +static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); @@ -320,7 +320,7 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_remove_exec(bContext *C, wmOperator *op) +static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 083202e5a03..7f34e6fa333 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -596,7 +596,7 @@ static int render_breakjob(void *rjv) } /* catch esc */ -static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event) +static int screen_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { /* no running blender, remove handler and pass through */ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) { @@ -763,7 +763,7 @@ void RENDER_OT_render(wmOperatorType *ot) /* *********************** cancel render viewer *************** */ -static int render_view_cancel_exec(bContext *C, wmOperator *unused) +static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) { wmWindow *win= CTX_wm_window(C); ScrArea *sa= CTX_wm_area(C); @@ -810,7 +810,7 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot) /* *********************** show render viewer *************** */ -static int render_view_show_invoke(bContext *C, wmOperator *unused, wmEvent *event) +static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEvent *event) { ScrArea *sa= find_area_showing_r_result(C); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 71a46a16f98..a989171d617 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -254,7 +254,7 @@ void ED_render_id_flush_update(Main *bmain, ID *id) /********************** material slot operators *********************/ -static int material_slot_add_exec(bContext *C, wmOperator *op) +static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -282,7 +282,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_remove_exec(bContext *C, wmOperator *op) +static int material_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -310,7 +310,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_assign_exec(bContext *C, wmOperator *op) +static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -434,7 +434,7 @@ static int material_slot_de_select(bContext *C, int select) return OPERATOR_FINISHED; } -static int material_slot_select_exec(bContext *C, wmOperator *op) +static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op)) { return material_slot_de_select(C, 1); } @@ -453,7 +453,7 @@ void OBJECT_OT_material_slot_select(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_deselect_exec(bContext *C, wmOperator *op) +static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { return material_slot_de_select(C, 0); } @@ -473,7 +473,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) } -static int material_slot_copy_exec(bContext *C, wmOperator *op) +static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Material ***matar; @@ -514,7 +514,7 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot) /********************** new material operator *********************/ -static int new_material_exec(bContext *C, wmOperator *op) +static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; PointerRNA ptr, idptr; @@ -560,7 +560,7 @@ void MATERIAL_OT_new(wmOperatorType *ot) /********************** new texture operator *********************/ -static int new_texture_exec(bContext *C, wmOperator *op) +static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; PointerRNA ptr, idptr; @@ -606,7 +606,7 @@ void TEXTURE_OT_new(wmOperatorType *ot) /********************** new world operator *********************/ -static int new_world_exec(bContext *C, wmOperator *op) +static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; PointerRNA ptr, idptr; @@ -652,7 +652,7 @@ void WORLD_OT_new(wmOperatorType *ot) /********************** render layer operators *********************/ -static int render_layer_add_exec(bContext *C, wmOperator *op) +static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -678,7 +678,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int render_layer_remove_exec(bContext *C, wmOperator *op) +static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); SceneRenderLayer *rl; @@ -890,7 +890,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { //Scene *scene= CTX_data_scene(C); @@ -942,7 +942,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); } -static int envmap_clear_exec(bContext *C, wmOperator *op) +static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; @@ -982,7 +982,7 @@ void TEXTURE_OT_envmap_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int envmap_clear_all_exec(bContext *C, wmOperator *op) +static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Tex *tex; @@ -1014,7 +1014,7 @@ void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot) /********************** material operators *********************/ /* material copy/paste */ -static int copy_material_exec(bContext *C, wmOperator *op) +static int copy_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; @@ -1042,7 +1042,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int paste_material_exec(bContext *C, wmOperator *op) +static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; @@ -1142,7 +1142,7 @@ void paste_mtex_copybuf(ID *id) } -static int copy_mtex_exec(bContext *C, wmOperator *op) +static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; @@ -1181,7 +1181,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int paste_mtex_exec(bContext *C, wmOperator *op) +static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6e921b57d9d..5caa6c5045b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5087,7 +5087,7 @@ static int grab_clone_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int grab_clone_cancel(bContext *C, wmOperator *op) +static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index b5cadb9c484..d8544f34fdf 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -42,7 +42,7 @@ //#include /* Brush operators */ -static int brush_add_exec(bContext *C, wmOperator *op) +static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) { /*int type = RNA_enum_get(op->ptr, "type");*/ Paint *paint = paint_get_active(CTX_data_scene(C)); @@ -129,7 +129,7 @@ void BRUSH_OT_scale_size(wmOperatorType *ot) RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2); } -static int vertex_color_set_exec(bContext *C, wmOperator *op) +static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -154,7 +154,7 @@ void PAINT_OT_vertex_color_set(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int brush_reset_exec(bContext *C, wmOperator *op) +static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) { Paint *paint = paint_get_active(CTX_data_scene(C)); struct Brush *brush = paint_brush(paint); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 0098b8ca12c..8fee8c7e8fc 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -233,7 +233,7 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot) /* face-select ops */ -static int paint_select_linked_exec(bContext *C, wmOperator *op) +static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { select_linked_tfaces(C, CTX_data_active_object(C), NULL, 2); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index f033c2aac83..f5a02e6fb9c 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1061,7 +1061,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index, /* *************** set wpaint operator ****************** */ -static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ +static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); @@ -1314,7 +1314,7 @@ static char *wpaint_make_validmap(Mesh *me, Object *ob) return validmap; } -static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) +static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); struct PaintStroke *stroke = op->customdata; @@ -1663,7 +1663,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } -static int weight_paint_set_exec(bContext *C, wmOperator *op) +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); @@ -1780,7 +1780,7 @@ typedef struct VPaintData { float vpimat[3][3]; } VPaintData; -static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *event) +static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *UNUSED(event)) { ToolSettings *ts= CTX_data_tool_settings(C); struct PaintStroke *stroke = op->customdata; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index fe1fe3266bc..18f35502f8b 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -280,7 +280,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Editing* ed = CTX_data_scene(C)->ed; bSound* sound; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 916b0032f17..86adc3d9e8c 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -70,7 +70,7 @@ /* ******************** New Action Operator *********************** */ -static int act_new_exec(bContext *C, wmOperator *op) +static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) { bAction *action; PointerRNA ptr, idptr; @@ -173,7 +173,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max) /* ****************** Automatic Preview-Range Operator ****************** */ -static int actkeys_previewrange_exec(bContext *C, wmOperator *op) +static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene; @@ -217,7 +217,7 @@ void ACTION_OT_previewrange_set (wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int actkeys_viewall_exec(bContext *C, wmOperator *op) +static int actkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -521,7 +521,7 @@ static void duplicate_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_duplicate_exec(bContext *C, wmOperator *op) +static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -541,7 +541,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; // xxx - start transform } -static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { actkeys_duplicate_exec(C, op); @@ -608,7 +608,7 @@ static void delete_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_delete_exec(bContext *C, wmOperator *op) +static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -734,7 +734,7 @@ static void sample_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_sample_exec(bContext *C, wmOperator *op) +static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1096,7 +1096,7 @@ void ACTION_OT_keyframe_type (wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ /* snap current-frame indicator to 'average time' of selected keyframe */ -static int actkeys_framejump_exec(bContext *C, wmOperator *op) +static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index b2c47194384..64d7a12bc4c 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -551,7 +551,7 @@ void ACTION_OT_select_column (wmOperatorType *ot) /* ******************** Select Linked Operator *********************** */ -static int actkeys_select_linked_exec (bContext *C, wmOperator *op) +static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -650,7 +650,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode) /* ----------------- */ -static int actkeys_select_more_exec (bContext *C, wmOperator *op) +static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -684,7 +684,7 @@ void ACTION_OT_select_more (wmOperatorType *ot) /* ----------------- */ -static int actkeys_select_less_exec (bContext *C, wmOperator *op) +static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index c1803dde805..2573470e8df 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -53,7 +53,7 @@ /********************** toolbox operator *********************/ -static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { bScreen *sc= CTX_wm_screen(C); SpaceButs *sbuts= CTX_wm_space_buts(C); @@ -123,7 +123,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int file_browse_cancel(bContext *C, wmOperator *op) +static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index e9764a2d36a..5184e6b7fc0 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -304,7 +304,7 @@ void FILE_OT_select(wmOperatorType *ot) RNA_def_boolean(ot->srna, "fill", 0, "Fill", "Select everything beginning with the last selection."); } -static int file_select_all_exec(bContext *C, wmOperator *op) +static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -384,7 +384,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot) RNA_def_string(ot->srna, "dir", "", 256, "Dir", ""); } -static int bookmark_add_exec(bContext *C, wmOperator *op) +static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -479,7 +479,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) return (params->active_file != origfile); } -static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ARegion *ar= CTX_wm_region(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -504,7 +504,7 @@ void FILE_OT_highlight(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; } -int file_cancel_exec(bContext *C, wmOperator *unused) +int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); wmOperator *op = sfile->op; @@ -704,7 +704,7 @@ void FILE_OT_execute(struct wmOperatorType *ot) } -int file_parent_exec(bContext *C, wmOperator *unused) +int file_parent_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -735,7 +735,7 @@ void FILE_OT_parent(struct wmOperatorType *ot) } -int file_refresh_exec(bContext *C, wmOperator *unused) +int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -759,7 +759,7 @@ void FILE_OT_previous(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_previous_exec(bContext *C, wmOperator *unused) +int file_previous_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -790,7 +790,7 @@ void FILE_OT_next(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_next_exec(bContext *C, wmOperator *unused) +int file_next_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); if(sfile->params) { @@ -812,7 +812,7 @@ int file_next_exec(bContext *C, wmOperator *unused) /* only meant for timer usage */ -static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ScrArea *sa = CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -995,7 +995,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_directory_exec(bContext *C, wmOperator *unused) +int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1021,7 +1021,7 @@ int file_directory_exec(bContext *C, wmOperator *unused) return OPERATOR_FINISHED; } -int file_filename_exec(bContext *C, wmOperator *unused) +int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1049,7 +1049,7 @@ void FILE_OT_refresh(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_hidedot_exec(bContext *C, wmOperator *unused) +int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1102,7 +1102,7 @@ struct ARegion *file_buttons_region(struct ScrArea *sa) return arnew; } -int file_bookmark_toggle_exec(bContext *C, wmOperator *unused) +int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= file_buttons_region(sa); @@ -1158,7 +1158,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot) RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100); } -int file_rename_exec(bContext *C, wmOperator *op) +int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); @@ -1232,7 +1232,7 @@ int file_delete_poll(bContext *C) return poll; } -int file_delete_exec(bContext *C, wmOperator *op) +int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) { char str[FILE_MAX]; SpaceFile *sfile= CTX_wm_space_file(C); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f4567255b91..568c76f3dfc 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -733,7 +733,7 @@ void graph_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int graph_properties(bContext *C, wmOperator *op) +static int graph_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= graph_has_buttons_region(sa); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 5c692ba1112..41c653048e8 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -140,7 +140,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo /* ****************** Automatic Preview-Range Operator ****************** */ -static int graphkeys_previewrange_exec(bContext *C, wmOperator *op) +static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene; @@ -183,7 +183,7 @@ void GRAPH_OT_previewrange_set (wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int graphkeys_viewall_exec(bContext *C, wmOperator *op) +static int graphkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -305,7 +305,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) /* ------------------- */ -static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *op) +static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -349,7 +349,7 @@ void GRAPH_OT_ghost_curves_create (wmOperatorType *ot) /* ******************** Clear Ghost-Curves Operator *********************** */ /* This operator clears the 'ghost curves' for the active Graph Editor */ -static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *op) +static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; SpaceIpo *sipo; @@ -719,7 +719,7 @@ static void duplicate_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_duplicate_exec(bContext *C, wmOperator *op) +static int graphkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -739,7 +739,7 @@ static int graphkeys_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { graphkeys_duplicate_exec(C, op); @@ -799,7 +799,7 @@ static void delete_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_delete_exec(bContext *C, wmOperator *op) +static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -935,7 +935,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end) /* ------------------- */ -static int graphkeys_bake_exec(bContext *C, wmOperator *op) +static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene= NULL; @@ -1149,7 +1149,7 @@ static void sample_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_sample_exec(bContext *C, wmOperator *op) +static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1530,7 +1530,7 @@ void GRAPH_OT_euler_filter (wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ /* snap current-frame indicator to 'average time' of selected keyframe */ -static int graphkeys_framejump_exec(bContext *C, wmOperator *op) +static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; @@ -1835,7 +1835,7 @@ void GRAPH_OT_mirror (wmOperatorType *ot) /* ******************** Smooth Keyframes Operator *********************** */ -static int graphkeys_smooth_exec(bContext *C, wmOperator *op) +static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1890,7 +1890,7 @@ void GRAPH_OT_smooth (wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ /* present a special customised popup menu for this, with some filtering */ -static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 0069e6e0675..b4ca1b8c901 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -181,7 +181,7 @@ void GRAPH_OT_cursor_set(wmOperatorType *ot) /* Toggle Handles ----------------------------------------------------------------- */ -static int view_toggle_handles_exec (bContext *C, wmOperator *op) +static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op)) { SpaceIpo *sipo= CTX_wm_space_graph(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index cdc8166f2d6..9dd499a2cbf 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -539,7 +539,7 @@ void GRAPH_OT_select_column (wmOperatorType *ot) /* ******************** Select Linked Operator *********************** */ -static int graphkeys_select_linked_exec (bContext *C, wmOperator *op) +static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -638,7 +638,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode) /* ----------------- */ -static int graphkeys_select_more_exec (bContext *C, wmOperator *op) +static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -672,7 +672,7 @@ void GRAPH_OT_select_more (wmOperatorType *ot) /* ----------------- */ -static int graphkeys_select_less_exec (bContext *C, wmOperator *op) +static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 51767d3e006..c87b25877b4 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -73,7 +73,7 @@ static int pack_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Main *bmain= CTX_data_main(C); Image *ima; @@ -133,7 +133,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Main *bmain= CTX_data_main(C); uiPopupMenu *pup; @@ -184,7 +184,7 @@ void FILE_OT_unpack_all(wmOperatorType *ot) /********************* make paths relative operator *********************/ -static int make_paths_relative_exec(bContext *C, wmOperator *op) +static int make_paths_relative_exec(bContext *UNUSED(C), wmOperator *op) { if(!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file."); @@ -211,7 +211,7 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot) /********************* make paths absolute operator *********************/ -static int make_paths_absolute_exec(bContext *C, wmOperator *op) +static int make_paths_absolute_exec(bContext *UNUSED(C), wmOperator *op) { if(!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file."); @@ -237,7 +237,7 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot) /********************* report missing files operator *********************/ -static int report_missing_files_exec(bContext *C, wmOperator *op) +static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op) { char txtname[24]; /* text block name */ @@ -264,7 +264,7 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) /********************* find missing files operator *********************/ -static int find_missing_files_exec(bContext *C, wmOperator *op) +static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op) { char *path; @@ -275,7 +275,7 @@ static int find_missing_files_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* XXX file open button text "Find Missing Files" */ WM_event_add_fileselect(C, op); @@ -313,7 +313,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot) #define ERROR_TIMEOUT 10.0 #define ERROR_COLOR_TIMEOUT 6.0 #define COLLAPSE_TIMEOUT 0.2 -static int update_reports_display_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { wmWindowManager *wm= CTX_wm_manager(C); ReportList *reports= CTX_wm_reports(C); diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index d8dfd8cb52d..195bc5df3c7 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -103,7 +103,7 @@ void logic_buttons_register(ARegionType *art) } -static int logic_properties(bContext *C, wmOperator *op) +static int logic_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= logic_has_buttons_region(sa); diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 4641fd2ce61..5c498a59884 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -238,7 +238,7 @@ static int sensor_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) + static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_sensor_invoke_properties(C, op)) return sensor_remove_exec(C, op); @@ -341,7 +341,7 @@ static int controller_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) + static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_controller_invoke_properties(C, op)) return controller_remove_exec(C, op); @@ -455,7 +455,7 @@ static int actuator_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_actuator_invoke_properties(C, op)) return actuator_remove_exec(C, op); @@ -562,7 +562,7 @@ static int sensor_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_sensor_invoke_properties(C, op)) { return sensor_move_exec(C, op); @@ -607,7 +607,7 @@ static int controller_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_controller_invoke_properties(C, op)) { return controller_move_exec(C, op); @@ -652,7 +652,7 @@ static int actuator_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_actuator_invoke_properties(C, op)) { return actuator_move_exec(C, op); diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index a728cc900c2..ef91fc56bec 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -477,7 +477,7 @@ void nla_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int nla_properties(bContext *C, wmOperator *op) +static int nla_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= nla_has_buttons_region(sa); diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index b00cba676d0..3cf1dcb5f68 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -433,7 +433,7 @@ void NLA_OT_tracks_add (wmOperatorType *ot) /* ******************** Delete Tracks Operator ***************************** */ /* Delete selected NLA Tracks */ -static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *op) +static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 247987cda9f..f2e83f4168e 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -457,7 +457,7 @@ void NLA_OT_transition_add (wmOperatorType *ot) /* Add new meta-strips incorporating the selected strips */ /* add the specified action as new strip */ -static int nlaedit_add_meta_exec (bContext *C, wmOperator *op) +static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -518,7 +518,7 @@ void NLA_OT_meta_add (wmOperatorType *ot) /* ******************** Remove Meta-Strip Operator ***************************** */ /* Separate out the strips held by the selected meta-strips */ -static int nlaedit_remove_meta_exec (bContext *C, wmOperator *op) +static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -572,7 +572,7 @@ void NLA_OT_meta_remove (wmOperatorType *ot) * the originals were housed in. */ -static int nlaedit_duplicate_exec (bContext *C, wmOperator *op) +static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -645,7 +645,7 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { nlaedit_duplicate_exec(C, op); @@ -677,7 +677,7 @@ void NLA_OT_duplicate (wmOperatorType *ot) /* ******************** Delete Strips Operator ***************************** */ /* Deletes the selected NLA-Strips */ -static int nlaedit_delete_exec (bContext *C, wmOperator *op) +static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -818,7 +818,7 @@ static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *st /* ----- */ -static int nlaedit_split_exec (bContext *C, wmOperator *op) +static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -893,7 +893,7 @@ void NLA_OT_split (wmOperatorType *ot) /* ******************** Bake Strips Operator ***************************** */ /* Bakes the NLA Strips for the active AnimData blocks */ -static int nlaedit_bake_exec (bContext *C, wmOperator *op) +static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -949,7 +949,7 @@ void NLA_OT_bake (wmOperatorType *ot) /* ******************** Toggle Muting Operator ************************** */ /* Toggles whether strips are muted or not */ -static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *op) +static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1008,7 +1008,7 @@ void NLA_OT_mute_toggle (wmOperatorType *ot) /* ******************** Move Strips Up Operator ************************** */ /* Tries to move the selected strips into the track above if possible. */ -static int nlaedit_move_up_exec (bContext *C, wmOperator *op) +static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1082,7 +1082,7 @@ void NLA_OT_move_up (wmOperatorType *ot) /* ******************** Move Strips Down Operator ************************** */ /* Tries to move the selected strips into the track above if possible. */ -static int nlaedit_move_down_exec (bContext *C, wmOperator *op) +static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1250,7 +1250,7 @@ static short bezt_apply_nlamapping (KeyframeEditData *ked, BezTriple *bezt) return 0; } -static int nlaedit_apply_scale_exec (bContext *C, wmOperator *op) +static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1333,7 +1333,7 @@ void NLA_OT_apply_scale (wmOperatorType *ot) /* ******************** Clear Scale Operator ***************************** */ /* Reset the scaling of the selected strips to 1.0f */ -static int nlaedit_clear_scale_exec (bContext *C, wmOperator *op) +static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1544,7 +1544,7 @@ void NLA_OT_snap (wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ /* present a special customised popup menu for this, with some filtering */ -static int nla_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int nla_fmodifier_add_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 11319d817c7..ca42193bff6 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -135,7 +135,7 @@ void node_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int node_properties(bContext *C, wmOperator *op) +static int node_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= node_has_buttons_region(sa); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 968391f271e..42aec17cc8f 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -541,7 +541,7 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode) ntreeSolveOrder(snode->nodetree); } -static int node_group_edit_exec(bContext *C, wmOperator *op) +static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *gnode; @@ -556,7 +556,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *gnode; @@ -1100,7 +1100,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode) } -static int node_active_link_viewer(bContext *C, wmOperator *op) +static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -1472,7 +1472,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float /* ****************** Duplicate *********************** */ -static int node_duplicate_exec(bContext *C, wmOperator *op) +static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -1851,7 +1851,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) // XXX some code needing updating to operators... /* goes over all scenes, reads render layers */ -static int node_read_renderlayers_exec(bContext *C, wmOperator *op) +static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); @@ -1893,7 +1893,7 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot) ot->flag= 0; } -static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *op) +static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); Scene *curscene= CTX_data_scene(C); @@ -2015,7 +2015,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag) } } -static int node_hide_exec(bContext *C, wmOperator *op) +static int node_hide_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2045,7 +2045,7 @@ void NODE_OT_hide_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_preview_exec(bContext *C, wmOperator *op) +static int node_preview_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2077,7 +2077,7 @@ void NODE_OT_preview_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_socket_toggle_exec(bContext *C, wmOperator *op) +static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -2128,7 +2128,7 @@ void NODE_OT_hide_socket_toggle(wmOperatorType *ot) /* ****************** Mute operator *********************** */ -static int node_mute_exec(bContext *C, wmOperator *op) +static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -2170,7 +2170,7 @@ void NODE_OT_mute_toggle(wmOperatorType *ot) /* ****************** Delete operator ******************* */ -static int node_delete_exec(bContext *C, wmOperator *op) +static int node_delete_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node, *next; @@ -2211,7 +2211,7 @@ void NODE_OT_delete(wmOperatorType *ot) /* ****************** Show Cyclic Dependencies Operator ******************* */ -static int node_show_cycles_exec(bContext *C, wmOperator *op) +static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index ec08cdf07ac..402e1b2d1cd 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -241,7 +241,7 @@ void NODE_OT_select_border(wmOperatorType *ot) /* ****** Select/Deselect All ****** */ -static int node_select_all_exec(bContext *C, wmOperator *op) +static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *first = snode->edittree->nodes.first; @@ -282,7 +282,7 @@ void NODE_OT_select_all(wmOperatorType *ot) /* ****** Select Linked To ****** */ -static int node_select_linked_to_exec(bContext *C, wmOperator *op) +static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLink *link; @@ -322,7 +322,7 @@ void NODE_OT_select_linked_to(wmOperatorType *ot) /* ****** Select Linked From ****** */ -static int node_select_linked_from_exec(bContext *C, wmOperator *op) +static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLink *link; @@ -362,7 +362,7 @@ void NODE_OT_select_linked_from(wmOperatorType *ot) /* ****** Select Same Type ****** */ -static int node_select_same_type_exec(bContext *C, wmOperator *op) +static int node_select_same_type_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -388,7 +388,7 @@ void NODE_OT_select_same_type(wmOperatorType *ot) /* ****** Select The Next/Prev Node Of The Same Type ****** */ -static int node_select_same_type_next_exec(bContext *C, wmOperator *op) +static int node_select_same_type_next_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -412,7 +412,7 @@ void NODE_OT_select_same_type_next(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_select_same_type_prev_exec(bContext *C, wmOperator *op) +static int node_select_same_type_prev_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index b4f09f960d6..d426ee17af7 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -278,7 +278,7 @@ static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) UI_view2d_curRect_validate(&ar->v2d); } -static int node_view_all_exec(bContext *C, wmOperator *op) +static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index dc6b9f342b3..c7e3340ba87 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1590,7 +1590,7 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre } } -static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op) +static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1630,7 +1630,7 @@ static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElemen } } -static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op) +static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1668,7 +1668,7 @@ void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, } } -static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op) +static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1697,7 +1697,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot) /* --- */ -static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op) +static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -1728,7 +1728,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot) /* --- */ -static int outliner_toggle_selected_exec(bContext *C, wmOperator *op) +static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -2660,7 +2660,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T return 0; } -static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ARegion *ar= CTX_wm_region(C); SpaceOops *soops= CTX_wm_space_outliner(C); @@ -2739,7 +2739,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) return NULL; } -static int outliner_show_active_exec(bContext *C, wmOperator *op) +static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *so= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -2959,7 +2959,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase } /* show entire object level hierarchy */ -static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op) +static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -3714,7 +3714,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S } -static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -3980,7 +3980,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m /* Add Operator ---------------------------------- */ -static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op) +static int outliner_drivers_addsel_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4015,7 +4015,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op) +static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4190,7 +4190,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *op) +static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 610fecaa543..7e3b14ca04a 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -80,7 +80,7 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot) } -static int script_reload_exec(bContext *C, wmOperator *op) +static int script_reload_exec(bContext *C, wmOperator *UNUSED(op)) { #ifndef DISABLE_PYTHON /* TODO, this crashes on netrender and keying sets, need to look into why diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 4394e334614..69eccfec2e1 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -92,7 +92,7 @@ void sequencer_buttons_register(ARegionType *art) /* **************** operator to open/close properties view ************* */ -static int sequencer_properties(bContext *C, wmOperator *op) +static int sequencer_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= sequencer_has_buttons_region(sa); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index d96b8a27c99..b41d0cb21d4 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1185,7 +1185,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); @@ -1310,7 +1310,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot) /* lock operator */ -static int sequencer_lock_exec(bContext *C, wmOperator *op) +static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1343,7 +1343,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot) } /* unlock operator */ -static int sequencer_unlock_exec(bContext *C, wmOperator *op) +static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1376,7 +1376,7 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_reload_exec(bContext *C, wmOperator *op) +static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1409,7 +1409,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_refresh_all_exec(bContext *C, wmOperator *op) +static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1609,7 +1609,7 @@ static int apply_unique_name_cb(Sequence *seq, void *arg_pt) } -static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) +static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1636,7 +1636,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { sequencer_add_duplicate_exec(C, op); @@ -1666,7 +1666,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) } /* delete operator */ -static int sequencer_delete_exec(bContext *C, wmOperator *op) +static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1840,7 +1840,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot) /* META Operators */ /* separate_meta_toggle operator */ -static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) +static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1985,7 +1985,7 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) } /* separate_meta_make operator */ -static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) +static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -2046,7 +2046,7 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot) } /* view_all operator */ -static int sequencer_view_all_exec(bContext *C, wmOperator *op) +static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { //Scene *scene= CTX_data_scene(C); bScreen *sc= CTX_wm_screen(C); @@ -2078,7 +2078,7 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot) } /* view_all operator */ -static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op) +static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *sc= CTX_wm_screen(C); ScrArea *area= CTX_wm_area(C); @@ -2189,7 +2189,7 @@ static EnumPropertyItem view_type_items[] = { #endif /* view_all operator */ -static int sequencer_view_toggle_exec(bContext *C, wmOperator *op) +static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C); @@ -2218,7 +2218,7 @@ void SEQUENCER_OT_view_toggle(wmOperatorType *ot) /* view_selected operator */ -static int sequencer_view_selected_exec(bContext *C, wmOperator *op) +static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View2D *v2d= UI_view2d_fromcontext(C); @@ -2354,7 +2354,7 @@ static int next_prev_edit_internal(Scene *scene, int side) } /* move frame to next edit point operator */ -static int sequencer_next_edit_exec(bContext *C, wmOperator *op) +static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -2384,7 +2384,7 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot) } /* move frame to previous edit point operator */ -static int sequencer_previous_edit_exec(bContext *C, wmOperator *op) +static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -2518,7 +2518,7 @@ void SEQUENCER_OT_swap(wmOperatorType *ot) RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap"); } -static int sequencer_rendersize_exec(bContext *C, wmOperator *op) +static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) { int retval = OPERATOR_CANCELLED; Scene *scene= CTX_data_scene(C); @@ -2638,7 +2638,7 @@ static void seq_offset(Scene *scene, Sequence *seq, int ofs) calc_sequence_disp(scene, seq); } -static int sequencer_paste_exec(bContext *C, wmOperator *op) +static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */ diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a61e05517d9..eee336eab1d 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -209,7 +209,7 @@ void select_neighbor_from_last(Scene *scene, int lr) /* (de)select operator */ -static int sequencer_deselect_exec(bContext *C, wmOperator *op) +static int sequencer_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -255,7 +255,7 @@ void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot) /* (de)select operator */ -static int sequencer_select_inverse_exec(bContext *C, wmOperator *op) +static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -582,7 +582,7 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { /* select more operator */ -static int sequencer_select_more_exec(bContext *C, wmOperator *op) +static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -613,7 +613,7 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot) /* select less operator */ -static int sequencer_select_less_exec(bContext *C, wmOperator *op) +static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -700,7 +700,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) /* select linked operator */ -static int sequencer_select_linked_exec(bContext *C, wmOperator *op) +static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int selected; diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 672940cf3cb..464e144515f 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -101,7 +101,7 @@ static int properties_poll(bContext *C) return (CTX_wm_space_text(C) != NULL); } -static int properties_exec(bContext *C, wmOperator *op) +static int properties_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= text_has_properties_region(sa); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 8ff82ce8be0..0d6c226c6d4 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -147,7 +147,7 @@ void text_update_edited(Text *text) /******************* new operator *********************/ -static int new_exec(bContext *C, wmOperator *op) +static int new_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text; @@ -204,7 +204,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; @@ -263,7 +263,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); char *path= (text && text->name)? text->name: G.sce; @@ -338,7 +338,7 @@ void TEXT_OT_reload(wmOperatorType *ot) /******************* delete operator *********************/ -static int unlink_exec(bContext *C, wmOperator *op) +static int unlink_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); @@ -385,7 +385,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /******************* make internal operator *********************/ -static int make_internal_exec(bContext *C, wmOperator *op) +static int make_internal_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -511,7 +511,7 @@ static int save_as_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); char *str; @@ -593,7 +593,7 @@ void TEXT_OT_run_script(wmOperatorType *ot) /******************* refresh pyconstraints operator *********************/ -static int refresh_pyconstraints_exec(bContext *C, wmOperator *op) +static int refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { #ifndef DISABLE_PYTHON #if 0 @@ -789,7 +789,7 @@ static void txt_copy_clipboard(Text *text) } } -static int copy_exec(bContext *C, wmOperator *op) +static int copy_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -845,7 +845,7 @@ void TEXT_OT_cut(wmOperatorType *ot) /******************* indent operator *********************/ -static int indent_exec(bContext *C, wmOperator *op) +static int indent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -880,7 +880,7 @@ void TEXT_OT_indent(wmOperatorType *ot) /******************* unindent operator *********************/ -static int unindent_exec(bContext *C, wmOperator *op) +static int unindent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -915,7 +915,7 @@ void TEXT_OT_unindent(wmOperatorType *ot) /******************* line break operator *********************/ -static int line_break_exec(bContext *C, wmOperator *op) +static int line_break_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -962,7 +962,7 @@ void TEXT_OT_line_break(wmOperatorType *ot) /******************* comment operator *********************/ -static int comment_exec(bContext *C, wmOperator *op) +static int comment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -995,7 +995,7 @@ void TEXT_OT_comment(wmOperatorType *ot) /******************* uncomment operator *********************/ -static int uncomment_exec(bContext *C, wmOperator *op) +static int uncomment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1172,7 +1172,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot) /******************* select all operator *********************/ -static int select_all_exec(bContext *C, wmOperator *op) +static int select_all_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1198,7 +1198,7 @@ void TEXT_OT_select_all(wmOperatorType *ot) /******************* select line operator *********************/ -static int select_line_exec(bContext *C, wmOperator *op) +static int select_line_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1224,7 +1224,7 @@ void TEXT_OT_select_line(wmOperatorType *ot) /******************* previous marker operator *********************/ -static int previous_marker_exec(bContext *C, wmOperator *op) +static int previous_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1260,7 +1260,7 @@ void TEXT_OT_previous_marker(wmOperatorType *ot) /******************* next marker operator *********************/ -static int next_marker_exec(bContext *C, wmOperator *op) +static int next_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1296,7 +1296,7 @@ void TEXT_OT_next_marker(wmOperatorType *ot) /******************* clear all markers operator *********************/ -static int clear_all_markers_exec(bContext *C, wmOperator *op) +static int clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1871,7 +1871,7 @@ static int jump_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int jump_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_props_dialog_popup(C,op,200,100); @@ -1947,7 +1947,7 @@ void TEXT_OT_delete(wmOperatorType *ot) /******************* toggle overwrite operator **********************/ -static int toggle_overwrite_exec(bContext *C, wmOperator *op) +static int toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); @@ -2512,7 +2512,7 @@ void TEXT_OT_cursor_set(wmOperatorType *ot) /******************* line number operator **********************/ -static int line_number_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2810,7 +2810,7 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot) /******************* replace set selected *********************/ -static int replace_set_selected_exec(bContext *C, wmOperator *op) +static int replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2920,7 +2920,7 @@ static int resolve_conflict_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); uiPopupMenu *pup; diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index fb80d54d5e6..edb3da5a06e 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -46,7 +46,7 @@ /* ****************** Start/End Frame Operators *******************************/ -static int time_set_sfra_exec (bContext *C, wmOperator *op) +static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int frame= CFRA; @@ -86,7 +86,7 @@ void TIME_OT_start_frame_set (wmOperatorType *ot) } -static int time_set_efra_exec (bContext *C, wmOperator *op) +static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int frame= CFRA; @@ -127,7 +127,7 @@ void TIME_OT_end_frame_set (wmOperatorType *ot) /* ************************ View All Operator *******************************/ -static int time_view_all_exec (bContext *C, wmOperator *op) +static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a0167c87d87..1bff01a02e4 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1451,7 +1451,7 @@ void view3d_buttons_register(ARegionType *art) // XXX view3d_panel_preview(C, ar, 0); } -static int view3d_properties(bContext *C, wmOperator *op) +static int view3d_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= view3d_has_buttons_region(sa); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 9f1b55ee2ce..e60dde7c88b 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1374,7 +1374,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot) } -static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview without local!, was centerview() in 2.4x */ +static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a localview without local!, was centerview() in 2.4x */ { ARegion *ar= CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); @@ -1514,7 +1514,7 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot) ot->flag= 0; } -static int viewcenter_cursor_exec(bContext *C, wmOperator *op) +static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -2151,7 +2151,7 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan"); } -static int viewpersportho_exec(bContext *C, wmOperator *op) +static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -2200,14 +2200,14 @@ static BGpic *add_background_image(bContext *C) return bgpic; } -static int add_background_image_exec(bContext *C, wmOperator *op) +static int add_background_image_exec(bContext *C, wmOperator *UNUSED(op)) { add_background_image(C); return OPERATOR_FINISHED; } -static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); @@ -2410,7 +2410,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* ***************** 3d cursor cursor op ******************* */ /* mx my in region coords */ -static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -2535,7 +2535,7 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot) Transform_Properties(ot, P_CONSTRAINT); } -static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { View3D *v3d = CTX_wm_view3d(C); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 7f5f7665028..4ef1d4daf92 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -443,7 +443,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) /* *********************** operators ******************** */ -static int snap_sel_to_grid(bContext *C, wmOperator *op) +static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) { extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); @@ -577,7 +577,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) /* *************************************************** */ -static int snap_sel_to_curs(bContext *C, wmOperator *op) +static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) { extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); @@ -703,7 +703,7 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot) /* *************************************************** */ -static int snap_curs_to_grid(bContext *C, wmOperator *op) +static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); RegionView3D *rv3d= CTX_wm_region_data(C); @@ -740,7 +740,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) /* **************************************************** */ -static int snap_curs_to_sel(bContext *C, wmOperator *op) +static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); @@ -847,7 +847,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) /* ********************************************** */ -static int snap_curs_to_active(bContext *C, wmOperator *op) +static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Object *obact= CTX_data_active_object(C); @@ -898,7 +898,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) /* **************************************************** */ /*New Code - Snap Cursor to Center -*/ -static int snap_curs_to_center(bContext *C, wmOperator *op) +static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 6e2624cb60b..10496bc078d 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -280,7 +280,7 @@ void view3d_tool_props_register(ARegionType *art) /* ********** operator to open/close toolshelf region */ -static int view3d_toolshelf(bContext *C, wmOperator *op) +static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= view3d_has_tools_region(sa); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index b49933cbb35..4bc921b6030 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -296,7 +296,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo } /* only meant for timer usage */ -static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -399,7 +399,7 @@ static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob) } -static int view3d_setcameratoview_exec(bContext *C, wmOperator *op) +static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -444,7 +444,7 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot) } -static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) +static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1600,7 +1600,7 @@ static void endlocalview(Scene *scene, ScrArea *sa) } } -static int localview_exec(bContext *C, wmOperator *unused) +static int localview_exec(bContext *C, wmOperator *UNUSED(unused)) { View3D *v3d= CTX_wm_view3d(C); @@ -1770,7 +1770,7 @@ int ED_view3d_context_activate(bContext *C) return 1; } -static int game_engine_exec(bContext *C, wmOperator *op) +static int game_engine_exec(bContext *C, wmOperator *UNUSED(op)) { #if GAMEBLENDER == 1 Scene *startscene = CTX_data_scene(C); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 95e167053ec..381612bf1ef 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -145,7 +145,7 @@ static int select_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; @@ -179,7 +179,7 @@ void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) } -static int delete_orientation_exec(bContext *C, wmOperator *op) +static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); @@ -192,7 +192,7 @@ static int delete_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return delete_orientation_exec(C, op); } @@ -243,7 +243,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return create_orientation_exec(C, op); } diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index e5128ea784a..a4f661e9511 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -196,14 +196,14 @@ void ED_undo_pop_op(bContext *C, wmOperator *op) ed_undo_step(C, 0, op->type->name); } -static int ed_undo_exec(bContext *C, wmOperator *op) +static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) { /* "last operator" should disappear, later we can tie ths with undo stack nicer */ WM_operator_stack_clear(C); return ed_undo_step(C, 1, NULL); } -static int ed_redo_exec(bContext *C, wmOperator *op) +static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) { return ed_undo_step(C, -1, NULL); } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 5c4564f1946..c300b668675 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1052,7 +1052,7 @@ void UV_OT_align(wmOperatorType *ot) /* ******************** weld operator **************** */ -static int weld_exec(bContext *C, wmOperator *op) +static int weld_exec(bContext *C, wmOperator *UNUSED(op)) { weld_align_uv(C, 'w'); @@ -1264,7 +1264,7 @@ void UV_OT_stitch(wmOperatorType *ot) /* ******************** (de)select all operator **************** */ -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene; ToolSettings *ts; @@ -2714,7 +2714,7 @@ void UV_OT_pin(wmOperatorType *ot) /******************* select pinned operator ***************/ -static int select_pinned_exec(bContext *C, wmOperator *op) +static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -2902,7 +2902,7 @@ void UV_OT_hide(wmOperatorType *ot) /****************** reveal operator ******************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *ts= CTX_data_tool_settings(C); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 20c9fa5877b..e5e46d407c9 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -330,7 +330,7 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { MinStretch *ms; @@ -425,7 +425,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* ******************** Pack Islands operator **************** */ -static int pack_islands_exec(bContext *C, wmOperator *op) +static int pack_islands_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -458,7 +458,7 @@ void UV_OT_pack_islands(wmOperatorType *ot) /* ******************** Average Islands Scale operator **************** */ -static int average_islands_scale_exec(bContext *C, wmOperator *op) +static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -975,7 +975,7 @@ void UV_OT_from_view(wmOperatorType *ot) /********************** Reset operator ********************/ -static int reset_exec(bContext *C, wmOperator *op) +static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); -- cgit v1.2.3 From f0fcf140f8242c76c8a7373cd61c3d4ab6a57391 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 02:24:48 +0000 Subject: enable warning for unused args with gcc: -Wunused-parameter - for cmake only apply this to source/blender, will apply globally later. - ./extern/ ./source/blender/makesrna/intern/ ignore this. --- CMakeLists.txt | 1 + build_files/scons/config/linux2-config.py | 2 +- extern/CMakeLists.txt | 3 +++ source/blender/CMakeLists.txt | 5 +++++ source/blender/makesrna/intern/CMakeLists.txt | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67dd7e40100..46977d780f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,6 +318,7 @@ IF(UNIX AND NOT APPLE) SET(PLATFORM_LINKFLAGS "-pthread") # Better warnings + # note: -Wunused-parameter should be added but for now only apply to ./source/blender SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas") SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare") diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index a9c74d692d7..f3e0085125a 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -204,7 +204,7 @@ REL_CCFLAGS = ['-O2'] ##ARFLAGS = ruv ##ARFLAGSQUIET = ru ## -C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement'] +C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter'] CC_WARN = ['-Wall'] CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare'] diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index b15c8a31c73..61acff4cfe4 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# Otherwise we get warnings here that we cant fix in external projects +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + IF(WITH_BULLET) ADD_SUBDIRECTORY(bullet2) ENDIF(WITH_BULLET) diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index 96d1ce3e8b2..dc0640c817f 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -24,6 +24,11 @@ # # ***** END GPL LICENSE BLOCK ***** +# TODO: remove this and uncommend the global arg, but for now adding here keeps it managable +IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") +ENDIF(CMAKE_COMPILER_IS_GNUCC) + ADD_SUBDIRECTORY(windowmanager) ADD_SUBDIRECTORY(editors) ADD_SUBDIRECTORY(avi) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 4f9032ffc95..a48603e623c 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# this warning on generated files gets annoying +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c") LIST(REMOVE_ITEM DEFSRC rna_access.c rna_define.c makesrna.c) -- cgit v1.2.3 From 201fd16df98dd1ad2a7b511edc96c338911dc1eb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 02:40:11 +0000 Subject: [#24250] wavefront import/export defaults match operator and internal default arg defaults. --- release/scripts/op/io_scene_obj/export_obj.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/op/io_scene_obj/export_obj.py b/release/scripts/op/io_scene_obj/export_obj.py index 49bc098ee54..3fd91615bb6 100644 --- a/release/scripts/op/io_scene_obj/export_obj.py +++ b/release/scripts/op/io_scene_obj/export_obj.py @@ -803,7 +803,7 @@ Currently the exporter lacks these features: def save(operator, context, filepath="", use_triangles=False, - use_edges=False, + use_edges=True, use_normals=False, use_hq_normals=False, use_uvs=True, -- cgit v1.2.3 From d3fcc2d0b4a02438f7e1ffa0bbdd9426d8dd0659 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 03:24:47 +0000 Subject: bugfix [#24256] Wrong bone subdivision number in tweak panel. there were 3 operators for armature subdivision, now only have 1 (as with mesh). + remove unused warnigns. --- release/scripts/ui/space_view3d.py | 4 +- release/scripts/ui/space_view3d_toolbar.py | 2 +- source/blender/editors/armature/armature_intern.h | 4 +- source/blender/editors/armature/armature_ops.c | 4 +- source/blender/editors/armature/editarmature.c | 128 ++++----------------- source/blender/editors/armature/poselib.c | 4 +- source/blender/editors/armature/poseobject.c | 19 +-- source/blender/editors/include/ED_armature.h | 2 +- .../editors/transform/transform_conversions.c | 2 +- 9 files changed, 44 insertions(+), 125 deletions(-) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 9299362cc05..f7238364142 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1856,7 +1856,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu): layout.separator() - layout.operator("armature.subdivide_multi", text="Subdivide") + layout.operator("armature.subdivide", text="Subdivide") layout.operator("armature.switch_direction", text="Switch Direction") layout.separator() @@ -1890,7 +1890,7 @@ class VIEW3D_MT_armature_specials(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("armature.subdivide_multi", text="Subdivide") + layout.operator("armature.subdivide", text="Subdivide") layout.operator("armature.switch_direction", text="Switch Direction") layout.separator() diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index a6f3f7e34c2..d2c6300eddc 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -311,7 +311,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel): col = layout.column(align=True) col.label(text="Modeling:") col.operator("armature.extrude_move") - col.operator("armature.subdivide_multi", text="Subdivide") + col.operator("armature.subdivide", text="Subdivide") col = layout.column(align=True) col.label(text="Repeat:") diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 2d28d3cb9e5..acbfec125e0 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -51,9 +51,7 @@ void ARMATURE_OT_align(struct wmOperatorType *ot); void ARMATURE_OT_calculate_roll(struct wmOperatorType *ot); void ARMATURE_OT_switch_direction(struct wmOperatorType *ot); -void ARMATURE_OT_subdivs(struct wmOperatorType *ot); -void ARMATURE_OT_subdivide_simple(struct wmOperatorType *ot); -void ARMATURE_OT_subdivide_multi(struct wmOperatorType *ot); +void ARMATURE_OT_subdivide(struct wmOperatorType *ot); void ARMATURE_OT_parent_set(struct wmOperatorType *ot); void ARMATURE_OT_parent_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 78b0b2e5e0d..ff4accfd066 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -57,9 +57,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(ARMATURE_OT_align); WM_operatortype_append(ARMATURE_OT_calculate_roll); WM_operatortype_append(ARMATURE_OT_switch_direction); - WM_operatortype_append(ARMATURE_OT_subdivs); - WM_operatortype_append(ARMATURE_OT_subdivide_simple); - WM_operatortype_append(ARMATURE_OT_subdivide_multi); + WM_operatortype_append(ARMATURE_OT_subdivide); WM_operatortype_append(ARMATURE_OT_parent_set); WM_operatortype_append(ARMATURE_OT_parent_clear); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index f786b50fcf9..c8c0a4e6980 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1075,7 +1075,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) * sel: remove selected bones from the armature, otherwise the unselected bones are removed * (ob is not in editmode) */ -static void separate_armature_bones (Scene *scene, Object *ob, short sel) +static void separate_armature_bones(Object *ob, short sel) { bArmature *arm= (bArmature *)ob->data; bPoseChannel *pchan, *pchann; @@ -1176,8 +1176,8 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op)) /* 3) remove bones that shouldn't still be around on both armatures */ - separate_armature_bones(scene, oldob, 1); - separate_armature_bones(scene, newob, 0); + separate_armature_bones(oldob, 1); + separate_armature_bones(newob, 0); /* 4) fix links before depsgraph flushes */ // err... or after? @@ -2087,7 +2087,7 @@ float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3]) /* Set roll value for given bone -> Z-Axis Point up (original method) */ -static void auto_align_ebone_zaxisup(Scene *scene, View3D *v3d, EditBone *ebone) +static void auto_align_ebone_zaxisup(Scene *UNUSED(scene), View3D *UNUSED(v3d), EditBone *ebone) { float delta[3], curmat[3][3]; float xaxis[3]={1.0f, 0.0f, 0.0f}, yaxis[3], zaxis[3]={0.0f, 0.0f, 1.0f}; @@ -3632,10 +3632,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) int numcuts, i; /* there may not be a number_cuts property defined (for 'simple' subdivide) */ - if (RNA_property_is_set(op->ptr, "number_cuts")) - numcuts= RNA_int_get(op->ptr, "number_cuts"); - else - numcuts= 1; + numcuts= RNA_int_get(op->ptr, "number_cuts"); /* loop over all editable bones */ // XXX the old code did this in reverse order though! @@ -3690,26 +3687,11 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - -void ARMATURE_OT_subdivide_simple(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Subdivide Simple"; - ot->idname= "ARMATURE_OT_subdivide_simple"; - - /* api callbacks */ - ot->exec = armature_subdivide_exec; - ot->poll = ED_operator_editarmature; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) +void ARMATURE_OT_subdivide(wmOperatorType *ot) { /* identifiers */ ot->name= "Subdivide Multi"; - ot->idname= "ARMATURE_OT_subdivide_multi"; + ot->idname= "ARMATURE_OT_subdivide"; /* api callbacks */ ot->exec = armature_subdivide_exec; @@ -3719,65 +3701,7 @@ void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* Properties */ - RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10); -} - - - -static int armature_subdivs_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) -{ - uiPopupMenu *pup; - uiLayout *layout; - - pup= uiPupMenuBegin(C, "Subdivision Type", 0); - layout= uiPupMenuLayout(pup); - uiItemsEnumO(layout, "ARMATURE_OT_subdivs", "type"); - uiPupMenuEnd(C, pup); - - return OPERATOR_CANCELLED; -} - -static int armature_subdivs_exec(bContext *C, wmOperator *op) -{ - switch (RNA_int_get(op->ptr, "type")) - { - case 0: /* simple */ - RNA_int_set(op->ptr, "number_cuts", 1); - armature_subdivide_exec(C, op); - break; - case 1: /* multi */ - armature_subdivide_exec(C, op); - break; - } - - return OPERATOR_FINISHED; -} - -void ARMATURE_OT_subdivs(wmOperatorType *ot) -{ - static EnumPropertyItem type_items[]= { - {0, "SIMPLE", 0, "Simple", ""}, - {1, "MULTI", 0, "Multi", ""}, - {0, NULL, 0, NULL, NULL}}; - - /* identifiers */ - ot->name= "subdivs"; - ot->idname= "ARMATURE_OT_subdivs"; - - /* api callbacks */ - ot->invoke= armature_subdivs_invoke; - ot->exec= armature_subdivs_exec; - - ot->poll= ED_operator_editarmature; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* props */ - RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); - - /* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/ - RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10); + RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10); } /* ----------- */ @@ -4552,7 +4476,7 @@ void ED_pose_deselectall (Object *ob, int test) arm->act_bone= NULL; } -static int bone_skinnable(Object *ob, Bone *bone, void *datap) +static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -4601,7 +4525,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap) return 0; } -static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data) +static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { /* This group creates a vertex group to ob that has the * same name as bone (provided the bone is skinnable). @@ -4616,7 +4540,7 @@ static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data) return 0; } -static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) +static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -4672,7 +4596,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) return 0; } -static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void add_vgroups__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { /* DerivedMesh mapFunc for getting final coords in weight paint mode */ @@ -4755,7 +4679,7 @@ void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object looper_data.list= NULL; /* count the number of skinnable bones */ - numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable); + numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); if (numbones == 0) return; @@ -4764,7 +4688,7 @@ void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object * and fill it with all of the skinnable bones */ bonelist = MEM_callocN(numbones*sizeof(Bone *), "bonelist"); looper_data.list= bonelist; - bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable); + bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); /* create an array of pointers to the deform groups that * coorespond to the skinnable bones (creating them @@ -4773,7 +4697,7 @@ void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object dgroupflip = MEM_callocN(numbones*sizeof(bDeformGroup *), "dgroupflip"); looper_data.list= dgrouplist; - bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable); + bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable_cb); /* create an array of root and tip positions transformed into * global coords */ @@ -4907,7 +4831,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, /* Traverse the bone list, trying to create empty vertex * groups cooresponding to the bone. */ - bone_looper(ob, arm->bonebase.first, NULL, ED_vgroup_add_unique_bone); + bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); if (ob->type == OB_MESH) ED_vgroup_data_create(ob->data); @@ -4964,7 +4888,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *UNUSED(op)) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5033,7 +4957,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *UNUSED(op)) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5186,7 +5110,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *UNUSED(op)) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5356,7 +5280,7 @@ void POSE_OT_select_parent(wmOperatorType *ot) /* ************* hide/unhide pose bones ******************* */ -static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) +static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5371,7 +5295,7 @@ static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) return 0; } -static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr) +static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5393,11 +5317,9 @@ static int pose_hide_exec(bContext *C, wmOperator *op) bArmature *arm= ob->data; if(RNA_boolean_get(op->ptr, "unselected")) - bone_looper(ob, arm->bonebase.first, NULL, - hide_unselected_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb); else - bone_looper(ob, arm->bonebase.first, NULL, - hide_selected_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); @@ -5422,7 +5344,7 @@ void POSE_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", ""); } -static int show_pose_bone(Object *ob, Bone *bone, void *ptr) +static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5442,7 +5364,7 @@ static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; - bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 3a90f75d2a1..a595396b15d 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -268,7 +268,7 @@ static KeyingSet *poselib_ks_locrotscale = NULL; /* the only keyingset we'll ne /* ----- */ -static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *arg) +static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *UNUSED(arg)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= ob->poselib; @@ -402,7 +402,7 @@ void POSELIB_OT_pose_add (wmOperatorType *ot) /* ----- */ -static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index fa7f01da7b9..ecb34609b2d 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -71,9 +71,9 @@ #include "armature_intern.h" /* ************* XXX *************** */ -static int pupmenu(const char *dummy) {return 0;} -static void error(const char *dummy) {}; -static void BIF_undo_push(const char *dummy) {} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} +static void error(const char *UNUSED(dummy)) {}; +static void BIF_undo_push(const char *UNUSED(dummy)) {} /* ************* XXX *************** */ @@ -226,7 +226,7 @@ int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) * * To be called from various tools that do incremental updates */ -void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) +void ED_pose_recalculate_paths(Scene *scene, Object *ob) { ListBase targets = {NULL, NULL}; @@ -267,7 +267,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) /* calculate the bones that now have motionpaths... */ // TODO: only make for the selected bones? - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); @@ -1895,9 +1895,9 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) /* ********************************************** */ /* context: active channel */ +#if 0 void pose_special_editmenu(Scene *scene) { -#if 0 Object *obedit= scene->obedit; // XXX context Object *ob= OBACT; short nr; @@ -1920,7 +1920,7 @@ void pose_special_editmenu(Scene *scene) pose_clear_paths(ob); } else if(nr==5) { - pose_clear_user_transforms(scene, ob); + pose_clear_user_transforms(ob); } else if(nr==6) { pose_relax(); @@ -1928,11 +1928,11 @@ void pose_special_editmenu(Scene *scene) else if(ELEM3(nr, 7, 8, 9)) { pose_autoside_names(nr-7); } -#endif } + /* Restore selected pose-bones to 'action'-defined pose */ -void pose_clear_user_transforms(Scene *scene, Object *ob) +static void pose_clear_user_transforms(Object *ob) { bArmature *arm= ob->data; bPoseChannel *pchan; @@ -1964,3 +1964,4 @@ void pose_clear_user_transforms(Scene *scene, Object *ob) BIF_undo_push("Clear User Transform"); } +#endif diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index e91bafc9056..32fe10783a7 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -147,7 +147,7 @@ void ED_armature_exit_posemode(struct bContext *C, struct Base *base); void ED_armature_enter_posemode(struct bContext *C, struct Base *base); int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan); void ED_pose_deselectall(struct Object *ob, int test); -void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob); +void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob); /* sketch */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index fd97406652e..53e553a0391 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4720,7 +4720,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o */ if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) { //ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } } else { -- cgit v1.2.3 From 68dea6591d4a08c50ade96ec58f00853d0d5340a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 04:27:09 +0000 Subject: bugfix [#24247] Duplicating a Composite Group Node no User Count Icon duplicating nodes wasnt changing the usercount of the referenced ID but file loading deleting was. also removed some unused args. --- source/blender/editors/include/ED_node.h | 2 +- source/blender/editors/space_node/node_draw.c | 16 ++++++++-------- source/blender/editors/space_node/node_edit.c | 11 ++++++++++- source/blender/makesrna/intern/rna_color.c | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 2 +- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 +- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 6e42b772bef..d287066828f 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -40,7 +40,7 @@ void ED_init_node_butfuncs(void); /* node_draw.c */ void ED_node_changed_update(struct ID *id, struct bNode *node); -void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node); +void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); /* node_edit.c */ void ED_node_shader_default(struct Material *ma); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 8316d79c9f0..a81d6e3b0ce 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -111,7 +111,7 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) return 0; } -void ED_node_generic_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) +void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node) { Material *ma; Tex *tex; @@ -309,7 +309,7 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node) } /* based on settings in node, sets drawing rect info. each redraw! */ -static void node_update_hidden(const bContext *C, bNode *node) +static void node_update_hidden(bNode *node) { bNodeSocket *nsock; float rad, drad, hiddenrad= HIDDEN_RAD; @@ -392,7 +392,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) node->locy+= gnode->locy; if(node->flag & NODE_HIDDEN) - node_update_hidden(C, node); + node_update_hidden(node); else node_update(C, ntree, node); node->locx-= gnode->locx; @@ -483,7 +483,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) /* nice AA filled circle */ /* this might have some more generic use */ -static void circle_draw(float x, float y, float size, int type, int col[3]) +static void circle_draw(float x, float y, float size, int col[3]) { /* 16 values of sin function */ static float si[16] = { @@ -538,11 +538,11 @@ static void socket_circle_draw(bNodeSocket *sock, float size) else { col[0]= 100; col[1]= 200; col[2]= 100; } - - circle_draw(sock->locx, sock->locy, size, sock->type, col); + + circle_draw(sock->locx, sock->locy, size, col); } -static void node_sync_cb(bContext *C, void *snode_v, void *node_v) +static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v) { SpaceNode *snode= snode_v; @@ -1103,7 +1103,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) if(node->flag & NODE_GROUP_EDIT) node_update_group(C, snode->nodetree, node); else if(node->flag & NODE_HIDDEN) - node_update_hidden(C, node); + node_update_hidden(node); else node_update(C, snode->nodetree, node); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 42aec17cc8f..71f48f0de5d 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -98,7 +98,7 @@ static int compo_breakjob(void *cjv) } /* called by compo, wmJob sends notifier */ -static void compo_redrawjob(void *cjv, char *str) +static void compo_redrawjob(void *cjv, char *UNUSED(str)) { CompoJob *cj= cjv; @@ -1475,9 +1475,18 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); + bNode *node; ED_preview_kill_jobs(C); + /* simple id user adjustment, node internal functions dont touch this + * but operators and readfile.c do. */ + for(node= snode->edittree->nodes.first; node; node= node->next) { + if(node->flag & SELECT) { + id_us_plus(node->id); + } + } + ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */ ntreeSolveOrder(snode->edittree); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 509fecb0122..cd588b598bd 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -253,7 +253,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr) for(node=ntree->nodes.first; node; node=node->next) { if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { - ED_node_generic_update(bmain, scene, ntree, node); + ED_node_generic_update(bmain, ntree, node); } } } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a97033200de..ef56ad6a0c2 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -159,7 +159,7 @@ static void rna_Image_end_frame_set(PointerRNA *ptr, int value) static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) { - ED_node_generic_update(bmain, scene, ntree, node); + ED_node_generic_update(bmain, ntree, node); } static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index f563cacf8a8..b9580cf4f91 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -219,7 +219,7 @@ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op){} void WM_cursor_wait (int val) {} void ED_node_texture_default(struct Tex *tx){} void ED_node_changed_update(struct bContext *C, struct bNode *node){} -void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node){} +void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node){} void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){} int ED_view3d_scene_layer_set(int lay, const int *values){return 0;} void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){} -- cgit v1.2.3 From 25bbf99a79b0a1fa324dcd8d49bf80807b2d9672 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 05:18:45 +0000 Subject: replace SIDE_OF_LINE macro with line_point_side_v2() inline function. made a number of files build without unused warnings. --- source/blender/blenkernel/intern/displist.c | 2 +- source/blender/blenkernel/intern/library.c | 5 +- source/blender/blenlib/BLI_math_vector.h | 2 + source/blender/blenlib/BLI_scanfill.h | 2 +- source/blender/blenlib/intern/math_geom.c | 27 +++++---- source/blender/blenlib/intern/math_vector_inline.c | 6 ++ source/blender/blenlib/intern/scanfill.c | 2 +- source/blender/editors/mesh/editmesh_add.c | 8 +-- source/blender/editors/mesh/editmesh_tools.c | 2 +- source/blender/editors/object/object_bake.c | 2 +- source/blender/editors/object/object_constraint.c | 14 ++--- source/blender/editors/object/object_hook.c | 2 +- source/blender/editors/object/object_shapekey.c | 5 +- source/blender/editors/object/object_vgroup.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 65 +++++++++++----------- source/blender/editors/sculpt_paint/paint_intern.h | 2 +- source/blender/editors/sculpt_paint/paint_stroke.c | 4 +- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/ikplugin/intern/iksolver_plugin.c | 2 +- source/blender/windowmanager/intern/wm_gesture.c | 2 +- 20 files changed, 79 insertions(+), 79 deletions(-) diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index d0336d9f786..2ab7e32a9c6 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -979,7 +979,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) dl= dl->next; } - if(totvert && BLI_edgefill(0, 0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { + if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { /* count faces */ tot= 0; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 93e4b5fcfbe..3f94992cd11 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -71,6 +71,7 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" +#include "BKE_utildefines.h" #include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_library.h" @@ -668,7 +669,7 @@ void *copy_libblock(void *rt) return idn; } -static void free_library(Library *lib) +static void free_library(Library *UNUSED(lib)) { /* no freeing needed for libraries yet */ } @@ -680,7 +681,7 @@ void set_free_windowmanager_cb(void (*func)(bContext *C, wmWindowManager *) ) free_windowmanager_cb= func; } -void animdata_dtar_clear_cb(ID *id, AnimData *adt, void *userdata) +void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata) { ChannelDriver *driver; FCurve *fcu; diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index b160097a33d..5c17ac6b639 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -129,6 +129,8 @@ MINLINE int compare_len_v3v3(float a[3], float b[3], float limit); MINLINE int compare_v4v4(float a[4], float b[4], float limit); MINLINE int equals_v4v4(float a[4], float b[4]); +MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]); + /********************************** Angles ***********************************/ /* - angle with 2 arguments is angle between vector */ /* - angle with 3 arguments is angle between 3 points at the middle point */ diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 0ae40c0b83d..bae5375f757 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -50,7 +50,7 @@ extern "C" { /* scanfill.c: used in displist only... */ struct EditVert *BLI_addfillvert(float *vec); struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); -int BLI_edgefill(int mode, int mat_nr); +int BLI_edgefill(int mat_nr); void BLI_end_edgefill(void); /* These callbacks are needed to make the lib finction properly */ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 2aec707b4ea..c2e765388c8 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -336,20 +336,19 @@ static short IsectLLPt2Df(float x0,float y0,float x1,float y1, return 1; } // end Intersect_Lines -#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) /* point in tri */ -// XXX was called IsectPT2Df + int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2]) { - if (SIDE_OF_LINE(v1,v2,pt)>=0.0) { - if (SIDE_OF_LINE(v2,v3,pt)>=0.0) { - if (SIDE_OF_LINE(v3,v1,pt)>=0.0) { + if (line_point_side_v2(v1,v2,pt)>=0.0) { + if (line_point_side_v2(v2,v3,pt)>=0.0) { + if (line_point_side_v2(v3,v1,pt)>=0.0) { return 1; } } } else { - if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) { - if (! (SIDE_OF_LINE(v3,v1,pt)>=0.0)) { + if (! (line_point_side_v2(v2,v3,pt)>=0.0)) { + if (! (line_point_side_v2(v3,v1,pt)>=0.0)) { return -1; } } @@ -360,18 +359,18 @@ int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2]) /* point in quad - only convex quads */ int isect_point_quad_v2(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2]) { - if (SIDE_OF_LINE(v1,v2,pt)>=0.0) { - if (SIDE_OF_LINE(v2,v3,pt)>=0.0) { - if (SIDE_OF_LINE(v3,v4,pt)>=0.0) { - if (SIDE_OF_LINE(v4,v1,pt)>=0.0) { + if (line_point_side_v2(v1,v2,pt)>=0.0) { + if (line_point_side_v2(v2,v3,pt)>=0.0) { + if (line_point_side_v2(v3,v4,pt)>=0.0) { + if (line_point_side_v2(v4,v1,pt)>=0.0) { return 1; } } } } else { - if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) { - if (! (SIDE_OF_LINE(v3,v4,pt)>=0.0)) { - if (! (SIDE_OF_LINE(v4,v1,pt)>=0.0)) { + if (! (line_point_side_v2(v2,v3,pt)>=0.0)) { + if (! (line_point_side_v2(v3,v4,pt)>=0.0)) { + if (! (line_point_side_v2(v4,v1,pt)>=0.0)) { return -1; } } diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 2f75fcead79..a45356f0bde 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -454,5 +454,11 @@ MINLINE int compare_v4v4(float *v1, float *v2, float limit) return 0; } +MINLINE float line_point_side_v2(const float *l1, const float *l2, const float *pt) +{ + return ((l1[0]-pt[0]) * (l2[1]-pt[1])) - + ((l2[0]-pt[0]) * (l1[1]-pt[1])); +} + #endif /* BLI_MATH_VECTOR_INLINE */ diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 7896ebdd263..85af307be16 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -747,7 +747,7 @@ static void scanfill(PolyFill *pf, int mat_nr) -int BLI_edgefill(int mode, int mat_nr) +int BLI_edgefill(int mat_nr) { /* - fill works with its own lists, so create that first (no faces!) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 2501a01d0e6..ad4c02c834c 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -113,7 +113,6 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) EditVert *eve; float min[3], max[3]; int done= 0; - int rot_src= RNA_boolean_get(op->ptr, "rotate_source"); em_setup_viewcontext(C, &vc); @@ -130,14 +129,13 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) /* call extrude? */ if(done) { + int rot_src= RNA_boolean_get(op->ptr, "rotate_source"); EditEdge *eed; float vec[3], cent[3], mat[3][3]; float nor[3]= {0.0, 0.0, 0.0}; /* 2D normal calc */ float mval_f[2]= {(float)event->mval[0], (float)event->mval[1]}; - -#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) done= 0; @@ -155,7 +153,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) * * accumulate the screenspace normal in 2D, * with screenspace edge length weighting the result. */ - if(SIDE_OF_LINE(co1, co2, mval_f) >= 0.0f) { + if(line_point_side_v2(co1, co2, mval_f) >= 0.0f) { nor[0] += (co1[1] - co2[1]); nor[1] += -(co1[0] - co2[0]); } @@ -167,8 +165,6 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) } } -#undef SIDE_OF_LINE - if(done) { float view_vec[3], cross[3]; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fc8a713230f..fb29257b184 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -7003,7 +7003,7 @@ static void fill_mesh(EditMesh *em) } } - if(BLI_edgefill(0, em->mat_nr)) { + if(BLI_edgefill(em->mat_nr)) { efa= fillfacebase.first; while(efa) { /* normals default pointing up */ diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index a921620fa71..0c28d4a608b 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -69,7 +69,7 @@ /* ****************** render BAKING ********************** */ /* threaded break test */ -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return G.afbreek; } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index ab3c649299c..02c88d4149b 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -511,7 +511,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op) return 0; } -static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Object *ob, int type) +static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type) { char constraint_name[32]; int owner = RNA_enum_get(op->ptr, "owner"); @@ -547,7 +547,7 @@ static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Ob static int stretchto_reset_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_STRETCHTO); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO); bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -590,7 +590,7 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot) static int limitdistance_reset_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_DISTLIMIT); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT); bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -636,7 +636,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; bPoseChannel *pchan= NULL; @@ -720,7 +720,7 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot) static int childof_clear_inverse_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; /* simply clear the matrix */ @@ -837,7 +837,7 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot) static int constraint_move_down_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, 0); + bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->next) { ListBase *conlist= get_constraint_lb(ob, con, NULL); @@ -885,7 +885,7 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot) static int constraint_move_up_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, 0); + bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->prev) { ListBase *conlist= get_constraint_lb(ob, con, NULL); diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index e6511b82eeb..3c3e7f1df76 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -557,7 +557,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob = CTX_data_edit_object(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 33f3534bb3b..0aefb09ee9e 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -161,7 +161,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) return 1; } -static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob) +static int object_shape_key_mirror(bContext *C, Object *ob) { KeyBlock *kb; Key *key; @@ -327,10 +327,9 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot) static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - if(!ED_object_shape_key_mirror(C, scene, ob)) + if(!object_shape_key_mirror(C, ob)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index c8c5492c966..015fab05828 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1947,7 +1947,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 5caa6c5045b..2521f138fee 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -473,8 +473,6 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj } } -#define SIDE_OF_LINE(pa, pb, pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) - /* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3]) { @@ -1689,7 +1687,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa /* note, use a squared value so we can use Vec2Lenf_nosqrt * be sure that you have done a bounds check first or this may fail */ /* only give bucket_bounds as an arg because we need it elsewhere */ -static int project_bucket_isect_circle(const int bucket_x, const int bucket_y, const float cent[2], const float radius_squared, rctf *bucket_bounds) +static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds) { /* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect @@ -1852,7 +1850,7 @@ static void project_bucket_clip_face( { int inside_bucket_flag = 0; int inside_face_flag = 0; - const int flip = ((SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) > 0.0f) != (SIDE_OF_LINE(uv1co, uv2co, uv3co) > 0.0f)); + const int flip = ((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f)); float bucket_bounds_ss[4][2]; @@ -2134,15 +2132,15 @@ if __name__ == '__main__': /* checks if pt is inside a convex 2D polyline, the polyline must be ordered rotating clockwise - * otherwise it would have to test for mixed (SIDE_OF_LINE > 0.0f) cases */ + * otherwise it would have to test for mixed (line_point_side_v2 > 0.0f) cases */ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot) { int i; - if (SIDE_OF_LINE(uv[tot-1], uv[0], pt) < 0.0f) + if (line_point_side_v2(uv[tot-1], uv[0], pt) < 0.0f) return 0; for (i=1; i 0.0f); + int side = (line_point_side_v2(uv[tot-1], uv[0], pt) > 0.0f); for (i=1; i 0.0f) != side) + if ((line_point_side_v2(uv[i-1], uv[i], pt) > 0.0f) != side) return 0; } @@ -2652,7 +2650,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index * calculated when it might not be needed later, (at the moment at least) * obviously it shouldn't have bugs though */ -static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max[2], int bucket_x, int bucket_y, int bucket_index, const MFace *mf) +static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MFace *mf) { /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */ rctf bucket_bounds; @@ -2712,11 +2710,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max /* Add faces to the bucket but dont initialize its pixels * TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */ -static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const MTFace *tf, const int face_index) +static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index) { float min[2], max[2], *vCoSS; int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */ - int fidx, bucket_x, bucket_y, bucket_index; + int fidx, bucket_x, bucket_y; int has_x_isect = -1, has_isect = 0; /* for early loop exit */ MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */ @@ -2733,10 +2731,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) { has_x_isect = 0; for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) { - - bucket_index = bucket_x + (bucket_y * ps->buckets_x); - - if (project_bucket_face_isect(ps, min, max, bucket_x, bucket_y, bucket_index, mf)) { + if (project_bucket_face_isect(ps, bucket_x, bucket_y, mf)) { + int bucket_index= bucket_x + (bucket_y * ps->buckets_x); BLI_linklist_prepend_arena( &ps->bucketFaces[ bucket_index ], SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */ @@ -3194,7 +3190,7 @@ static void project_paint_begin(ProjPaintState *ps) } } else { - if (SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) < 0.0f) { + if (line_point_side_v2(v1coSS, v2coSS, v3coSS) < 0.0f) { continue; } @@ -3217,7 +3213,7 @@ static void project_paint_begin(ProjPaintState *ps) if (image_index != -1) { /* Initialize the faces screen pixels */ /* Add this to a list to initialize later */ - project_paint_delayed_face_init(ps, mf, tf, face_index); + project_paint_delayed_face_init(ps, mf, face_index); } } } @@ -3500,7 +3496,7 @@ static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds); if ( (ps->source != PROJ_SRC_VIEW) || - project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(diameter*diameter), bucket_bounds) + project_bucket_isect_circle(mval, (float)(diameter*diameter), bucket_bounds) ) { *bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x); ps->context_bucket_x++; @@ -3569,7 +3565,7 @@ static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, c cp[3]= alpha > 255 ? 255 : alpha; } -static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) +static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask) { if (ps->is_airbrush==0 && mask < 1.0f) { projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*255), ps->blend); @@ -3580,7 +3576,7 @@ static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, floa } } -static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) +static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask) { if (ps->is_airbrush==0 && mask < 1.0f) { IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, ((ProjPixelClone *)projPixel)->clonepx.f, alpha, ps->blend); @@ -3597,7 +3593,7 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl * accumulation of color greater then 'projPixel->mask' however in the case of smear its not * really that important to be correct as it is with clone and painting */ -static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2]) +static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2]) { unsigned char rgba_ub[4]; @@ -3608,7 +3604,7 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena); } -static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2]) +static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2]) { unsigned char rgba_ub[4]; unsigned char rgba_smear[4]; @@ -3757,6 +3753,7 @@ static void *do_projectpaint_thread(void *ph_v) if (falloff > 0.0f) { if (ps->is_texbrush) { + /* note, for clone and smear, we only use the alpha, could be a special function */ brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index); alpha = rgba[3]; } else { @@ -3808,20 +3805,20 @@ static void *do_projectpaint_thread(void *ph_v) case PAINT_TOOL_CLONE: if (is_floatbuf) { if (((ProjPixelClone *)projPixel)->clonepx.f[3]) { - do_projectpaint_clone_f(ps, projPixel, rgba, alpha, mask); + do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */ } } else { if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) { - do_projectpaint_clone(ps, projPixel, rgba, alpha, mask); + do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */ } } break; case PAINT_TOOL_SMEAR: sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs); - if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels_f, co); - else do_projectpaint_smear(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels, co); + if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co); + else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co); break; default: if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask); @@ -3861,7 +3858,7 @@ static void *do_projectpaint_thread(void *ph_v) return NULL; } -static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos) +static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos) { /* First unpack args from the struct */ ProjPaintState *ps = (ProjPaintState *)state; @@ -3928,7 +3925,7 @@ static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *po } -static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure) +static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure) { /* Use mouse coords as floats for projection painting */ @@ -4387,7 +4384,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL); if(ibuf && ibuf->rect) - imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, mval, newuv); + imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv); else { newimage = NULL; newuv[0] = newuv[1] = 0.0f; @@ -4398,8 +4395,8 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint /* see if stroke is broken, and if so finish painting in old position */ if (s->image) { - imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv); - imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, prevmval, bkuv); + imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv); + imapaint_pick_uv(s->scene, s->ob, newfaceindex, prevmval, bkuv); if (newimage == s->image) breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv); @@ -4410,7 +4407,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint fwuv[0]= fwuv[1]= 0.0f; if (breakstroke) { - imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv); + imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv); redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, fwuv, time, 1, pressure); imapaint_clear_partial_redraw(); @@ -4923,7 +4920,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *customdata) +static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { Brush *brush= image_paint_brush(C); Paint *paint= paint_get_active(CTX_data_scene(C)); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 3ed314095ef..6232a8f2de1 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -99,7 +99,7 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot); /* paint_utils.c */ int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index); -void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv); +void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv); void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y); void BRUSH_OT_curve_preset(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 6d58731d79c..e991c4fc3fa 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -253,7 +253,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc) snap->winy = vc->ar->winy; } -int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) +static int load_tex(Brush* br, ViewContext* vc) { static GLuint overlay_texture = 0; static int init = 0; @@ -611,7 +611,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused) GL_VIEWPORT_BIT| GL_TEXTURE_BIT); - if (load_tex(sd, brush, &vc)) { + if (load_tex(brush, &vc)) { glEnable(GL_BLEND); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 8fee8c7e8fc..e3a486a0fee 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -88,7 +88,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl } /* compute uv coordinates of mouse in face */ -void imapaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, int *xy, float *uv) +void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv) { DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX); diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 9c0f151aa8b..240e91ad22e 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -488,7 +488,7 @@ static void free_posetree(PoseTree *tree) ///---------------------------------------- /// Plugin API for legacy iksolver -void iksolver_initialize_tree(struct Scene *scene, struct Object *ob, float ctime) +void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime)) { bPoseChannel *pchan; diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index e87d2d79c39..e6220eac8f0 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -244,7 +244,7 @@ static void draw_filled_lasso(wmGesture *gt) /* highly unlikely this will fail, but could crash if (gt->points == 0) */ if(firstv) { BLI_addfilledge(firstv, v); - BLI_edgefill(0, 0); + BLI_edgefill(0); glEnable(GL_BLEND); glColor4f(1.0, 1.0, 1.0, 0.05); -- cgit v1.2.3 From 4e61d5420c6b45c406bc59bd311342579c619e9c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 05:27:57 +0000 Subject: Ctrl+Click extrude, project the source verts when projection and rotating the source are enabled (better for retopo workflow). --- source/blender/editors/mesh/editmesh_add.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index ad4c02c834c..30070581a1c 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -113,9 +113,12 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) EditVert *eve; float min[3], max[3]; int done= 0; - + short use_proj; + em_setup_viewcontext(C, &vc); + use_proj= ((vc.scene->toolsettings->snap_flag & (SCE_SNAP|SCE_SNAP_PROJECT))==(SCE_SNAP|SCE_SNAP_PROJECT)) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); + invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); INIT_MINMAX(min, max); @@ -129,7 +132,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) /* call extrude? */ if(done) { - int rot_src= RNA_boolean_get(op->ptr, "rotate_source"); + short rot_src= RNA_boolean_get(op->ptr, "rotate_source"); EditEdge *eed; float vec[3], cent[3], mat[3][3]; float nor[3]= {0.0, 0.0, 0.0}; @@ -221,8 +224,12 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) } } - if(rot_src) + if(rot_src) { rotateflag(vc.em, SELECT, cent, mat); + /* also project the source, for retopo workflow */ + if(use_proj) + EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); + } extrudeflag(vc.obedit, vc.em, SELECT, nor, 0); rotateflag(vc.em, SELECT, cent, mat); @@ -249,11 +256,8 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) eve->f= SELECT; } - if( ((vc.scene->toolsettings->snap_flag & (SCE_SNAP|SCE_SNAP_PROJECT))==(SCE_SNAP|SCE_SNAP_PROJECT)) && - (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE) - ) { + if(use_proj) EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); - } WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA); -- cgit v1.2.3 From 271bbf4a0d7390f68ac973aa83bbb89fd0e4f583 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 07:26:26 +0000 Subject: fix for own recent unused commit that broke with OpenMP enabled. also build ./source/ first with cmake since testing new changes are most likely to be made here. --- CMakeLists.txt | 2 +- source/blender/editors/sculpt_paint/paint_stroke.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46977d780f6..287fa50d70a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -931,9 +931,9 @@ ENDIF(WITH_CXX_GUARDEDALLOC) #----------------------------------------------------------------------------- # Libraries FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "") +ADD_SUBDIRECTORY(source) ADD_SUBDIRECTORY(intern) ADD_SUBDIRECTORY(extern) -ADD_SUBDIRECTORY(source) #----------------------------------------------------------------------------- diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index e991c4fc3fa..ea99844bfac 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -253,7 +253,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc) snap->winy = vc->ar->winy; } -static int load_tex(Brush* br, ViewContext* vc) +static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) { static GLuint overlay_texture = 0; static int init = 0; @@ -268,8 +268,12 @@ static int load_tex(Brush* br, ViewContext* vc) int j; int refresh; +#ifndef _OPENMP + (void)sd; /* quied unused warning */ +#endif + if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0; - + refresh = !overlay_texture || (br->mtex.tex && @@ -611,7 +615,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused) GL_VIEWPORT_BIT| GL_TEXTURE_BIT); - if (load_tex(brush, &vc)) { + if (load_tex(sd, brush, &vc)) { glEnable(GL_BLEND); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); -- cgit v1.2.3 From bb11d6337e334b9ceb6fc9b27c8f0aba13897d9a Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 15 Oct 2010 07:31:26 +0000 Subject: Fix [#24260] Window geometry command-line option doesn't work Override the first window size with --window-geometry if given. startup.blend would otherwise open as lastly saved. --- source/blender/windowmanager/intern/wm_window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d9d7abd3a68..3600267dabc 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -68,6 +68,7 @@ GHOST_SystemHandle g_system= NULL; /* set by commandline */ static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal; +static int prefsizeused = 0; /* ******** win open & close ************ */ @@ -372,18 +373,19 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) for(win= wm->windows.first; win; win= win->next) { if(win->ghostwin==NULL) { - if(win->sizex==0) { + if(win->sizex==0 || prefsizeused==0) { win->posx= prefstax; win->posy= prefstay; win->sizex= prefsizx; win->sizey= prefsizy; win->windowstate= initialstate; + prefsizeused= 1; } wm_window_add_ghostwindow(C, wm, "Blender", win); } /* happens after fileread */ if(win->eventstate==NULL) - win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); + win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); /* add keymap handlers (1 handler for all keys in map!) */ keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0); -- cgit v1.2.3 From 4cfecdd06ab3f45c944b42c003e8dbd9179e911f Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 15 Oct 2010 08:11:26 +0000 Subject: Fix for [#21822] Unusual material slot behaviour, edit v object mode, cascade, SVN 27833 * Disabled removing material slots in edit mode and added back error message from 2.49. --- source/blender/editors/render/render_shading.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index a989171d617..a058f5155de 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -289,6 +289,12 @@ static int material_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) if(!ob) return OPERATOR_CANCELLED; + /* Removing material slots in edit mode screws things up, see bug #21822.*/ + if(ob == CTX_data_edit_object(C)) { + BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode."); + return OPERATOR_CANCELLED; + } + object_remove_material_slot(ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob); -- cgit v1.2.3 From 7a535ed3d9691d3d7df52848f8a8621633c00de0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 08:32:27 +0000 Subject: [#24263] Hooks influence area with vertex group assigned is not effected changes... - use vertex weights when hook indices are used. - use force as well as vertex weights (overall multiplier), before when vertex weights were used force was ignored. - rearranged the loops to be less confusing. - falloff now in its own function. - falloff curve slightly different, smoother towards the center /w 2 less sqrt calls. --- source/blender/modifiers/intern/MOD_hook.c | 176 ++++++++++++++++------------- 1 file changed, 95 insertions(+), 81 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 8ad3c9aaf5b..c26d3ff0967 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -75,7 +75,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(!hmd->indexar && hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); + // if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX; return dataMask; } @@ -121,6 +122,21 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } +static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac) +{ + if(falloff_squared) { + float len_squared = len_squared_v3v3(co_1, co_2); + if(len_squared > falloff_squared) { + return 0.0f; + } + else if(len_squared > 0.0) { + return fac * (1.0 - (len_squared / falloff_squared)); + } + } + + return fac; +} + static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], @@ -131,8 +147,13 @@ static void deformVerts(ModifierData *md, Object *ob, HookModifierData *hmd = (HookModifierData*) md; bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); float vec[3], mat[4][4], dmat[4][4]; - int i; + int i, *index_pt; DerivedMesh *dm = derivedData; + const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */ + + int max_dvert= 0; + MDeformVert *dvert= NULL; + int defgrp_index = -1; /* get world-space matrix of target, corrected for the space the verts are in */ if (hmd->subtarget[0] && pchan) { @@ -147,98 +168,91 @@ static void deformVerts(ModifierData *md, Object *ob, mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv, NULL, NULL, NULL, NULL, NULL); - /* vertex indices? */ - if(hmd->indexar) { - for(i = 0; i < hmd->totindex; i++) { - int index = hmd->indexar[i]; - - /* This should always be true and I don't generally like - * "paranoid" style code like this, but old files can have - * indices that are out of range because old blender did - * not correct them on exit editmode. - zr - */ - if(index < numVerts) { - float *co = vertexCos[index]; - float fac = hmd->force; - - /* if DerivedMesh is present and has original index data, - * use it - */ - if(dm && dm->getVertDataArray(dm, CD_ORIGINDEX)) { + if((defgrp_index= defgroup_name_index(ob, hmd->name)) != -1) { + Mesh *me = ob->data; + if(dm) { + dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT); + if(dvert) { + max_dvert = numVerts; + } + } + else if(me->dvert) { + dvert= me->dvert; + if(dvert) { + max_dvert = me->totvert; + } + } + } + + /* Regarding index range checking below. + * + * This should always be true and I don't generally like + * "paranoid" style code like this, but old files can have + * indices that are out of range because old blender did + * not correct them on exit editmode. - zr + */ + + if(hmd->force == 0.0f) { + /* do nothing, avoid annoying checks in the loop */ + } + else if(hmd->indexar) { /* vertex indices? */ + const float fac_orig= hmd->force; + float fac; + const int *origindex_ar; + + /* if DerivedMesh is present and has original index data, + * use it + */ + if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) { + for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + if(*index_pt < numVerts) { int j; - int orig_index; - for(j = 0; j < numVerts; ++j) { - fac = hmd->force; - orig_index = *(int *)dm->getVertData(dm, j, - CD_ORIGINDEX); - if(orig_index == index) { - co = vertexCos[j]; - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - if(fac != 0.0) { - mul_v3_m4v3(vec, mat, co); - interp_v3_v3v3(co, co, vec, fac); + for(j = 0; j < numVerts; j++) { + if(origindex_ar[j] == *index_pt) { + float *co = vertexCos[j]; + if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if(dvert) + fac *= defvert_find_weight(dvert+j, defgrp_index); + + if(fac) { + mul_v3_m4v3(vec, mat, co); + interp_v3_v3v3(co, co, vec, fac); + } } } } - } else { - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - - if(fac != 0.0) { - mul_v3_m4v3(vec, mat, co); - interp_v3_v3v3(co, co, vec, fac); - } } } } - } - else if(hmd->name[0]) { /* vertex group hook */ - Mesh *me = ob->data; - int use_dverts = 0; - int maxVerts = 0; - int defgrp_index = defgroup_name_index(ob, hmd->name); - - if(dm) { - if(dm->getVertData(dm, 0, CD_MDEFORMVERT)) { - maxVerts = dm->getNumVerts(dm); - use_dverts = 1; + else { /* missing dm or ORIGINDEX */ + for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + if(*index_pt < numVerts) { + float *co = vertexCos[*index_pt]; + if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if(dvert) + fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index); + + if(fac) { + mul_v3_m4v3(vec, mat, co); + interp_v3_v3v3(co, co, vec, fac); + } + } + } } } - else if(me->dvert) { - maxVerts = me->totvert; - use_dverts = 1; - } + } + else if(dvert) { /* vertex group hook */ + int i; + const float fac_orig= hmd->force; - if(defgrp_index >= 0 && use_dverts) { - MDeformVert *dvert = me->dvert; - int i; + for(i = 0; i < max_dvert; i++, dvert++) { float fac; + float *co = vertexCos[i]; - for(i = 0; i < maxVerts; i++, dvert++) { - if(dm) dvert = dm->getVertData(dm, i, CD_MDEFORMVERT); - - fac= defvert_find_weight(dvert, defgrp_index); - - if(fac > 0.0f) { - float *co = vertexCos[i]; - - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - + if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + fac *= defvert_find_weight(dvert, defgrp_index); + if(fac) { mul_v3_m4v3(vec, mat, co); interp_v3_v3v3(co, co, vec, fac); } -- cgit v1.2.3 From 9f81104b29c774f66cba9cfd09cf4ba24be1519f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 08:41:58 +0000 Subject: patch [#24251] Add missing tooltips for image operatios from Sergej Reich (sergof), with minor edits. --- release/scripts/op/image.py | 6 +++--- release/scripts/op/uv.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index 011b42b32e5..ddd04c4e7c3 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -88,7 +88,7 @@ class EditExternally(bpy.types.Operator): class SaveDirty(bpy.types.Operator): - '''Select object matching a naming pattern''' + """Save all modified textures""" bl_idname = "image.save_dirty" bl_label = "Save Dirty" bl_options = {'REGISTER', 'UNDO'} @@ -109,7 +109,7 @@ class SaveDirty(bpy.types.Operator): class ProjectEdit(bpy.types.Operator): - '''Select object matching a naming pattern''' + """Edit a snapshot if the viewport in an external image editor""" bl_idname = "image.project_edit" bl_label = "Project Edit" bl_options = {'REGISTER'} @@ -174,7 +174,7 @@ class ProjectEdit(bpy.types.Operator): class ProjectApply(bpy.types.Operator): - '''Select object matching a naming pattern''' + """Project edited image back onto the object""" bl_idname = "image.project_apply" bl_label = "Project Apply" bl_options = {'REGISTER'} diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index d01ef070d87..8fea37ef420 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -235,7 +235,7 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter): class ExportUVLayout(bpy.types.Operator): - '''Export the Mesh as SVG''' + """Export UV layout to file""" bl_idname = "uv.export_layout" bl_label = "Export UV Layout" @@ -251,7 +251,7 @@ class ExportUVLayout(bpy.types.Operator): name="Format", description="File format to export the UV layout to", default='PNG') - size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768) + size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768, description="Dimensions of the exported file") @classmethod def poll(cls, context): -- cgit v1.2.3 From f756a047e6ec13762f7f90dd03b72794e986459c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 09:07:19 +0000 Subject: bugfix [#24264] toggle UV selection fails. was using the 4th selection flag on tri's. also some minor changes, removed unused args and corrected some comments. --- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- source/blender/editors/include/ED_uvedit.h | 1 - source/blender/editors/mesh/editmesh_add.c | 15 ++--- source/blender/editors/space_node/node_header.c | 2 +- source/blender/editors/space_node/node_intern.h | 2 +- source/blender/editors/space_node/space_node.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 83 +++++++++++-------------- 7 files changed, 48 insertions(+), 59 deletions(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index eb5d77bb9b0..496bcc0f88c 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2237,7 +2237,7 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask) Object *obact = scene->basact?scene->basact->object:NULL; int editing = paint_facesel_test(ob); /* weight paint and face select need original indicies because of selection buffer drawing */ - int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT)) || editing); + int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT))); clear_mesh_caches(ob); diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 1710a8439d1..737d124b494 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -41,7 +41,6 @@ void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); -void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile); int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max); int ED_uvedit_test_silent(struct Object *obedit); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 30070581a1c..e1a4b2b2fd4 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -151,7 +151,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) project_float_noclip(vc.ar, co1, co1); project_float_noclip(vc.ar, co2, co2); - /* 2D rotate by 90d while subtracting + /* 2D rotate by 90d while adding. * (x, y) = (y, -x) * * accumulate the screenspace normal in 2D, @@ -181,14 +181,11 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) cross_v3_v3v3(cross, nor, view_vec); cross_v3_v3v3(nor, view_vec, cross); normalize_v3(nor); - - /* correct for flipping */ } /* center */ - add_v3_v3v3(cent, min, max); - mul_v3_fl(cent, 0.5f); - VECCOPY(min, cent); + mid_v3_v3v3(cent, min, max); + copy_v3_v3(min, cent); mul_m4_v3(vc.obedit->obmat, min); // view space view3d_get_view_aligned_coordinate(&vc, min, event->mval); @@ -201,7 +198,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) if(done) { float dot; - VECCOPY(vec, min); + copy_v3_v3(vec, min); normalize_v3(vec); dot= INPR(vec, nor); @@ -241,7 +238,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) float mat[3][3],imat[3][3]; float *curs= give_cursor(vc.scene, vc.v3d); - VECCOPY(min, curs); + copy_v3_v3(min, curs); view3d_get_view_aligned_coordinate(&vc, min, event->mval); eve= addvertlist(vc.em, 0, NULL); @@ -249,7 +246,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) copy_m3_m4(mat, vc.obedit->obmat); invert_m3_m3(imat, mat); - VECCOPY(eve->co, min); + copy_v3_v3(eve->co, min); mul_m3_v3(imat, eve->co); sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 0711ef66497..f22ff1515c5 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -202,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu) } } -void node_menus_register(ARegionType *art) +void node_menus_register(void) { MenuType *mt; diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 77fda0627e7..cba491deb01 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -41,7 +41,7 @@ ARegion *node_has_buttons_region(ScrArea *sa); /* node_header.c */ void node_header_buttons(const bContext *C, ARegion *ar); -void node_menus_register(struct ARegionType *art); +void node_menus_register(void); /* node_draw.c */ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index c94fcb52e38..2d7cde37ec4 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -452,7 +452,7 @@ void ED_spacetype_node(void) BLI_addhead(&st->regiontypes, art); - node_menus_register(art); + node_menus_register(); /* regions: listview/buttons */ art= MEM_callocN(sizeof(ARegionType), "spacetype node region"); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c300b668675..d311733e945 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -141,7 +141,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre /* dotile - 1, set the tile flag (from the space image) * 2, set the tile index for the faces. */ -void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, int curtile) +static int uvedit_set_tile(Object *obedit, Image *ima, int curtile) { EditMesh *em; EditFace *efa; @@ -149,11 +149,14 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i /* verify if we have something to do */ if(!ima || !ED_uvedit_test(obedit)) - return; - + return 0; + + if((ima->tpageflag & IMA_TILES) == 0) + return 0; + /* skip assigning these procedural images... */ if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE) - return; + return 0; em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -165,8 +168,9 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i } DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); BKE_mesh_end_editmesh(obedit->data, em); + + return 1; } /*********************** space conversion *********************/ @@ -845,7 +849,8 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2] tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(tf->flag & select_flag) { stack[stacksize]= a; stacksize++; flag[a]= 1; @@ -909,12 +914,9 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2] else { for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) { if(flag[a]) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - if(efa->v4) { - if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))) - break; - } - else if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) + if((tf->flag & select_flag)) break; } } @@ -1355,10 +1357,11 @@ static int select_all_exec(bContext *C, wmOperator *op) if (action == SEL_TOGGLE) { action = SEL_SELECT; for(efa= em->faces.first; efa; efa= efa->next) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) { + if(tf->flag & select_flag) { action = SEL_DESELECT; break; } @@ -1370,12 +1373,7 @@ static int select_all_exec(bContext *C, wmOperator *op) tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - char select_flag; - - if(efa->v4) - select_flag = (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4); - else - select_flag = (TF_SEL1+TF_SEL2+TF_SEL3); + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); switch (action) { case SEL_SELECT: @@ -1937,14 +1935,10 @@ static int unlink_selection_exec(bContext *C, wmOperator *op) tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(efa->v4) { - if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) - tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); - } - else { - if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) - tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3); - } + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(~tf->flag & select_flag) + tf->flag &= ~select_flag; + } } @@ -2260,7 +2254,7 @@ void UV_OT_select_border(wmOperatorType *ot) /* ******************** circle select operator **************** */ -static void select_uv_inside_ellipse(SpaceImage *sima, Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index) +static void select_uv_inside_ellipse(Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index) { /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */ float x, y, r2, *uv; @@ -2309,11 +2303,11 @@ int circle_select_exec(bContext *C, wmOperator *op) /* do selection */ for(efa= em->faces.first; efa; efa= efa->next) { tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 0, offset, ellipse, 0); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 1, offset, ellipse, 1); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 2, offset, ellipse, 2); + select_uv_inside_ellipse(scene, select, efa, tface, 0, offset, ellipse, 0); + select_uv_inside_ellipse(scene, select, efa, tface, 1, offset, ellipse, 1); + select_uv_inside_ellipse(scene, select, efa, tface, 2, offset, ellipse, 2); if(efa->v4) - select_uv_inside_ellipse(sima, scene, select, efa, tface, 3, offset, ellipse, 3); + select_uv_inside_ellipse(scene, select, efa, tface, 3, offset, ellipse, 3); } if(select) EM_select_flush(em); @@ -2800,11 +2794,9 @@ static int hide_exec(bContext *C, wmOperator *op) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } else if(em->selectmode == SCE_SELECT_FACE) { - if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) { - if(!efa->v4) - EM_select_face(efa, 0); - else if(!(tf->flag & TF_SEL4)) - EM_select_face(efa, 0); + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if((tf->flag & select_flag)==0) { + EM_select_face(efa, 0); tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } } @@ -2845,9 +2837,8 @@ static int hide_exec(bContext *C, wmOperator *op) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } else if(em->selectmode == SCE_SELECT_FACE) { - if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) - EM_select_face(efa, 0); - else if(efa->v4 && tf->flag & TF_SEL4) + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(tf->flag & select_flag) EM_select_face(efa, 0); tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); @@ -3086,16 +3077,18 @@ static int set_tile_exec(bContext *C, wmOperator *op) { Image *ima= CTX_data_edit_image(C); int tile[2]; - - if(!ima || !(ima->tpageflag & IMA_TILES)) - return OPERATOR_CANCELLED; + Object *obedit= CTX_data_edit_object(C); RNA_int_get_array(op->ptr, "tile", tile); - ED_uvedit_set_tile(C, CTX_data_scene(C), CTX_data_edit_object(C), ima, tile[0] + ima->xrep*tile[1]); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL); + if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) { + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; + } + + return OPERATOR_CANCELLED; } static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event) -- cgit v1.2.3 From 572faf9e7a589e1712fa0a95223d5c8a180a5a2c Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 15 Oct 2010 09:23:18 +0000 Subject: Partial fix for [#22867] retopo bug * More logical to restrict snapping to all visible objects instead of just selectable objects * Rest of bug added to todo-list --- source/blender/editors/transform/transform_snap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 09c04168a71..a5950a72fe8 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1587,7 +1587,7 @@ int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mv base= FIRSTBASE; for ( base = FIRSTBASE; base != NULL; base = base->next ) { - if ( BASE_SELECTABLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) { + if ( BASE_VISIBLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) { Object *ob = base->object; if (ob->transflag & OB_DUPLI) -- cgit v1.2.3 From 9ecf7c15a5c705b2ab336a7ea7e39f4b25006e8b Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 15 Oct 2010 09:30:33 +0000 Subject: Fix for r32487: the logic was suboptimal, improved to always work correctly. --- source/blender/windowmanager/intern/wm_window.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 3600267dabc..f791cb1667a 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -68,7 +68,7 @@ GHOST_SystemHandle g_system= NULL; /* set by commandline */ static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal; -static int prefsizeused = 0; +static unsigned short useprefsize= 0; /* ******** win open & close ************ */ @@ -373,13 +373,13 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) for(win= wm->windows.first; win; win= win->next) { if(win->ghostwin==NULL) { - if(win->sizex==0 || prefsizeused==0) { + if(win->sizex==0 || useprefsize) { win->posx= prefstax; win->posy= prefstay; win->sizex= prefsizx; win->sizey= prefsizy; win->windowstate= initialstate; - prefsizeused= 1; + useprefsize= 0; } wm_window_add_ghostwindow(C, wm, "Blender", win); } @@ -1111,6 +1111,7 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy) prefstay= stay; prefsizx= sizx; prefsizy= sizy; + useprefsize= 1; } /* for borderless and border windows set from command-line */ -- cgit v1.2.3 From a431b40de28c0bf79686fd14ea13bc72af01cf94 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 15 Oct 2010 09:32:40 +0000 Subject: Add comment about when prefsizx et al are used. --- source/blender/windowmanager/intern/wm_window.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index f791cb1667a..12fa9a8bd7b 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -353,7 +353,10 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) wmKeyMap *keymap; wmWindow *win; - /* no commandline prefsize? then we set this */ + /* no commandline prefsize? then we set this. + * Note that these values will be used only + * when there is no startup.blend yet. + */ if (!prefsizx) { wm_get_screensize(&prefsizx, &prefsizy); -- cgit v1.2.3 From 44afd8ae5af40dfbff51503894e9c5754ce5657a Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 15 Oct 2010 10:25:43 +0000 Subject: Fix for [#23314] Comp node renaming breaks animation * Old name was already overwritten before the update function, so changed the update function to a "set" function. --- source/blender/makesrna/intern/rna_nodetree.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index ef56ad6a0c2..52a19c6376f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -180,7 +180,7 @@ static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr) node_update(bmain, scene, ntree, node); } -static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Node_name_set(PointerRNA *ptr, const char *value) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; bNode *node= (bNode*)ptr->data; @@ -188,14 +188,14 @@ static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr) /* make a copy of the old name first */ BLI_strncpy(oldname, node->name, sizeof(node->name)); + /* set new name */ + BLI_strncpy(node->name, value, sizeof(node->name)); nodeUniqueName(ntree, node); node->flag |= NODE_CUSTOM_NAME; /* fix all the animation data which may link to this */ BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name); - - node_update(bmain, scene, ntree, node); } /* this should be done at display time! if no custom names are set */ @@ -2263,7 +2263,8 @@ static void rna_def_node(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Node name"); RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update_name"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); -- cgit v1.2.3 From 2755129fb67b137e7a145bb5c6d94c2a4f462a56 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 11:43:34 +0000 Subject: nodes were being ignored by api update script. --- release/scripts/modules/animsys_refactor.py | 64 ++++++++++++++++------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py index 8cc91873b0e..bd16a02268a 100644 --- a/release/scripts/modules/animsys_refactor.py +++ b/release/scripts/modules/animsys_refactor.py @@ -111,6 +111,7 @@ def classes_recursive(base_type, clss=None): def find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map): + # note!, id_data can be ID type or a node tree # ignore ID props for now if data_path.startswith("["): return data_path @@ -156,36 +157,43 @@ def update_data_paths(rna_update): rna_update_from_map.setdefault(ren_from, []).append(ren_to) for id_data in id_iter(): - anim_data = getattr(id_data, "animation_data", None) - if anim_data is None: - continue - - for fcurve in anim_data.drivers: - for var in fcurve.driver.variables: - if var.type == 'SINGLE_PROP': - for tar in var.targets: - id_data_other = tar.id - data_path = tar.data_path - - if id_data_other and data_path: - data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map) - # print(data_path_new) - if data_path_new != data_path: - if not IS_TESTING: - tar.data_path = data_path_new - print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new)) + + # check node-trees too + anim_data_ls = [(id_data, getattr(id_data, "animation_data", None))] + node_tree = getattr(id_data, "node_tree", None) + if node_tree: + anim_data_ls.append((node_tree, node_tree.animation_data)) + + for anim_data_base, anim_data in anim_data_ls: + if anim_data is None: + continue + + for fcurve in anim_data.drivers: + for var in fcurve.driver.variables: + if var.type == 'SINGLE_PROP': + for tar in var.targets: + id_data_other = tar.id + data_path = tar.data_path + + if id_data_other and data_path: + data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map) + # print(data_path_new) + if data_path_new != data_path: + if not IS_TESTING: + tar.data_path = data_path_new + print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new)) + - - for action in anim_data_actions(anim_data): - for fcu in action.fcurves: - data_path = fcu.data_path - data_path_new = find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map) - # print(data_path_new) - if data_path_new != data_path: - if not IS_TESTING: - fcu.data_path = data_path_new - print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new)) + for action in anim_data_actions(anim_data): + for fcu in action.fcurves: + data_path = fcu.data_path + data_path_new = find_path_new(anim_data_base, data_path, rna_update_dict, rna_update_from_map) + # print(data_path_new) + if data_path_new != data_path: + if not IS_TESTING: + fcu.data_path = data_path_new + print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new)) if __name__ == "__main__": -- cgit v1.2.3 From db09ca106dfddd64e62ca7da4c85e720007aba4b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Oct 2010 12:29:02 +0000 Subject: remove/tag unused args for view*.c, gpu*.c & image*.c --- source/blender/blenkernel/BKE_image.h | 2 +- source/blender/blenkernel/intern/image.c | 7 +-- source/blender/editors/interface/view2d_ops.c | 60 +++++++++++----------- source/blender/editors/mesh/mesh_data.c | 3 +- source/blender/editors/space_image/image_buttons.c | 2 +- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/editors/space_image/image_render.c | 2 +- source/blender/editors/space_node/node_edit.c | 2 +- source/blender/editors/space_view3d/space_view3d.c | 10 ++-- .../blender/editors/space_view3d/view3d_buttons.c | 28 +++++----- source/blender/editors/space_view3d/view3d_draw.c | 8 +-- source/blender/editors/space_view3d/view3d_edit.c | 14 ++--- .../blender/editors/space_view3d/view3d_intern.h | 2 +- .../blender/editors/space_view3d/view3d_select.c | 24 ++++----- source/blender/editors/space_view3d/view3d_snap.c | 13 ++--- .../blender/editors/space_view3d/view3d_toolbar.c | 4 +- source/blender/editors/space_view3d/view3d_view.c | 6 +-- source/blender/gpu/GPU_draw.h | 2 +- source/blender/gpu/intern/gpu_buffers.c | 14 ++--- source/blender/gpu/intern/gpu_codegen.c | 6 +-- source/blender/gpu/intern/gpu_draw.c | 4 +- source/blender/gpu/intern/gpu_extensions.c | 10 ++-- source/blender/makesrna/intern/rna_main_api.c | 2 +- source/blender/nodes/intern/TEX_util.c | 2 +- source/blender/render/intern/source/imagetexture.c | 28 +++++----- source/blender/render/intern/source/pipeline.c | 2 +- 26 files changed, 128 insertions(+), 131 deletions(-) diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 0a07e6d482c..b0cb3f32d37 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -112,7 +112,7 @@ struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void BKE_image_release_ibuf(struct Image *ima, void *lock); /* returns existing Image when filename/type is same (frame optional) */ -struct Image *BKE_add_image_file(const char *name, int frame); +struct Image *BKE_add_image_file(const char *name); /* adds image, adds ibuf, generates color or pattern */ struct Image *BKE_add_image_size(unsigned int width, unsigned int height, char *name, int depth, int floatbuf, short uvtestgrid, float color[4]); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index e356e40c6fd..fec713805e3 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -330,7 +330,7 @@ void BKE_image_merge(Image *dest, Image *source) /* otherwise creates new. */ /* does not load ibuf itself */ /* pass on optional frame for #name images */ -Image *BKE_add_image_file(const char *name, int frame) +Image *BKE_add_image_file(const char *name) { Image *ima; int file, len; @@ -397,7 +397,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, char *name, rect= (unsigned char*)ibuf->rect; } - strcpy(ibuf->name, "//Untitled"); + BLI_strncpy(ibuf->name, name, sizeof(ibuf->name)); ibuf->userflags |= IB_BITMAPDIRTY; switch(uvtestgrid) { @@ -1202,7 +1202,8 @@ void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf) int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimtype, int quality) { int ok; - + (void)subimtype; /* quies unused warnings */ + if(imtype==0) { /* pass */ } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index c155aff8d70..48523ec1a5a 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -119,7 +119,7 @@ static int view_pan_init(bContext *C, wmOperator *op) } /* apply transform to view (i.e. adjust 'cur' rect) */ -static void view_pan_apply(bContext *C, wmOperator *op) +static void view_pan_apply(wmOperator *op) { v2dViewPanData *vpd= op->customdata; View2D *v2d= vpd->v2d; @@ -156,7 +156,7 @@ static void view_pan_apply(bContext *C, wmOperator *op) } /* cleanup temp customdata */ -static void view_pan_exit(bContext *C, wmOperator *op) +static void view_pan_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -172,8 +172,8 @@ static int view_pan_exec(bContext *C, wmOperator *op) if (!view_pan_init(C, op)) return OPERATOR_CANCELLED; - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -199,8 +199,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", event->prevx - event->x); RNA_int_set(op->ptr, "deltay", event->prevy - event->y); - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -236,7 +236,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) vpd->lastx= event->x; vpd->lasty= event->y; - view_pan_apply(C, op); + view_pan_apply(op); } break; @@ -247,7 +247,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - view_pan_exit(C, op); + view_pan_exit(op); WM_cursor_restore(CTX_wm_window(C)); WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); @@ -260,7 +260,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - view_pan_exit(C, op); + view_pan_exit(op); WM_cursor_restore(CTX_wm_window(C)); return OPERATOR_FINISHED; @@ -271,9 +271,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_pan_cancel(bContext *C, wmOperator *op) +static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_CANCELLED; } @@ -312,7 +312,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) /* also, check if can pan in horizontal axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_X) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -321,8 +321,8 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 0); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -356,7 +356,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) /* also, check if can pan in horizontal axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_X) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -365,8 +365,8 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 0); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -399,7 +399,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) /* also, check if can pan in vertical axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -408,8 +408,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", -40); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -443,7 +443,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) /* also, check if can pan in vertical axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -452,8 +452,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 40); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -632,7 +632,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) /* --------------- Individual Operators ------------------- */ /* cleanup temp customdata */ -static void view_zoomstep_exit(bContext *C, wmOperator *op) +static void view_zoomstep_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -654,7 +654,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(C, op); + view_zoomstep_exit(op); return OPERATOR_FINISHED; } @@ -711,7 +711,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(C, op); + view_zoomstep_exit(op); return OPERATOR_FINISHED; } @@ -823,7 +823,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) } /* cleanup temp customdata */ -static void view_zoomdrag_exit(bContext *C, wmOperator *op) +static void view_zoomdrag_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -838,7 +838,7 @@ static int view_zoomdrag_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; view_zoomdrag_apply(C, op); - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); return OPERATOR_FINISHED; } @@ -873,7 +873,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltay", dy); view_zoomdrag_apply(C, op); - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); return OPERATOR_FINISHED; } @@ -985,7 +985,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltay", 0); /* free customdata */ - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); WM_cursor_restore(CTX_wm_window(C)); return OPERATOR_FINISHED; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index f45786d3abe..272201df50d 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -334,8 +334,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima= BKE_add_image_file(path, - scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); } else { RNA_string_get(op->ptr, "name", name); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 353d741fe27..bbc8925a152 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -494,7 +494,7 @@ static char *slot_menu() } /* TODO, curlay should be removed? */ -static char *layer_menu(RenderResult *rr, short *curlay) +static char *layer_menu(RenderResult *rr, short *UNUSED(curlay)) { RenderLayer *rl; int len= 64 + 32*BLI_countlist(&rr->layers); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 3e33fef6904..a44258351ce 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -701,7 +701,7 @@ static int open_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(str, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(str); if(!ima) { if(op->customdata) MEM_freeN(op->customdata); diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c index be9d60a5adb..5fa0a2de202 100644 --- a/source/blender/editors/space_image/image_render.c +++ b/source/blender/editors/space_image/image_render.c @@ -149,7 +149,7 @@ void imagewindow_toggle_render(bContext *C) } /* NOTE: called while render, so no malloc allowed! */ -static void imagewindow_renderinfo_cb(void *handle, RenderStats *rs) +static void imagewindow_renderinfo_cb(void *UNUSED(handle), RenderStats *UNUSED(rs)) { if(image_area) { // XXX BIF_make_render_text(rs); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 71f48f0de5d..b8bfed2b75e 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2264,7 +2264,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); if(!ima) { BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", path, errno ? strerror(errno) : "Unsupported image format"); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 629e0efe2ce..6261ca52564 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -274,7 +274,7 @@ static void view3d_free(SpaceLink *sl) /* spacetype; init callback */ -static void view3d_init(struct wmWindowManager *wm, ScrArea *sa) +static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -387,7 +387,7 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar) } -static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -397,7 +397,7 @@ static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -407,7 +407,7 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -726,7 +726,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) } /* concept is to retrieve cursor type context-less */ -static void view3d_main_area_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) +static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) { Scene *scene= win->screen->scene; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 1bff01a02e4..141a8800365 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -128,7 +128,7 @@ typedef struct { /* is used for both read and write... */ -static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) { uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL; MDeformVert *dvert=NULL; @@ -643,7 +643,7 @@ static void vgroup_normalize_active(Object *ob) } -static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event) +static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -670,7 +670,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event) WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data); } -int view3d_panel_vgroup_poll(const bContext *C, PanelType *pt) +int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -794,7 +794,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) } } -static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_posearmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); // bArmature *arm; @@ -896,7 +896,7 @@ void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev) WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix } -static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_editarmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); bArmature *arm= ob->data; @@ -930,7 +930,7 @@ static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, flo uiItemR(col, &eboneptr, "roll", 0, "Roll", 0); } -static void v3d_editmetaball_buts(uiLayout *layout, Object *ob, float lim) +static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) { PointerRNA mbptr, ptr; MetaBall *mball= ob->data; @@ -989,7 +989,7 @@ static int test_parent_loop(Object *par, Object *ob) return test_parent_loop(par->parent, ob); } -static void do_view3d_region_buttons(bContext *C, void *arg, int event) +static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1012,7 +1012,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) case B_OBJECTPANELMEDIAN: if(ob) { - v3d_editvertex_buts(C, NULL, v3d, ob, 1.0); + v3d_editvertex_buts(NULL, v3d, ob, 1.0); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } break; @@ -1152,12 +1152,12 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob); } -void removeTransformOrientation_func(bContext *C, void *target, void *unused) +void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_removeTransformOrientation(C, (TransformOrientation *) target); } -void selectTransformOrientation_func(bContext *C, void *target, void *unused) +void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_selectTransformOrientation(C, (TransformOrientation *) target); } @@ -1203,12 +1203,12 @@ static void view3d_panel_object(const bContext *C, Panel *pa) RNA_id_pointer_create(&ob->id, &obptr); if(ob==obedit) { - if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, v3d, ob, lim); - if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob, lim); - else v3d_editvertex_buts(C, col, v3d, ob, lim); + if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob); + if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob); + else v3d_editvertex_buts(col, v3d, ob, lim); } else if(ob->mode & OB_MODE_POSE) { - v3d_posearmature_buts(col, v3d, ob, lim); + v3d_posearmature_buts(col, ob); } else { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 24f71b8b1df..6e634252631 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1589,7 +1589,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas } -void view3d_update_depths(ARegion *ar, View3D *v3d) +void view3d_update_depths(ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -2354,7 +2354,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // retopo= retopo_mesh_check() || retopo_curve_check(); sculptparticle= (obact && obact->mode & (OB_MODE_PARTICLE_EDIT)) && !scene->obedit; if(retopo) - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); /* draw selected and editmode */ for(base= scene->base.first; base; base= base->next) { @@ -2365,7 +2365,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } if(!retopo && sculptparticle && !(obact && (obact->dtx & OB_DRAWXRAY))) { - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); } // REEB_draw(); @@ -2378,7 +2378,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) { - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); } if(rv3d->rflag & RV3D_CLIPPING) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index e60dde7c88b..41899a70b34 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1548,7 +1548,7 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot) ot->flag= 0; } -static int view3d_center_camera_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */ +static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ { RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1691,7 +1691,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); /* Constrain rect to depth bounds */ if (rect.xmin < 0) rect.xmin = 0; @@ -2220,7 +2220,7 @@ static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *UNU char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); } else if(RNA_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); @@ -2644,7 +2644,7 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mou rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); depth_close= view_autodist_depth_margin(ar, mval, 4); @@ -2688,7 +2688,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); return 1; } @@ -2785,7 +2785,7 @@ void filterNDOFvalues(float *sbval) int dz_flag = 0; float m_dist; -void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode) +void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int UNUSED(mode)) { RegionView3D *rv3d= ar->regiondata; int i; @@ -2914,7 +2914,7 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode) // XXX BIF_view3d_previewrender_signal(ar, PR_DBASE|PR_DISPRECT); } -void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode)) { RegionView3D *rv3d= ar->regiondata; float fval[7]; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 49ef803b1af..9d1f5a77a3f 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -130,7 +130,7 @@ void add_view3d_after(ListBase *lb, Base *base, int flag); void circf(float x, float y, float rad); void circ(float x, float y, float rad); -void view3d_update_depths(struct ARegion *ar, View3D *v3d); +void view3d_update_depths(struct ARegion *ar); /* view3d_select.c */ void VIEW3D_OT_select(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 7e6e8e0e6af..e3212e8a3d1 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -189,9 +189,9 @@ void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select) } } +#if 0 void arrows_move_cursor(unsigned short event) { -#if 0 short mval[2]; getmouseco_sc(mval); @@ -205,8 +205,8 @@ void arrows_move_cursor(unsigned short event) } else if(event==RIGHTARROWKEY) { warp_pointer(mval[0]+1, mval[1]); } -#endif } +#endif /* *********************** GESTURE AND LASSO ******************* */ @@ -404,7 +404,7 @@ void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) } } -static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; @@ -431,7 +431,7 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, in } } } -static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; @@ -560,7 +560,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select } #endif -static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } *data = userData; Object *obedit= data->vc->obedit; @@ -1291,7 +1291,7 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, return 0; } -static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct { ViewContext *vc; rcti *rect; int select; } *data = userData; Object *obedit= data->vc->obedit; @@ -1359,7 +1359,7 @@ static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int e lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data); } -static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData; @@ -1384,7 +1384,7 @@ static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int } } } -static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData; @@ -1800,7 +1800,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) /* -------------------- circle select --------------------------------------------- */ -static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; @@ -1810,7 +1810,7 @@ static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y eve->f = data->select?(eve->f|1):(eve->f&~1); } } -static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) +static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; @@ -1818,7 +1818,7 @@ static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int EM_select_edge(eed, data->select); } } -static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; @@ -1892,7 +1892,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int selecting, short *m } -static void nurbscurve_circle_doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 4ef1d4daf92..d6778070931 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -82,7 +82,7 @@ static TransVert *transvmain=NULL; static int tottrans= 0; /* copied from editobject.c, now uses (almost) proper depgraph */ -static void special_transvert_update(Scene *scene, Object *obedit) +static void special_transvert_update(Object *obedit) { if(obedit) { @@ -481,7 +481,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) VECCOPY(tv->loc, vec); } - special_transvert_update(scene, obedit); + special_transvert_update(obedit); MEM_freeN(transvmain); transvmain= NULL; @@ -602,15 +602,12 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) tv= transvmain; for(a=0; aobmat[3][0]; - vec[1]= curs[1]-obedit->obmat[3][1]; - vec[2]= curs[2]-obedit->obmat[3][2]; - + sub_v3_v3v3(vec, curs, obedit->obmat[3]); mul_m3_v3(imat, vec); - VECCOPY(tv->loc, vec); + copy_v3_v3(tv->loc, vec); } - special_transvert_update(scene, obedit); + special_transvert_update(obedit); MEM_freeN(transvmain); transvmain= NULL; diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 10496bc078d..0691895948a 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -65,7 +65,7 @@ /* op->invoke */ -static void redo_cb(bContext *C, void *arg_op, void *arg2) +static void redo_cb(bContext *C, void *arg_op, void *UNUSED(arg2)) { wmOperator *lastop= arg_op; @@ -177,7 +177,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) } -static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 4bc921b6030..312ae1df590 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -380,7 +380,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot) /* ****************** change view operators ****************** */ -static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob) +static void setcameratoview3d(RegionView3D *rv3d, Object *ob) { float dvec[3]; float mat3[3][3]; @@ -408,7 +408,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) rv3d->lview= rv3d->view; rv3d->lpersp= rv3d->persp; - setcameratoview3d(v3d, rv3d, v3d->camera); + setcameratoview3d(rv3d, v3d->camera); rv3d->persp = RV3D_CAMOB; WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, v3d->camera); @@ -1986,7 +1986,7 @@ typedef struct FlyInfo { } FlyInfo; -static void drawFlyPixel(const struct bContext *C, struct ARegion *ar, void *arg) +static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *arg) { FlyInfo *fly = arg; diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 92bf43e9a5a..1f1bbab9abf 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -114,7 +114,7 @@ void GPU_paint_set_mipmap(int mipmap); void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap); void GPU_update_images_framechange(void); int GPU_update_image_time(struct Image *ima, double time); -int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap); +int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap); void GPU_free_image(struct Image *ima); void GPU_free_images(void); void GPU_free_images_anim(void); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 5bddb42add2..90c33f68c65 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -592,8 +592,8 @@ void GPU_update_grid_buffers(void *buffers_v, DMGridData **grids, //printf("node updated %p\n", buffers_v); } -void *GPU_build_grid_buffers(DMGridData **grids, - int *grid_indices, int totgrid, int gridsize) +void *GPU_build_grid_buffers(DMGridData **UNUSED(grids), int *UNUSED(grid_indices), + int totgrid, int gridsize) { GPU_Buffers *buffers; int i, j, k, totquad, offset= 0; @@ -852,7 +852,7 @@ GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, G return buffer; } -void GPU_buffer_copy_vertex( DerivedMesh *dm, float *varray, int *index, int *redir, void *user ) +void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int start; int i, j, numfaces; @@ -901,7 +901,7 @@ GPUBuffer *GPU_buffer_vertex( DerivedMesh *dm ) return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*3*(dm->drawObject->nelements+dm->drawObject->nlooseverts), GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_vertex); } -void GPU_buffer_copy_normal( DerivedMesh *dm, float *varray, int *index, int *redir, void *user ) +void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int i, numfaces; int start; @@ -965,7 +965,7 @@ GPUBuffer *GPU_buffer_normal( DerivedMesh *dm ) return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*3*dm->drawObject->nelements, GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_normal); } -void GPU_buffer_copy_uv( DerivedMesh *dm, float *varray, int *index, int *redir, void *user ) +void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int start; int i, numfaces; @@ -1107,7 +1107,7 @@ GPUBuffer *GPU_buffer_color( DerivedMesh *dm ) return result; } -void GPU_buffer_copy_edge( DerivedMesh *dm, float *varray, int *index, int *redir, void *user ) +void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) { int i; @@ -1135,7 +1135,7 @@ GPUBuffer *GPU_buffer_edge( DerivedMesh *dm ) return GPU_buffer_setup( dm, dm->drawObject, sizeof(int)*2*dm->drawObject->nedges, GL_ELEMENT_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_edge); } -void GPU_buffer_copy_uvedge( DerivedMesh *dm, float *varray, int *index, int *redir, void *user ) +void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) { MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); int i, j=0; diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index d596f573682..34cf62462a7 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -686,7 +686,7 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final BLI_dynstr_append(ds, ";\n"); } -static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const char *name) +static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const char *UNUSED(name)) { DynStr *ds = BLI_dynstr_new(); char *code; @@ -916,7 +916,7 @@ GPUNode *GPU_node_begin(char *name) return node; } -void GPU_node_end(GPUNode *node) +void GPU_node_end(GPUNode *UNUSED(node)) { /* empty */ } @@ -1036,7 +1036,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock) } } -void GPU_node_output(GPUNode *node, int type, char *name, GPUNodeLink **link) +void GPU_node_output(GPUNode *node, int type, char *UNUSED(name), GPUNodeLink **link) { GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput"); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 55522ea18b9..a93d8cbbb8e 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -394,7 +394,7 @@ static void gpu_verify_reflection(Image *ima) } } -int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap) +int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap) { ImBuf *ibuf = NULL; unsigned int *bind = NULL; @@ -593,7 +593,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap) gpu_verify_alpha_mode(tface); gpu_verify_reflection(ima); - if(GPU_verify_image(ima, NULL, tface->tile, tface->mode, 1, mipmap)) { + if(GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) { GTS.curtile= GTS.tile; GTS.curima= GTS.ima; GTS.curtilemode= GTS.tilemode; diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index fa8ff7a6354..c6b8a43918c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -484,7 +484,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time, glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode); GPU_update_image_time(ima, time); - bindcode = GPU_verify_image(ima, iuser, 0, 0, 0, mipmap); + bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap); if(ima->gputexture) { ima->gputexture->bindcode = bindcode; @@ -744,7 +744,7 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex) tex->fb = NULL; } -void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex) +void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex) { /* push attributes */ glPushAttrib(GL_ENABLE_BIT); @@ -766,7 +766,7 @@ void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex) glLoadIdentity(); } -void GPU_framebuffer_texture_unbind(GPUFrameBuffer *fb, GPUTexture *tex) +void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUSED(tex)) { /* restore matrix */ glMatrixMode(GL_PROJECTION); @@ -1063,7 +1063,7 @@ int GPU_shader_get_uniform(GPUShader *shader, char *name) return glGetUniformLocationARB(shader->object, name); } -void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, float *value) +void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value) { if(location == -1) return; @@ -1080,7 +1080,7 @@ void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int GPU_print_error("Post Uniform Vector"); } -void GPU_shader_uniform_texture(GPUShader *shader, int location, GPUTexture *tex) +void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUTexture *tex) { GLenum arbnumber; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index b244d8ee5d3..63268f69438 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -261,7 +261,7 @@ Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath) Image *ima; errno= 0; - ima= BKE_add_image_file(filepath, 0); + ima= BKE_add_image_file(filepath); if(!ima) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format"); diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c index dc31685827f..4f085c84eda 100644 --- a/source/blender/nodes/intern/TEX_util.c +++ b/source/blender/nodes/intern/TEX_util.c @@ -173,7 +173,7 @@ int ntreeTexExecTree( float *dxt, float *dyt, int osatex, short thread, - Tex *tex, + Tex *UNUSED(tex), short which_output, int cfra, int preview, diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 5321d71194f..9376c798c39 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -500,7 +500,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres) } } -static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int intpol) +static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend) { /* Sample box, performs clip. minx etc are in range 0.0 - 1.0 . * Enlarge with antialiased edges of pixels. @@ -1606,11 +1606,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f //minx*= 1.35f; //miny*= 1.35f; - boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend); val1= texres->tr+texres->tg+texres->tb; - boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend); val2= texr.tr + texr.tg + texr.tb; - boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend); val3= texr.tr + texr.tg + texr.tb; /* don't switch x or y! */ @@ -1619,7 +1619,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f if(previbuf!=curibuf) { /* interpolate */ - boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend); /* calc rgb */ dx= 2.0f*(pixsize-maxd)/pixsize; @@ -1636,9 +1636,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f } val1= dy*val1+ dx*(texr.tr + texr.tg + texr.tb); - boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend); val2= dy*val2+ dx*(texr.tr + texr.tg + texr.tb); - boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend); val3= dy*val3+ dx*(texr.tr + texr.tg + texr.tb); texres->nor[0]= (val1-val2); /* vals have been interpolated above! */ @@ -1661,10 +1661,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f maxy= fy+miny; miny= fy-miny; - boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0); + boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend); if(previbuf!=curibuf) { /* interpolate */ - boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend); fx= 2.0f*(pixsize-maxd)/pixsize; @@ -1690,11 +1690,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f } if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) { - boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend); val1= texres->tr+texres->tg+texres->tb; - boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend); val2= texr.tr + texr.tg + texr.tb; - boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend); val3= texr.tr + texr.tg + texr.tb; /* don't switch x or y! */ @@ -1702,7 +1702,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f texres->nor[1]= (val1-val3); } else - boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend); } if(tex->imaflag & TEX_CALCALPHA) { @@ -1749,7 +1749,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) ibuf->rect+= (ibuf->x*ibuf->y); - boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0); + boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1); result[0]= texres.tr; result[1]= texres.tg; result[2]= texres.tb; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 44c6a6f008f..9179019f824 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2041,7 +2041,7 @@ static void load_backbuffer(Render *re) BKE_image_signal(re->backbuf, NULL, IMA_SIGNAL_RELOAD); } - re->backbuf= BKE_add_image_file(name, re->r.cfra); + re->backbuf= BKE_add_image_file(name); ibuf= BKE_image_get_ibuf(re->backbuf, NULL); if(ibuf==NULL) { // error() doesnt work with render window open -- cgit v1.2.3 From f5f935e58885096b7cb56f95d0525ccb9d1c4021 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 15 Oct 2010 13:03:10 +0000 Subject: Less cryptic modifier key types --- source/blender/windowmanager/intern/wm_window.c | 47 ++++++++++++++++--------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 12fa9a8bd7b..c31f72d8af1 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -521,22 +521,37 @@ int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op) /* ************ events *************** */ -static int query_qual(char qual) +typedef enum +{ + SHIFT = 's', + CONTROL = 'c', + ALT = 'a', + OS = 'C' +} modifierKeyType; + +/* check if specified modifier key type is pressed */ +static int query_qual(modifierKeyType qual) { GHOST_TModifierKeyMask left, right; int val= 0; - if (qual=='s') { - left= GHOST_kModifierKeyLeftShift; - right= GHOST_kModifierKeyRightShift; - } else if (qual=='c') { - left= GHOST_kModifierKeyLeftControl; - right= GHOST_kModifierKeyRightControl; - } else if (qual=='C') { - left= right= GHOST_kModifierKeyOS; - } else { - left= GHOST_kModifierKeyLeftAlt; - right= GHOST_kModifierKeyRightAlt; + switch(qual) { + case SHIFT: + left= GHOST_kModifierKeyLeftShift; + right= GHOST_kModifierKeyRightShift; + break; + case CONTROL: + left= GHOST_kModifierKeyLeftControl; + right= GHOST_kModifierKeyRightControl; + break; + case OS: + left= right= GHOST_kModifierKeyOS; + break; + case ALT: + default: + left= GHOST_kModifierKeyLeftAlt; + right= GHOST_kModifierKeyRightAlt; + break; } GHOST_GetModifierKeyState(g_system, left, &val); @@ -605,19 +620,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) /* bad ghost support for modifier keys... so on activate we set the modifiers again */ kdata.ascii= 0; - if (win->eventstate->shift && !query_qual('s')) { + if (win->eventstate->shift && !query_qual(SHIFT)) { kdata.key= GHOST_kKeyLeftShift; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->ctrl && !query_qual('c')) { + if (win->eventstate->ctrl && !query_qual(CONTROL)) { kdata.key= GHOST_kKeyLeftControl; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->alt && !query_qual('a')) { + if (win->eventstate->alt && !query_qual(ALT)) { kdata.key= GHOST_kKeyLeftAlt; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->oskey && !query_qual('C')) { + if (win->eventstate->oskey && !query_qual(OS)) { kdata.key= GHOST_kKeyOS; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } -- cgit v1.2.3 From 99bd5f2f3b987ca8f2353468d117624dc76e4b27 Mon Sep 17 00:00:00 2001 From: Luca Bonavita Date: Fri, 15 Oct 2010 13:09:38 +0000 Subject: == rna info == changing from __repr__ to __str__ after discussing with campbell was annyoing me when testing things, huge printouts :) --- release/scripts/modules/rna_info.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 4282889c51a..e0298d30aa2 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -152,7 +152,7 @@ class InfoStructRNA: functions.append((identifier, attr)) return functions - def __repr__(self): + def __str__(self): txt = "" txt += self.identifier @@ -285,7 +285,7 @@ class InfoPropertyRNA: return type_str - def __repr__(self): + def __str__(self): txt = '' txt += ' * ' + self.identifier + ': ' + self.description @@ -319,7 +319,7 @@ class InfoFunctionRNA: self.return_values = tuple(self.return_values) - def __repr__(self): + def __str__(self): txt = '' txt += ' * ' + self.identifier + '(' -- cgit v1.2.3 From f631a8b5beb13f4d02c6eddc1bd6fdf15039b7ef Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 15 Oct 2010 14:52:47 +0000 Subject: Simplify GHOST modifier key handling on Windows. --- intern/ghost/intern/GHOST_SystemWin32.cpp | 220 +++++++++--------------------- intern/ghost/intern/GHOST_SystemWin32.h | 7 +- 2 files changed, 69 insertions(+), 158 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 62559953195..d63ac700831 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -136,9 +136,7 @@ GHOST_SystemWin32::GHOST_SystemWin32() -: m_hasPerformanceCounter(false), m_freq(0), m_start(0), - m_separateLeftRight(false), - m_separateLeftRightInitialized(false) +: m_hasPerformanceCounter(false), m_freq(0), m_start(0) { m_displayManager = new GHOST_DisplayManagerWin32 (); GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n"); @@ -287,43 +285,24 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const { - if (m_separateLeftRight && m_separateLeftRightInitialized) { - bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0; - keys.set(GHOST_kModifierKeyLeftShift, down); - down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0; - keys.set(GHOST_kModifierKeyRightShift, down); - down = HIBYTE(::GetKeyState(VK_LMENU)) != 0; - keys.set(GHOST_kModifierKeyLeftAlt, down); - down = HIBYTE(::GetKeyState(VK_RMENU)) != 0; - keys.set(GHOST_kModifierKeyRightAlt, down); - down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0; - keys.set(GHOST_kModifierKeyLeftControl, down); - down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0; - keys.set(GHOST_kModifierKeyRightControl, down); - bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; - bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; - if(lwindown || rwindown) - keys.set(GHOST_kModifierKeyOS, true); - else - keys.set(GHOST_kModifierKeyOS, false); - } - else { - bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0; - keys.set(GHOST_kModifierKeyLeftShift, down); - keys.set(GHOST_kModifierKeyRightShift, down); - down = HIBYTE(::GetKeyState(VK_MENU)) != 0; - keys.set(GHOST_kModifierKeyLeftAlt, down); - keys.set(GHOST_kModifierKeyRightAlt, down); - down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0; - keys.set(GHOST_kModifierKeyLeftControl, down); - keys.set(GHOST_kModifierKeyRightControl, down); - bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; - bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; - if(lwindown || rwindown) - keys.set(GHOST_kModifierKeyOS, true); - else - keys.set(GHOST_kModifierKeyOS, false); - } + bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0; + keys.set(GHOST_kModifierKeyLeftShift, down); + down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0; + keys.set(GHOST_kModifierKeyRightShift, down); + down = HIBYTE(::GetKeyState(VK_LMENU)) != 0; + keys.set(GHOST_kModifierKeyLeftAlt, down); + down = HIBYTE(::GetKeyState(VK_RMENU)) != 0; + keys.set(GHOST_kModifierKeyRightAlt, down); + down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0; + keys.set(GHOST_kModifierKeyLeftControl, down); + down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0; + keys.set(GHOST_kModifierKeyRightControl, down); + bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; + bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; + if(lwindown || rwindown) + keys.set(GHOST_kModifierKeyOS, true); + else + keys.set(GHOST_kModifierKeyOS, false); return GHOST_kSuccess; } @@ -405,6 +384,10 @@ GHOST_TSuccess GHOST_SystemWin32::exit() GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const { GHOST_TKey key; + GHOST_ModifierKeys oldModifiers, newModifiers; + ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers); + ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers); + bool isExtended = (lParam&(1<<24))?true:false; if ((wParam >= '0') && (wParam <= '9')) { @@ -469,15 +452,43 @@ GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const case VK_QUOTE: key = GHOST_kKeyQuote; break; case VK_GR_LESS: key = GHOST_kKeyGrLess; break; - // Process these keys separately because we need to distinguish right from left modifier keys case VK_SHIFT: + { + bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftShift) != newModifiers.get(GHOST_kModifierKeyLeftShift); + if(lchanged) { + key = GHOST_kKeyLeftShift; + } else { + key = GHOST_kKeyRightShift; + } + } + break; case VK_CONTROL: + { + bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftControl) != newModifiers.get(GHOST_kModifierKeyLeftControl); + if(lchanged) { + key = GHOST_kKeyLeftControl; + } else { + key = GHOST_kKeyRightControl; + } + } + break; case VK_MENU: - - // Ignore these keys - case VK_NUMLOCK: - case VK_SCROLL: - case VK_CAPITAL: + { + bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftAlt) != newModifiers.get(GHOST_kModifierKeyLeftAlt); + if(lchanged) { + key = GHOST_kKeyLeftAlt; + } else { + key = GHOST_kKeyRightAlt; + } + } + break; + case VK_LWIN: + case VK_RWIN: + key = GHOST_kKeyOS; + break; + case VK_NUMLOCK: key = GHOST_kKeyNumLock; break; + case VK_SCROLL: key = GHOST_kKeyScrollLock; break; + case VK_CAPITAL: key = GHOST_kKeyCapsLock; break; default: key = GHOST_kKeyUnknown; break; @@ -486,38 +497,6 @@ GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const return key; } - -void GHOST_SystemWin32::processModifierKeys(GHOST_IWindow *window) -{ - GHOST_ModifierKeys oldModifiers, newModifiers; - // Retrieve old state of the modifier keys - ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers); - // Retrieve current state of the modifier keys - ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers); - - // Compare the old and the new - if (!newModifiers.equals(oldModifiers)) { - // Create events for the masks that changed - for (int i = 0; i < GHOST_kModifierKeyNumMasks; i++) { - if (newModifiers.get((GHOST_TModifierKeyMask)i) != oldModifiers.get((GHOST_TModifierKeyMask)i)) { - // Convert the mask to a key code - GHOST_TKey key = GHOST_ModifierKeys::getModifierKeyCode((GHOST_TModifierKeyMask)i); - bool keyDown = newModifiers.get((GHOST_TModifierKeyMask)i); - GHOST_EventKey* event; - if (key != GHOST_kKeyUnknown) { - // Create an event - event = new GHOST_EventKey(getSystem()->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key); - pushEvent(event); - } - } - } - } - - // Store new modifier keys state - ((GHOST_SystemWin32*)getSystem())->storeModifierKeys(newModifiers); -} - - GHOST_EventButton* GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask) { return new GHOST_EventButton (getSystem()->getMilliSeconds(), type, window, mask); @@ -655,85 +634,22 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, // Keyboard events, processed //////////////////////////////////////////////////////////////////////// case WM_KEYDOWN: - /* The WM_KEYDOWN message is posted to the window with the keyboard focus when a - * nonsystem key is pressed. A nonsystem key is a key that is pressed when the alt - * key is not pressed. - */ case WM_SYSKEYDOWN: - /* The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when - * the user presses the F10 key (which activates the menu bar) or holds down the - * alt key and then presses another key. It also occurs when no window currently - * has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the - * active window. The window that receives the message can distinguish between these - * two contexts by checking the context code in the lKeyData parameter. - */ - switch (wParam) { - case VK_SHIFT: - case VK_CONTROL: - case VK_MENU: - case VK_LWIN: - case VK_RWIN: - if (!system->m_separateLeftRightInitialized) { - // Check whether this system supports separate left and right keys - switch (wParam) { - case VK_SHIFT: - system->m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LSHIFT)) != 0) || - (HIBYTE(::GetKeyState(VK_RSHIFT)) != 0) ? - true : false; - break; - case VK_CONTROL: - system->m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LCONTROL)) != 0) || - (HIBYTE(::GetKeyState(VK_RCONTROL)) != 0) ? - true : false; - break; - case VK_MENU: - system->m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LMENU)) != 0) || - (HIBYTE(::GetKeyState(VK_RMENU)) != 0) ? - true : false; - break; - case VK_LWIN: - case VK_RWIN: - system->m_separateLeftRight = true; - break; - } - system->m_separateLeftRightInitialized = true; - } - system->processModifierKeys(window); - // Bypass call to DefWindowProc - return 0; - default: - event = processKeyEvent(window, true, wParam, lParam); - if (!event) { - GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") - GHOST_PRINT(msg) - GHOST_PRINT(" key ignored\n") - } - break; - } + event = processKeyEvent(window, true, wParam, lParam); + if (!event) { + GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") + GHOST_PRINT(msg) + GHOST_PRINT(" key ignored\n") + } break; case WM_KEYUP: case WM_SYSKEYUP: - switch (wParam) { - case VK_SHIFT: - case VK_CONTROL: - case VK_MENU: - case VK_LWIN: - case VK_RWIN: - system->processModifierKeys(window); - // Bypass call to DefWindowProc - return 0; - default: - event = processKeyEvent(window, false, wParam, lParam); - if (!event) { - GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") - GHOST_PRINT(msg) - GHOST_PRINT(" key ignored\n") - } - break; + event = processKeyEvent(window, false, wParam, lParam); + if (!event) { + GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") + GHOST_PRINT(msg) + GHOST_PRINT(" key ignored\n") } break; diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 35b8debf6b4..03f5349a606 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -248,7 +248,7 @@ protected: * events generated for both keys. * @param window The window receiving the event (the active window). */ - void processModifierKeys(GHOST_IWindow *window); + GHOST_EventKey* processModifierKeys(GHOST_IWindow *window); /** * Creates mouse button event. @@ -324,11 +324,6 @@ protected: __int64 m_freq; /** High frequency timer variable. */ __int64 m_start; - /** Stores the capability of this system to distinguish left and right modifier keys. */ - bool m_separateLeftRight; - /** Stores the initialization state of the member m_leftRightDistinguishable. */ - bool m_separateLeftRightInitialized; - }; inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const -- cgit v1.2.3 From 17085e967ea38dd764a1b521b28f256941b1ce17 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 15 Oct 2010 14:56:31 +0000 Subject: Fix COLLADA import after recent API cleanups by Campbell. --- source/blender/collada/DocumentImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 25787e18b06..bc5653c8c45 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -807,7 +807,7 @@ public: BLI_split_dirfile(filename, dir, NULL); BLI_join_dirfile(full_path, dir, filepath.c_str()); - Image *ima = BKE_add_image_file(full_path, 0); + Image *ima = BKE_add_image_file(full_path); if (!ima) { fprintf(stderr, "Cannot create image. \n"); return true; -- cgit v1.2.3 From 1807beabf5372f297329b6be2ab3ba89f954d33a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 02:40:31 +0000 Subject: - UNUSED macro wasn't throwing an error with GCC if a var become used. - made interface, windowmanager, readfile build without unused warnings. - re-arranged CMake's source/blender build order so less changed libs are build later, eg: IK, avi --- source/blender/CMakeLists.txt | 18 +++--- source/blender/blenkernel/BKE_blender.h | 4 +- source/blender/blenkernel/BKE_utildefines.h | 4 +- source/blender/blenkernel/intern/blender.c | 8 +-- source/blender/blenlib/intern/pbvh.c | 2 +- source/blender/blenloader/BLO_writefile.h | 3 +- source/blender/blenloader/intern/readblenentry.c | 2 +- source/blender/blenloader/intern/readfile.c | 32 +++++----- source/blender/blenloader/intern/readfile.h | 2 +- source/blender/blenloader/intern/writefile.c | 2 +- source/blender/editors/animation/anim_filter.c | 4 +- source/blender/editors/armature/poseSlide.c | 38 +++++------ source/blender/editors/include/UI_interface.h | 12 ++-- source/blender/editors/interface/interface.c | 16 ++--- source/blender/editors/interface/interface_draw.c | 10 +-- source/blender/editors/interface/interface_icons.c | 18 +++--- .../blender/editors/interface/interface_intern.h | 2 +- .../blender/editors/interface/interface_layout.c | 4 +- source/blender/editors/interface/interface_panel.c | 10 +-- .../blender/editors/interface/interface_regions.c | 38 +++++------ .../editors/interface/interface_templates.c | 30 ++++----- source/blender/editors/interface/interface_utils.c | 2 +- .../blender/editors/interface/interface_widgets.c | 38 +++++------ source/blender/editors/mesh/meshtools.c | 4 +- source/blender/editors/render/render_shading.c | 2 +- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 8 +-- source/blender/editors/space_graph/graph_buttons.c | 49 +++++++------- source/blender/editors/space_info/space_info.c | 4 +- source/blender/editors/space_node/drawnode.c | 14 ++-- .../blender/editors/space_view3d/view3d_buttons.c | 2 +- .../blender/editors/space_view3d/view3d_toolbar.c | 2 +- source/blender/ikplugin/intern/iksolver_plugin.c | 2 +- source/blender/makesrna/intern/rna_ui_api.c | 5 -- source/blender/modifiers/intern/MOD_shapekey.c | 2 +- source/blender/python/generic/mathutils.c | 4 +- source/blender/python/generic/mathutils_color.c | 2 +- source/blender/windowmanager/WM_api.h | 2 +- source/blender/windowmanager/intern/wm.c | 2 +- .../blender/windowmanager/intern/wm_event_system.c | 4 +- source/blender/windowmanager/intern/wm_files.c | 8 +-- source/blender/windowmanager/intern/wm_gesture.c | 26 ++++---- source/blender/windowmanager/intern/wm_keymap.c | 4 +- source/blender/windowmanager/intern/wm_operators.c | 74 +++++++++++----------- source/blender/windowmanager/intern/wm_subwindow.c | 3 +- source/blender/windowmanager/intern/wm_window.c | 14 ++-- source/blender/windowmanager/wm.h | 2 +- source/blender/windowmanager/wm_window.h | 6 +- source/creator/creator.c | 2 +- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- 50 files changed, 271 insertions(+), 279 deletions(-) diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index dc0640c817f..83f76e38fd3 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -29,23 +29,23 @@ IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") ENDIF(CMAKE_COMPILER_IS_GNUCC) -ADD_SUBDIRECTORY(windowmanager) ADD_SUBDIRECTORY(editors) -ADD_SUBDIRECTORY(avi) -ADD_SUBDIRECTORY(nodes) +ADD_SUBDIRECTORY(windowmanager) ADD_SUBDIRECTORY(blenkernel) -ADD_SUBDIRECTORY(modifiers) ADD_SUBDIRECTORY(blenlib) +ADD_SUBDIRECTORY(render) +ADD_SUBDIRECTORY(blenfont) ADD_SUBDIRECTORY(blenloader) +ADD_SUBDIRECTORY(readblenfile) ADD_SUBDIRECTORY(blenpluginapi) -ADD_SUBDIRECTORY(imbuf) +ADD_SUBDIRECTORY(ikplugin) ADD_SUBDIRECTORY(gpu) +ADD_SUBDIRECTORY(imbuf) +ADD_SUBDIRECTORY(avi) +ADD_SUBDIRECTORY(nodes) +ADD_SUBDIRECTORY(modifiers) ADD_SUBDIRECTORY(makesdna) ADD_SUBDIRECTORY(makesrna) -ADD_SUBDIRECTORY(readblenfile) -ADD_SUBDIRECTORY(render) -ADD_SUBDIRECTORY(blenfont) -ADD_SUBDIRECTORY(ikplugin) IF(WITH_IMAGE_OPENEXR) ADD_SUBDIRECTORY(imbuf/intern/openexr) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index cd9f3971540..70badbc96e8 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -50,8 +50,8 @@ struct Main; #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 -int BKE_read_file(struct bContext *C, char *dir, void *type_r, struct ReportList *reports); -int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, void *type_r, struct ReportList *reports); +int BKE_read_file(struct bContext *C, char *dir, struct ReportList *reports); +int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, struct ReportList *reports); int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports); void free_blender(void); diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 7450e31e263..33ab6c36b74 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -44,8 +44,10 @@ #define STRINGIFY_ARG(x) #x #define STRINGIFY(x) STRINGIFY_ARG(x) + + #ifdef __GNUC__ -# define UNUSED(x) x __attribute__((__unused__)) +# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) #else # define UNUSED(x) x #endif diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index d120b42a286..5fcf3c77d3b 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -365,7 +365,7 @@ void BKE_userdef_free(void) 2: OK, and with new user settings */ -int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports) +int BKE_read_file(bContext *C, char *dir, ReportList *reports) { BlendFileData *bfd; int retval= 1; @@ -392,7 +392,7 @@ int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports) return (bfd?retval:0); } -int BKE_read_file_from_memory(bContext *C, char* filebuf, int filelength, void *unused, ReportList *reports) +int BKE_read_file_from_memory(bContext *C, char* filebuf, int filelength, ReportList *reports) { BlendFileData *bfd; @@ -474,7 +474,7 @@ static int read_undosave(bContext *C, UndoElem *uel) G.fileflags |= G_FILE_NO_UI; if(UNDO_DISK) - success= BKE_read_file(C, uel->str, NULL, NULL); + success= BKE_read_file(C, uel->str, NULL); else success= BKE_read_file_from_memfile(C, &uel->memfile, NULL); @@ -554,7 +554,7 @@ void BKE_write_undo(bContext *C, char *name) if(curundo->prev) prevfile= &(curundo->prev->memfile); memused= MEM_get_memory_in_use(); - success= BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags, NULL); + success= BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags); curundo->undosize= MEM_get_memory_in_use() - memused; } diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index bd721871f0a..9d126a4a931 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -1399,7 +1399,7 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], //#include -void BLI_pbvh_node_draw(PBVHNode *node, void *data) +void BLI_pbvh_node_draw(PBVHNode *node, void *UNUSED(data)) { #if 0 /* XXX: Just some quick code to show leaf nodes in different colors */ diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 182c582cc0f..5758eca6076 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -36,8 +36,7 @@ struct Main; struct ReportList; extern int BLO_write_file(struct Main *mainvar, char *dir, int write_flags, struct ReportList *reports, int *thumb); -extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, - int write_flags, struct ReportList *reports); +extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags); extern int BLO_write_runtime(struct Main *mainvar, char *file, char *exename, struct ReportList *reports); #define BLEN_THUMB_SIZE 128 diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index b637d538b91..c892e8457ca 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -284,7 +284,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil strcpy(fd->relabase, filename); /* clear ob->proxy_from pointers in old main */ - blo_clear_proxy_pointers_from_lib(fd, oldmain); + blo_clear_proxy_pointers_from_lib(oldmain); /* separate libraries from old main */ blo_split_main(&mainlist, oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b6c1bd1c7bc..ebd407e7e21 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -704,7 +704,7 @@ BHead *blo_firstbhead(FileData *fd) return(bhead); } -BHead *blo_prevbhead(FileData *fd, BHead *thisblock) +BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock) { BHeadN *bheadn= (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) ); BHeadN *prev= bheadn->prev; @@ -1155,7 +1155,7 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi * to clear that pointer before reading the undo memfile since * the object might be removed, it is set again in reading * if the local object still exists */ -void blo_clear_proxy_pointers_from_lib(FileData *fd, Main *oldmain) +void blo_clear_proxy_pointers_from_lib(Main *oldmain) { Object *ob= oldmain->object.first; @@ -1442,7 +1442,7 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f } } -static void IDP_DirectLinkString(IDProperty *prop, int switch_endian, FileData *fd) +static void IDP_DirectLinkString(IDProperty *prop, FileData *fd) { /*since we didn't save the extra string buffer, set totallen to len.*/ prop->totallen = prop->len; @@ -1469,7 +1469,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) IDP_DirectLinkGroup(prop, switch_endian, fd); break; case IDP_STRING: - IDP_DirectLinkString(prop, switch_endian, fd); + IDP_DirectLinkString(prop, fd); break; case IDP_ARRAY: IDP_DirectLinkArray(prop, switch_endian, fd); @@ -1499,7 +1499,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) } /*stub function*/ -void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) +void IDP_LibLinkProperty(IDProperty *UNUSED(prop), int UNUSED(switch_endian), FileData *UNUSED(fd)) { } @@ -1552,7 +1552,7 @@ static void direct_link_brush(FileData *fd, Brush *brush) brush->icon_imbuf= NULL; } -static void direct_link_script(FileData *fd, Script *script) +static void direct_link_script(FileData *UNUSED(fd), Script *script) { script->id.us = 1; SCRIPT_SET_NULL(script) @@ -2030,7 +2030,7 @@ static void lib_link_nodetree(FileData *fd, Main *main) /* verify types for nodes and groups, all data has to be read */ /* open = 0: appending/linking, open = 1: open new file (need to clean out dynamic * typedefs*/ -static void lib_verify_nodetree(Main *main, int open) +static void lib_verify_nodetree(Main *main, int UNUSED(open)) { Scene *sce; Material *ma; @@ -2139,7 +2139,7 @@ typedef struct tConstraintLinkData { ID *id; } tConstraintLinkData; /* callback function used to relink constraint ID-links */ -static void lib_link_constraint_cb(bConstraint *con, ID **idpoin, void *userdata) +static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata) { tConstraintLinkData *cld= (tConstraintLinkData *)userdata; *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin); @@ -2534,7 +2534,7 @@ static void direct_link_world(FileData *fd, World *wrld) /* ************ READ VFONT ***************** */ -static void lib_link_vfont(FileData *fd, Main *main) +static void lib_link_vfont(FileData *UNUSED(fd), Main *main) { VFont *vf; @@ -2555,7 +2555,7 @@ static void direct_link_vfont(FileData *fd, VFont *vf) /* ************ READ TEXT ****************** */ -static void lib_link_text(FileData *fd, Main *main) +static void lib_link_text(FileData *UNUSED(fd), Main *main) { Text *text; @@ -5261,7 +5261,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) lib->parent= NULL; } -static void lib_link_library(FileData *fd, Main *main) +static void lib_link_library(FileData *UNUSED(fd), Main *main) { Library *lib; for(lib= main->library.first; lib; lib= lib->id.next) { @@ -6473,7 +6473,7 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) } } -static void do_version_mdef_250(FileData *fd, Library *lib, Main *main) +static void do_version_mdef_250(Main *main) { Object *ob; ModifierData *md; @@ -10899,7 +10899,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - do_version_mdef_250(fd, lib, main); + do_version_mdef_250(main); /* parent type to modifier */ for(ob = main->object.first; ob; ob = ob->id.next) { @@ -11291,7 +11291,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) lib_link_all(fd, bfd->main); //do_versions_after_linking(fd, NULL, bfd->main); // XXX: not here (or even in this function at all)! this causes crashes on many files - Aligorith (July 04, 2010) - lib_verify_nodetree(bfd->main, 1); + lib_verify_nodetree(bfd->main, TRUE); fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */ link_global(fd, bfd); /* as last */ @@ -11776,7 +11776,7 @@ typedef struct tConstraintExpandData { Main *mainvar; } tConstraintExpandData; /* callback function used to expand constraint ID-links */ -static void expand_constraint_cb(bConstraint *con, ID **idpoin, void *userdata) +static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata) { tConstraintExpandData *ced= (tConstraintExpandData *)userdata; expand_doit(ced->fd, ced->mainvar, *idpoin); @@ -12461,7 +12461,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in mainl= NULL; /* blo_join_main free's mainl, cant use anymore */ lib_link_all(*fd, mainvar); - lib_verify_nodetree(mainvar, 0); + lib_verify_nodetree(mainvar, FALSE); fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */ /* give a base to loose objects. If group append, do it for objects too */ diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 8e391fa438e..ed89e93d66a 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -114,7 +114,7 @@ FileData *blo_openblenderfile(char *name, struct ReportList *reports); FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); -void blo_clear_proxy_pointers_from_lib(FileData *fd, Main *oldmain); +void blo_clear_proxy_pointers_from_lib(Main *oldmain); void blo_make_image_pointer_map(FileData *fd, Main *oldmain); void blo_end_image_pointer_map(FileData *fd, Main *oldmain); void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index dc5a0dbeafa..440f1cc98a8 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2530,7 +2530,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report } /* return: success (1) */ -int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags, ReportList *reports) +int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags) { int err; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index feb680ff40a..6e5be217164 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -91,7 +91,7 @@ /* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */ /* Note: there's a similar function in key.c (ob_get_key) */ -Key *actedit_get_shapekeys (bAnimContext *ac, SpaceAction *saction) +static Key *actedit_get_shapekeys (bAnimContext *ac) { Scene *scene= ac->scene; Object *ob; @@ -153,7 +153,7 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction) case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */ ac->datatype= ANIMCONT_SHAPEKEY; - ac->data= actedit_get_shapekeys(ac, saction); + ac->data= actedit_get_shapekeys(ac); ac->mode= saction->mode; return 1; diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 64426b7dc6b..7b2ec9891f4 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -157,7 +157,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) } /* exiting the operator - free data */ -static void pose_slide_exit (bContext *C, wmOperator *op) +static void pose_slide_exit(wmOperator *op) { tPoseSlideOp *pso= op->customdata; @@ -376,7 +376,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl) } /* apply() - perform the pose sliding based on weighting various poses */ -static void pose_slide_apply (bContext *C, wmOperator *op, tPoseSlideOp *pso) +static void pose_slide_apply(bContext *C, tPoseSlideOp *pso) { tPChanFCurveLink *pfl; @@ -434,7 +434,7 @@ static void pose_slide_autoKeyframe (bContext *C, tPoseSlideOp *pso) } /* reset changes made to current pose */ -static void pose_slide_reset (bContext *C, tPoseSlideOp *pso) +static void pose_slide_reset (tPoseSlideOp *pso) { /* wrapper around the generic call, so that custom stuff can be added later */ poseAnim_mapping_reset(&pso->pfLinks); @@ -501,7 +501,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp * /* initial apply for operator... */ // TODO: need to calculate percentage for initial round too... - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); /* depsgraph updates + redraws */ pose_slide_refresh(C, pso); @@ -528,7 +528,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) /* insert keyframes as required... */ pose_slide_autoKeyframe(C, pso); - pose_slide_exit(C, op); + pose_slide_exit(op); /* done! */ return OPERATOR_FINISHED; @@ -541,13 +541,13 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) WM_cursor_restore(win); /* reset transforms back to original state */ - pose_slide_reset(C, pso); + pose_slide_reset(pso); /* depsgraph updates + redraws */ pose_slide_refresh(C, pso); /* clean up temp data */ - pose_slide_exit(C, op); + pose_slide_exit(op); /* cancelled! */ return OPERATOR_CANCELLED; @@ -562,10 +562,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) RNA_float_set(op->ptr, "percentage", pso->percentage); /* reset transforms (to avoid accumulation errors) */ - pose_slide_reset(C, pso); + pose_slide_reset(pso); /* apply... */ - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); } break; @@ -579,10 +579,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) } /* common code for cancel() */ -static int pose_slide_cancel (bContext *C, wmOperator *op) +static int pose_slide_cancel (bContext *UNUSED(C), wmOperator *op) { /* cleanup and done */ - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } @@ -590,13 +590,13 @@ static int pose_slide_cancel (bContext *C, wmOperator *op) static int pose_slide_exec_common (bContext *C, wmOperator *op, tPoseSlideOp *pso) { /* settings should have been set up ok for applying, so just apply! */ - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); /* insert keyframes if needed */ pose_slide_autoKeyframe(C, pso); /* cleanup and done */ - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_FINISHED; } @@ -618,7 +618,7 @@ static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED( /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -635,7 +635,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -675,7 +675,7 @@ static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -692,7 +692,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -732,7 +732,7 @@ static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UN /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -749,7 +749,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4689153c9f5..2a1527b670d 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -492,7 +492,7 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval); uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2); -void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr, int columns); +void uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int columns); /* Links * @@ -680,17 +680,17 @@ void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA char *newop, char *openop, char *unlinkop); void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols); -void uiTemplateAnyID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, +void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *proptypename, char *text); -void uiTemplatePathBuilder(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, +void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *root_ptr, char *text); uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot); void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); +void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname); void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush); void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname, diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 55428a4a241..f65b10eaaea 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -441,7 +441,7 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval) /* link line drawing is not part of buttons or theme.. so we stick with it here */ -static void ui_draw_linkline(uiBut *but, uiLinkLine *line) +static void ui_draw_linkline(uiLinkLine *line) { rcti rect; @@ -470,7 +470,7 @@ static void ui_draw_links(uiBlock *block) if(but->type==LINK && but->link) { line= but->link->lines.first; while(line) { - ui_draw_linkline(but, line); + ui_draw_linkline(line); line= line->next; } } @@ -748,7 +748,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) if(block->flag & UI_BLOCK_LOOP) ui_draw_menu_back(&style, block, &rect); else if(block->panel) - ui_draw_aligned_panel(ar, &style, block, &rect); + ui_draw_aligned_panel(&style, block, &rect); /* widgets */ for(but= block->buttons.first; but; but= but->next) { @@ -835,7 +835,7 @@ static void ui_is_but_sel(uiBut *but) /* XXX 2.50 no links supported yet */ -static int uibut_contains_pt(uiBut *but, short *mval) +static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval)) { return 0; @@ -1093,12 +1093,12 @@ static void ui_do_active_linklines(uiBlock *block, short *mval) if(line==act) { if((line->flag & UI_SELECT)==0) { line->flag |= UI_SELECT; - ui_draw_linkline(but, line); + ui_draw_linkline(line); } } else if(line->flag & UI_SELECT) { line->flag &= ~UI_SELECT; - ui_draw_linkline(but, line); + ui_draw_linkline(line); } line= line->next; } @@ -2182,7 +2182,7 @@ int ui_but_can_align(uiBut *but) return !ELEM3(but->type, LABEL, OPTION, OPTIONN); } -static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr) +static void ui_block_do_align_but(uiBut *first, int nr) { uiBut *prev, *but=NULL, *next; int flag= 0, cols=0, rows=0; @@ -2316,7 +2316,7 @@ void ui_block_do_align(uiBlock *block) for(but=block->buttons.first; but;) { if(but->alignnr) { nr= but->alignnr; - ui_block_do_align_but(block, but, nr); + ui_block_do_align_but(but, nr); /* skip with same number */ for(; but && but->alignnr == nr; but=but->next); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 093d175adce..855ca45f61a 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -460,7 +460,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel) /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect) +void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) { extern char datatoc_splash_png[]; extern int datatoc_splash_png_size; @@ -747,7 +747,7 @@ void histogram_draw_one(float r, float g, float b, float alpha, float x, float y glDisable(GL_LINE_SMOOTH); } -void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Histogram *hist = (Histogram *)but->poin; int res = hist->x_resolution; @@ -800,7 +800,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti * draw_scope_end(&rect, scissor); } -void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; rctf rect; @@ -1023,7 +1023,7 @@ void vectorscope_draw_target(float centerx, float centery, float diam, float r, glEnd(); } -void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; rctf rect; @@ -1105,7 +1105,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti glDisable(GL_BLEND); } -void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect) +void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) { ColorBand *coba; CBData *cbd; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3fa53b73015..cbd4939b1b1 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -331,7 +331,7 @@ static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha) viconutil_draw_points(pts, 3, 1); } -static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) +static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(alpha)) { GLint pts[3][2]; @@ -346,7 +346,7 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) viconutil_draw_points(pts, 3, 1); } -static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha) +static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2; @@ -371,7 +371,7 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float al viconutil_draw_lineloop_smooth(pts, 3); } -static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha) +static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2-4; @@ -393,7 +393,7 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha) glShadeModel(GL_FLAT); } -static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha) +static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2; @@ -418,7 +418,7 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alp viconutil_draw_lineloop_smooth(pts, 3); } -static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) +static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha)) { int d=-2; @@ -436,7 +436,7 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) glDisable(GL_LINE_SMOOTH); } -static void vicon_move_down_draw(int x, int y, int w, int h, float alpha) +static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)) { int d=2; @@ -843,7 +843,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple prv_img->w[miplevel], prv_img->h[miplevel]); } -static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect, float alpha, float *rgb) +static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb) { /* modulate color */ if(alpha != 1.0f) @@ -895,7 +895,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, } } -static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int iw, int ih, float alpha, float *rgb) +static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb) { float x1, x2, y1, y2; @@ -938,7 +938,7 @@ static int preview_size(int miplevel) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int nocreate) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate)) { Icon *icon = NULL; DrawInfo *di = NULL; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 91776b41817..7a0f69fc838 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -441,7 +441,7 @@ void autocomplete_end(struct AutoComplete *autocpl, char *autoname); /* interface_panel.c */ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event); -extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect); +extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect); /* interface_draw.c */ extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3db68fd89c0..f729124e405 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon uiBlockSetCurLayout(block, layout); } -static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only) +static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only) { uiBut *but; EnumPropertyItem *item; @@ -956,7 +956,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index } /* expanded enum */ else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG)) - ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only); + ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only); /* property with separate label */ else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) { but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index a7b74900a21..d6cb8161916 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -316,7 +316,7 @@ void uiPanelPush(uiBlock *block) glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0); } -void uiPanelPop(uiBlock *block) +void uiPanelPop(uiBlock *UNUSED(block)) { glPopMatrix(); } @@ -425,7 +425,7 @@ static void ui_draw_panel_dragwidget(rctf *rect) } -static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect, char dir) +static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir) { Panel *panel= block->panel; rcti hrect; @@ -468,7 +468,7 @@ static void rectf_scale(rctf *rect, float scale) } /* panel integrated in buttonswindow, tool/property lists etc */ -void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) { Panel *panel= block->panel; rcti headrect; @@ -499,7 +499,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re /* horizontal title */ if(!(panel->flag & PNL_CLOSEDX)) { - ui_draw_aligned_panel_header(ar, style, block, &headrect, 'h'); + ui_draw_aligned_panel_header(style, block, &headrect, 'h'); /* itemrect smaller */ itemrect.xmax= headrect.xmax - 5.0f/block->aspect; @@ -518,7 +518,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re } else if(panel->flag & PNL_CLOSEDX) { /* draw vertical title */ - ui_draw_aligned_panel_header(ar, style, block, &headrect, 'v'); + ui_draw_aligned_panel_header(style, block, &headrect, 'v'); } /* an open panel */ else { diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index f6a13dae71c..5f8d604817a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -306,7 +306,7 @@ typedef struct uiTooltipData { int toth, spaceh, lineh; } uiTooltipData; -static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) +static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiTooltipData *data= ar->regiondata; rcti bbox= data->bbox; @@ -328,7 +328,7 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) } } -static void ui_tooltip_region_free(ARegion *ar) +static void ui_tooltip_region_free_cb(ARegion *ar) { uiTooltipData *data; @@ -455,8 +455,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) ar= ui_add_temporary_region(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); - type.draw= ui_tooltip_region_draw; - type.free= ui_tooltip_region_free; + type.draw= ui_tooltip_region_draw_cb; + type.free= ui_tooltip_region_free_cb; ar->type= &type; /* set font, get bb */ @@ -832,7 +832,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) } } -static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) +static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiSearchboxData *data= ar->regiondata; @@ -840,7 +840,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f); if(!data->noback) - ui_draw_search_back(U.uistyles.first, NULL, &data->bbox); + ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */ /* draw text */ if(data->items.totitem) { @@ -899,7 +899,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) } } -static void ui_searchbox_region_free(ARegion *ar) +static void ui_searchbox_region_free_cb(ARegion *ar) { uiSearchboxData *data= ar->regiondata; int a; @@ -931,8 +931,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) ar= ui_add_temporary_region(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); - type.draw= ui_searchbox_region_draw; - type.free= ui_searchbox_region_free; + type.draw= ui_searchbox_region_draw_cb; + type.free= ui_searchbox_region_free_cb; ar->type= &type; /* create searchbox data */ @@ -1418,7 +1418,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle) /***************************** Menu Button ***************************/ -static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str) +static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *arg_str) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1500,7 +1500,7 @@ static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str) menudata_free(md); } -void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but) +void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1514,7 +1514,7 @@ void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but) &handle->retvalue, (float)a, 0.0, 0, 0, ""); } -void ui_block_func_ICONTEXTROW(bContext *C, uiLayout *layout, void *arg_but) +void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1642,7 +1642,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb) } } -static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) +static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1659,7 +1659,7 @@ static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hsv_rna_cb(bContext *C, void *bt1, void *arg_dummy) +static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1674,7 +1674,7 @@ static void do_hsv_rna_cb(bContext *C, void *bt1, void *arg_dummy) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) +static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1695,7 +1695,7 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) popup->menuretval= UI_RETURN_UPDATE; } -static void close_popup_cb(bContext *C, void *bt1, void *arg) +static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1735,7 +1735,7 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) } } -static void do_picker_new_mode_cb(bContext *C, void *bt1, void *dummy) +static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *bt= bt1; short colormode= ui_get_but_val(bt); @@ -1886,7 +1886,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR } -static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event) +static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event) { float add= 0.0f; @@ -1945,7 +1945,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; uiBoundsBlock(block, 10); - block->block_event_func= ui_picker_small_wheel; + block->block_event_func= ui_picker_small_wheel_cb; /* and lets go */ block->direction= UI_TOP; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 77770452f84..bbbb5bec7c0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -491,7 +491,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p * - propname: property identifier for property that ID-pointer gets stored to * - proptypename: property identifier for property used to determine the type of ID-pointer that can be used */ -void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *proptypename, char *text) +void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text) { PropertyRNA *propID, *propType; uiLayout *row; @@ -536,7 +536,7 @@ void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn * - propname: property identifier for property that path gets stored to * - root_ptr: struct that path gets built from */ -void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *root_ptr, char *text) +void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text) { PropertyRNA *propPath; uiLayout *row; @@ -817,7 +817,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) #define REMAKEIPO 8 #define B_DIFF 9 -void do_constraint_panels(bContext *C, void *arg, int event) +void do_constraint_panels(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -853,7 +853,7 @@ void do_constraint_panels(bContext *C, void *arg, int event) // XXX allqueue(REDRAWBUTSEDIT, 0); } -static void constraint_active_func(bContext *C, void *ob_v, void *con_v) +static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v) { ED_object_constraint_set_active(ob_v, con_v); } @@ -1142,7 +1142,7 @@ typedef struct RNAUpdateCb { PropertyRNA *prop; } RNAUpdateCb; -static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) +static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb; @@ -1319,7 +1319,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Histogram Template ************************/ -void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1358,7 +1358,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Waveform Template ************************/ -void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1394,7 +1394,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int e /********************* Vectorscope Template ************************/ -void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1432,7 +1432,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, in /********************* CurveMapping Template ************************/ -static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(arg)) { CurveMapping *cumap = cumap_v; float d; @@ -1450,7 +1450,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused) ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(unused)) { CurveMapping *cumap = cumap_v; float d, d1; @@ -1487,7 +1487,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused) ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_setclip(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *UNUSED(arg)) { CurveMapping *cumap = cumap_v; @@ -1607,7 +1607,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void return block; } -static void curvemap_buttons_redraw(bContext *C, void *arg1, void *arg2) +static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_region_tag_redraw(CTX_wm_region(C)); } @@ -2200,7 +2200,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propna /************************* Operator Search Template **************************/ -static void operator_call_cb(bContext *C, void *arg1, void *arg2) +static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2) { wmOperatorType *ot= arg2; @@ -2208,7 +2208,7 @@ static void operator_call_cb(bContext *C, void *arg1, void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -2255,7 +2255,7 @@ void uiTemplateOperatorSearch(uiLayout *layout) #define B_STOPANIM 3 #define B_STOPCOMPO 4 -static void do_running_jobs(bContext *C, void *arg, int event) +static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) { switch(event) { case B_STOPRENDER: diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 37278340275..6d8aa89afb0 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -131,7 +131,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind return but; } -void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns) +void uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int columns) { uiLayout *split, *col; int flag; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 44fec4d4e07..7e15f9b1f74 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -744,7 +744,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) #define PREVIEW_PAD 4 -static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti *rect) +static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect) { int w, h, x, y, size; @@ -1492,7 +1492,7 @@ static void widget_state_label(uiWidgetType *wt, int state) } -static void widget_state_nothing(uiWidgetType *wt, int state) +static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state)) { wt->wcol= *(wt->wcol_theme); } @@ -1949,7 +1949,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) /* ************ separator, for menus etc ***************** */ -static void ui_draw_separator(uiBut *but, rcti *rect, uiWidgetColors *wcol) +static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol) { int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1; unsigned char col[4]; @@ -2121,7 +2121,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat } } -static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { rcti rect1; double value; @@ -2182,7 +2182,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat uiWidgetScrollDraw(wcol, rect, &rect1, state); } -static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { rcti rect_prog = *rect, rect_bar = *rect; float value = but->a1; @@ -2208,7 +2208,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect->xmin -= 6; } -static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { if(but->flag & UI_SELECT) { @@ -2362,7 +2362,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun } -static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2380,7 +2380,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roun rect->xmax -= (rect->ymax-rect->ymin); } -static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2393,7 +2393,7 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { if(state & UI_ACTIVE) { uiWidgetBase wtb; @@ -2408,7 +2408,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int } } -static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { uiWidgetBase wtb; @@ -2421,7 +2421,7 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { uiWidgetBase wtb; @@ -2434,7 +2434,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { uiWidgetBase wtb; rcti recttemp= *rect; @@ -2467,7 +2467,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int ro } -static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2480,7 +2480,7 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int rou } -static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; char old_col[3]; @@ -2508,7 +2508,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, VECCOPY(wcol->inner, old_col); } -static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2521,7 +2521,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundbox } -static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin); @@ -2786,7 +2786,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); break; case SEPR: - ui_draw_separator(but, rect, &tui->wcol_menu_item); + ui_draw_separator(rect, &tui->wcol_menu_item); break; default: @@ -2972,7 +2972,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } } -void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK); @@ -2984,7 +2984,7 @@ void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect) } -void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt= widget_type(UI_WTYPE_BOX); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 0f1efbcf7cf..d8b34311e76 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1104,14 +1104,14 @@ static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, struct EditMesh *em if(poinval != -1) return (EditVert *)(poinval); return NULL; -} +} EditVert *editmesh_get_x_mirror_vert(Object *ob, struct EditMesh *em, EditVert *eve, float *co, int index) { if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { return editmesh_get_x_mirror_vert_topo(ob, em, eve, index); } else { - return editmesh_get_x_mirror_vert_spacial(ob, em, eve->co); + return editmesh_get_x_mirror_vert_spacial(ob, em, co); } } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index a058f5155de..840ab0b2098 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -282,7 +282,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) +static int material_slot_remove_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 9ae16b1bfa6..5bcf8c18074 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2463,7 +2463,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) return 0; } -static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) +static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { bScreen *screen= CTX_wm_screen(C); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 2521f138fee..cd498c274cf 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4986,10 +4986,10 @@ static int paint_radial_control_exec(bContext *C, wmOperator *op) Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); float zoom; int ret; - char str[256]; + char str[64]; get_imapaint_zoom(C, &zoom, &zoom); ret = brush_radial_control_exec(op, brush, 1.0f / zoom); - WM_radial_control_string(op, str, 256); + WM_radial_control_string(op, str, sizeof(str)); WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); @@ -5333,8 +5333,8 @@ static int texture_paint_radial_control_exec(bContext *C, wmOperator *op) { Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); int ret = brush_radial_control_exec(op, brush, 1); - char str[256]; - WM_radial_control_string(op, str, 256); + char str[64]; + WM_radial_control_string(op, str, sizeof(str)); WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 568c76f3dfc..dd3672b656a 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -76,7 +76,7 @@ /* -------------- */ -static void do_graph_region_buttons(bContext *C, void *arg, int event) +static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { //Scene *scene= CTX_data_scene(C); @@ -116,7 +116,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** return 1; } -static int graph_panel_poll(const bContext *C, PanelType *pt) +static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { return graph_panel_context(C, NULL, NULL); } @@ -288,7 +288,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) #define B_IPO_DEPCHANGE 10 -static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) +static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -310,7 +310,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) } /* callback to remove the active driver */ -static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v) +static void driver_remove_cb (bContext *UNUSED(C), void *ale_v, void *UNUSED(arg)) { bAnimListElem *ale= (bAnimListElem *)ale_v; ID *id= ale->id; @@ -325,7 +325,7 @@ static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v) } /* callback to add a target variable to the active driver */ -static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v) +static void driver_add_var_cb (bContext *UNUSED(C), void *driver_v, void *UNUSED(arg)) { ChannelDriver *driver= (ChannelDriver *)driver_v; @@ -334,7 +334,7 @@ static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v) } /* callback to remove target variable from active driver */ -static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v) +static void driver_delete_var_cb (bContext *UNUSED(C), void *driver_v, void *dvar_v) { ChannelDriver *driver= (ChannelDriver *)driver_v; DriverVar *dvar= (DriverVar *)dvar_v; @@ -344,7 +344,7 @@ static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v) } /* callback to reset the driver's flags */ -static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) +static void driver_update_flags_cb (bContext *UNUSED(C), void *fcu_v, void *UNUSED(arg)) { FCurve *fcu= (FCurve *)fcu_v; ChannelDriver *driver= fcu->driver; @@ -355,7 +355,7 @@ static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) } /* drivers panel poll */ -static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) +static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceIpo *sipo= CTX_wm_space_graph(C); @@ -365,9 +365,8 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) return graph_panel_context(C, NULL, NULL); } - /* settings for 'single property' driver variable type */ -static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; PointerRNA dtar_ptr; @@ -379,7 +378,7 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou /* Target ID */ row= uiLayoutRow(layout, 0); - uiTemplateAnyID(row, (bContext *)C, &dtar_ptr, "id", "id_type", "Prop:"); + uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", "Prop:"); /* Target Property */ // TODO: make this less technical... @@ -392,12 +391,12 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou col= uiLayoutColumn(layout, 1); block= uiLayoutGetBlock(col); /* rna path */ - uiTemplatePathBuilder(col, (bContext *)C, &dtar_ptr, "data_path", &root_ptr, "Path"); + uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path"); } } /* settings for 'rotation difference' driver variable type */ -static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; DriverTarget *dtar2= &dvar->targets[1]; @@ -412,7 +411,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, /* Bone 1 */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Bone 1:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Bone 1:"); if (dtar->id && ob1->pose) { PointerRNA tar_ptr; @@ -422,7 +421,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, } col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Bone 2:"); + uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Bone 2:"); if (dtar2->id && ob2->pose) { PointerRNA tar_ptr; @@ -433,7 +432,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, } /* settings for 'location difference' driver variable type */ -static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; DriverTarget *dtar2= &dvar->targets[1]; @@ -448,7 +447,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, /* Bone 1 */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone 1:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone 1:"); if (dtar->id && ob1->pose) { PointerRNA tar_ptr; @@ -460,7 +459,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, 0); col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); + uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); if (dtar2->id && ob2->pose) { PointerRNA tar_ptr; @@ -473,7 +472,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, } /* settings for 'transform channel' driver variable type */ -static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; Object *ob = (Object *)dtar->id; @@ -485,7 +484,7 @@ static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout /* properties */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone:"); if (dtar->id && ob->pose) { PointerRNA tar_ptr; @@ -606,16 +605,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* controls to draw depends on the type of variable */ switch (dvar->type) { case DVAR_TYPE_SINGLE_PROP: /* single property */ - graph_panel_driverVar__singleProp(C, box, ale->id, dvar); + graph_panel_driverVar__singleProp(box, ale->id, dvar); break; case DVAR_TYPE_ROT_DIFF: /* rotational difference */ - graph_panel_driverVar__rotDiff(C, box, ale->id, dvar); + graph_panel_driverVar__rotDiff(box, ale->id, dvar); break; case DVAR_TYPE_LOC_DIFF: /* location difference */ - graph_panel_driverVar__locDiff(C, box, ale->id, dvar); + graph_panel_driverVar__locDiff(box, ale->id, dvar); break; case DVAR_TYPE_TRANSFORM_CHAN: /* transform channel */ - graph_panel_driverVar__transChan(C, box, ale->id, dvar); + graph_panel_driverVar__transChan(box, ale->id, dvar); break; } @@ -642,7 +641,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) #define B_FMODIFIER_REDRAW 20 -static void do_graph_region_modifier_buttons(bContext *C, void *arg, int event) +static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event) { switch (event) { case B_REDR: diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index b47c8e8d189..6799d9390d7 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -179,7 +179,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) } -static void recent_files_menu(const bContext *C, Menu *menu) +static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; uiLayout *layout= menu->layout; @@ -200,7 +200,7 @@ void recent_files_menu_register() mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); strcpy(mt->label, "Open Recent..."); - mt->draw= recent_files_menu; + mt->draw= recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 16a2ac3c52e..78ae82c57b0 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -72,7 +72,7 @@ /* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */ -void node_buts_group(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, ""); } @@ -297,7 +297,7 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v) node->menunr= 0; } -static void node_shader_buts_material(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node= ptr->data; uiLayout *col; @@ -343,7 +343,7 @@ static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), Po uiItemR(layout, ptr, "operation", 0, "", 0); } -static void node_shader_buts_geometry(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA obptr= CTX_data_pointer_get(C, "active_object"); uiLayout *col; @@ -362,7 +362,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *UNUSED(C), Poi } } -static void node_shader_buts_dynamic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr) { Main *bmain= CTX_data_main(C); uiBlock *block= uiLayoutAbsoluteBlock(layout); @@ -457,7 +457,7 @@ static void node_shader_set_butfunc(bNodeType *ntype) /* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */ -static void node_composit_buts_image(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiLayout *col; bNode *node= ptr->data; @@ -491,7 +491,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *UNUSED(C), Poin uiItemR(col, ptr, "layer", 0, NULL, 0); } -static void node_composit_buts_renderlayers(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node= ptr->data; uiLayout *col, *row; @@ -1210,7 +1210,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe } } -static void node_texture_buts_image(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 141a8800365..450b3725bdb 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1421,7 +1421,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA(C, pa->layout, &ptr, 2); + uiDefAutoButsRNA(pa->layout, &ptr, 2); } #endif // XXX not used diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 0691895948a..16896f75915 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -114,7 +114,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper op->layout= NULL; } else - uiDefAutoButsRNA(C, pa->layout, &ptr, 1); + uiDefAutoButsRNA(pa->layout, &ptr, 1); } static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 240e91ad22e..c0c4cd9bc6c 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -50,7 +50,7 @@ /* allocates PoseTree, and links that to root bone/channel */ /* Note: detecting the IK chain is duplicate code... in drawarmature.c and in transform_conversions.c */ -static void initialize_posetree(struct Object *ob, bPoseChannel *pchan_tip) +static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_tip) { bPoseChannel *curchan, *pchan_root=NULL, *chanlist[256], **oldchan; PoseTree *tree; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 1d86faa5e53..a230a51e792 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -287,7 +287,6 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); func= RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data."); @@ -297,7 +296,6 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI."); func= RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data."); @@ -343,17 +341,14 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data."); api_ui_item_rna_common(func); - RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); func= RNA_def_function(srna, "template_waveform", "uiTemplateWaveform"); RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data."); api_ui_item_rna_common(func); - RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); func= RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope"); RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data."); api_ui_item_rna_common(func); - RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); func= RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 3a3150022d8..ff2f7c5e3b7 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -77,7 +77,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, struct EditMesh *UNUSED(editData), DerivedMesh *UNUSED(derivedData), - float UNUSED((*vertexCos)[3]), + float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index 540a9831dce..c1f24e413c8 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -205,7 +205,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) /* BaseMathObject generic functions for all mathutils types */ char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly)."; -PyObject *BaseMathObject_getOwner(BaseMathObject *UNUSED(self), void *UNUSED(type)) +PyObject *BaseMathObject_getOwner(BaseMathObject *self, void *UNUSED(closure)) { PyObject *ret= self->cb_user ? self->cb_user : Py_None; Py_INCREF(ret); @@ -213,7 +213,7 @@ PyObject *BaseMathObject_getOwner(BaseMathObject *UNUSED(self), void *UNUSED(typ } char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean"; -PyObject *BaseMathObject_getWrapped(BaseMathObject *UNUSED(self), void *UNUSED(type)) +PyObject *BaseMathObject_getWrapped(BaseMathObject *self, void *UNUSED(closure)) { return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0); } diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 8380adef496..26af8a38f6d 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -31,7 +31,7 @@ //----------------------------------mathutils.Color() ------------------- //makes a new color for you to play with -static PyObject *Color_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) +static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { float col[3]= {0.0f, 0.0f, 0.0f}; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f103cbe2d4e..197f99b989e 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -107,7 +107,7 @@ wmKeyConfig *WM_keyconfig_new (struct wmWindowManager *wm, char *idname); wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname); void WM_keyconfig_remove (struct wmWindowManager *wm, struct wmKeyConfig *keyconf); void WM_keyconfig_free (struct wmKeyConfig *keyconf); -void WM_keyconfig_userdef(struct wmWindowManager *wm); +void WM_keyconfig_userdef(void); void WM_keymap_init (struct bContext *C); void WM_keymap_free (struct wmKeyMap *keymap); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 148932fa941..1b0870194a6 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -205,7 +205,7 @@ void WM_keymap_init(bContext *C) /* create default key config */ wm_window_keymap(wm->defaultconf); ED_spacetypes_keymap(wm->defaultconf); - WM_keyconfig_userdef(wm); + WM_keyconfig_userdef(); wm->initialized |= WM_INIT_KEYMAP; } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 334bc79b96a..f2b880bd0d5 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1894,7 +1894,7 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap } /* priorities not implemented yet, for time being just insert in begin of list */ -wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int priority) +wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority)) { wmEventHandler *handler; @@ -2167,7 +2167,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi /* windows store own event queues, no bContext here */ /* time is in 1000s of seconds, from ghost */ -void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata) +void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata) { wmWindow *owin; wmEvent event, *evt= win->eventstate; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 74a8310c2b3..66d2a1efdea 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -283,7 +283,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* also exit screens and editors */ wm_window_match_init(C, &wmbase); - retval= BKE_read_file(C, name, NULL, reports); + retval= BKE_read_file(C, name, reports); G.save_over = 1; /* this flag is initialized by the operator but overwritten on read. @@ -369,9 +369,9 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_window_match_init(C, &wmbase); if (!from_memory && BLI_exists(tstr)) { - success = BKE_read_file(C, tstr, NULL, NULL); + success = BKE_read_file(C, tstr, NULL); } else { - success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL, NULL); + success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL); if (wmbase.first == NULL) wm_clear_default_size(C); } @@ -735,7 +735,7 @@ void WM_autosave_init(wmWindowManager *wm) wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0); } -void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) +void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt)) { wmWindow *win; wmEventHandler *handler; diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index e6220eac8f0..8dcf65886e4 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -121,7 +121,7 @@ void WM_gestures_remove(bContext *C) /* tweak and line gestures */ #define TWEAK_THRESHOLD 10 -int wm_gesture_evaluate(bContext *C, wmGesture *gesture) +int wm_gesture_evaluate(wmGesture *gesture) { if(gesture->type==WM_GESTURE_TWEAK) { rcti *rect= gesture->customdata; @@ -159,7 +159,7 @@ int wm_gesture_evaluate(bContext *C, wmGesture *gesture) /* ******************* gesture draw ******************* */ -static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_rect(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -183,7 +183,7 @@ static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt) glDisable(GL_LINE_STIPPLE); } -static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_line(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -199,7 +199,7 @@ static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt) } -static void wm_gesture_draw_circle(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_circle(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -261,7 +261,7 @@ static void draw_filled_lasso(wmGesture *gt) } } -static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_lasso(wmGesture *gt) { short *lasso= (short *)gt->customdata; int i; @@ -320,23 +320,23 @@ void wm_gesture_draw(wmWindow *win) wmSubWindowSet(win, gt->swinid); if(gt->type==WM_GESTURE_RECT) - wm_gesture_draw_rect(win, gt); + wm_gesture_draw_rect(gt); else if(gt->type==WM_GESTURE_TWEAK) - wm_gesture_draw_line(win, gt); + wm_gesture_draw_line(gt); else if(gt->type==WM_GESTURE_CIRCLE) - wm_gesture_draw_circle(win, gt); + wm_gesture_draw_circle(gt); else if(gt->type==WM_GESTURE_CROSS_RECT) { if(gt->mode==1) - wm_gesture_draw_rect(win, gt); + wm_gesture_draw_rect(gt); else wm_gesture_draw_cross(win, gt); } else if(gt->type==WM_GESTURE_LINES) - wm_gesture_draw_lasso(win, gt); + wm_gesture_draw_lasso(gt); else if(gt->type==WM_GESTURE_LASSO) - wm_gesture_draw_lasso(win, gt); + wm_gesture_draw_lasso(gt); else if(gt->type==WM_GESTURE_STRAIGHTLINE) - wm_gesture_draw_line(win, gt); + wm_gesture_draw_line(gt); } } @@ -351,5 +351,3 @@ void wm_gesture_tag_redraw(bContext *C) wm_tag_redraw_overlay(win, ar); } - - diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index f1873b14232..436494be975 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -118,7 +118,7 @@ void WM_keyconfig_free(wmKeyConfig *keyconf) MEM_freeN(keyconf); } -void WM_keyconfig_userdef(wmWindowManager *wm) +void WM_keyconfig_userdef(void) { wmKeyMap *km; wmKeyMapItem *kmi; @@ -419,7 +419,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) return str; } -static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) +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) { wmWindowManager *wm= CTX_wm_manager(C); wmEventHandler *handler; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 3b342f440b3..ef3c8fb789e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -619,7 +619,7 @@ void WM_operator_properties_free(PointerRNA *ptr) /* ************ default op callbacks, exported *********** */ /* invoke callback, uses enum property named "type" */ -int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { PropertyRNA *prop= op->type->prop; uiPopupMenu *pup; @@ -724,7 +724,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) } -int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *event) +int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPupBlock(C, wm_enum_search_menu, op); return OPERATOR_CANCELLED; @@ -751,13 +751,13 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, char *message) } -int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_confirm_message(C, op, NULL); } /* op->invoke, opens fileselect if path property not set, otherwise executes */ -int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (RNA_property_is_set(op->ptr, "filepath")) { return WM_operator_call(C, op); @@ -862,7 +862,7 @@ int WM_operator_winactive(bContext *C) } /* op->invoke */ -static void redo_cb(bContext *C, void *arg_op, int event) +static void redo_cb(bContext *C, void *arg_op, int UNUSED(event)) { wmOperator *lastop= arg_op; @@ -903,7 +903,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, &ptr, columns); + uiDefAutoButsRNA(layout, &ptr, columns); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -922,7 +922,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) uiPupBlockClose(C, block); } -void dialog_check_cb(bContext *C, void *op_ptr, void *dummy2) +void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) { wmOperator *op= op_ptr; if(op->type->check) { @@ -966,7 +966,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, &ptr, columns); + uiDefAutoButsRNA(layout, &ptr, columns); uiBlockSetFunc(block, NULL, NULL, NULL); @@ -1014,7 +1014,7 @@ static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData) return block; } -int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retval= OPERATOR_CANCELLED; @@ -1083,7 +1083,7 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, op->ptr, 2); + uiDefAutoButsRNA(layout, op->ptr, 2); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -1100,7 +1100,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RNA_int_set(op->ptr, "debugval", G.rt); @@ -1127,7 +1127,7 @@ static void WM_OT_debug_menu(wmOperatorType *ot) /* ***************** Splash Screen ************************* */ -static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused) +static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg)) { uiPupBlockClose(C, arg_block); } @@ -1136,7 +1136,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse /* XXX: hack to refresh splash screen with updated prest menu name, * since popup blocks don't get regenerated like panels do */ -void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused) +void wm_block_splash_refreshmenu (bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg)) { /* ugh, causes crashes in other buttons, disabling for now until * a better fix @@ -1145,7 +1145,7 @@ void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused) */ } -static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; uiBut *but; @@ -1231,7 +1231,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse return block; } -static int wm_splash_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPupBlock(C, wm_block_create_splash, NULL); @@ -1250,7 +1250,7 @@ static void WM_OT_splash(wmOperatorType *ot) /* ***************** Search menu ************************* */ -static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) +static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2) { wmOperatorType *ot= arg2; @@ -1258,7 +1258,7 @@ static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -1285,7 +1285,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u } } -static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op) +static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op)) { static char search[256]= ""; wmEvent event; @@ -1315,15 +1315,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op) return block; } -static int wm_search_menu_exec(bContext *C, wmOperator *op) +static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { - return OPERATOR_FINISHED; } -static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - uiPupBlock(C, wm_block_search_menu, op); return OPERATOR_CANCELLED; @@ -1389,7 +1387,7 @@ static void WM_OT_window_duplicate(wmOperatorType *ot) ot->idname= "WM_OT_window_duplicate"; ot->description="Duplicate the current Blender window"; - ot->exec= wm_window_duplicate_op; + ot->exec= wm_window_duplicate_exec; ot->poll= wm_operator_winactive_normal; } @@ -1440,7 +1438,7 @@ static void open_set_use_scripts(wmOperator *op) RNA_boolean_set(op->ptr, "use_scripts", !(U.flag & USER_SCRIPT_AUTOEXEC_DISABLE)); } -static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RNA_string_set(op->ptr, "filepath", G.sce); open_set_load_ui(op); @@ -1496,7 +1494,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) /* **************** link/append *************** */ -static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); @@ -1721,7 +1719,7 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char filename[FILE_MAX]; @@ -1769,7 +1767,7 @@ static void save_set_compress(wmOperator *op) } } -static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char name[FILE_MAX]; @@ -1820,7 +1818,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) } /* function used for WM_OT_save_mainfile too */ -static int blend_save_check(bContext *C, wmOperator *op) +static int blend_save_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -1850,7 +1848,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) /* *************** save file directly ******** */ -static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char name[FILE_MAX]; int check_existing=1; @@ -1985,7 +1983,7 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot) ot->idname= "WM_OT_window_fullscreen_toggle"; ot->description="Toggle the current window fullscreen"; - ot->exec= wm_window_fullscreen_toggle_op; + ot->exec= wm_window_fullscreen_toggle_exec; ot->poll= WM_operator_winactive; } @@ -2301,7 +2299,7 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event) rect->xmax= event->x - sx; rect->ymax= event->y - sy; - if((val= wm_gesture_evaluate(C, gesture))) { + if((val= wm_gesture_evaluate(gesture))) { wmEvent event; event= *(window->eventstate); @@ -2394,7 +2392,7 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event) } -static void gesture_lasso_apply(bContext *C, wmOperator *op, int event_type) +static void gesture_lasso_apply(bContext *C, wmOperator *op) { wmGesture *gesture= op->customdata; PointerRNA itemptr; @@ -2463,7 +2461,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: case RIGHTMOUSE: if(event->val==KM_RELEASE) { /* key release */ - gesture_lasso_apply(C, op, event->type); + gesture_lasso_apply(C, op); return OPERATOR_FINISHED; } break; @@ -2856,11 +2854,11 @@ void WM_radial_control_string(wmOperator *op, char str[], int maxlen) float v = RNA_float_get(op->ptr, "new_value"); if(mode == WM_RADIALCONTROL_SIZE) - sprintf(str, "Size: %d", (int)v); + BLI_snprintf(str, maxlen, "Size: %d", (int)v); else if(mode == WM_RADIALCONTROL_STRENGTH) - sprintf(str, "Strength: %d", (int)v); + BLI_snprintf(str, maxlen, "Strength: %d", (int)v); else if(mode == WM_RADIALCONTROL_ANGLE) - sprintf(str, "Angle: %d", (int)(v * 180.0f/M_PI)); + BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/M_PI)); } /** Important: this doesn't define an actual operator, it @@ -3027,7 +3025,7 @@ static void WM_OT_redraw_timer(wmOperatorType *ot) /* ************************** memory statistics for testing ***************** */ -static int memory_statistics_exec(bContext *C, wmOperator *op) +static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { MEM_printmemlist_stats(); return OPERATOR_FINISHED; @@ -3351,7 +3349,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, ID *id, int local) +static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), int *free, ID *id, int local) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 207b6cebfe6..271b32359f5 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -40,6 +40,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" @@ -73,7 +74,7 @@ typedef struct wmSubWindow { /* ******************* open, free, set, get data ******************** */ /* not subwindow itself */ -static void wm_subwindow_free(wmSubWindow *swin) +static void wm_subwindow_free(wmSubWindow *UNUSED(swin)) { /* future fancy stuff */ } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index c31f72d8af1..fbc77d0d06d 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -290,7 +290,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } /* belongs to below */ -static void wm_window_add_ghostwindow(bContext *C, wmWindowManager *wm, char *title, wmWindow *win) +static void wm_window_add_ghostwindow(bContext *C, char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; int scr_w, scr_h, posy; @@ -384,7 +384,7 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) win->windowstate= initialstate; useprefsize= 0; } - wm_window_add_ghostwindow(C, wm, "Blender", win); + wm_window_add_ghostwindow(C, "Blender", win); } /* happens after fileread */ if(win->eventstate==NULL) @@ -493,7 +493,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type) /* ****************** Operators ****************** */ /* operator callback */ -int wm_window_duplicate_op(bContext *C, wmOperator *op) +int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { wm_window_copy(C, CTX_wm_window(C)); WM_check(C); @@ -505,7 +505,7 @@ int wm_window_duplicate_op(bContext *C, wmOperator *op) /* fullscreen operator callback */ -int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op) +int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *window= CTX_wm_window(C); GHOST_TWindowState state = GHOST_GetWindowState(window->ghostwin); @@ -895,7 +895,7 @@ void wm_window_process_events(const bContext *C) PIL_sleep_ms(5); } -void wm_window_process_events_nosleep(const bContext *C) +void wm_window_process_events_nosleep(void) { if(GHOST_ProcessEvents(g_system, 0)) GHOST_DispatchEvents(g_system); @@ -943,7 +943,7 @@ void wm_ghost_exit(void) /* **************** timer ********************** */ /* to (de)activate running timers temporary */ -void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *win, wmTimer *timer, int dosleep) +void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, int dosleep) { wmTimer *wt; @@ -971,7 +971,7 @@ wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, return wt; } -void WM_event_remove_timer(wmWindowManager *wm, wmWindow *win, wmTimer *timer) +void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer) { wmTimer *wt; diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index 7228a6dcd93..e1ca1793c04 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -61,7 +61,7 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action); /* wm_gesture.c */ #define WM_LASSO_MIN_POINTS 1024 void wm_gesture_draw(struct wmWindow *win); -int wm_gesture_evaluate(bContext *C, wmGesture *gesture); +int wm_gesture_evaluate(wmGesture *gesture); void wm_gesture_tag_redraw(bContext *C); /* wm_jobs.c */ diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 5a425df01e1..b0aec50e228 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -45,7 +45,7 @@ void wm_window_close (bContext *C, wmWindowManager *wm, wmWindow *win); void wm_window_title (wmWindowManager *wm, wmWindow *win); void wm_window_add_ghostwindows (bContext *C, wmWindowManager *wm); void wm_window_process_events (const bContext *C); -void wm_window_process_events_nosleep(const bContext *C); +void wm_window_process_events_nosleep(void); void wm_window_make_drawable(bContext *C, wmWindow *win); @@ -65,8 +65,8 @@ wmWindow *wm_window_copy (bContext *C, wmWindow *winorig); void wm_window_testbreak (void); /* *************** window operators ************** */ -int wm_window_duplicate_op (bContext *C, struct wmOperator *op); -int wm_window_fullscreen_toggle_op(bContext *C, struct wmOperator *op); +int wm_window_duplicate_exec(bContext *C, struct wmOperator *op); +int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op); #endif /* WM_WINDOW_H */ diff --git a/source/creator/creator.c b/source/creator/creator.c index 83392224444..70c9fae0427 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -873,7 +873,7 @@ static int load_file(int argc, char **argv, void *data) BLI_path_cwd(filename); if (G.background) { - int retval = BKE_read_file(C, filename, NULL, NULL); + int retval = BKE_read_file(C, filename, NULL); /*we successfully loaded a blend file, get sure that pointcache works */ diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 2bc24aab526..d65993581b5 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -440,7 +440,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->Render(); } - wm_window_process_events_nosleep(C); + wm_window_process_events_nosleep(); // test for the ESC key //XXX while (qtest()) -- cgit v1.2.3 From d977da3b2ca319da74cb43845b440ce5f6dda791 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 16 Oct 2010 03:13:40 +0000 Subject: Bugfix #24276: Unable to set extrapolation on a per curve basis Selected-curves only flag was missing. --- source/blender/editors/space_action/action_edit.c | 2 +- source/blender/editors/space_graph/graph_edit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 86adc3d9e8c..b0704e76138 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -791,7 +791,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 41c653048e8..46e7840cec8 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1205,7 +1205,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ -- cgit v1.2.3 From 00e3ef9b132db3c9136322bd7de1e50c862e883c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 16 Oct 2010 04:14:26 +0000 Subject: Bugfix #24143: Edit NLA Strips When editing an action used by a NLA strip and editing it 'in place' (controlled by pin icon on green 'tweaking' channel), the animation would only get played back in the action's original frame range while the keyframes were still displayed in the strip-altered positions. --- source/blender/blenkernel/intern/anim_sys.c | 34 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 10c2c1801cb..ea0b2945821 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1607,7 +1607,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* 1. get the stack of strips to evaluate at current time (influence calculated here) */ for (nlt=adt->nla_tracks.first; nlt; nlt=nlt->next, track_index++) { - /* if tweaking is on and this strip is the tweaking track, stop on this one */ + /* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */ if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED)) break; @@ -1634,22 +1634,30 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) */ if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) { /* if there are strips, evaluate action as per NLA rules */ - if (has_strips) { + if ((has_strips) || (adt->actstrip)) { /* make dummy NLA strip, and add that to the stack */ memset(&dummy_strip, 0, sizeof(NlaStrip)); dummy_trackslist.first= dummy_trackslist.last= &dummy_strip; - dummy_strip.act= adt->action; - dummy_strip.remap= adt->remap; - - /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ - calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); - dummy_strip.start = dummy_strip.actstart; - dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend); - - dummy_strip.blendmode= adt->act_blendmode; - dummy_strip.extendmode= adt->act_extendmode; - dummy_strip.influence= adt->act_influence; + if ((nlt) && !(adt->flag & ADT_NLA_EDIT_NOMAP)) { + /* edit active action in-place according to its active strip, so copy the data */ + memcpy(&dummy_strip, adt->actstrip, sizeof(NlaStrip)); + dummy_strip.next = dummy_strip.prev = NULL; + } + else { + /* set settings of dummy NLA strip from AnimData settings */ + dummy_strip.act= adt->action; + dummy_strip.remap= adt->remap; + + /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ + calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); + dummy_strip.start = dummy_strip.actstart; + dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend); + + dummy_strip.blendmode= adt->act_blendmode; + dummy_strip.extendmode= adt->act_extendmode; + dummy_strip.influence= adt->act_influence; + } /* add this to our list of evaluation strips */ nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime); -- cgit v1.2.3 From ad65cd59870df1e59a5960c7c355c2c888a8141a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 16 Oct 2010 05:07:33 +0000 Subject: Bugfix #24099: nla content moves out of sync - with fix Thanks Shane Ambler (sambler) for the patch! This kind of follows on from a report that I think was closed prematurely - #22775 - I can't find any reference to an outstanding todo that relates to it. When resizing the nla editor the channel names and the main area get out of sync. When toggling back from fullscreen the content is hidden off the top of the area requiring scrolling to see it. The dopesheet displays similar problems but after fixing the ui_view2d_sync call it appears to behave as if the v2d.keepofs has been set for the most part. Two areas seem to be related to this - the first is calls to UI_view2d_sync used for these two views use the wrong flags. The other is v2d.keepofs not being set. (dopesheet has less issue here but I think it is meant to be set the same as nla) --- source/blender/editors/space_action/action_draw.c | 4 ++-- source/blender/editors/space_action/space_action.c | 5 +++-- source/blender/editors/space_nla/nla_draw.c | 4 ++-- source/blender/editors/space_nla/space_nla.c | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index d2067790b2f..d9093c5db85 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -90,8 +90,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARe */ v2d->tot.ymin= (float)(-height); } - /* need to do a view-sync here, so that the keys area doesn't jump around */ - UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); + /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ + UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* loop through channels, and set up drawing depending on their type */ { /* first pass: just the standard GL-drawing for backdrop + text */ diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 01ae28a20d6..199d06ccb82 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -101,16 +101,17 @@ static SpaceLink *action_new(const bContext *C) ar->v2d.cur = ar->v2d.tot; ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; + ar->v2d.min[1]= 0.0f; ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= FLT_MAX; + ar->v2d.max[1]= FLT_MAX; ar->v2d.minzoom= 0.01f; ar->v2d.maxzoom= 50; ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom= V2D_LOCKZOOM_Y; + ar->v2d.keepofs= V2D_KEEPOFS_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index ef9c46c8042..7df9db11472 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -477,8 +477,6 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); - /* need to do a view-sync here, so that the strips area doesn't jump around */ - UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); /* loop through channels, and set up drawing depending on their type */ y= (float)(-NLACHANNEL_HEIGHT); @@ -837,6 +835,8 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegi * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); + /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ + UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* draw channels */ { /* first pass: backdrops + oldstyle drawing */ diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 2ae47ddbc7f..ad6e183995f 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -148,16 +148,17 @@ static SpaceLink *nla_new(const bContext *C) ar->v2d.cur = ar->v2d.tot; ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; + ar->v2d.min[1]= 0.0f; ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= 10000.0f; + ar->v2d.max[1]= 10000.0f; ar->v2d.minzoom= 0.01f; ar->v2d.maxzoom= 50; ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom= V2D_LOCKZOOM_Y; + ar->v2d.keepofs= V2D_KEEPOFS_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; -- cgit v1.2.3 From 03e6bb7ede4ac5e45ba8db7233ba775a07b27ced Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 05:12:31 +0000 Subject: patch for bug [#24253] r32218 breaks outliner icon drawing provided by Shane Ambler (sambler) with some changes. --- source/blender/editors/interface/interface_icons.c | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index cbd4939b1b1..2da54b492e6 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -843,7 +843,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple prv_img->w[miplevel], prv_img->h[miplevel]); } -static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb) +static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview) { /* modulate color */ if(alpha != 1.0f) @@ -855,6 +855,11 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), glPixelTransferf(GL_BLUE_SCALE, rgb[2]); } + if(is_preview == 0) { + /* position */ + glRasterPos2f(x,y); + } + /* draw */ if((w<1 || h<1)) { // XXX - TODO 2.5 verify whether this case can happen @@ -876,13 +881,25 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), /* scale it */ IMB_scaleImBuf(ima, w, h); - glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); - + + if(is_preview) { + glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); + } + else { + glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); + } + IMB_freeImBuf(ima); } } - else - glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + else { + if(is_preview) { + glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + else { + glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + } /* restore color */ if(alpha != 0.0f) @@ -938,7 +955,7 @@ static int preview_size(int miplevel) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate)) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview) { Icon *icon = NULL; DrawInfo *di = NULL; @@ -981,7 +998,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al if(!iimg->rect) return; /* something has gone wrong! */ - icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb); + icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview); } else if(di->type == ICON_TYPE_PREVIEW) { PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj); @@ -992,7 +1009,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al /* preview images use premul alpha ... */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL); + icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } } @@ -1082,7 +1099,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview) static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate) { int draw_size = preview_size(miplevel); - icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate); + icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE); } void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha) @@ -1093,7 +1110,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb) { int draw_size = preview_size(PREVIEW_MIPMAP_ZERO); - icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0); + icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE); } void UI_icon_draw(float x, float y, int icon_id) @@ -1103,7 +1120,7 @@ void UI_icon_draw(float x, float y, int icon_id) void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha) { - icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1); + icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE); } void UI_icon_draw_preview(float x, float y, int icon_id) @@ -1118,6 +1135,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect) void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size) { - icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, 0); + icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE); } -- cgit v1.2.3 From e5fbd93cecc8527467cfe33a4c74a252c3d39828 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 08:03:28 +0000 Subject: editors/space_* build without unused args warnings --- source/blender/blenkernel/BKE_sequencer.h | 2 +- source/blender/blenkernel/intern/anim_sys.c | 10 +- source/blender/blenkernel/intern/sequencer.c | 4 +- source/blender/editors/space_action/action_draw.c | 2 +- .../blender/editors/space_action/action_intern.h | 2 +- source/blender/editors/space_action/space_action.c | 11 +- source/blender/editors/space_api/spacetypes.c | 11 +- .../editors/space_buttons/buttons_context.c | 16 +- .../blender/editors/space_buttons/buttons_header.c | 3 +- .../blender/editors/space_buttons/space_buttons.c | 6 +- source/blender/editors/space_file/file_draw.c | 4 +- source/blender/editors/space_file/file_ops.c | 2 +- source/blender/editors/space_file/file_panels.c | 4 +- source/blender/editors/space_file/filelist.c | 6 +- source/blender/editors/space_file/filesel.c | 4 +- source/blender/editors/space_file/space_file.c | 8 +- source/blender/editors/space_file/writeimage.c | 8 +- source/blender/editors/space_graph/graph_draw.c | 52 ++--- source/blender/editors/space_graph/graph_edit.c | 2 +- source/blender/editors/space_graph/graph_intern.h | 4 +- source/blender/editors/space_graph/graph_select.c | 4 +- source/blender/editors/space_graph/space_graph.c | 9 +- source/blender/editors/space_info/space_info.c | 14 +- source/blender/editors/space_logic/logic_buttons.c | 2 +- source/blender/editors/space_logic/logic_window.c | 36 ++-- source/blender/editors/space_logic/space_logic.c | 14 +- source/blender/editors/space_nla/nla_buttons.c | 10 +- source/blender/editors/space_nla/nla_draw.c | 10 +- source/blender/editors/space_nla/nla_edit.c | 4 +- source/blender/editors/space_nla/nla_intern.h | 2 +- source/blender/editors/space_nla/nla_ops.c | 4 +- source/blender/editors/space_nla/space_nla.c | 7 +- source/blender/editors/space_node/node_buttons.c | 4 +- source/blender/editors/space_node/node_header.c | 2 +- source/blender/editors/space_node/node_state.c | 6 +- source/blender/editors/space_node/space_node.c | 10 +- source/blender/editors/space_outliner/outliner.c | 233 +++++++++++---------- .../editors/space_outliner/space_outliner.c | 12 +- .../blender/editors/space_script/script_header.c | 8 +- source/blender/editors/space_script/space_script.c | 8 +- .../editors/space_sequencer/sequencer_buttons.c | 6 +- .../editors/space_sequencer/sequencer_draw.c | 22 +- .../editors/space_sequencer/sequencer_edit.c | 40 ++-- .../editors/space_sequencer/sequencer_select.c | 2 +- .../editors/space_sequencer/space_sequencer.c | 12 +- source/blender/editors/space_sound/sound_header.c | 7 +- source/blender/editors/space_sound/space_sound.c | 12 +- source/blender/editors/space_text/space_text.c | 10 +- source/blender/editors/space_text/text_draw.c | 10 +- source/blender/editors/space_text/text_intern.h | 2 +- source/blender/editors/space_text/text_ops.c | 18 +- source/blender/editors/space_text/text_python.c | 14 +- source/blender/editors/space_time/space_time.c | 24 +-- .../editors/space_userpref/space_userpref.c | 17 +- source/blender/editors/space_view3d/view3d_edit.c | 1 - source/blender/makesrna/intern/rna_sequencer.c | 6 +- source/blender/render/intern/source/pipeline.c | 2 +- 57 files changed, 378 insertions(+), 387 deletions(-) diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 252c9fee8f7..8cf541ae03a 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -156,7 +156,7 @@ void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, i void calc_sequence(struct Scene *scene, struct Sequence *seq); void calc_sequence_disp(struct Scene *scene, struct Sequence *seq); void new_tstripdata(struct Sequence *seq); -void reload_sequence_new_file(struct Main *bmain, struct Scene *scene, struct Sequence * seq, int lock_range); +void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range); void sort_seq(struct Scene *scene); void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq, int (*test_func)(struct Sequence * seq)); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index ea0b2945821..22f5ac181f1 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -565,7 +565,7 @@ void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newNa /* Find the first path that matches the given criteria */ // TODO: do we want some method to perform partial matches too? -KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode) +KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode)) { KS_Path *ksp; @@ -767,7 +767,7 @@ void BKE_keyingsets_free (ListBase *list) * - path: original path string (as stored in F-Curve data) * - dst: destination string to write data to */ -static short animsys_remap_path (AnimMapper *remap, char *path, char **dst) +static short animsys_remap_path (AnimMapper *UNUSED(remap), char *path, char **dst) { /* is there a valid remapping table to use? */ //if (remap) { @@ -1693,7 +1693,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* Clear all overides */ /* Add or get existing Override for given setting */ -AnimOverride *BKE_animsys_validate_override (PointerRNA *ptr, char *path, int array_index) +AnimOverride *BKE_animsys_validate_override (PointerRNA *UNUSED(ptr), char *UNUSED(path), int UNUSED(array_index)) { // FIXME: need to define how to get overrides return NULL; @@ -1702,7 +1702,7 @@ AnimOverride *BKE_animsys_validate_override (PointerRNA *ptr, char *path, int ar /* -------------------- */ /* Evaluate Overrides */ -static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt, float ctime) +static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt) { AnimOverride *aor; @@ -1801,7 +1801,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re * - Overrides are cleared upon frame change and/or keyframing * - It is best that we execute this everytime, so that no errors are likely to occur. */ - animsys_evaluate_overrides(&id_ptr, adt, ctime); + animsys_evaluate_overrides(&id_ptr, adt); /* clear recalc flag now */ adt->recalc= 0; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 040ca832a80..dcd411409f9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -554,7 +554,7 @@ void calc_sequence(Scene *scene, Sequence *seq) } /* note: caller should run calc_sequence(scene, seq) after */ -void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int lock_range) +void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) { char str[FILE_MAXDIR+FILE_MAXFILE]; int prev_startdisp, prev_enddisp; @@ -621,7 +621,7 @@ void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int loc seq->strip->len = seq->len; } else if (seq->type == SEQ_SCENE) { /* 'seq->scenenr' should be replaced with something more reliable */ - Scene * sce = bmain->scene.first; + Scene * sce = G.main->scene.first; int nr = 1; while(sce) { diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index d9093c5db85..ce9a96af38c 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -63,7 +63,7 @@ /* Channel List */ /* left hand part */ -void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar) +void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index b02e95ac138..cc363b76479 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -41,7 +41,7 @@ struct bAnimListElem; /* ***************************************** */ /* action_draw.c */ -void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); +void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 199d06ccb82..bb3b40fbf9b 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -119,7 +119,7 @@ static SpaceLink *action_new(const bContext *C) } /* not spacelink itself */ -static void action_free(SpaceLink *sl) +static void action_free(SpaceLink *UNUSED(sl)) { // SpaceAction *saction= (SpaceAction*) sl; @@ -127,7 +127,7 @@ static void action_free(SpaceLink *sl) /* spacetype; init callback */ -static void action_init(struct wmWindowManager *wm, ScrArea *sa) +static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceAction *saction = sa->spacedata.first; saction->flag |= SACTION_TEMP_NEEDCHANSYNC; @@ -220,7 +220,6 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar) static void action_channel_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceAction *saction= CTX_wm_space_action(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -233,7 +232,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_channel_names((bContext *)C, &ac, saction, ar); + draw_channel_names((bContext *)C, &ac, ar); } /* reset view matrix */ @@ -247,7 +246,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* add handlers, stuff you only do once or on area/region changes */ -static void action_header_area_init(wmWindowManager *wm, ARegion *ar) +static void action_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -418,7 +417,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn) static void action_refresh(const bContext *C, ScrArea *sa) { - SpaceAction *saction= CTX_wm_space_action(C); + SpaceAction *saction= (SpaceAction *)sa->spacedata.first; /* update the state of the animchannels in response to changes from the data they represent * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 2140c59da67..0d0d3713723 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -30,6 +30,7 @@ #include "DNA_object_types.h" #include "DNA_windowmanager_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" @@ -224,19 +225,19 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type) /* ********************* space template *********************** */ /* allocate and init some vars */ -static SpaceLink *xxx_new(const bContext *C) +static SpaceLink *xxx_new(const bContext *UNUSED(C)) { return NULL; } /* not spacelink itself */ -static void xxx_free(SpaceLink *sl) +static void xxx_free(SpaceLink *UNUSED(sl)) { } /* spacetype; init callback for usage, should be redoable */ -static void xxx_init(wmWindowManager *wm, ScrArea *sa) +static void xxx_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { /* link area to SpaceXXX struct */ @@ -246,7 +247,7 @@ static void xxx_init(wmWindowManager *wm, ScrArea *sa) /* add types to regions */ } -static SpaceLink *xxx_duplicate(SpaceLink *sl) +static SpaceLink *xxx_duplicate(SpaceLink *UNUSED(sl)) { return NULL; @@ -257,7 +258,7 @@ static void xxx_operatortypes(void) /* register operator types for this space */ } -static void xxx_keymap(wmKeyConfig *keyconf) +static void xxx_keymap(wmKeyConfig *UNUSED(keyconf)) { /* add default items to keymap */ } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 343237dee5e..2d16bb6bc81 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -323,7 +323,7 @@ static int buttons_context_path_particle(ButsContextPath *path) return 0; } -static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) +static int buttons_context_path_brush(ButsContextPath *path) { Scene *scene; Brush *br= NULL; @@ -352,7 +352,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) return 0; } -static int buttons_context_path_texture(const bContext *C, ButsContextPath *path) +static int buttons_context_path_texture(ButsContextPath *path) { Material *ma; Lamp *la; @@ -367,7 +367,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path return 1; } /* try brush */ - if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(C, path)) { + if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -416,7 +416,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path } /* try brushes again in case of no material, lamp, etc */ path->len = orig_len; - if(buttons_context_path_brush(C, path)) { + if(buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -485,7 +485,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found= buttons_context_path_material(path); break; case BCONTEXT_TEXTURE: - found= buttons_context_path_texture(C, path); + found= buttons_context_path_texture(path); break; case BCONTEXT_BONE: found= buttons_context_path_bone(path); @@ -515,7 +515,7 @@ static int buttons_shading_context(const bContext *C, int mainb) return 0; } -static int buttons_shading_new_context(const bContext *C, int flag, int mainb) +static int buttons_shading_new_context(const bContext *C, int flag) { Object *ob= CTX_data_active_object(C); @@ -568,7 +568,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) if((flag & (1 << sbuts->mainb)) == 0) { if(sbuts->flag & SB_SHADING_CONTEXT) { /* try to keep showing shading related buttons */ - sbuts->mainb= buttons_shading_new_context(C, flag, sbuts->mainb); + sbuts->mainb= buttons_shading_new_context(C, flag); } else if(flag & BCONTEXT_OBJECT) { sbuts->mainb= BCONTEXT_OBJECT; @@ -821,7 +821,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /************************* Drawing the Path ************************/ -static void pin_cb(bContext *C, void *arg1, void *arg2) +static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceButs *sbuts= CTX_wm_space_buts(C); diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index ab756b638fa..9071d9f27d9 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -33,6 +33,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -50,7 +51,7 @@ #define B_CONTEXT_SWITCH 101 #define B_BUTSPREVIEW 102 -static void do_buttons_buttons(bContext *C, void *arg, int event) +static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) { SpaceButs *sbuts= CTX_wm_space_buts(C); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 5927a7473e2..44138119f7a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for buttons space ***************** */ -static SpaceLink *buttons_new(const bContext *C) +static SpaceLink *buttons_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceButs *sbuts; @@ -103,7 +103,7 @@ static void buttons_free(SpaceLink *sl) } /* spacetype; init callback */ -static void buttons_init(struct wmWindowManager *wm, ScrArea *sa) +static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceButs *sbuts= sa->spacedata.first; @@ -191,7 +191,7 @@ void buttons_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar) +static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 0f627bda3dc..421b14e5bbe 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -79,7 +79,7 @@ enum { } eFile_ButEvents; -static void do_file_buttons(bContext *C, void *arg, int event) +static void do_file_buttons(bContext *C, void *UNUSED(arg), int event) { switch(event) { case B_FS_FILENAME: @@ -433,7 +433,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int } } -static void renamebutton_cb(bContext *C, void *arg1, char *oldname) +static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) { char newname[FILE_MAX+12]; char orgname[FILE_MAX+12]; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 5184e6b7fc0..6dfdcfd430a 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -613,7 +613,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) /* XXX, files and dirs updates missing, not really so important though */ } -void file_draw_check_cb(bContext *C, void *dummy1, void *dummy2) +void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceFile *sfile= CTX_wm_space_file(C); wmOperator *op= sfile->op; diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 33d740e18a6..9096b9eed27 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -49,7 +49,7 @@ #include -static void file_panel_cb(bContext *C, void *arg_entry, void *arg_unused) +static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v)) { PointerRNA ptr; char *entry= (char*)arg_entry; @@ -151,7 +151,7 @@ static void file_panel_recent(const bContext *C, Panel *pa) } -static int file_panel_operator_poll(const bContext *C, PanelType *pt) +static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceFile *sfile= CTX_wm_space_file(C); return (sfile && sfile->op); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index eba0df9f963..1b997ade956 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -295,7 +295,7 @@ static int is_hidden_file(const char* filename, short hide_dot) return is_hidden; } -static int is_filtered_file(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsigned int filter, short hide_dot) { int is_filtered=0; if (filter) { @@ -324,7 +324,7 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int return is_filtered; } -static int is_filtered_main(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +static int is_filtered_main(struct direntry* file, const char* UNUSED(dir), unsigned int UNUSED(filter), short hide_dot) { return !is_hidden_file(file->relname, hide_dot); } @@ -1145,7 +1145,7 @@ static void thumbnail_joblist_free(ThumbnailJob *tj) BLI_freelistN(&tj->loadimages); } -static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *progress) +static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *UNUSED(progress)) { ThumbnailJob *tj= tjv; FileImage* limg = tj->loadimages.first; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 7192870bcc8..b36cfe66a36 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -463,7 +463,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern) return match; } -void autocomplete_directory(struct bContext *C, char *str, void *arg_v) +void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -510,7 +510,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *arg_v) } } -void autocomplete_file(struct bContext *C, char *str, void *arg_v) +void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile= CTX_wm_space_file(C); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 52805c39816..92244165dc1 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -66,7 +66,7 @@ /* ******************** default callbacks for file space ***************** */ -static SpaceLink *file_new(const bContext *C) +static SpaceLink *file_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceFile *sfile; @@ -143,7 +143,7 @@ static void file_free(SpaceLink *sl) /* spacetype; init callback, area size changes, screen set, etc */ -static void file_init(struct wmWindowManager *wm, ScrArea *sa) +static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceFile *sfile= (SpaceFile*)sa->spacedata.first; //printf("file_init\n"); @@ -178,7 +178,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl) return (SpaceLink *)sfilen; } -static void file_refresh(const bContext *C, ScrArea *sa) +static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) { SpaceFile *sfile= CTX_wm_space_file(C); FileSelectParams *params = ED_fileselect_get_params(sfile); @@ -457,7 +457,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void file_channel_area_listener(ARegion *ar, wmNotifier *wmn) +static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn) { /* context changes */ switch(wmn->category) { diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index b69bfdc0231..1277ad9d69c 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -48,10 +48,10 @@ #include "file_intern.h" /* XXX */ -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {} -static int saveover(const char *dummy) {return 0;} +static void error(const char *UNUSED(dummy)) {} +static void waitcursor(int UNUSED(val)) {} +static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {} +static int saveover(const char *UNUSED(dummy)) {return 0;} /* XXX */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index f780a6c31ee..01a8ba4797c 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -87,7 +87,7 @@ /* Envelope -------------- */ // TODO: draw a shaded poly showing the region of influence too!!! -static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, View2D *v2d) +static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; @@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, /* Points ---------------- */ /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_vertices_keyframes (bAnimContext *ac, FCurve *fcu, View2D *v2d, short edit, short sel) +static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel) { BezTriple *bezt= fcu->bezt; const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin); @@ -209,7 +209,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys } /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ -static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel) +static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only) { BezTriple *bezt= fcu->bezt; BezTriple *prevbezt = NULL; @@ -237,7 +237,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur * Also, need to take into account whether the keyframe was selected * if a Graph Editor option to only show handles of selected keys is on. */ - if ( !(sipo->flag & SIPO_SELVHANDLESONLY) || BEZSELECTED(bezt) ) { + if ( !sel_handle_only || BEZSELECTED(bezt) ) { if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize); @@ -255,7 +255,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur } /* helper func - set color to draw F-Curve data with */ -static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) +static void set_fcurve_vertex_color (FCurve *fcu, short sel) { /* Fade the 'intensity' of the vertices based on the selection of the curves too */ int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255); @@ -274,7 +274,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) } -static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles) +static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only) { View2D *v2d= &ar->v2d; @@ -290,19 +290,19 @@ static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */ if (do_handles) { - set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0); + set_fcurve_vertex_color(fcu, 0); + draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only); - set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 1); + set_fcurve_vertex_color(fcu, 1); + draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only); } /* draw keyframes over the handles */ - set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); + set_fcurve_vertex_color(fcu, 0); + draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); - set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); + set_fcurve_vertex_color(fcu, 1); + draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); glPointSize(1.0f); } @@ -329,7 +329,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) /* draw lines for F-Curve handles only (this is only done in EditMode) * note: draw_fcurve_handles_check must be checked before running this. */ -static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) { int sel, b; @@ -455,7 +455,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys } /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_samples (ARegion *ar, FCurve *fcu) { FPoint *first, *last; float hsize, xscale, yscale; @@ -489,7 +489,7 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* Curve ---------------- */ /* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */ -static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) { ChannelDriver *driver; float samplefreq, ctime; @@ -627,7 +627,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi } /* helper func - draw one repeat of an F-Curve */ -static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d) { BezTriple *prevbezt= fcu->bezt; BezTriple *bezt= prevbezt+1; @@ -784,7 +784,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View /* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) * NOTE: unit mapping has already been applied to the values, so do not try and apply again */ -void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid) +void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) { FCurve *fcu; @@ -878,12 +878,12 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* draw a curve affected by modifiers or only allowed to have integer values * by sampling it at various small-intervals over the visible region */ - draw_fcurve_curve(ac, ale->id, fcu, sipo, &ar->v2d, grid); + draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid); } else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { /* just draw curve based on defined data (i.e. no modifiers) */ if (fcu->bezt) - draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, grid); + draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d); else if (fcu->fpt) draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d); } @@ -904,7 +904,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { switch (fcm->type) { case FMODIFIER_TYPE_ENVELOPE: /* envelope */ - draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d); + draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d); break; } } @@ -919,15 +919,15 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri if (do_handles) { /* only draw handles/vertices on keyframes */ glEnable(GL_BLEND); - draw_fcurve_handles(ac, sipo, ar, fcu); + draw_fcurve_handles(sipo, fcu); glDisable(GL_BLEND); } - draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles); + draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY); } else { /* samples: only draw two indicators at either end as indicators */ - draw_fcurve_samples(ac, sipo, ar, fcu); + draw_fcurve_samples(ar, fcu); } /* unapply unit mapping */ @@ -948,7 +948,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* Channel List */ /* left hand part */ -void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) +void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 46e7840cec8..e1d1e4194d5 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1001,7 +1001,7 @@ typedef struct tSoundBakeInfo { /* Sampling callback used to determine the value from the sound to * save in the F-Curve at the specified frame */ -static float fcurve_samplingcb_sound (FCurve *fcu, void *data, float evaltime) +static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float evaltime) { tSoundBakeInfo *sbi= (tSoundBakeInfo *)data; diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index a637ed15fcd..560dabbb634 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -48,10 +48,10 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa); /* ***************************************** */ /* graph_draw.c */ -void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); +void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel); -void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid); +void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); /* ***************************************** */ /* graph_header.c */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 9dd499a2cbf..0aa0a87dbac 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -886,7 +886,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBa } /* helper for find_nearest_fcurve_vert() - get the best match to use */ -static tNearestVertInfo *get_best_nearest_fcurve_vert (bAnimContext *ac, ListBase *matches) +static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches) { tNearestVertInfo *nvi = NULL; short found = 0; @@ -941,7 +941,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2] get_nearest_fcurve_verts_list(ac, mval, &matches); /* step 2: find the best vert */ - nvi= get_best_nearest_fcurve_vert(ac, &matches); + nvi= get_best_nearest_fcurve_vert(&matches); BLI_freelistN(&matches); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 994d9725762..ff2d233ccdb 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -175,7 +175,7 @@ static void graph_free(SpaceLink *sl) /* spacetype; init callback */ -static void graph_init(struct wmWindowManager *wm, ScrArea *sa) +static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first; @@ -239,7 +239,7 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) /* draw data */ if (ANIM_animdata_get_context(C, &ac)) { /* draw ghost curves */ - graph_draw_ghost_curves(&ac, sipo, ar, grid); + graph_draw_ghost_curves(&ac, sipo, ar); /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */ graph_draw_curves(&ac, sipo, ar, grid, 0); @@ -314,7 +314,6 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar) static void graph_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceIpo *sipo= CTX_wm_space_graph(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -329,7 +328,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) /* draw channels */ if (ANIM_animdata_get_context(C, &ac)) { - graph_draw_channel_names((bContext*)C, &ac, sipo, ar); + graph_draw_channel_names((bContext*)C, &ac, ar); } /* reset view matrix */ @@ -342,7 +341,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void graph_header_area_init(wmWindowManager *wm, ARegion *ar) +static void graph_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 6799d9390d7..5173621d9c1 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for info space ***************** */ -static SpaceLink *info_new(const bContext *C) +static SpaceLink *info_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceInfo *sinfo; @@ -80,7 +80,7 @@ static SpaceLink *info_new(const bContext *C) } /* not spacelink itself */ -static void info_free(SpaceLink *sl) +static void info_free(SpaceLink *UNUSED(sl)) { // SpaceInfo *sinfo= (SpaceInfo*) sl; @@ -88,7 +88,7 @@ static void info_free(SpaceLink *sl) /* spacetype; init callback */ -static void info_init(struct wmWindowManager *wm, ScrArea *sa) +static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -105,11 +105,11 @@ static SpaceLink *info_duplicate(SpaceLink *sl) /* add handlers, stuff you only do once or on area/region changes */ -static void info_main_area_init(wmWindowManager *wm, ARegion *ar) +static void info_main_area_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(ar)) { } -static void info_main_area_draw(const bContext *C, ARegion *ar) +static void info_main_area_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar)) { /* clear and setup matrix */ @@ -137,7 +137,7 @@ void info_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void info_header_area_init(wmWindowManager *wm, ARegion *ar) +static void info_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -147,7 +147,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void info_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index 195bc5df3c7..e41627ad0a4 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -83,7 +83,7 @@ static void logic_panel_view_properties(const bContext *C, Panel *pa) } #endif -void logic_buttons_register(ARegionType *art) +void logic_buttons_register(ARegionType *UNUSED(art)) { #if 0 PanelType *pt; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 148bcf1459f..c8d6e960132 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -182,7 +182,7 @@ void make_unique_prop_names(bContext *C, char *str) MEM_freeN(names); } -static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view3d_flagv) +static void make_unique_prop_names_cb(bContext *C, void *strv, void *UNUSED(redraw_view3d_flagv)) { char *str= strv; // int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv); @@ -354,7 +354,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) } } -void do_logic_buts(bContext *C, void *arg, int event) +void do_logic_buts(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); bSensor *sens; @@ -964,7 +964,7 @@ static void set_col_sensor(int type, int medium) } -static void verify_logicbutton_func(bContext *C, void *data1, void *data2) +static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data2) { bSensor *sens= (bSensor*)data1; @@ -1017,7 +1017,7 @@ static void test_scenepoin_but(struct bContext *C, char *name, ID **idpp) id_us_plus(*idpp); } -static void test_keyboard_event(struct bContext *C, void *arg_ks, void *arg_unused) +static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *UNUSED(arg)) { bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks; @@ -1116,7 +1116,7 @@ static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens) check_armature_bone_constraint(ob, sens->posechannel, sens->constraint); } -static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname) +static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width) { bNearSensor *ns = NULL; bTouchSensor *ts = NULL; @@ -1734,7 +1734,7 @@ static void set_col_actuator(int item, int medium) } -static void change_object_actuator(bContext *C, void *act, void *arg) +static void change_object_actuator(bContext *UNUSED(C), void *act, void *UNUSED(arg)) { bObjectActuator *oa = act; @@ -1758,7 +1758,7 @@ static void change_object_actuator(bContext *C, void *act, void *arg) } } -static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia) +static void change_ipo_actuator(bContext *UNUSED(C), void *arg1_but, void *arg2_ia) { bIpoActuator *ia = arg2_ia; uiBut *but = arg1_but; @@ -1770,7 +1770,7 @@ static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia) but->retval = B_REDR; } -void update_object_actuator_PID(bContext *C, void *act, void *arg) +void update_object_actuator_PID(bContext *UNUSED(C), void *act, void *UNUSED(arg)) { bObjectActuator *oa = act; oa->forcerot[0] = 60.0f*oa->forcerot[1]; @@ -2920,7 +2920,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo return yco-4; } -static void do_sensor_menu(bContext *C, void *arg, int event) +static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -2949,7 +2949,7 @@ static void do_sensor_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int yco=0; @@ -2969,7 +2969,7 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_controller_menu(bContext *C, void *arg, int event) +static void do_controller_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -2998,7 +2998,7 @@ static void do_controller_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int yco=0; @@ -3018,7 +3018,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_actuator_menu(bContext *C, void *arg, int event) +static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -3047,7 +3047,7 @@ static void do_actuator_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int xco=0; @@ -3069,7 +3069,7 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused) -static void check_controller_state_mask(bContext *C, void *arg1_but, void *arg2_mask) +static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask) { unsigned int *cont_mask = arg2_mask; uiBut *but = arg1_but; @@ -3122,7 +3122,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c return block; } -static void do_object_state_menu(bContext *C, void *arg, int event) +static void do_object_state_menu(bContext *UNUSED(C), void *arg, int event) { Object *ob = arg; @@ -3579,7 +3579,7 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) } } -static void draw_controller_state(uiLayout *layout, PointerRNA *ptr) +static void draw_controller_state(uiLayout *UNUSED(layout), PointerRNA *UNUSED(ptr)) { } @@ -4955,7 +4955,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0); sens->otype= sens->type; - yco= draw_sensorbuttons(ob, sens, block, xco, yco, width,ob->id.name); + yco= draw_sensorbuttons(ob, sens, block, xco, yco, width); if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2; } else { diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 5af5b5ee6c0..9a3cac02c50 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -82,7 +82,7 @@ ARegion *logic_has_buttons_region(ScrArea *sa) /* ******************** default callbacks for image space ***************** */ -static SpaceLink *logic_new(const bContext *C) +static SpaceLink *logic_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceLogic *slogic; @@ -145,7 +145,7 @@ static SpaceLink *logic_new(const bContext *C) } /* not spacelink itself */ -static void logic_free(SpaceLink *sl) +static void logic_free(SpaceLink *UNUSED(sl)) { // Spacelogic *slogic= (SpaceLogic*) sl; @@ -156,7 +156,7 @@ static void logic_free(SpaceLink *sl) /* spacetype; init callback */ -static void logic_init(struct wmWindowManager *wm, ScrArea *sa) +static void logic_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -183,7 +183,7 @@ void logic_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0); } -static void logic_refresh(const bContext *C, ScrArea *sa) +static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa)) { // SpaceLogic *slogic= CTX_wm_space_logic(C); // Object *obedit= CTX_data_edit_object(C); @@ -217,11 +217,9 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn) } } -static int logic_context(const bContext *C, const char *member, bContextDataResult *result) +static int logic_context(const bContext *UNUSED(C), const char *UNUSED(member), bContextDataResult *UNUSED(result)) { // SpaceLogic *slogic= CTX_wm_space_logic(C); - - return 0; } @@ -287,7 +285,7 @@ static void logic_buttons_area_draw(const bContext *C, ARegion *ar) /************************* header region **************************/ /* add handlers, stuff you only do once or on area/region changes */ -static void logic_header_area_init(wmWindowManager *wm, ARegion *ar) +static void logic_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index ef91fc56bec..49cd09043c2 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -66,7 +66,7 @@ /* -------------- */ -static void do_nla_region_buttons(bContext *C, void *arg, int event) +static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event) { //Scene *scene= CTX_data_scene(C); @@ -172,25 +172,25 @@ static int nla_panel_poll(const bContext *C, PanelType *pt) } #endif -static int nla_animdata_panel_poll(const bContext *C, PanelType *pt) +static int nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL)); } -static int nla_track_panel_poll(const bContext *C, PanelType *pt) +static int nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL)); } -static int nla_strip_panel_poll(const bContext *C, PanelType *pt) +static int nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL)); } -static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt) +static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; NlaStrip *strip; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 7df9db11472..98550b7e452 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -219,7 +219,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co } /* helper call for drawing influence/time control curves for a given NLA-strip */ -static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc) { const float yheight = ymaxc - yminc; @@ -280,7 +280,7 @@ static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, fl } /* main call for drawing a single NLA-strip */ -static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) { float color[3]; @@ -351,7 +351,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr * - only if user hasn't hidden them... */ if ((snla->flag & SNLA_NOSTRIPCURVES) == 0) - nla_draw_strip_curves(strip, v2d, yminc, ymaxc); + nla_draw_strip_curves(strip, yminc, ymaxc); /* draw strip outline * - color used here is to indicate active vs non-active @@ -414,7 +414,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr } /* add the relevant text to the cache of text-strings to draw in pixelspace */ -static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNUSED(index), View2D *v2d, float yminc, float ymaxc) { char str[256], dir[3]; rctf rect; @@ -810,7 +810,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie } } -void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar) +void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index f2e83f4168e..e13a229fdd1 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -810,7 +810,7 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip } /* split a given Meta strip */ -static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *strip) +static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip) { /* simply ungroup it for now... */ BKE_nlastrips_clear_metastrip(&nlt->strips, strip); @@ -852,7 +852,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op)) break; case NLASTRIP_TYPE_META: /* meta-strips need special handling */ - nlaedit_split_strip_meta(adt, nlt, strip); + nlaedit_split_strip_meta(nlt, strip); break; default: /* for things like Transitions, do not split! */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 7570969158b..6906a151936 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -45,7 +45,7 @@ void NLA_OT_properties(wmOperatorType *ot); /* nla_draw.c */ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar); -void draw_nla_channel_list(bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar); +void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar); /* **************************************** */ /* nla_header.c */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 85a169f2bb0..13380cd17f7 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -156,7 +156,7 @@ void nla_operatortypes(void) /* ************************** registration - keymaps **********************************/ -static void nla_keymap_channels (wmKeyConfig *keyconf, wmKeyMap *keymap) +static void nla_keymap_channels(wmKeyMap *keymap) { /* NLA-specific (different to standard channels keymap) -------------------------- */ /* selection */ @@ -287,7 +287,7 @@ void nla_keymap(wmKeyConfig *keyconf) * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead */ keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0); - nla_keymap_channels(keyconf, keymap); + nla_keymap_channels(keymap); /* data */ keymap= WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index ad6e183995f..25c53687597 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -178,7 +178,7 @@ static void nla_free(SpaceLink *sl) /* spacetype; init callback */ -static void nla_init(struct wmWindowManager *wm, ScrArea *sa) +static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceNla *snla= (SpaceNla *)sa->spacedata.first; @@ -219,7 +219,6 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar) /* draw entirely, view changes should be handled here */ static void nla_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceNla *snla= CTX_wm_space_nla(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -232,7 +231,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_nla_channel_list((bContext *)C, &ac, snla, ar); + draw_nla_channel_list((bContext *)C, &ac, ar); } /* reset view matrix */ @@ -316,7 +315,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) /* add handlers, stuff you only do once or on area/region changes */ -static void nla_header_area_init(wmWindowManager *wm, ARegion *ar) +static void nla_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index ca42193bff6..954018bfd4f 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -63,7 +63,7 @@ #define B_NOP 1 #define B_REDR 2 -static void do_node_region_buttons(bContext *C, void *arg, int event) +static void do_node_region_buttons(bContext *C, void *UNUSED(arg), int event) { //SpaceNode *snode= CTX_wm_space_node(C); @@ -75,7 +75,7 @@ static void do_node_region_buttons(bContext *C, void *arg, int event) } /* poll callback for active node */ -static int active_node_poll(const bContext *C, PanelType *pt) +static int active_node_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode= CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index f22ff1515c5..64e4bc4cbc8 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -55,7 +55,7 @@ /* ************************ add menu *********************** */ -static void do_node_add(bContext *C, void *arg, int event) +static void do_node_add(bContext *C, void *UNUSED(arg), int event) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index d426ee17af7..48801d4369d 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -140,7 +140,7 @@ static int do_header_node(SpaceNode *snode, bNode *node, float mx, float my) return 0; } -static int do_header_hidden_node(SpaceNode *snode, bNode *node, float mx, float my) +static int do_header_hidden_node(bNode *node, float mx, float my) { rctf totr= node->totr; @@ -164,7 +164,7 @@ static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval) for(next_node(snode->edittree); (node=next_node(NULL));) { if(node->flag & NODE_HIDDEN) { - if(do_header_hidden_node(snode, node, mx, my)) { + if(do_header_hidden_node(node, mx, my)) { ED_region_tag_redraw(ar); return 1; } @@ -227,7 +227,7 @@ void NODE_OT_visibility_toggle(wmOperatorType *ot) /* **************** View All Operator ************** */ -static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) +static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode) { bNode *node; rctf *cur, *tot; diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 2d7cde37ec4..d38e2af734b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -89,7 +89,7 @@ ARegion *node_has_buttons_region(ScrArea *sa) /* ******************** default callbacks for node space ***************** */ -static SpaceLink *node_new(const bContext *C) +static SpaceLink *node_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceNode *snode; @@ -145,14 +145,14 @@ static SpaceLink *node_new(const bContext *C) } /* not spacelink itself */ -static void node_free(SpaceLink *sl) +static void node_free(SpaceLink *UNUSED(sl)) { } /* spacetype; init callback */ -static void node_init(struct wmWindowManager *wm, ScrArea *sa) +static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -306,7 +306,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int node_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -345,7 +345,7 @@ static void node_dropboxes(void) /* add handlers, stuff you only do once or on area/region changes */ -static void node_header_area_init(wmWindowManager *wm, ARegion *ar) +static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index c7e3340ba87..6040b755e30 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -120,7 +120,7 @@ /* ************* XXX **************** */ -static void error(const char *dummy, ...) {} +static void error(const char *UNUSED(arg), ...) {} /* ********************************** */ @@ -1556,7 +1556,7 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short /* same check needed for both object operation and restrict column button func * return 0 when in edit mode (cannot restrict view or select) * otherwise return 1 */ -static int common_restrict_check(bContext *C, Scene *scene, Object *ob) +static int common_restrict_check(bContext *C, Object *ob) { /* Don't allow hide an object in edit mode, * check the bug #22153 and #21609, #23977 @@ -1575,13 +1575,13 @@ static int common_restrict_check(bContext *C, Scene *scene, Object *ob) return 1; } -void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; Object *ob = (Object *)tselem->id; /* add check for edit mode */ - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; if(base || (base= object_in_scene(ob, scene))) { if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) { @@ -1620,7 +1620,7 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot) /* --- */ -static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -1658,7 +1658,7 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -1820,6 +1820,8 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot) RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep."); } +/* This is not used anywhere at the moment */ +#if 0 /* return 1 when levels were opened */ static int outliner_open_back(SpaceOops *soops, TreeElement *te) { @@ -1836,8 +1838,6 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te) return retval; } -/* This is not used anywhere at the moment */ -#if 0 static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *teFind, int *found) { TreeElement *te; @@ -1863,7 +1863,7 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te #endif // XXX just use View2D ops for this? -void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up) +void outliner_page_up_down(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int up) { int dy= ar->v2d.mask.ymax-ar->v2d.mask.ymin; @@ -2056,7 +2056,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo } -static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set) { Object *ob; @@ -2204,7 +2204,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, /* ebones only draw in editmode armature */ -static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { EditBone *ebone= te->directdata; @@ -2229,7 +2229,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2242,7 +2242,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreE return 0; } -static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2255,7 +2255,7 @@ static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2267,7 +2267,7 @@ static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStor return 0; } -static int tree_element_active_text(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops), TreeElement *UNUSED(te), int UNUSED(set)) { // XXX removed return 0; @@ -2292,7 +2292,7 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree return 0; } -static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; Base *base= object_in_scene(ob, scene); @@ -2312,7 +2312,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq= (Sequence*) te->directdata; @@ -2326,7 +2326,7 @@ static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreE return(0); } -static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq, *p; Editing *ed= seq_give_editing(scene, FALSE); @@ -2353,7 +2353,7 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme return(0); } -static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { wmKeyMapItem *kmi= te->directdata; @@ -2398,9 +2398,9 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, case TSE_POSEGRP: return tree_element_active_posegroup(C, scene, te, tselem, set); case TSE_SEQUENCE: - return tree_element_active_sequence(C, te, tselem, set); + return tree_element_active_sequence(te, tselem, set); case TSE_SEQUENCE_DUP: - return tree_element_active_sequence_dup(C, scene, te, tselem, set); + return tree_element_active_sequence_dup(scene, te, tselem, set); case TSE_KEYMAP_ITEM: return tree_element_active_keymap_item(C, te, tselem, set); @@ -2687,39 +2687,6 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot) ot->poll= ED_operator_outliner_active; } - - -/* recursive helper for function below */ -static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) -{ - TreeStoreElem *tselem= TREESTORE(te); - - /* store coord and continue, we need coordinates for elements outside view too */ - te->xs= (float)startx; - te->ys= (float)(*starty); - *starty-= OL_H; - - if((tselem->flag & TSE_CLOSED)==0) { - TreeElement *ten; - for(ten= te->subtree.first; ten; ten= ten->next) { - outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); - } - } - -} - -/* to retrieve coordinates with redrawing the entire tree */ -static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) -{ - TreeElement *te; - int starty= (int)(ar->v2d.tot.ymax)-OL_H; - int startx= 0; - - for(te= soops->tree.first; te; te= te->next) { - outliner_set_coordinates_element(soops, te, startx, &starty); - } -} - static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) { TreeElement *te, *tes; @@ -2789,6 +2756,66 @@ void OUTLINER_OT_show_active(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/* tse is not in the treestore, we use its contents to find a match */ +static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) +{ + TreeStore *ts= soops->treestore; + TreeStoreElem *tselem; + int a; + + if(tse->id==NULL) return NULL; + + /* check if 'tse' is in treestore */ + tselem= ts->data; + for(a=0; ausedelem; a++, tselem++) { + if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if(tselem->id==tse->id) { + break; + } + } + } + if(tselem) + return outliner_find_tree_element(&soops->tree, a); + + return NULL; +} + + +/* Called to find an item based on name. + */ +#if 0 + +/* recursive helper for function below */ +static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) +{ + TreeStoreElem *tselem= TREESTORE(te); + + /* store coord and continue, we need coordinates for elements outside view too */ + te->xs= (float)startx; + te->ys= (float)(*starty); + *starty-= OL_H; + + if((tselem->flag & TSE_CLOSED)==0) { + TreeElement *ten; + for(ten= te->subtree.first; ten; ten= ten->next) { + outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); + } + } + +} + +/* to retrieve coordinates with redrawing the entire tree */ +static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) +{ + TreeElement *te; + int starty= (int)(ar->v2d.tot.ymax)-OL_H; + int startx= 0; + + for(te= soops->tree.first; te; te= te->next) { + outliner_set_coordinates_element(soops, te, startx, &starty); + } +} + /* find next element that has this name */ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound) { @@ -2818,34 +2845,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na return NULL; } -/* tse is not in the treestore, we use its contents to find a match */ -static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) -{ - TreeStore *ts= soops->treestore; - TreeStoreElem *tselem; - int a; - - if(tse->id==NULL) return NULL; - - /* check if 'tse' is in treestore */ - tselem= ts->data; - for(a=0; ausedelem; a++, tselem++) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { - if(tselem->id==tse->id) { - break; - } - } - } - if(tselem) - return outliner_find_tree_element(&soops->tree, a); - - return NULL; -} - - -/* Called to find an item based on name. - */ -void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, int flags) +static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags) { TreeElement *te= NULL; TreeElement *last_find; @@ -2917,6 +2917,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, error("Not found: %s", name); } } +#endif /* helper function for tree_element_shwo_hierarchy() - recursively checks whether subtrees have any objects*/ static int subtree_has_objects(SpaceOops *soops, ListBase *lb) @@ -3077,7 +3078,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, } } -static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem)) { Material **matar=NULL; int a, totcol=0; @@ -3111,7 +3112,7 @@ static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeS } } -static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem)) { MTex **mtex= NULL; int a; @@ -3140,7 +3141,7 @@ static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeSt } } -static void unlink_group_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; @@ -3177,7 +3178,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops * /* */ -static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3188,7 +3189,7 @@ static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto } } -static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3199,7 +3200,7 @@ static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeS } } -static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3217,7 +3218,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto } -static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) { tselem->id->lib= NULL; @@ -3226,7 +3227,7 @@ static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreEle } } -static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; GroupObject *gob; @@ -3279,7 +3280,7 @@ static void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOop /* ******************************************** */ -static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; @@ -3295,7 +3296,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) pchan->bone->flag &= ~BONE_HIDDEN_P; } -static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { Bone *bone= (Bone *)te->directdata; @@ -3311,7 +3312,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem) bone->flag &= ~BONE_HIDDEN_P; } -static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { EditBone *ebone= (EditBone *)te->directdata; @@ -3327,7 +3328,7 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem) ebone->flag &= ~BONE_HIDDEN_A; } -static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem)) { // Sequence *seq= (Sequence*) te->directdata; if(event==1) { @@ -3354,7 +3355,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li } } -void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) +void outliner_del(bContext *C, Scene *scene, ARegion *UNUSED(ar), SpaceOops *soops) { if(soops->outlinevis==SO_SEQUENCE) @@ -3764,7 +3765,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C) * this function does not do that yet */ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, - ID **id, char **path, int *array_index, short *flag, short *groupmode) + ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode)) { ListBase hierarchy = {NULL, NULL}; LinkData *ld; @@ -4816,7 +4817,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio } -static void outliner_back(ARegion *ar, SpaceOops *soops) +static void outliner_back(ARegion *ar) { int ystart; @@ -4830,7 +4831,7 @@ static void outliner_back(ARegion *ar, SpaceOops *soops) } } -static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops) +static void outliner_draw_restrictcols(ARegion *ar) { int ystart; @@ -4873,7 +4874,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; /* deselect objects that are invisible */ if (ob->restrictflag & OB_RESTRICT_VIEW) { @@ -4890,7 +4891,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; /* if select restriction has just been turned on */ if (ob->restrictflag & OB_RESTRICT_SELECT) { @@ -4902,17 +4903,17 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) } -static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2)) { WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin); } -static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2)) { WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin); } -static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2) { Object *ob = (Object *)poin2; @@ -4921,7 +4922,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); } -static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2) { Bone *bone= (Bone *)poin2; if(bone && (bone->flag & BONE_HIDDEN_P)) @@ -4929,7 +4930,7 @@ static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); } -static void restrictbutton_ebone_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2) { EditBone *ebone= (EditBone *)poin2; if(ebone && (ebone->flag & BONE_HIDDEN_A)) @@ -4961,7 +4962,7 @@ static int group_select_flag(Group *gr) return 0; } -static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2, int flag) +static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) { Scene *scene = (Scene *)poin; GroupObject *gob; @@ -4989,17 +4990,17 @@ static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2 static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_VIEW); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_VIEW); WM_event_add_notifier(C, NC_GROUP, NULL); } static void restrictbutton_gr_restrict_select(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_SELECT); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_SELECT); WM_event_add_notifier(C, NC_GROUP, NULL); } static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_RENDER); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_RENDER); WM_event_add_notifier(C, NC_GROUP, NULL); } @@ -5245,7 +5246,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } } -static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex) +static void outliner_draw_rnacols(ARegion *ar, int sizex) { View2D *v2d= &ar->v2d; @@ -5297,7 +5298,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa } } -static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) +static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2) { wmOperatorType *ot= arg2; wmKeyMapItem *kmi= arg_kmi; @@ -5306,7 +5307,7 @@ static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME); } -static void operator_search_cb(const struct bContext *C, void *arg_kmi, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -5457,7 +5458,7 @@ static char *keymap_tweak_dir_menu(void) } -static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v) +static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v)) { wmKeyMapItem *kmi= kmi_v; short maptype= keymap_menu_type(kmi->type); @@ -5662,13 +5663,13 @@ void draw_outliner(const bContext *C) UI_view2d_view_ortho(v2d); /* draw outliner stuff (background, hierachy lines and names) */ - outliner_back(ar, soops); + outliner_back(ar); block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS); outliner_draw_tree((bContext *)C, block, scene, ar, soops); if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { /* draw rna buttons */ - outliner_draw_rnacols(ar, soops, sizex_rna); + outliner_draw_rnacols(ar, sizex_rna); outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree); } else if(soops->outlinevis == SO_KEYMAP) { @@ -5676,7 +5677,7 @@ void draw_outliner(const bContext *C) } else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) { /* draw restriction columns */ - outliner_draw_restrictcols(ar, soops); + outliner_draw_restrictcols(ar); outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); } diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index cb51b609a31..f31910d8289 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -84,11 +84,11 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar) } -static void outliner_main_area_free(ARegion *ar) +static void outliner_main_area_free(ARegion *UNUSED(ar)) { + } - static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ @@ -179,7 +179,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header outliner area region *********************** */ /* add handlers, stuff you only do once or on area/region changes */ -static void outliner_header_area_init(wmWindowManager *wm, ARegion *ar) +static void outliner_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -189,7 +189,7 @@ static void outliner_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void outliner_header_area_free(ARegion *ar) +static void outliner_header_area_free(ARegion *UNUSED(ar)) { } @@ -210,7 +210,7 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn) /* ******************** default callbacks for outliner space ***************** */ -static SpaceLink *outliner_new(const bContext *C) +static SpaceLink *outliner_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceOops *soutliner; @@ -254,7 +254,7 @@ static void outliner_free(SpaceLink *sl) } /* spacetype; init callback */ -static void outliner_init(wmWindowManager *wm, ScrArea *sa) +static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c index 6e65d458451..1159139eff5 100644 --- a/source/blender/editors/space_script/script_header.c +++ b/source/blender/editors/space_script/script_header.c @@ -32,7 +32,7 @@ #include "BLI_blenlib.h" - +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -50,12 +50,12 @@ /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) +static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { ScrArea *curarea= CTX_wm_area(C); uiBlock *block; @@ -81,7 +81,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_script_buttons(bContext *C, void *arg, int event) +static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { switch(event) { } diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index ce6edc3a565..66f630bb5b3 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -61,7 +61,7 @@ /* ******************** default callbacks for script space ***************** */ -static SpaceLink *script_new(const bContext *C) +static SpaceLink *script_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceScript *sscript; @@ -107,7 +107,7 @@ static void script_free(SpaceLink *sl) /* spacetype; init callback */ -static void script_init(struct wmWindowManager *wm, ScrArea *sa) +static void script_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -164,7 +164,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void script_header_area_init(wmWindowManager *wm, ARegion *ar) +static void script_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -174,7 +174,7 @@ static void script_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void script_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void script_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ // XXX - Todo, need the ScriptSpace accessible to get the python script to run. diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 69eccfec2e1..aa0686bc9bb 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -47,13 +47,13 @@ #include "sequencer_intern.h" -static void do_sequencer_panel_events(bContext *C, void *arg, int event) +static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static void sequencer_panel_view_properties(const bContext *C, Panel *pa) +static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; @@ -63,7 +63,7 @@ static void sequencer_panel_view_properties(const bContext *C, Panel *pa) } -static void sequencer_panel_properties(const bContext *C, Panel *pa) +static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index eb61633d44c..c4ae658ce37 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -357,7 +357,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire } } -static void draw_seq_extensions(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq) +static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) { float x1, x2, y1, y2, pixely, a; char col[3], blendcol[3]; @@ -586,7 +586,7 @@ Draw a sequence strip, bounds check already made ARegion is currently only used to get the windows width in pixels so wave file sample drawing precision is zoom adjusted */ -static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq, int outline_tint, float pixelx) +static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx) { View2D *v2d= &ar->v2d; float x1, x2, y1, y2; @@ -616,7 +616,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence * /* draw additional info and controls */ if (!is_single_image) - draw_seq_extensions(scene, ar, sseq, seq); + draw_seq_extensions(scene, ar, seq); draw_seq_handle(v2d, seq, pixelx, SEQ_LEFTHANDLE); draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE); @@ -866,7 +866,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq UI_view2d_view_restore(C); } -void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq) +void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq) { int rectx, recty; int render_size = sseq->render_size; @@ -936,7 +936,6 @@ static void draw_seq_backdrop(View2D *v2d) static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) { Scene *scene= CTX_data_scene(C); - SpaceSeq *sseq= CTX_wm_space_seq(C); View2D *v2d= &ar->v2d; Sequence *last_seq = seq_active_get(scene); int sel = 0, j; @@ -958,7 +957,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) else if (seq->machine > v2d->cur.ymax) continue; /* strip passed all tests unscathed... so draw it now */ - draw_seq_strip(scene, ar, sseq, seq, outline_tint, pixelx); + draw_seq_strip(scene, ar, seq, outline_tint, pixelx); } /* draw selected next time round */ @@ -967,14 +966,11 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */ if (last_seq) - draw_seq_strip(scene, ar, sseq, last_seq, 120, pixelx); + draw_seq_strip(scene, ar, last_seq, 120, pixelx); } -static void seq_draw_sfra_efra(const bContext *C, SpaceSeq *sseq, ARegion *ar) -{ - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - +static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) +{ glEnable(GL_BLEND); /* draw darkened area outside of active timeline @@ -1031,7 +1027,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* regular grid-pattern over the rest of the view (i.e. frame grid lines) */ UI_view2d_constant_grid_draw(v2d); - seq_draw_sfra_efra(C, sseq, ar); + seq_draw_sfra_efra(scene, v2d); /* sequence strips (if there is data available to be drawn) */ if (ed) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index b41d0cb21d4..bd53615feda 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -69,11 +69,11 @@ /* own include */ #include "sequencer_intern.h" -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {} -static int pupmenu(const char *dummy) {return 0;} -static int okee(const char *dummy) {return 0;} +static void error(const char *UNUSED(dummy)) {} +static void waitcursor(int UNUSED(val)) {} +static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} +static int okee(const char *UNUSED(dummy)) {return 0;} /* XXX */ @@ -468,7 +468,7 @@ static void reload_sound_strip(Scene *scene, char *name) } #endif -static void reload_image_strip(Scene *scene, char *name) +static void reload_image_strip(Scene *scene, char *UNUSED(name)) { Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq=NULL, *seqact; @@ -735,7 +735,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de } -static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) { TransSeq ts; Sequence *seqn = 0; @@ -782,7 +782,7 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut } } - reload_sequence_new_file(bmain, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); new_tstripdata(seq); @@ -822,14 +822,14 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut seqn->startstill = 0; } - reload_sequence_new_file(bmain, scene, seqn, FALSE); + reload_sequence_new_file(scene, seqn, FALSE); calc_sequence(scene, seqn); new_tstripdata(seqn); } return seqn; } -static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) { TransSeq ts; Sequence *seqn = 0; @@ -919,8 +919,8 @@ static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cut /* like duplicate, but only duplicate and cut overlapping strips, * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */ -static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, int cutframe, - Sequence * (*cut_seq)(Main *, Scene *, Sequence *, int)) +static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe, + Sequence * (*cut_seq)(Scene *, Sequence *, int)) { int did_something = FALSE; Sequence *seq, *seq_next; @@ -934,7 +934,7 @@ static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, if(seq->flag & SELECT) { if(cutframe > seq->startdisp && cutframe < seq->enddisp) { - Sequence * seqn = cut_seq(bmain, scene, seq, cutframe); + Sequence * seqn = cut_seq(scene, seq, cutframe); if (seqn) { BLI_addtail(new, seqn); } @@ -1004,7 +1004,8 @@ void touch_seq_files(Scene *scene) waitcursor(0); } -void set_filter_seq(Main *bmain, Scene *scene) +/* +static void set_filter_seq(Scene *scene) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -1018,15 +1019,15 @@ void set_filter_seq(Main *bmain, Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { seq->flag |= SEQ_FILTERY; - reload_sequence_new_file(bmain, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); } } } SEQ_END - } +*/ void seq_remap_paths(Scene *scene) { @@ -1506,7 +1507,6 @@ static EnumPropertyItem prop_cut_types[] = { static int sequencer_cut_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); int cut_side, cut_hard, cut_frame; @@ -1521,11 +1521,9 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) newlist.first= newlist.last= NULL; if (cut_hard==SEQ_CUT_HARD) { - changed = cut_seq_list(bmain, scene, - ed->seqbasep, &newlist, cut_frame, cut_seq_hard); + changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard); } else { - changed = cut_seq_list(bmain, scene, - ed->seqbasep, &newlist, cut_frame, cut_seq_soft); + changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft); } if (newlist.first) { /* got new strips ? */ diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index eee336eab1d..720aa098ff6 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -58,7 +58,7 @@ /* own include */ #include "sequencer_intern.h" -static void *find_nearest_marker(int d1, int d2) {return NULL;} +static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;} void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */ { diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index a4b7a17ec13..84daf04e4aa 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -236,7 +236,7 @@ static SpaceLink *sequencer_new(const bContext *C) } /* not spacelink itself */ -static void sequencer_free(SpaceLink *sl) +static void sequencer_free(SpaceLink *UNUSED(sl)) { // SpaceSeq *sseq= (SpaceSequencer*) sl; @@ -246,7 +246,7 @@ static void sequencer_free(SpaceLink *sl) /* spacetype; init callback */ -static void sequencer_init(struct wmWindowManager *wm, ScrArea *sa) +static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -296,7 +296,7 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -304,7 +304,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -312,7 +312,7 @@ static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int sound_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */ @@ -352,7 +352,7 @@ static void sequencer_dropboxes(void) /* ************* end drop *********** */ /* add handlers, stuff you only do once or on area/region changes */ -static void sequencer_header_area_init(wmWindowManager *wm, ARegion *ar) +static void sequencer_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c index fbf6d8c85c9..c857d33bcab 100644 --- a/source/blender/editors/space_sound/sound_header.c +++ b/source/blender/editors/space_sound/sound_header.c @@ -34,6 +34,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -53,12 +54,12 @@ /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) +static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { ScrArea *curarea= CTX_wm_area(C); uiBlock *block; @@ -84,7 +85,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_sound_buttons(bContext *C, void *arg, int event) +static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { switch(event) { } diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c index 919395f3bff..99b24479967 100644 --- a/source/blender/editors/space_sound/space_sound.c +++ b/source/blender/editors/space_sound/space_sound.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for sound space ***************** */ -static SpaceLink *sound_new(const bContext *C) +static SpaceLink *sound_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceSound *ssound; @@ -106,7 +106,7 @@ static SpaceLink *sound_new(const bContext *C) } /* not spacelink itself */ -static void sound_free(SpaceLink *sl) +static void sound_free(SpaceLink *UNUSED(sl)) { // SpaceSound *ssound= (SpaceSound*) sl; @@ -115,7 +115,7 @@ static void sound_free(SpaceLink *sl) /* spacetype; init callback */ -static void sound_init(struct wmWindowManager *wm, ScrArea *sa) +static void sound_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -169,13 +169,13 @@ void sound_operatortypes(void) } -void sound_keymap(struct wmKeyConfig *keyconf) +void sound_keymap(struct wmKeyConfig *UNUSED(keyconf)) { } /* add handlers, stuff you only do once or on area/region changes */ -static void sound_header_area_init(wmWindowManager *wm, ARegion *ar) +static void sound_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } @@ -202,7 +202,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); } -static void sound_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void sound_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 4e1bc818ce4..06346bc89ed 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -59,7 +59,7 @@ /* ******************** default callbacks for text space ***************** */ -static SpaceLink *text_new(const bContext *C) +static SpaceLink *text_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceText *stext; @@ -97,7 +97,7 @@ static void text_free(SpaceLink *sl) /* spacetype; init callback */ -static void text_init(struct wmWindowManager *wm, ScrArea *sa) +static void text_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -395,7 +395,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) /* scrollers? */ } -static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) +static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) { WM_cursor_set(win, BC_TEXTEDITCURSOR); } @@ -404,7 +404,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) /* ************* dropboxes ************* */ -static int text_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, 0, ICON_FILE_BLANK)) /* rule might not work? */ @@ -433,7 +433,7 @@ static void text_dropboxes(void) /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void text_header_area_init(wmWindowManager *wm, ARegion *ar) +static void text_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index c6036eb354b..024eef9092a 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -67,11 +67,11 @@ static void text_font_begin(SpaceText *st) BLF_size(mono, st->lheight, 72); } -static void text_font_end(SpaceText *st) +static void text_font_end(SpaceText *UNUSED(st)) { } -static int text_font_draw(SpaceText *st, int x, int y, char *str) +static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str) { BLF_position(mono, x, y, 0); BLF_draw(mono, str); @@ -92,7 +92,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c) return st->cwidth; } -int text_font_width(SpaceText *st, char *str) +int text_font_width(SpaceText *UNUSED(st), char *str) { return BLF_width(mono, str); } @@ -1173,7 +1173,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin); } -static void draw_textscroll(SpaceText *st, ARegion *ar, rcti *scroll) +static void draw_textscroll(SpaceText *st, rcti *scroll) { bTheme *btheme= U.themes.first; uiWidgetColors wcol= btheme->tui.wcol_scroll; @@ -1781,7 +1781,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) draw_brackets(st, ar); draw_markers(st, ar); glTranslatef(0.375f, 0.375f, 0.0f); /* XXX scroll requires exact pixel space */ - draw_textscroll(st, ar, &scroll); + draw_textscroll(st, &scroll); draw_documentation(st, ar); draw_suggestion_list(st, ar); diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 81968221765..c229e685aba 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -53,7 +53,7 @@ int text_check_whitespace(char ch); int text_font_width_character(struct SpaceText *st); int text_font_width(struct SpaceText *st, char *str); -void text_update_line_edited(struct Text *text, struct TextLine *line); +void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); void text_update_character_width(struct SpaceText *st); void text_update_cursor_moved(struct bContext *C); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 0d6c226c6d4..90fab7b2902 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -66,7 +66,7 @@ /************************ poll ***************************/ -static int text_new_poll(bContext *C) +static int text_new_poll(bContext *UNUSED(C)) { return 1; } @@ -125,7 +125,7 @@ static int text_region_edit_poll(bContext *C) /********************** updates *********************/ -void text_update_line_edited(Text *text, TextLine *line) +void text_update_line_edited(TextLine *line) { if(!line) return; @@ -142,7 +142,7 @@ void text_update_edited(Text *text) TextLine *line; for(line=text->lines.first; line; line=line->next) - text_update_line_edited(text, line); + text_update_line_edited(line); } /******************* new operator *********************/ @@ -938,8 +938,8 @@ static int line_break_exec(bContext *C, wmOperator *UNUSED(op)) if(text->curl) { if(text->curl->prev) - text_update_line_edited(text, text->curl->prev); - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl->prev); + text_update_line_edited(text->curl); } text_update_cursor_moved(C); @@ -1417,7 +1417,7 @@ static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int return selc; } -static int cursor_skip_find_line(SpaceText* st, ARegion *ar, Text *text, +static int cursor_skip_find_line(SpaceText* st, ARegion *ar, int lines, TextLine **linep, int *charp, int *rell, int *relc) { int offl, offc, visible_lines; @@ -1713,7 +1713,7 @@ static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int s int rell, relc; /* find line and offsets inside it needed to set cursor position */ - if(cursor_skip_find_line(st, ar, text, lines, linep, charp, &rell, &relc)) + if(cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc)) *charp= text_get_cursor_rel (st, ar, *linep, rell, relc); } else { while (lines>0 && (*linep)->next) { @@ -1918,7 +1918,7 @@ static int delete_exec(bContext *C, wmOperator *op) else if(type == DEL_NEXT_CHAR) txt_delete_char(text); - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); @@ -2587,7 +2587,7 @@ static int insert_exec(bContext *C, wmOperator *op) if(!done) return OPERATOR_CANCELLED; - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 9be554924c9..6e64bef4c85 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -204,7 +204,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) if(tools & TOOL_SUGG_LIST) { if((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } else if((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) { get_suggest_prefix(st->text, 0); @@ -230,7 +230,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) case MIDDLEMOUSE: if(text_do_suggest_select(st, ar)) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); swallow= 1; } else { @@ -248,7 +248,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) case RETKEY: if(tools & TOOL_SUGG_LIST) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); swallow= 1; draw= 1; } @@ -430,11 +430,11 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); if(st->overwrite) { if(txt_replace_char(text, ascii)) - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } else { if(txt_add_char(text, ascii)) { - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } } @@ -459,7 +459,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) txt_move_to(text, mrk->lineno, mrk->start+c, 0); if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); txt_backspace_char(text); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); if(mrk==marker || mrk==nxt) break; mrk= nxt; } @@ -479,7 +479,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) txt_move_to(text, mrk->lineno, mrk->start+c, 0); if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); txt_delete_char(text); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); if(mrk==marker || mrk==nxt) break; mrk= nxt; } diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 37867890c15..a03baa2fa72 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -61,11 +61,8 @@ /* ************************ main time area region *********************** */ -static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar) -{ - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - +static void time_draw_sfra_efra(Scene *scene, View2D *v2d) +{ /* draw darkened area outside of active timeline * frame range used is preview range or scene range */ UI_ThemeColorShade(TH_BACK, -25); @@ -86,7 +83,7 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar #define CACHE_DRAW_HEIGHT 3.0f -static void time_draw_cache(const bContext *C, SpaceTime *stime, ARegion *ar) +static void time_draw_cache(SpaceTime *stime) { SpaceTimeCache *stc; float yoffs=0.f; @@ -162,7 +159,7 @@ static void time_cache_free(SpaceTime *stime) BLI_freelistN(&stime->caches); } -static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar) +static void time_cache_refresh(const bContext *C, SpaceTime *stime) { Object *ob = CTX_data_active_object(C); PTCacheID *pid; @@ -389,7 +386,7 @@ static void time_refresh(const bContext *C, ScrArea *sa) /* find the main timeline region and refresh cache display*/ for (ar= sa->regionbase.first; ar; ar= ar->next) { if (ar->regiontype==RGN_TYPE_WINDOW) { - time_cache_refresh(C, stime, ar); + time_cache_refresh(C, stime); break; } } @@ -457,6 +454,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar) static void time_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ + Scene *scene= CTX_data_scene(C); SpaceTime *stime= CTX_wm_space_time(C); View2D *v2d= &ar->v2d; View2DGrid *grid; @@ -470,11 +468,11 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); /* start and end frame */ - time_draw_sfra_efra(C, stime, ar); + time_draw_sfra_efra(scene, v2d); /* grid */ unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS; - grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + grid= UI_view2d_grid_calc(scene, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); UI_view2d_grid_free(grid); @@ -492,7 +490,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) draw_markers_time(C, 0); /* caches */ - time_draw_cache(C, stime, ar); + time_draw_cache(stime); /* reset view matrix */ UI_view2d_view_restore(C); @@ -533,7 +531,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header time area region *********************** */ /* add handlers, stuff you only do once or on area/region changes */ -static void time_header_area_init(wmWindowManager *wm, ARegion *ar) +static void time_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -632,7 +630,7 @@ static void time_free(SpaceLink *sl) /* spacetype; init callback in ED_area_initialize() */ /* init is called to (re)initialize an existing editor (file read, screen changes) */ /* validate spacedata, add own area level handlers */ -static void time_init(wmWindowManager *wm, ScrArea *sa) +static void time_init(wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceTime *stime= (SpaceTime *)sa->spacedata.first; diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 8eea83a1083..a59c03ad17d 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -47,7 +47,7 @@ /* ******************** default callbacks for userpref space ***************** */ -static SpaceLink *userpref_new(const bContext *C) +static SpaceLink *userpref_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceUserPref *spref; @@ -72,7 +72,7 @@ static SpaceLink *userpref_new(const bContext *C) } /* not spacelink itself */ -static void userpref_free(SpaceLink *sl) +static void userpref_free(SpaceLink *UNUSED(sl)) { // SpaceUserPref *spref= (SpaceUserPref*) sl; @@ -80,7 +80,7 @@ static void userpref_free(SpaceLink *sl) /* spacetype; init callback */ -static void userpref_init(struct wmWindowManager *wm, ScrArea *sa) +static void userpref_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -111,13 +111,13 @@ void userpref_operatortypes(void) { } -void userpref_keymap(struct wmKeyConfig *keyconf) +void userpref_keymap(struct wmKeyConfig *UNUSED(keyconf)) { } /* add handlers, stuff you only do once or on area/region changes */ -static void userpref_header_area_init(wmWindowManager *wm, ARegion *ar) +static void userpref_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -127,19 +127,20 @@ static void userpref_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void userpref_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void userpref_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } -static void userpref_header_listener(ARegion *ar, wmNotifier *wmn) +static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ +#if 0 switch(wmn->category) { default: break; } - +#endif } /* only called once, from space/spacetypes.c */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 41899a70b34..dc75efcc5ca 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2209,7 +2209,6 @@ static int add_background_image_exec(bContext *C, wmOperator *UNUSED(op)) static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); Image *ima= NULL; BGpic *bgpic; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index c004f32f586..923f4560532 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -150,7 +150,7 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs); - reload_sequence_new_file(G.main, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -161,7 +161,7 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs); - reload_sequence_new_file(G.main, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -552,7 +552,7 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Sequence *seq= (Sequence*)(ptr->data); - reload_sequence_new_file(G.main, scene, seq, TRUE); + reload_sequence_new_file(scene, seq, TRUE); calc_sequence(scene, seq); rna_Sequence_update(bmain, scene, ptr); } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 9179019f824..79f489137f3 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2226,7 +2226,7 @@ static int composite_needs_render(Scene *sce) } /* bad call... need to think over proper method still */ -static void render_composit_stats(void *unused, char *str) +static void render_composit_stats(void *UNUSED(arg), char *str) { R.i.infostr= str; R.stats_draw(R.sdh, &R.i); -- cgit v1.2.3 From bc1cca8d006f5c9cc6a6e695b2a12bb208694bb5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 09:27:02 +0000 Subject: - blender player builds again with CMake. - remove duplicate entries for libs for blender binary (where possible) --- source/blenderplayer/CMakeLists.txt | 12 +++++++----- source/creator/CMakeLists.txt | 22 ++++++---------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index a61152d37ba..b1dbde8d4b1 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -65,7 +65,7 @@ IF(UNIX) gp_ghost gp_common bf_intern_string - bf_intern_ghost + bf_intern_ghost bf_rna bf_blenkernel bf_blenloader @@ -81,10 +81,10 @@ IF(UNIX) bf_oglrasterizer bf_expressions bf_scenegraph - bf_ikplugin - bf_intern_itasc - bf_intern_ik - bf_intern_smoke + bf_ikplugin + bf_intern_itasc + bf_intern_ik + bf_intern_smoke bf_modifiers bf_intern_moto bf_kernel @@ -114,6 +114,8 @@ IF(UNIX) extern_binreloc extern_glew extern_minilzo + bf_intern_ghost # duplicate for linking + bf_blenkernel # duplicate for linking ) IF(WITH_QUICKTIME) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 0433f76c846..f2ea4d3dc75 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -451,9 +451,6 @@ IF(WITH_FLUID) LIST(APPEND BLENDER_LINK_LIBS bf_intern_elbeem) ENDIF(WITH_FLUID) -IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - LIST(APPEND BLENDER_LINK_LIBS extern_binreloc) -ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") #IF(UNIX) # Sort libraries @@ -498,7 +495,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_editor_animation bf_editor_datafiles - bf_intern_bsp bf_render bf_intern_opennl bf_python @@ -529,8 +525,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_intern_memutil bf_intern_guardedalloc bf_intern_ctr - bf_intern_moto - bf_windowmanager bf_blroutines bf_converter bf_dummy @@ -545,19 +539,13 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_oglrasterizer bf_expressions bf_scenegraph - bf_intern_moto - bf_blroutines kx_network - bf_kernel + bf_kernel + bf_python # duplicate for BPY_eval_driver bf_ngnetwork extern_bullet bf_loopbacknetwork - bf_intern_itasc - bf_common bf_intern_moto - bf_python - bf_python_ext - extern_binreloc extern_glew extern_openjpeg bf_videotex @@ -565,10 +553,12 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_dna bf_blenfont bf_intern_audaspace - bf_intern_decimate - ) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + LIST(APPEND BLENDER_SORTED_LIBS extern_binreloc) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF(WITH_CXX_GUARDEDALLOC) LIST(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp) ENDIF(WITH_CXX_GUARDEDALLOC) -- cgit v1.2.3 From 87533e679c3134bb3ba972a45c0d648df47703dd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 09:42:52 +0000 Subject: dont check for project anymore for ctrl+click, face snapping is enough. --- source/blender/editors/mesh/editmesh_add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index e1a4b2b2fd4..f90f1b095e6 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -117,7 +117,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) em_setup_viewcontext(C, &vc); - use_proj= ((vc.scene->toolsettings->snap_flag & (SCE_SNAP|SCE_SNAP_PROJECT))==(SCE_SNAP|SCE_SNAP_PROJECT)) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); + use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); -- cgit v1.2.3 From 5999658569d781bdc4e0b8fa6e0cceb2efb5e612 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 16 Oct 2010 10:14:17 +0000 Subject: Fix #24280: NURBS default "12x12" UV resolution is not actually "12x12" When adding new nurb primitive it'll have got the same resolution as curve --- source/blender/editors/curve/editcurve.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9fa7ba44c58..97379cc110c 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5620,6 +5620,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) Nurb *nu = NULL; BezTriple *bezt; BPoint *bp; + Curve *cu= (Curve*)obedit->data; float vec[3]; float fac, grid; int a, b, cutype, stype; @@ -5641,13 +5642,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) { nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim"); nu->type= cutype; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; } switch(stype) { case CU_PRIM_CURVE: /* curve */ - nu->resolu= 12; /* set as 4 above */ + nu->resolu= cu->resolu; if(newname) { rename_id((ID *)obedit, "Curve"); rename_id((ID *)obedit->data, "Curve"); @@ -5724,7 +5725,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsv= 1; nu->orderu= 5; nu->flagu= CU_NURB_ENDPOINT; /* endpoint */ - nu->resolu= 8; + nu->resolu= cu->resolu; nu->bp= callocstructN(BPoint, 5, "addNurbprim3"); bp= nu->bp; @@ -5753,7 +5754,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) break; case CU_PRIM_CIRCLE: /* circle */ - nu->resolu= 12; /* set as 4 above */ + nu->resolu= cu->resolu; if(newname) { rename_id((ID *)obedit, "CurveCircle"); rename_id((ID *)obedit->data, "CurveCircle"); @@ -5870,7 +5871,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) } nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ - nu->resolu= 4; + nu->resolu= cu->resolu; nu->flag= CU_SMOOTH; BLI_addtail(editnurb, nu); /* temporal for extrude and translate */ vec[0]=vec[1]= 0.0; @@ -5913,8 +5914,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsu= 5; nu->pntsv= 1; nu->orderu= 3; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; nu->flag= CU_SMOOTH; nu->bp= callocstructN(BPoint, 5, "addNurbprim6"); nu->flagu= 0; @@ -5962,8 +5963,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) xzproj= 1; nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ xzproj= 0; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; nu->flag= CU_SMOOTH; BLI_addtail(editnurb, nu); /* temporal for spin */ -- cgit v1.2.3 From 98d6c533a606f7965d0a2bfe1da4f83942693066 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 16 Oct 2010 11:30:41 +0000 Subject: Bugfix #23979: FCurve.keyframe_points.add(..., replace=True) ... fails if there were no keyframes in the curve yet. Was a missing null-check for case when no keyframe array is created. Also, changed the description for the "replace" arg to better reflect what it really does. --- source/blender/makesrna/intern/rna_fcurve.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 63405e08f69..31ba51a9b04 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -542,14 +542,14 @@ static BezTriple *rna_FKeyframe_points_add(FCurve *fcu, float frame, float value index= insert_vert_fcurve(fcu, frame, value, flag); - return index >= 0 ? fcu->bezt + index : NULL; + return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL; } static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTriple *bezt, int do_fast) { int index= (int)(bezt - fcu->bezt); if (index < 0 || index >= fcu->totvert) { - BKE_report(reports, RPT_ERROR, "bezier not in fcurve."); + BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve."); return; } @@ -1320,7 +1320,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); /* optional */ - parm= RNA_def_boolean(func, "replace", 0, "Replace", "Replace existing keyframes"); + parm= RNA_def_boolean(func, "replace", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"); parm= RNA_def_boolean(func, "needed", 0, "Needed", "Only adds keyframes that are needed"); parm= RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"); -- cgit v1.2.3 From 7cc5aaf18afd882ee8fefdf773fb83eb2e0f467b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 16 Oct 2010 11:52:30 +0000 Subject: Added panel for accessing the "delta transforms" for Objects (this is closed by default to not clutter that much). This should help silence complaints from some about "dloc",etc. not being easily keyable. It's also a nice way to have instances of animated objects located in different places, by animating either the standard transforms or the deltas, and then modifying by not animating the other version to keep the instances from going to a single point. This was a common newbie problem in 2.4x. --- release/scripts/ui/properties_object.py | 25 +++++++++++++++++++++++++ source/blender/blenkernel/intern/object.c | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 65f1cc2d929..2532a99b402 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -68,6 +68,31 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel): row.column().prop(ob, "scale") layout.prop(ob, "rotation_mode") + +class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel): + bl_label = "Delta Transform" + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + + ob = context.object + + row = layout.row() + + row.column().prop(ob, "delta_location") + if ob.rotation_mode == 'QUATERNION': + row.column().prop(ob, "delta_rotation_quaternion", text="Rotation") + elif ob.rotation_mode == 'AXIS_ANGLE': + #row.column().label(text="Rotation") + #row.column().prop(pchan, "delta_rotation_angle", text="Angle") + #row.column().prop(pchan, "delta_rotation_axis", text="Axis") + #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation") + row.column().label(ob, text="Not for Axis-Angle") + else: + row.column().prop(ob, "delta_rotation_euler", text="Rotation") + + row.column().prop(ob, "delta_scale") class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel): diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 861904335d7..3df9bd6ed05 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1646,7 +1646,7 @@ void object_scale_to_mat3(Object *ob, float mat[][3]) size_to_mat3( mat,vec); } -// TODO: this should take rotation orders into account later... + void object_rot_to_mat3(Object *ob, float mat[][3]) { float rmat[3][3], dmat[3][3]; @@ -1675,7 +1675,6 @@ void object_rot_to_mat3(Object *ob, float mat[][3]) } /* combine these rotations */ - // XXX is this correct? if errors, change the order of multiplication... mul_m3_m3m3(mat, dmat, rmat); } -- cgit v1.2.3 From 8268a4be71fe326b5b7b43e5e55ef751844dddbc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 14:32:17 +0000 Subject: most unused arg warnings corrected. - removed deprecated bitmap arg from IMB_allocImBuf (plugins will need updating). - mostly tagged UNUSED() since some of these functions look like they may need to have the arguments used later. --- source/blender/avi/intern/endian.c | 2 + source/blender/avi/intern/mjpeg.c | 2 +- source/blender/blenfont/intern/blf_lang.c | 2 + source/blender/blenkernel/BKE_cloth.h | 2 +- source/blender/blenkernel/BKE_mesh.h | 4 +- source/blender/blenkernel/BKE_object.h | 2 +- source/blender/blenkernel/BKE_scene.h | 2 +- source/blender/blenkernel/BKE_sound.h | 4 +- source/blender/blenkernel/intern/BME_tools.c | 4 +- source/blender/blenkernel/intern/DerivedMesh.c | 19 ++- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/anim.c | 2 +- source/blender/blenkernel/intern/armature.c | 8 +- source/blender/blenkernel/intern/boids.c | 4 +- source/blender/blenkernel/intern/brush.c | 6 +- source/blender/blenkernel/intern/bvhutils.c | 2 +- source/blender/blenkernel/intern/cdderivedmesh.c | 6 +- source/blender/blenkernel/intern/cloth.c | 22 ++-- source/blender/blenkernel/intern/collision.c | 4 +- source/blender/blenkernel/intern/colortools.c | 10 +- source/blender/blenkernel/intern/constraint.c | 32 +++--- source/blender/blenkernel/intern/curve.c | 8 +- source/blender/blenkernel/intern/customdata.c | 6 +- source/blender/blenkernel/intern/customdata_file.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 4 +- source/blender/blenkernel/intern/displist.c | 4 +- source/blender/blenkernel/intern/effect.c | 4 +- source/blender/blenkernel/intern/fcurve.c | 4 +- source/blender/blenkernel/intern/fmodifier.c | 20 ++-- source/blender/blenkernel/intern/group.c | 3 +- source/blender/blenkernel/intern/image.c | 20 ++-- source/blender/blenkernel/intern/implicit.c | 4 +- source/blender/blenkernel/intern/ipo.c | 4 +- source/blender/blenkernel/intern/key.c | 4 +- source/blender/blenkernel/intern/library.c | 4 +- source/blender/blenkernel/intern/mesh.c | 12 +- source/blender/blenkernel/intern/multires.c | 6 +- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/object.c | 4 +- source/blender/blenkernel/intern/packedFile.c | 2 +- source/blender/blenkernel/intern/paint.c | 3 +- source/blender/blenkernel/intern/particle.c | 16 +-- source/blender/blenkernel/intern/particle_system.c | 12 +- source/blender/blenkernel/intern/pointcache.c | 26 +++-- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 118 +++++++++---------- source/blender/blenkernel/intern/sequencer.c | 20 ++-- source/blender/blenkernel/intern/smoke.c | 4 +- source/blender/blenkernel/intern/softbody.c | 6 +- source/blender/blenkernel/intern/sound.c | 10 +- source/blender/blenkernel/intern/writeavi.c | 4 +- .../blender/blenkernel/intern/writeframeserver.c | 9 +- source/blender/blenlib/intern/BLI_kdtree.c | 1 + source/blender/blenlib/intern/dynlib.c | 1 + source/blender/blenlib/intern/noise.c | 10 +- source/blender/blenlib/intern/threads.c | 2 + source/blender/blenloader/intern/readfile.c | 2 +- source/blender/blenpluginapi/iff.h | 2 +- source/blender/blenpluginapi/intern/pluginapi.c | 5 +- .../editors/animation/anim_channels_defines.c | 128 ++++++++++----------- .../blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/animation/anim_deps.c | 6 +- source/blender/editors/animation/anim_filter.c | 2 +- source/blender/editors/animation/anim_markers.c | 16 +-- source/blender/editors/animation/drivers.c | 8 +- source/blender/editors/animation/fmodifier_ui.c | 18 +-- source/blender/editors/animation/keyframes_draw.c | 4 +- source/blender/editors/animation/keyframes_edit.c | 2 +- .../blender/editors/animation/keyframes_general.c | 2 +- source/blender/editors/animation/keyframing.c | 2 +- source/blender/editors/animation/keyingsets.c | 2 +- .../editors/armature/editarmature_generate.c | 6 +- .../editors/armature/editarmature_retarget.c | 6 +- .../blender/editors/armature/editarmature_sketch.c | 36 +++--- source/blender/editors/armature/meshlaplacian.c | 6 +- source/blender/editors/armature/reeb.c | 4 +- source/blender/editors/gpencil/gpencil_paint.c | 14 +-- source/blender/editors/include/ED_keyframes_draw.h | 2 +- source/blender/editors/include/ED_keyframing.h | 2 +- source/blender/editors/include/ED_mesh.h | 2 +- source/blender/editors/include/ED_object.h | 2 +- .../blender/editors/interface/interface_handlers.c | 2 +- source/blender/editors/interface/interface_icons.c | 2 +- source/blender/editors/mesh/editface.c | 16 +-- source/blender/editors/mesh/editmesh.c | 12 +- source/blender/editors/mesh/editmesh_add.c | 6 +- source/blender/editors/mesh/editmesh_lib.c | 8 +- source/blender/editors/mesh/editmesh_loop.c | 4 +- source/blender/editors/mesh/editmesh_mods.c | 10 +- source/blender/editors/mesh/editmesh_tools.c | 24 ++-- source/blender/editors/mesh/loopcut.c | 28 ++--- source/blender/editors/mesh/mesh_data.c | 4 +- source/blender/editors/metaball/mball_edit.c | 4 +- source/blender/editors/object/object_add.c | 12 +- source/blender/editors/object/object_edit.c | 20 ++-- source/blender/editors/object/object_modifier.c | 36 +++--- source/blender/editors/object/object_ops.c | 2 +- source/blender/editors/object/object_relations.c | 8 +- source/blender/editors/physics/particle_edit.c | 32 +++--- source/blender/editors/physics/physics_fluid.c | 14 +-- .../blender/editors/physics/physics_pointcache.c | 6 +- source/blender/editors/render/render_preview.c | 18 +-- source/blender/editors/render/render_shading.c | 8 +- source/blender/editors/screen/screen_edit.c | 2 +- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/screen/screendump.c | 4 +- source/blender/editors/sculpt_paint/paint_image.c | 6 +- source/blender/editors/sculpt_paint/paint_ops.c | 2 +- source/blender/editors/sculpt_paint/paint_undo.c | 4 +- source/blender/editors/sculpt_paint/paint_vertex.c | 8 +- source/blender/editors/sculpt_paint/sculpt.c | 2 +- source/blender/editors/sound/sound_ops.c | 2 +- .../blender/editors/space_action/action_select.c | 2 +- source/blender/editors/space_file/filelist.c | 4 +- source/blender/editors/space_file/writeimage.c | 2 +- .../editors/space_sequencer/sequencer_scopes.c | 18 +-- source/blender/editors/space_view3d/view3d_draw.c | 6 +- source/blender/editors/space_view3d/view3d_view.c | 5 +- source/blender/editors/transform/transform.c | 62 +++++----- source/blender/editors/transform/transform.h | 2 +- .../editors/transform/transform_constraints.c | 2 +- .../editors/transform/transform_conversions.c | 46 ++++---- source/blender/editors/transform/transform_input.c | 12 +- .../editors/transform/transform_manipulator.c | 2 +- .../editors/transform/transform_ndofinput.c | 2 +- .../editors/transform/transform_orientations.c | 2 +- source/blender/editors/transform/transform_snap.c | 12 +- source/blender/editors/util/editmode_undo.c | 7 +- source/blender/editors/uvedit/uvedit_draw.c | 8 +- source/blender/imbuf/IMB_imbuf.h | 3 +- source/blender/imbuf/intern/allocimbuf.c | 4 +- source/blender/imbuf/intern/anim.c | 18 +-- source/blender/imbuf/intern/bmp.c | 4 +- source/blender/imbuf/intern/cineon/cineon_dpx.c | 2 +- source/blender/imbuf/intern/dds/dds_api.cpp | 2 +- source/blender/imbuf/intern/divers.c | 8 +- source/blender/imbuf/intern/filter.c | 2 +- source/blender/imbuf/intern/iris.c | 10 +- source/blender/imbuf/intern/jp2.c | 2 +- source/blender/imbuf/intern/jpeg.c | 6 +- .../blender/imbuf/intern/openexr/openexr_api.cpp | 2 +- .../blender/imbuf/intern/openexr/openexr_multi.h | 2 +- source/blender/imbuf/intern/png.c | 5 +- source/blender/imbuf/intern/radiance_hdr.c | 4 +- source/blender/imbuf/intern/scaling.c | 10 +- source/blender/imbuf/intern/targa.c | 4 +- source/blender/imbuf/intern/thumbs.c | 2 +- source/blender/imbuf/intern/thumbs_blend.c | 2 +- source/blender/imbuf/intern/tiff.c | 19 ++- source/blender/makesrna/intern/rna_animation.c | 2 +- source/blender/makesrna/intern/rna_main_api.c | 2 +- source/blender/makesrna/intern/rna_mesh.c | 2 +- source/blender/makesrna/intern/rna_sound.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 2 +- .../blender/modifiers/intern/MOD_fluidsim_util.c | 10 ++ .../blender/nodes/intern/CMP_nodes/CMP_alphaOver.c | 6 +- .../nodes/intern/CMP_nodes/CMP_bilateralblur.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_blur.c | 2 +- .../nodes/intern/CMP_nodes/CMP_brightness.c | 2 +- .../nodes/intern/CMP_nodes/CMP_channelMatte.c | 4 +- .../nodes/intern/CMP_nodes/CMP_chromaMatte.c | 4 +- .../nodes/intern/CMP_nodes/CMP_colorSpill.c | 2 +- .../nodes/intern/CMP_nodes/CMP_colorbalance.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_composite.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_crop.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_curves.c | 6 +- .../blender/nodes/intern/CMP_nodes/CMP_defocus.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_dilate.c | 2 +- .../nodes/intern/CMP_nodes/CMP_directionalblur.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_displace.c | 6 +- source/blender/nodes/intern/CMP_nodes/CMP_flip.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_gamma.c | 4 +- source/blender/nodes/intern/CMP_nodes/CMP_glare.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c | 2 +- .../nodes/intern/CMP_nodes/CMP_huecorrect.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_image.c | 4 +- source/blender/nodes/intern/CMP_nodes/CMP_invert.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_lensdist.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c | 4 +- .../blender/nodes/intern/CMP_nodes/CMP_mapValue.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_math.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_normal.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_normalize.c | 4 +- .../nodes/intern/CMP_nodes/CMP_outputFile.c | 4 +- .../blender/nodes/intern/CMP_nodes/CMP_premulkey.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_rgb.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_rotate.c | 6 +- source/blender/nodes/intern/CMP_nodes/CMP_scale.c | 2 +- .../nodes/intern/CMP_nodes/CMP_sepcombHSVA.c | 8 +- .../nodes/intern/CMP_nodes/CMP_sepcombRGBA.c | 6 +- .../nodes/intern/CMP_nodes/CMP_sepcombYCCA.c | 8 +- .../nodes/intern/CMP_nodes/CMP_sepcombYUVA.c | 8 +- .../blender/nodes/intern/CMP_nodes/CMP_setalpha.c | 2 +- .../nodes/intern/CMP_nodes/CMP_splitViewer.c | 4 +- .../blender/nodes/intern/CMP_nodes/CMP_tonemap.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_translate.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_valToRgb.c | 6 +- source/blender/nodes/intern/CMP_nodes/CMP_value.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_vecBlur.c | 2 +- source/blender/nodes/intern/CMP_nodes/CMP_viewer.c | 2 +- .../blender/nodes/intern/CMP_nodes/CMP_zcombine.c | 2 +- source/blender/nodes/intern/CMP_util.c | 20 ++-- source/blender/nodes/intern/SHD_nodes/SHD_camera.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_curves.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_geom.c | 2 +- .../blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c | 6 +- source/blender/nodes/intern/SHD_nodes/SHD_invert.c | 4 +- .../blender/nodes/intern/SHD_nodes/SHD_mapping.c | 2 +- source/blender/nodes/intern/SHD_nodes/SHD_math.c | 2 +- source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c | 2 +- source/blender/nodes/intern/SHD_nodes/SHD_normal.c | 2 +- source/blender/nodes/intern/SHD_nodes/SHD_output.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_rgb.c | 2 +- .../nodes/intern/SHD_nodes/SHD_sepcombRGB.c | 8 +- .../blender/nodes/intern/SHD_nodes/SHD_squeeze.c | 4 +- .../blender/nodes/intern/SHD_nodes/SHD_valToRgb.c | 6 +- source/blender/nodes/intern/SHD_nodes/SHD_value.c | 2 +- .../blender/nodes/intern/SHD_nodes/SHD_vectMath.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_at.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_checker.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_compose.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_coord.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_curves.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_decompose.c | 8 +- .../blender/nodes/intern/TEX_nodes/TEX_distance.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_image.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_invert.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_output.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_proc.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_rotate.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_scale.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_translate.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_valToNor.c | 2 +- .../blender/nodes/intern/TEX_nodes/TEX_valToRgb.c | 2 +- source/blender/nodes/intern/TEX_nodes/TEX_viewer.c | 2 +- .../blender/render/intern/source/convertblender.c | 2 +- source/blender/render/intern/source/envmap.c | 4 +- source/blender/render/intern/source/pipeline.c | 22 ++-- .../render/intern/source/rayobject_instance.c | 2 +- source/blender/render/intern/source/shadbuf.c | 2 +- source/blender/render/intern/source/sss.c | 4 +- .../blender/render/intern/source/volume_precache.c | 2 +- source/blender/windowmanager/intern/wm_files.c | 2 +- source/blenderplayer/bad_level_call_stubs/stubs.c | 4 +- source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 2 +- .../GamePlayer/ghost/GPG_Application.cpp | 2 +- source/gameengine/Ketsji/BL_Texture.cpp | 2 +- source/gameengine/VideoTexture/ImageBuff.cpp | 8 +- 249 files changed, 890 insertions(+), 852 deletions(-) diff --git a/source/blender/avi/intern/endian.c b/source/blender/avi/intern/endian.c index 282e26b3ee8..137c664568c 100644 --- a/source/blender/avi/intern/endian.c +++ b/source/blender/avi/intern/endian.c @@ -206,6 +206,8 @@ void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int t MEM_freeN (data); #else /* WORDS_BIGENDIAN */ + (void)movie; /* unused */ + (void)type; /* unused */ fwrite (datain, block, size, fp); #endif /* WORDS_BIGENDIAN */ } diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c index fd7e8aaef83..56ba352dcf8 100644 --- a/source/blender/avi/intern/mjpeg.c +++ b/source/blender/avi/intern/mjpeg.c @@ -403,7 +403,7 @@ static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, in /* Decompression from memory */ static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) { - ; + (void)dinfo; } static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 7054d955faf..21bf73b56d9 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -118,11 +118,13 @@ void BLF_lang_init(void) void BLF_lang_encoding(char *str) { + (void)str; return; } void BLF_lang_set(char *str) { + (void)str; return; } diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 034bedbb07d..e9f0304e645 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -220,7 +220,7 @@ void clmdSetInterruptCallBack ( int ( *f ) ( void ) ); // needed for modifier.c void cloth_free_modifier_extern ( struct ClothModifierData *clmd ); -void cloth_free_modifier ( struct Object *ob, struct ClothModifierData *clmd ); +void cloth_free_modifier ( struct ClothModifierData *clmd ); void cloth_init ( struct ClothModifierData *clmd ); struct DerivedMesh *clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc ); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index e80c266ff70..7e1ab138acc 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -132,8 +132,8 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const struct MEdge *m /* Partial Mesh Visibility */ struct PartialVisibility *mesh_pmv_copy(struct PartialVisibility *); void mesh_pmv_free(struct PartialVisibility *); -void mesh_pmv_revert(struct Object *ob, struct Mesh *me); -void mesh_pmv_off(struct Object *ob, struct Mesh *me); +void mesh_pmv_revert(struct Mesh *me); +void mesh_pmv_off(struct Mesh *me); /* functions for making menu's from customdata layers */ int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to work out how many chars to allocate */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 2a7ba4f98c9..7451d43a578 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -71,7 +71,7 @@ void object_free_modifiers(struct Object *ob); void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob); void object_copy_proxy_drivers(struct Object *ob, struct Object *target); -void unlink_object(struct Scene *scene, struct Object *ob); +void unlink_object(struct Object *ob); int exist_object(struct Object *obtest); void *add_camera(char *name); struct Camera *copy_camera(struct Camera *cam); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 8d5ebb64cf0..8a49e432ebd 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -64,7 +64,7 @@ struct Base *object_in_scene(struct Object *ob, struct Scene *sce); void set_scene_bg(struct Main *bmain, struct Scene *sce); struct Scene *set_scene_name(struct Main *bmain, char *name); -struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type); +struct Scene *copy_scene(struct Scene *sce, int type); void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 190b0400aff..fb2ea4c1ca9 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -40,7 +40,7 @@ struct Sequence; void sound_init_once(); -void sound_init(struct Main *main); +void sound_init(void); void sound_exit(); @@ -62,7 +62,7 @@ void sound_cache(struct bSound* sound, int ignore); void sound_delete_cache(struct bSound* sound); -void sound_load(struct Main *main, struct bSound* sound); +void sound_load(struct bSound* sound); void sound_free(struct bSound* sound); diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index 7d9c9a431f8..e5a355e5f24 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -918,7 +918,7 @@ static int BME_face_sharededges(BME_Poly *f1, BME_Poly *f2){ * Returns - * A BME_Mesh pointer to the BMesh passed as a parameter. */ -static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int defgrp_index, float angle, BME_TransData_Head *td) { +static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) { BME_Vert *v; BME_Edge *e; BME_Poly *f; @@ -1162,7 +1162,7 @@ static void bmesh_dissolve_disk(BME_Mesh *bm, BME_Vert *v){ //BME_JEKV(bm,v->edge,v); } } -static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int defgrp_index, BME_TransData_Head *td) { +static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int UNUSED(defgrp_index), BME_TransData_Head *td) { BME_Vert *v, *nv; BME_Edge *e, *oe; BME_Loop *l, *l2; diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 496bcc0f88c..e70dde1474a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -517,7 +517,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us glEnd(); } } -static void emDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges) +static void emDM_drawEdges(DerivedMesh *dm, int UNUSED(drawLooseEdges), int UNUSED(drawAllEdges)) { emDM_drawMappedEdges(dm, NULL, NULL); } @@ -628,7 +628,7 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use } /* note, material function is ignored for now. */ -static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) +static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs)) { EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm; EditFace *efa; @@ -1326,8 +1326,7 @@ static void emDM_release(DerivedMesh *dm) } } -static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob, - float (*vertexCos)[3]) +static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, float (*vertexCos)[3]) { EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm"); @@ -2023,7 +2022,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri modifiers_clearErrors(ob); if(cage_r && cageIndex == -1) { - *cage_r = getEditMeshDerivedMesh(em, ob, NULL); + *cage_r = getEditMeshDerivedMesh(em, NULL); } dm = NULL; @@ -2156,7 +2155,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri *cage_r = dm; } else { *cage_r = - getEditMeshDerivedMesh(em, ob, + getEditMeshDerivedMesh(em, deformedVerts ? MEM_dupallocN(deformedVerts) : NULL); } } @@ -2180,7 +2179,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri } else if (!deformedVerts && cage_r && *cage_r) { *final_r = *cage_r; } else { - *final_r = getEditMeshDerivedMesh(em, ob, deformedVerts); + *final_r = getEditMeshDerivedMesh(em, deformedVerts); deformedVerts = NULL; } @@ -2396,9 +2395,9 @@ DerivedMesh *editmesh_get_derived_cage(Scene *scene, Object *obedit, EditMesh *e return em->derivedCage; } -DerivedMesh *editmesh_get_derived_base(Object *obedit, EditMesh *em) +DerivedMesh *editmesh_get_derived_base(Object *UNUSED(obedit), EditMesh *em) { - return getEditMeshDerivedMesh(em, obedit, NULL); + return getEditMeshDerivedMesh(em, NULL); } @@ -2484,7 +2483,7 @@ int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, f if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { if(!defmats) { - dm= getEditMeshDerivedMesh(em, ob, NULL); + dm= getEditMeshDerivedMesh(em, NULL); deformedVerts= editmesh_getVertexCos(em, &numVerts); defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 90a3a6ce664..5a96575452b 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1091,7 +1091,7 @@ void copy_pose_result(bPose *to, bPose *from) /* For the calculation of the effects of an Action at the given frame on an object * This is currently only used for the Action Constraint */ -void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe) +void what_does_obaction (Scene *UNUSED(scene), Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe) { bActionGroup *agrp= action_groups_find_named(act, groupname); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index b2feb01352e..7b52d9c586a 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1138,7 +1138,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa dm->release(dm); } -static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated) +static void new_particle_duplilist(ListBase *lb, ID *UNUSED(id), Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated) { GroupObject *go; Object *ob=0, **oblist=0, obcopy, *obcopylist=0; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index f1f9fe08717..f0c39e6373e 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -252,7 +252,7 @@ Bone *get_named_bone (bArmature *arm, const char *name) * axis: the axis to name on * head/tail: the head/tail co-ordinate of the bone on the specified axis */ -int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail) +int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float head, float tail) { unsigned int len; char basename[32]={""}; @@ -1057,7 +1057,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, /* ************ END Armature Deform ******************* */ -void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed) +void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int UNUSED(root), int UNUSED(posed)) { copy_m4_m4(M_accumulatedMatrix, bone->arm_mat); } @@ -1616,7 +1616,7 @@ typedef struct tSplineIK_Tree { /* ----------- */ /* Tag the bones in the chain formed by the given bone for IK */ -static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel *pchan_tip) +static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPoseChannel *pchan_tip) { bPoseChannel *pchan, *pchanRoot=NULL; bPoseChannel *pchanChain[255]; @@ -1785,7 +1785,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel } /* Tag which bones are members of Spline IK chains */ -static void splineik_init_tree(Scene *scene, Object *ob, float ctime) +static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime)) { bPoseChannel *pchan; diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 69a42e52247..cfe16e089cf 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -58,7 +58,7 @@ typedef struct BoidValues { static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness); -static int rule_none(BoidRule *rule, BoidBrainData *data, BoidValues *val, ParticleData *pa) +static int rule_none(BoidRule *rule, BoidBrainData *UNUSED(data), BoidValues *val, ParticleData *pa) { return 0; } @@ -823,7 +823,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro return NULL; } } -static int boid_rule_applies(ParticleData *pa, BoidSettings *boids, BoidRule *rule) +static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), BoidRule *rule) { BoidParticle *bpa = pa->boid; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c67db9382f3..d894aef4ac5 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -530,7 +530,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf if (*outbuf) ibuf= *outbuf; else - ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag, 0); + ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag); if (flt) { for (y=0; y < ibuf->y; y++) { @@ -796,11 +796,11 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float imbflag= (cache->flt)? IB_rectfloat: IB_rect; if (!cache->ibuf) - cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0); + cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag); ibuf= cache->ibuf; oldtexibuf= cache->texibuf; - cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0); + cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag); if (oldtexibuf) { srcx= srcy= 0; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 1b7257519b1..671bcb36680 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -42,7 +42,7 @@ /* Math stuff for ray casting on mesh faces and for nearest surface */ -static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float *v0, const float *v1, const float *v2) +static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), const float *v0, const float *v1, const float *v2) { float dist; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index b9ca7bfafe3..eb895d62f17 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -418,7 +418,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) static void cdDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], - int fast, int (*setMaterial)(int, void *attribs)) + int UNUSED(fast), int (*setMaterial)(int, void *attribs)) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mvert = cddm->mvert; @@ -1489,7 +1489,7 @@ DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces) return dm; } -DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob) +DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob)) { CDDerivedMesh *cddm = cdDM_create("CDDM_from_mesh dm"); DerivedMesh *dm = &cddm->dm; @@ -1518,7 +1518,7 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob) return dm; } -DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me) +DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me)) { DerivedMesh *dm = CDDM_new(BLI_countlist(&em->verts), BLI_countlist(&em->edges), diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 3f47676d7fd..e7e94c407f1 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -87,7 +87,7 @@ static CM_SOLVER_DEF solvers [] = /* Prototypes for internal functions. */ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh *dm); -static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm ); +static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ); static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first); static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ); static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ); @@ -423,7 +423,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul /************************************************ * clothModifier_do - main simulation function ************************************************/ -DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) +DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { DerivedMesh *result; PointCache *cache; @@ -546,7 +546,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, } /* frees all */ -void cloth_free_modifier ( Object *ob, ClothModifierData *clmd ) +void cloth_free_modifier(ClothModifierData *clmd ) { Cloth *cloth = NULL; @@ -804,7 +804,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) } } -static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first) +static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float UNUSED(framenr), int first) { int i = 0; MVert *mvert = NULL; @@ -817,7 +817,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d // If we have a clothObject, free it. if ( clmd->clothObject != NULL ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); if(G.rt > 0) printf("cloth_free_modifier cloth_from_object\n"); } @@ -841,7 +841,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d if ( !dm ) return 0; - cloth_from_mesh ( ob, clmd, dm ); + cloth_from_mesh ( clmd, dm ); // create springs clmd->clothObject->springs = NULL; @@ -897,7 +897,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d if ( !cloth_build_springs ( clmd, dm ) ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); modifier_setError ( & ( clmd->modifier ), "Can't build springs." ); printf("cloth_free_modifier cloth_build_springs\n"); return 0; @@ -931,7 +931,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d return 1; } -static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm ) +static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) { unsigned int numverts = dm->getNumVerts ( dm ); unsigned int numfaces = dm->getNumFaces ( dm ); @@ -943,7 +943,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh * clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" ); if ( clmd->clothObject->verts == NULL ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->verts." ); printf("cloth_free_modifier clmd->clothObject->verts\n"); return; @@ -954,7 +954,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh * clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" ); if ( clmd->clothObject->mfaces == NULL ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->mfaces." ); printf("cloth_free_modifier clmd->clothObject->mfaces\n"); return; @@ -1006,7 +1006,7 @@ int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned in return 0; } -static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *edgehash, LinkNode **edgelist) +static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), LinkNode **edgelist) { unsigned int i = 0; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index af12d23b2c2..5c9cc441b95 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -79,7 +79,7 @@ void collision_move_object ( CollisionModifierData *collmd, float step, float pr bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 ); } -BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon ) +BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int UNUSED(numverts), float epsilon ) { BVHTree *tree; float co[12]; @@ -106,7 +106,7 @@ BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert return tree; } -void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int numverts, int moving ) +void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int UNUSED(numverts), int moving ) { int i; MFace *mfaces = faces; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 90ffa39c88f..83ed65a1bf2 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -53,7 +53,7 @@ #include "IMB_imbuf_types.h" -void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w) +void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int UNUSED(w)) { int x, y; float *rf= rectf; @@ -74,7 +74,7 @@ void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, i } } -void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w) +void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int UNUSED(w)) { int x, y; float *rf= rectf; @@ -356,7 +356,7 @@ void curvemap_sethandle(CurveMap *cuma, int type) /* *********************** Making the tables and display ************** */ /* reduced copy of garbled calchandleNurb() code in curve.c */ -static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) +static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode)) { float *p1,*p2,*p3,pt[3]; float dx1,dy1, dx,dy, vx,vy, len,len1,len2; @@ -830,6 +830,10 @@ void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile) cmsCloseProfile(proofingProfile); } } +#else + /* unused */ + (void)ibuf; + (void)profile; #endif } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 3df395244f4..5dad01a126f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -655,7 +655,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { /* This function should be used for the get_target_matrix member of all * constraints that are not picky about what happens to their target matrix. */ -static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); @@ -1107,7 +1107,7 @@ static void kinematic_flush_tars (bConstraint *con, ListBase *list, short nocopy } } -static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bKinematicConstraint *data= con->data; @@ -1195,7 +1195,7 @@ static void followpath_flush_tars (bConstraint *con, ListBase *list, short nocop } } -static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bFollowPathConstraint *data= con->data; @@ -1330,7 +1330,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = { /* --------- Limit Location --------- */ -static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bLocLimitConstraint *data = con->data; @@ -1378,7 +1378,7 @@ static bConstraintTypeInfo CTI_LOCLIMIT = { /* -------- Limit Rotation --------- */ -static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bRotLimitConstraint *data = con->data; float loc[3]; @@ -1437,7 +1437,7 @@ static bConstraintTypeInfo CTI_ROTLIMIT = { /* --------- Limit Scaling --------- */ -static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bSizeLimitConstraint *data = con->data; float obsize[3], size[3]; @@ -1831,7 +1831,7 @@ static void translike_flush_tars (bConstraint *con, ListBase *list, short nocopy } } -static void translike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void translike_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct= targets->first; @@ -1867,7 +1867,7 @@ static void samevolume_new_data (void *cdata) data->volume = 1.0f; } -static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bSameVolumeConstraint *data= con->data; @@ -1981,7 +1981,7 @@ static void pycon_id_looper (bConstraint *con, ConstraintIDFunc func, void *user } /* Whether this approach is maintained remains to be seen (aligorith) */ -static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { #ifndef DISABLE_PYTHON bPythonConstraint *data= con->data; @@ -2105,7 +2105,7 @@ static void actcon_flush_tars (bConstraint *con, ListBase *list, short nocopy) } } -static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { extern void chan_calc_mat(bPoseChannel *chan); bActionConstraint *data = con->data; @@ -2196,7 +2196,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint } } -static void actcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void actcon_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct= targets->first; @@ -3076,7 +3076,7 @@ static void clampto_flush_tars (bConstraint *con, ListBase *list, short nocopy) } } -static void clampto_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void clampto_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; @@ -3410,7 +3410,7 @@ static void shrinkwrap_flush_tars (bConstraint *con, ListBase *list, short nocop } -static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; @@ -3513,7 +3513,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr } } -static void shrinkwrap_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void shrinkwrap_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct= targets->first; @@ -3729,7 +3729,7 @@ static void splineik_flush_tars (bConstraint *con, ListBase *list, short nocopy) } } -static void splineik_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void splineik_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; @@ -4161,7 +4161,7 @@ void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userda /* ......... */ /* helper for copy_constraints(), to be used for making sure that ID's are valid */ -static void con_extern_cb(bConstraint *con, ID **idpoin, void *userdata) +static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, void *UNUSED(userData)) { if (*idpoin && (*idpoin)->lib) id_lib_extern(*idpoin); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 9578b5185af..a7dd80bff4d 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2951,7 +2951,7 @@ void switchdirectionNurb(Nurb *nu) } -float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3] +float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] { int i, numVerts = *numVerts_r = count_curveverts(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos"); @@ -2979,7 +2979,7 @@ float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3] return cos; } -void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3]) +void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]) { float *co = vertexCos[0]; Nurb *nu; @@ -3004,7 +3004,7 @@ void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3]) } } -float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3] +float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] { int i, numVerts = count_curveverts(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos"); @@ -3035,7 +3035,7 @@ float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3] return cos; } -void curve_applyKeyVertexTilts(Curve *cu, ListBase *lb, float *key) +void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key) { Nurb *nu; int i; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 1f867a615b2..f4db8e953f9 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -468,8 +468,8 @@ static void layerSwap_mdisps(void *data, const int *ci) } } -static void layerInterp_mdisps(void **sources, float *weights, float *sub_weights, - int count, void *dest) +static void layerInterp_mdisps(void **UNUSED(sources), float *weights, float *sub_weights, + int UNUSED(count), void *dest) { MDisps *d = dest; int i; @@ -2503,7 +2503,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in cdf_free(cdf); } -void CustomData_external_add(CustomData *data, ID *id, int type, int totelem, const char *filename) +void CustomData_external_add(CustomData *data, ID *id, int type, int UNUSED(totelem), const char *filename) { CustomDataExternal *external= data->external; CustomDataLayer *layer; diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index 65a0d731beb..5954ac1b022 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -379,7 +379,7 @@ int cdf_write_open(CDataFile *cdf, char *filename) return 1; } -int cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay) +int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay)) { return 1; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 382c0690ae3..d95b7010993 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -846,7 +846,7 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, char *name) { DagAdjList *itA = fob2->parent; @@ -2280,7 +2280,7 @@ void DAG_on_load_update(Main *bmain) } } -static void dag_id_flush_update__isDependentTexture(void *userData, Object *ob, ID **idpoin) +static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUSED(ob), ID **idpoin) { struct { ID *id; int is_dependent; } *data = userData; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 2ab7e32a9c6..d1830cb8243 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -289,7 +289,7 @@ static void init_fastshade_shadeinput(Render *re) shi.combinedflag= -1; } -static Render *fastshade_get_render(Scene *scene) +static Render *fastshade_get_render(Scene *UNUSED(scene)) { // XXX 2.5: this crashes combined with previewrender // due to global R so disabled for now @@ -1117,7 +1117,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase) } -static void curve_to_filledpoly(Curve *cu, ListBase *nurb, ListBase *dispbase) +static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dispbase) { if(cu->flag & CU_3D) return; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 4860e7d8eed..f4fae3ed3c6 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -410,7 +410,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte /************************************************/ // triangle - ray callback function -static void eff_tri_ray_hit(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) +static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) { // whenever we hit a bounding box, we don't check further hit->dist = -1; @@ -515,7 +515,7 @@ static float falloff_func_rad(PartDeflect *pd, float fac) return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r); } -float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, EffectorWeights *weights) +float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNUSED(point), EffectorWeights *weights) { float temp[3]; float falloff = weights ? weights->weight[0] * weights->weight[eff->pd->forcefield] : 1.0f; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 43f01199b69..1575f69209f 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -556,7 +556,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt) /* Basic sampling callback which acts as a wrapper for evaluate_fcurve() * 'data' arg here is unneeded here... */ -float fcurve_samplingcb_evalcurve (FCurve *fcu, void *data, float evaltime) +float fcurve_samplingcb_evalcurve (FCurve *fcu, void *UNUSED(data), float evaltime) { /* assume any interference from drivers on the curve is intended... */ return evaluate_fcurve(fcu, evaltime); @@ -1331,7 +1331,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar) * - "evaltime" is the frame at which F-Curve is being evaluated * - has to return a float value */ -static float evaluate_driver (ChannelDriver *driver, float evaltime) +static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime)) { DriverVar *dvar; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 5a10f93ac72..6660442b14a 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -190,7 +190,7 @@ static void fcm_generator_verify (FModifier *fcm) } } -static void fcm_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Generator *data= (FMod_Generator *)fcm->data; @@ -303,7 +303,7 @@ static double sinc (double x) return sin(M_PI * x) / (M_PI * x); } -static void fcm_fn_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_FunctionGenerator *data= (FMod_FunctionGenerator *)fcm->data; double arg= data->phase_multiplier*evaltime + data->phase_offset; @@ -432,7 +432,7 @@ static void fcm_envelope_verify (FModifier *fcm) } } -static void fcm_envelope_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_envelope_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed, *prevfed, *lastfed; @@ -524,7 +524,7 @@ static void fcm_cycles_new_data (void *mdata) data->before_mode= data->after_mode= FCM_EXTRAPOLATE_CYCLIC; } -static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Cycles *data= (FMod_Cycles *)fcm->data; float prevkey[2], lastkey[2], cycyofs=0.0f; @@ -664,7 +664,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e return evaltime; } -static void fcm_cycles_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_cycles_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime)) { tFCMED_Cycles *edata= (tFCMED_Cycles *)fcm->edata; @@ -708,7 +708,7 @@ static void fcm_noise_new_data (void *mdata) data->modification = FCM_NOISE_MODIF_REPLACE; } -static void fcm_noise_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_noise_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Noise *data= (FMod_Noise *)fcm->data; float noise; @@ -800,7 +800,7 @@ static void fcm_python_copy (FModifier *fcm, FModifier *src) pymod->prop = IDP_CopyProperty(opymod->prop); } -static void fcm_python_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_python_evaluate (FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), float *UNUSED(cvalue), float UNUSED(evaltime)) { #ifndef DISABLE_PYTHON //FMod_Python *data= (FMod_Python *)fcm->data; @@ -829,7 +829,7 @@ static FModifierTypeInfo FMI_PYTHON = { /* Limits F-Curve Modifier --------------------------- */ -static float fcm_limits_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +static float fcm_limits_time (FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Limits *data= (FMod_Limits *)fcm->data; @@ -843,7 +843,7 @@ static float fcm_limits_time (FCurve *fcu, FModifier *fcm, float cvalue, float e return evaltime; } -static void fcm_limits_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_limits_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime)) { FMod_Limits *data= (FMod_Limits *)fcm->data; @@ -880,7 +880,7 @@ static void fcm_stepped_new_data (void *mdata) data->step_size = 2.0f; } -static float fcm_stepped_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +static float fcm_stepped_time (FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Stepped *data= (FMod_Stepped *)fcm->data; int snapblock; diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index bdf203119c3..5a031d62fcb 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -42,6 +42,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_group.h" #include "BKE_library.h" @@ -327,7 +328,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode) you can draw everything, leaves tags in objects to signal it needs further updating */ /* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */ -void group_handle_recalc_and_update(Scene *scene, Object *parent, Group *group) +void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group *group) { GroupObject *go; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index fec713805e3..d750300291b 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -103,8 +103,8 @@ static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */ if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0); - tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0); + tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect); ibuf->x *= 2; @@ -131,8 +131,8 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */ if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0); - tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0); + tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect); ibuf->x *= 2; @@ -389,11 +389,11 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, char *name, float *rect_float= NULL; if (floatbuf) { - ibuf= IMB_allocImBuf(width, height, depth, IB_rectfloat, 0); + ibuf= IMB_allocImBuf(width, height, depth, IB_rectfloat); rect_float= (float*)ibuf->rect_float; } else { - ibuf= IMB_allocImBuf(width, height, depth, IB_rect, 0); + ibuf= IMB_allocImBuf(width, height, depth, IB_rect); rect= (unsigned char*)ibuf->rect; } @@ -1681,7 +1681,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f if(rpass) { // printf("load from pass %s\n", rpass->name); /* since we free render results, we copy the rect */ - ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0); + ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0); ibuf->rect_float= MEM_dupallocN(rpass->rect); ibuf->flags |= IB_rectfloat; ibuf->mall= IB_rectfloat; @@ -1831,7 +1831,7 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser) RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser); if(rpass) { - ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0); + ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0); image_initialize_after_load(ima, ibuf); @@ -1938,7 +1938,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ /* make ibuf if needed, and initialize it */ if(ibuf==NULL) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0); image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); } @@ -2148,7 +2148,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) if(!ibuf) { /* Composite Viewer, all handled in compositor */ /* fake ibuf, will be filled in compositor */ - ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0); + ibuf= IMB_allocImBuf(256, 256, 32, IB_rect); image_assign_ibuf(ima, ibuf, 0, frame); } } diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 158f964a846..9baaf7e5abc 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -726,7 +726,7 @@ typedef struct Implicit_Data fmatrix3x3 *A, *dFdV, *dFdX, *S, *P, *Pinv, *bigI, *M; } Implicit_Data; -int implicit_init (Object *ob, ClothModifierData *clmd) +int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd) { unsigned int i = 0; unsigned int pinned = 0; @@ -1555,7 +1555,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec free_collider_cache(&colliders); } -static void cloth_calc_force(ClothModifierData *clmd, float frame, lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M) +static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M) { /* Collect forces and derivatives: F,dFdX,dFdV */ Cloth *cloth = clmd->clothObject; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5c0c0fbf0c1..846592f0f2f 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -317,7 +317,7 @@ static char *constraint_adrcodes_to_paths (int adrcode, int *array_index) * NOTE: as we don't have access to the keyblock where the data comes from (for now), * we'll just use numerical indicies for now... */ -static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index) +static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { static char buf[128]; @@ -331,7 +331,7 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index) } /* MTex (Texture Slot) types */ -static char *mtex_adrcodes_to_paths (int adrcode, int *array_index) +static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { char *base=NULL, *prop=NULL; static char buf[128]; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 708403ab1f7..aa9d0b4f57c 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1163,7 +1163,7 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float } } -static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float ctime, char *out, int tot) +static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float UNUSED(ctime), char *out, int tot) { Nurb *nu; int a, step; @@ -1657,7 +1657,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb) } } -void key_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb) +void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) { Nurb *nu; BezTriple *bezt; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 3f94992cd11..1e08432c271 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -337,7 +337,7 @@ int id_unlink(ID *id, int test) break; case ID_OB: if(test) return 1; - unlink_object(NULL, (Object*)id); + unlink_object((Object*)id); break; } @@ -822,7 +822,7 @@ void free_libblock_us(ListBase *lb, void *idv) /* test users */ else printf("ERROR block %s users %d\n", id->name, id->us); } if(id->us==0) { - if( GS(id->name)==ID_OB ) unlink_object(NULL, (Object *)id); + if( GS(id->name)==ID_OB ) unlink_object((Object *)id); free_libblock(lb, id); } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 3e9287dd511..faefbdacb45 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -71,7 +71,7 @@ EditMesh *BKE_mesh_get_editmesh(Mesh *me) return me->edit_mesh; } -void BKE_mesh_end_editmesh(Mesh *me, EditMesh *em) +void BKE_mesh_end_editmesh(Mesh *UNUSED(me), EditMesh *UNUSED(em)) { } @@ -561,7 +561,7 @@ static void mfaces_strip_loose(MFace *mface, int *totface) } /* Create edges based on known verts and faces */ -static void make_edges_mdata(MVert *allvert, MFace *allface, int totvert, int totface, +static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(totvert), int totface, int old, MEdge **alledge, int *_totedge) { MFace *mface; @@ -1441,7 +1441,7 @@ void mesh_pmv_free(PartialVisibility *pv) MEM_freeN(pv); } -void mesh_pmv_revert(Object *ob, Mesh *me) +void mesh_pmv_revert(Mesh *me) { if(me->pv) { unsigned i; @@ -1480,10 +1480,10 @@ void mesh_pmv_revert(Object *ob, Mesh *me) } } -void mesh_pmv_off(Object *ob, Mesh *me) +void mesh_pmv_off(Mesh *me) { - if(ob && me->pv) { - mesh_pmv_revert(ob, me); + if(me->pv) { + mesh_pmv_revert(me); MEM_freeN(me->pv); me->pv= NULL; } diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 57f568e6094..b0ab947d478 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -456,7 +456,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0, 0); } -static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal) +static DerivedMesh *subsurf_dm_create_local(Object *UNUSED(ob), DerivedMesh *dm, int lvl, int simple, int optimal) { SubsurfModifierData smd; @@ -780,7 +780,7 @@ void multires_stitch_grids(Object *ob) } DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob, - int useRenderParams, int isFinalCalc) + int useRenderParams, int UNUSED(isFinalCalc)) { Mesh *me= ob->data; DerivedMesh *result; @@ -874,7 +874,7 @@ static void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u add_v3_v3v3(out, d2[0], d2[1]); } -static void old_mdisps_rotate(int S, int newside, int oldside, int x, int y, float *u, float *v) +static void old_mdisps_rotate(int S, int UNUSED(newside), int oldside, int x, int y, float *u, float *v) { float offset = oldside*0.5f - 0.5f; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index b053d615756..09ba967e265 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1585,7 +1585,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt) /* Baking Tools ------------------------------------------- */ -void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int flag) +void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int UNUSED(flag)) { /* verify that data is valid diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3df9bd6ed05..17e488c8353 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -320,7 +320,7 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec } } -void unlink_object(Scene *scene, Object *ob) +void unlink_object(Object *ob) { Main *bmain= G.main; Object *obt; @@ -1617,7 +1617,7 @@ void disable_speed_curve(int val) // XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP! /* ob can be NULL */ -float bsystem_time(struct Scene *scene, Object *ob, float cfra, float ofs) +float bsystem_time(struct Scene *scene, Object *UNUSED(ob), float cfra, float ofs) { /* returns float ( see BKE_curframe in scene.c) */ cfra += scene->r.subframe; diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 5bbb3506a78..78340288836 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -486,7 +486,7 @@ int unpackSound(ReportList *reports, bSound *sound, int how) freePackedFile(sound->packedfile); sound->packedfile = 0; - sound_load(NULL, sound); + sound_load(sound); ret_value = RET_OK; } diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index ffb99c10c40..116ed3c8ef2 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -31,6 +31,7 @@ #include "DNA_scene_types.h" #include "DNA_brush_types.h" +#include "BKE_utildefines.h" #include "BKE_brush.h" #include "BKE_library.h" #include "BKE_paint.h" @@ -100,7 +101,7 @@ void paint_init(Paint *p, const char col[3]) p->flags |= PAINT_SHOW_BRUSH; } -void free_paint(Paint *paint) +void free_paint(Paint *UNUSED(paint)) { /* nothing */ } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ebbb3ea1020..f7345d6159a 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -380,7 +380,7 @@ void psys_free_settings(ParticleSettings *part) fluid_free_settings(part->fluid); } -void free_hair(Object *ob, ParticleSystem *psys, int dynamics) +void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics) { PARTICLE_P; @@ -405,7 +405,7 @@ void free_hair(Object *ob, ParticleSystem *psys, int dynamics) psys->pointcache = BKE_ptcache_add(&psys->ptcaches); } else { - cloth_free_modifier(ob, psys->clmd); + cloth_free_modifier(psys->clmd); } } @@ -1052,7 +1052,7 @@ typedef struct ParticleInterpolationData { } ParticleInterpolationData; /* Assumes pointcache->mem_cache exists, so for disk cached particles call psys_make_temp_pointcache() before use */ /* It uses ParticleInterpolationData->pm to store the current memory cache frame so it's thread safe. */ -static void get_pointcache_keys_for_time(Object *ob, PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2) +static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2) { static PTCacheMem *pm = NULL; @@ -1803,7 +1803,7 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys) /* Particles on a shape */ /************************************************/ /* ready for future use */ -static void psys_particle_on_shape(int distr, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) +static void psys_particle_on_shape(int UNUSED(distr), int index, float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) { /* TODO */ float zerovec[3]={0.0f,0.0f,0.0f}; @@ -2185,7 +2185,7 @@ static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float VECADDFAC(state->co,state->co,mat[0],rough[0]); VECADDFAC(state->co,state->co,mat[1],rough[1]); } -static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float cfra, float *length, float *vec) +static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float UNUSED(cfra), float *length, float *vec) { float force[3] = {0.0f,0.0f,0.0f}; ParticleKey eff_key; @@ -3339,7 +3339,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m triatomat(v[0], v[1], v[2], (osface)? osface->uv: NULL, mat); } -void psys_mat_hair_to_object(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4]) +void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4]) { float vec[3]; @@ -3818,7 +3818,7 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra, return (cfra-time)/life; } -float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float cfra, float *pa_time) +float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED(cfra), float *UNUSED(pa_time)) { ParticleSettings *part = psys->part; float size; // time XXX @@ -4249,7 +4249,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta } } -void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco) +void psys_get_dupli_texture(Object *UNUSED(ob), ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco) { MFace *mface; MTFace *mtface; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index fa82d2c5359..8ab4117c8a1 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1437,7 +1437,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) } /* ready for future use, to emit particles without geometry */ -static void distribute_particles_on_shape(ParticleSimulationData *sim, int from) +static void distribute_particles_on_shape(ParticleSimulationData *sim, int UNUSED(from)) { ParticleSystem *psys = sim->psys; PARTICLE_P; @@ -2289,7 +2289,7 @@ static void psys_update_effectors(ParticleSimulationData *sim) In theory, there could be unlimited implementation of SPH simulators **************************************************/ -void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float cfra, float mass){ +void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float UNUSED(cfra), float mass){ /**************************************************************************************************************** * This code uses in some parts adapted algorithms from the pseduo code as outlined in the Research paper * Titled: Particle-based Viscoelastic Fluid Simulation. @@ -3284,7 +3284,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra) psys_calc_dmcache(sim->ob, sim->psmd->dm, psys); if(psys->clmd) - cloth_free_modifier(sim->ob, psys->clmd); + cloth_free_modifier(psys->clmd); } /* dynamics with cloth simulation */ @@ -3298,7 +3298,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra) psys->flag |= PSYS_HAIR_UPDATED; } -static void save_hair(ParticleSimulationData *sim, float cfra){ +static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ Object *ob = sim->ob; ParticleSystem *psys = sim->psys; HairKey *key, *root; @@ -3574,7 +3574,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) } } -static void particles_fluid_step(ParticleSimulationData *sim, int cfra) +static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) { ParticleSystem *psys = sim->psys; if(psys->particles){ @@ -3682,7 +3682,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra) #endif // DISABLE_ELBEEM } -static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float cfra) +static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra)) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index f9d2c1c3fec..3896d523b11 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -132,7 +132,7 @@ static int ptcache_write_basic_header(PTCacheFile *pf) return 1; } /* Softbody functions */ -static int ptcache_write_softbody(int index, void *soft_v, void **data, int cfra) +static int ptcache_write_softbody(int index, void *soft_v, void **data, int UNUSED(cfra)) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -142,7 +142,7 @@ static int ptcache_write_softbody(int index, void *soft_v, void **data, int cfra return 1; } -static void ptcache_read_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float *old_data) +static void ptcache_read_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -156,7 +156,7 @@ static void ptcache_read_softbody(int index, void *soft_v, void **data, float fr PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, 0, bp->vec); } } -static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -188,7 +188,7 @@ static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, f VECCOPY(bp->pos, keys->co); VECCOPY(bp->vec, keys->vel); } -static int ptcache_totpoint_softbody(void *soft_v, int cfra) +static int ptcache_totpoint_softbody(void *soft_v, int UNUSED(cfra)) { SoftBody *soft= soft_v; return soft->totpoint; @@ -348,7 +348,7 @@ static void ptcache_interpolate_particle(int index, void *psys_v, void **data, f pa->state.time = cfra; } -static int ptcache_totpoint_particle(void *psys_v, int cfra) +static int ptcache_totpoint_particle(void *psys_v, int UNUSED(cfra)) { ParticleSystem *psys = psys_v; return psys->totpart; @@ -493,7 +493,7 @@ static int ptcache_totwrite_particle(void *psys_v, int cfra) //} // /* Cloth functions */ -static int ptcache_write_cloth(int index, void *cloth_v, void **data, int cfra) +static int ptcache_write_cloth(int index, void *cloth_v, void **data, int UNUSED(cfra)) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -505,7 +505,7 @@ static int ptcache_write_cloth(int index, void *cloth_v, void **data, int cfra) return 1; } -static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float *old_data) +static void ptcache_read_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -522,7 +522,7 @@ static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_ PTCACHE_DATA_TO(data, BPHYS_DATA_XCONST, 0, vert->xconst); } } -static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -558,7 +558,7 @@ static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, flo /* should vert->xconst be interpolated somehow too? - jahka */ } -static int ptcache_totpoint_cloth(void *cloth_v, int cfra) +static int ptcache_totpoint_cloth(void *cloth_v, int UNUSED(cfra)) { ClothModifierData *clmd= cloth_v; return clmd->clothObject ? clmd->clothObject->numverts : 0; @@ -635,7 +635,7 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p } /* Smoke functions */ -static int ptcache_totpoint_smoke(void *smoke_v, int cfra) +static int ptcache_totpoint_smoke(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; @@ -648,7 +648,7 @@ static int ptcache_totpoint_smoke(void *smoke_v, int cfra) } /* Smoke functions */ -static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int cfra) +static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; @@ -671,6 +671,8 @@ static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned i unsigned char *props = MEM_callocN(16*sizeof(char), "tmp"); size_t sizeOfIt = 5; + (void)mode; /* unused when building w/o compression */ + #ifdef WITH_LZO out_len= LZO_OUT_LEN(in_len); if(mode == 1) { @@ -2220,7 +2222,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) cache->flag &= ~PTCACHE_REDO_NEEDED; if(pid->type == PTCACHE_TYPE_CLOTH) - cloth_free_modifier(pid->ob, pid->calldata); + cloth_free_modifier(pid->calldata); else if(pid->type == PTCACHE_TYPE_SOFTBODY) sbFreeSimulation(pid->calldata); else if(pid->type == PTCACHE_TYPE_PARTICLES) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 3f41b704f97..fde180cadc6 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -106,7 +106,7 @@ void free_qtcodecdata(QuicktimeCodecData *qcd) } } -Scene *copy_scene(Main *bmain, Scene *sce, int type) +Scene *copy_scene(Scene *sce, int type) { Scene *scen; ToolSettings *ts; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 7b428661c6d..7ce5dcc3884 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -53,7 +53,7 @@ #include "RNA_access.h" /* **** XXX **** */ -static void error(const char *error, ...) {} +static void error(const char *UNUSED(error), ...) {} #define INT 96 #define FLO 128 @@ -77,15 +77,15 @@ static struct ImBuf * prepare_effect_imbufs( if (!ibuf1 && !ibuf2 && !ibuf3) { /* hmmm, global float option ? */ - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect); } else if ((ibuf1 && ibuf1->rect_float) || (ibuf2 && ibuf2->rect_float) || (ibuf3 && ibuf3->rect_float)) { /* if any inputs are rectfloat, output is float too */ - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat); } else { - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect); } if (ibuf1 && !ibuf1->rect_float && out->rect_float) { @@ -273,9 +273,9 @@ static ImBuf * IMB_cast_away_list(ImBuf * i) } static struct ImBuf * do_plugin_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float cfra, float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -370,8 +370,8 @@ static struct ImBuf * do_plugin_effect( return out; } -static int do_plugin_early_out(struct Sequence *seq, - float facf0, float facf1) +static int do_plugin_early_out(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 0; } @@ -524,9 +524,9 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_alphaover_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -696,9 +696,9 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf* do_alphaunder_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -821,9 +821,9 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y, /* carefull: also used by speed effect! */ static struct ImBuf* do_cross_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -976,19 +976,19 @@ static void build_gammatabs() } } -static void init_gammacross(Sequence * seq) +static void init_gammacross(Sequence * UNUSED(seq)) { } -static void load_gammacross(Sequence * seq) +static void load_gammacross(Sequence * UNUSED(seq)) { } -static void free_gammacross(Sequence * seq) +static void free_gammacross(Sequence * UNUSED(seq)) { } -static void do_gammacross_effect_byte(float facf0, float facf1, +static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1, unsigned char *rect2, @@ -1044,7 +1044,7 @@ static void do_gammacross_effect_byte(float facf0, float facf1, } -static void do_gammacross_effect_float(float facf0, float facf1, +static void do_gammacross_effect_float(float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) @@ -1088,9 +1088,9 @@ static void do_gammacross_effect_float(float facf0, float facf1, } static struct ImBuf * do_gammacross_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1206,9 +1206,9 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y, } } -static struct ImBuf * do_add_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_add_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1323,9 +1323,9 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_sub_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1537,9 +1537,9 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_mul_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1876,7 +1876,7 @@ static void copy_wipe_effect(Sequence *dst, Sequence *src) dst->effectdata = MEM_dupallocN(src->effectdata); } -static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1, +static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) @@ -1934,7 +1934,7 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1, } } -static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, +static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) @@ -1993,9 +1993,9 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_wipe_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2111,7 +2111,7 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out } } -static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, +static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y, struct ImBuf *ibuf1,struct ImBuf *out) { TransformVars *transform = (TransformVars *)seq->effectdata; @@ -2144,9 +2144,9 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, static struct ImBuf * do_transform_effect( - Main *bmain, Scene *scene, Sequence *seq,float cfra, - float facf0, float facf1, int x, int y, - int preview_render_size, + Main *UNUSED(bmain), Scene *scene, Sequence *seq,float UNUSED(cfra), + float facf0, float UNUSED(facf1), int x, int y, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2631,7 +2631,7 @@ static void copy_glow_effect(Sequence *dst, Sequence *src) } //void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use) -static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1, +static void do_glow_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, char *rect1, char *rect2, char *out) { @@ -2646,7 +2646,7 @@ static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1, RVAddBitmaps_byte (inbuf , outbuf, outbuf, x, y); } -static void do_glow_effect_float(Sequence *seq, float facf0, float facf1, +static void do_glow_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) { @@ -2662,9 +2662,9 @@ static void do_glow_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_glow_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2716,16 +2716,16 @@ static void copy_solid_color(Sequence *dst, Sequence *src) dst->effectdata = MEM_dupallocN(src->effectdata); } -static int early_out_color(struct Sequence *seq, - float facf0, float facf1) +static int early_out_color(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return -1; } static struct ImBuf * do_solid_color( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2813,14 +2813,14 @@ static int num_inputs_multicam() return 0; } -static int early_out_multicam(struct Sequence *seq, float facf0, float facf1) +static int early_out_multicam(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1)) { return -1; } static struct ImBuf * do_multicam( Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, + float UNUSED(facf0), float UNUSED(facf1), int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) @@ -2907,8 +2907,8 @@ static void copy_speed_effect(Sequence *dst, Sequence *src) v->length = 0; } -static int early_out_speed(struct Sequence *seq, - float facf0, float facf1) +static int early_out_speed(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 1; } @@ -3039,22 +3039,22 @@ static void do_speed_effect(Sequence * seq,int cfra, ********************************************************************** */ -static void init_noop(struct Sequence *seq) +static void init_noop(struct Sequence *UNUSED(seq)) { } -static void load_noop(struct Sequence *seq) +static void load_noop(struct Sequence *UNUSED(seq)) { } -static void init_plugin_noop(struct Sequence *seq, const char * fname) +static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname)) { } -static void free_noop(struct Sequence *seq) +static void free_noop(struct Sequence *UNUSED(seq)) { } @@ -3064,13 +3064,13 @@ static int num_inputs_default() return 2; } -static int early_out_noop(struct Sequence *seq, - float facf0, float facf1) +static int early_out_noop(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 0; } -static int early_out_fade(struct Sequence *seq, +static int early_out_fade(struct Sequence *UNUSED(seq), float facf0, float facf1) { if (facf0 == 0.0 && facf1 == 0.0) { @@ -3081,7 +3081,7 @@ static int early_out_fade(struct Sequence *seq, return 0; } -static int early_out_mul_input2(struct Sequence *seq, +static int early_out_mul_input2(struct Sequence *UNUSED(seq), float facf0, float facf1) { if (facf0 == 0.0 && facf1 == 0.0) { @@ -3090,13 +3090,13 @@ static int early_out_mul_input2(struct Sequence *seq, return 0; } -static void store_icu_yrange_noop(struct Sequence * seq, +static void store_icu_yrange_noop(struct Sequence * UNUSED(seq), short adrcode, float * ymin, float * ymax) { /* defaults are fine */ } -static void get_default_fac_noop(struct Sequence *seq, float cfra, +static void get_default_fac_noop(struct Sequence *UNUSED(seq), float UNUSED(cfra), float * facf0, float * facf1) { *facf0 = *facf1 = 1.0; @@ -3111,10 +3111,10 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra, *facf1 /= seq->len; } -static struct ImBuf * do_overdrop_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_overdrop_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf * ibuf1, struct ImBuf * ibuf2, struct ImBuf * ibuf3) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index dcd411409f9..6d087837302 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1021,7 +1021,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se #define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE) -static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * name, int render_size) +static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, char * name, int render_size) { int frameno; char dir[FILE_MAXDIR]; @@ -1444,7 +1444,7 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul) */ int input_have_to_preprocess( - Scene *scene, Sequence * seq, float cfra, int seqrectx, int seqrecty) + Scene *UNUSED(scene), Sequence * seq, float UNUSED(cfra), int UNUSED(seqrectx), int UNUSED(seqrecty)) { float mul; @@ -1476,7 +1476,7 @@ int input_have_to_preprocess( } static ImBuf * input_preprocess( - Scene *scene, Sequence *seq, float cfra, int seqrectx, int seqrecty, + Scene *scene, Sequence *seq, float UNUSED(cfra), int seqrectx, int seqrecty, ImBuf * ibuf) { float mul; @@ -1521,9 +1521,9 @@ static ImBuf * input_preprocess( ImBuf * i; if (ibuf->rect_float) { - i = IMB_allocImBuf(dx, dy,32, IB_rectfloat, 0); + i = IMB_allocImBuf(dx, dy,32, IB_rectfloat); } else { - i = IMB_allocImBuf(dx, dy,32, IB_rect, 0); + i = IMB_allocImBuf(dx, dy,32, IB_rect); } IMB_rectcpy(i, ibuf, @@ -1787,7 +1787,7 @@ finish: if (!out) { out = IMB_allocImBuf( - (short)seqrectx, (short)seqrecty, 32, IB_rect, 0); + (short)seqrectx, (short)seqrecty, 32, IB_rect); } return out; @@ -1878,7 +1878,7 @@ static ImBuf * seq_render_scene_strip_impl( RE_AcquireResultImage(re, &rres); if(rres.rectf) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat); memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty); if(rres.rectz) { addzbuffloatImBuf(ibuf); @@ -1890,7 +1890,7 @@ static ImBuf * seq_render_scene_strip_impl( IMB_convert_profile(ibuf, IB_PROFILE_SRGB); } else if (rres.rect32) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect); memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty); } @@ -2079,7 +2079,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float if (!ibuf) { ibuf = IMB_allocImBuf( - (short)seqrectx, (short)seqrecty, 32, IB_rect, 0); + (short)seqrectx, (short)seqrecty, 32, IB_rect); } if (ibuf->x != seqrectx || ibuf->y != seqrecty) { @@ -2213,7 +2213,7 @@ static ImBuf* seq_render_strip_stack( if (i == 0) { out = IMB_allocImBuf( (short)seqrectx, (short)seqrecty, - 32, IB_rect, 0); + 32, IB_rect); } break; case 0: diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 965ce9801d7..d1eed94d330 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -435,7 +435,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) } /*! init triangle divisions */ -void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) +void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) { // mTriangleDivs1.resize( faces.size() ); // mTriangleDivs2.resize( faces.size() ); @@ -1270,7 +1270,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) } } } -void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) +void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { if((smd->type & MOD_SMOKE_TYPE_FLOW)) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 98a50eee146..58aa171e97b 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -171,7 +171,7 @@ static void Vec3PlusStVec(float *v, float s, float *v1); /*physical unit of force is [kg * m / sec^2]*/ -static float sb_grav_force_scale(Object *ob) +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 */ @@ -179,7 +179,7 @@ static float sb_grav_force_scale(Object *ob) return (0.001f); } -static float sb_fric_force_scale(Object *ob) +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 */ @@ -1029,7 +1029,7 @@ static int query_external_colliders(Scene *scene, Object *me) /* +++ the aabb "force" section*/ -static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float time) +static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float UNUSED(time)) { Object *ob; SoftBody *sb=vertexowner->soft; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 5e95b19b64f..bf8e2d348ac 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -79,7 +79,7 @@ void sound_init_once() AUD_initOnce(); } -void sound_init(struct Main *bmain) +void sound_init(void) { AUD_DeviceSpecs specs; int device, buffersize; @@ -141,7 +141,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename) BLI_strncpy(sound->name, filename, FILE_MAX); // XXX unused currently sound->type = SOUND_TYPE_FILE; - sound_load(bmain, sound); + sound_load(sound); if(!sound->playback_handle) { @@ -167,7 +167,7 @@ struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source) sound->child_sound = source; sound->type = SOUND_TYPE_BUFFER; - sound_load(CTX_data_main(C), sound); + sound_load(sound); if(!sound->playback_handle) { @@ -193,7 +193,7 @@ struct bSound* sound_new_limiter(struct bContext *C, struct bSound *source, floa sound->end = end; sound->type = SOUND_TYPE_LIMITER; - sound_load(CTX_data_main(C), sound); + sound_load(sound); if(!sound->playback_handle) { @@ -234,7 +234,7 @@ void sound_delete_cache(struct bSound* sound) } } -void sound_load(struct Main *bmain, struct bSound* sound) +void sound_load(struct bSound* sound) { if(sound) { diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 00614ef0f4f..8363ff13ef9 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -137,6 +137,8 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL int quality; double framerate; + (void)scene; /* unused */ + filepath_avi(name, rd); sframe = (rd->sfra); @@ -175,7 +177,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL return 1; } -static int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports) +static int append_avi(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports)) { unsigned int *rt1, *rt2, *rectot; int x, y; diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index b0c05c31fa1..bbc441f3622 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -47,6 +47,7 @@ #include "DNA_userdef_types.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_report.h" @@ -96,10 +97,12 @@ static int closesocket(int fd) } #endif -int start_frameserver(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports) +int start_frameserver(struct Scene *scene, RenderData *UNUSED(rd), int rectx, int recty, ReportList *reports) { struct sockaddr_in addr; int arg = 1; + + (void)scene; /* unused */ if (!startup_socket_system()) { BKE_report(reports, RPT_ERROR, "Can't startup socket system"); @@ -243,7 +246,7 @@ static int handle_request(RenderData *rd, char * req) return -1; } -int frameserver_loop(RenderData *rd, ReportList *reports) +int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports)) { fd_set readfds; struct timeval tv; @@ -350,7 +353,7 @@ static void serve_ppm(int *pixels, int rectx, int recty) connsock = -1; } -int append_frameserver(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports) +int append_frameserver(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports)) { fprintf(stderr, "Serving frame: %d\n", frame); if (write_ppm) { diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index cf94a0c9ffe..0d541c1fe37 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -132,6 +132,7 @@ void BLI_kdtree_balance(KDTree *tree) static float squared_distance(float *v2, float *v1, float *n1, float *n2) { float d[3], dist; + (void)n1; /* unused */ d[0]= v2[0]-v1[0]; d[1]= v2[1]-v1[1]; diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index 55d6ce7a241..a674f38cec6 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -122,6 +122,7 @@ void *PIL_dynlib_find_symbol(PILdynlib* lib, char *symname) { } char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { + (void)lib; /* unused */ return dlerror(); } diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 141e5438bc9..801130eebc8 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1052,15 +1052,17 @@ float BLI_hnoisep(float noisesize, float x, float y, float z) /* Camberra omitted, didn't seem useful */ /* distance squared */ -static float dist_Squared(float x, float y, float z, float e) { return (x*x + y*y + z*z); } +static float dist_Squared(float x, float y, float z, float e) { (void)e; return (x*x + y*y + z*z); } /* real distance */ -static float dist_Real(float x, float y, float z, float e) { return sqrt(x*x + y*y + z*z); } +static float dist_Real(float x, float y, float z, float e) { (void)e; return sqrt(x*x + y*y + z*z); } /* manhattan/taxicab/cityblock distance */ -static float dist_Manhattan(float x, float y, float z, float e) { return (fabs(x) + fabs(y) + fabs(z)); } +static float dist_Manhattan(float x, float y, float z, float e) { (void)e; return (fabs(x) + fabs(y) + fabs(z)); } /* Chebychev */ static float dist_Chebychev(float x, float y, float z, float e) { float t; + (void)e; + x = fabs(x); y = fabs(y); z = fabs(z); @@ -1072,12 +1074,14 @@ static float dist_Chebychev(float x, float y, float z, float e) static float dist_MinkovskyH(float x, float y, float z, float e) { float d = sqrt(fabs(x)) + sqrt(fabs(y)) + sqrt(fabs(z)); + (void)e; return (d*d); } /* minkovsky preset exponent 4 */ static float dist_Minkovsky4(float x, float y, float z, float e) { + (void)e; x *= x; y *= y; z *= z; diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 726ed817f8b..eb2057220fe 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -442,6 +442,8 @@ ThreadedWorker *BLI_create_worker(void *(*do_thread)(void *), int tot, int sleep { ThreadedWorker *worker; + (void)sleep_time; /* unused */ + worker = MEM_callocN(sizeof(ThreadedWorker), "threadedworker"); if (tot > RE_MAX_THREAD) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ebd407e7e21..7c8c7eb6e5d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5308,7 +5308,7 @@ static void lib_link_sound(FileData *fd, Main *main) sound->id.flag -= LIB_NEEDLINK; sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system - sound_load(main, sound); + sound_load(sound); if(sound->cache) sound_cache(sound, 1); diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h index b8628b00575..668d14508ec 100644 --- a/source/blender/blenpluginapi/iff.h +++ b/source/blender/blenpluginapi/iff.h @@ -81,7 +81,7 @@ typedef struct ImBuf { int refcounter; /* reference counter for multiple users */ } ImBuf; -LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar); +LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint); LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *); LIBIMPORT void freeImBuf(struct ImBuf*); diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c index 9e739f7927d..a12488ae868 100644 --- a/source/blender/blenpluginapi/intern/pluginapi.c +++ b/source/blender/blenpluginapi/intern/pluginapi.c @@ -101,10 +101,9 @@ LIBEXPORT void freeT(void *vmemh) LIBEXPORT struct ImBuf *allocImBuf(short x, short y, uchar d, - uint flags, - uchar bitmap) + uint flags) { - return IMB_allocImBuf(x, y, d, flags, bitmap); + return IMB_allocImBuf(x, y, d, flags); } diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 3fb8e441d6f..73c7cfd4381 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -89,7 +89,7 @@ /* Draw Backdrop ---------------------------------- */ /* get backdrop color for top-level widgets (Scene and Object only) */ -static void acf_generic_root_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { /* darker blue for top-level widgets */ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color); @@ -115,7 +115,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa /* get backdrop color for data expanders under top-level Scene/Object */ -static void acf_generic_dataexpand_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { /* lighter color than top-level widget */ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color); @@ -202,11 +202,11 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f /* Indention + Offset ------------------------------------------- */ /* indention level is always the value in the name */ -static short acf_generic_indention_0(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 0; } -static short acf_generic_indention_1(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 1; } @@ -218,7 +218,7 @@ static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale) #endif /* indention which varies with the grouping status */ -static short acf_generic_indention_flexible(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale) { short indent= 0; @@ -352,7 +352,7 @@ static void *acf_generic_dsexpand_setting_ptr(bAnimListElem *ale, int setting, s } /* check if some setting exists for this object-based data-expander (datablock only) */ -static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* expand is always supported */ @@ -375,7 +375,7 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle /* Animation Summary ----------------------------------- */ /* get backdrop color for summary widget */ -static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { // FIXME: hardcoded color - same as the 'action' line in NLA // reddish color @@ -404,27 +404,27 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi } /* name for summary entries */ -static void acf_summary_name(bAnimListElem *ale, char *name) +static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name) { if (name) strcpy(name, "DopeSheet Summary"); } // TODO: this is really a temp icon I think -static int acf_summary_icon(bAnimListElem *ale) +static int acf_summary_icon(bAnimListElem *UNUSED(ale)) { return ICON_BORDERMOVE; } /* check if some setting exists for this channel */ -static short acf_summary_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { /* only expanded is supported, as it is used for hiding all stuff which the summary covers */ return (setting == ACHANNEL_SETTING_EXPAND); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_summary_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { if (setting == ACHANNEL_SETTING_EXPAND) { /* expanded */ @@ -481,13 +481,13 @@ static bAnimChannelType ACF_SUMMARY = /* Scene ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_scene_icon(bAnimListElem *ale) +static int acf_scene_icon(bAnimListElem *UNUSED(ale)) { return ICON_SCENE_DATA; } /* check if some setting exists for this channel */ -static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* muted only in NLA */ @@ -509,7 +509,7 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_scene_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -652,7 +652,7 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_object_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -726,7 +726,7 @@ static bAnimChannelType ACF_OBJECT = /* Group ------------------------------------------- */ /* get backdrop color for group widget */ -static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color) { /* highlight only for action group channels */ if (ale->flag & AGRP_ACTIVE) @@ -764,7 +764,7 @@ static void acf_group_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { /* for now, all settings are supported, though some are only conditionally */ switch (setting) { @@ -814,7 +814,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg) } /* get pointer to the setting */ -static void *acf_group_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) { bActionGroup *agrp= (bActionGroup *)ale->data; @@ -875,7 +875,7 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -900,7 +900,7 @@ static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg) } /* get pointer to the setting */ -static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) { FCurve *fcu= (FCurve *)ale->data; @@ -929,13 +929,13 @@ static bAnimChannelType ACF_FCURVE = /* Object Action Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillactd_icon(bAnimListElem *ale) +static int acf_fillactd_icon(bAnimListElem *UNUSED(ale)) { return ICON_ACTION; } /* check if some setting exists for this channel */ -static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* only select and expand supported */ @@ -949,7 +949,7 @@ static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, in } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillactd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1013,19 +1013,19 @@ static bAnimChannelType ACF_FILLACTD = /* Drivers Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_filldrivers_icon(bAnimListElem *ale) +static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale)) { return ICON_ANIM_DATA; } -static void acf_filldrivers_name(bAnimListElem *ale, char *name) +static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Drivers"); } /* check if some setting exists for this channel */ // TODO: this could be made more generic -static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* only expand supported */ @@ -1038,7 +1038,7 @@ static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filldrivers_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1091,18 +1091,18 @@ static bAnimChannelType ACF_FILLDRIVERS = /* Materials Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillmatd_icon(bAnimListElem *ale) +static int acf_fillmatd_icon(bAnimListElem *UNUSED(ale)) { return ICON_MATERIAL_DATA; } -static void acf_fillmatd_name(bAnimListElem *ale, char *name) +static void acf_fillmatd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Materials"); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillmatd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillmatd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1137,18 +1137,18 @@ static bAnimChannelType ACF_FILLMATD= /* Particles Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillpartd_icon(bAnimListElem *ale) +static int acf_fillpartd_icon(bAnimListElem *UNUSED(ale)) { return ICON_PARTICLE_DATA; } -static void acf_fillpartd_name(bAnimListElem *ale, char *name) +static void acf_fillpartd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Particles"); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillpartd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillpartd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1205,12 +1205,12 @@ static short acf_filltexd_offset(bAnimContext *ac, bAnimListElem *ale) } // TODO: just get this from RNA? -static int acf_filltexd_icon(bAnimListElem *ale) +static int acf_filltexd_icon(bAnimListElem *UNUSED(ale)) { return ICON_TEXTURE_DATA; } -static void acf_filltexd_name(bAnimListElem *ale, char *name) +static void acf_filltexd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Textures"); } @@ -1253,7 +1253,7 @@ static void *acf_filltexd_setting_ptr(bAnimListElem *ale, int setting, short *ty } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filltexd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_filltexd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1289,19 +1289,19 @@ static bAnimChannelType ACF_FILLTEXD= /* Material Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmat_icon(bAnimListElem *ale) +static int acf_dsmat_icon(bAnimListElem *UNUSED(ale)) { return ICON_MATERIAL_DATA; } /* offset for material expanders */ -static short acf_dsmat_offset(bAnimContext *ac, bAnimListElem *ale) +static short acf_dsmat_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 21; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmat_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1371,13 +1371,13 @@ static bAnimChannelType ACF_DSMAT= /* Lamp Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dslam_icon(bAnimListElem *ale) +static int acf_dslam_icon(bAnimListElem *UNUSED(ale)) { return ICON_LAMP_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslam_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1447,13 +1447,13 @@ static bAnimChannelType ACF_DSLAM= /* Texture Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dstex_icon(bAnimListElem *ale) +static int acf_dstex_icon(bAnimListElem *UNUSED(ale)) { return ICON_TEXTURE_DATA; } /* offset for texture expanders */ -static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale) +static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale) { short offset = 21; @@ -1472,7 +1472,7 @@ static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dstex_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1542,13 +1542,13 @@ static bAnimChannelType ACF_DSTEX= /* Camera Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dscam_icon(bAnimListElem *ale) +static int acf_dscam_icon(bAnimListElem *UNUSED(ale)) { return ICON_CAMERA_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscam_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1634,7 +1634,7 @@ static int acf_dscur_icon(bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscur_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1704,13 +1704,13 @@ static bAnimChannelType ACF_DSCUR= /* Shape Key Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsskey_icon(bAnimListElem *ale) +static int acf_dsskey_icon(bAnimListElem *UNUSED(ale)) { return ICON_SHAPEKEY_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsskey_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1780,13 +1780,13 @@ static bAnimChannelType ACF_DSSKEY= /* World Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dswor_icon(bAnimListElem *ale) +static int acf_dswor_icon(bAnimListElem *UNUSED(ale)) { return ICON_WORLD_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dswor_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1856,13 +1856,13 @@ static bAnimChannelType ACF_DSWOR= /* Particle Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dspart_icon(bAnimListElem *ale) +static int acf_dspart_icon(bAnimListElem *UNUSED(ale)) { return ICON_PARTICLE_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dspart_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1932,13 +1932,13 @@ static bAnimChannelType ACF_DSPART= /* MetaBall Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmball_icon(bAnimListElem *ale) +static int acf_dsmball_icon(bAnimListElem *UNUSED(ale)) { return ICON_META_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmball_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2008,13 +2008,13 @@ static bAnimChannelType ACF_DSMBALL= /* Armature Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsarm_icon(bAnimListElem *ale) +static int acf_dsarm_icon(bAnimListElem *UNUSED(ale)) { return ICON_ARMATURE_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsarm_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2084,13 +2084,13 @@ static bAnimChannelType ACF_DSARM= /* NodeTree Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsntree_icon(bAnimListElem *ale) +static int acf_dsntree_icon(bAnimListElem *UNUSED(ale)) { return ICON_NODETREE; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsntree_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2160,13 +2160,13 @@ static bAnimChannelType ACF_DSNTREE= /* Mesh Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmesh_icon(bAnimListElem *ale) +static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale)) { return ICON_MESH_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmesh_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2251,7 +2251,7 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { case ACHANNEL_SETTING_SELECT: /* selected */ @@ -2266,7 +2266,7 @@ static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, in } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_shapekey_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2851,7 +2851,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float /* ------------------ */ /* callback for (normal) widget settings - send notifiers */ -static void achannel_setting_widget_cb(bContext *C, void *poin, void *poin2) +static void achannel_setting_widget_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 1ac17aee871..16eb08be933 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1628,7 +1628,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot) /* ******************** Mouse-Click Operator *********************** */ /* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */ -static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, short selectmode) +static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_index, short selectmode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 5312e97c604..ed23e72b328 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -96,7 +96,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale) /* tags the given ID block for refreshes (if applicable) due to * Animation Editor editing */ -void ANIM_id_update(Scene *scene, ID *id) +void ANIM_id_update(Scene *UNUSED(scene), ID *id) { if (id) { AnimData *adt= BKE_animdata_from_id(id); @@ -121,7 +121,7 @@ void ANIM_id_update(Scene *scene, ID *id) */ /* perform syncing updates for Action Groups */ -static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale) +static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale) { bActionGroup *agrp= (bActionGroup *)ale->data; ID *owner_id= ale->id; @@ -154,7 +154,7 @@ static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale) } /* perform syncing updates for F-Curves */ -static void animchan_sync_fcurve (bAnimContext *ac, bAnimListElem *ale) +static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale) { FCurve *fcu= (FCurve *)ale->data; ID *owner_id= ale->id; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 6e5be217164..08b4f8a7bc8 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1065,7 +1065,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS * - for normal filtering (i.e. for editing), we only need the NLA-tracks but they can be in 'normal' evaluation * order, i.e. first to last. Otherwise, some tools may get screwed up. */ -static int animdata_filter_nla (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id) +static int animdata_filter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDopeSheet *UNUSED(ads), AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id) { bAnimListElem *ale; NlaTrack *nlt; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 0f9ef45ac94..055ee1c3392 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -489,7 +489,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt) } /* note, init has to be called succesfully */ -static void ed_marker_move_apply(bContext *C, wmOperator *op) +static void ed_marker_move_apply(wmOperator *op) { MarkerMove *mm= op->customdata; TimeMarker *marker; @@ -508,7 +508,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op) static void ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); ed_marker_move_exit(C, op); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -565,7 +565,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) offs= (int)fac; RNA_int_set(op->ptr, "frames", offs); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); /* cruft below is for header print */ for (a=0, marker= mm->markers->first; marker; marker= marker->next) { @@ -632,7 +632,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) outputNumInput(&mm->num, str_tx); RNA_int_set(op->ptr, "frames", vec[0]); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); // ed_marker_header_update(C, op, str, (int)vec[0]); // strcat(str, str_tx); sprintf(str, "Marker offset %s", str_tx); @@ -649,7 +649,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) static int ed_marker_move_exec(bContext *C, wmOperator *op) { if(ed_marker_move_init(C, op)) { - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); ed_marker_move_exit(C, op); return OPERATOR_FINISHED; } @@ -697,7 +697,7 @@ callbacks: /* duplicate selected TimeMarkers */ -static void ed_marker_duplicate_apply(bContext *C, wmOperator *op) +static void ed_marker_duplicate_apply(bContext *C) { ListBase *markers= context_get_markers(C); TimeMarker *marker, *newmarker; @@ -731,7 +731,7 @@ static void ed_marker_duplicate_apply(bContext *C, wmOperator *op) static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) { - ed_marker_duplicate_apply(C, op); + ed_marker_duplicate_apply(C); ed_marker_move_exec(C, op); /* assumes frs delta set */ return OPERATOR_FINISHED; @@ -740,7 +740,7 @@ static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt) { - ed_marker_duplicate_apply(C, op); + ed_marker_duplicate_apply(C); return ed_marker_move_invoke(C, op, evt); } diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 28b51ad0602..6ace48dd301 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -115,7 +115,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind /* Main Driver Management API calls: * Add a new driver for the specified property on the given ID block */ -short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short flag, int type) +short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag), int type) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -193,7 +193,7 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla /* Main Driver Management API calls: * Remove the driver for the specified property on the given ID block (if available) */ -short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag) +short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { AnimData *adt; FCurve *fcu; @@ -262,7 +262,7 @@ short ANIM_driver_can_paste (void) /* Main Driver Management API calls: * Make a copy of the driver for the specified property on the given ID block */ -short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short flag) +short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -307,7 +307,7 @@ short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short fl * Add a new driver for the specified property on the given ID block or replace an existing one * with the driver + driver-curve data from the buffer */ -short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short flag) +short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { PointerRNA id_ptr, ptr; PropertyRNA *prop; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 35e6cb66d45..2b8d0f35b9a 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -74,7 +74,7 @@ } /* callback to verify modifier data */ -static void validate_fmodifier_cb (bContext *C, void *fcm_v, void *dummy) +static void validate_fmodifier_cb (bContext *UNUSED(C), void *fcm_v, void *UNUSED(arg)) { FModifier *fcm= (FModifier *)fcm_v; FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); @@ -215,7 +215,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* --------------- */ /* draw settings for generator modifier */ -static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col; PointerRNA ptr; @@ -238,7 +238,7 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm /* --------------- */ /* draw settings for cycles modifier */ -static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; @@ -267,7 +267,7 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor /* --------------- */ /* draw settings for noise modifier */ -static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; @@ -374,7 +374,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float /* callback to add new envelope data point */ // TODO: should we have a separate file for things like this? -static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy) +static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *UNUSED(arg)) { Scene *scene= CTX_data_scene(C); FMod_Envelope *env= (FMod_Envelope *)fcm_dv; @@ -426,7 +426,7 @@ static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy) /* callback to remove envelope data point */ // TODO: should we have a separate file for things like this? -static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v) +static void fmod_envelope_deletepoint_cb (bContext *UNUSED(C), void *fcm_dv, void *ind_v) { FMod_Envelope *env= (FMod_Envelope *)fcm_dv; FCM_EnvelopeData *fedn; @@ -454,7 +454,7 @@ static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v } /* draw settings for envelope modifier */ -static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; @@ -509,7 +509,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* --------------- */ /* draw settings for limits modifier */ -static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col, *row; PointerRNA ptr; @@ -557,7 +557,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* --------------- */ /* draw settings for stepped interpolation modifier */ -static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col, *subcol; PointerRNA ptr; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 02e141a7a69..c895baa49f8 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -655,7 +655,7 @@ void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos) BLI_dlrbTree_init(&keys); - gpl_to_keylist(ads, gpl, &keys, NULL); + gpl_to_keylist(ads, gpl, &keys); BLI_dlrbTree_linkedlist_sync(&keys); @@ -898,7 +898,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree } -void gpl_to_keylist(bDopeSheet *ads, bGPDlayer *gpl, DLRBT_Tree *keys, DLRBT_Tree *blocks) +void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys) { bGPDframe *gpf; ActKeyColumn *ak; diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 17d674784f8..590d609ce02 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -369,7 +369,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEdi } /* This function is used to loop over the keyframe data in a DopeSheet summary */ -static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int UNUSED(filterflag)) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index befcc0a71cb..68e38d04620 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -486,7 +486,7 @@ void free_anim_copybuf (void) /* ------------------- */ /* This function adds data to the keyframes copy/paste buffer, freeing existing data first */ -short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data) +short copy_animedit_keys (bAnimContext *UNUSED(ac), ListBase *anim_data) { bAnimListElem *ale; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 160116bb1a3..ddd692d26ea 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -917,7 +917,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ * The flag argument is used for special settings that alter the behaviour of * the keyframe deletion. These include the quick refresh options. */ -short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag) +short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag)) { AnimData *adt= BKE_animdata_from_id(id); PointerRNA id_ptr, ptr; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 55c14411328..57617651823 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -558,7 +558,7 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[ /* --------------- */ /* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */ -void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi) +void ANIM_keyingset_info_register (KeyingSetInfo *ksi) { KeyingSet *ks; diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 1c9024f6f91..6eda622ead8 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -46,7 +46,7 @@ #include "armature_intern.h" #include "BIF_generate.h" -void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float tmat[][3]) +void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3]) { if (no != NULL && !is_zero_v3(no)) { @@ -118,7 +118,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl } } -int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float head[3], float p[3]) +int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float UNUSED(head[3]), float p[3]) { static float stroke_length = 0; static float current_length; @@ -277,7 +277,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st return -1; } -EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *editbones, BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion) +EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *UNUSED(editbones), BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion) { EditBone *lastBone = NULL; EditBone *child = NULL; diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 637c6076314..e80f1494d8c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -374,7 +374,7 @@ static RigNode *newRigNodeHead(RigGraph *rg, RigArc *arc, float p[3]) return node; } -static void addRigNodeHead(RigGraph *rg, RigArc *arc, RigNode *node) +static void addRigNodeHead(RigGraph *UNUSED(rg), RigArc *arc, RigNode *node) { node->degree++; @@ -1784,7 +1784,7 @@ static void repositionTailControl(RigGraph *rigg, RigControl *ctrl) finalizeControl(rigg, ctrl, 1); /* resize will be recalculated anyway so we don't need it */ } -static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float tail[3], float qrot[4], float resize) +static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float UNUSED(tail[3]), float qrot[4], float resize) { float parent_offset[3], tail_offset[3]; @@ -2051,7 +2051,7 @@ static float calcCostLengthDistance(BArcIterator *iter, float **vec_cache, RigEd } #endif -static float calcCostAngleLengthDistance(BArcIterator *iter, float **vec_cache, RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight) +static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_cache), RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight) { float vec_second[3], vec_first[3]; float length2; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 84f8513878c..93bddb3834b 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -184,7 +184,7 @@ void BIF_makeListTemplates(const bContext *C) } } -char *BIF_listTemplates(const bContext *C) +char *BIF_listTemplates(const bContext *UNUSED(C)) { GHashIterator ghi; char menu_header[] = "Template%t|None%x0|"; @@ -309,7 +309,7 @@ char * BIF_nameBoneTemplate(const bContext *C) return RIG_nameBone(rg, 0, index); } -void BIF_freeTemplates(bContext *C) +void BIF_freeTemplates(bContext *UNUSED(C)) { if (TEMPLATES_MENU != NULL) { @@ -1029,7 +1029,7 @@ void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_DrawData sub_v3_v3v3(vec, fp, dvec); } -int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd) +int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *UNUSED(sketch), SK_Stroke *stk, SK_DrawData *dd) { pt->type = dd->type; pt->mode = PT_PROJECT; @@ -1773,7 +1773,7 @@ int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture) return segments->nb_points - 1; } -int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 1 && gest->nb_intersections == 1) { @@ -1783,7 +1783,7 @@ int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -1800,7 +1800,7 @@ void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0) { @@ -1821,7 +1821,7 @@ int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; float trim_dir[3]; @@ -1856,7 +1856,7 @@ void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1) { @@ -1883,7 +1883,7 @@ int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; int command = 1; @@ -1918,7 +1918,7 @@ void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 2 && gest->nb_intersections == 2) { @@ -1939,7 +1939,7 @@ int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *sketch) { SK_Intersection *isect; @@ -1955,7 +1955,7 @@ void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { ARegion *ar = CTX_wm_region(C); if (gest->nb_segments > 2 && gest->nb_intersections == 2) @@ -2003,7 +2003,7 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -2034,7 +2034,7 @@ void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0) { @@ -2076,7 +2076,7 @@ int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -2093,7 +2093,7 @@ void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectConvertGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 3 && gest->nb_self_intersections == 1) { @@ -2102,7 +2102,7 @@ int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyConvertGesture(bContext *C, SK_Gesture *UNUSED(gest), SK_Sketch *sketch) { sk_convert(C, sketch); } @@ -2215,7 +2215,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch) } } -void sk_drawSketch(Scene *scene, View3D *v3d, SK_Sketch *sketch, int with_names) +void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, int with_names) { ToolSettings *ts= scene->toolsettings; SK_Stroke *stk; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 38372850ff8..10627f95aa7 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -62,7 +62,7 @@ /* ************* XXX *************** */ static void waitcursor(int val) {} -static void progress_bar(int dummy_val, const char *dummy) {} +static void progress_bar(int UNUSED(dummy_val), const char *UNUSED(dummy)) {} static void start_progress_bar() {} static void end_progress_bar() {} static void error(char *str) { printf("error: %s\n", str); } @@ -362,7 +362,7 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index) } } -void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value) +void laplacian_add_right_hand_side(LaplacianSystem *UNUSED(sys), int v, float value) { nlRightHandSideAdd(0, v, value); } @@ -1712,7 +1712,7 @@ static void meshdeform_matrix_solve(MeshDeformBind *mdb) nlDeleteContext(context); } -static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, MeshDeformBind *mdb) +static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierData *mmd, MeshDeformBind *mdb) { MDefBindInfluence *inf; MDefInfluence *mdinf; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 9602d80575a..32362afca2b 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -1692,7 +1692,7 @@ int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_internal, flo return value; } -int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold) +int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold)) { ReebArc *arc1, *arc2; ReebArc *next2; @@ -1723,7 +1723,7 @@ int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold) return filtered; } -int filterSmartReebGraph(ReebGraph *rg, float threshold) +int filterSmartReebGraph(ReebGraph *rg, float UNUSED(threshold)) { int value = 0; #if 0 //XXX diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 083a90efb25..75156571cf4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -662,7 +662,7 @@ static short gp_stroke_eraser_splitdel (bGPDframe *gpf, bGPDstroke *gps, int i) } /* eraser tool - check if part of stroke occurs within last segment drawn by eraser */ -static short gp_stroke_eraser_strokeinside (int mval[], int mvalo[], short rad, short x0, short y0, short x1, short y1) +static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), short rad, short x0, short y0, short x1, short y1) { /* simple within-radius check for now */ if (edge_inside_circle(mval[0], mval[1], rad, x0, y0, x1, y1)) @@ -1250,7 +1250,7 @@ static int gpencil_draw_cancel (bContext *C, wmOperator *op) /* ------------------------------- */ /* create a new stroke point at the point indicated by the painting context */ -static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p) +static void gpencil_draw_apply (wmOperator *op, tGPsdata *p) { /* handle drawing/erasing -> test for erasing first */ if (p->paintmode == GP_PAINTMODE_ERASER) { @@ -1294,7 +1294,7 @@ static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p) } /* handle draw event */ -static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *event) +static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event) { tGPsdata *p= op->customdata; ARegion *ar= p->ar; @@ -1343,7 +1343,7 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even RNA_float_set(&itemptr, "pressure", p->pressure); /* apply the current latest drawing point */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); /* force refresh */ ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ @@ -1394,7 +1394,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op) } /* apply this data as necessary now (as per usual) */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); } RNA_END; @@ -1456,7 +1456,7 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event) p->status= GP_STATUS_PAINTING; /* handle the initial drawing - i.e. for just doing a simple dot */ - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); } else { /* toolbar invoked - don't start drawing yet... */ @@ -1516,7 +1516,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) if (p->status == GP_STATUS_PAINTING) { /* handle drawing event */ //printf("\t\tGP - add point\n"); - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); /* finish painting operation if anything went wrong just now */ if (p->status == GP_STATUS_ERROR) { diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 78a645d6b50..ec74ea6123b 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -136,7 +136,7 @@ void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tr void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks); /* Grease Pencil Layer */ // XXX not restored -void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks); +void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys); /* ActKeyColumn API ---------------- */ /* Comparator callback used for ActKeyColumns and cframe float-value pointer */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index b3aac489852..2650005a489 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -183,7 +183,7 @@ struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, con KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]); /* for RNA type registrations... */ -void ANIM_keyingset_info_register(const struct bContext *C, KeyingSetInfo *ksi); +void ANIM_keyingset_info_register(KeyingSetInfo *ksi); void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi); /* cleanup on exit */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 313df32fd6f..22779fbba0b 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -225,7 +225,7 @@ void ED_mesh_calc_normals(struct Mesh *me); void ED_mesh_material_link(struct Mesh *me, struct Material *ma); void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); -int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); +int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 64e72a5e2fa..63af7c5abd3 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -109,7 +109,7 @@ int object_is_libdata(struct Object *ob); int object_data_is_libdata(struct Object *ob); /* object motion paths */ -void ED_objects_clear_paths(struct bContext *C, struct Scene *scene); +void ED_objects_clear_paths(struct bContext *C); void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene); /* constraints */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c450b41b183..ab8fda85ff2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3806,7 +3806,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand } #ifdef INTERNATIONAL -static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) +static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event)) { /* XXX 2.50 bad global and state access */ #if 0 diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 2da54b492e6..6d1a72fcd1a 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -876,7 +876,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), ImBuf *ima; /* first allocate imbuf for scaling and copy preview into it */ - ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0); + ima = IMB_allocImBuf(rw, rh, 32, IB_rect); memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); /* scale it */ diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index fc92598591a..e33e24a75ce 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -68,7 +68,7 @@ #include "mesh_intern.h" /* ***************** XXX **************** */ -static int pupmenu(const char *dummy) {return 0;} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} /* ***************** XXX **************** */ @@ -343,7 +343,7 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index) // object_tface_flags_changed(OBACT, 0); } -void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode) +void select_linked_tfaces(bContext *UNUSED(C), Object *ob, short UNUSED(mval[2]), int mode) { Mesh *me; unsigned int index=0; @@ -464,7 +464,7 @@ int minmax_tface(Object *ob, float *min, float *max) #define ME_SEAM_DONE 2 /* reuse this flag */ -static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert) +static float edgetag_cut_cost(int e1, int e2, int vert) { EditVert *v = EM_get_vert_for_index(vert); EditEdge *eed1 = EM_get_edge_for_index(e1), *eed2 = EM_get_edge_for_index(e2); @@ -483,7 +483,7 @@ static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert) return cost; } -static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) +static void edgetag_add_adjacent(Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) { int startadj, endadj = nedges[vertnum+1]; @@ -495,7 +495,7 @@ static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertn if (eedadj->f2 & ME_SEAM_DONE) continue; - newcost = cost[mednum] + edgetag_cut_cost(em, mednum, adjnum, vertnum); + newcost = cost[mednum] + edgetag_cut_cost(mednum, adjnum, vertnum); if (cost[adjnum] > newcost) { cost[adjnum] = newcost; @@ -621,8 +621,8 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge eed->f2 |= ME_SEAM_DONE; - edgetag_add_adjacent(em, heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost); - edgetag_add_adjacent(em, heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost); + edgetag_add_adjacent(heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost); + edgetag_add_adjacent(heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost); } @@ -819,7 +819,7 @@ void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select, i view3d_validate_backbuf(&vc); - ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0); + ibuf = IMB_allocImBuf(sx,sy,32,IB_rect); rt = ibuf->rect; glReadPixels(rect->xmin+vc.ar->winrct.xmin, rect->ymin+vc.ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index ff2fad3f551..80df034552d 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -78,8 +78,8 @@ editmesh.c: */ /* XXX */ -static void BIF_undo_push(const char *dummy) {} -static void error(const char *dummy) {} +static void BIF_undo_push(const char *UNUSED(arg)) {} +static void error(const char *UNUSED(arg)) {} /* ***************** HASH ********************* */ @@ -91,7 +91,7 @@ static void error(const char *dummy) {} /* ************ ADD / REMOVE / FIND ****************** */ -static void *calloc_em(EditMesh *em, size_t size, size_t nr) +static void *calloc_em(EditMesh *UNUSED(em), size_t size, size_t nr) { return calloc(size, nr); } @@ -447,19 +447,19 @@ int editface_containsEdge(EditFace *efa, EditEdge *eed) /* ************************ stuct EditMesh manipulation ***************************** */ /* fake callocs for fastmalloc below */ -static void *calloc_fastvert(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastvert(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditVert *eve= em->curvert++; eve->fast= 1; return eve; } -static void *calloc_fastedge(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastedge(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditEdge *eed= em->curedge++; eed->fast= 1; return eed; } -static void *calloc_fastface(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastface(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditFace *efa= em->curface++; efa->fast= 1; diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index f90f1b095e6..7b23b556994 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -116,7 +116,11 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) short use_proj; em_setup_viewcontext(C, &vc); - + wmWindow *win= CTX_wm_window(C); + + printf("\n%d %d\n", event->x, event->y); + printf("%d %d\n", win->eventstate->x, win->eventstate->y); + use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index 209a7975357..b632cb2a842 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -215,7 +215,7 @@ static int EM_check_selection(EditMesh *em, void *data) return 0; } -void EM_remove_selection(EditMesh *em, void *data, int type) +void EM_remove_selection(EditMesh *em, void *data, int UNUSED(type)) { EditSelection *ese; for(ese=em->selected.first; ese; ese = ese->next){ @@ -1051,7 +1051,7 @@ static void set_edge_directions_f2(EditMesh *em, int val) /* individual face extrude */ /* will use vertex normals for extrusion directions, so *nor is unaffected */ -short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor) +short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor)) { EditVert *eve, *v1, *v2, *v3, *v4; EditEdge *eed; @@ -1205,7 +1205,7 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor) } /* extrudes individual vertices */ -short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor) +short extrudeflag_verts_indiv(EditMesh *em, short flag, float *UNUSED(nor)) { EditVert *eve; @@ -1231,7 +1231,7 @@ short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor) /* this is actually a recode of extrudeflag(), using proper edge/face select */ /* hurms, doesnt use 'flag' yet, but its not called by primitive making stuff anyway */ -static short extrudeflag_edge(Object *obedit, EditMesh *em, short flag, float *nor, int all) +static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), float *nor, int all) { /* all select edges/faces: extrude */ /* old select is cleared, in new ones it is set */ diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 682fbca5072..7595e0d2fe1 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -69,9 +69,9 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv #include "mesh_intern.h" /* **** XXX ******** */ -static void BIF_undo_push(const char *dummy) {} +static void BIF_undo_push(const char *UNUSED(arg)) {} static void BIF_undo() {} -static void error(const char *dummy) {} +static void error(const char *UNUSED(arg)) {} static int qtest() {return 0;} /* **** XXX ******** */ diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index c4ca6166f02..ab01a773020 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -83,8 +83,8 @@ editmesh_mods.c, UI level access, no geometry changes #include "BLO_sys_types.h" // for intptr_t support /* XXX */ -static void waitcursor(int val) {} -static int pupmenu(const char *dummy) {return 0;} +static void waitcursor(int UNUSED(val)) {} +static int pupmenu(const char *UNUSED(arg)) {return 0;} /* ****************************** MIRROR **************** */ @@ -475,7 +475,7 @@ static float labda_PdistVL2Dfl( float *v1, float *v2, float *v3) } /* note; uses v3d, so needs active 3d window */ -static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) +static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { struct { ViewContext vc; float mval[2]; int dist; EditEdge *closest; } *data = userData; float v1[2], v2[2]; @@ -544,7 +544,7 @@ EditEdge *findnearestedge(ViewContext *vc, int *dist) } } -static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int index) +static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { short mval[2]; int dist; EditFace *toFace; } *data = userData; @@ -1252,7 +1252,7 @@ static int select_similar_exec(bContext *C, wmOperator *op) return similar_face_select_exec(C, op); } -static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); EnumPropertyItem *item= NULL; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fb29257b184..66090f14fff 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -80,7 +80,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "mesh_intern.h" /* XXX */ -static void waitcursor(int val) {} +static void waitcursor(int UNUSED(val)) {} #define add_numbut(a, b, c, d, e, f, g) {} /* XXX */ @@ -511,7 +511,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot) // XXX is this needed? /* called from buttons */ -static void xsortvert_flag__doSetX(void *userData, EditVert *eve, int x, int y, int index) +static void xsortvert_flag__doSetX(void *userData, EditVert *UNUSED(eve), int x, int UNUSED(y), int index) { xvertsort *sortblock = userData; @@ -616,7 +616,7 @@ void hashvert_flag(EditMesh *em, int flag) } /* generic extern called extruder */ -void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, short type) +static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short type) { float nor[3]= {0.0, 0.0, 0.0}; short transmode= 0; @@ -666,11 +666,10 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, sh // XXX should be a menu item static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); BKE_mesh_end_editmesh(obedit->data, em); @@ -683,11 +682,10 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even /* extrude without transform */ static int mesh_extrude_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(obedit->data); - extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -704,7 +702,7 @@ EnumPropertyItem extrude_items[] = { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL; Object *obedit= CTX_data_edit_object(C); @@ -1189,7 +1187,7 @@ static void erase_vertices(EditMesh *em, ListBase *l) } } -void delete_mesh(Object *obedit, EditMesh *em, wmOperator *op, int event) +static void delete_mesh(EditMesh *em, wmOperator *op, int event) { EditFace *efa, *nextvl; EditVert *eve,*nextve; @@ -1347,7 +1345,7 @@ static int delete_mesh_exec(bContext *C, wmOperator *op) if(type==6) return WM_operator_name_call(C, "MESH_OT_delete_edgeloop", WM_OP_EXEC_DEFAULT, NULL); - delete_mesh(obedit, em, op, type); + delete_mesh(em, op, type); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -4703,7 +4701,7 @@ useless: } #endif // END OF XXX -int EdgeLoopDelete(EditMesh *em, wmOperator *op) +int EdgeLoopDelete(EditMesh *UNUSED(em), wmOperator *UNUSED(op)) { #if 0 //XXX won't work with new edgeslide @@ -5185,7 +5183,7 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); Mesh *me= (obedit) ? obedit->data : NULL; @@ -5884,7 +5882,7 @@ static EnumPropertyItem merge_type_items[]= { {5, "COLLAPSE", 0, "Collapse", ""}, {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); EnumPropertyItem *item= NULL; diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 13538a6f218..ac65a3c21d3 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -94,7 +94,7 @@ typedef struct tringselOpData { } tringselOpData; /* modal loop selection drawing callback */ -static void ringsel_draw(const bContext *C, ARegion *ar, void *arg) +static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { int i; tringselOpData *lcd = arg; @@ -248,7 +248,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) lcd->totedge = tot; } -static void ringsel_find_edge(tringselOpData *lcd, const bContext *C, ARegion *ar, int cuts) +static void ringsel_find_edge(tringselOpData *lcd, int cuts) { if (lcd->eed) { edgering_sel(lcd, cuts, 0); @@ -293,7 +293,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) } /* called when modal loop selection is done... */ -static void ringsel_exit (bContext *C, wmOperator *op) +static void ringsel_exit(wmOperator *op) { tringselOpData *lcd= op->customdata; @@ -332,10 +332,10 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) return 1; } -static int ringcut_cancel (bContext *C, wmOperator *op) +static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op) { /* this is just a wrapper around exit() */ - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } @@ -353,7 +353,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) lcd = op->customdata; if (lcd->em->selectmode == SCE_SELECT_FACE) { - ringsel_exit(C, op); + ringsel_exit(op); WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL); return OPERATOR_CANCELLED; } @@ -363,15 +363,15 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if(!edge) { - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, 1); + ringsel_find_edge(lcd, 1); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -397,7 +397,7 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if (edge != lcd->eed) { lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, 1); + ringsel_find_edge(lcd, 1); } return OPERATOR_RUNNING_MODAL; @@ -418,7 +418,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(lcd->ar); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -441,7 +441,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { cuts++; RNA_int_set(op->ptr, "number_cuts",cuts); - ringsel_find_edge(lcd, C, lcd->ar, cuts); + ringsel_find_edge(lcd, cuts); ED_region_tag_redraw(lcd->ar); } @@ -451,7 +451,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { cuts=MAX2(cuts-1,1); RNA_int_set(op->ptr,"number_cuts",cuts); - ringsel_find_edge(lcd, C, lcd->ar,cuts); + ringsel_find_edge(lcd, cuts); ED_region_tag_redraw(lcd->ar); } @@ -466,7 +466,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (edge != lcd->eed) { lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, cuts); + ringsel_find_edge(lcd, cuts); } ED_region_tag_redraw(lcd->ar); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 272201df50d..03f2bb42b51 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -157,7 +157,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la } } -int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set) +int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set) { EditMesh *em; int layernum; @@ -292,7 +292,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; - if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE)) + if(!ED_mesh_uv_texture_add(C, me, NULL, TRUE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index c110222a109..ec727d7d82b 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -84,12 +84,12 @@ void make_editMball(Object *obedit) /* This function is called, when MetaBall Object switched from * edit mode to object mode. List od MetaElements is copied * from object->data->edit_elems to object->data->elems. */ -void load_editMball(Object *obedit) +void load_editMball(Object *UNUSED(obedit)) { } /* Add metaelem primitive to metaball object (which is in edit mode) */ -MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int newname) +MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNUSED(newname)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mball = (MetaBall*)obedit->data; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9de6d002a43..56af4ce1b1c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -161,11 +161,6 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl /********************* Add Object Operator ********************/ -void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ -{ - /* keep here to get things compile, remove later */ -} - void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) { PropertyRNA *prop; @@ -363,11 +358,6 @@ static EnumPropertyItem field_type_items[] = { {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""}, {0, NULL, 0, NULL, NULL}}; -void add_effector_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ -{ - /* keep here to get things compile, remove later */ -} - /* for effector add primitive operators */ static Object *effector_add_type(bContext *C, wmOperator *op, int type) { @@ -855,7 +845,7 @@ void OBJECT_OT_delete(wmOperatorType *ot) /**************************** Copy Utilities ******************************/ -static void copy_object__forwardModifierLinks(void *userData, Object *ob, +static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin) { /* this is copied from ID_NEW; it might be better to have a macro */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5882478f05e..32e49ce3f71 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -97,9 +97,9 @@ #include "object_intern.h" // own include /* ************* XXX **************** */ -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static int pupmenu(const char *msg) {return 0;} +static void error(const char *UNUSED(arg)) {} +static void waitcursor(int UNUSED(val)) {} +static int pupmenu(const char *UNUSED(msg)) {return 0;} /* port over here */ static bContext *C; @@ -433,7 +433,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(ob->type==OB_MESH) { Mesh *me= ob->data; - if(me->pv) mesh_pmv_off(ob, me); + if(me->pv) mesh_pmv_off(me); ok= 1; scene->obedit= ob; // context sees this @@ -1565,7 +1565,7 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot) /* --------- */ /* for the object with pose/action: clear path curves for selected bones only */ -void ED_objects_clear_paths(bContext *C, Scene *scene) +void ED_objects_clear_paths(bContext *C) { /* loop over objects in scene */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) @@ -1581,11 +1581,9 @@ void ED_objects_clear_paths(bContext *C, Scene *scene) /* operator callback for this */ static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) -{ - Scene *scene= CTX_data_scene(C); - +{ /* use the backend function for this */ - ED_objects_clear_paths(C, scene); + ED_objects_clear_paths(C); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); @@ -1838,7 +1836,7 @@ void rand_timeoffs(Scene *scene, View3D *v3d) } -static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *input = object_mode_items; EnumPropertyItem *item= NULL; @@ -2082,7 +2080,7 @@ static EnumPropertyItem game_properties_copy_operations[] ={ static EnumPropertyItem gameprops_items[]= { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_active_context(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 1c22c1820ce..3bdf202aca9 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -250,7 +250,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * return 1; } -int ED_object_modifier_convert(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *scene, Object *ob, ModifierData *md) { Object *obn; ParticleSystem *psys; @@ -365,7 +365,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes"); return 0; } - mesh_pmv_off(ob, me); + mesh_pmv_off(me); dm = mesh_create_derived_for_modifier(scene, ob, md); if (!dm) { @@ -413,7 +413,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, return 0; } - mesh_pmv_off(ob, me); + mesh_pmv_off(me); /* Multires: ensure that recent sculpting is applied */ if(md->type == eModifierType_Multires) @@ -511,7 +511,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi return 1; } -int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md) +int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierData *md) { ModifierData *nmd; @@ -540,7 +540,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_active_context(C); EnumPropertyItem *item= NULL, *md_item; @@ -636,7 +636,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op) return 0; } -static ModifierData *edit_modifier_property_get(bContext *C, wmOperator *op, Object *ob, int type) +static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type) { char modifier_name[32]; ModifierData *md; @@ -657,7 +657,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; @@ -695,7 +695,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot) static int modifier_move_up_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -734,7 +734,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot) static int modifier_move_down_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -774,7 +774,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); int apply_as= RNA_enum_get(op->ptr, "apply_as"); if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) { @@ -824,7 +824,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; @@ -863,7 +863,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot) static int modifier_copy_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -907,7 +907,7 @@ static int multires_poll(bContext *C) static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -946,7 +946,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot) static int multires_subdivide_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -988,7 +988,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) { Object *ob= ED_object_active_context(C), *secondob= NULL; Scene *scene= CTX_data_scene(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -1076,7 +1076,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U if (!edit_modifier_invoke_properties(C, op)) return OPERATOR_CANCELLED; - mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -1158,7 +1158,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_MeshDeform); + MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform); if (!mmd) return OPERATOR_CANCELLED; @@ -1245,7 +1245,7 @@ static int explode_poll(bContext *C) static int explode_refresh_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Explode); + ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(op, ob, eModifierType_Explode); if (!emd) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 6e9e8eeb5e5..221d1211930 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -378,7 +378,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) ED_object_generic_keymap(keyconf, keymap, 2); } -void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet) +void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap, int do_pet) { wmKeyMapItem *kmi; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 2a01c870ad6..14f88c6d99e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -353,7 +353,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; @@ -1140,7 +1140,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /************************** Link to Scene Operator *****************************/ -void link_to_scene(Main *bmain, unsigned short nr) +void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr)) { #if 0 Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1); @@ -1344,7 +1344,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot) /**************************** Make Single User ********************************/ -static void single_object_users__forwardModifierLinks(void *userData, Object *ob, Object **obpoin) +static void single_object_users__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), Object **obpoin) { ID_NEW(*obpoin); } @@ -1538,7 +1538,7 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag) } } -void single_ipo_users(Scene *scene, int flag) +void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag)) { #if 0 // XXX old animation system Object *ob; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 610f6d95d42..796314ba2e3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2022,7 +2022,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float /************************* utilities **************************/ -static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psys, int mirror) +static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror) { PTCacheEdit *edit = psys->edit; ParticleData *pa, *npa=0, *new_pars=0; @@ -2092,7 +2092,7 @@ static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psy return removed; } -static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys) +static void remove_tagged_keys(Object *ob, ParticleSystem *psys) { PTCacheEdit *edit= psys->edit; ParticleData *pa; @@ -2123,7 +2123,7 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys) if(new_totkey < 2) point->flag |= PEP_TAG; } - remove_tagged_particles(scene, ob, psys, pe_x_mirror(ob)); + remove_tagged_particles(ob, psys, pe_x_mirror(ob)); LOOP_POINTS { pa = psys->particles + p; @@ -2347,7 +2347,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) BLI_kdtree_free(tree); /* remove tagged particles - don't do mirror here! */ - remove_tagged_particles(scene, ob, psys, 0); + remove_tagged_particles(ob, psys, 0); totremoved += removed; } while(removed); @@ -2430,7 +2430,7 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *customdata) +static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { ParticleEditSettings *pset= PE_settings(CTX_data_scene(C)); ParticleBrushData *brush; @@ -2574,12 +2574,12 @@ static int delete_exec(bContext *C, wmOperator *op) if(type == DEL_KEY) { foreach_selected_key(&data, set_delete_particle_key); - remove_tagged_keys(data.scene, data.ob, data.edit->psys); + remove_tagged_keys(data.ob, data.edit->psys); recalc_lengths(data.edit); } else if(type == DEL_PARTICLE) { foreach_selected_point(&data, set_delete_particle); - remove_tagged_particles(data.scene, data.ob, data.edit->psys, pe_x_mirror(data.ob)); + remove_tagged_particles(data.ob, data.edit->psys, pe_x_mirror(data.ob)); recalc_lengths(data.edit); } @@ -2765,7 +2765,7 @@ void PARTICLE_OT_mirror(wmOperatorType *ot) /************************* brush edit callbacks ********************/ -static void brush_comb(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { ParticleEditSettings *pset= PE_settings(data->scene); float cvec[3], fac; @@ -3034,7 +3034,7 @@ static void brush_puff(PEData *data, int point_index) } -static void brush_weight(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_weight(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { /* roots have full weight allways */ if(key_index) { @@ -3060,7 +3060,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int } } -static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { float vec[3], dvec[3]; @@ -3401,7 +3401,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) else foreach_point(&data, brush_cut); - removed= remove_tagged_particles(scene, ob, edit->psys, pe_x_mirror(ob)); + removed= remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob)); if(pset->flag & PE_KEEP_LENGTHS) recalc_lengths(edit); } @@ -3538,7 +3538,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pset->flag |= lock_root; } -static void brush_edit_exit(bContext *C, wmOperator *op) +static void brush_edit_exit(wmOperator *op) { BrushEdit *bedit= op->customdata; @@ -3555,7 +3555,7 @@ static int brush_edit_exec(bContext *C, wmOperator *op) } RNA_END; - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_FINISHED; } @@ -3597,7 +3597,7 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event) case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: // XXX hardcoded - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_FINISHED; case MOUSEMOVE: brush_edit_apply_event(C, op, event); @@ -3607,9 +3607,9 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int brush_edit_cancel(bContext *C, wmOperator *op) +static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op) { - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index f411f92d395..e4934269173 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -720,7 +720,7 @@ static void fluidbake_free(void *customdata) } /* called by fluidbake, only to check job 'stop' value */ -static int fluidbake_breakjob(void *customdata) +static int fluidbake_breakjob(void *UNUSED(customdata)) { //FluidBakeJob *fb= (FluidBakeJob *)customdata; //return *(fb->stop); @@ -1047,7 +1047,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) return 1; } -void fluidsimFreeBake(Object *ob) +void fluidsimFreeBake(Object *UNUSED(ob)) { /* not implemented yet */ } @@ -1056,27 +1056,27 @@ void fluidsimFreeBake(Object *ob) /* compile dummy functions for disabled fluid sim */ -FluidsimSettings *fluidsimSettingsNew(Object *srcob) +FluidsimSettings *fluidsimSettingsNew(Object *UNUSED(srcob)) { return NULL; } -void fluidsimSettingsFree(FluidsimSettings *fss) +void fluidsimSettingsFree(FluidsimSettings *UNUSED(fss)) { } -FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) +FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss)) { return NULL; } /* only compile dummy functions */ -int fluidsimBake(bContext *C, ReportList *reports, Object *ob) +int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob)) { return 0; } -void fluidsimFreeBake(Object *ob) +void fluidsimFreeBake(Object *UNUSED(ob)) { } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 6664dd624b2..9e39862cf5d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -56,7 +56,7 @@ #include "physics_intern.h" -static int cache_break_test(void *cbd) { +static int cache_break_test(void *UNUSED(cbd)) { return G.afbreek==1; } static int ptcache_bake_all_poll(bContext *C) @@ -75,13 +75,13 @@ static int ptcache_poll(bContext *C) return (ptr.data && ptr.id.data); } -void bake_console_progress(void *arg, int nr) +void bake_console_progress(void *UNUSED(arg), int nr) { printf("\rbake: %3i%%", nr); fflush(stdout); } -void bake_console_progress_end(void *arg) +void bake_console_progress_end(void *UNUSED(arg)) { printf("\n"); } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 71bee8c5b08..21f10d936bf 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -190,7 +190,7 @@ void draw_tex_crop(Tex *tex) } /* temporal abuse; if id_code is -1 it only does texture.... solve! */ -void BIF_preview_changed(short id_code) +void BIF_preview_changed(short UNUSED(id_code)) { #if 0 ScrArea *sa; @@ -571,7 +571,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r /* ******************************** Icon Preview **************************** */ -void ED_preview_icon_draw(const bContext *C, void *idp, void *arg1, void *arg2, rcti *rect) +void ED_preview_icon_draw(const bContext *UNUSED(C), void *UNUSED(idp), void *UNUSED(arg1), void *UNUSED(arg2), rcti *UNUSED(rect)) { } @@ -603,7 +603,7 @@ void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renrect) } -void BIF_view3d_previewrender_signal(ScrArea *sa, short signal) +void BIF_view3d_previewrender_signal(ScrArea *UNUSED(sa), short UNUSED(signal)) { #if 0 View3D *v3d= sa->spacedata.first; @@ -625,7 +625,7 @@ void BIF_view3d_previewrender_signal(ScrArea *sa, short signal) #endif } -void BIF_view3d_previewrender_free(View3D *v3d) +void BIF_view3d_previewrender_free(View3D *UNUSED(v3d)) { #if 0 if(v3d->ri) { @@ -683,7 +683,7 @@ static int view3d_previewrender_get_rects(ScrArea *sa, rctf *viewplane, RenderIn } /* called before a panel gets moved/scaled, makes sure we can see through */ -void BIF_view3d_previewrender_clear(ScrArea *sa) +void BIF_view3d_previewrender_clear(ScrArea *UNUSED(sa)) { #if 0 View3D *v3d= sa->spacedata.first; @@ -844,7 +844,7 @@ void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa) } /* in panel space! */ -static void view3d_previewdraw_rect(ScrArea *sa, uiBlock *block, RenderInfo *ri) +static void view3d_previewdraw_rect(ScrArea *UNUSED(sa), uiBlock *UNUSED(block), RenderInfo *ri) { // rctf dispf; @@ -887,7 +887,7 @@ void BIF_view3d_previewdraw(struct ScrArea *sa, struct uiBlock *block) /* **************************** new shader preview system ****************** */ /* inside thread, called by renderer, sets job update value */ -static void shader_preview_draw(void *spv, RenderResult *rr, volatile struct rcti *rect) +static void shader_preview_draw(void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) { ShaderPreview *sp= spv; @@ -903,7 +903,7 @@ static int shader_preview_break(void *spv) } /* outside thread, called before redraw notifiers, it moves finished preview over */ -static void shader_preview_updatejob(void *spv) +static void shader_preview_updatejob(void *UNUSED(spv)) { // ShaderPreview *sp= spv; @@ -1141,7 +1141,7 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat /* use same function for icon & shader, so the job manager does not run two of them at the same time. */ -static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *progress) +static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *UNUSED(progress)) { ShaderPreview *sp= customdata; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 840ab0b2098..bca8100a809 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -116,7 +116,7 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex) return 0; } -static void material_changed(Main *bmain, Material *ma) +static void material_changed(Main *UNUSED(bmain), Material *ma) { /* icons */ BKE_icon_changed(BKE_icon_getid(&ma->id)); @@ -208,7 +208,7 @@ static void image_changed(Main *bmain, Image *ima) texture_changed(bmain, tex); } -static void scene_changed(Main *bmain, Scene *sce) +static void scene_changed(Main *bmain, Scene *UNUSED(scene)) { Object *ob; Material *ma; @@ -834,7 +834,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int dx= env->cube[1]->x; if (env->type == ENV_CUBE) { - ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0); + ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat); IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx); IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx); @@ -844,7 +844,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx); } else if (env->type == ENV_PLANE) { - ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat, 0); + ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat); IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx); } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 138ce19951d..9d178a57465 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1739,7 +1739,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh) } /* results in fully updated anim system */ -void ED_update_for_newframe(const bContext *C, int mute) +void ED_update_for_newframe(const bContext *C, int UNUSED(mute)) { Main *bmain= CTX_data_main(C); bScreen *screen= CTX_wm_screen(C); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 5bcf8c18074..5a6acd24c5f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2897,7 +2897,7 @@ static int scene_new_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); int type= RNA_enum_get(op->ptr, "type"); - newscene= copy_scene(bmain, scene, type); + newscene= copy_scene(scene, type); /* these can't be handled in blenkernel curently, so do them here */ if(type == SCE_COPY_LINK_DATA) diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index f1e11430573..937441a6e43 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -84,7 +84,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) if(strlen(path)r.imtype); - ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0, 0); + ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); ibuf->rect= scd->dumprect; BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality); @@ -251,7 +251,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float break; } else { - ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0); char name[FILE_MAXDIR+FILE_MAXFILE]; int ok; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index cd498c274cf..71754c3589a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -383,7 +383,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int return tile->rect; if (*tmpibuf==NULL) - *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect, 0); + *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); strcpy(tile->idname, ima->id.name); @@ -410,7 +410,7 @@ static void image_undo_restore(bContext *C, ListBase *lb) UndoImageTile *tile; tmpibuf= IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, - IB_rectfloat|IB_rect, 0); + IB_rectfloat|IB_rect); for(tile=lb->first; tile; tile=tile->next) { /* find image based on name, pointer becomes invalid with global undo */ @@ -4191,7 +4191,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) /* note: allocImbuf returns zero'd memory, so regions outside image will have zero alpha, and hence not be blended onto the image */ int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1]; - ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags, 0); + ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags); IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h); IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h, diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index d8544f34fdf..2e0338b370e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -290,7 +290,7 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path) RNA_int_set(kmi->ptr, "value", 19); } -static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *path) +static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path)) { wmKeyMapItem *kmi; diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index c2f82b8e2e0..c21bbadc242 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -62,13 +62,13 @@ static UndoStack MeshUndoStack = {UNDO_PAINT_MESH, {NULL, NULL}, NULL}; /* Generic */ -static void undo_restore(bContext *C, UndoStack *stack, UndoElem *uel) +static void undo_restore(bContext *C, UndoStack *UNUSED(stack), UndoElem *uel) { if(uel && uel->restore) uel->restore(C, &uel->elems); } -static void undo_elem_free(UndoStack *stack, UndoElem *uel) +static void undo_elem_free(UndoStack *UNUSED(stack), UndoElem *uel) { if(uel && uel->free) { uel->free(&uel->elems); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index f5a02e6fb9c..3c25d861d2f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -852,7 +852,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float /* else */ /* sets wp->weight to the closest weight value to vertex */ /* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */ -void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mode) { ViewContext vc; ToolSettings *ts= scene->toolsettings; @@ -1256,7 +1256,7 @@ struct WPaintData { char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/ }; -static char *wpaint_make_validmap(Mesh *me, Object *ob) +static char *wpaint_make_validmap(Object *ob) { bDeformGroup *dg; ModifierData *md; @@ -1344,7 +1344,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED vgroups affect deform bones*/ wpd->auto_normalize = ts->auto_normalize; if (wpd->auto_normalize) - wpd->vgroup_validmap = wpaint_make_validmap(me, ob); + wpd->vgroup_validmap = wpaint_make_validmap(ob); // if(qual & LR_CTRLKEY) { // sample_wpaint(scene, ar, v3d, 0); @@ -1817,7 +1817,7 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent return 1; } -static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int flip) +static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int UNUSED(flip)) { ViewContext *vc = &vpd->vc; Brush *brush = paint_brush(&vp->paint); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 2e192a08ca5..a3252ca7621 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2534,7 +2534,7 @@ static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss) /* Flip all the editdata across the axis/axes specified by symm. Used to calculate multiple modifications to the mesh when symmetry is enabled. */ -static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float feather) +static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather)) { flip_coord(cache->location, cache->true_location, symm); flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 18f35502f8b..2be3a51869b 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -180,7 +180,7 @@ static int pack_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; sound->packedfile= newPackedFile(op->reports, sound->name); - sound_load(CTX_data_main(C), sound); + sound_load(sound); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 64d7a12bc4c..11b6123dbbb 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -990,7 +990,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, } else if (ale->type == ANIMTYPE_GPLAYER) { struct bGPDlayer *gpl= (struct bGPDlayer *)ale->data; - gpl_to_keylist(ads, gpl, &anim_keys, NULL); + gpl_to_keylist(ads, gpl, &anim_keys); } /* loop through keyframes, finding one that was within the range clicked on */ diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 1b997ade956..68a93d39062 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -371,7 +371,7 @@ void filelist_init_icons() for (x=0; xrect[k*SPECIAL_IMG_SIZE], &bbuf->rect[(k+y*SPECIAL_IMG_SIZE)*SPECIAL_IMG_SIZE*SPECIAL_IMG_COLS+x*SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE*sizeof(int)); } @@ -965,7 +965,7 @@ void filelist_from_library(struct FileList* filelist) /* first allocate imbuf for copying preview into it */ if (w > 0 && h > 0 && rect) { - ima = IMB_allocImBuf(w, h, 32, IB_rect, 0); + ima = IMB_allocImBuf(w, h, 32, IB_rect); memcpy(ima->rect, rect, w*h*sizeof(unsigned int)); filelist->filelist[i + 1].image = ima; filelist->filelist[i + 1].flags = IMAGEFILE; diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index 1277ad9d69c..f5ce5a818d7 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -99,7 +99,7 @@ static void save_rendered_image_cb_real(char *name, int confirm) waitcursor(1); /* from screen.c */ - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0); ibuf->rect= (unsigned int *)rres.rect32; ibuf->rect_float= rres.rectf; ibuf->zbuf_float= rres.rectz; diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index d9d027823bc..f5c8388bf67 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -143,7 +143,7 @@ static void wform_put_grid(unsigned char * tgt, int w, int h) static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x,y; unsigned char* src = (unsigned char*) ibuf->rect; unsigned char* tgt = (unsigned char*) rval->rect; @@ -189,7 +189,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; unsigned char* tgt = (unsigned char*) rval->rect; @@ -249,7 +249,7 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf) static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) { struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect, 0); + ibuf->x + 3, 515, 32, IB_rect); int x,y; unsigned char* src = (unsigned char*) ibuf->rect; unsigned char* tgt = (unsigned char*) rval->rect; @@ -299,7 +299,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( struct ImBuf * ibuf) { struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect, 0); + ibuf->x + 3, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; unsigned char* tgt = (unsigned char*) rval->rect; @@ -422,7 +422,7 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc) { - struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect, 0); + struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect); if (src->rect_float) { draw_zebra_float(src, ibuf, perc); @@ -463,7 +463,7 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col) static struct ImBuf *make_histogram_view_from_ibuf_byte( struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); int n,c,x,y; unsigned char* src = (unsigned char*) ibuf->rect; @@ -517,7 +517,7 @@ static int get_bin_float(float f) static struct ImBuf *make_histogram_view_from_ibuf_float( struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); int n,c,x,y; float* src = ibuf->rect_float; @@ -596,7 +596,7 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g, static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x,y; char* src = (char*) ibuf->rect; char* tgt = (char*) rval->rect; @@ -643,7 +643,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; char* tgt = (char*) rval->rect; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6e634252631..67c2a4f1c56 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1140,7 +1140,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, if(ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax; if(yminc > ymaxc) return NULL; - ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect,0); + ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect); view3d_validate_backbuf(vc); @@ -1160,7 +1160,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax) return ibuf; - ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect,0); + ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect); rd= ibuf->rect; dr= ibuf1->rect; @@ -2092,7 +2092,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in } /* read in pixels & stamp */ - ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0); + ibuf= IMB_allocImBuf(sizex, sizey, 32, flag); if(ibuf->rect_float) glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 312ae1df590..8b3d99e355d 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1770,7 +1770,7 @@ int ED_view3d_context_activate(bContext *C) return 1; } -static int game_engine_exec(bContext *C, wmOperator *UNUSED(op)) +static int game_engine_exec(bContext *C, wmOperator *op) { #if GAMEBLENDER == 1 Scene *startscene = CTX_data_scene(C); @@ -1780,6 +1780,8 @@ static int game_engine_exec(bContext *C, wmOperator *UNUSED(op)) RegionView3D *rv3d; rcti cam_frame; + (void)op; /* unused */ + // bad context switch .. if(!ED_view3d_context_activate(C)) return OPERATOR_CANCELLED; @@ -1828,6 +1830,7 @@ static int game_engine_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; #else + (void)C; /* unused */ BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build."); return OPERATOR_CANCELLED; #endif diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 1778e648e20..4a95d0ec081 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -384,7 +384,7 @@ void BIF_selectOrientation() { #endif } -static void view_editmove(unsigned short event) +static void view_editmove(unsigned short UNUSED(event)) { #if 0 // TRANSFORM_FIX_ME int refresh = 0; @@ -1201,7 +1201,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments glEnd(); } -static void drawHelpline(bContext *C, int x, int y, void *customdata) +static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) { TransInfo *t = (TransInfo*)customdata; @@ -1333,16 +1333,16 @@ static void drawHelpline(bContext *C, int x, int y, void *customdata) } } -void drawTransformView(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; - drawConstraint(C, t); + drawConstraint(t); drawPropCircle(C, t); drawSnapping(C, t); } -void drawTransformPixel(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg)) { // TransInfo *t = arg; // @@ -1723,7 +1723,7 @@ void transformApply(const bContext *C, TransInfo *t) } } -void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformApply(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; @@ -1896,7 +1896,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu /* ******************* TRANSFORM LIMITS ********************** */ -static void constraintTransLim(TransInfo *t, TransData *td) +static void constraintTransLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); @@ -1991,7 +1991,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) } } -static void constraintRotLim(TransInfo *t, TransData *td) +static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); @@ -2211,7 +2211,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event) return status; } -int Warp(TransInfo *t, short mval[2]) +int Warp(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3]; @@ -2309,7 +2309,7 @@ int Warp(TransInfo *t, short mval[2]) /* ************************** SHEAR *************************** */ -void postInputShear(TransInfo *t, float values[3]) +void postInputShear(TransInfo *UNUSED(t), float values[3]) { mul_v3_fl(values, 0.05f); } @@ -2359,7 +2359,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) } -int Shear(TransInfo *t, short mval[2]) +int Shear(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float vec[3]; @@ -2723,7 +2723,7 @@ void initToSphere(TransInfo *t) t->val /= (float)t->total; } -int ToSphere(TransInfo *t, short mval[2]) +int ToSphere(TransInfo *t, short UNUSED(mval[2])) { float vec[3]; float ratio, radius; @@ -3058,7 +3058,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) } } -int Rotation(TransInfo *t, short mval[2]) +int Rotation(TransInfo *t, short UNUSED(mval[2])) { char str[64]; @@ -3172,7 +3172,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a } } -int Trackball(TransInfo *t, short mval[2]) +int Trackball(TransInfo *t, short UNUSED(mval[2])) { char str[128]; float axis1[3], axis2[3]; @@ -3391,7 +3391,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) { } /* uses t->vec to store actual translation in */ -int Translation(TransInfo *t, short mval[2]) +int Translation(TransInfo *t, short UNUSED(mval[2])) { char str[250]; @@ -3457,7 +3457,7 @@ void initShrinkFatten(TransInfo *t) -int ShrinkFatten(TransInfo *t, short mval[2]) +int ShrinkFatten(TransInfo *t, short UNUSED(mval[2])) { float vec[3]; float distance; @@ -3532,7 +3532,7 @@ void initTilt(TransInfo *t) -int Tilt(TransInfo *t, short mval[2]) +int Tilt(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -3604,7 +3604,7 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; } -int CurveShrinkFatten(TransInfo *t, short mval[2]) +int CurveShrinkFatten(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -3672,7 +3672,7 @@ void initPushPull(TransInfo *t) } -int PushPull(TransInfo *t, short mval[2]) +int PushPull(TransInfo *t, short UNUSED(mval[2])) { float vec[3], axis[3]; float distance; @@ -3805,7 +3805,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event) return 0; } -int Bevel(TransInfo *t, short mval[2]) +int Bevel(TransInfo *t, short UNUSED(mval[2])) { float distance,d; int i; @@ -3873,7 +3873,7 @@ void initBevelWeight(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BevelWeight(TransInfo *t, short mval[2]) +int BevelWeight(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float weight; @@ -3946,7 +3946,7 @@ void initCrease(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int Crease(TransInfo *t, short mval[2]) +int Crease(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float crease; @@ -4140,7 +4140,7 @@ void initBoneEnvelope(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneEnvelope(TransInfo *t, short mval[2]) +int BoneEnvelope(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -4846,7 +4846,7 @@ int doEdgeSlide(TransInfo *t, float perc) return 1; } -int EdgeSlide(TransInfo *t, short mval[2]) +int EdgeSlide(TransInfo *t, short UNUSED(mval[2])) { char str[50]; float final; @@ -4905,7 +4905,7 @@ void initBoneRoll(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneRoll(TransInfo *t, short mval[2]) +int BoneRoll(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -5041,7 +5041,7 @@ void initMirror(TransInfo *t) } } -int Mirror(TransInfo *t, short mval[2]) +int Mirror(TransInfo *t, short UNUSED(mval[2])) { TransData *td; float size[3], mat[3][3]; @@ -5118,7 +5118,7 @@ void initAlign(TransInfo *t) initMouseInputMode(t, &t->mouse, INPUT_NONE); } -int Align(TransInfo *t, short mval[2]) +int Align(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float center[3]; @@ -5221,7 +5221,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) { } } -int SeqSlide(TransInfo *t, short mval[2]) +int SeqSlide(TransInfo *t, short UNUSED(mval[2])) { char str[200]; @@ -5449,7 +5449,7 @@ static void headerTimeTranslate(TransInfo *t, char *str) sprintf(str, "DeltaX: %s", &tvec[0]); } -static void applyTimeTranslate(TransInfo *t, float sval) +static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) { TransData *td = t->data; TransData2D *td2d = t->data2d; @@ -5751,7 +5751,7 @@ static void applyTimeScale(TransInfo *t) { } } -int TimeScale(TransInfo *t, short mval[2]) +int TimeScale(TransInfo *t, short UNUSED(mval[2])) { char str[200]; @@ -5772,7 +5772,7 @@ int TimeScale(TransInfo *t, short mval[2]) /* ************************************ */ -void BIF_TransformSetUndo(char *str) +void BIF_TransformSetUndo(char *UNUSED(str)) { // TRANSFORM_FIX_ME //Trans.undostr= str; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 6cfe78a979d..bb6ffe9155f 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -571,7 +571,7 @@ void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct V /*********************** Constraints *****************************/ -void drawConstraint(const struct bContext *C, TransInfo *t); +void drawConstraint(TransInfo *t); void getConstraintMatrix(TransInfo *t); void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 1e6916f0a86..b15c5b07758 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -593,7 +593,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte /*----------------- DRAWING CONSTRAINTS -------------------*/ -void drawConstraint(const struct bContext *C, TransInfo *t) +void drawConstraint(TransInfo *t) { TransCon *tc = &(t->con); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 53e553a0391..22b83ee4c89 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -232,7 +232,7 @@ static void set_prop_dist(TransInfo *t, short with_dist) /* ********************* texture space ********* */ -static void createTransTexspace(bContext *C, TransInfo *t) +static void createTransTexspace(TransInfo *t) { Scene *scene = t->scene; TransData *td; @@ -277,7 +277,7 @@ static void createTransTexspace(bContext *C, TransInfo *t) /* ********************* edge (for crease) ***** */ -static void createTransEdge(bContext *C, TransInfo *t) { +static void createTransEdge(TransInfo *t) { EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh; TransData *td = NULL; EditEdge *eed; @@ -930,7 +930,7 @@ static short pose_grab_with_ik(Object *ob) /* only called with pose mode active object now */ -static void createTransPose(bContext *C, TransInfo *t, Object *ob) +static void createTransPose(TransInfo *t, Object *ob) { bArmature *arm; bPoseChannel *pchan; @@ -995,7 +995,7 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob) /* ********************* armature ************** */ -static void createTransArmatureVerts(bContext *C, TransInfo *t) +static void createTransArmatureVerts(TransInfo *t) { EditBone *ebo; bArmature *arm= t->obedit->data; @@ -1195,7 +1195,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t) /* ********************* meta elements ********* */ -static void createTransMBallVerts(bContext *C, TransInfo *t) +static void createTransMBallVerts(TransInfo *t) { MetaBall *mb = (MetaBall*)t->obedit->data; MetaElem *ml; @@ -1530,7 +1530,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) /* ********************* lattice *************** */ -static void createTransLatticeVerts(bContext *C, TransInfo *t) +static void createTransLatticeVerts(TransInfo *t) { Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt; TransData *td = NULL; @@ -1896,7 +1896,7 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert /* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */ -static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { float *vec = userData; @@ -3978,7 +3978,7 @@ static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth) } -static TransData *SeqToTransData(TransInfo *t, TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag) +static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag) { int start_left; @@ -4063,16 +4063,16 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData * if (flag & SELECT) { if (flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) { if (flag & SEQ_LEFTSEL) { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); tot++; } if (flag & SEQ_RIGHTSEL) { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); tot++; } } else { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SELECT); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SELECT); tot++; } } @@ -4232,7 +4232,7 @@ static void createTransSeqData(bContext *C, TransInfo *t) /* transcribe given object into TransData for Transforming */ -static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob) +static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) { Scene *scene = t->scene; float obmtx[3][3]; @@ -4342,7 +4342,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object * /* sets flags in Bases to define whether they take part in transform */ /* it deselects Bases, so we have to call the clear function always after */ -static void set_trans_object_base_flags(bContext *C, TransInfo *t) +static void set_trans_object_base_flags(TransInfo *t) { Scene *scene = t->scene; View3D *v3d = t->view; @@ -5091,7 +5091,7 @@ static void createTransObject(bContext *C, TransInfo *t) TransDataExtension *tx; int propmode = t->flag & T_PROP_EDIT; - set_trans_object_base_flags(C, t); + set_trans_object_base_flags(t); /* count */ t->total= CTX_DATA_COUNT(C, selected_objects); @@ -5130,7 +5130,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->flag |= TD_SKIP; } - ObjectToTransData(C, t, td, ob); + ObjectToTransData(t, td, ob); td->val = NULL; td++; tx++; @@ -5153,7 +5153,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->ext = tx; td->rotOrder= ob->rotmode; - ObjectToTransData(C, t, td, ob); + ObjectToTransData(t, td, ob); td->val = NULL; td++; tx++; @@ -5210,12 +5210,12 @@ void createTransData(bContext *C, TransInfo *t) if (t->options & CTX_TEXTURE) { t->flag |= T_TEXTURE; - createTransTexspace(C, t); + createTransTexspace(t); } else if (t->options & CTX_EDGE) { t->ext = NULL; t->flag |= T_EDIT; - createTransEdge(C, t); + createTransEdge(t); if(t->data && t->flag & T_PROP_EDIT) { sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); @@ -5277,14 +5277,14 @@ void createTransData(bContext *C, TransInfo *t) createTransCurveVerts(C, t); } else if (t->obedit->type==OB_LATTICE) { - createTransLatticeVerts(C, t); + createTransLatticeVerts(t); } else if (t->obedit->type==OB_MBALL) { - createTransMBallVerts(C, t); + createTransMBallVerts(t); } else if (t->obedit->type==OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; - createTransArmatureVerts(C, t); + createTransArmatureVerts(t); } else { printf("edit type not implemented!\n"); @@ -5315,7 +5315,7 @@ void createTransData(bContext *C, TransInfo *t) else if (ob && (ob->mode & OB_MODE_POSE)) { // XXX this is currently limited to active armature only... // XXX active-layer checking isn't done as that should probably be checked through context instead - createTransPose(C, t, ob); + createTransPose(t, ob); } else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { /* important that ob_armature can be set even when its not selected [#23412] @@ -5326,7 +5326,7 @@ void createTransData(bContext *C, TransInfo *t) if(base_arm) { View3D *v3d = t->view; if(BASE_VISIBLE(v3d, base_arm)) { - createTransPose(C, t, ob_armature); + createTransPose(t, ob_armature); } } diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 54a86b3dca1..ce0888b6a30 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -55,7 +55,7 @@ void InputVector(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) } -void InputSpring(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { float ratio, precise_ratio, dx, dy; if(mi->precision) @@ -93,7 +93,7 @@ void InputSpringFlip(TransInfo *t, MouseInput *mi, short mval[2], float output[3 } } -void InputTrackBall(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { if(mi->precision) @@ -162,7 +162,7 @@ void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, short mval[2], float ou output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f; } -void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]) +void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short end[2]) { short *data; @@ -178,7 +178,7 @@ void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]) data[3] = end[1]; } -void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { float length; float distance; @@ -211,7 +211,7 @@ void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[ } } -void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { double dx2 = mval[0] - mi->center[0]; double dy2 = mval[1] - mi->center[1]; @@ -272,7 +272,7 @@ void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) output[0] = *angle; } -void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2]) +void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], short mval[2]) { mi->factor = 0; mi->precision = 0; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 1d32f893b80..030ad190dc3 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1187,7 +1187,7 @@ static void draw_cylinder(GLUquadricObj *qobj, float len, float width) } -static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo, int colcode) +static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUSED(moving), int drawflags, int combo, int colcode) { GLUquadricObj *qobj; float cylen= 0.01f*(float)U.tw_handlesize; diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c index 3e47484c54c..1ff16dd5f5f 100644 --- a/source/blender/editors/transform/transform_ndofinput.c +++ b/source/blender/editors/transform/transform_ndofinput.c @@ -65,7 +65,7 @@ static void resetNDofInput(NDofInput *n) } -int handleNDofInput(NDofInput *n, wmEvent *event) +int handleNDofInput(NDofInput *UNUSED(n), wmEvent *UNUSED(event)) { int retval = 0; // TRANSFORM_FIX_ME diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 210ab0d45a8..a01a3b17cd2 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -141,7 +141,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name } } -TransformOrientation *createObjectSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) { Base *base = CTX_data_active_base(C); Object *ob; float mat[3][3]; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index a5950a72fe8..adaaf7c9de6 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -210,7 +210,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) } } -int handleSnapping(TransInfo *t, wmEvent *event) +int handleSnapping(TransInfo *UNUSED(t), wmEvent *UNUSED(event)) { int status = 0; @@ -596,7 +596,7 @@ void ApplySnapResize(TransInfo *t, float vec[3]) /********************** DISTANCE **************************/ -float TranslationBetween(TransInfo *t, float p1[3], float p2[3]) +float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) { return len_v3v3(p1, p2); } @@ -680,12 +680,12 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) /********************** CALC **************************/ -void CalcSnapGrid(TransInfo *t, float *vec) +void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) { snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS); } -void CalcSnapGeometry(TransInfo *t, float *vec) +void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) { if (t->spacetype == SPACE_VIEW3D) { @@ -1194,7 +1194,7 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray return retval; } -int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth) +int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth) { float imat[4][4]; float ray_start_local[3], ray_normal_local[3]; @@ -1682,7 +1682,7 @@ void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float no[3], O peel->flag = 0; } -int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], ListBase *depth_peels) +int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels) { int retval = 0; int totvert = dm->getNumVerts(dm); diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 290c8a64881..debb8cedd07 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -37,6 +37,7 @@ #include "DNA_object_types.h" #include "DNA_screen_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -74,7 +75,7 @@ void undo_editmode_menu(void) // history menu /* ********************************************************************* */ /* ****** XXX ***** */ -void error(const char *dummy) {} +void error(const char *UNUSED(arg)) {} /* ****** XXX ***** */ @@ -341,7 +342,7 @@ void undo_editmode_menu(bContext *C) if(event>0) undo_number(C, event); } -static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) +static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event) { Object *obedit= CTX_data_edit_object(C); @@ -351,7 +352,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) } -uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused) +uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; UndoElem *uel; diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index f1f2dd8548a..5169b096d09 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -113,7 +113,7 @@ static int draw_uvs_face_check(Scene *scene) return (ts->uv_selectmode == UV_SELECT_FACE); } -static void draw_uvs_shadow(SpaceImage *sima, Object *obedit) +static void draw_uvs_shadow(Object *obedit) { EditMesh *em; EditFace *efa; @@ -374,7 +374,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac } } -static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFace *activetf) +static void draw_uvs_other(Scene *scene, Object *obedit, MTFace *activetf) { Base *base; Image *curimage; @@ -440,7 +440,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) /* draw other uvs */ if(sima->flag & SI_DRAW_OTHER) - draw_uvs_other(sima, scene, obedit, activetf); + draw_uvs_other(scene, obedit, activetf); /* 1. draw shadow mesh */ @@ -838,7 +838,7 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi if(show_uvedit || show_uvshadow) { if(show_uvshadow) - draw_uvs_shadow(sima, obedit); + draw_uvs_shadow(obedit); else draw_uvs(sima, scene, obedit); diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index d8c7be06aa1..4a9adaf59fd 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -118,8 +118,7 @@ void IMB_freeImBuf(struct ImBuf *ibuf); * @attention Defined in allocimbuf.c */ struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, - unsigned char d, unsigned int flags, - unsigned char bitmap); + unsigned char d, unsigned int flags); /** * diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index e67c319e61a..53828ed8ea8 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -324,7 +324,7 @@ short imb_addtilesImBuf(ImBuf *ibuf) return (ibuf->tiles != NULL); } -ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags, uchar bitmap) /* XXX bitmap argument is deprecated */ +ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags) { ImBuf *ibuf; @@ -384,7 +384,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) y = ibuf1->y; if(ibuf1->flags & IB_fields) y *= 2; - ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags, 0); + ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags); if(ibuf2 == NULL) return NULL; if(flags & IB_rect) diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c index 096ed499f85..57d65bc6761 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim.c @@ -163,7 +163,7 @@ static ImBuf * movie_fetchibuf(struct anim * anim, int position) { if (anim == 0) return (0); - ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect, 0); + ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect); if ( mvReadFrames(anim->track, position, 1, ibuf->x * ibuf->y * sizeof(int), ibuf->rect ) != DM_SUCCESS ) { @@ -483,7 +483,7 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) { #else if (1) { #endif - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, IB_rect, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, IB_rect); tmp = AVI_read_frame (anim->avi, AVI_FORMAT_RGB32, position, AVI_get_stream(anim->avi, AVIST_VIDEO, 0)); @@ -809,7 +809,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { if (anim == 0) return (0); - ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); avpicture_fill((AVPicture*) anim->pFrameRGB, (unsigned char*) ibuf->rect, @@ -998,7 +998,7 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) { } ibuf = IMB_allocImBuf(raw_frame->width * 2, - raw_frame->height * 2, 32, IB_rectfloat, 0); + raw_frame->height * 2, 32, IB_rectfloat); redcode_decode_video_float(raw_frame, ibuf->rect_float, 1); @@ -1050,31 +1050,31 @@ static struct ImBuf * anim_getnew(struct anim * anim) { break; case ANIM_MOVIE: if (startmovie(anim)) return (0); - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); /* fake */ + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); /* fake */ break; case ANIM_AVI: if (startavi(anim)) { printf("couldnt start avi\n"); return (0); } - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; #ifdef WITH_QUICKTIME case ANIM_QTIME: if (startquicktime(anim)) return (0); - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; #endif #ifdef WITH_FFMPEG case ANIM_FFMPEG: if (startffmpeg(anim)) return (0); - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; #endif #ifdef WITH_REDCODE case ANIM_REDCODE: if (startredcode(anim)) return (0); - ibuf = IMB_allocImBuf (8, 8, 32, 0, 0); + ibuf = IMB_allocImBuf (8, 8, 32, 0); break; #endif } diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 450b09c923b..4c7cf669d18 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -129,9 +129,9 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) /* printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y, depth, bmi.biBitCount); */ if (flags & IB_test) { - ibuf = IMB_allocImBuf(x, y, depth, 0, 0); + ibuf = IMB_allocImBuf(x, y, depth, 0); } else { - ibuf = IMB_allocImBuf(x, y, depth, IB_rect, 0); + ibuf = IMB_allocImBuf(x, y, depth, IB_rect); bmp = mem + skip; rect = (unsigned char *) ibuf->rect; diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index a9b229536cb..0eee1bd082a 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -88,7 +88,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int return NULL; } - ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags, 0); + ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags); row = MEM_mallocN(sizeof(unsigned short)*width*depth, "row in cineon_dpx.c"); frow = ibuf->rect_float+width*height*4; diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 2e224893271..08f60589977 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -104,7 +104,7 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags) // TODO use the image RGB or RGBA tag to determine the bits per pixel if (dds.hasAlpha()) bits_per_pixel = 32; else bits_per_pixel = 24; - ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0, 0); + ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0); if (ibuf == 0) return(0); /* memory allocation failed */ ibuf->ftype = DDS; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 7b3a07f10ad..dfe316628f6 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -50,8 +50,8 @@ void IMB_de_interlace(struct ImBuf *ibuf) if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); - tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); + tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); ibuf->x *= 2; IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y); @@ -78,8 +78,8 @@ void IMB_interlace(struct ImBuf *ibuf) if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); - tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); + tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y); IMB_rectcpy(tbuf2, ibuf, 0, 0, 0, tbuf2->y, ibuf->x, ibuf->y); diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 3cc266e460e..3c2c276b6e4 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -380,7 +380,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) while(curmap < IB_MIPMAP_LEVELS) { if(use_filter) { - ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0); + ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect); IMB_filterN(nbuf, hbuf); ibuf->mipmap[curmap] = IMB_onehalf(nbuf); IMB_freeImBuf(nbuf); diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 883de823745..9037285a1c5 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -283,7 +283,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) zsize = image.zsize; if (flags & IB_test) { - ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0, 0); + ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0); if (ibuf) ibuf->ftype = IMAGIC; return(ibuf); } @@ -315,7 +315,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) if (bpp == 1) { - ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect); if (ibuf->depth > 32) ibuf->depth = 32; base = ibuf->rect; zbase = (unsigned int *)ibuf->zbuf; @@ -356,7 +356,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } else { /* bpp == 2 */ - ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat); fbase = ibuf->rect_float; @@ -399,7 +399,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } else { if (bpp == 1) { - ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect); if (ibuf->depth > 32) ibuf->depth = 32; base = ibuf->rect; @@ -424,7 +424,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } else { /* bpp == 2 */ - ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat); fbase = ibuf->rect_float; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index a70c154014a..5e7ef199500 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -189,7 +189,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) float_divs[i]= (1<comps[i].prec)-1; } - ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect, 0); + ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect); if (ibuf==NULL) { if(dinfo) diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 0a070646fd5..e020a5fa8fd 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -297,9 +297,9 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f if (flags & IB_test) { jpeg_abort_decompress(cinfo); - ibuf = IMB_allocImBuf(x, y, 8 * depth, 0, 0); + ibuf = IMB_allocImBuf(x, y, 8 * depth, 0); } - else if ((ibuf = IMB_allocImBuf(x, y, 8 * depth, IB_rect, 0)) == NULL) { + else if ((ibuf = IMB_allocImBuf(x, y, 8 * depth, IB_rect)) == NULL) { jpeg_abort_decompress(cinfo); } else { @@ -699,7 +699,7 @@ static int save_jstjpeg(char * name, struct ImBuf * ibuf) struct ImBuf * tbuf; int oldy, returnval; - tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect, 0); + tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect); tbuf->ftype = ibuf->ftype; tbuf->flags = ibuf->flags; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 4107f051d73..5b8c5c72802 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -975,7 +975,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) } else { - ibuf = IMB_allocImBuf(width, height, 32, 0, 0); + ibuf = IMB_allocImBuf(width, height, 32, 0); ibuf->ftype = OPENEXR; /* openEXR is linear as per EXR spec */ diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index c66abe76289..3f80e5577a8 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -70,7 +70,7 @@ void * IMB_exr_get_handle (void) {return NULL;} void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) {} int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) {return 0;} -void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) {} +void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; } void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) {} void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) {} diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 6b21f20b3fb..b29a4ae0627 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -61,7 +61,8 @@ int imb_is_a_png(unsigned char *mem) } static void Flush(png_structp png_ptr) -{ +{ + (void)png_ptr; } static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length) @@ -368,7 +369,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) longjmp(png_jmpbuf(png_ptr), 1); } - ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0, 0); + ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0); if (ibuf) { ibuf->ftype = PNG; diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 4064246c866..385124cd717 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -202,8 +202,8 @@ struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags) ptr = (unsigned char *)strchr((char*)&mem[x+1], '\n'); ptr++; - if (flags & IB_test) ibuf = IMB_allocImBuf(width, height, 32, 0, 0); - else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect)|IB_rectfloat, 0); + if (flags & IB_test) ibuf = IMB_allocImBuf(width, height, 32, 0); + else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect)|IB_rectfloat); if (ibuf==NULL) return NULL; ibuf->ftype = RADHDR; diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 4fccf5dae41..73dcc0c8ea9 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -62,7 +62,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1) if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1)); - ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); _p1 = (uchar *) ibuf1->rect; @@ -123,7 +123,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); p1 = (int *) ibuf1->rect; @@ -181,7 +181,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); _p1 = (uchar *) ibuf1->rect; @@ -249,7 +249,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); p1 = (int *) ibuf1->rect; @@ -303,7 +303,7 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1) if (ibuf1->x <= 1) return(IMB_half_y(ibuf1)); if (ibuf1->y <= 1) return(IMB_half_x(ibuf1)); - ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags, 0); + ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); p1f = ibuf1->rect_float; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index ada1f448bfc..e50e445034e 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -537,8 +537,8 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) if (checktarga(&tga,mem) == 0) return(0); - if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0, 0); - else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect, 0); + if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0); + else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect); if (ibuf == 0) return(0); ibuf->ftype = TGA; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index f3415d44ecb..8abc2e89952 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -280,7 +280,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im return NULL; } if (size == THB_FAIL) { - img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata, 0); + img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata); if (!img) return 0; } else { if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) { diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index f1f8383b85e..cd9bf9c7a3a 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -102,7 +102,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile) return NULL; /* finally malloc and read the data */ - img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata, 0); + img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata); if(gzread(gzfile, img->rect, bhead[1]) != bhead[1]) { IMB_freeImBuf(img); diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 5b77c6c7c36..eb5d1f2c039 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -93,11 +93,18 @@ typedef struct ImbTIFFMemFile { static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) { + (void)fd; + (void)base; + (void)size; } static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { - return (0); + (void)fd; + (void)pbase; + (void)psize; + + return (0); } /** @@ -154,6 +161,10 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) */ static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n) { + (void)handle; + (void)data; + (void)n; + printf("imb_tiff_WriteProc: this function should not be called.\n"); return (-1); } @@ -368,7 +379,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) ib_flag = IB_rect; } - tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0); + tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag); /* simple RGBA image */ if (!(bitspersample == 32 || bitspersample == 16)) { @@ -497,7 +508,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags) ib_depth = (spp==3)?24:32; - ibuf = IMB_allocImBuf(width, height, ib_depth, 0, 0); + ibuf = IMB_allocImBuf(width, height, ib_depth, 0); if(ibuf) { ibuf->ftype = TIF; } @@ -533,7 +544,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags) width= (width > 1)? width/2: 1; height= (height > 1)? height/2: 1; - hbuf= IMB_allocImBuf(width, height, 32, 0, 0); + hbuf= IMB_allocImBuf(width, height, 32, 0); hbuf->miplevel= level; hbuf->ftype= ibuf->ftype; ibuf->mipmap[level-1] = hbuf; diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index cee6b7f854a..9f5308cce33 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -206,7 +206,7 @@ static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *repo ksi->generate= (have_function[2])? RKS_GEN_rna_internal: NULL; /* add and register with other info as needed */ - ANIM_keyingset_info_register(C, ksi); + ANIM_keyingset_info_register(ksi); /* return the struct-rna added */ return ksi->ext.srna; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 63268f69438..76930e3cc52 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -176,7 +176,7 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *d void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object) { if(ID_REAL_USERS(object) <= 0) { - unlink_object(NULL, object); /* needed or ID pointers to this are not cleared */ + unlink_object(object); /* needed or ID pointers to this are not cleared */ free_libblock(&bmain->object, object); } else { diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index dc3cb675f7a..95e17451e62 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1084,7 +1084,7 @@ static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext CustomDataLayer *cdl= NULL; int index; - if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) { + if(ED_mesh_uv_texture_add(C, me, name, FALSE)) { fdata= rna_mesh_fdata(me); index= CustomData_get_named_layer_index(fdata, CD_MTFACE, name); cdl= (index == -1)? NULL: &fdata->layers[index]; diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 674fbbad9c6..0c217837226 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -38,7 +38,7 @@ static void rna_Sound_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_load(bmain, (bSound*)ptr->data); + sound_load((bSound*)ptr->data); } static int rna_Sound_caching_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4196b3585b3..b3b263fe030 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -169,7 +169,7 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr) static void rna_UserDef_audio_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_init(bmain); + sound_init(); } static void rna_Userdef_memcache_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 42c2fc5bbe4..176a52251e7 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -138,6 +138,8 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fss->flag |= OB_FLUIDSIM_ACTIVE; } +#else + (void)fluidmd; /* unused */ #endif return; } @@ -154,7 +156,10 @@ void fluidsim_free(FluidsimModifierData *fluidmd) } MEM_freeN(fluidmd->fss); } +#else + (void)fluidmd; /* unused */ #endif + return; } @@ -607,6 +612,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, return dm; #else + /* unused */ + (void)fluidmd; + (void)scene; + (void)dm; + (void)useRenderParams; return NULL; #endif } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c index 37061dd7eae..3f6bd989477 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c @@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_alphaover_out[]= { { -1, 0, "" } }; -static void do_alphaover_premul(bNode *node, float *out, float *src, float *over, float *fac) +static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { if(over[3]<=0.0f) { @@ -61,7 +61,7 @@ static void do_alphaover_premul(bNode *node, float *out, float *src, float *over } /* result will be still premul, but the over part is premulled */ -static void do_alphaover_key(bNode *node, float *out, float *src, float *over, float *fac) +static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { if(over[3]<=0.0f) { @@ -107,7 +107,7 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, -static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: col col */ /* stack order out: col */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c index 97577fa6b5e..404f0aefb3c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c @@ -81,7 +81,7 @@ static bNodeSocketType cmp_node_bilateralblur_out[]= { /* code of this node was heavily inspired by the smooth function of opencv library. The main change is an optional image input */ -static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeBilateralBlurData *nbbd= node->storage; CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index 894cc20e999..f367e7b473d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -205,7 +205,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca } /* reference has to be mapped 0-1, and equal in size */ -static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float fac, NodeBlurData *nbd) +static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref), float UNUSED(fac), NodeBlurData *nbd) { CompBuf *wbuf; register float val; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c index 03eed59a4c4..889d61fe4fa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c @@ -77,7 +77,7 @@ static void do_brightnesscontrast(bNode *node, float *out, float *in) } } -static void node_composit_exec_brightcontrast(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index ca7c19cc778..182c339132e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_channel_matte_out[]={ {-1,0,""} }; -static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in) +static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in) { /*normalize to the range 0.0 to 1.0) */ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); @@ -52,7 +52,7 @@ static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in) out[3]=in[3]; } -static void do_normalized_ycca_to_rgba2(bNode *node, float *out, float *in) +static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ in[0]=in[0]*255.0; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index e502129c3d3..d102afbbd16 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_chroma_out[]={ {-1,0,""} }; -static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) +static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in) { rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); @@ -62,7 +62,7 @@ static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) out[3]=in[3]; } -static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in) +static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ in[0]=(in[0]+1.0)/2.0; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c index 3191ad757a0..408bda02ee4 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c @@ -182,7 +182,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma } } -static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* Originally based on the information from the book "The Art and Science of Digital Composition" and diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index 33f5680eaa9..c8e0108a5c8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -120,7 +120,7 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f out[3] = in[3]; } -static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf= in[1]->data; CompBuf *stackbuf; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index 7510a2d11d4..ffb090f3a94 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_composite_in[]= { }; /* applies to render pipeline */ -static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha, z */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c index dd5ce88bd36..7ecfe40f739 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_crop_out[]= { { -1, 0, "" } }; -static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { NodeTwoXYs *ntxy= node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index e4afa1922bb..1a88e9541c6 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -38,7 +38,7 @@ static bNodeSocketType cmp_node_time_out[]= { { -1, 0, "" } }; -static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { RenderData *rd= data; /* stack order output: fac */ @@ -89,7 +89,7 @@ static bNodeSocketType cmp_node_curve_vec_out[]= { { -1, 0, "" } }; -static void node_composit_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: vec */ /* stack order output: vec */ @@ -158,7 +158,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac) out[3]= in[3]; } -static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: fac, image, black level, white level */ /* stack order output: image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index a93a5760842..5c25bffa5d9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -791,7 +791,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } -static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data; NodeDefocus *nqd = node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c index 6c67413ea1f..71990b7403a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c @@ -110,7 +110,7 @@ static void morpho_erode(CompBuf *cbuf) } -static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: mask */ /* stack order out: mask */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c index b0cf5559772..42bf48b9128 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c @@ -102,7 +102,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, return img; } -static void node_composit_exec_dblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeDBlurData *ndbd= node->storage; CompBuf *new, *img= in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c index aa7fac81c2c..1ce545e2ca8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c @@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= { * in order to take effect */ #define DISPLACE_EPSILON 0.01 -static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) +static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) { ImBuf *ibuf; int x, y; @@ -60,7 +60,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float float vec[3], vecdx[3], vecdy[3]; float col[3]; - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; for(y=0; y < stackbuf->y; y++) { @@ -140,7 +140,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float } -static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c index fbc570c4028..33a17f890d8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_flip_out[]= { { -1, 0, "" } }; -static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { CompBuf *cbuf= in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c index c0e524a3ae9..2e3162b0c30 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_gamma_out[]= { { -1, 0, "" } }; -static void do_gamma(bNode *node, float *out, float *in, float *fac) +static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) { int i=0; for(i=0; i<3; i++) { @@ -51,7 +51,7 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac) } out[3] = in[3]; } -static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: Fac, Image */ /* stack order out: Image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index 1d50acfdc26..d4968caee0f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -422,7 +422,7 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src) //-------------------------------------------------------------------------------------------- -static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *src, *img = in[0]->data; NodeGlare* ndg = node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c index c274c580771..e8ce3e20f11 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c @@ -65,7 +65,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) } } -static void node_composit_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: Fac, Image */ /* stack order out: Image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c index 9eb79bb8c36..ac009ccb69d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c @@ -98,7 +98,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac) out[3]= in[3]; } -static void node_composit_exec_huecorrect(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf= in[1]->data; CompBuf *stackbuf; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index c99496d9664..dcf9a059c83 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -215,7 +215,7 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I }; -static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { /* image assigned to output */ @@ -378,7 +378,7 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); }; -static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { Scene *sce= (Scene *)node->id; Render *re= (sce)? RE_GetRender(sce->id.name): NULL; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c index 08ae51975b9..7ea146c7d4d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c @@ -75,7 +75,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) QUATCOPY(out, col); } -static void node_composit_exec_invert(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac, Image, Image */ /* stack order out: Image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c index fc9045caafd..b6e1fffcce8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c @@ -147,7 +147,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb } -static void node_composit_exec_lensdist(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *img = in[0]->data; NodeLensDist* nld = node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c index 91d1aa148b2..c605a661556 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c @@ -51,7 +51,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr int x, y, sx, sy, row= 3*stackbuf->x; /* ibuf needed for sampling */ - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; /* vars for efficient looping */ @@ -134,7 +134,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr } -static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c index 357218ea937..92709025a84 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c @@ -52,7 +52,7 @@ static void do_map_value(bNode *node, float *out, float *src) out[0]= texmap->max[0]; } -static void node_composit_exec_map_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: valbuf */ /* stack order out: valbuf */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index f663dc76b5c..98bbbf6c752 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -151,7 +151,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) } } -static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf=in[0]->data; CompBuf *cbuf2=in[1]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c index c57caf180ad..04162956ac3 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c @@ -52,7 +52,7 @@ static void do_normal(bNode *node, float *out, float *in) } /* generates normal, does dot product */ -static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { bNodeSocket *sock= node->outputs.first; /* stack order input: normal */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c index 64855ba5cf3..07a11cdc997 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_normalize_out[]= { { -1, 0, "" } }; -static void do_normalize(bNode *node, float *out, float *src, float *min, float *mult) +static void do_normalize(bNode *UNUSED(node), float *out, float *src, float *min, float *mult) { float res; res = (src[0] - min[0]) * mult[0]; @@ -58,7 +58,7 @@ static void do_normalize(bNode *node, float *out, float *src, float *min, float /* The code below assumes all data is inside range +- this, and that input buffer is single channel */ #define BLENDER_ZMAX 10000.0f -static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: valbuf */ /* stack order out: valbuf */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c index 6f29548fcc3..85baa8c347a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_output_file_in[]= { { -1, 0, "" } }; -static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha */ @@ -54,7 +54,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * return; } else { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); - ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); char string[256]; ibuf->rect_float= cbuf->rect; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c index 5058fa51c11..1aa2e338f94 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c @@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_premulkey_out[]= { { -1, 0, "" } }; -static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c index 3b9b993d5f8..5fbed05ac8d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_rgb_out[]= { { -1, 0, "" } }; -static void node_composit_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index ccb1d8abfd9..8fed6972c20 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_rotate_out[]= { }; /* only supports RGBA nodes now */ -static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) @@ -68,8 +68,8 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, maxy= -centy + (float)cbuf->y; - ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); - obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0); + ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); + obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); if(ibuf && obuf){ ibuf->rect_float=cbuf->rect; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index 9779875b01a..40785f3bc77 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -75,7 +75,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b newx= MIN2(newx, CMP_SCALE_MAX); newy= MIN2(newy, CMP_SCALE_MAX); - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); if(ibuf) { ibuf->rect_float= cbuf->rect; IMB_scaleImBuf(ibuf, newx, newy); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c index 0ac47c58ab3..ef8723fd4e9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sephsva_out[]= { { -1, 0, "" } }; -static void do_sephsva(bNode *node, float *out, float *in) +static void do_sephsva(bNode *UNUSED(node), float *out, float *in) { float h, s, v; @@ -55,7 +55,7 @@ static void do_sephsva(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -127,7 +127,7 @@ static bNodeSocketType cmp_node_combhsva_out[]= { { -1, 0, "" } }; -static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b); @@ -138,7 +138,7 @@ static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c index c5a57f8a175..36603785bb3 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_seprgba_out[]= { { -1, 0, "" } }; -static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -106,7 +106,7 @@ static bNodeSocketType cmp_node_combrgba_out[]= { { -1, 0, "" } }; -static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_combrgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { out[0] = in1[0]; out[1] = in2[0]; @@ -114,7 +114,7 @@ static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float * out[3] = in4[0]; } -static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c index 7b3dfccab50..4b164729bbc 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepycca_out[]= { { -1, 0, "" } }; -static void do_sepycca(bNode *node, float *out, float *in) +static void do_sepycca(bNode *UNUSED(node), float *out, float *in) { float y, cb, cr; @@ -56,7 +56,7 @@ static void do_sepycca(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* input no image? then only color operation */ if(in[0]->data==NULL) { @@ -126,7 +126,7 @@ static bNodeSocketType cmp_node_combycca_out[]= { { -1, 0, "" } }; -static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_ycca(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; float y, cb, cr; @@ -144,7 +144,7 @@ static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 ycca channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c index 13b71026054..333a4a2596e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepyuva_out[]= { { -1, 0, "" } }; -static void do_sepyuva(bNode *node, float *out, float *in) +static void do_sepyuva(bNode *UNUSED(node), float *out, float *in) { float y, u, v; @@ -55,7 +55,7 @@ static void do_sepyuva(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -127,7 +127,7 @@ static bNodeSocketType cmp_node_combyuva_out[]= { { -1, 0, "" } }; -static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; yuv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b); @@ -138,7 +138,7 @@ static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c index a7d10017c1f..f4c5603ce49 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_setalpha_out[]= { { -1, 0, "" } }; -static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: RGBA image */ /* stack order in: col, alpha */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c index 98bda1bd7fa..efb8c12fa84 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_splitviewer_in[]= { { -1, 0, "" } }; -static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, float *fac) +static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac) { if(*fac==0.0f) { QUATCOPY(out, in1); @@ -46,7 +46,7 @@ static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, } } -static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: image image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c index 12f0c171f94..49031e1625a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c @@ -123,7 +123,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) } -static void node_composit_exec_tonemap(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *img = in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c index ca359d436f6..0d8ad41d2dd 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_translate_out[]= { { -1, 0, "" } }; -static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { if(in[0]->data) { CompBuf *cbuf= in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c index 6ce03f38cdb..7e0ecbcb888 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c @@ -46,7 +46,7 @@ static void do_colorband_composit(bNode *node, float *out, float *in) do_colorband(node->storage, in[0], out); } -static void node_composit_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac */ /* stack order out: col, alpha */ @@ -109,12 +109,12 @@ static bNodeSocketType cmp_node_rgbtobw_out[]= { { -1, 0, "" } }; -static void do_rgbtobw(bNode *node, float *out, float *in) +static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in) { out[0]= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f; } -static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw */ /* stack order in: col */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c index 14a3b6fe15c..a37742c77e9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c @@ -35,7 +35,7 @@ static bNodeSocketType cmp_node_value_out[]= { { -1, 0, "" } }; -static void node_composit_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c index eaeeadd02af..9ea626e39d6 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c @@ -44,7 +44,7 @@ static bNodeSocketType cmp_node_vecblur_out[]= { -static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeBlurData *nbd= node->storage; CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c index 80200ad9ce6..24d8a9eb09e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c @@ -39,7 +39,7 @@ static bNodeSocketType cmp_node_viewer_in[]= { }; -static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha, z */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c index 7be9f34f00b..80989feaf26 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c @@ -67,7 +67,7 @@ static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2) } } -static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol) +static void do_zcombine_add(bNode *UNUSED(node), float *out, float *col1, float *col2, float *acol) { float alpha= *acol; float malpha= 1.0f - alpha; diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index 9edcc8b0eec..c762d8cb42d 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -662,59 +662,59 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) } } -void do_rgba_to_yuva(bNode *node, float *out, float *in) +void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in) { rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_rgba_to_hsva(bNode *node, float *out, float *in) +void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in) { rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_rgba_to_ycca(bNode *node, float *out, float *in) +void do_rgba_to_ycca(bNode *UNUSED(node), float *out, float *in) { rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } -void do_yuva_to_rgba(bNode *node, float *out, float *in) +void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in) { yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_hsva_to_rgba(bNode *node, float *out, float *in) +void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in) { hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_ycca_to_rgba(bNode *node, float *out, float *in) +void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in) { ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } -void do_copy_rgba(bNode *node, float *out, float *in) +void do_copy_rgba(bNode *UNUSED(node), float *out, float *in) { QUATCOPY(out, in); } -void do_copy_rgb(bNode *node, float *out, float *in) +void do_copy_rgb(bNode *UNUSED(node), float *out, float *in) { VECCOPY(out, in); out[3]= 1.0f; } -void do_copy_value(bNode *node, float *out, float *in) +void do_copy_value(bNode *UNUSED(node), float *out, float *in) { out[0]= in[0]; } -void do_copy_a_rgba(bNode *node, float *out, float *in, float *fac) +void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac) { VECCOPY(out, in); out[3]= *fac; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c index d89099955aa..869b1d1e54c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c @@ -38,7 +38,7 @@ static bNodeSocketType sh_node_camera_out[]= { }; -static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */ @@ -49,7 +49,7 @@ static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bN } } -static int gpu_shader_camera(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION)); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c index 4e47e75993d..56aaa4fe8a7 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_curve_vec_out[]= { { -1, 0, "" } }; -static void node_shader_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -97,7 +97,7 @@ static bNodeSocketType sh_node_curve_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec[3]; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c index aefe7d104b5..a27918df275 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c @@ -47,7 +47,7 @@ static bNodeSocketType sh_node_geom_out[]= { }; /* node execute callback */ -static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c index 4f319f8937c..5c95577e32d 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c @@ -45,7 +45,7 @@ static bNodeSocketType sh_node_hue_sat_out[]= { }; /* note: it would be possible to use CMP version for both nodes */ -static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, float *val, float *in, float *fac) +static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac) { if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0 || *val!=1.0)) { float col[3], hsv[3], mfac= 1.0f - *fac; @@ -66,13 +66,13 @@ static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, floa } } -static void node_shader_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { do_hue_sat_fac(node, out[0]->vec, in[0]->vec, in[1]->vec, in[2]->vec, in[4]->vec, in[3]->vec); } -static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "hue_sat", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c index 08666f4dd52..73fccf7cd0b 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c @@ -43,7 +43,7 @@ static bNodeSocketType sh_node_invert_out[]= { { -1, 0, "" } }; -static void node_shader_exec_invert(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_invert(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { float col[3], facm; @@ -64,7 +64,7 @@ bNodeStack **out) VECCOPY(out[0]->vec, col); } -static int gpu_shader_invert(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "invert", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c index 49778625446..f01ed3d7ab8 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c @@ -41,7 +41,7 @@ static bNodeSocketType sh_node_mapping_out[]= { }; /* do the regular mapping options for blender textures */ -static void node_shader_exec_mapping(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { TexMapping *texmap= node->storage; float *vec= out[0]->vec; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c index 7429c084ab3..40a2e53c665 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c @@ -43,7 +43,7 @@ static bNodeSocketType sh_node_math_out[]= { { -1, 0, "" } }; -static void node_shader_exec_math(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { switch(node->custom1){ diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c index bc4342e11e3..56d863f002a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_mix_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_mix_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac, col1, col2 */ /* stack order out: col */ diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c index eb3786286ae..8054f184cea 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_normal_out[]= { }; /* generates normal, does dot product */ -static void node_shader_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { bNodeSocket *sock= node->outputs.first; float vec[3]; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/intern/SHD_nodes/SHD_output.c index 740639b6ab4..4395716e599 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_output.c @@ -36,7 +36,7 @@ static bNodeSocketType sh_node_output_in[]= { { -1, 0, "" } }; -static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; @@ -62,7 +62,7 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN } } -static int gpu_shader_output(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *outlink; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c index 71af58beb67..600518962ab 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c @@ -35,7 +35,7 @@ static bNodeSocketType sh_node_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c index 883cd4d3bf4..1de200c7b1c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c @@ -41,14 +41,14 @@ static bNodeSocketType sh_node_seprgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_seprgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_seprgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { out[0]->vec[0] = in[0]->vec[0]; out[1]->vec[0] = in[0]->vec[1]; out[2]->vec[0] = in[0]->vec[2]; } -static int gpu_shader_seprgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "separate_rgb", in, out); } @@ -85,14 +85,14 @@ static bNodeSocketType sh_node_combrgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_combrgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_combrgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { out[0]->vec[0] = in[0]->vec[0]; out[0]->vec[1] = in[1]->vec[0]; out[0]->vec[2] = in[2]->vec[0]; } -static int gpu_shader_combrgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "combine_rgb", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c index 926dcd0f046..06b06affaa0 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_squeeze_out[]= { { -1, 0, "" } }; -static void node_shader_exec_squeeze(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_squeeze(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -54,7 +54,7 @@ bNodeStack **out) out[0]->vec[0] = 1.0f / (1.0f + pow(2.71828183,-((vec[0]-vec[2])*vec[1]))) ; } -static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "squeeze", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c index e2260461152..1e5b9cf935e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c @@ -40,7 +40,7 @@ static bNodeSocketType sh_node_valtorgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac */ /* stack order out: col, alpha */ @@ -98,7 +98,7 @@ static bNodeSocketType sh_node_rgbtobw_out[]= { }; -static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_rgbtobw(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { /* stack order out: bw */ /* stack order in: col */ @@ -106,7 +106,7 @@ static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, b out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f; } -static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "rgbtobw", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/intern/SHD_nodes/SHD_value.c index 1663ea352aa..f78480bd794 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_value.c @@ -35,7 +35,7 @@ static bNodeSocketType sh_node_value_out[]= { { -1, 0, "" } }; -static void node_shader_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c index 062c6402fb6..dbdb04c2a6a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c @@ -44,7 +44,7 @@ static bNodeSocketType sh_node_vect_math_out[]= { { -1, 0, "" } }; -static void node_shader_exec_vect_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec1[3], vec2[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/intern/TEX_nodes/TEX_at.c index 08c1c65792d..1ca293acb5b 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_at.c @@ -38,7 +38,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { TexParams np = *p; float new_co[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c index 4155cec4d7f..64b70455a19 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float x = p->co[0]; float y = p->co[1]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c index 7319a50b7d9..f05e1e987da 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { int i; for(i = 0; i < 4; i++) diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c index 68e892ce77c..4ad32bc872e 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c @@ -33,7 +33,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void vectorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **UNUSED(in), short UNUSED(thread)) { out[0] = p->co[0]; out[1] = p->co[1]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c index 49a1ef35fbb..0fca0aa30ad 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c @@ -36,7 +36,7 @@ static bNodeSocketType time_outputs[]= { { -1, 0, "" } }; -static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) { /* stack order output: fac */ float fac= 0.0f; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c index f031091e08d..13768aaa868 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c @@ -41,25 +41,25 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void valuefn_r(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_r(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[0]; } -static void valuefn_g(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_g(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[1]; } -static void valuefn_b(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_b(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[2]; } -static void valuefn_a(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_a(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c index e0fee3e3153..5d624205f43 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c @@ -41,7 +41,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float co1[3], co2[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c index 367ea7b9e5f..2ccde083823 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c @@ -42,7 +42,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void do_hue_sat_fac(bNode *node, float *out, float hue, float sat, float val, float *in, float fac) +static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac) { if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) { float col[3], hsv[3], mfac= 1.0f - fac; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c index 628d9026db1..c764c7a22d2 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c @@ -34,7 +34,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) { float x = p->co[0]; float y = p->co[1]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c index 1619ed73023..421082aeb34 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c @@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float col[4]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c index 09bc893cc1f..26733a94180 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c @@ -36,7 +36,7 @@ static bNodeSocketType inputs[]= { }; /* applies to render pipeline */ -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; TexResult *target = cdata->target; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c index 3e7ef0e94fe..a4a608e777c 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c @@ -111,7 +111,7 @@ static int count_outputs(bNode *node) /* Boilerplate generators */ #define ProcNoInputs(name) \ - static void name##_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread) \ + static void name##_map_inputs(Tex *UNUSED(tex), bNodeStack **UNUSED(in), TexParams *UNUSED(p), short UNUSED(thread)) \ {} #define ProcDef(name) \ diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c index 9a855938eef..88ed5382a6a 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c @@ -64,7 +64,7 @@ static void rotate(float new_co[3], float a, float ax[3], float co[3]) new_co[2] = para[2] + perp[2] + cp[2]; } -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3], new_dxt[3], new_dyt[3], a, ax[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c index 721c322c540..8045c1ca07a 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float scale[3], new_co[3], new_dxt[3], new_dyt[3]; TexParams np = *p; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c index a823338faf9..a9d7fbcf3da 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float offset[3], new_co[3]; TexParams np = *p; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c index 46aefe5ad47..c71d442cef3 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c @@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void normalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3]; float *co = p->co; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c index 3810167a58a..fcaa9550efa 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c @@ -87,7 +87,7 @@ static bNodeSocketType rgbtobw_out[]= { }; -static void rgbtobw_valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float cin[4]; tex_input_rgba(cin, in[0], p, thread); diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c index 698c894a8d8..75fe6945261 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c @@ -37,7 +37,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index e741c622380..e70287e522e 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -321,7 +321,7 @@ u | | F1 | F2 | /* ------------------------------------------------------------------------- */ -static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, int usize, int vsize, int uIndex, int cyclu, int cyclv) +static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, int usize, int vsize, int uIndex, int UNUSED(cyclu), int cyclv) { int vLen = vsize-1+(!!cyclv); int v; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 8977bc7f379..f7da13373d1 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -86,7 +86,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf) if (env->type == ENV_CUBE) { for(part=0; part<6; part++) { - env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat, 0); + env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat); } IMB_float_from_rect(ibuf); @@ -458,7 +458,7 @@ static void render_envmap(Render *re, EnvMap *env) int y; float *alpha; - ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat, 0); + ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat); memcpy(ibuf->rect_float, rl->rectf, ibuf->channels * ibuf->x * ibuf->y * sizeof(float)); if (re->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 79f489137f3..ed390fe102a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -122,20 +122,20 @@ Render R; static volatile int g_break= 0; -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return g_break; } /* default callbacks, set in each new render */ -static void result_nothing(void *unused, RenderResult *rr) {} -static void result_rcti_nothing(void *unused, RenderResult *rr, volatile struct rcti *rect) {} -static void stats_nothing(void *unused, RenderStats *rs) {} -static void float_nothing(void *unused, float val) {} -static void print_error(void *unused, char *str) {printf("ERROR: %s\n", str);} -static int default_break(void *unused) {return G.afbreek == 1;} +static void result_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr)) {} +static void result_rcti_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) {} +static void stats_nothing(void *UNUSED(arg), RenderStats *UNUSED(rs)) {} +static void float_nothing(void *UNUSED(arg), float UNUSED(val)) {} +static void print_error(void *UNUSED(arg), char *str) {printf("ERROR: %s\n", str);} +static int default_break(void *UNUSED(arg)) {return G.afbreek == 1;} -static void stats_background(void *unused, RenderStats *rs) +static void stats_background(void *UNUSED(arg), RenderStats *rs) { char str[400], *spos= str; uintptr_t mem_in_use, mmap_in_use, peak_memory; @@ -1398,7 +1398,7 @@ void RE_error_cb(Render *re, void *handle, void (*f)(void *handle, char *str)) /* object is considered fully prepared on correct time etc */ /* includes lights */ -void RE_AddObject(Render *re, Object *ob) +void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob)) { } @@ -2813,7 +2813,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R } } else { - ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0); /* if not exists, BKE_write_ibuf makes one */ ibuf->rect= (unsigned int *)rres.rect32; @@ -3170,7 +3170,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, char *file if(ibuf->rect_float==NULL) IMB_float_from_rect(ibuf); - ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat, 0); + ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat); if(ibuf_clip) { IMB_rectcpy(ibuf_clip, ibuf, 0,0, 0,0, layer->rectx, layer->recty); diff --git a/source/blender/render/intern/source/rayobject_instance.c b/source/blender/render/intern/source/rayobject_instance.c index 25765c4763a..a8098d2e8ef 100644 --- a/source/blender/render/intern/source/rayobject_instance.c +++ b/source/blender/render/intern/source/rayobject_instance.c @@ -41,7 +41,7 @@ static void RE_rayobject_instance_free(RayObject *o); static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max); static float RE_rayobject_instance_cost(RayObject *o); -static void RE_rayobject_instance_hint_bb(RayObject *o, RayHint *hint, float *min, float *max) +static void RE_rayobject_instance_hint_bb(RayObject *UNUSED(o), RayHint *UNUSED(hint), float *UNUSED(min), float *UNUSED(max)) {} static RayObjectAPI instance_api = diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 7101ce5daaf..e589bb3a840 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -820,7 +820,7 @@ static void *do_shadow_thread(void *re_v) } static volatile int g_break= 0; -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return g_break; } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index e8c95a34ac4..1e8709d09f7 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -466,7 +466,7 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad) /* building */ -static void sum_leaf_radiance(ScatterTree *tree, ScatterNode *node) +static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) { ScatterPoint *p; float rad, totrad= 0.0f, inv; @@ -540,7 +540,7 @@ static void sum_leaf_radiance(ScatterTree *tree, ScatterNode *node) } } -static void sum_branch_radiance(ScatterTree *tree, ScatterNode *node) +static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) { ScatterNode *subnode; float rad, totrad= 0.0f, inv; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index d3e8f4058c5..39e8315e7cf 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -89,7 +89,7 @@ int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int l } /* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */ -int point_inside_obi(RayObject *tree, ObjectInstanceRen *obi, float *co) +int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) { Isect isect; float vec[3] = {0.0f,0.0f,1.0f}; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 66d2a1efdea..e925d651490 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -254,7 +254,7 @@ static void wm_init_userdef(bContext *C) UI_init_userdef(); MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024); - sound_init(CTX_data_main(C)); + sound_init(); /* set the python auto-execute setting from user prefs */ /* disabled by default, unless explicitly enabled in the command line */ diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index b9580cf4f91..7bcbe0db341 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -205,7 +205,7 @@ struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;} int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;} struct ListBase builtin_keyingsets; -void ANIM_keyingset_info_register (const struct bContext *C, struct KeyingSetInfo *ksi){} +void ANIM_keyingset_info_register (struct KeyingSetInfo *ksi){} void ANIM_keyingset_info_unregister (const struct bContext *C, struct KeyingSetInfo *ksi){} short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type){return 0;} short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;} @@ -254,7 +254,7 @@ void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count) void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){} void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma){} int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;} -int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;} +int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me){return 0;} void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){} void ED_object_constraint_update(struct Object *ob){} struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, char *name){return (struct bDeformGroup *) NULL;} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 662222bf990..e1cd1c6d488 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -250,7 +250,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename) BLI_path_abs(path, G.sce); /* BKE_add_image_extension() checks for if extension was already set */ BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */ - ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0, 0); + ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0); ibuf->rect= dumprect; ibuf->ftype= PNG; diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index d1b8fb12336..3a302fbc7ff 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -583,7 +583,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) if (!m_networkdevice) goto initFailed; - sound_init(m_maggie); + sound_init(); // create a ketsjisystem (only needed for timing and stuff) m_kxsystem = new GPG_System (m_system); diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index 5d40ba7d75c..e708775b184 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -634,7 +634,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) } else { for(part=0; part<6; part++) { - env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect, 0); + env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect); } IMB_rectcpy(env->cube[0], ibuf, 0, 0, 0, 0, dx, dx); diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp index 926468c662e..b8a67ccfc40 100644 --- a/source/gameengine/VideoTexture/ImageBuff.cpp +++ b/source/gameengine/VideoTexture/ImageBuff.cpp @@ -147,10 +147,10 @@ void ImageBuff::plot (unsigned char * img, short width, short height, short x, s if (!m_imbuf) { // allocate most basic imbuf, we will assign the rect buffer on the fly - m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0); + m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0); } - tmpbuf = IMB_allocImBuf(width, height, 0, 0, 0); + tmpbuf = IMB_allocImBuf(width, height, 0, 0); // assign temporarily our buffer to the ImBuf buffer, we use the same format tmpbuf->rect = (unsigned int*)img; @@ -169,11 +169,11 @@ void ImageBuff::plot (ImageBuff* img, short x, short y, short mode) if (!m_imbuf) { // allocate most basic imbuf, we will assign the rect buffer on the fly - m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0); + m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0); } if (!img->m_imbuf) { // allocate most basic imbuf, we will assign the rect buffer on the fly - img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0, 0); + img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0); } // assign temporarily our buffer to the ImBuf buffer, we use the same format img->m_imbuf->rect = img->m_image; -- cgit v1.2.3 From 5ca362c4224ef9254477ead5696cc61cbac273cc Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 14:43:47 +0000 Subject: Declaration before any statements. Doesn't GCC warn about this? --- source/blender/editors/mesh/editmesh_add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 7b23b556994..a33d64cad29 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -114,9 +114,9 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) float min[3], max[3]; int done= 0; short use_proj; + wmWindow *win= CTX_wm_window(C); em_setup_viewcontext(C, &vc); - wmWindow *win= CTX_wm_window(C); printf("\n%d %d\n", event->x, event->y); printf("%d %d\n", win->eventstate->x, win->eventstate->y); -- cgit v1.2.3 From fe693b4631b604e502cfd40078a1fcad9e03dc58 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 14:49:56 +0000 Subject: Revert overaggressive parameter removal: Main struct is used in audio when Jack support is enabled. --- source/blender/blenkernel/BKE_sound.h | 2 +- source/blender/blenkernel/intern/sound.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index fb2ea4c1ca9..09cea572deb 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -40,7 +40,7 @@ struct Sequence; void sound_init_once(); -void sound_init(void); +void sound_init(struct Main *main); void sound_exit(); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index bf8e2d348ac..ca1fd80b406 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -79,7 +79,7 @@ void sound_init_once() AUD_initOnce(); } -void sound_init(void) +void sound_init(struct Main *bmain) { AUD_DeviceSpecs specs; int device, buffersize; -- cgit v1.2.3 From 1aecaaf815676700cb297fc43953cdecfdcf90c4 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 14:51:50 +0000 Subject: Forgot to commit RNA part of revert in 32519 --- source/blender/makesrna/intern/rna_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 0c217837226..674fbbad9c6 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -38,7 +38,7 @@ static void rna_Sound_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_load((bSound*)ptr->data); + sound_load(bmain, (bSound*)ptr->data); } static int rna_Sound_caching_get(PointerRNA *ptr) -- cgit v1.2.3 From 03eb8d02229843c3257076c00a8f51925f3c93a6 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 14:53:54 +0000 Subject: =?UTF-8?q?Maybe=20now=20correct=20commit=20:=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/makesrna/intern/rna_sound.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 674fbbad9c6..0c217837226 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -38,7 +38,7 @@ static void rna_Sound_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_load(bmain, (bSound*)ptr->data); + sound_load((bSound*)ptr->data); } static int rna_Sound_caching_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index b3b263fe030..4196b3585b3 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -169,7 +169,7 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr) static void rna_UserDef_audio_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_init(); + sound_init(bmain); } static void rna_Userdef_memcache_update(Main *bmain, Scene *scene, PointerRNA *ptr) -- cgit v1.2.3 From 53ced0be29c2672226d16d63118a02a4c8eee342 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 15:00:04 +0000 Subject: Now sound init param removal revert should be fine (apparently my cmake project files missed rebuild hint for these, fortunately SCons did its job well). --- source/blender/windowmanager/intern/wm_files.c | 2 +- source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e925d651490..66d2a1efdea 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -254,7 +254,7 @@ static void wm_init_userdef(bContext *C) UI_init_userdef(); MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024); - sound_init(); + sound_init(CTX_data_main(C)); /* set the python auto-execute setting from user prefs */ /* disabled by default, unless explicitly enabled in the command line */ diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 3a302fbc7ff..d1b8fb12336 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -583,7 +583,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) if (!m_networkdevice) goto initFailed; - sound_init(); + sound_init(m_maggie); // create a ketsjisystem (only needed for timing and stuff) m_kxsystem = new GPG_System (m_system); -- cgit v1.2.3 From 7122b534fa6879c7f321705213a71ffdc091dcfd Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sat, 16 Oct 2010 15:01:01 +0000 Subject: == Audaspace / FFMPEG == Audaspace audio seek code wasn't taking start_time into account. (Most common symptom: HDV MPEG2TS files always start audio playback at the beginning regardless of seek position.) --- intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp index 623e99d5edc..09fdb31e938 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp @@ -246,13 +246,23 @@ void AUD_FFMPEGReader::seek(int position) { if(position >= 0) { + uint64_t st_time = m_formatCtx->streams[m_stream]->start_time; + double time_base = + av_q2d(m_formatCtx->streams[m_stream]->time_base); + uint64_t seek_pos = position / time_base / m_specs.rate; + + if (seek_pos < 0) { + seek_pos = 0; + } + + if (st_time != AV_NOPTS_VALUE) { + seek_pos += st_time; + } + + // a value < 0 tells us that seeking failed - if(av_seek_frame(m_formatCtx, - -1, - (uint64_t)(((uint64_t)position * - (uint64_t)AV_TIME_BASE) / - (uint64_t)m_specs.rate), - AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0) + if(av_seek_frame(m_formatCtx, m_stream, seek_pos, + AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0) { avcodec_flush_buffers(m_codecCtx); m_position = position; @@ -273,9 +283,8 @@ void AUD_FFMPEGReader::seek(int position) if(packet.pts != AV_NOPTS_VALUE) { // calculate real position, and read to frame! - m_position = packet.pts * - av_q2d(m_formatCtx->streams[m_stream]->time_base) * - m_specs.rate; + m_position = (packet.pts - + ((st_time != AV_NOPTS_VALUE) ? st_time : 0)) * time_base * m_specs.rate; if(m_position < position) { -- cgit v1.2.3 From c52e7c13706e96816f5f8893349d602803948ae2 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 15:21:55 +0000 Subject: Fix AltGr problem on Windows It was impossible for keyboard layouts that use AltGr to create certain characters to insert them in Text and Console. The keyboard driver in Windows sends left control events when AltGr is pressed. This meant that Blender thought control was being held, which is a PASS_THROUGH condition for the insert operator in both editors. Add testing of keyboard layout for AltGr, both on initialization and WM_INPUTLANGCHANGE. To remedy AltGr problem, we send now a left control key up event to Blender before further processing the AltGr key. --- intern/ghost/intern/GHOST_SystemWin32.cpp | 42 +++++++++++++++++++++++-------- intern/ghost/intern/GHOST_SystemWin32.h | 26 ++++++++++++++++++- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index d63ac700831..1f1fc65adc4 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -34,6 +34,8 @@ * @date May 7, 2001 */ +#include + #include "GHOST_SystemWin32.h" #include "GHOST_EventDragnDrop.h" @@ -142,6 +144,8 @@ GHOST_SystemWin32::GHOST_SystemWin32() GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n"); m_displayManager->initialize(); + this->keyboardAltGr(); + // Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32. OleInitialize(0); } @@ -285,18 +289,18 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const { - bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0; + bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0; keys.set(GHOST_kModifierKeyLeftShift, down); - down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0; keys.set(GHOST_kModifierKeyRightShift, down); - down = HIBYTE(::GetKeyState(VK_LMENU)) != 0; + + down = HIBYTE(::GetKeyState(VK_MENU)) != 0; keys.set(GHOST_kModifierKeyLeftAlt, down); - down = HIBYTE(::GetKeyState(VK_RMENU)) != 0; keys.set(GHOST_kModifierKeyRightAlt, down); - down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0; + + down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0; keys.set(GHOST_kModifierKeyLeftControl, down); - down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0; keys.set(GHOST_kModifierKeyRightControl, down); + bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; if(lwindown || rwindown) @@ -365,7 +369,7 @@ GHOST_TSuccess GHOST_SystemWin32::init() wc.hbrBackground= (HBRUSH)::GetStockObject(BLACK_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName= GHOST_WindowWin32::getWindowClassName(); - + // Use RegisterClassEx for setting small icon if (::RegisterClass(&wc) == 0) { success = GHOST_kFailure; @@ -381,14 +385,14 @@ GHOST_TSuccess GHOST_SystemWin32::exit() } -GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const +GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const { + bool isExtended = (lParam&(1<<24))?true:false; + GHOST_TKey key; GHOST_ModifierKeys oldModifiers, newModifiers; ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers); ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers); - - bool isExtended = (lParam&(1<<24))?true:false; if ((wParam >= '0') && (wParam <= '9')) { // VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) @@ -474,6 +478,16 @@ GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const break; case VK_MENU: { + if(m_hasAltGr && isExtended) { + // We have here an extended RAlt, which is AltGr. The keyboard driver on Windows sends before this a LControl, so + // to be able to input characters created with AltGr (normal on German, French, Finnish and other keyboards) we + // push an extra LControl up event. This ensures we don't have a 'hanging' ctrl event in Blender windowmanager + // when typing in Text editor or Console. + GHOST_Event *extra = new GHOST_EventKey(getSystem()->getMilliSeconds(), GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl, '\0'); + ((GHOST_SystemWin32*)getSystem())->pushEvent(extra); + newModifiers.set(GHOST_kModifierKeyRightControl, false); + newModifiers.set(GHOST_kModifierKeyLeftControl, false); + } bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftAlt) != newModifiers.get(GHOST_kModifierKeyLeftAlt); if(lchanged) { key = GHOST_kKeyLeftAlt; @@ -494,6 +508,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const break; } } + ((GHOST_SystemWin32*)getSystem())->storeModifierKeys(newModifiers); return key; } @@ -573,7 +588,7 @@ GHOST_EventWheel* GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WP GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, bool keyDown, WPARAM wParam, LPARAM lParam) { - GHOST_TKey key = ((GHOST_SystemWin32*)getSystem())->convertKey(wParam, lParam); + GHOST_TKey key = ((GHOST_SystemWin32*)getSystem())->convertKey(window, wParam, lParam); GHOST_EventKey* event; if (key != GHOST_kKeyUnknown) { MSG keyMsg; @@ -582,6 +597,7 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, bool k /* Eat any character related messages */ if (::PeekMessage(&keyMsg, NULL, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE)) { ascii = (char) keyMsg.wParam; + } event = new GHOST_EventKey(getSystem()->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii); @@ -630,6 +646,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, GHOST_WindowWin32* window = (GHOST_WindowWin32*)::GetWindowLong(hwnd, GWL_USERDATA); if (window) { switch (msg) { + // we need to check if new key layout has altgr + case WM_INPUTLANGCHANGE: + system->keyboardAltGr(); + break; //////////////////////////////////////////////////////////////////////// // Keyboard events, processed //////////////////////////////////////////////////////////////////////// diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 03f5349a606..3cd1deefda0 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -239,7 +239,7 @@ protected: * @param lParam The lParam from the wndproc * @return The GHOST key (GHOST_kKeyUnknown if no match). */ - virtual GHOST_TKey convertKey(WPARAM wParam, LPARAM lParam) const; + virtual GHOST_TKey convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const; /** * Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys). @@ -310,6 +310,11 @@ protected: * @param keys The new state of the modifier keys. */ inline virtual void storeModifierKeys(const GHOST_ModifierKeys& keys); + + /** + * Check current key layout for AltGr + */ + inline virtual void keyboardAltGr(); /** * Windows call back routine for our window class. @@ -324,6 +329,8 @@ protected: __int64 m_freq; /** High frequency timer variable. */ __int64 m_start; + /** AltGr on current keyboard layout. */ + bool m_hasAltGr; }; inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const @@ -336,5 +343,22 @@ inline void GHOST_SystemWin32::storeModifierKeys(const GHOST_ModifierKeys& keys) m_modifierKeys = keys; } +inline void GHOST_SystemWin32::keyboardAltGr() +{ + HKL keylayout = GetKeyboardLayout(0); // get keylayout for current thread + int i; + SHORT s; + for(m_hasAltGr = false, i = 32; i < 256; ++i) { + s = VkKeyScanEx((char)i, keylayout); + // s == -1 means no key that translates passed char code + // high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed + // if both are pressed, we have AltGr keycombo on keylayout + if(s!=-1 && (s & 0x600) == 0x600) { + m_hasAltGr = true; + break; + } + } +} + #endif // _GHOST_SYSTEM_WIN32_H_ -- cgit v1.2.3 From ac03fbe4c9d836f7dffaf230a4019371b6f5874d Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 15:53:01 +0000 Subject: Adapt OSX code for IMB_allocImBuf param changes. --- intern/ghost/intern/GHOST_SystemCocoa.mm | 2 +- source/blender/quicktime/apple/qtkit_import.m | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 97cfcf1006c..80356c19c9b 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1163,7 +1163,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType NSEnumerator *enumerator; NSImageRep *representation; - ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect); if (!ibuf) { [droppedImg release]; return GHOST_kFailure; diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m index 41c4e0cc5a3..f067d717a7c 100644 --- a/source/blender/quicktime/apple/qtkit_import.m +++ b/source/blender/quicktime/apple/qtkit_import.m @@ -149,7 +149,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height) NSEnumerator *enumerator; NSImageRep *representation; - ibuf = IMB_allocImBuf (width, height, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (width, height, 32, IB_rect); if (!ibuf) { if(QTIME_DEBUG) printf("quicktime_import: could not allocate memory for the " \ "image.\n"); @@ -359,7 +359,7 @@ int startquicktime (struct anim *anim) return -1; } - anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0); + anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect); qtTimeDuration = [[anim->qtime->media attributeForKey:QTMediaDurationAttribute] QTTimeValue]; anim->qtime->durationTime = qtTimeDuration.timeValue; @@ -450,7 +450,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) [bitmapImage setSize:bitmapSize]; /* allocate the image buffer */ - ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0, 0); + ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0); if (!ibuf) { fprintf(stderr, "imb_cocoaLoadImage: could not allocate memory for the " \ -- cgit v1.2.3 From d170a959d20fda4d694919c9ffadc29cd211a323 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 16 Oct 2010 17:26:40 +0000 Subject: Add System Info function to the Help menu. Users can use this to quickly get info about their system for bug reports. --- release/scripts/modules/sys_info.py | 103 ++++++++++++++++++++++++++++++++++++ release/scripts/op/wm.py | 9 ++++ release/scripts/ui/space_info.py | 1 + 3 files changed, 113 insertions(+) create mode 100644 release/scripts/modules/sys_info.py diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py new file mode 100644 index 00000000000..b6f429141bf --- /dev/null +++ b/release/scripts/modules/sys_info.py @@ -0,0 +1,103 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +# classes for extracting info from blenders internal classes + +import bpy +import bgl + +import sys + +def cutPoint(text, length): + "Returns position of the last space found before 'length' chars" + l = length + c = text[l] + while c != ' ': + l -= 1 + if l == 0: return length # no space found + c = text[l] + return l + +def textWrap(text, length = 70): + lines = [] + while len(text) > 70: + cpt = cutPoint(text, length) + line, text = text[:cpt], text[cpt + 1:] + lines.append(line) + lines.append(text) + return lines + +def write_sysinfo(op): + output_filename = "system-info.txt" + warnings = 0 + notices = 0 + + if output_filename in bpy.data.texts.keys(): + output = bpy.data.texts[output_filename] + output.clear() + else: + output = bpy.data.texts.new(name=output_filename) + + header = '= Blender {} System Information =\n'.format(bpy.app.version_string) + lilies = '{}\n\n'.format(len(header)*'=') + firstlilies = '{}\n'.format(len(header)*'=') + output.write(firstlilies) + output.write(header) + output.write(lilies) + + # build info + output.write('\nBlender:\n') + output.write(lilies) + output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type)) + output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time)) + output.write('platform: {}\n'.format(bpy.app.build_platform)) + output.write('binary path: {}\n\n'.format(bpy.app.binary_path)) + + # python info + output.write('\nPython:\n') + output.write(lilies) + output.write('version: {}\n'.format(sys.version)) + output.write('paths:\n') + for p in sys.path: + output.write('\t{}\n'.format(p)) + + output.write('\nDirectories:\n') + output.write(lilies) + output.write('scripts: {}\n'.format(bpy.utils.script_paths())) + output.write('user scripts: {}\n'.format(bpy.utils.user_script_path())) + output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES'))) + output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG'))) + output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS'))) + output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE'))) + output.write('tempdir: {}\n'.format(bpy.app.tempdir)) + + output.write('\nOpenGL\n') + output.write(lilies) + output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER))) + output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR))) + output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION))) + output.write('extensions:\n') + + glext = bgl.glGetString(bgl.GL_EXTENSIONS) + glext = textWrap(glext, 70) + for l in glext: + output.write('\t\t{}\n'.format(l)) + + op.report({'INFO'}, "System information generated in 'system-info.txt'") diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index 60a963804a6..4ce10233a9b 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -779,6 +779,15 @@ class WM_OT_keyconfig_activate(bpy.types.Operator): bpy.utils.keyconfig_set(self.filepath) return {'FINISHED'} +class WM_OT_sysinfo(bpy.types.Operator): + '''Generate System Info''' + bl_idname = "wm.sysinfo" + bl_label = "System Info" + + def execute(self, context): + import sys_info + sys_info.write_sysinfo(self) + return {'FINISHED'} def register(): pass diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 7b3ea18fcf9..b0e8dbab0b3 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -345,6 +345,7 @@ class INFO_MT_help(bpy.types.Menu): layout.separator() layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version) layout.operator("help.operator_cheat_sheet", icon='TEXT') + layout.operator("wm.sysinfo", icon='TEXT') layout.separator() layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP') layout.separator() -- cgit v1.2.3 From 3b6564a821e8797942132ad30f93af810952237a Mon Sep 17 00:00:00 2001 From: Elia Sarti Date: Sat, 16 Oct 2010 17:28:52 +0000 Subject: Fix for [#24292] When rendering with the stamp feature the scene opt. affects the seq. strip placement Fixed typo. --- source/blender/blenkernel/intern/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d750300291b..8ba7cde519d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1161,7 +1161,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i } if (stamp_data.strip[0]) { - BLF_width_and_height(mono, stamp_data.scene, &w, &h); h= h_fixed; + BLF_width_and_height(mono, stamp_data.strip, &w, &h); h= h_fixed; /* Top right corner, with an extra space because blenfont is too strict! */ x= width - w - pad; -- cgit v1.2.3 From 7415c967ff5905efbd8b89fe466cf6c4cb79e8f1 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sat, 16 Oct 2010 19:29:48 +0000 Subject: This fixes HDV render presets: * according to wikipedia HDV1080p 24p has a framerate of 24/1.001 * HDV comes in NTSC in PAL versions, too (30/1.001 and 25/1) --- release/scripts/presets/render/HDV_1080p.py | 2 +- release/scripts/presets/render/HDV_NTSC_1080p.py | 8 ++++++++ release/scripts/presets/render/HDV_PAL_1080p.py | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 release/scripts/presets/render/HDV_NTSC_1080p.py create mode 100644 release/scripts/presets/render/HDV_PAL_1080p.py diff --git a/release/scripts/presets/render/HDV_1080p.py b/release/scripts/presets/render/HDV_1080p.py index 7637648e53a..3ba32135c1d 100644 --- a/release/scripts/presets/render/HDV_1080p.py +++ b/release/scripts/presets/render/HDV_1080p.py @@ -5,4 +5,4 @@ bpy.context.scene.render.resolution_percentage = 100 bpy.context.scene.render.pixel_aspect_x = 4 bpy.context.scene.render.pixel_aspect_y = 3 bpy.context.scene.render.fps = 24 -bpy.context.scene.render.fps_base = 1 +bpy.context.scene.render.fps_base = 1.001 diff --git a/release/scripts/presets/render/HDV_NTSC_1080p.py b/release/scripts/presets/render/HDV_NTSC_1080p.py new file mode 100644 index 00000000000..2dfa1e0fd1e --- /dev/null +++ b/release/scripts/presets/render/HDV_NTSC_1080p.py @@ -0,0 +1,8 @@ +import bpy +bpy.context.scene.render.resolution_x = 1440 +bpy.context.scene.render.resolution_y = 1080 +bpy.context.scene.render.resolution_percentage = 100 +bpy.context.scene.render.pixel_aspect_x = 4 +bpy.context.scene.render.pixel_aspect_y = 3 +bpy.context.scene.render.fps = 30 +bpy.context.scene.render.fps_base = 1.001 diff --git a/release/scripts/presets/render/HDV_PAL_1080p.py b/release/scripts/presets/render/HDV_PAL_1080p.py new file mode 100644 index 00000000000..d8b1c707607 --- /dev/null +++ b/release/scripts/presets/render/HDV_PAL_1080p.py @@ -0,0 +1,8 @@ +import bpy +bpy.context.scene.render.resolution_x = 1440 +bpy.context.scene.render.resolution_y = 1080 +bpy.context.scene.render.resolution_percentage = 100 +bpy.context.scene.render.pixel_aspect_x = 4 +bpy.context.scene.render.pixel_aspect_y = 3 +bpy.context.scene.render.fps = 25 +bpy.context.scene.render.fps_base = 1 -- cgit v1.2.3 From 28e144db920699a13e6cd196ac91f13e11b2877c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 16 Oct 2010 20:43:16 +0000 Subject: Fix #24139: Edge loop + Multi-Resolution modifier results weird artifacts - mdisp_corners used to return incorrect number of verts in some cases - fixed memory corruption when face changed vertex count in edit mode (forgot displacement for such faces atm, could be changed in the future) --- source/blender/blenkernel/intern/customdata.c | 34 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index f4db8e953f9..58cd08f1c4c 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -442,8 +442,15 @@ static void mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, fl static int mdisp_corners(MDisps *s) { - /* silly trick because we don't get it from callback */ - return (s->totdisp % (3*3) == 0)? 3: 4; + int lvl= 13; + + while(lvl > 0) { + int side = (1 << (lvl-1)) + 1; + if ((s->totdisp % (side*side)) == 0) return s->totdisp / (side*side); + lvl--; + } + + return 0; } static void layerSwap_mdisps(void *data, const int *ci) @@ -452,19 +459,28 @@ static void layerSwap_mdisps(void *data, const int *ci) float (*d)[3] = NULL; int corners, cornersize, S; - /* this function is untested .. */ if(s->disps) { - corners = mdisp_corners(s); - cornersize = s->totdisp/corners; + int nverts= (ci[1] == 3) ? 4 : 3; /* silly way to know vertex count of face */ + corners= mdisp_corners(s); + cornersize= s->totdisp/corners; + + if(corners!=nverts) { + /* happens when face changed vertex count in edit mode + if it happened, just forgot displacement */ - d = MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap"); + MEM_freeN(s->disps); + s->disps= NULL; + s->totdisp= 0; /* flag to update totdisp */ + return; + } + + d= MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap"); for(S = 0; S < corners; S++) memcpy(d + cornersize*S, s->disps + cornersize*ci[S], cornersize*3*sizeof(float)); - if(s->disps) - MEM_freeN(s->disps); - s->disps = d; + MEM_freeN(s->disps); + s->disps= d; } } -- cgit v1.2.3 From 30b79ddcc6e2737add3a7ebd49b167c1776e4087 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Oct 2010 06:38:56 +0000 Subject: - fixed remaining unused warnings. - omit render code from this warning (cmake only), until render branch is merged. - moved -Wunused-parameter warning to apply to all C code in blender (not just ./source/blender), (cmake only). --- CMakeLists.txt | 8 +++- source/blender/CMakeLists.txt | 5 --- source/blender/avi/intern/avirgb.c | 4 ++ source/blender/avi/intern/mjpeg.c | 9 ++++- source/blender/avi/intern/options.c | 2 + source/blender/avi/intern/rgb32.c | 4 ++ source/blender/blenkernel/intern/BME_tools.c | 14 +++---- source/blender/blenkernel/intern/CCGSubSurf.c | 19 +++++++--- source/blender/blenkernel/intern/DerivedMesh.c | 2 + source/blender/blenkernel/intern/boids.c | 6 +-- source/blender/blenkernel/intern/customdata.c | 16 ++++---- source/blender/blenkernel/intern/implicit.c | 6 +-- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/particle.c | 6 +-- source/blender/blenkernel/intern/seqeffects.c | 14 +++---- source/blender/blenkernel/intern/softbody.c | 22 +++++------ source/blender/blenkernel/intern/sound.c | 2 + source/blender/blenkernel/intern/subsurf_ccg.c | 8 ++-- source/blender/editors/animation/keyframes_edit.c | 34 ++++++++--------- source/blender/editors/armature/meshlaplacian.c | 10 ++--- source/blender/editors/armature/reeb.c | 10 ++--- source/blender/editors/mesh/mesh_data.c | 1 - source/blender/editors/physics/particle_edit.c | 10 ++--- source/blender/editors/physics/physics_fluid.c | 2 +- source/blender/editors/sculpt_paint/paint_undo.c | 1 + source/blender/editors/sculpt_paint/sculpt.c | 8 ++++ source/blender/imbuf/intern/anim.c | 9 +++-- source/blender/imbuf/intern/bmp.c | 4 ++ source/blender/imbuf/intern/cineon/cineon_dpx.c | 2 + source/blender/imbuf/intern/cineon/cineonlib.c | 4 ++ source/blender/imbuf/intern/cineon/dpxlib.c | 9 ++++- source/blender/imbuf/intern/filetype.c | 2 +- source/blender/imbuf/intern/iris.c | 6 ++- source/blender/imbuf/intern/jp2.c | 2 + source/blender/imbuf/intern/jpeg.c | 2 + .../blender/imbuf/intern/openexr/openexr_multi.h | 23 ++++++----- source/blender/imbuf/intern/radiance_hdr.c | 2 + source/blender/imbuf/intern/targa.c | 2 + source/blender/modifiers/intern/MOD_shapekey.c | 2 + source/blender/render/CMakeLists.txt | 3 ++ source/blender/render/intern/source/pipeline.c | 4 +- source/blender/render/intern/source/pointdensity.c | 2 +- source/blender/render/intern/source/volumetric.c | 2 +- source/blenderplayer/bad_level_call_stubs/stubs.c | 1 + source/creator/creator.c | 44 +++++++++++----------- .../GamePlayer/common/GPC_RenderTools.cpp | 3 +- 46 files changed, 214 insertions(+), 139 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 287fa50d70a..53ee69bd3e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,7 +318,7 @@ IF(UNIX AND NOT APPLE) SET(PLATFORM_LINKFLAGS "-pthread") # Better warnings - # note: -Wunused-parameter should be added but for now only apply to ./source/blender + # note: -Wunused-parameter is added below for all GCC compilers SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas") SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare") @@ -920,6 +920,12 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) #----------------------------------------------------------------------------- # Extra compile flags + +# TODO: remove this and uncommend the global arg, but for now adding here keeps it managable +IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") +ENDIF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}") diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index 83f76e38fd3..7f4ed753956 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -24,11 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -# TODO: remove this and uncommend the global arg, but for now adding here keeps it managable -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") -ENDIF(CMAKE_COMPILER_IS_GNUCC) - ADD_SUBDIRECTORY(editors) ADD_SUBDIRECTORY(windowmanager) ADD_SUBDIRECTORY(blenkernel) diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c index f7acbf238b5..c7d411b2fc6 100644 --- a/source/blender/avi/intern/avirgb.c +++ b/source/blender/avi/intern/avirgb.c @@ -51,6 +51,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu unsigned char *buf; AviBitmapInfoHeader *bi; short bits= 32; + + (void)size; /* unused */ bi= (AviBitmapInfoHeader *) movie->streams[stream].sf; if (bi) bits= bi->BitCount; @@ -120,6 +122,8 @@ void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buff int y, x, i, rowstride; unsigned char *buf; + (void)stream; /* unused */ + *size= movie->header->Height * movie->header->Width * 3; if (movie->header->Width%2) *size+= movie->header->Height; diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c index 56ba352dcf8..e8c96476fd1 100644 --- a/source/blender/avi/intern/mjpeg.c +++ b/source/blender/avi/intern/mjpeg.c @@ -144,6 +144,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign unsigned int y; struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jerr; + + (void)width; /* unused */ numbytes= 0; @@ -324,7 +326,9 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) { int deint; unsigned char *buf; - + + (void)stream; /* unused */ + buf= MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 1"); deint= check_and_decode_jpeg(buffer, buf, movie->header->Width, movie->header->Height, *size); @@ -374,10 +378,11 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer /* Compression from memory */ static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) { - ; + (void)cinfo; /* unused */ } static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) { + (void)cinfo; /* unused */ return TRUE; } diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index 15ec40ade8c..bec7060e118 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -41,6 +41,8 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { int i; + (void)stream; /* unused */ + if (movie->header->TotalFrames != 0) /* Can't change params after we have already started writing frames */ return AVI_ERROR_OPTION; diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c index 68e3ce4d1d2..f66f57924df 100644 --- a/source/blender/avi/intern/rgb32.c +++ b/source/blender/avi/intern/rgb32.c @@ -41,6 +41,8 @@ void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buff int y, x, rowstridea, rowstrideb; unsigned char *buf; + (void)stream; /* unused */ + buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromrgb32buf"); *size = movie->header->Height * movie->header->Width * 3; @@ -65,6 +67,8 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer unsigned char *buf; unsigned char *to, *from; + (void)stream; /* unused */ + buf= MEM_mallocN (movie->header->Height * movie->header->Width * 4, "torgb32buf"); *size= movie->header->Height * movie->header->Width * 4; diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index e5a355e5f24..444bc10d562 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -107,7 +107,7 @@ float *BME_new_transdata_float(BME_TransData_Head *td) { return BLI_memarena_alloc(td->ma, sizeof(float)); } -static int BME_is_nonmanifold_vert(BME_Mesh *bm, BME_Vert *v) { +static int BME_is_nonmanifold_vert(BME_Mesh *UNUSED(bm), BME_Vert *v) { BME_Edge *e, *oe; BME_Loop *l; int len, count, flag; @@ -217,7 +217,7 @@ static void BME_data_interp_from_verts(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, #endif -static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Vert *v, BME_Edge *e1, float fac){ +static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *UNUSED(v2), BME_Vert *v, BME_Edge *e1, float fac){ void *src[2]; float w[2]; BME_Loop *l=NULL, *v1loop = NULL, *vloop = NULL, *v2loop = NULL; @@ -356,7 +356,7 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa * vec2 is the direction of projection (pointing away from vec1) * up_vec is used for orientation (expected to be normalized) * returns the length of the projected vector that lies along vec1 */ -static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *td) { +static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td)) { float factor, vec3[3], tmp[3],c1,c2; cross_v3_v3v3(tmp,vec1,vec2); @@ -582,7 +582,7 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran return max; } -static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int options, BME_TransData_Head *td) { +static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int UNUSED(options), BME_TransData_Head *td) { BME_Vert *ov1, *ov2, *v1, *v2; ov1 = BME_edge_getothervert(v->edge, v); @@ -607,7 +607,7 @@ static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, return v1; } -static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int options, float *up_vec, BME_TransData_Head *td) { +static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) { BME_Vert *v1, *v2, *kv; BME_Loop *kl=NULL, *nl; BME_Edge *e; @@ -708,7 +708,7 @@ static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int opti return l; } -static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int options, float *up_vec, BME_TransData_Head *td) { +static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) { BME_Vert *v1, *v2; BME_Poly *f; @@ -859,7 +859,7 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert } } -static float BME_bevel_get_angle(BME_Mesh *bm, BME_Edge *e, BME_Vert *v) { +static float BME_bevel_get_angle(BME_Mesh *UNUSED(bm), BME_Edge *e, BME_Vert *v) { BME_Vert *v1, *v2; BME_Loop *l1, *l2; float vec1[3], vec2[3], vec3[3], vec4[3]; diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index bbd68fb797b..1cd5ae381c4 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -15,6 +15,13 @@ #define CCG_INLINE inline #endif +/* copied from BKE_utildefines.h ugh */ +#ifdef __GNUC__ +# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) +#else +# define UNUSED(x) x +#endif + /* used for normalize_v3 in BLI_math_vector * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */ #define EPSILON (1.0e-35f) @@ -185,13 +192,13 @@ static int _ehashIterator_isStopped(EHashIterator *ehi) { /***/ -static void *_stdAllocator_alloc(CCGAllocatorHDL a, int numBytes) { +static void *_stdAllocator_alloc(CCGAllocatorHDL UNUSED(a), int numBytes) { return malloc(numBytes); } -static void *_stdAllocator_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) { +static void *_stdAllocator_realloc(CCGAllocatorHDL UNUSED(a), void *ptr, int newSize, int UNUSED(oldSize)) { return realloc(ptr, newSize); } -static void _stdAllocator_free(CCGAllocatorHDL a, void *ptr) { +static void _stdAllocator_free(CCGAllocatorHDL UNUSED(a), void *ptr) { free(ptr); } @@ -2601,7 +2608,7 @@ float ccgSubSurf_getEdgeCrease(CCGEdge *e) { /* Face accessors */ -CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *ss, CCGFace *f) { +CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *UNUSED(ss), CCGFace *f) { return f->fHDL; } int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f) { @@ -2619,14 +2626,14 @@ void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f) { int ccgSubSurf_getFaceNumVerts(CCGFace *f) { return f->numVerts; } -CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *ss, CCGFace *f, int index) { +CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) { if (index<0 || index>=f->numVerts) { return NULL; } else { return FACE_getVerts(f)[index]; } } -CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *ss, CCGFace *f, int index) { +CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) { if (index<0 || index>=f->numVerts) { return NULL; } else { diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index e70dde1474a..2e8922dec1b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -633,6 +633,8 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm; EditFace *efa; int i, draw; + + (void)setMaterial; /* unused */ if (emdm->vertexCos) { EditVert *eve; diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index cfe16e089cf..943cf20720e 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -58,7 +58,7 @@ typedef struct BoidValues { static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness); -static int rule_none(BoidRule *rule, BoidBrainData *UNUSED(data), BoidValues *val, ParticleData *pa) +static int rule_none(BoidRule *UNUSED(rule), BoidBrainData *UNUSED(data), BoidValues *UNUSED(val), ParticleData *UNUSED(pa)) { return 0; } @@ -344,7 +344,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * return ret; } -static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa) +static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *val, ParticleData *pa) { KDTreeNearest *ptn = NULL; ParticleTarget *pt; @@ -384,7 +384,7 @@ static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Pa } return ret; } -static int rule_flock(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa) +static int rule_flock(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *UNUSED(val), ParticleData *pa) { KDTreeNearest ptn[11]; float vec[3] = {0.0f, 0.0f, 0.0f}, loc[3] = {0.0f, 0.0f, 0.0f}; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 58cd08f1c4c..7f91df3b281 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -145,7 +145,7 @@ static void linklist_free_simple(void *link) } static void layerInterp_mdeformvert(void **sources, float *weights, - float *sub_weights, int count, void *dest) + float *UNUSED(sub_weights), int count, void *dest) { MDeformVert *dvert = dest; LinkNode *dest_dw = NULL; /* a list of lists of MDeformWeight pointers */ @@ -203,7 +203,7 @@ static void layerInterp_mdeformvert(void **sources, float *weights, static void layerInterp_msticky(void **sources, float *weights, - float *sub_weights, int count, void *dest) + float *UNUSED(sub_weights), int count, void *dest) { float co[2], w; MSticky *mst; @@ -484,8 +484,8 @@ static void layerSwap_mdisps(void *data, const int *ci) } } -static void layerInterp_mdisps(void **UNUSED(sources), float *weights, float *sub_weights, - int UNUSED(count), void *dest) +static void layerInterp_mdisps(void **UNUSED(sources), float *UNUSED(weights), + float *UNUSED(sub_weights), int UNUSED(count), void *dest) { MDisps *d = dest; int i; @@ -563,7 +563,7 @@ static void layerCopy_mdisps(const void *source, void *dest, int count) } } -static void layerFree_mdisps(void *data, int count, int size) +static void layerFree_mdisps(void *data, int count, int UNUSED(size)) { int i; MDisps *d = data; @@ -609,7 +609,7 @@ static int layerWrite_mdisps(CDataFile *cdf, void *data, int count) return 1; } -static size_t layerFilesize_mdisps(CDataFile *cdf, void *data, int count) +static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), void *data, int count) { MDisps *d = data; size_t size = 0; @@ -2349,7 +2349,7 @@ static void customdata_external_filename(char filename[FILE_MAX], ID *id, Custom BLI_path_abs(filename, path); } -void CustomData_external_reload(CustomData *data, ID *id, CustomDataMask mask, int totelem) +void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem) { CustomDataLayer *layer; const LayerTypeInfo *typeInfo; @@ -2519,7 +2519,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in cdf_free(cdf); } -void CustomData_external_add(CustomData *data, ID *id, int type, int UNUSED(totelem), const char *filename) +void CustomData_external_add(CustomData *data, ID *UNUSED(id), int type, int UNUSED(totelem), const char *filename) { CustomDataExternal *external= data->external; CustomDataLayer *layer; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 9baaf7e5abc..e0077ec7d26 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1218,7 +1218,7 @@ DO_INLINE void dfdx_damp(float to[3][3], float dir[3],float length,const float } -DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *lF, lfVector *X, lfVector *V, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float time) +DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *UNUSED(lF), lfVector *X, lfVector *V, fmatrix3x3 *UNUSED(dFdV), fmatrix3x3 *UNUSED(dFdX), float time) { Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; @@ -1353,7 +1353,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, } } -DO_INLINE void cloth_apply_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *lF, lfVector *X, lfVector *V, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX) +DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSpring *s, lfVector *lF, lfVector *UNUSED(X), lfVector *UNUSED(V), fmatrix3x3 *dFdV, fmatrix3x3 *dFdX) { if(s->flags & CLOTH_SPRING_FLAG_NEEDED) { @@ -1708,7 +1708,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec // printf("\n"); } -static void simulate_implicit_euler(lfVector *Vnew, lfVector *lX, lfVector *lV, lfVector *lF, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float dt, fmatrix3x3 *A, lfVector *B, lfVector *dV, fmatrix3x3 *S, lfVector *z, lfVector *olddV, fmatrix3x3 *P, fmatrix3x3 *Pinv, fmatrix3x3 *M, fmatrix3x3 *bigI) +static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVector *lV, lfVector *lF, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float dt, fmatrix3x3 *A, lfVector *B, lfVector *dV, fmatrix3x3 *S, lfVector *z, lfVector *olddV, fmatrix3x3 *UNUSED(P), fmatrix3x3 *UNUSED(Pinv), fmatrix3x3 *M, fmatrix3x3 *UNUSED(bigI)) { unsigned int numverts = dFdV[0].vcount; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 09ba967e265..67c3e746a63 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1585,7 +1585,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt) /* Baking Tools ------------------------------------------- */ -void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int UNUSED(flag)) +void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) { /* verify that data is valid diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f7345d6159a..624587338c9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1647,7 +1647,7 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float * return DMCACHE_NOTFOUND; } -static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, int *mapindex, float *mapfw) +static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float UNUSED(foffset), int *mapindex, float *mapfw) { if(index < 0) return 0; @@ -1803,7 +1803,7 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys) /* Particles on a shape */ /************************************************/ /* ready for future use */ -static void psys_particle_on_shape(int UNUSED(distr), int index, float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) +static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) { /* TODO */ float zerovec[3]={0.0f,0.0f,0.0f}; @@ -2185,7 +2185,7 @@ static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float VECADDFAC(state->co,state->co,mat[0],rough[0]); VECADDFAC(state->co,state->co,mat[1],rough[1]); } -static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float UNUSED(cfra), float *length, float *vec) +static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *UNUSED(rootco), float effector, float UNUSED(dfra), float UNUSED(cfra), float *length, float *vec) { float force[3] = {0.0f,0.0f,0.0f}; ParticleKey eff_key; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 7ce5dcc3884..6477c6b4f75 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -524,7 +524,7 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_alphaover_effect( - Main *bmain, Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -2633,7 +2633,7 @@ static void copy_glow_effect(Sequence *dst, Sequence *src) //void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use) static void do_glow_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, char *rect1, - char *rect2, char *out) + char *UNUSED(rect2), char *out) { unsigned char *outbuf=(unsigned char *)out; unsigned char *inbuf=(unsigned char *)rect1; @@ -2648,7 +2648,7 @@ static void do_glow_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), static void do_glow_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, - float *rect1, float *rect2, float *out) + float *rect1, float *UNUSED(rect2), float *out) { float *outbuf = out; float *inbuf = rect1; @@ -2822,8 +2822,8 @@ static struct ImBuf * do_multicam( Main *bmain, Scene *scene, Sequence *seq, float cfra, float UNUSED(facf0), float UNUSED(facf1), int x, int y, int preview_render_size, - struct ImBuf *ibuf1, struct ImBuf *ibuf2, - struct ImBuf *ibuf3) + struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2), + struct ImBuf *UNUSED(ibuf3)) { struct ImBuf * i; struct ImBuf * out; @@ -2914,7 +2914,7 @@ static int early_out_speed(struct Sequence *UNUSED(seq), } static void store_icu_yrange_speed(struct Sequence * seq, - short adrcode, float * ymin, float * ymax) + short UNUSED(adrcode), float * ymin, float * ymax) { SpeedControlVars * v = (SpeedControlVars *)seq->effectdata; @@ -3091,7 +3091,7 @@ static int early_out_mul_input2(struct Sequence *UNUSED(seq), } static void store_icu_yrange_noop(struct Sequence * UNUSED(seq), - short adrcode, float * ymin, float * ymax) + short UNUSED(adrcode), float *UNUSED(ymin), float *UNUSED(ymax)) { /* defaults are fine */ } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 58aa171e97b..978b3c9864f 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -678,7 +678,7 @@ static void add_mesh_quad_diag_springs(Object *ob) } } -static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int addsprings) +static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counter, int addsprings) { /*assume we have a softbody*/ SoftBody *sb= ob->soft; /* is supposed to be there */ @@ -1029,7 +1029,7 @@ static int query_external_colliders(Scene *scene, Object *me) /* +++ the aabb "force" section*/ -static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float UNUSED(time)) +static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int UNUSED(par_layer),struct Object *vertexowner,float UNUSED(time)) { Object *ob; SoftBody *sb=vertexowner->soft; @@ -1094,7 +1094,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye /* +++ the face external section*/ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner,float time) + float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time) { Object *ob; GHash *hash; @@ -1192,7 +1192,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner,float time) + float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time) { Object *ob; GHash *hash; @@ -1418,7 +1418,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow) /* +++ the spring external section*/ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner,float time) + float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time) { Object *ob; GHash *hash; @@ -1659,7 +1659,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) return 0; } -static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *ptr_to_break_func()) +static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func())) { ListBase *do_effector = NULL; ListBase threads; @@ -1749,7 +1749,7 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner, + float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner, float time,float vel[3], float *intrusion) { Object *ob= NULL; @@ -2084,7 +2084,7 @@ static void dfdv_goal(int ia, int ic,float factor) for(i=0;i<3;i++) nlMatrixAdd(ia+i,ic+i,factor); } */ -static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags) +static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UNUSED(forcetime), int nl_flags) { SoftBody *sb= ob->soft; /* is supposed to be there */ BodyPoint *bp1,*bp2; @@ -2175,7 +2175,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo /* since this is definitely the most CPU consuming task here .. try to spread it */ /* core function _softbody_calc_forces_slice_in_a_thread */ /* result is int to be able to flag user break */ -static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *ptr_to_break_func(),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func()),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { float iks; int bb,do_selfcollision,do_springcollision,do_aero; @@ -2386,7 +2386,7 @@ static void *exec_softbody_calc_forces(void *data) return 0; } -static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *ptr_to_break_func(),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func()),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { ListBase threads; SB_thread_context *sb_threads; @@ -2444,7 +2444,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t MEM_freeN(sb_threads); } -static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow, int nl_flags) +static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow, int UNUSED(nl_flags)) { /* rule we never alter free variables :bp->vec bp->pos in here ! * this will ruin adaptive stepsize AKA heun! (BM) diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index ca1fd80b406..b2e5209a4fc 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -110,6 +110,8 @@ void sound_init(struct Main *bmain) #ifdef WITH_JACK AUD_setSyncCallback(sound_sync_callback, bmain); +#else + (void)bmain; /* unused */ #endif } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 6323e1e3c79..26bd981db4a 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -83,13 +83,13 @@ static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSiz } return p2; } -static void arena_free(CCGAllocatorHDL a, void *ptr) { +static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr)) { } static void arena_release(CCGAllocatorHDL a) { BLI_memarena_free(a); } -static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int useFlatSubdiv) { +static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int UNUSED(useFlatSubdiv)) { CCGMeshIFC ifc; CCGSubSurf *ccgSS; @@ -1146,7 +1146,7 @@ static void ccgDM_drawVerts(DerivedMesh *dm) { ccgFaceIterator_free(fi); glEnd(); } -static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges) { +static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); @@ -1514,7 +1514,7 @@ static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *a dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL); } -static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2) { +static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 590d609ce02..0958b4870b5 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -541,7 +541,7 @@ static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt) return ok; } -static short ok_bezier_selected(KeyframeEditData *ked, BezTriple *bezt) +static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* this macro checks all beztriple handles for selection... * only one of the verts has to be selected for this to be ok... @@ -677,7 +677,7 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt) /* Transform */ /* snaps the keyframe to the nearest frame */ -static short snap_bezier_nearest(KeyframeEditData *ked, BezTriple *bezt) +static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5)); @@ -713,7 +713,7 @@ static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt) } /* make the handles have the same value as the key */ -static short snap_bezier_horizontal(KeyframeEditData *ked, BezTriple *bezt) +static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) { bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1]; @@ -768,7 +768,7 @@ static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt) +static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { float diff; @@ -780,7 +780,7 @@ static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short mirror_bezier_xaxis(KeyframeEditData *ked, BezTriple *bezt) +static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { float diff; @@ -841,7 +841,7 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type) /* Settings */ /* Sets the selected bezier handles to type 'auto' */ -static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */ @@ -859,7 +859,7 @@ static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt) } /* Sets the selected bezier handles to type 'vector' */ -static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { if (bezt->f1 & SELECT) bezt->h1= HD_VECT; @@ -879,7 +879,7 @@ static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt) /* Queries if the handle should be set to 'free' or 'align' */ // NOTE: this was used for the 'toggle free/align' option // currently this isn't used, but may be restored later -static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt) +static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if ((bezt->f1 & SELECT) && (bezt->h1)) return 1; if ((bezt->f3 & SELECT) && (bezt->h2)) return 1; @@ -887,7 +887,7 @@ static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt) } /* Sets selected bezier handles to type 'align' */ -static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f1 & SELECT) bezt->h1= HD_ALIGN; if (bezt->f3 & SELECT) bezt->h2= HD_ALIGN; @@ -895,7 +895,7 @@ static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt) } /* Sets selected bezier handles to type 'free' */ -static short set_bezier_free(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f1 & SELECT) bezt->h1= HD_FREE; if (bezt->f3 & SELECT) bezt->h2= HD_FREE; @@ -925,21 +925,21 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code) /* ------- */ -static short set_bezt_constant(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_CONST; return 0; } -static short set_bezt_linear(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_LIN; return 0; } -static short set_bezt_bezier(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_BEZ; @@ -962,21 +962,21 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code) /* ------- */ -static short set_keytype_keyframe(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME; return 0; } -static short set_keytype_breakdown(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN; return 0; } -static short set_keytype_extreme(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_EXTREME; @@ -1038,7 +1038,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short select_bezier_invert(KeyframeEditData *ked, BezTriple *bezt) +static short select_bezier_invert(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* Invert the selection for the whole bezier triple */ bezt->f2 ^= SELECT; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 10627f95aa7..f193defc129 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -61,7 +61,7 @@ /* ************* XXX *************** */ -static void waitcursor(int val) {} +static void waitcursor(int UNUSED(val)) {} static void progress_bar(int UNUSED(dummy_val), const char *UNUSED(dummy)) {} static void start_progress_bar() {} static void end_progress_bar() {} @@ -398,7 +398,7 @@ typedef struct BVHCallbackUserData { LaplacianSystem *sys; } BVHCallbackUserData; -static void bvh_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) +static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) { BVHCallbackUserData *data = (struct BVHCallbackUserData*)userdata; MFace *mf = data->sys->heat.mface + index; @@ -1401,7 +1401,7 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb) MEM_freeN(stack); } -static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, int cagevert) +static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect *isect, int cagevert) { int a; @@ -1412,7 +1412,7 @@ static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, return 0.0f; } -static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *vec, int cagevert) +static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNUSED(vec), int UNUSED(cagevert)) { float dvec[3], ivec[3], wx, wy, wz, result=0.0f; float weight, totweight= 0.0f; @@ -1563,7 +1563,7 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int } } -static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int cagevert) +static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int UNUSED(cagevert)) { float phi, totweight; int i, a, acenter; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 32362afca2b..5af1658a83f 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -442,7 +442,7 @@ void flipArc(ReebArc *arc) } #ifdef DEBUG_REEB_NODE -void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node) +void NodeDegreeDecrement(ReebGraph *UNUSED(rg), ReebNode *node) { node->degree--; @@ -452,7 +452,7 @@ void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node) // } } -void NodeDegreeIncrement(ReebGraph *rg, ReebNode *node) +void NodeDegreeIncrement(ReebGraph *UNUSED(rg), ReebNode *node) { // if (node->degree == 0) // { @@ -523,7 +523,7 @@ void verifyNodeDegree(ReebGraph *rg) #endif } -void verifyBucketsArc(ReebGraph *rg, ReebArc *arc) +void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc) { ReebNode *head = (ReebNode*)arc->head; ReebNode *tail = (ReebNode*)arc->tail; @@ -1723,7 +1723,7 @@ int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold)) return filtered; } -int filterSmartReebGraph(ReebGraph *rg, float UNUSED(threshold)) +int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) { int value = 0; #if 0 //XXX @@ -2180,7 +2180,7 @@ void addFacetoArc(ReebArc *arc, EditFace *efa) BLI_ghash_insert(arc->faces, efa, efa); } -void mergeArcFaces(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc) +void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc) { GHashIterator ghi; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 03f2bb42b51..080151a8dca 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -288,7 +288,6 @@ static int layers_poll(bContext *C) static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 796314ba2e3..57867fdc441 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1125,7 +1125,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit) } } } -static void update_velocities(Object *ob, PTCacheEdit *edit) +static void update_velocities(PTCacheEdit *edit) { /*TODO: get frs_sec properly */ float vec1[3], vec2[3], frs_sec, dfra; @@ -1208,7 +1208,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag) if(edit->psys) update_world_cos(ob, edit); if(pset->flag & PE_AUTO_VELOCITY) - update_velocities(ob, edit); + update_velocities(edit); PE_hide_keys_time(scene, edit, CFRA); /* regenerate path caches */ @@ -1243,7 +1243,7 @@ static void select_key(PEData *data, int point_index, int key_index) point->flag |= PEP_EDIT_RECALC; } -static void select_keys(PEData *data, int point_index, int key_index) +static void select_keys(PEData *data, int point_index, int UNUSED(key_index)) { PTCacheEdit *edit = data->edit; PTCacheEditPoint *point = edit->points + point_index; @@ -3034,7 +3034,7 @@ static void brush_puff(PEData *data, int point_index) } -static void brush_weight(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key)) { /* roots have full weight allways */ if(key_index) { @@ -3048,7 +3048,7 @@ static void brush_weight(PEData *data, float UNUSED(mat[][4]), float imat[][4], } } -static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key) { if(key_index) { float dvec[3]; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index e4934269173..6dc4684d815 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -342,7 +342,7 @@ static void free_all_fluidobject_channels(ListBase *fobjects) } } -static void fluid_init_all_channels(bContext *C, Object *fsDomain, FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) +static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) { Scene *scene = CTX_data_scene(C); Base *base; diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index c21bbadc242..643e2cd6915 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -31,6 +31,7 @@ #include "BLI_listbase.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index a3252ca7621..505e37d95f6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -867,6 +867,8 @@ static void calc_area_normal(Sculpt *sd, SculptSession *ss, float an[3], PBVHNod float out_flip[3] = {0.0f, 0.0f, 0.0f}; + (void)sd; /* unused w/o openmp */ + zero_v3(an); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -1667,6 +1669,8 @@ static void calc_flatten_center(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, float count = 0; + (void)sd; /* unused w/o openmp */ + zero_v3(fc); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -1721,6 +1725,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, SculptSession *ss, P // fc float count = 0; + (void)sd; /* unused w/o openmp */ + // an zero_v3(an); @@ -2536,6 +2542,8 @@ static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss) calculate multiple modifications to the mesh when symmetry is enabled. */ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather)) { + (void)sd; /* unused */ + flip_coord(cache->location, cache->true_location, symm); flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm); flip_coord(cache->view_normal, cache->true_view_normal, symm); diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c index 57d65bc6761..8df0d69bcfa 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim.c @@ -63,6 +63,7 @@ #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_depsgraph.h" @@ -214,14 +215,14 @@ int ismovie(char *name) { #else -int ismovie(char *name) { +int ismovie(char *UNUSED(name)) { return 0; } /* never called, just keep the linker happy */ -static int startmovie(struct anim * anim) { return 1; } -static ImBuf * movie_fetchibuf(struct anim * anim, int position) { return NULL; } -static void free_anim_movie(struct anim * anim) { ; } +static int startmovie(struct anim *UNUSED(anim)) { return 1; } +static ImBuf * movie_fetchibuf(struct anim *UNUSED(anim), int UNUSED(position)) { return NULL; } +static void free_anim_movie(struct anim *UNUSED(anim)) { ; } #endif diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 4c7cf669d18..10dc23b1ad2 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -108,6 +108,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) int x, y, depth, skip, i; unsigned char *bmp, *rect; unsigned short col; + + (void)size; /* unused */ if (checkbmp(mem) == 0) return(0); @@ -199,6 +201,8 @@ int imb_savebmp(struct ImBuf *ibuf, char *name, int flags) { int bytesize, extrabytes, x, y, t, ptr; uchar *data; FILE *ofile; + + (void)flags; /* unused */ extrabytes = (4 - ibuf->x*3 % 4) % 4; bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y; diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 0eee1bd082a..7a5a3fb011b 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -125,6 +125,8 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f int i, j; int index; float *fline; + + (void)flags; /* unused */ cineon_conversion_parameters(&conversion); diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 9c9156a4dd9..a2a0fae526d 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -185,6 +185,8 @@ dumpCineonImageInfo(CineonImageInformation* imageInfo) { static void fillCineonFormatInfo(CineonFile* cineon, CineonFormatInformation* formatInfo) { + (void)cineon; /* unused */ + formatInfo->interleave = 0; formatInfo->packing = 5; formatInfo->signage = 0; @@ -238,6 +240,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) { static void fillCineonOriginationInfo(CineonFile* cineon, CineonOriginationInformation* originInfo, CineonFileInformation* fileInfo) { + + (void)cineon; /* unused */ originInfo->x_offset = htonl(0); originInfo->y_offset = htonl(0); diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index 365d56939ed..ade69b4d7c0 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -39,6 +39,8 @@ static void fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) { + (void)dpx; /* unused */ + chan->signage = 0; chan->ref_low_data = htonl(0); chan->ref_low_quantity = htonf(0.0); @@ -160,7 +162,12 @@ dumpDpxImageInfo(DpxImageInformation* imageInfo) { static void fillDpxOriginationInfo( - DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo) { + DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo) +{ + /* unused */ + (void)dpx; + (void)originInfo; + (void)fileInfo; } static void diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index fb5d2f2e4d7..0702fbe3907 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -45,7 +45,7 @@ static int imb_ftype_default(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftyp #if defined(__APPLE__) && defined(IMBUF_COCOA) static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & TIF); } #endif -static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype == IMAGIC); } +static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { (void)type; return (ibuf->ftype == IMAGIC); } #ifdef WITH_QUICKTIME static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf) { return 0; } // XXX #endif diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 9037285a1c5..71ba9b06cad 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -123,7 +123,8 @@ static int file_offset; static unsigned short getshort(FILE *inf) { unsigned char * buf; - + (void)inf; /* unused */ + buf = file_data + file_offset; file_offset += 2; @@ -133,6 +134,7 @@ static unsigned short getshort(FILE *inf) static unsigned int getlong(FILE *inf) { unsigned char * buf; + (void)inf; /* unused */ buf = file_data + file_offset; file_offset += 4; @@ -258,6 +260,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) int bpp, rle, cur, badorder; ImBuf * ibuf; + (void)size; /* unused */ + if(!imb_is_a_iris(mem)) return NULL; /*printf("new iris\n");*/ diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 5e7ef199500..0403d0044f5 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -670,6 +670,8 @@ int imb_savejp2(struct ImBuf *ibuf, char *name, int flags) { opj_event_mgr_t event_mgr; /* event manager */ opj_image_t *image = NULL; + (void)flags; /* unused */ + /* configure the event callbacks (not required) setting of each callback is optionnal diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index e020a5fa8fd..e7737e68fce 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -132,6 +132,7 @@ typedef my_source_mgr * my_src_ptr; static void init_source(j_decompress_ptr cinfo) { + (void)cinfo; /* unused */ } @@ -165,6 +166,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) static void term_source(j_decompress_ptr cinfo) { + (void)cinfo; /* unused */ } static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t size) diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 3f80e5577a8..e96b52e121d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -67,24 +67,27 @@ void IMB_exr_close (void *handle); /* ugly... but we only use it on pipeline.c, render module, now */ void * IMB_exr_get_handle (void) {return NULL;} -void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) {} +void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } -int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) {return 0;} +int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;} void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; } -void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) {} +void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; } -void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) {} +void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } -void IMB_exr_read_channels (void *handle) {} -void IMB_exr_write_channels (void *handle) {} -void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) {} -void IMB_exrtile_clear_channels (void *handle) {} +void IMB_exr_read_channels (void *handle) { (void)handle; } +void IMB_exr_write_channels (void *handle) { (void)handle; } +void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) { (void)handle; (void)partx; (void)party; (void)level; } +void IMB_exrtile_clear_channels (void *handle) { (void)handle; } void IMB_exr_multilayer_convert (void *handle, void *base, void * (*addlayer)(void *base, char *str), - void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) {} + void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) + { + (void)handle; (void)base; (void)addlayer; (void)addpass; + } -void IMB_exr_close (void *handle) {} +void IMB_exr_close (void *handle) { (void)handle; } #endif diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 385124cd717..b356f56ab74 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -340,6 +340,8 @@ int imb_savehdr(struct ImBuf *ibuf, char *name, int flags) int y, width=ibuf->x, height=ibuf->y; unsigned char *cp= NULL; + (void)flags; /* unused */ + if (file==NULL) return 0; writeHeader(file, width, height); diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index e50e445034e..89a69242a46 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -238,6 +238,8 @@ int imb_savetarga(struct ImBuf * ibuf, char *name, int flags) char buf[20]; FILE *fildes; short ok = 0; + + (void)flags; /* unused */ if (ibuf == 0) return (0); if (ibuf->rect == 0) return (0); diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index ff2f7c5e3b7..a43e19a5fc1 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -85,6 +85,8 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, KeyBlock *kb= ob_get_keyblock(ob); float scale[3][3]; int a; + + (void)vertexCos; /* unused */ if(kb && kb->totelem==numVerts && kb!=key->refkey) { scale_m3_fl(scale, kb->curval); diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 8e0dbb457e8..e6478098dad 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# remove warning until render branch merged. +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + FILE(GLOB SRC intern/source/*.c intern/raytrace/*.cpp) SET(INC diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index ed390fe102a..a2f08d96251 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -861,7 +861,7 @@ static void *ml_addlayer_cb(void *base, char *str) BLI_strncpy(rl->name, str, EXR_LAY_MAXNAME); return rl; } -static void ml_addpass_cb(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id) +static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect, int totchan, char *chan_id) { RenderLayer *rl= lay; RenderPass *rpass= MEM_callocN(sizeof(RenderPass), "loaded pass"); @@ -2677,7 +2677,7 @@ static int is_rendering_allowed(Render *re) return 1; } -static void update_physics_cache(Render *re, Scene *scene, int anim_init) +static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init)) { PTCacheBaker baker; diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 1ca1ea10273..d8156594085 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -253,7 +253,7 @@ static void cache_pointdensity(Render *re, Tex *tex) } } -static void free_pointdensity(Render *re, Tex *tex) +static void free_pointdensity(Render *UNUSED(re), Tex *tex) { PointDensity *pd = tex->pd; diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index d15ea0c792c..f3f31bf6b43 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -358,7 +358,7 @@ void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) /* phase function - determines in which directions the light * is scattered in the volume relative to incoming direction * and view direction */ -float vol_get_phasefunc(ShadeInput *shi, float g, float *w, float *wp) +float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) { const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 7bcbe0db341..5fa09cebf29 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -42,6 +42,7 @@ struct CSG_FaceIteratorDescriptor; struct CSG_VertexIteratorDescriptor; struct ColorBand; struct CurveMapping; +struct Curve; struct EditBone; struct EditFace; struct EditMesh; diff --git a/source/creator/creator.c b/source/creator/creator.c index 70c9fae0427..912ae9f3d90 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -138,7 +138,7 @@ static void setCallbacks(void); /* set breakpoints here when running in debug mode, useful to catch floating point errors */ #if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE -static void fpe_handler(int sig) +static void fpe_handler(int UNUSED(sig)) { // printf("SIGFPE trapped\n"); } @@ -175,7 +175,7 @@ static void strip_quotes(char *str) } #endif -static int print_version(int argc, char **argv, void *data) +static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { printf (BLEND_VERSION_STRING_FMT); #ifdef BUILD_DATE @@ -190,7 +190,7 @@ static int print_version(int argc, char **argv, void *data) return 0; } -static int print_help(int argc, char **argv, void *data) +static int print_help(int UNUSED(argc), char **UNUSED(argv), void *data) { bArgs *ba = (bArgs*)data; @@ -317,30 +317,30 @@ double PIL_check_seconds_timer(void); } }*/ -static int end_arguments(int argc, char **argv, void *data) +static int end_arguments(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { return -1; } -static int enable_python(int argc, char **argv, void *data) +static int enable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { G.f |= G_SCRIPT_AUTOEXEC; return 0; } -static int disable_python(int argc, char **argv, void *data) +static int disable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { G.f &= ~G_SCRIPT_AUTOEXEC; return 0; } -static int background_mode(int argc, char **argv, void *data) +static int background_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { G.background = 1; return 0; } -static int debug_mode(int argc, char **argv, void *data) +static int debug_mode(int UNUSED(argc), char **UNUSED(argv), void *data) { G.f |= G_DEBUG; /* std output printf's */ printf(BLEND_VERSION_STRING_FMT); @@ -354,7 +354,7 @@ static int debug_mode(int argc, char **argv, void *data) return 0; } -static int set_fpe(int argc, char **argv, void *data) +static int set_fpe(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { #if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE /* zealous but makes float issues a heck of a lot easier to find! @@ -379,7 +379,7 @@ static int set_fpe(int argc, char **argv, void *data) return 0; } -static int playback_mode(int argc, char **argv, void *data) +static int playback_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { /* not if -b was given first */ if (G.background == 0) { @@ -391,7 +391,7 @@ static int playback_mode(int argc, char **argv, void *data) return -2; } -static int prefsize(int argc, char **argv, void *data) +static int prefsize(int argc, char **argv, void *UNUSED(data)) { int stax, stay, sizx, sizy; @@ -410,19 +410,19 @@ static int prefsize(int argc, char **argv, void *data) return 4; } -static int with_borders(int argc, char **argv, void *data) +static int with_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { WM_setinitialstate_normal(); return 0; } -static int without_borders(int argc, char **argv, void *data) +static int without_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { WM_setinitialstate_fullscreen(); return 0; } -static int register_extension(int argc, char **argv, void *data) +static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { #ifdef WIN32 char *path = BLI_argsArgv(data)[0]; @@ -432,7 +432,7 @@ static int register_extension(int argc, char **argv, void *data) return 0; } -static int no_joystick(int argc, char **argv, void *data) +static int no_joystick(int UNUSED(argc), char **UNUSED(argv), void *data) { SYS_SystemHandle *syshandle = data; @@ -446,19 +446,19 @@ static int no_joystick(int argc, char **argv, void *data) return 0; } -static int no_glsl(int argc, char **argv, void *data) +static int no_glsl(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { GPU_extensions_disable(); return 0; } -static int no_audio(int argc, char **argv, void *data) +static int no_audio(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { sound_force_device(0); return 0; } -static int set_audio(int argc, char **argv, void *data) +static int set_audio(int argc, char **argv, void *UNUSED(data)) { if (argc < 1) { printf("-setaudio require one argument\n"); @@ -583,7 +583,7 @@ static int set_image_type(int argc, char **argv, void *data) } } -static int set_threads(int argc, char **argv, void *data) +static int set_threads(int argc, char **argv, void *UNUSED(data)) { if (argc >= 1) { if(G.background) { @@ -714,7 +714,7 @@ static int render_frame(int argc, char **argv, void *data) } } -static int render_animation(int argc, char **argv, void *data) +static int render_animation(int UNUSED(argc), char **UNUSED(argv), void *data) { bContext *C = data; if (CTX_data_scene(C)) { @@ -848,7 +848,7 @@ static int run_python(int argc, char **argv, void *data) #endif /* DISABLE_PYTHON */ } -static int run_python_console(int argc, char **argv, void *data) +static int run_python_console(int UNUSED(argc), char **argv, void *data) { #ifndef DISABLE_PYTHON bContext *C = data; @@ -863,7 +863,7 @@ static int run_python_console(int argc, char **argv, void *data) #endif /* DISABLE_PYTHON */ } -static int load_file(int argc, char **argv, void *data) +static int load_file(int UNUSED(argc), char **argv, void *data) { bContext *C = data; diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index e02b5fedaf0..a985decabe4 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -284,8 +284,9 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, int width, int height) { + /* STR_String tmpstr(text); - char* s = tmpstr.Ptr(); + char* s = tmpstr.Ptr(); */ // Save and change OpenGL settings int texture2D; -- cgit v1.2.3 From 952b728578bc0ecea22b3659067775102c0eea55 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Oct 2010 08:04:28 +0000 Subject: Test stricter GCC compiler settings, these warnings will now give errors. - implicit function declaration. - no return type set for a function. - declaration after statement. This may be too strict but in general I prefer we don't allow commits with these warnings. Applies to cmake/gcc and scons/linux. --- CMakeLists.txt | 4 +--- build_files/scons/config/linux2-config.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53ee69bd3e8..6ed3cd788b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -920,10 +920,8 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) #----------------------------------------------------------------------------- # Extra compile flags - -# TODO: remove this and uncommend the global arg, but for now adding here keeps it managable IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") + SET(C_WARNINGS "${C_WARNINGS} -Wunused-parameter -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type") ENDIF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}") diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index f3e0085125a..fd42e61da0c 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -204,7 +204,7 @@ REL_CCFLAGS = ['-O2'] ##ARFLAGS = ruv ##ARFLAGSQUIET = ru ## -C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter'] +C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type'] CC_WARN = ['-Wall'] CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare'] -- cgit v1.2.3 From 7d10ad012d9307cc9db0f91111a14376790f1536 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Oct 2010 08:59:23 +0000 Subject: fix for bad use of UNUSED() with win32 & some other minor error checks. --- source/blender/editors/interface/interface_widgets.c | 7 +++++++ source/blender/render/intern/source/texture.c | 2 +- source/creator/creator.c | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 7e15f9b1f74..ed7284bf264 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "DNA_screen_types.h" @@ -1773,6 +1774,12 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) VECCOPY(col1[1], col1[2]); VECCOPY(col1[3], col1[2]); break; + default: + assert(!"invalid 'type' argument"); + hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]); + VECCOPY(col1[0], col1[2]); + VECCOPY(col1[1], col1[2]); + VECCOPY(col1[3], col1[2]); } /* old below */ diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index be2c83a7edf..cdac27f352a 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -771,7 +771,7 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex if (pit->version < 6) { texres->tin = pit->result[0]; } else { - texres->tin = result[0]; + texres->tin = result[0]; /* XXX, assigning garbage value, fixme! */ } if(rgbnor & TEX_NOR) { diff --git a/source/creator/creator.c b/source/creator/creator.c index 912ae9f3d90..26835eb28da 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -422,11 +422,13 @@ static int without_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(d return 0; } -static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) +static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *data) { #ifdef WIN32 char *path = BLI_argsArgv(data)[0]; RegisterBlendExtension(path); +#else + (void)data; /* unused */ #endif return 0; -- cgit v1.2.3 From 856389eac7705b857ba50f0c3e3ee9d08639177e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Oct 2010 09:01:12 +0000 Subject: re-arrange icon_draw_rect, also use an assert() for odd icon sizes. this can happen in some cases but hard to find when. --- source/blender/editors/interface/interface_icons.c | 58 ++++++++-------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 6d1a72fcd1a..39e062a13aa 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifndef WIN32 #include @@ -845,6 +846,15 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview) { + ImBuf *ima= NULL; + + /* sanity check */ + if(w<=0 || h<=0 || w>2000 || h>2000) { + printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h); + assert(!"invalid icon size"); + return; + } + /* modulate color */ if(alpha != 1.0f) glPixelTransferf(GL_ALPHA_SCALE, alpha); @@ -861,45 +871,21 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), } /* draw */ - if((w<1 || h<1)) { - // XXX - TODO 2.5 verify whether this case can happen - if (G.f & G_DEBUG) - printf("what the heck! - icons are %i x %i pixels?\n", w, h); - } - /* rect contains image in 'rendersize', we only scale if needed */ - else if(rw!=w && rh!=h) { - if(w>2000 || h>2000) { /* something has gone wrong! */ - if (G.f & G_DEBUG) - printf("insane icon size w=%d h=%d\n",w,h); - } - else { - ImBuf *ima; - /* first allocate imbuf for scaling and copy preview into it */ - ima = IMB_allocImBuf(rw, rh, 32, IB_rect); - memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); - - /* scale it */ - IMB_scaleImBuf(ima, w, h); + /* rect contains image in 'rendersize', we only scale if needed */ + if(rw!=w && rh!=h) { + /* first allocate imbuf for scaling and copy preview into it */ + ima = IMB_allocImBuf(rw, rh, 32, IB_rect); + memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); + IMB_scaleImBuf(ima, w, h); /* scale it */ + rect= ima->rect; + } - if(is_preview) { - glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); - } - else { - glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); - } + if(is_preview) glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + else glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); - IMB_freeImBuf(ima); - } - } - else { - if(is_preview) { - glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); - } - else { - glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); - } - } + if(ima) + IMB_freeImBuf(ima); /* restore color */ if(alpha != 0.0f) -- cgit v1.2.3 From d6d1f3cb68f59566fbfa0f23ccaaa4b84a073247 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 17 Oct 2010 09:01:37 +0000 Subject: Reverting Cam's audio code changes from revision 32517. Part of it has been reverted by Nathan already. Cam: next time please check, why a parameter is unused before you remove it! --- source/blender/blenkernel/BKE_sound.h | 2 +- source/blender/blenkernel/intern/packedFile.c | 2 +- source/blender/blenkernel/intern/sound.c | 9 +++++---- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/sound/sound_ops.c | 2 +- source/blender/makesrna/intern/rna_sound.c | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 09cea572deb..190b0400aff 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -62,7 +62,7 @@ void sound_cache(struct bSound* sound, int ignore); void sound_delete_cache(struct bSound* sound); -void sound_load(struct bSound* sound); +void sound_load(struct Main *main, struct bSound* sound); void sound_free(struct bSound* sound); diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 78340288836..5bbb3506a78 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -486,7 +486,7 @@ int unpackSound(ReportList *reports, bSound *sound, int how) freePackedFile(sound->packedfile); sound->packedfile = 0; - sound_load(sound); + sound_load(NULL, sound); ret_value = RET_OK; } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index b2e5209a4fc..5c3047942f7 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -143,7 +143,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename) BLI_strncpy(sound->name, filename, FILE_MAX); // XXX unused currently sound->type = SOUND_TYPE_FILE; - sound_load(sound); + sound_load(bmain, sound); if(!sound->playback_handle) { @@ -169,7 +169,7 @@ struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source) sound->child_sound = source; sound->type = SOUND_TYPE_BUFFER; - sound_load(sound); + sound_load(CTX_data_main(C), sound); if(!sound->playback_handle) { @@ -195,7 +195,7 @@ struct bSound* sound_new_limiter(struct bContext *C, struct bSound *source, floa sound->end = end; sound->type = SOUND_TYPE_LIMITER; - sound_load(sound); + sound_load(CTX_data_main(C), sound); if(!sound->playback_handle) { @@ -236,7 +236,7 @@ void sound_delete_cache(struct bSound* sound) } } -void sound_load(struct bSound* sound) +void sound_load(struct Main *UNUSED(bmain), struct bSound* sound) { if(sound) { @@ -266,6 +266,7 @@ void sound_load(struct bSound* sound) if(sound->id.lib) path = sound->id.lib->filepath; else + // XXX this should be fixed! path = /*bmain ? bmain->name :*/ G.sce; BLI_path_abs(fullpath, path); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7c8c7eb6e5d..ebd407e7e21 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5308,7 +5308,7 @@ static void lib_link_sound(FileData *fd, Main *main) sound->id.flag -= LIB_NEEDLINK; sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system - sound_load(sound); + sound_load(main, sound); if(sound->cache) sound_cache(sound, 1); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 2be3a51869b..18f35502f8b 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -180,7 +180,7 @@ static int pack_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; sound->packedfile= newPackedFile(op->reports, sound->name); - sound_load(sound); + sound_load(CTX_data_main(C), sound); return OPERATOR_FINISHED; } diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 0c217837226..674fbbad9c6 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -38,7 +38,7 @@ static void rna_Sound_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_load((bSound*)ptr->data); + sound_load(bmain, (bSound*)ptr->data); } static int rna_Sound_caching_get(PointerRNA *ptr) -- cgit v1.2.3 From 6f1783470e249c60b8a96956f2f0ed564efaf107 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 17 Oct 2010 10:46:06 +0000 Subject: Partial fix for #22409: Locked axis + auto IK = bad The "root" bone in an Auto-IK chain was never added properly if it didn't have a parent that it was connected to. This meant that if it had axis-locking (using transform locks), these would not get converted to temporary IK-locks. This also affects 2.49 The second part of the bug report though, is something more ingrained in the IK-solver internals (numeric error, which means that even locked axes aren't exactly untouched). --- .../editors/transform/transform_conversions.c | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 22b83ee4c89..5de08d7832c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -446,16 +446,21 @@ static short apply_targetless_ik(Object *ob) /* apply and decompose, doesn't work for constraints or non-uniform scale well */ { float rmat3[3][3], qrmat[3][3], imat[3][3], smat[3][3]; - + copy_m3_m4(rmat3, rmat); /* rotation */ - if (parchan->rotmode > 0) - mat3_to_eulO( parchan->eul, parchan->rotmode,rmat3); + /* [#22409] is partially caused by this, as slight numeric error introduced during + * the solving process leads to locked-axis values changing. However, we cannot modify + * the values here, or else there are huge discreptancies between IK-solver (interactive) + * and applied poses. + */ + if (parchan->rotmode > 0) + mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3); else if (parchan->rotmode == ROT_MODE_AXISANGLE) - mat3_to_axis_angle( parchan->rotAxis, &pchan->rotAngle,rmat3); + mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle,rmat3); else - mat3_to_quat( parchan->quat,rmat3); + mat3_to_quat(parchan->quat,rmat3); /* for size, remove rotation */ /* causes problems with some constraints (so apply only if needed) */ @@ -840,9 +845,9 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO; VECCOPY(data->grabtarget, pchan->pose_tail); data->rootbone= 1; - - /* we include only a connected chain */ - while ((pchan) && (pchan->bone->flag & BONE_CONNECTED)) { + + /* we only include bones that are part of a continual connected chain */ + while (pchan) { /* here, we set ik-settings for bone from pchan->protectflag */ if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP; if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP; @@ -850,7 +855,12 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) /* now we count this pchan as being included */ data->rootbone++; - pchan= pchan->parent; + + /* continue to parent, but only if we're connected to it */ + if (pchan->bone->flag & BONE_CONNECTED) + pchan = pchan->parent; + else + pchan = NULL; } /* make a copy of maximum chain-length */ -- cgit v1.2.3 From 013ffe904176c113a7642aed95b4b691f213d042 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 17 Oct 2010 11:20:12 +0000 Subject: Bugfix #24296: AutoIK interactive chain length adjustment feature is missing In 2.49, you could adjust the maximum length of Auto-IK Chains by using scrollwheel up/down or page up/down while moving Auto-IK bones. Now this is possible again with those hotkeys, but you need to hold SHIFT to get this to work, otherwise we get a conflict with the hotkeys for proportional edit nowadays. Was broken when transform tools switched from using hardcoded key mappings to using a modal keymap. --- intern/iksolver/intern/IK_Solver.cpp | 1 + source/blender/editors/transform/transform.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp index 1add6f638cf..beb82f08ed4 100644 --- a/intern/iksolver/intern/IK_Solver.cpp +++ b/intern/iksolver/intern/IK_Solver.cpp @@ -45,6 +45,7 @@ public: std::list tasks; }; +// FIXME: locks still result in small "residual" changes to the locked axes... IK_QSegment *CreateSegment(int flag, bool translate) { int ndof = 0; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4a95d0ec081..ae0bce176c1 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -481,6 +481,8 @@ static void view_editmove(unsigned short UNUSED(event)) * */ #define TFM_MODAL_PROPSIZE_UP 20 #define TFM_MODAL_PROPSIZE_DOWN 21 +#define TFM_MODAL_AUTOIK_LEN_INC 22 +#define TFM_MODAL_AUTOIK_LEN_DEC 23 /* called in transform_ops.c, on each regeneration of keymaps */ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) @@ -507,6 +509,8 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""}, {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""}, {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""}, + {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""}, + {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map"); @@ -541,7 +545,12 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN); WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP); WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN); - + + WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); + WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); + WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); + WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); + return keymap; } @@ -735,6 +744,16 @@ int transformEvent(TransInfo *t, wmEvent *event) } t->redraw |= TREDRAW_HARD; break; + case TFM_MODAL_AUTOIK_LEN_INC: + if (t->flag & T_AUTOIK) + transform_autoik_update(t, 1); + t->redraw |= TREDRAW_HARD; + break; + case TFM_MODAL_AUTOIK_LEN_DEC: + if (t->flag & T_AUTOIK) + transform_autoik_update(t, -1); + t->redraw |= TREDRAW_HARD; + break; default: handled = 0; break; -- cgit v1.2.3 From 0069c521042766a75c6e5fefce9b4a7a1f0e8142 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 17 Oct 2010 11:21:53 +0000 Subject: Disabling menu entry for adding "Python" F-Modifier. This hasn't been coded yet, and I don't think I'll be adding it very soon yet, so disabling to avoid further confusion over this. --- source/blender/makesrna/intern/rna_fcurve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 31ba51a9b04..23f37f8db8e 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -53,7 +53,7 @@ EnumPropertyItem fmodifier_type_items[] = { {FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", ""}, {FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", ""}, {FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""}, - {FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, + //{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, // FIXME: not implemented yet! {FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""}, {FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation", ""}, {0, NULL, 0, NULL, NULL}}; -- cgit v1.2.3 From fec7585190187ba6c8509620b83addfcaa225be0 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 17 Oct 2010 18:56:36 +0000 Subject: Fix [#24294] IMB_allocImBuf changes in r32517 missed a couple of files Reported and patched by Shane Ambler --- source/blender/imbuf/intern/imbuf_cocoa.m | 2 +- source/blender/quicktime/apple/quicktime_export.c | 4 ++-- source/blender/quicktime/apple/quicktime_import.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m index 02c90c5bd09..9b627612d2a 100644 --- a/source/blender/imbuf/intern/imbuf_cocoa.m +++ b/source/blender/imbuf/intern/imbuf_cocoa.m @@ -93,7 +93,7 @@ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags) [bitmapImage setSize:bitmapSize]; /* allocate the image buffer */ - ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0, 0); + ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0); if (!ibuf) { fprintf(stderr, "imb_cocoaLoadImage: could not allocate memory for the " \ diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index c1291fc6949..9664a5b16f8 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -379,8 +379,8 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame, int rectx, i SCTemporalSettings gTemporalSettings; OSErr err = noErr; - qtexport->ibuf = IMB_allocImBuf (rectx, recty, 32, IB_rect, 0); - qtexport->ibuf2 = IMB_allocImBuf (rectx, recty, 32, IB_rect, 0); + qtexport->ibuf = IMB_allocImBuf (rectx, recty, 32, IB_rect); + qtexport->ibuf2 = IMB_allocImBuf (rectx, recty, 32, IB_rect); err = NewGWorldFromPtr( &qtexport->theGWorld, k32ARGBPixelFormat, diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index f9793f04b88..699b2c4f6e3 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -335,7 +335,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position) return (NULL); } - ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect); rect = ibuf->rect; SetMovieTimeValue(anim->qtime->movie, anim->qtime->frameIndex[position]); @@ -496,7 +496,7 @@ int startquicktime (struct anim *anim) return -1; } - anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0); + anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect); #ifdef _WIN32 err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld, @@ -676,7 +676,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) depth = (**desc).depth; if (flags & IB_test) { - ibuf = IMB_allocImBuf(x, y, depth, 0, 0); + ibuf = IMB_allocImBuf(x, y, depth, 0); ibuf->ftype = QUICKTIME; DisposeHandle((Handle)dataref); if (gImporter != NULL) CloseComponent(gImporter); @@ -684,8 +684,8 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) } #ifdef __APPLE__ - ibuf = IMB_allocImBuf (x, y, 32, IB_rect, 0); - wbuf = IMB_allocImBuf (x, y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (x, y, 32, IB_rect); + wbuf = IMB_allocImBuf (x, y, 32, IB_rect); err = NewGWorldFromPtr(&offGWorld, k32ARGBPixelFormat, @@ -693,7 +693,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) (unsigned char *)wbuf->rect, x * 4); #else - ibuf = IMB_allocImBuf (x, y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (x, y, 32, IB_rect); err = NewGWorldFromPtr(&offGWorld, k32RGBAPixelFormat, -- cgit v1.2.3 From c1e1551ef148623c236048deeb30dc826c7ee0c3 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 17 Oct 2010 23:08:05 +0000 Subject: Fix [#24288] Mesh Grid pointing towards the floor when first created Reported by Terry Wallwork --- source/blender/editors/mesh/editmesh_add.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index a33d64cad29..525867d74c0 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1053,15 +1053,13 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se /* one segment first: the X axis */ phi = (2*dia)/(float)(tot-1); phid = (2*dia)/(float)(seg-1); - for(a=0;a=0;a--) { vec[0] = (phi*a) - dia; vec[1]= - dia; vec[2]= 0.0f; eve= addvertlist(em, vec, NULL); eve->f= 1+2+4; - if (a) { - addedgelist(em, eve->prev, eve, NULL); - } + addedgelist(em, eve->prev, eve, NULL); } /* extrude and translate */ vec[0]= vec[2]= 0.0; -- cgit v1.2.3 From c7c128f03b1a5bd95946ef5b2d1f9e46abd76ce7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Oct 2010 23:32:48 +0000 Subject: remove LCMS option from cmake, this is only testing code. developers who want to work on it can uncomment. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ed3cd788b6..9580d24be14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,6 @@ GET_BLENDER_VERSION() # Blender internal features OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON) -OPTION(WITH_LCMS "Enable color correction with lcms" OFF) OPTION(WITH_PYTHON "Enable Embedded Python API" ON) OPTION(WITH_BUILDINFO "Include extra build details" ON) OPTION(WITH_FLUID "Enable Elbeem (Fluid Simulation)" ON) @@ -126,6 +125,8 @@ IF(APPLE) OPTION(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF) ENDIF(APPLE) +# only for developers who want to make this functional +# OPTION(WITH_LCMS "Enable color correction with lcms" OFF) IF(NOT WITH_GAMEENGINE AND WITH_PLAYER) MESSAGE(FATAL_ERROR "WITH_PLAYER needs WITH_GAMEENGINE") -- cgit v1.2.3 From 433f871f0f6bc68fbb1fffbdac42ef1bb8b5d019 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 00:25:32 +0000 Subject: bugfix [#24302] Ctrl+Click Extrude gets old mouse events double click didnt check mouse distance moved so you could click twice in different areas of the screen very fast and generate a double click event which had old mouse coords copied into it but was sent to an operator set to run on single click (because the double click wasnt handled). Also added MEM_name_ptr function (included in debug mode only), prints the name of allocated memory. used for debugging where events came from. --- intern/guardedalloc/MEM_guardedalloc.h | 4 ++++ intern/guardedalloc/intern/mallocn.c | 14 ++++++++++++++ source/blender/editors/interface/interface_icons.c | 17 ++++++++--------- source/blender/editors/mesh/editmesh_add.c | 6 +----- .../blender/windowmanager/intern/wm_event_system.c | 21 +++++++++++++++++---- source/blender/windowmanager/wm_event_system.h | 1 - 6 files changed, 44 insertions(+), 19 deletions(-) diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 6b78b0b6bdc..dfb8b2db1b1 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -150,6 +150,10 @@ extern "C" { /*get the peak memory usage in bytes, including mmap allocations*/ uintptr_t MEM_get_peak_memory(void); +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh); +#endif + #ifdef __cplusplus } #endif diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 09f2d33a674..b213a1c3744 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -856,4 +856,18 @@ int MEM_get_memory_blocks_in_use(void) return _totblock; } +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh) +{ + if (vmemh) { + MemHead *memh= vmemh; + memh--; + return memh->name; + } + else { + return "MEM_name_ptr(NULL)"; + } +} +#endif + /* eof */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 39e062a13aa..0ade3e6199f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -864,13 +864,6 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), glPixelTransferf(GL_GREEN_SCALE, rgb[1]); glPixelTransferf(GL_BLUE_SCALE, rgb[2]); } - - if(is_preview == 0) { - /* position */ - glRasterPos2f(x,y); - } - - /* draw */ /* rect contains image in 'rendersize', we only scale if needed */ if(rw!=w && rh!=h) { @@ -881,8 +874,14 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), rect= ima->rect; } - if(is_preview) glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); - else glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + /* draw */ + if(is_preview) { + glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + else { + glRasterPos2f(x, y); + glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } if(ima) IMB_freeImBuf(ima); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 525867d74c0..89991015419 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -114,13 +114,9 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) float min[3], max[3]; int done= 0; short use_proj; - wmWindow *win= CTX_wm_window(C); - +printf("%d\n", event->val); em_setup_viewcontext(C, &vc); - printf("\n%d %d\n", event->x, event->y); - printf("%d %d\n", win->eventstate->x, win->eventstate->y); - use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index f2b880bd0d5..47ca4314cc7 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1452,11 +1452,24 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) wmWindow *win = CTX_wm_window(C); if (win && win->eventstate->prevtype == event->type && win->eventstate->prevval == KM_PRESS) { - /* test for double click first */ - if ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) { + /* test for double click first, + * note1: this can be problematic because single click operators can get the + * double click event but then with old mouse coords which is highly confusing, + * so check for mouse moves too. + * note2: the first click event will be handled but still used to create a + * double click event if clicking again quickly. + * If no double click events are found itwill fallback to a single click. + * So a double click event can result in 2 successive single click calls + * if its not handled by the keymap - campbell */ + if ( (ABS(event->x - win->eventstate->prevclickx)) <= 2 && + (ABS(event->y - win->eventstate->prevclicky)) <= 2 && + ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) + ) { event->val = KM_DBL_CLICK; - event->x = win->eventstate->prevclickx; - event->y = win->eventstate->prevclicky; + /* removed this because in cases where we're this is used as a single click + * event, this will give old coords, since the distance is checked above, using new coords should be ok. */ + // event->x = win->eventstate->prevclickx; + // event->y = win->eventstate->prevclicky; action |= wm_handlers_do(C, event, handlers); } diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index 8fd650fb184..4888f9aced3 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -84,7 +84,6 @@ enum { /* wm_event_system.c */ -void wm_event_add (wmWindow *win, wmEvent *event_to_add); void wm_event_free_all (wmWindow *win); void wm_event_free (wmEvent *event); void wm_event_free_handler (wmEventHandler *handler); -- cgit v1.2.3 From 05a105cac1b7733996a99e0fb074b3575620ccb5 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 00:42:18 +0000 Subject: Add short comment. --- intern/ghost/intern/GHOST_SystemWin32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 1f1fc65adc4..da333ce4f08 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -144,6 +144,7 @@ GHOST_SystemWin32::GHOST_SystemWin32() GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n"); m_displayManager->initialize(); + // Check if current keyboard layout uses AltGr this->keyboardAltGr(); // Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32. @@ -646,7 +647,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, GHOST_WindowWin32* window = (GHOST_WindowWin32*)::GetWindowLong(hwnd, GWL_USERDATA); if (window) { switch (msg) { - // we need to check if new key layout has altgr + // we need to check if new key layout has AltGr case WM_INPUTLANGCHANGE: system->keyboardAltGr(); break; -- cgit v1.2.3 From 03085d2caea837f17b6c330c8306ecff67888ac2 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 00:46:41 +0000 Subject: Fix [#24200] COLLADA Exporter: Aspect ratio is not exported Reported by Wenzel Jakob, patch [#24235] by Phil Gosch --- source/blender/collada/CameraExporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index c3a6cda8b3c..d5e2a7e116c 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -68,7 +68,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) if (cam->type == CAM_PERSP) { COLLADASW::PerspectiveOptic persp(mSW); persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI)); - persp.setAspectRatio(1.0); + persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch)); persp.setZFar(cam->clipend); persp.setZNear(cam->clipsta); COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name); @@ -77,7 +77,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) else { COLLADASW::OrthographicOptic ortho(mSW); ortho.setXMag(cam->ortho_scale); - ortho.setAspectRatio(1.0); + ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch)); ortho.setZFar(cam->clipend); ortho.setZNear(cam->clipsta); COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); -- cgit v1.2.3 From 7db9558cf6fc64545dcdb1c0291ec943a10600db Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 02:36:43 +0000 Subject: bugfix [#24291] Error parenting a child with any negative scaling coordinate the bug was in object_apply_mat4(), caused by applying a non-normalized matrix to the rotation. Blender 2.4x also had this problem, surprising nobody noticed!. --- source/blender/blenkernel/intern/object.c | 31 ++++++++++++++--------------- source/blender/blenlib/BLI_math_matrix.h | 2 ++ source/blender/blenlib/intern/math_matrix.c | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 17e488c8353..79030e3adfa 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1698,29 +1698,28 @@ void object_mat3_to_rot(Object *ob, float mat[][3], int use_compat) /* see pchan_apply_mat4() for the equivalent 'pchan' function */ void object_apply_mat4(Object *ob, float mat[][4]) { - float mat3[3][3], tmat[3][3], imat[3][3]; + float mat3[3][3]; /* obmat -> 3x3 */ + float mat3_n[3][3]; /* obmat -> normalized, 3x3 */ + float imat3_n[3][3]; /* obmat -> normalized & inverted, 3x3 */ /* location */ copy_v3_v3(ob->loc, mat[3]); /* rotation */ copy_m3_m4(mat3, mat); - object_mat3_to_rot(ob, mat3, 0); - + /* so scale doesnt interfear with rotation [#24291] */ + normalize_m3_m3(mat3_n, mat3); + + object_mat3_to_rot(ob, mat3_n, 0); + /* scale */ -#if 0 - /* works fine except for neg scales */ - mat4_to_size(ob->size, mat); -#else - /* this is more complicated but works for negative scales */ - object_rot_to_mat3(ob, tmat); - invert_m3_m3(imat, tmat); - mul_m3_m3m3(tmat, imat, mat3); - - ob->size[0]= tmat[0][0]; - ob->size[1]= tmat[1][1]; - ob->size[2]= tmat[2][2]; -#endif + /* note: mat4_to_size(ob->size, mat) fails for negative scale */ + invert_m3_m3(imat3_n, mat3_n); + mul_m3_m3m3(mat3, imat3_n, mat3); + + ob->size[0]= mat3[0][0]; + ob->size[1]= mat3[1][1]; + ob->size[2]= mat3[2][2]; } void object_to_mat3(Object *ob, float mat[][3]) /* no parent */ diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 77ebcb24975..294546bb222 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -102,7 +102,9 @@ void transpose_m3(float R[3][3]); void transpose_m4(float R[4][4]); void normalize_m3(float R[3][3]); +void normalize_m3_m3(float R[3][3], float A[3][3]); void normalize_m4(float R[4][4]); +void normalize_m4_m4(float R[4][4], float A[4][4]); void orthogonalize_m3(float R[3][3], int axis); void orthogonalize_m4(float R[4][4], int axis); diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 3b5ffa2d442..197d3676367 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -750,6 +750,14 @@ void normalize_m3(float mat[][3]) normalize_v3(mat[2]); } +void normalize_m3_m3(float rmat[][3], float mat[][3]) +{ + normalize_v3_v3(rmat[0], mat[0]); + normalize_v3_v3(rmat[1], mat[1]); + normalize_v3_v3(rmat[2], mat[2]); +} + + void normalize_m4(float mat[][4]) { float len; @@ -762,6 +770,18 @@ void normalize_m4(float mat[][4]) if(len!=0.0) mat[2][3]/= len; } +void normalize_m4_m4(float rmat[][4], float mat[][4]) +{ + float len; + + len= normalize_v3_v3(rmat[0], mat[0]); + if(len!=0.0) rmat[0][3]= mat[0][3] / len; + len= normalize_v3_v3(rmat[1], mat[1]); + if(len!=0.0) rmat[1][3]= mat[1][3] / len; + len= normalize_v3_v3(rmat[2], mat[2]); + if(len!=0.0) rmat[2][3]= mat[2][3] / len;; +} + void adjoint_m3_m3(float m1[][3], float m[][3]) { m1[0][0]=m[1][1]*m[2][2]-m[1][2]*m[2][1]; -- cgit v1.2.3 From b3afc3618db09942f83d4a3ac62834e7b925d5d7 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 06:34:02 +0000 Subject: Remove unused code. --- source/blender/verify/BLO_sign_verify_Header.h | 80 ----- source/blender/verify/BLO_signer_info.h | 45 --- source/blender/verify/BLO_verify.h | 76 ----- source/blender/verify/Makefile | 34 -- source/blender/verify/intern/BLO_verify.c | 420 ------------------------- source/blender/verify/intern/Makefile | 50 --- 6 files changed, 705 deletions(-) delete mode 100644 source/blender/verify/BLO_sign_verify_Header.h delete mode 100644 source/blender/verify/BLO_signer_info.h delete mode 100644 source/blender/verify/BLO_verify.h delete mode 100644 source/blender/verify/Makefile delete mode 100644 source/blender/verify/intern/BLO_verify.c delete mode 100644 source/blender/verify/intern/Makefile diff --git a/source/blender/verify/BLO_sign_verify_Header.h b/source/blender/verify/BLO_sign_verify_Header.h deleted file mode 100644 index 9d73d9ba595..00000000000 --- a/source/blender/verify/BLO_sign_verify_Header.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#ifndef BLO_SIGN_VERIFY_H -#define BLO_SIGN_VERIFY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef FREE_WINDOWS -typedef int int32_t; -#endif - -#include "BLO_sys_types.h" - -#define SIGNVERIFYHEADERSTRUCTSIZE sizeof(struct BLO_sign_verify_HeaderStruct) -/* TODO use reasonable sizes -Tests showed: pubKeyLen 64, cryptedKeyLen 64 bytes -So we pick 2*64 bytes + tail for now : */ - -#define MAXPUBKEYLEN 130 -#define MAXSIGNATURELEN 130 - -struct BLO_sign_verify_HeaderStruct { - uint8_t magic; /* poor mans header recognize check */ - uint32_t length; /* how much signed data is there */ - uint8_t pubKey[MAXPUBKEYLEN]; - uint32_t pubKeyLen; /* the actual pubKey length */ - uint8_t signature[MAXSIGNATURELEN]; - int32_t signatureLen; /* the actual signature length */ - uint32_t datacrc; /* data crc checksum */ - uint32_t headercrc; /* header minus crc itself checksum */ -}; - -#define SIGNERHEADERSTRUCTSIZE sizeof(struct BLO_SignerHeaderStruct) -#define MAXSIGNERLEN 100 - -struct BLO_SignerHeaderStruct { - uint8_t name[MAXSIGNERLEN]; /* the signers name (from the key) */ - uint8_t email[MAXSIGNERLEN]; /* the signers email (from the key) */ - uint8_t homeUrl[MAXSIGNERLEN]; /* the signers home page */ - uint8_t text[MAXSIGNERLEN]; /* optional additional user text */ - uint8_t pubKeyUrl1[MAXSIGNERLEN]; /* the signers pubKey store */ - uint8_t pubKeyUrl2[MAXSIGNERLEN]; /* the signers pubKey at NaN */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* BLO_SIGN_VERIFY_H */ - diff --git a/source/blender/verify/BLO_signer_info.h b/source/blender/verify/BLO_signer_info.h deleted file mode 100644 index 39059cf94a7..00000000000 --- a/source/blender/verify/BLO_signer_info.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#include "BLO_sign_verify_Header.h" - -/* external struct for signer info */ - -struct BLO_SignerInfo { - char name[MAXSIGNERLEN]; - char email[MAXSIGNERLEN]; - char homeUrl[MAXSIGNERLEN]; - /* more to come... */ -}; - -struct BLO_SignerInfo *BLO_getSignerInfo(void); -int BLO_isValidSignerInfo(struct BLO_SignerInfo *info); -void BLO_clrSignerInfo(struct BLO_SignerInfo *info); - diff --git a/source/blender/verify/BLO_verify.h b/source/blender/verify/BLO_verify.h deleted file mode 100644 index 5f7241c1cd5..00000000000 --- a/source/blender/verify/BLO_verify.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BLO_VERIFY_H -#define BLO_VERIFY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define VERIFY_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name - -VERIFY_DECLARE_HANDLE(BLO_verifyStructHandle); - -/** - * openssl verify initializer - * @retval pointer to verify control structure - */ - BLO_verifyStructHandle -BLO_verify_begin( - void *endControl); - -/** - * openssl verify dataprocessor wrapper - * @param BLO_verify Pointer to verify control structure - * @param data Pointer to new data - * @param dataIn New data amount - * @retval streamGlueRead return value - */ - int -BLO_verify_process( - BLO_verifyStructHandle BLO_verifyHandle, - unsigned char *data, - unsigned int dataIn); - -/** - * openssl verify final call and cleanup - * @param BLO_verify Pointer to verify control structure - * @retval streamGlueRead return value - */ - int -BLO_verify_end( - BLO_verifyStructHandle BLO_verifyHandle); - -#ifdef __cplusplus -} -#endif - -#endif /* BLO_VERIFY_H */ - diff --git a/source/blender/verify/Makefile b/source/blender/verify/Makefile deleted file mode 100644 index 4451d5baf22..00000000000 --- a/source/blender/verify/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -SOURCEDIR = source/blender/verify -DIRS = intern - -include nan_subdirs.mk diff --git a/source/blender/verify/intern/BLO_verify.c b/source/blender/verify/intern/BLO_verify.c deleted file mode 100644 index ccdc8a7e916..00000000000 --- a/source/blender/verify/intern/BLO_verify.c +++ /dev/null @@ -1,420 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * openssl verify wrapper library - */ - -#include -#include -#include - -#include "openssl/rsa.h" -#include "openssl/ripemd.h" -#include "openssl/objects.h" -#include "zlib.h" - -#include "GEN_messaging.h" - -#include "BLO_readStreamGlue.h" -#include "BLO_verify.h" -#include "BLO_sign_verify_Header.h" /* used by verify and encrypt */ - -#include "BLO_signer_info.h" /* external signer info struct */ - -static struct BLO_SignerInfo g_SignerInfo = {"", "", ""}; - -struct verifyStructType { - struct readStreamGlueStruct *streamGlue; - unsigned int streamDone; - unsigned char headerbuffer[SIGNVERIFYHEADERSTRUCTSIZE]; - uint32_t datacrc; - struct BLO_sign_verify_HeaderStruct *streamHeader; - RIPEMD160_CTX ripemd160_ctx; - struct BLO_SignerHeaderStruct *signerHeader; - unsigned char signerHeaderBuffer[SIGNERHEADERSTRUCTSIZE]; - void *endControl; -}; - - BLO_verifyStructHandle -BLO_verify_begin( - void *endControl) -{ - struct verifyStructType *control; - control = malloc(sizeof(struct verifyStructType)); - if (!control) return NULL; - - control->streamGlue = NULL; - control->streamDone = 0; - memset(control->headerbuffer, 0, SIGNVERIFYHEADERSTRUCTSIZE); - control->datacrc = 0; - - control->streamHeader = malloc(SIGNVERIFYHEADERSTRUCTSIZE); - if (!control->streamHeader) { - free(control); - return NULL; - } - control->streamHeader->magic = 0; - control->streamHeader->length = 0; - strcpy(control->streamHeader->pubKey, ""); - control->streamHeader->pubKeyLen = 0; - strcpy(control->streamHeader->signature, ""); - control->streamHeader->signatureLen = 0; - control->streamHeader->datacrc = 0; - control->streamHeader->headercrc = 0; - - RIPEMD160_Init(&(control->ripemd160_ctx)); - - control->signerHeader = malloc(SIGNERHEADERSTRUCTSIZE); - if (!control->signerHeader) { - free(control->streamHeader); - free(control); - return NULL; - } - memset(control->signerHeader->name, 0, MAXSIGNERLEN); - memset(control->signerHeader->email, 0, MAXSIGNERLEN); - memset(control->signerHeader->homeUrl, 0, MAXSIGNERLEN); - memset(control->signerHeader->text, 0, MAXSIGNERLEN); - memset(control->signerHeader->pubKeyUrl1, 0, MAXSIGNERLEN); - memset(control->signerHeader->pubKeyUrl2, 0, MAXSIGNERLEN); - - control->endControl = endControl; - return((BLO_verifyStructHandle) control); -} - - int -BLO_verify_process( - BLO_verifyStructHandle BLO_verifyHandle, - unsigned char *data, - unsigned int dataIn) -{ - int err = 0; - struct verifyStructType *BLO_verify = - (struct verifyStructType *) BLO_verifyHandle; - - if (!BLO_verify) { - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_NULL); - return err; - } - - /* First check if we have our header filled in yet */ - if (BLO_verify->streamHeader->length == 0) { - unsigned int processed; - if (dataIn == 0) return err; /* really need data to do anything */ - processed = ((dataIn + BLO_verify->streamDone) <= - SIGNVERIFYHEADERSTRUCTSIZE) - ? dataIn : SIGNVERIFYHEADERSTRUCTSIZE; - memcpy(BLO_verify->headerbuffer + BLO_verify->streamDone, - data, processed); - BLO_verify->streamDone += processed; - dataIn -= processed; - data += processed; - if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE) { - /* we have the whole header, absorb it */ - struct BLO_sign_verify_HeaderStruct *header; - uint32_t crc; - - header = (struct BLO_sign_verify_HeaderStruct *) - BLO_verify->headerbuffer; - crc = crc32(0L, (const Bytef *) header, - SIGNVERIFYHEADERSTRUCTSIZE - 4); - - if (header->magic == 'A') { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_sign_verify_HeaderStruct Magic confirmed\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "ERROR BLO_sign_verify_HeaderStruct Magic NOT confirmed\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_MAGIC); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - if (crc == ntohl(header->headercrc)) { -#ifndef NDEBUG - fprintf(GEN_errorstream,"BLO_sign_verify_Header CRC correct\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream,"ERROR BLO_sign_verify_Header CRC NOT correct\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_CRCHEADER); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - BLO_verify->streamHeader->length = ntohl(header->length); - BLO_verify->streamHeader->pubKeyLen = ntohl(header->pubKeyLen); - memcpy(BLO_verify->streamHeader->pubKey, header->pubKey, - BLO_verify->streamHeader->pubKeyLen); - BLO_verify->streamHeader->signatureLen = - ntohl(header->signatureLen); - memcpy(BLO_verify->streamHeader->signature, header->signature, - BLO_verify->streamHeader->signatureLen); - BLO_verify->streamHeader->datacrc = ntohl(header->datacrc); - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_verify_process gets %u bytes\n", - (unsigned int) BLO_verify->streamHeader->length); -#endif - - } - } - - /* Is there really (still) new data available ? */ - if (dataIn > 0) { - /* BLO_SignerHeaderStruct */ - if (BLO_verify->signerHeader->name[0] == 0) { - /* we don't have our signerHeader complete yet */ - unsigned int processed; - processed = ((dataIn + BLO_verify->streamDone - - SIGNVERIFYHEADERSTRUCTSIZE) <= SIGNERHEADERSTRUCTSIZE) - ? dataIn : SIGNERHEADERSTRUCTSIZE; - memcpy(BLO_verify->signerHeaderBuffer + - BLO_verify->streamDone - SIGNVERIFYHEADERSTRUCTSIZE, - data, processed); - BLO_verify->streamDone += processed; - dataIn -= processed; - data += processed; - if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE + - SIGNERHEADERSTRUCTSIZE) { - /* we have the whole header, absorb it */ - struct BLO_SignerHeaderStruct *signerHeader; - signerHeader = (struct BLO_SignerHeaderStruct *) - BLO_verify->signerHeaderBuffer; - strncpy(BLO_verify->signerHeader->name, - signerHeader->name, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->email, - signerHeader->email, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->homeUrl, - signerHeader->homeUrl, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->text, - signerHeader->text, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->pubKeyUrl1, - signerHeader->pubKeyUrl1, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->pubKeyUrl2, - signerHeader->pubKeyUrl2, MAXSIGNERLEN-1); - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "name %s\nemail %s\nhomeUrl %s\ntext %s\n", - BLO_verify->signerHeader->name, - BLO_verify->signerHeader->email, - BLO_verify->signerHeader->homeUrl, - BLO_verify->signerHeader->text); - fprintf(GEN_errorstream, - "pubKeyUrl1 %s\npubKeyUrl2 %s\n", - BLO_verify->signerHeader->pubKeyUrl1, - BLO_verify->signerHeader->pubKeyUrl2); -#endif - /* also update the signature and crc checksum */ - RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), - BLO_verify->signerHeaderBuffer, - SIGNERHEADERSTRUCTSIZE); - - /* update datacrc */ - BLO_verify->datacrc = crc32( - BLO_verify->datacrc, (const Bytef *) - BLO_verify->signerHeaderBuffer, - SIGNERHEADERSTRUCTSIZE); - } - } - } - - /* Is there really (still) new data available ? */ - if (dataIn > 0) { - RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), data, dataIn); - - /* update datacrc */ - BLO_verify->datacrc = crc32( - BLO_verify->datacrc, (const Bytef *) data, dataIn); - - BLO_verify->streamDone += dataIn; - - /* give data to streamGlueRead, it will find out what to do next */ - err = readStreamGlue( - BLO_verify->endControl, - &(BLO_verify->streamGlue), - (unsigned char *) data, - dataIn); - } - return err; -} - -/** - * openssl verify final call and cleanup - * @param BLO_verify Pointer to verify control structure - * @retval streamGlueRead return value - */ - int -BLO_verify_end( - BLO_verifyStructHandle BLO_verifyHandle) -{ - int err = 0; - unsigned char *digest; - static unsigned char rsa_e[] = "\x01\x00\x01"; - RSA *rsa = NULL; - int verifySuccess; - struct verifyStructType *BLO_verify = - (struct verifyStructType *) BLO_verifyHandle; - - if (!BLO_verify) { - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_NULL); - return err; - } - - if (BLO_verify->streamDone == BLO_verify->streamHeader->length + - SIGNVERIFYHEADERSTRUCTSIZE) { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data length is correct\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data length is NOT correct\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_DATALEN); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - if (BLO_verify->datacrc == BLO_verify->streamHeader->datacrc) { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data CRC is correct\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data CRC is NOT correct\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_CRCDATA); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - digest = malloc(RIPEMD160_DIGEST_LENGTH); - if (!digest) { - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_MALLOC); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - RIPEMD160_Final(digest, &(BLO_verify->ripemd160_ctx)); - - rsa = RSA_new(); - if (rsa == NULL) { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Error in RSA_new\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETSPECERR(BRS_RSANEWERROR); - free(digest); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - /* static exponent */ - rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e); - - /* public part into rsa->n */ - rsa->n = BN_bin2bn(BLO_verify->streamHeader->pubKey, - BLO_verify->streamHeader->pubKeyLen, - rsa->n); - /*DEBUG RSA_print_fp(stdout, rsa, 0); */ - - /* verify the signature */ - verifySuccess = RSA_verify(NID_ripemd160, digest, RIPEMD160_DIGEST_LENGTH, - BLO_verify->streamHeader->signature, - BLO_verify->streamHeader->signatureLen, rsa); - if (verifySuccess == 1) { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "Signature verified\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "Signature INCORRECT\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETSPECERR(BRS_SIGFAILED); - } - -/* copy signer information to external struct */ - - strncpy(g_SignerInfo.name, BLO_verify->signerHeader->name, MAXSIGNERLEN-1); - strncpy(g_SignerInfo.email, BLO_verify->signerHeader->email, MAXSIGNERLEN-1); - strncpy(g_SignerInfo.homeUrl, BLO_verify->signerHeader->homeUrl, MAXSIGNERLEN-1); - - free(digest); - free(BLO_verify->streamGlue); - free(BLO_verify->streamHeader); - free(BLO_verify->signerHeader); - free(BLO_verify); - RSA_free(rsa); - - return err; -} - -struct BLO_SignerInfo *BLO_getSignerInfo(){ - return &g_SignerInfo; -} - -int BLO_isValidSignerInfo(struct BLO_SignerInfo *info){ - return info->name[0] != 0; -} - -void BLO_clrSignerInfo(struct BLO_SignerInfo *info) -{ - info->name[0] = 0; -} - diff --git a/source/blender/verify/intern/Makefile b/source/blender/verify/intern/Makefile deleted file mode 100644 index 009fd1c6e28..00000000000 --- a/source/blender/verify/intern/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = verify -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -CFLAGS += $(LEVEL_2_C_WARNINGS) - -# path to our own external headerfiles -CPPFLAGS += -I.. - -# external modules -CPPFLAGS += -I../../../kernel/gen_messaging -CPPFLAGS += -I../../readstreamglue - -CPPFLAGS += -I$(NAN_OPENSSL)/include - -ifeq ($(OS),$(findstring $(OS), "solaris windows")) - CPPFLAGS += -I$(NAN_ZLIB)/include -endif - -- cgit v1.2.3 From 4d37cf90b9d9d8ed2f0339c8ccd72481e29a4514 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 06:41:16 +0000 Subject: remove G.sce, use G.main->name instead. Both stored the filename of the blend file, but G.sce stored the last opened file. This will make blender act differently in some cases since a relative path to the last opened file will no longer resolve (which is correct IMHO since that file isnt open and the path might not even be valid anymore). Tested linking with durian files and rendering to relative paths when no files is loaded however we may need to have some operators give an error if they are used on the default startup.blend. --- source/blender/blenkernel/BKE_global.h | 4 ++-- source/blender/blenkernel/intern/blender.c | 13 +++++------- source/blender/blenkernel/intern/customdata.c | 3 ++- source/blender/blenkernel/intern/image.c | 16 +++++++-------- source/blender/blenkernel/intern/library.c | 2 +- source/blender/blenkernel/intern/packedFile.c | 6 +++--- source/blender/blenkernel/intern/particle_system.c | 3 ++- source/blender/blenkernel/intern/pointcache.c | 2 +- source/blender/blenkernel/intern/scene.c | 4 ++-- source/blender/blenkernel/intern/sequencer.c | 12 +++++------ source/blender/blenkernel/intern/sound.c | 4 ++-- source/blender/blenkernel/intern/text.c | 2 +- source/blender/blenkernel/intern/writeavi.c | 3 ++- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- source/blender/blenlib/BLI_bpath.h | 2 +- source/blender/blenlib/intern/bpath.c | 2 +- source/blender/blenloader/intern/readfile.c | 12 +++++------ source/blender/blenloader/intern/writefile.c | 6 +++--- source/blender/collada/ImageExporter.cpp | 5 +++-- source/blender/editors/interface/interface_draw.c | 2 +- source/blender/editors/object/object_modifier.c | 2 +- source/blender/editors/physics/physics_fluid.c | 6 +++--- source/blender/editors/render/render_preview.c | 4 ++-- source/blender/editors/render/render_shading.c | 6 +++--- source/blender/editors/screen/screendump.c | 3 ++- source/blender/editors/space_buttons/buttons_ops.c | 3 ++- source/blender/editors/space_file/file_draw.c | 5 +++-- source/blender/editors/space_file/file_ops.c | 15 +++++++------- source/blender/editors/space_file/filelist.c | 8 ++++---- source/blender/editors/space_file/filesel.c | 7 ++++--- source/blender/editors/space_file/writeimage.c | 5 +++-- source/blender/editors/space_image/image_ops.c | 12 +++++------ source/blender/editors/space_info/info_ops.c | 8 ++++---- source/blender/editors/space_outliner/outliner.c | 2 +- .../editors/space_sequencer/sequencer_add.c | 4 ++-- .../editors/space_sequencer/sequencer_edit.c | 2 +- source/blender/editors/space_text/text_ops.c | 12 +++++------ source/blender/makesrna/intern/rna_image_api.c | 4 ++-- .../blender/modifiers/intern/MOD_fluidsim_util.c | 5 +++-- .../blender/python/generic/bpy_internal_import.c | 4 ++-- source/blender/quicktime/apple/quicktime_export.c | 2 +- source/blender/render/intern/source/pipeline.c | 4 ++-- source/blender/windowmanager/intern/wm_files.c | 23 +++++++--------------- source/blender/windowmanager/intern/wm_init_exit.c | 6 +++--- source/blender/windowmanager/intern/wm_operators.c | 10 +++++----- source/blender/windowmanager/intern/wm_window.c | 11 +++++------ .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 10 +++++----- source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 3 ++- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 4 ++-- 49 files changed, 147 insertions(+), 148 deletions(-) diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 6a602339e11..76fb5605d77 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -52,9 +52,9 @@ typedef struct Global { struct Main *main; /* strings: lastsaved */ - char ima[256], sce[256], lib[256]; + char ima[256], lib[256]; - /* flag: if != 0 G.sce contains valid relative base path */ + /* flag: if != 0 G.main->name contains valid relative base path */ int relbase_valid; /* strings of recent opend files */ diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 5fcf3c77d3b..72d194e4d79 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -309,8 +309,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) #endif /* these are the same at times, should never copy to the same location */ - if(G.sce != filename) - BLI_strncpy(G.sce, filename, FILE_MAX); + if(G.main->name != filename) + BLI_strncpy(G.main->name, filename, FILE_MAX); BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */ @@ -410,7 +410,7 @@ int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *report { BlendFileData *bfd; - bfd= BLO_read_from_memfile(CTX_data_main(C), G.sce, memfile, reports); + bfd= BLO_read_from_memfile(CTX_data_main(C), G.main->name, memfile, reports); if (bfd) setup_app_data(C, bfd, ""); else @@ -460,14 +460,12 @@ static UndoElem *curundo= NULL; static int read_undosave(bContext *C, UndoElem *uel) { - char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */ char mainstr[FILE_MAXDIR+FILE_MAXFILE]; int success=0, fileflags; /* This is needed so undoing/redoing doesnt crash with threaded previews going */ WM_jobs_stop_all(CTX_wm_manager(C)); - - strcpy(scestr, G.sce); /* temporal store */ + strcpy(mainstr, G.main->name); /* temporal store */ fileflags= G.fileflags; @@ -479,7 +477,6 @@ static int read_undosave(bContext *C, UndoElem *uel) success= BKE_read_file_from_memfile(C, &uel->memfile, NULL); /* restore */ - strcpy(G.sce, scestr); /* restore */ strcpy(G.main->name, mainstr); /* restore */ G.fileflags= fileflags; @@ -720,7 +717,7 @@ void BKE_undo_save_quit(void) Main *BKE_undo_get_main(Scene **scene) { Main *mainp= NULL; - BlendFileData *bfd= BLO_read_from_memfile(G.main, G.sce, &curundo->memfile, NULL); + BlendFileData *bfd= BLO_read_from_memfile(G.main, G.main->name, &curundo->memfile, NULL); if(bfd) { mainp= bfd->main; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 7f91df3b281..9c4f0d790ca 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -48,6 +48,7 @@ #include "BKE_customdata.h" #include "BKE_customdata_file.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" /* number of layers to add when growing a CustomData object */ @@ -2343,7 +2344,7 @@ int CustomData_verify_versions(struct CustomData *data, int index) static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external) { - char *path = (id->lib)? id->lib->filepath: G.sce; + char *path = (id->lib)? id->lib->filepath: G.main->name; BLI_strncpy(filename, external->filename, FILE_MAX); BLI_path_abs(filename, path); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8ba7cde519d..09622b2acfe 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -338,7 +338,7 @@ Image *BKE_add_image_file(const char *name) char str[FILE_MAX], strtest[FILE_MAX]; BLI_strncpy(str, name, sizeof(str)); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); /* exists? */ file= open(str, O_BINARY|O_RDONLY); @@ -349,7 +349,7 @@ Image *BKE_add_image_file(const char *name) for(ima= G.main->image.first; ima; ima= ima->id.next) { if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) { BLI_strncpy(strtest, ima->name, sizeof(ima->name)); - BLI_path_abs(strtest, G.sce); + BLI_path_abs(strtest, G.main->name); if( strcmp(strtest, str)==0 ) { if(ima->anim==NULL || ima->id.us==0) { @@ -861,8 +861,8 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) if (scene->r.stamp & R_STAMP_FILENAME) { if (G.relbase_valid) { - if (do_prefix) sprintf(stamp_data->file, "File %s", G.sce); - else sprintf(stamp_data->file, "%s", G.sce); + if (do_prefix) sprintf(stamp_data->file, "File %s", G.main->name); + else sprintf(stamp_data->file, "%s", G.main->name); } else { if (do_prefix) strcpy(stamp_data->file, "File "); else strcpy(stamp_data->file, ""); @@ -1311,7 +1311,7 @@ void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ { if (string==NULL) return; BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */ - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_path_frame(string, frame, 4); if(use_ext) @@ -1609,7 +1609,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) if(ima->id.lib) BLI_path_abs(name, ima->id.lib->filepath); else - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); flag= IB_rect|IB_multilayer; if(ima->flag & IMA_DO_PREMUL) @@ -1717,7 +1717,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) if(ima->id.lib) BLI_path_abs(str, ima->id.lib->filepath); else - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); ima->anim = openanim(str, IB_rect); @@ -1778,7 +1778,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) if(ima->id.lib) BLI_path_abs(str, ima->id.lib->filepath); else - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); /* read ibuf */ ibuf = IMB_loadiffname(str, flag); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 1e08432c271..dfc82152e8c 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1234,7 +1234,7 @@ static void image_fix_relative_path(Image *ima) if(ima->id.lib==NULL) return; if(strncmp(ima->name, "//", 2)==0) { BLI_path_abs(ima->name, ima->id.lib->filepath); - BLI_path_rel(ima->name, G.sce); + BLI_path_rel(ima->name, G.main->name); } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 5bbb3506a78..33f1949c5ac 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -179,7 +179,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename) // convert relative filenames to absolute filenames strcpy(name, filename); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); // open the file // and create a PackedFile structure @@ -274,7 +274,7 @@ int writePackedFile(ReportList *reports, char *filename, PackedFile *pf, int gui if (guimode) {} //XXX waitcursor(1); strcpy(name, filename); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if (BLI_exists(name)) { for (number = 1; number <= 999; number++) { @@ -339,7 +339,7 @@ int checkPackedFile(char *filename, PackedFile *pf) char name[FILE_MAXDIR + FILE_MAXFILE]; strcpy(name, filename); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if (stat(name, &st)) { ret_val = PF_NOFILE; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 8ab4117c8a1..71ec1114848 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -63,6 +63,7 @@ #include "BLI_listbase.h" #include "BLI_threads.h" +#include "BKE_main.h" #include "BKE_animsys.h" #include "BKE_boids.h" #include "BKE_cdderivedmesh.h" @@ -3607,7 +3608,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) // ok, start loading strcpy(filename, fss->surfdataPath); strcat(filename, suffix); - BLI_path_abs(filename, G.sce); + BLI_path_abs(filename, G.main->name); BLI_path_frame(filename, curFrame, 0); // fixed #frame-no strcat(filename, suffix2); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 3896d523b11..37d2b103ef0 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1085,7 +1085,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup static int ptcache_path(PTCacheID *pid, char *filename) { Library *lib= (pid->ob)? pid->ob->id.lib: NULL; - const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce; + const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name; size_t i; if(pid->cache->flag & PTCACHE_EXTERNAL) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index fde180cadc6..e399e0bb83d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -566,11 +566,11 @@ Scene *set_scene_name(Main *bmain, char *name) Scene *sce= (Scene *)find_id("SC", name); if(sce) { set_scene_bg(bmain, sce); - printf("Scene switch: '%s' in file: '%s'\n", name, G.sce); + printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name); return sce; } - printf("Can't find scene: '%s' in file: '%s'\n", name, G.sce); + printf("Can't find scene: '%s' in file: '%s'\n", name, G.main->name); return NULL; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 6d087837302..21b7cfd010c 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -579,7 +579,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) if (seq->type != SEQ_SCENE && seq->type != SEQ_META && seq->type != SEQ_IMAGE) { BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); } if (seq->type == SEQ_IMAGE) { @@ -1044,7 +1044,7 @@ static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, c if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { BLI_join_dirfile(name, dir, seq->strip->proxy->file); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); return TRUE; } @@ -1071,7 +1071,7 @@ static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, c render_size); } - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); BLI_path_frame(name, frameno, 0); @@ -2002,7 +2002,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float if(ibuf == 0 && s_elem) { BLI_join_dirfile(name, seq->strip->dir, s_elem->name); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); ibuf = seq_proxy_fetch(scene, seq, cfra, render_size); } @@ -2038,7 +2038,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); seq->anim = openanim( name, IB_rect | @@ -3492,7 +3492,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo struct anim *an; BLI_strncpy(path, seq_load->path, sizeof(path)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); an = openanim(path, IB_rect); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 5c3047942f7..cc941c81131 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -131,7 +131,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename) strcpy(str, filename); - path = /*bmain ? bmain->name :*/ G.sce; + path = /*bmain ? bmain->name :*/ G.main->name; BLI_path_abs(str, path); @@ -267,7 +267,7 @@ void sound_load(struct Main *UNUSED(bmain), struct bSound* sound) path = sound->id.lib->filepath; else // XXX this should be fixed! - path = /*bmain ? bmain->name :*/ G.sce; + path = /*bmain ? bmain->name :*/ G.main->name; BLI_path_abs(fullpath, path); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 19bc853276a..bb1a1a88a09 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -241,7 +241,7 @@ int reopen_text(Text *text) if (!text || !text->name) return 0; BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); fp= fopen(str, "r"); if(fp==NULL) return 0; diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 8363ff13ef9..de708f216fd 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -40,6 +40,7 @@ #include "BLI_blenlib.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_report.h" #include "BKE_utildefines.h" #include "BKE_writeavi.h" @@ -119,7 +120,7 @@ static void filepath_avi (char *string, RenderData *rd) if (string==NULL) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 473c10d6ced..ec998e68e00 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -857,7 +857,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) { if (!string || !exts) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h index 72489a171b9..34b9e282061 100644 --- a/source/blender/blenlib/BLI_bpath.h +++ b/source/blender/blenlib/BLI_bpath.h @@ -50,7 +50,7 @@ struct BPathIterator { void (*setpath_callback)(struct BPathIterator *, char *); void (*getpath_callback)(struct BPathIterator *, char *); - char* base_path; /* base path, the directry the blend file is in - normally G.sce */ + char* base_path; /* base path, the directry the blend file is in - normally G.main->name */ /* only for seq data */ struct BPathIteratorSeqData seqdata; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index cf7eb873409..862df4103a7 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -92,7 +92,7 @@ void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) { bpi->seqdata.seqar = NULL; bpi->seqdata.scene = NULL; - bpi->base_path= base_path ? base_path : G.sce; + bpi->base_path= base_path ? base_path : G.main->name; BLI_bpathIterator_step(bpi); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ebd407e7e21..b6515863c2b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9707,7 +9707,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { char str[FILE_MAX]; BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); seq->sound = sound_new_file(main, str); } /* don't know, if anybody used that @@ -12369,7 +12369,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) blo_split_main(&(*fd)->mainlist, mainvar); /* which one do we need? */ - mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.sce); + mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name); /* needed for do_version */ mainl->versionfile= (*fd)->fileversion; @@ -12453,7 +12453,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name)); /* uses current .blend file as reference */ - BLI_path_rel(curlib->name, G.sce); + BLI_path_rel(curlib->name, G.main->name); } blo_join_main(&(*fd)->mainlist); @@ -12462,7 +12462,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in lib_link_all(*fd, mainvar); lib_verify_nodetree(mainvar, FALSE); - fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */ + fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */ /* give a base to loose objects. If group append, do it for objects too */ if(scene) { @@ -12578,7 +12578,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) while(fd==NULL) { char newlib_path[240] = { 0 }; printf("Missing library...'\n"); - printf(" current file: %s\n", G.sce); + printf(" current file: %s\n", G.main->name); printf(" absolute lib: %s\n", mainptr->curlib->filepath); printf(" relative lib: %s\n", mainptr->curlib->name); printf(" enter a new path:\n"); @@ -12586,7 +12586,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if(scanf("%s", newlib_path) > 0) { strcpy(mainptr->curlib->name, newlib_path); strcpy(mainptr->curlib->filepath, newlib_path); - cleanup_path(G.sce, mainptr->curlib->filepath); + cleanup_path(G.main->name, mainptr->curlib->filepath); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 440f1cc98a8..b5715353c6c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2471,14 +2471,14 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report if(strcmp(dir1, dir2)==0) write_flags &= ~G_FILE_RELATIVE_REMAP; else - makeFilesAbsolute(G.sce, NULL); + makeFilesAbsolute(G.main->name, NULL); } - BLI_make_file_string(G.sce, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); + BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); write_user_block= BLI_streq(dir, userfilename); if(write_flags & G_FILE_RELATIVE_REMAP) - makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.sce */ + makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.main->name */ /* actual file writing */ err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb); diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index ce40846ba59..3194b2269ea 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -32,6 +32,7 @@ #include "DNA_texture_types.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" #include "BLI_fileops.h" #include "BLI_path_util.h" @@ -66,13 +67,13 @@ void ImagesExporter::operator()(Material *ma, Object *ob) BLI_split_dirfile(mfilename, dir, NULL); - BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir); + BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir); if (abs[0] != '\0') { // make absolute source path BLI_strncpy(src, image->name, sizeof(src)); - BLI_path_abs(src, G.sce); + BLI_path_abs(src, G.main->name); // make dest directory if it doesn't exist BLI_make_existing_file(abs); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 855ca45f61a..81b04fea062 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -564,7 +564,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) int err; strcpy(tmpStr, G.selfont->name); - BLI_path_abs(tmpStr, G.sce); + BLI_path_abs(tmpStr, G.main->name); err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); } } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 3bdf202aca9..c273b375a06 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1058,7 +1058,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); if(relative) - BLI_path_rel(path, G.sce); + BLI_path_rel(path, G.main->name); CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path); CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 6dc4684d815..b1c373e7a91 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -639,7 +639,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF // prepare names... strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR); strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.sce); // fixed #frame-no + BLI_path_abs(targetDir, G.main->name); // fixed #frame-no strcpy(targetFile, targetDir); strcat(targetFile, suffixConfig); @@ -663,7 +663,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF char blendFile[FILE_MAXDIR+FILE_MAXFILE]; // invalid dir, reset to current/previous - strcpy(blendDir, G.sce); + strcpy(blendDir, G.main->name); BLI_splitdirstring(blendDir, blendFile); if(strlen(blendFile)>6){ int len = strlen(blendFile); @@ -694,7 +694,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF if(selection<1) return 0; // 0 from menu, or -1 aborted strcpy(targetDir, newSurfdataPath); strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.sce); // fixed #frame-no + BLI_path_abs(targetDir, G.main->name); // fixed #frame-no } #endif return outStringsChanged; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 21f10d936bf..0e8587e4642 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -111,7 +111,7 @@ ImBuf* get_brush_icon(Brush *brush) // first use the path directly to try and load the file BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); brush->icon_imbuf= IMB_loadiffname(path, flags); @@ -121,7 +121,7 @@ ImBuf* get_brush_icon(Brush *brush) path[0]= 0; - BLI_make_file_string(G.sce, path, folder, brush->icon_filepath); + BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath); if (path[0]) brush->icon_imbuf= IMB_loadiffname(path, flags); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index bca8100a809..9db15ee43e5 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -852,7 +852,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int ibuf->profile = IB_PROFILE_LINEAR_RGB; /* to save, we first get absolute path */ - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) { retval = OPERATOR_FINISHED; @@ -863,7 +863,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int } /* in case we were saving with relative paths, change back again */ if(relative) - BLI_path_rel(str, G.sce); + BLI_path_rel(str, G.main->name); IMB_freeImBuf(ibuf); ibuf = NULL; @@ -908,7 +908,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event //RNA_enum_set(op->ptr, "file_type", scene->r.imtype); - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 937441a6e43..082c9f2f721 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_image.h" #include "BKE_report.h" #include "BKE_writeavi.h" @@ -77,7 +78,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); strcpy(G.ima, path); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ if(scene->r.scemode & R_EXTENSION) diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 2573470e8df..e72446366fe 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -39,6 +39,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "WM_api.h" #include "WM_types.h" @@ -104,7 +105,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* add slash for directories, important for some properties */ if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { id = fbo->ptr.id.data; - base = (id && id->lib)? id->lib->filepath: G.sce; + base = (id && id->lib)? id->lib->filepath: G.main->name; BLI_strncpy(path, str, FILE_MAX); BLI_path_abs(path, base); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 421b14e5bbe..65415d382ec 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -40,6 +40,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BLF_api.h" @@ -445,9 +446,9 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) struct direntry *file = (struct direntry *)arg1; #endif - BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname); + BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname); BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename)); - BLI_make_file_string(G.sce, newname, sfile->params->dir, filename); + BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename); if( strcmp(orgname, newname) != 0 ) { if (!BLI_exists(newname)) { diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 6dfdcfd430a..1af8e9d14be 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -30,6 +30,7 @@ #include "BKE_screen.h" #include "BKE_global.h" #include "BKE_report.h" +#include "BKE_main.h" #include "BLI_blenlib.h" #include "BLI_storage_types.h" @@ -190,7 +191,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh /* avoids /../../ */ BLI_parent_dir(params->dir); } else { - BLI_cleanup_dir(G.sce, params->dir); + BLI_cleanup_dir(G.main->name, params->dir); strcat(params->dir, file->relname); BLI_add_slash(params->dir); } @@ -361,7 +362,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "dir", entry); BLI_strncpy(params->dir, entry, sizeof(params->dir)); - BLI_cleanup_dir(G.sce, params->dir); + BLI_cleanup_dir(G.main->name, params->dir); file_change_dir(C, 1); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); @@ -544,7 +545,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file); if(RNA_struct_find_property(op->ptr, "relative_path")) { if(RNA_boolean_get(op->ptr, "relative_path")) { - BLI_path_rel(filepath, G.sce); + BLI_path_rel(filepath, G.main->name); } } @@ -680,7 +681,7 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1); - BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); @@ -711,7 +712,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused)) if(sfile->params) { if (BLI_has_parent(sfile->params->dir)) { BLI_parent_dir(sfile->params->dir); - BLI_cleanup_dir(G.sce, sfile->params->dir); + BLI_cleanup_dir(G.main->name, sfile->params->dir); file_change_dir(C, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); } @@ -1010,7 +1011,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) if (sfile->params->dir[0] == '\0') get_default_root(sfile->params->dir); #endif - BLI_cleanup_dir(G.sce, sfile->params->dir); + BLI_cleanup_dir(G.main->name, sfile->params->dir); BLI_add_slash(sfile->params->dir); file_change_dir(C, 1); @@ -1240,7 +1241,7 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) file = filelist_file(sfile->files, sfile->params->active_file); - BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname); + BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); BLI_delete(str, 0, 0); ED_fileselect_clear(C, sfile); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 68a93d39062..43d5d54805d 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -730,7 +730,7 @@ static void filelist_read_dir(struct FileList* filelist) BLI_getwdN(wdir); - BLI_cleanup_dir(G.sce, filelist->dir); + BLI_cleanup_dir(G.main->name, filelist->dir); filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); if(!chdir(wdir)) {} /* fix warning about not checking return value */ @@ -747,7 +747,7 @@ static void filelist_read_main(struct FileList* filelist) static void filelist_read_library(struct FileList* filelist) { if (!filelist) return; - BLI_cleanup_dir(G.sce, filelist->dir); + BLI_cleanup_dir(G.main->name, filelist->dir); filelist_from_library(filelist); if(!filelist->libfiledata) { int num; @@ -912,7 +912,7 @@ void filelist_from_library(struct FileList* filelist) return; } - BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI + BLI_strncpy(filename, G.main->name, sizeof(filename)); /* there we go */ /* for the time being only read filedata when libfiledata==0 */ @@ -979,7 +979,7 @@ void filelist_from_library(struct FileList* filelist) filelist_sort(filelist, FILE_SORT_ALPHA); - BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change + BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change filelist->filter = 0; filelist_filter(filelist); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index b36cfe66a36..8ad3ef08e85 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -64,6 +64,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BLF_api.h" @@ -104,7 +105,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) if (!sfile->params) { sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams"); /* set path to most recently opened .blend */ - BLI_split_dirfile(G.sce, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); sfile->params->filter_glob[0] = '\0'; } @@ -142,8 +143,8 @@ short ED_fileselect_set_params(SpaceFile *sfile) } if(params->dir[0]) { - BLI_cleanup_dir(G.sce, params->dir); - BLI_path_abs(params->dir, G.sce); + BLI_cleanup_dir(G.main->name, params->dir); + BLI_path_abs(params->dir, G.main->name); } params->filter = 0; diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index f5ce5a818d7..750cf98727a 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -41,6 +41,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_image.h" #include "RE_pipeline.h" @@ -75,7 +76,7 @@ static void save_rendered_image_cb_real(char *name, int confirm) BKE_add_image_extension(name, scene->r.imtype); strcpy(str, name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (confirm) overwrite = saveover(str); @@ -218,7 +219,7 @@ void BIF_save_rendered_image_fs(Scene *scene) char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2]; if(G.ima[0]==0) { - strcpy(dir, G.sce); + strcpy(dir, G.main->name); BLI_splitdirstring(dir, str); strcpy(G.ima, dir); } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index a44258351ce..429ba64ed0f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -133,7 +133,7 @@ static int space_image_file_exists_poll(bContext *C) ibuf= ED_space_image_acquire_buffer(sima, &lock); if(ibuf) { BLI_strncpy(name, ibuf->name, FILE_MAX); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); poll= (BLI_exists(name) && BLI_is_writable(name)); } ED_space_image_release_buffer(sima, lock); @@ -856,7 +856,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); if(scene->r.scemode & R_EXTENSION) { BKE_add_image_extension(path, sima->imtypenr); @@ -876,7 +876,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera RE_WriteRenderResult(rr, path, scene->r.quality); if(relative) - BLI_path_rel(path, G.sce); /* only after saving */ + BLI_path_rel(path, G.main->name); /* only after saving */ if(!save_copy) { if(do_newpath) { @@ -896,7 +896,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) { if(relative) - BLI_path_rel(path, G.sce); /* only after saving */ + BLI_path_rel(path, G.main->name); /* only after saving */ if(!save_copy) { if(do_newpath) { @@ -1071,7 +1071,7 @@ static int save_exec(bContext *C, wmOperator *op) if(name[0]==0) BLI_strncpy(name, G.ima, FILE_MAX); else - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if(BLI_exists(name) && BLI_is_writable(name)) { rr= BKE_image_acquire_renderresult(scene, ima); @@ -1157,7 +1157,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op) char name[FILE_MAX]; BLI_strncpy(name, ibuf->name, sizeof(name)); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) { BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index c87b25877b4..aeb32cda6bd 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -191,7 +191,7 @@ static int make_paths_relative_exec(bContext *UNUSED(C), wmOperator *op) return OPERATOR_CANCELLED; } - makeFilesRelative(G.sce, op->reports); + makeFilesRelative(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -218,7 +218,7 @@ static int make_paths_absolute_exec(bContext *UNUSED(C), wmOperator *op) return OPERATOR_CANCELLED; } - makeFilesAbsolute(G.sce, op->reports); + makeFilesAbsolute(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -244,7 +244,7 @@ static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op) txtname[0] = '\0'; /* run the missing file check */ - checkMissingFiles(G.sce, op->reports); + checkMissingFiles(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -269,7 +269,7 @@ static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op) char *path; path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); - findMissingFiles(path, G.sce); + findMissingFiles(path, G.main->name); MEM_freeN(path); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 6040b755e30..1f0725c5458 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -5035,7 +5035,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) if (te->idcode == ID_LI) { char expanded[FILE_MAXDIR + FILE_MAXFILE]; BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE); - BLI_path_abs(expanded, G.sce); + BLI_path_abs(expanded, G.main->name); if (!BLI_exists(expanded)) { error("This path does not exist, correct this before saving"); } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index b9db18f7850..5f0693dc43c 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -101,7 +101,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { char path[sizeof(last_seq->strip->dir)]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); RNA_string_set(op->ptr, identifier, path); } } @@ -152,7 +152,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) } if((is_file != -1) && relative) - BLI_path_rel(seq_load->path, G.sce); + BLI_path_rel(seq_load->path, G.main->name); if (RNA_struct_find_property(op->ptr, "frame_end")) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index bd53615feda..35f27953633 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -992,7 +992,7 @@ void touch_seq_files(Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { if(seq->strip && seq->strip->stripdata) { - BLI_make_file_string(G.sce, str, seq->strip->dir, seq->strip->stripdata->name); + BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name); BLI_touch(seq->name); } } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 90fab7b2902..8d4f3f87f66 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -221,7 +221,7 @@ static int open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - text= add_text(str, G.sce); + text= add_text(str, G.main->name); if(!text) { if(op->customdata) MEM_freeN(op->customdata); @@ -266,7 +266,7 @@ static int open_exec(bContext *C, wmOperator *op) static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); - char *path= (text && text->name)? text->name: G.sce; + char *path= (text && text->name)? text->name: G.main->name; if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); @@ -438,7 +438,7 @@ static void txt_write_file(Text *text, ReportList *reports) char file[FILE_MAXDIR+FILE_MAXFILE]; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); fp= fopen(file, "w"); if(fp==NULL) { @@ -524,7 +524,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) else if(text->flags & TXT_ISMEM) str= text->id.name+2; else - str= G.sce; + str= G.main->name; RNA_string_set(op->ptr, "filepath", str); WM_event_add_fileselect(C, op); @@ -2860,7 +2860,7 @@ int text_file_modified(Text *text) return 0; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return 2; @@ -2888,7 +2888,7 @@ static void text_ignore_modified(Text *text) if(!text || !text->name) return; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return; diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 70438ae3d8c..74d61101273 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -41,7 +41,7 @@ #include "BKE_packedFile.h" #include "BKE_main.h" #include "BKE_utildefines.h" -#include "BKE_global.h" /* grr: G.sce */ +#include "BKE_global.h" /* grr: G.main->name */ #include "IMB_imbuf.h" @@ -90,7 +90,7 @@ static void rna_Image_save(Image *image, ReportList *reports) if(ibuf) { char filename[FILE_MAXDIR + FILE_MAXFILE]; BLI_strncpy(filename, image->name, sizeof(filename)); - BLI_path_abs(filename, G.sce); + BLI_path_abs(filename, G.main->name); if(image->packedfile) { if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) { diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 176a52251e7..fb3eb74a919 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -43,10 +43,11 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BKE_main.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_utildefines.h" -#include "BKE_global.h" /* G.sce only */ +#include "BKE_global.h" /* G.main->name only */ #include "MOD_modifiertypes.h" @@ -482,7 +483,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid strcat(targetDir,"fluidsurface_final_####"); } - BLI_path_abs(targetDir, G.sce); + BLI_path_abs(targetDir, G.main->name); BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no strcpy(targetFile,targetDir); diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 568cef0f676..6d42c794583 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -33,7 +33,7 @@ #include "BKE_utildefines.h" /* UNUSED */ #include "BKE_text.h" /* txt_to_buf */ #include "BKE_main.h" -#include "BKE_global.h" /* grr, only for G.sce */ +#include "BKE_global.h" /* grr, only for G.main->name */ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" @@ -62,7 +62,7 @@ void bpy_import_main_set(struct Main *maggie) /* returns a dummy filename for a textblock so we can tell what file a text block comes from */ void bpy_text_filename_get(char *fn, Text *text) { - sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2); + sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.main->name, text->id.name+2); /* XXX, this is a bug in python's Py_CompileString()! the string encoding should not be required to be utf-8 diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 9664a5b16f8..de16fba9a30 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -494,7 +494,7 @@ void filepath_qt(char *string, RenderData *rd) { if (string==0) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index a2f08d96251..7230e0b3909 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -452,7 +452,7 @@ static void render_unique_exr_name(Render *re, char *str, int sample) { char di[FILE_MAX], name[FILE_MAXFILE+MAX_ID_NAME+100], fi[FILE_MAXFILE]; - BLI_strncpy(di, G.sce, FILE_MAX); + BLI_strncpy(di, G.main->name, FILE_MAX); BLI_splitdirstring(di, fi); if(sample==0) @@ -2032,7 +2032,7 @@ static void load_backbuffer(Render *re) char name[256]; strcpy(name, re->r.backbuf); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); BLI_path_frame(name, re->r.cfra, 0); if(re->backbuf) { diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 66d2a1efdea..00a686c0d74 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -335,13 +335,10 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -/* note: G.sce is used to store the last saved path so backup and restore after loading - * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend - * ...this could be changed but seems better then setting to "" */ int WM_read_homefile(bContext *C, wmOperator *op) { ListBase wmbase; - char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; + char tstr[FILE_MAXDIR+FILE_MAXFILE]; int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0; int success; @@ -351,7 +348,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) if (!from_memory) { char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL); if (cfgdir) { - BLI_make_file_string(G.sce, tstr, cfgdir, BLENDER_STARTUP_FILE); + BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE); } else { tstr[0] = '\0'; from_memory = 1; @@ -360,7 +357,6 @@ int WM_read_homefile(bContext *C, wmOperator *op) } } } - strcpy(scestr, G.sce); /* temporary store */ /* prevent loading no UI */ G.fileflags &= ~G_FILE_NO_UI; @@ -383,7 +379,6 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_window_match_do(C, &wmbase); WM_check(C); /* opens window(s), checks keymaps */ - strcpy(G.sce, scestr); /* restore */ G.main->name[0]= '\0'; wm_init_userdef(C); @@ -440,9 +435,6 @@ void read_history(void) for (l= lines, num= 0; l && (numnext) { line = l->link; if (line[0] && BLI_exists(line)) { - if (num==0) - strcpy(G.sce, line); /* note: this seems highly dodgy since the file isnt actually read. please explain. - campbell */ - recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); BLI_addtail(&(G.recent_files), recent); recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(line)+1), "name of file"); @@ -468,14 +460,14 @@ static void write_history(void) recent = G.recent_files.first; /* refresh recent-files.txt of recent opened files, when current file was changed */ - if(!(recent) || (strcmp(recent->filepath, G.sce)!=0)) { + if(!(recent) || (strcmp(recent->filepath, G.main->name)!=0)) { fp= fopen(name, "w"); if (fp) { /* add current file to the beginning of list */ recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); - recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file"); + recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file"); recent->filepath[0] = '\0'; - strcpy(recent->filepath, G.sce); + strcpy(recent->filepath, G.main->name); BLI_addhead(&(G.recent_files), recent); /* write current file to recent-files.txt */ fprintf(fp, "%s\n", recent->filepath); @@ -484,7 +476,7 @@ static void write_history(void) /* write rest of recent opened files to recent-files.txt */ while((ifilepath, G.sce)!=0) { + if (strcmp(recent->filepath, G.main->name)!=0) { fprintf(fp, "%s\n", recent->filepath); recent = recent->next; } @@ -572,7 +564,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) int write_crash_blend(void) { char path[FILE_MAX]; - BLI_strncpy(path, G.sce, sizeof(path)); + BLI_strncpy(path, G.main->name, sizeof(path)); BLI_replace_extension(path, sizeof(path), "_crash.blend"); if(BLO_write_file(G.main, path, G.fileflags, NULL, NULL)) { printf("written: %s\n", path); @@ -634,7 +626,6 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) { if(!copy) { - strcpy(G.sce, di); G.relbase_valid = 1; strcpy(G.main->name, di); /* is guaranteed current file */ diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 983361f01ff..b319058ce5c 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -167,10 +167,10 @@ void WM_init(bContext *C, int argc, char **argv) read_history(); - if(G.sce[0] == 0) - BLI_make_file_string("/", G.sce, BLI_getDefaultDocumentFolder(), "untitled.blend"); + if(G.main->name[0] == 0) + BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend"); - BLI_strncpy(G.lib, G.sce, FILE_MAX); + BLI_strncpy(G.lib, G.main->name, FILE_MAX); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index ef3c8fb789e..de08c209d06 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1440,7 +1440,7 @@ static void open_set_use_scripts(wmOperator *op) static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); open_set_load_ui(op); open_set_use_scripts(op); @@ -1773,7 +1773,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUS save_set_compress(op); - BLI_strncpy(name, G.sce, FILE_MAX); + BLI_strncpy(name, G.main->name, FILE_MAX); untitled(name); RNA_string_set(op->ptr, "filepath", name); @@ -1794,7 +1794,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) if(RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", path); else { - BLI_strncpy(path, G.sce, FILE_MAX); + BLI_strncpy(path, G.main->name, FILE_MAX); untitled(path); } @@ -1859,7 +1859,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( save_set_compress(op); - BLI_strncpy(name, G.sce, FILE_MAX); + BLI_strncpy(name, G.main->name, FILE_MAX); untitled(name); RNA_string_set(op->ptr, "filepath", name); @@ -1905,7 +1905,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; - BLI_strncpy(filepath, G.sce, sizeof(filepath)); + BLI_strncpy(filepath, G.main->name, sizeof(filepath)); BLI_replace_extension(filepath, sizeof(filepath), ".dae"); RNA_string_set(op->ptr, "filepath", filepath); } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index fbc77d0d06d..69a29092058 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -45,6 +45,7 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" #include "BIF_gl.h" @@ -260,17 +261,15 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) else { /* this is set to 1 if you don't have startup.blend open */ - if(G.save_over) { - char *str= MEM_mallocN(strlen(G.sce) + 16, "title"); + if(G.save_over && G.main->name[0]) { + char str[sizeof(G.main->name) + 12]; if(wm->file_saved) - sprintf(str, "Blender [%s]", G.sce); + sprintf(str, "Blender [%s]", G.main->name); else - sprintf(str, "Blender* [%s]", G.sce); + sprintf(str, "Blender* [%s]", G.main->name); GHOST_SetTitle(win->ghostwin, str); - - MEM_freeN(str); } else GHOST_SetTitle(win->ghostwin, "Blender"); diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index d65993581b5..858a5964a52 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -141,10 +141,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c BlendFileData *bfd= NULL; BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); - BLI_strncpy(oldsce, G.sce, sizeof(oldsce)); + BLI_strncpy(oldsce, G.main->name, sizeof(oldsce)); #ifndef DISABLE_PYTHON resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path - setGamePythonPath(G.sce); + setGamePythonPath(G.main->name); // Acquire Python's GIL (global interpreter lock) // so we can safely run Python code and API calls @@ -309,10 +309,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c startscenename = bfd->curscene->id.name + 2; if(blenderdata) { - BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce)); + BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name)); BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); #ifndef DISABLE_PYTHON - setGamePythonPath(G.sce); + setGamePythonPath(G.main->name); #endif } } @@ -573,7 +573,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c if (bfd) BLO_blendfiledata_free(bfd); - BLI_strncpy(G.sce, oldsce, sizeof(G.sce)); + BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name)); #ifndef DISABLE_PYTHON Py_DECREF(pyGlobalDict); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index e1cd1c6d488..5e1e213c570 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -67,6 +67,7 @@ extern "C" { #include "DNA_windowmanager_types.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_bmfont.h" #include "BKE_image.h" @@ -247,7 +248,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename) dumprect= screenshot(curarea, &dumpsx, &dumpsy); if(dumprect) { ImBuf *ibuf; - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */ ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0); diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 9c0b5a24aeb..e9dfd2a6e26 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -821,8 +821,8 @@ int main(int argc, char** argv) app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ BLI_strncpy(pathname, maggie->name, sizeof(pathname)); - BLI_strncpy(G.sce, maggie->name, sizeof(G.sce)); - setGamePythonPath(G.sce); + BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name)); + setGamePythonPath(G.main->name); if (firstTimeRunning) { -- cgit v1.2.3 From a293f76cdf36220bf6f9027b5bbf75bc2cbb3def Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 06:52:10 +0000 Subject: Use DEBUG instead of NDEBUG --- intern/moto/include/MT_assert.h | 4 ++-- source/blender/blenlib/intern/path_util.c | 4 ++-- .../blender/readblenfile/stub/BLO_readblenfileSTUB.c | 10 +++++----- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 18 +++++++++--------- .../RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/intern/moto/include/MT_assert.h b/intern/moto/include/MT_assert.h index cc6f980efb4..a0e97e6ad34 100644 --- a/intern/moto/include/MT_assert.h +++ b/intern/moto/include/MT_assert.h @@ -48,7 +48,7 @@ MT_CDECL int MT_QueryAssert(const char *file, int line, const char *predicate, int *do_assert); -#ifdef NDEBUG +#if !defined(DEBUG) #define MT_assert(predicate) ((void)0) #define BREAKPOINT() ((void)0) #else @@ -93,7 +93,7 @@ abort(); } #endif /* windows */ -#endif /* NDEBUG */ +#endif /* !defined(DEBUG) */ #endif diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 23972c64ee1..61b525d50af 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1607,7 +1607,7 @@ void BLI_where_am_i(char *fullname, const char *name) } while (temp); } } -#ifndef NDEBUG +#if defined(DEBUG) if (strcmp(name, fullname)) { printf("guessing '%s' == '%s'\n", name, fullname); } @@ -1620,7 +1620,7 @@ void BLI_where_am_i(char *fullname, const char *name) // with spawnv(P_WAIT, bprogname, argv) instead of system() but // that's even uglier GetShortPathName(fullname, fullname, FILE_MAXDIR+FILE_MAXFILE); -#ifndef NDEBUG +#if defined(DEBUG) printf("Shortname = '%s'\n", fullname); #endif #endif diff --git a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c index 33e9bfec446..c5b523b106f 100644 --- a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c +++ b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c @@ -41,7 +41,7 @@ int BLO_read_runtime( char *file); BLO_readblenfilememory( char *fromBuffer, int fromBufferSize) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_readblenfilename is a stub\n"); #endif @@ -52,7 +52,7 @@ BLO_readblenfilememory( BLO_readblenfilename( char *fileName) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_readblenfilename is a stub\n"); #endif @@ -63,7 +63,7 @@ BLO_readblenfilename( BLO_readblenfilehandle( int fileHandle) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_readblenfilehandle is a stub\n"); #endif @@ -74,7 +74,7 @@ BLO_readblenfilehandle( BLO_is_a_runtime( char *file) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_is_a_runtime is a stub\n"); #endif @@ -85,7 +85,7 @@ BLO_is_a_runtime( BLO_read_runtime( char *file) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_read_runtime is a stub\n"); #endif diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index e9dfd2a6e26..94142e7a604 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -95,9 +95,9 @@ extern char btempdir[]; /* use this to store a valid temp directory */ #ifdef WIN32 #include -#ifdef NDEBUG +#if !defined(DEBUG) #include -#endif // NDEBUG +#endif // !defined(DEBUG) #endif // WIN32 const int kMinWindowWidth = 100; @@ -391,7 +391,7 @@ int main(int argc, char** argv) IMB_init(); // Parse command line options -#ifndef NDEBUG +#if defined(DEBUG) printf("argv[0] = '%s'\n", argv[0]); #endif @@ -438,7 +438,7 @@ int main(int argc, char** argv) ;) { -#ifndef NDEBUG +#if defined(DEBUG) printf("argv[%d] = '%s' , %i\n", i, argv[i],argc); #endif if (argv[i][0] == '-') @@ -469,7 +469,7 @@ int main(int argc, char** argv) SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i])); SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i])); SYS_WriteCommandLineString(syshandle, paramname, argv[i]); -#ifndef NDEBUG +#if defined(DEBUG) printf("%s = '%s'\n", paramname, argv[i]); #endif i++; @@ -542,9 +542,9 @@ int main(int argc, char** argv) printf("error: too few options for parent window argument.\n"); } -#ifndef NDEBUG +#if defined(DEBUG) printf("XWindows ID = %d\n", parentWindow); -#endif //NDEBUG +#endif // defined(DEBUG) #endif // _WIN32 case 'c': @@ -745,12 +745,12 @@ int main(int argc, char** argv) else { #ifdef WIN32 -#ifdef NDEBUG +#if !defined(DEBUG) if (closeConsole) { //::FreeConsole(); // Close a console window } -#endif // NDEBUG +#endif // !defined(DEBUG) #endif // WIN32 Main *maggie = bfd->main; Scene *scene = bfd->curscene; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp index 12a255b4e4e..d793a2faf7b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp @@ -13,7 +13,7 @@ #include "RAS_TexVert.h" #include "MT_assert.h" -//#ifndef NDEBUG +//#if defined(DEBUG) //#ifdef WIN32 //#define spit(x) std::cout << x << std::endl; //#endif //WIN32 -- cgit v1.2.3 From 8862afcb51c60ad0c5d0f077e25d8531728e2719 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 07:01:46 +0000 Subject: this should fix quicktime building from last commit. --- source/blender/quicktime/apple/quicktime_export.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index de16fba9a30..2623a598d5f 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -40,6 +40,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" -- cgit v1.2.3 From 6c505c97a7d0fa6628de0ee100635f66c8210d04 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 07:03:38 +0000 Subject: _DEBUG -> DEBUG --- intern/ghost/intern/GHOST_Debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h index d402aed63db..927ecfc88a5 100644 --- a/intern/ghost/intern/GHOST_Debug.h +++ b/intern/ghost/intern/GHOST_Debug.h @@ -35,10 +35,10 @@ #define _GHOST_DEBUG_H_ #if defined(WIN32) && !defined(FREE_WINDOWS) - #ifdef _DEBUG + #ifdef DEBUG #pragma warning (disable:4786) // suppress stl-MSVC debug info warning // #define GHOST_DEBUG - #endif // _DEBUG + #endif // DEBUG #endif // WIN32 #ifdef BF_GHOST_DEBUG -- cgit v1.2.3 From 9bd94eebc4d240203b89c7a0a3dfe800859ca636 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 07:24:08 +0000 Subject: _DEBUG -> DEBUG --- source/blender/blenkernel/SConscript | 2 +- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index bbc66ac14ea..954b7759b46 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -25,7 +25,7 @@ else: incs += ' ../python' incs += ' ' + env['BF_PYTHON_INC'] if env['BF_DEBUG']: - defs.append('_DEBUG') + defs.append('DEBUG') if env['WITH_BF_QUICKTIME']: incs += ' ../quicktime' diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index ec998e68e00..aae26da02dd 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -19,7 +19,7 @@ #include #include -#if defined(_WIN32) && defined(_DEBUG) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if defined(_WIN32) && defined(DEBUG) && !defined(__MINGW32__) && !defined(__CYGWIN__) /* This does not seem necessary or present on MSVC 8, but may be needed in earlier versions? */ #if _MSC_VER < 1400 #include -- cgit v1.2.3 From b7ad16983c8a105299d7fd3f17d4141b87d66f26 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 08:11:34 +0000 Subject: Camera object drawing now shows shift (not especially important but the tracker is being unusably slow) --- source/blender/editors/space_view3d/drawobject.c | 26 ++++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index c9b8a086d22..e7a69642e9f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1211,7 +1211,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob /* a standing up pyramid with (0,0,0) as top */ Camera *cam; World *wrld; - float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy; + float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy; int i; cam= ob->data; @@ -1233,6 +1233,8 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if(rv3d->persp>=2 && cam->type==CAM_ORTHO && ob==v3d->camera) { facx= 0.5*cam->ortho_scale*caspx; facy= 0.5*cam->ortho_scale*caspy; + shx= cam->shiftx * cam->ortho_scale; + shy= cam->shifty * cam->ortho_scale; depth= -cam->clipsta-0.1; } else { @@ -1242,13 +1244,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob depth= - fac*cam->lens/16.0; facx= fac*caspx; facy= fac*caspy; + shx= cam->shiftx*fac*2; + shy= cam->shifty*fac*2; } vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */ - vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth; - vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth; - vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth; - vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth; + vec[1][0]= shx + facx; vec[1][1]= shy + facy; vec[1][2]= depth; + vec[2][0]= shx + facx; vec[2][1]= shy - facy; vec[2][2]= depth; + vec[3][0]= shx - facx; vec[3][1]= shy - facy; vec[3][2]= depth; + vec[4][0]= shx - facx; vec[4][1]= shy + facy; vec[4][2]= depth; glBegin(GL_LINE_LOOP); glVertex3fv(vec[1]); @@ -1281,16 +1285,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if (i==0) glBegin(GL_LINE_LOOP); else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES); else break; - - vec[0][0]= -0.7 * cam->drawsize; - vec[0][1]= cam->drawsize * (caspy + 0.1); + + vec[0][0]= shx + (-0.7 * cam->drawsize); + vec[0][1]= shy + (cam->drawsize * (caspy + 0.1)); glVertex3fv(vec[0]); /* left */ - vec[0][0] *= -1.0; + vec[0][0]= shx + (0.7 * cam->drawsize); glVertex3fv(vec[0]); /* right */ - vec[0][0]= 0.0; - vec[0][1]= 1.1 * cam->drawsize * (caspy + 0.7); + vec[0][0]= shx; + vec[0][1]= shy + (1.1 * cam->drawsize * (caspy + 0.7)); glVertex3fv(vec[0]); /* top */ glEnd(); -- cgit v1.2.3 From c092a18fcbfead6ed2936c74f504ece9f08e96d2 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 18 Oct 2010 08:17:04 +0000 Subject: [#24209] Texture Forcefields: Use Object Coordinates produces incorrect results (patch included) * Original patch provided by Alexander Beels and modified a bit by me. --- source/blender/blenkernel/intern/effect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index f4fae3ed3c6..70e814ef956 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -264,6 +264,9 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector eff = new_effector_cache(scene, ob, NULL, ob->pd); + /* make sure imat is up to date */ + invert_m4_m4(ob->imat, ob->obmat); + BLI_addtail(*effectors, eff); } static void add_particles_to_effectors(ListBase **effectors, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src) @@ -774,7 +777,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP } if(eff->pd->flag & PFIELD_TEX_OBJECT) { - mul_m4_v3(eff->ob->obmat, tex_co); + mul_m4_v3(eff->ob->imat, tex_co); } hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result); -- cgit v1.2.3 From 9650667b3df2f39c35b7632720ff872265dfeaa5 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 18 Oct 2010 10:52:57 +0000 Subject: [#21475] Moving a Transform strip upwards moves its animation sidewards * F-Curve translation is now calculated from the difference of the strips original & resulting start time, instead of using the transform data directly. --- source/blender/editors/transform/transform_conversions.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5de08d7832c..d723f77f537 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2284,11 +2284,10 @@ void flushTransNodes(TransInfo *t) } /* *** SEQUENCE EDITOR *** */ -#define XXX_DURIAN_ANIM_TX_HACK void flushTransSeq(TransInfo *t) { ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */ - int a, new_frame; + int a, new_frame, old_start; TransData *td= NULL; TransData2D *td2d= NULL; TransDataSeq *tdsq= NULL; @@ -2305,16 +2304,11 @@ void flushTransSeq(TransInfo *t) for(a=0, td= t->data, td2d= t->data2d; atotal; a++, td++, td2d++) { tdsq= (TransDataSeq *)td->extra; seq= tdsq->seq; + old_start = seq->start; new_frame= (int)floor(td2d->loc[0] + 0.5f); switch (tdsq->sel_flag) { case SELECT: -#ifdef XXX_DURIAN_ANIM_TX_HACK - if (seq != seq_prev) { - int ofs = (new_frame - tdsq->start_offset) - seq->start; // breaks for single strips - color/image - seq_offset_animdata(t->scene, seq, ofs); - } -#endif if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ seq->start= new_frame - tdsq->start_offset; @@ -2345,6 +2339,9 @@ void flushTransSeq(TransInfo *t) else { calc_sequence_disp(t->scene, seq); } + + if(tdsq->sel_flag == SELECT) + seq_offset_animdata(t->scene, seq, seq->start - old_start); } seq_prev= seq; } @@ -3851,6 +3848,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list) * seq->depth must be set before running this function so we know if the strips * are root level or not */ +#define XXX_DURIAN_ANIM_TX_HACK static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag) { -- cgit v1.2.3 From 58683fa993e11d7bf888050e359b864f865d7c41 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 11:21:22 +0000 Subject: enable DEBUG define in CMake and scons, also change booleans debug option to BOP_DEBUG, which was used inconsistently, and had to add a define for superlu. --- CMakeLists.txt | 10 ++++-- build_files/scons/config/darwin-config.py | 2 +- build_files/scons/config/freebsd7-config.py | 2 +- build_files/scons/config/freebsd8-config.py | 2 +- build_files/scons/config/freebsd9-config.py | 2 +- build_files/scons/config/linux2-config.py | 2 +- build_files/scons/config/linuxcross-config.py | 2 +- build_files/scons/config/openbsd3-config.py | 2 +- build_files/scons/config/sunos5-config.py | 2 +- build_files/scons/config/win32-mingw-config.py | 2 +- intern/boolop/intern/BOP_Interface.cpp | 20 +++++------ intern/boolop/intern/BOP_Merge2.cpp | 46 +++++++++++++------------- intern/opennl/superlu/ssp_defs.h | 2 +- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenlib/BLI_math_matrix.h | 4 +-- source/blender/blenlib/intern/math_matrix.c | 4 +-- 16 files changed, 55 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9580d24be14..ffbc60d29de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,8 @@ IF(UNIX AND NOT APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") ENDIF(WITH_OPENMP) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing") @@ -550,9 +552,8 @@ IF(WIN32) ADD_DEFINITIONS(-DFREE_WINDOWS) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") - + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUG") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") @@ -796,6 +797,9 @@ IF(APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") ENDIF(WITH_OPENMP) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") + IF (WITH_OPENCOLLADA) SET(OPENCOLLADA ${LIBDIR}/opencollada) SET(OPENCOLLADA_INC ${OPENCOLLADA}/include) diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 1423e8fb392..f23d4a6390b 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -340,7 +340,7 @@ BF_PROFILE_LINKFLAGS = ['-pg'] BF_PROFILE = False BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] ############################################################################# ################### Output directories ################## diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py index 5678b4bda0a..afc71d01c94 100644 --- a/build_files/scons/config/freebsd7-config.py +++ b/build_files/scons/config/freebsd7-config.py @@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/freebsd7' BF_INSTALLDIR='../install/freebsd7' diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py index bc09e87d59f..d11618b6293 100644 --- a/build_files/scons/config/freebsd8-config.py +++ b/build_files/scons/config/freebsd8-config.py @@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/freebsd8' BF_INSTALLDIR='../install/freebsd8' diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py index 3fb4ebe7cd6..2aadbf0f960 100644 --- a/build_files/scons/config/freebsd9-config.py +++ b/build_files/scons/config/freebsd9-config.py @@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/freebsd9' BF_INSTALLDIR='../install/freebsd9' diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index fd42e61da0c..fd0364f9ce9 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -220,7 +220,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/linux2' BF_INSTALLDIR='../install/linux2' diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py index 1650201f8c6..263cfd89a8b 100644 --- a/build_files/scons/config/linuxcross-config.py +++ b/build_files/scons/config/linuxcross-config.py @@ -185,7 +185,7 @@ CC_WARN = [ '-Wall' ] LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++', '-luuid', '-lole32'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_PROFILE = False BF_PROFILE_CCFLAGS = ['-pg','-g'] diff --git a/build_files/scons/config/openbsd3-config.py b/build_files/scons/config/openbsd3-config.py index 0ef9ba5d0a4..65c2a1a2585 100644 --- a/build_files/scons/config/openbsd3-config.py +++ b/build_files/scons/config/openbsd3-config.py @@ -147,7 +147,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR='../build/openbsd3' BF_INSTALLDIR='../install/openbsd3' diff --git a/build_files/scons/config/sunos5-config.py b/build_files/scons/config/sunos5-config.py index a0713735a5b..168fb4271a8 100644 --- a/build_files/scons/config/sunos5-config.py +++ b/build_files/scons/config/sunos5-config.py @@ -161,7 +161,7 @@ BF_PROFILE_LINKFLAGS = ['-pg'] BF_PROFILE = False BF_DEBUG = False -BF_DEBUG_CCFLAGS = [] +BF_DEBUG_CCFLAGS = ['-DDEBUG'] BF_BUILDDIR = '../build/sunos5' BF_INSTALLDIR='../install/sunos5' diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index f8b67781172..7189522809e 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -176,7 +176,7 @@ CC_WARN = [ '-Wall' ] LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid'] BF_DEBUG = False -BF_DEBUG_CCFLAGS= ['-g'] +BF_DEBUG_CCFLAGS= ['-g', '-DDEBUG'] BF_PROFILE_CCFLAGS = ['-pg', '-g'] BF_PROFILE_LINKFLAGS = ['-pg'] diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp index 99116b7d87d..ff15751b797 100644 --- a/intern/boolop/intern/BOP_Interface.cpp +++ b/intern/boolop/intern/BOP_Interface.cpp @@ -80,7 +80,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, CSG_FaceIteratorDescriptor obBFaces, CSG_VertexIteratorDescriptor obBVertices) { - #ifdef DEBUG + #ifdef BOP_DEBUG cout << "BEGIN BOP_performBooleanOperation" << endl; #endif @@ -118,7 +118,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, // Invert the output mesh if is required *outputMesh = BOP_exportMesh(&meshC, invertMeshC); - #ifdef DEBUG + #ifdef BOP_DEBUG cout << "END BOP_performBooleanOperation" << endl; #endif @@ -141,7 +141,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, bool invertMeshA, bool invertMeshB) { - #ifdef DEBUG + #ifdef BOP_DEBUG BOP_Chrono chrono; float t = 0.0f; float c = 0.0f; @@ -156,7 +156,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, BOP_BSPTree bspB; bspB.addMesh(meshC, *facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Create BSP " << c << endl; #endif @@ -172,7 +172,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, if ((0.25*facesB->size()) > bspA.getDeep()) BOP_meshFilter(meshC, facesB, &bspA); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "mesh Filter " << c << endl; #endif @@ -180,7 +180,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, // Face 2 Face BOP_Face2Face(meshC,facesA,facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Face2Face " << c << endl; #endif @@ -189,7 +189,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, BOP_meshClassify(meshC,facesA,&bspB); BOP_meshClassify(meshC,facesB,&bspA); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Classification " << c << endl; #endif @@ -197,7 +197,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, // Process overlapped faces BOP_removeOverlappedFaces(meshC,facesA,facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Remove overlap " << c << endl; #endif @@ -205,7 +205,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, // Sew two meshes BOP_sew(meshC,facesA,facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Sew " << c << endl; #endif @@ -238,7 +238,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, #endif #endif - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Merge faces " << c << endl; cout << "Total " << t << endl; diff --git a/intern/boolop/intern/BOP_Merge2.cpp b/intern/boolop/intern/BOP_Merge2.cpp index ad9f832ef01..2ef8b5b30b7 100644 --- a/intern/boolop/intern/BOP_Merge2.cpp +++ b/intern/boolop/intern/BOP_Merge2.cpp @@ -70,7 +70,7 @@ void dumpmesh ( BOP_Mesh *m, bool force ) } if( nonmanifold ) cout << nonmanifold << " edges detected" << endl; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "---------------------------" << endl; BOP_Edges edges = m->getEdges(); @@ -130,7 +130,7 @@ void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v) { m_mesh = m; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "##############################" << endl; #endif cleanup( ); @@ -147,7 +147,7 @@ void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v) // ... and merge new faces if( cont ) cont = mergeFaces(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "called mergeFaces " << cont << endl; #endif // ... until the merge is not succesful @@ -186,7 +186,7 @@ void clean_nonmanifold( BOP_Mesh *m ) unsigned short facecount = 0; bool found = false; BOP_Indexs vertList; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " first edge is " << (*it) << endl; #endif vertList.push_back(first); @@ -214,7 +214,7 @@ void clean_nonmanifold( BOP_Mesh *m ) edge = NULL; } if( !edge ) break; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " next edge is " << edge << endl; #endif tmpface = m->getFace(edge->getFaces().front()); @@ -231,7 +231,7 @@ void clean_nonmanifold( BOP_Mesh *m ) } if(found) { edge = *it; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " --> found a loop" << endl; #endif if( vertList.size() == 3 ) { @@ -241,7 +241,7 @@ void clean_nonmanifold( BOP_Mesh *m ) BOP_Face4 *face = (BOP_Face4 *)m->getFace(edge->getFaces().front()); face->getNeighbours(first,last,next,last); } else { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "loop has " << vertList.size() << "verts"; #endif continue; @@ -253,7 +253,7 @@ void clean_nonmanifold( BOP_Mesh *m ) BOP_Face3 *f = new BOP_Face3(next,first,last, oface1->getPlane(),oface1->getOriginalFace()); m->addFace( f ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " face is backward: " << f << endl; #endif @@ -261,7 +261,7 @@ void clean_nonmanifold( BOP_Mesh *m ) BOP_Face3 *f = new BOP_Face3(last,first,next, oface1->getPlane(),oface1->getOriginalFace()); m->addFace( f ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " face is forward: " << f << endl; #endif } @@ -366,7 +366,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) BOP_LFaces facesByOriginalFace; BOP_Index v = mergeVertices[i]; BOP_Vertex *vert = m_mesh->getVertex(v); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "i = " << i << ", v = " << v << ", vert = " << vert << endl; if (v==48) cout << "found vert 48" << endl; @@ -381,7 +381,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) vert->setTAG(BROKEN); break; case 2: { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "size of fBOF = " << facesByOriginalFace.size() << endl; #endif BOP_Faces ff = facesByOriginalFace.front(); @@ -391,7 +391,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) // look for two edges adjacent to v which contain both ofaces BOP_Indexs edges = vert->getEdges(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " ff has " << ff.size() << " faces" << endl; cout << " fb has " << fb.size() << " faces" << endl; cout << " v has " << edges.size() << " edges" << endl; @@ -400,14 +400,14 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) ++it ) { BOP_Edge *edge = m_mesh->getEdge(*it); BOP_Indexs faces = edge->getFaces(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " " << edge << " has " << edge->getFaces().size() << " faces" << endl; #endif if( faces.size() == 2 ) { BOP_Face *f0 = m_mesh->getFace(faces[0]); BOP_Face *f1 = m_mesh->getFace(faces[1]); if( f0->getOriginalFace() != f1->getOriginalFace() ) { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " " << f0 << endl; cout << " " << f1 << endl; #endif @@ -416,14 +416,14 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) } } if(ecount == 2) { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " edge indexes are " << eindexs[0]; cout << " and " << eindexs[1] << endl; #endif BOP_Edge *edge = m_mesh->getEdge(eindexs[0]); BOP_Index N = edge->getVertex1(); if(N == v) N = edge->getVertex2(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " ## OK, replace "<setTAG(BROKEN); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " breaking " << (*face) << endl; #endif } @@ -506,7 +506,7 @@ void BOP_Merge2::mergeVertex(BOP_Face3 *face, BOP_Index v1, BOP_Index v2) if( prev != v2 && next != v2 ) { m_mesh->addFace( new BOP_Face3(prev,v2,next, face->getPlane(),face->getOriginalFace()) ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "mv3: add " << prev << "," << v2 << "," << next << endl; } else { cout << "mv3: vertex already in tri: doing nothing" << endl; @@ -524,7 +524,7 @@ void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2) if( prev == v2 || next == v2 ) { m_mesh->addFace( new BOP_Face3(prev,next,opp, face->getPlane(),face->getOriginalFace()) ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "mv4a: add " << prev << "," << next << "," << opp << endl; #endif } @@ -532,7 +532,7 @@ void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2) else { m_mesh->addFace( new BOP_Face4(prev,v2,next,opp, face->getPlane(),face->getOriginalFace()) ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "mv4b: add "< Date: Mon, 18 Oct 2010 11:37:53 +0000 Subject: bugfix [#24306] Python : relative import error --- source/blender/python/generic/bpy_internal_import.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 6d42c794583..3ee0c76a44a 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -198,18 +198,18 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObjec char *name; int found= 0; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; - PyObject *newmodule; + int level= -1; /* relative imports */ + PyObject *newmodule; //PyObject_Print(args, stderr, 0); - int dummy_val; /* what does this do?*/ static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0}; if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist, - &name, &globals, &locals, &fromlist, &dummy_val) ) + &name, &globals, &locals, &fromlist, &level) ) return NULL; /* import existing builtin modules or modules that have been imported already */ - newmodule = PyImport_ImportModuleEx( name, globals, locals, fromlist ); + newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level); if(newmodule) return newmodule; -- cgit v1.2.3 From 6d0d688943b6f27c8069cd6e774322a7e1ee642f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 12:35:40 +0000 Subject: define NDEBUG for release builds so assert() is disabled. --- CMakeLists.txt | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffbc60d29de..39dc85cc15a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,9 +313,6 @@ IF(UNIX AND NOT APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") ENDIF(WITH_OPENMP) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") - SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing") SET(PLATFORM_LINKFLAGS "-pthread") @@ -333,7 +330,7 @@ IF(WIN32) # this file is included anyway when building under Windows with cl.exe # INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) - + SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows) # Setup 64bit and 64bit windows systems @@ -488,7 +485,7 @@ IF(WIN32) SET(LCMS_LIBPATH ${LCMS}/lib) SET(LCMS_LIB lcms) ENDIF(WITH_LCMS) - + IF(WITH_FFMPEG) SET(FFMPEG ${LIBDIR}/ffmpeg) SET(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc) @@ -539,7 +536,7 @@ IF(WIN32) ELSE(CMAKE_CL_64) SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ") ENDIF(CMAKE_CL_64) - + SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ") ELSE(MSVC) # MINGW @@ -552,18 +549,8 @@ IF(WIN32) ADD_DEFINITIONS(-DFREE_WINDOWS) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUG") - - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") - - SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG") - SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") - - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG") - + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") IF(WITH_OPENMP) SET(LLIBS "${LLIBS} -lgomp") @@ -797,9 +784,6 @@ IF(APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") ENDIF(WITH_OPENMP) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") - IF (WITH_OPENCOLLADA) SET(OPENCOLLADA ${LIBDIR}/opencollada) SET(OPENCOLLADA_INC ${OPENCOLLADA}/include) @@ -925,6 +909,22 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) #----------------------------------------------------------------------------- # Extra compile flags + +IF((NOT WIN32) AND (NOT MSVC)) + # used for internal debug checks + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") + + # assert() checks for this. + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") + SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") + + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") + SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG") +ENDIF(NOT WIN32 AND NOT MSVC) + IF(CMAKE_COMPILER_IS_GNUCC) SET(C_WARNINGS "${C_WARNINGS} -Wunused-parameter -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type") ENDIF(CMAKE_COMPILER_IS_GNUCC) -- cgit v1.2.3 From 799fc68234bbb8731439b8ecf3f782f69b11795c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 12:56:14 +0000 Subject: cflags, cxxflags & linkflags in buildinfo. --- CMakeLists.txt | 2 +- source/blender/python/intern/bpy_app.c | 12 ++++++++++++ source/creator/CMakeLists.txt | 3 +++ source/creator/buildinfo.c | 11 +++++++++++ source/creator/creator.c | 9 +++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39dc85cc15a..39ef55f351f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -923,7 +923,7 @@ IF((NOT WIN32) AND (NOT MSVC)) SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG") -ENDIF(NOT WIN32 AND NOT MSVC) +ENDIF((NOT WIN32) AND (NOT MSVC)) IF(CMAKE_COMPILER_IS_GNUCC) SET(C_WARNINGS "${C_WARNINGS} -Wunused-parameter -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type") diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 46a3c93292b..39494678a12 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -39,6 +39,9 @@ extern char build_time[]; extern char build_rev[]; extern char build_platform[]; extern char build_type[]; +extern char build_cflags[]; +extern char build_cxxflags[]; +extern char build_linkflags[]; #endif static PyTypeObject BlenderAppType; @@ -55,6 +58,9 @@ static PyStructSequence_Field app_info_fields[] = { {"build_revision", "The subversion revision this blender instance was built with"}, {"build_platform", "The platform this blender instance was built for"}, {"build_type", "The type of build (Release, Debug)"}, + {"build_cflags", ""}, + {"build_cxxflags", ""}, + {"build_linkflags", ""}, {0} }; @@ -96,12 +102,18 @@ static PyObject *make_app_info(void) SetStrItem(build_rev); SetStrItem(build_platform); SetStrItem(build_type); + SetStrItem(build_cflags); + SetStrItem(build_cxxflags); + SetStrItem(build_linkflags); #else SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index f2ea4d3dc75..65099761fad 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -101,6 +101,9 @@ IF(WITH_BUILDINFO) -DBUILD_REV="${BUILD_REV}" -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}" -DBUILD_TYPE="${CMAKE_BUILD_TYPE}" + -DBUILD_CFLAGS="${CMAKE_C_FLAGS}" + -DBUILD_CXXFLAGS="${CMAKE_CXX_FLAGS}" + -DBUILD_LINKFLAGS="${PLATFORM_LINKFLAGS}" ) LIST(APPEND EXESRC buildinfo.c) diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index a14cb94b859..cf6f5a11c45 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -35,4 +35,15 @@ char build_time[]= STRINGIFY(BUILD_TIME); char build_rev[]= STRINGIFY(BUILD_REV); char build_platform[]= STRINGIFY(BUILD_PLATFORM); char build_type[]= STRINGIFY(BUILD_TYPE); + +#ifdef BUILD_CFLAGS +char build_cflags[]= STRINGIFY(BUILD_CFLAGS); +char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS); +char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS); +#else +char build_cflags[]= "unmaintained buildsystem alert!"; +char build_cxxflags[]= "unmaintained buildsystem alert!"; +char build_linkflags[]= "unmaintained buildsystem alert!"; #endif + +#endif // BUILD_DATE diff --git a/source/creator/creator.c b/source/creator/creator.c index 26835eb28da..fce71edcced 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -118,6 +118,9 @@ extern char build_time[]; extern char build_rev[]; extern char build_platform[]; extern char build_type[]; +extern char build_cflags[]; +extern char build_cxxflags[]; +extern char build_linkflags[]; #endif /* Local Function prototypes */ @@ -184,6 +187,9 @@ static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(dat printf ("\tbuild revision: %s\n", build_rev); printf ("\tbuild platform: %s\n", build_platform); printf ("\tbuild type: %s\n", build_type); + printf ("\tbuild c flags: %s\n", build_cflags); + printf ("\tbuild c++ flags: %s\n", build_cxxflags); + printf ("\tbuild link flags: %s\n", build_linkflags); #endif exit(0); @@ -1045,6 +1051,9 @@ int main(int argc, char **argv) strip_quotes(build_rev); strip_quotes(build_platform); strip_quotes(build_type); + strip_quotes(build_cflags); + strip_quotes(build_cxxflags); + strip_quotes(build_linkflags); #endif BLI_threadapi_init(); -- cgit v1.2.3 From b1e8d168d7067dcb087dec55841d5069b61da043 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 13:16:43 +0000 Subject: recent fix for relative imports broke autocomp. --- release/scripts/modules/console/intellisense.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/scripts/modules/console/intellisense.py b/release/scripts/modules/console/intellisense.py index 0f9acf9b6a9..d76c5d0ad60 100644 --- a/release/scripts/modules/console/intellisense.py +++ b/release/scripts/modules/console/intellisense.py @@ -75,10 +75,10 @@ def complete(line, cursor, namespace, private=True): # unquoted word -> module or attribute completion word = re_unquoted_word.group(1) if RE_MODULE.match(line): - import complete_import + from . import complete_import matches = complete_import.complete(line) else: - import complete_namespace + from . import complete_namespace matches = complete_namespace.complete(word, namespace, private) else: # for now we don't have completers for strings @@ -112,7 +112,7 @@ def expand(line, cursor, namespace, private=True): 'abs(number) -> number\\nReturn the absolute value of the argument.' """ if line[:cursor].strip().endswith('('): - import complete_calltip + from . import complete_calltip matches, word, scrollback = complete_calltip.complete(line, cursor, namespace) no_calltip = False -- cgit v1.2.3 From 77867dfab1324283990bde06ca2395511f12e028 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 13:22:34 +0000 Subject: remove annoying warnings for blenderplayers stub.c --- source/blenderplayer/bad_level_call_stubs/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index 50be3c91dbe..473cc823f12 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# this warning on generated files gets annoying +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + FILE(GLOB SRC stubs.c) IF(WITH_BUILDINFO) -- cgit v1.2.3 From bf09c851a97aba67b19a5fc85a91d874e28d1df1 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Mon, 18 Oct 2010 17:55:11 +0000 Subject: quick commit for forgotten file in the G.sce -> G.main->name refactoring. Patch by Jens Verwiebe, many thanks. --- source/blender/quicktime/apple/qtkit_export.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 73e23ea8abd..14a1163ee9a 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -41,6 +41,7 @@ #include "AUD_C-API.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_scene.h" #include "BKE_report.h" @@ -208,7 +209,7 @@ void makeqtstring (RenderData *rd, char *string) { char txt[64]; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); @@ -222,7 +223,7 @@ void filepath_qt(char *string, RenderData *rd) { if (string==NULL) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); -- cgit v1.2.3 From d5f160d1e82f556cc7ad4646104ee09b07967fa8 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 20:32:11 +0000 Subject: Mangle unused parameter names also on non-GCC platforms. This should help in situations where a coder starts using the previously unused tagged parameter after all, reminding the coder to remove the tag and check further. --- source/blender/blenkernel/BKE_utildefines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 33ab6c36b74..8359bfdb01b 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -49,7 +49,7 @@ #ifdef __GNUC__ # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) #else -# define UNUSED(x) x +# define UNUSED(x) UNUSED_ ## x #endif /* these values need to be hardcoded in structs, dna does not recognize defines */ -- cgit v1.2.3 From 6e77dc19428a7887c6bee80f2485cb4628d03b78 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 20:33:04 +0000 Subject: whitespace commit, AKA commit count bump. --- build_files/scons/config/win64-vc-config.py | 2 +- source/creator/creator.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 8987d66a7a0..78d90187abf 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -172,7 +172,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast'] BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] -CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE'] +CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE'] REL_CFLAGS = ['-O2', '-DNDEBUG'] REL_CCFLAGS = ['-O2', '-DNDEBUG'] REL_CXXFLAGS = ['-O2', '-DNDEBUG'] diff --git a/source/creator/creator.c b/source/creator/creator.c index fce71edcced..117efe6bba6 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1046,14 +1046,14 @@ int main(int argc, char **argv) BLI_where_am_i(bprogname, argv[0]); #ifdef BUILD_DATE - strip_quotes(build_date); - strip_quotes(build_time); - strip_quotes(build_rev); - strip_quotes(build_platform); - strip_quotes(build_type); - strip_quotes(build_cflags); - strip_quotes(build_cxxflags); - strip_quotes(build_linkflags); + strip_quotes(build_date); + strip_quotes(build_time); + strip_quotes(build_rev); + strip_quotes(build_platform); + strip_quotes(build_type); + strip_quotes(build_cflags); + strip_quotes(build_cxxflags); + strip_quotes(build_linkflags); #endif BLI_threadapi_init(); -- cgit v1.2.3 From f08a9dfd8a9b7d6ba10d764f087c5bbd3ff1013d Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 20:41:52 +0000 Subject: Add operator for toggling cmd box on Windows. Use through search menu (Toggle System Console) or call bpy.ops.wm.toggle_console(). This is based on patch [#6927] Optional Console for Windows by Fahrezal Effendi, submitted on July 10th, 2007 (!) This paves the way for adding a command-line option to Blender to toggle this cmd console, and for having a user preference option for this. Command-line option I haven't added yet, as there seemed to be problems with Python interpreter initialization (read: crashes). This works by redirecting stdout and stderr to blenderlog.txt in user temp directory (most likely %TEMP%\blenderlog.txt). When python problem is fixed we can use this to always redirect stdout and stderr to this logfile, making it also easier for us to ask users for this file in bugreports. --- source/blender/windowmanager/WM_api.h | 9 +++- source/blender/windowmanager/intern/wm_operators.c | 62 +++++++++++++++++++++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 197f99b989e..2a36e91ac66 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -119,7 +119,7 @@ wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier); -void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi); +void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi); char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len); wmKeyMap *WM_keymap_list_find(ListBase *lb, char *idname, int spaceid, int regionid); @@ -220,7 +220,7 @@ struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType * int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot); int WM_operator_call (struct bContext *C, struct wmOperator *op); int WM_operator_repeat (struct bContext *C, struct wmOperator *op); -int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties); +int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties); int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports); void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */ @@ -342,6 +342,11 @@ void WM_clipboard_text_set(char *buf, int selection); void WM_progress_set(struct wmWindow *win, float progress); void WM_progress_clear(struct wmWindow *win); +#ifdef WIN32 + /* Windows System Console */ +void WM_toggle_console(struct bContext *C, short show); +#endif + #ifdef __cplusplus } #endif diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index de08c209d06..ccdb19adfce 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -31,7 +31,10 @@ #include #include #include - +#ifdef WIN32 +#include +#include +#endif #include "DNA_ID.h" #include "DNA_object_types.h" @@ -2007,6 +2010,60 @@ static void WM_OT_quit_blender(wmOperatorType *ot) ot->poll= WM_operator_winactive; } +/* *********************** */ +#ifdef WIN32 +static int console= 1; +void WM_toggle_console(bContext *C, short show) +{ + if(show) { + FILE *fp; + char fn[FILE_MAX]; + char tmp[FILE_MAXDIR]; + BLI_where_is_temp(tmp, 1); + BLI_make_file_string("/", fn, tmp, "blenderlog.txt"); + /* open the console */ + AllocConsole(); + + /* redirect stdin */ + fp= freopen(fn, "r", stdin); + SetStdHandle(STD_INPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdin))); + /* redirect stdout */ + fp= freopen(fn, "w", stdout); + SetStdHandle(STD_OUTPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdout))); + /* redirect stderr */ + fp= freopen(fn, "w", stderr); + SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(_fileno(stderr))); + + console= 1; + } + else { + FreeConsole(); + console= 0; + } +} + +static int wm_toggle_console_op(bContext *C, wmOperator *op) +{ + if(console) { + WM_toggle_console(C, 0); + } + else { + WM_toggle_console(C, 1); + } + return OPERATOR_FINISHED; +} + +static void WM_OT_toggle_console(wmOperatorType *ot) +{ + ot->name= "Toggle System Console"; + ot->idname= "WM_OT_toggle_console"; + ot->description= "Toggle System Console"; + + ot->exec= wm_toggle_console_op; + ot->poll= WM_operator_winactive; +} +#endif + /* ************ default paint cursors, draw always around cursor *********** */ /* - returns handler to free @@ -3079,6 +3136,9 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_splash); WM_operatortype_append(WM_OT_search_menu); WM_operatortype_append(WM_OT_call_menu); +#ifdef WIN32 + WM_operatortype_append(WM_OT_toggle_console); +#endif #ifdef WITH_COLLADA /* XXX: move these */ -- cgit v1.2.3 From b743454ce1c361e6161da8ae5f840c2befe3a081 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 18 Oct 2010 22:37:21 +0000 Subject: Add Toggle System Console entry to Help menu on Windows systems. --- release/scripts/ui/space_info.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index b0e8dbab0b3..d9ddc4a470b 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -347,6 +347,9 @@ class INFO_MT_help(bpy.types.Menu): layout.operator("help.operator_cheat_sheet", icon='TEXT') layout.operator("wm.sysinfo", icon='TEXT') layout.separator() + if bpy.app.build_platform[0:7] == 'Windows': + layout.operator("wm.toggle_console", icon='CONSOLE') + layout.separator() layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP') layout.separator() layout.operator("wm.splash") -- cgit v1.2.3