From 6b7b81220808203c9a778df3b4585a77a8096f10 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 18 Sep 2008 16:43:31 +0000 Subject: This file did not compile, but is also not part of the build target... Fixed neverheless, patch #6258 from Early Ehlinger --- source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp b/source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp index 6d9b41e08d2..2e8ee31058f 100644 --- a/source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp +++ b/source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp @@ -198,7 +198,7 @@ int ODEPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl } -void ODEPhysicsEnvironment::removeConstraint(int constraintid) +void ODEPhysicsEnvironment::removeConstraint(void *constraintid) { if (constraintid) { -- cgit v1.2.3 From f7113fd267864a081b7e4640dd14f4fca835a5a4 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 18 Sep 2008 17:19:40 +0000 Subject: Reactor particles were born with incorrect timing. Some changes made could effect normal particles too, but after many tests I didn't notice any adverse effects. Be sure to poke me hard if there are some though :) --- source/blender/blenkernel/intern/particle_system.c | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index a0c4bd91da4..07b709efcbe 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2110,22 +2110,18 @@ static void react_to_events(ParticleSystem *psys, int pa_num) for(re=psys->reactevents.first; re; re=re->next){ birth=0; if(part->from==PART_FROM_PARTICLE){ - if(pa->num==re->pa_num){ + if(pa->num==re->pa_num && pa->alive==PARS_UNBORN){ if(re->event==PART_EVENT_NEAR){ ParticleData *tpa = re->psys->particles+re->pa_num; float pa_time=tpa->time + pa->foffset*tpa->lifetime; - if(re->time > pa_time){ - pa->alive=PARS_ALIVE; + if(re->time >= pa_time){ pa->time=pa_time; pa->dietime=pa->time+pa->lifetime; } } else{ - if(pa->alive==PARS_UNBORN){ - pa->alive=PARS_ALIVE; - pa->time=re->time; - pa->dietime=pa->time+pa->lifetime; - } + pa->time=re->time; + pa->dietime=pa->time+pa->lifetime; } } } @@ -2133,7 +2129,6 @@ static void react_to_events(ParticleSystem *psys, int pa_num) dist=VecLenf(pa->state.co, re->state.co); if(dist <= re->size){ if(pa->alive==PARS_UNBORN){ - pa->alive=PARS_ALIVE; pa->time=re->time; pa->dietime=pa->time+pa->lifetime; birth=1; @@ -3127,6 +3122,10 @@ static void deflect_particle(Object *pob, ParticleSystemModifierData *psmd, Part if(through == 0 && (part->flag & PART_DIE_ON_COL || pd->flag & PDEFLE_KILL_PART)) { pa->alive = PARS_DYING; pa->dietime = pa->state.time + (cfra - pa->state.time) * dt; + + /* we have to add this for dying particles too so that reactors work correctly */ + VECADDFAC(co, co, col.nor, (through ? -0.0001f : 0.0001f)); + VECCOPY(state->co, co); VecLerpf(state->vel, pa->state.vel, state->vel, dt); QuatInterpol(state->rot, pa->state.rot, state->rot, dt); @@ -4061,9 +4060,11 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi pa_dfra = dfra; pa_dtime = dtime; + /* we need to calculate this once again because reactions might have changed pa->time */ + birthtime = pa->time + pa->loop * pa->lifetime; dietime = birthtime + pa->lifetime; - if(birthtime < cfra && birthtime >= psys->cfra){ + if(birthtime <= cfra && birthtime >= psys->cfra){ /* particle is born some time between this and last step*/ pa->alive = PARS_ALIVE; pa_dfra = cfra - birthtime; @@ -4103,8 +4104,6 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi } } - push_reaction(ob,psys,p,PART_EVENT_NEAR,key); - if(pa->alive == PARS_DYING){ push_reaction(ob,psys,p,PART_EVENT_DEATH,key); @@ -4124,6 +4123,8 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi } else key->time=cfra; + + push_reaction(ob,psys,p,PART_EVENT_NEAR,key); } } } -- cgit v1.2.3 From a283e7e4af8b1016ac2162cdb0f7b2cc10f94376 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 18 Sep 2008 17:42:17 +0000 Subject: A typo in my fix for bug #11740 caused problems with at least grid distributed particles. --- source/blender/blenkernel/intern/particle_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 07b709efcbe..11e69262bbe 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -156,7 +156,7 @@ void psys_reset(ParticleSystem *psys, int mode) int p=0; for(; ptotpart; p++, pa++) - pa->flag = PARS_NO_DISP; + pa->flag |= PARS_NO_DISP; } /* reset children */ -- cgit v1.2.3 From 02a91ac784d2d4f612dcd3a7772d0f1b26b56166 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Thu, 18 Sep 2008 19:28:28 +0000 Subject: BGE patch: change constraint location actuator to work in local coordinates. It won't change anything for root objects but will be of some use for child objects. --- source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index 4b57b0e8c54..e0c9af5ae60 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -359,7 +359,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) case KX_ACT_CONSTRAINT_LOCX: case KX_ACT_CONSTRAINT_LOCY: case KX_ACT_CONSTRAINT_LOCZ: - newposition = position; + newposition = position = obj->GetSGNode()->GetLocalPosition(); switch (m_locrot) { case KX_ACT_CONSTRAINT_LOCX: Clamp(newposition[0], m_minimumBound, m_maximumBound); @@ -375,7 +375,8 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) if (m_posDampTime) { newposition = filter*position + (1.0-filter)*newposition; } - break; + obj->NodeSetLocalPosition(newposition); + goto CHECK_TIME; } if (result) { // set the new position but take into account parent if any -- cgit v1.2.3 From 5f25e52c20298dc7ac7e13bbe62f6055cde89b02 Mon Sep 17 00:00:00 2001 From: unclezeiv Date: Thu, 18 Sep 2008 20:37:11 +0000 Subject: [#7297] Fix knife visualization on MacMini Intel w/ Intel gfx --- source/blender/src/editmesh_loop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/src/editmesh_loop.c b/source/blender/src/editmesh_loop.c index 2c5386b86b6..138dd93e490 100644 --- a/source/blender/src/editmesh_loop.c +++ b/source/blender/src/editmesh_loop.c @@ -519,6 +519,7 @@ static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash glDrawBuffer(GL_FRONT); headerprint("(LMB) draw, (MMB) constrain to x/y screen axis, (Enter) cut (with Ctrl to select cut line), (Esc) cancel"); } + bglFlush(); persp(PERSP_WIN); @@ -620,14 +621,14 @@ static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash if ((i>1)&&(i!=lasti)) { /*Draw recorded part of curve */ sdrawline((int)curve[i-2].x, (int)curve[i-2].y, (int)curve[i-1].x, (int)curve[i-1].y); - glFlush(); + bglFlush(); } if ((i==lasti)&&(i>0)) { /*Draw rubberband */ glLineWidth(2.0); sdrawXORline((int)curve[i-1].x, (int)curve[i-1].y,(int)mval[0], (int)mval[1]); glLineWidth(1.0); - glFlush(); + bglFlush(); rubberband=1; } lasti=i; -- cgit v1.2.3 From ec6bd008c1899986c619ce1976709eac1c1c1e0c Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Thu, 18 Sep 2008 21:18:53 +0000 Subject: fixing scons build. needed BoolOption in argument definition --- tools/btools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/btools.py b/tools/btools.py index ffefef06a5a..8fb38646432 100755 --- a/tools/btools.py +++ b/tools/btools.py @@ -258,7 +258,7 @@ def read_opts(cfg, args): ('BF_WINTAB', 'WinTab base dir', ''), ('BF_WINTAB_INC', 'WinTab include dir', ''), ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''), - ('WITH_BF_STATICCXX', 'static link to stdc++', 'false'), + (BoolOption('WITH_BF_STATICCXX', 'static link to stdc++', 'false')), ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''), ## ##WITH_BF_NSPR = 'true' -- cgit v1.2.3 From 6ff74f45279aeea88fa9a93ba0ced726fdeafc5a Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Thu, 18 Sep 2008 22:33:49 +0000 Subject: == Python Script Links == Bug #17599: Summary: Python constraints, good in 2.46 not working anymore in 2.47 http://projects.blender.org/tracker/?func=detail&atid=125&aid=17599&group_id=9 Improved my old hack to avoid frame changed scriptlinks from running when rendering stills, should fix this bug. It also causes REDRAW scriptlinks to be executed during renders, but that conforms to how FRAMECHANGED ones work. BTW: this can still be improved. The current system meant to disable all Python functionality at once needs imo to be replaced by one that allows to enable / disable per feature (scriptlinks, pyconstraints, pynodes, etc.). A better way to inform scriptlinks about what is going on (render, anim, render anim, etc.) would also help. Will discuss with others. --- source/blender/blenkernel/BKE_bad_level_calls.h | 2 +- .../blender/blenkernel/bad_level_call_stubs/stubs.c | 2 +- source/blender/blenkernel/intern/scene.c | 6 +++--- source/blender/python/BPY_extern.h | 2 +- source/blender/python/BPY_interface.c | 11 ++++++++++- source/blender/python/api2_2x/sceneRender.c | 17 +++++------------ source/blender/src/renderwin.c | 15 ++++----------- source/creator/creator.c | 19 +++++-------------- 8 files changed, 30 insertions(+), 44 deletions(-) diff --git a/source/blender/blenkernel/BKE_bad_level_calls.h b/source/blender/blenkernel/BKE_bad_level_calls.h index 8dee9a27f49..0b623526562 100644 --- a/source/blender/blenkernel/BKE_bad_level_calls.h +++ b/source/blender/blenkernel/BKE_bad_level_calls.h @@ -141,7 +141,7 @@ short pupmenu(char *instr); // will be general callback /* scene.c */ #include "DNA_sequence_types.h" void free_editing(struct Editing *ed); // scenes and sequences problem... -void BPY_do_all_scripts (short int event); +void BPY_do_all_scripts (short int event, short int anim); int BPY_call_importloader(char *name); diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c index f4beca262d7..ae336d0fc26 100644 --- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c +++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c @@ -201,7 +201,7 @@ short pupmenu(char *instr){ return 0;} // will be general callback /* scene.c */ #include "DNA_sequence_types.h" void free_editing(struct Editing *ed){} // scenes and sequences problem... -void BPY_do_all_scripts (short int event){} +void BPY_do_all_scripts (short int event, short int anim){} /*editmesh_lib.c*/ void EM_select_face(struct EditFace *efa, int sel) {} diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 553107dd264..701e8ecb311 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -350,7 +350,7 @@ void set_scene_bg(Scene *sce) /* no full animation update, this to enable render code to work (render code calls own animation updates) */ /* do we need FRAMECHANGED in set_scene? */ -// if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED); +// if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0); } /* called from creator.c */ @@ -570,8 +570,8 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) /* object ipos are calculated in where_is_object */ do_all_data_ipos(); - if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED); - + if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0); + /* sets first, we allow per definition current scene to have dependencies on sets */ for(sce= sce->set; sce; sce= sce->set) scene_update(sce, lay); diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 4b96ef3fdf0..146093d6b99 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -100,7 +100,7 @@ extern "C" { void BPY_clear_bad_scriptlinks( struct Text *byebye ); int BPY_has_onload_script( void ); - void BPY_do_all_scripts( short event ); + void BPY_do_all_scripts( short event, short anim ); int BPY_check_all_scriptlinks( struct Text *text ); void BPY_do_pyscript( struct ID *id, short event ); void BPY_free_scriptlink( struct ScriptLink *slink ); diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 041ba069928..c0dab4df651 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -2163,8 +2163,14 @@ void BPY_clear_bad_scriptlinks( struct Text *byebye ) * For the scene, only the current active scene the scripts are * executed (if any). *****************************************************************************/ -void BPY_do_all_scripts( short event ) +void BPY_do_all_scripts( short event, short anim ) { + /* during stills rendering we disable FRAMECHANGED events */ + static char disable_frame_changed = 0; + + if ((event == SCRIPT_FRAMECHANGED) && disable_frame_changed) + return; + DoAllScriptsFromList( &( G.main->object ), event ); DoAllScriptsFromList( &( G.main->lamp ), event ); DoAllScriptsFromList( &( G.main->camera ), event ); @@ -2180,9 +2186,12 @@ void BPY_do_all_scripts( short event ) * "import sys; sys.setcheckinterval(sys.maxint)" */ if (event == SCRIPT_RENDER) { _Py_CheckInterval = PyInt_GetMax(); + if (!anim) + disable_frame_changed = 1; } else if (event == SCRIPT_POSTRENDER) { _Py_CheckInterval = 100; /* Python default */ + disable_frame_changed = 0; } return; diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 22e165cbe9f..7958e66b44f 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -481,7 +481,6 @@ PyObject *RenderData_Render( BPy_RenderData * self ) set_scene( oldsce ); } else { /* background mode (blender -b file.blend -P script) */ - int slink_flag = 0; Render *re= RE_NewRender(G.scene->id.name); int end_frame = G.scene->r.efra; @@ -492,20 +491,14 @@ PyObject *RenderData_Render( BPy_RenderData * self ) G.scene->r.efra = G.scene->r.sfra; - if (G.f & G_DOSCRIPTLINKS) { - BPY_do_all_scripts(SCRIPT_RENDER); - G.f &= ~G_DOSCRIPTLINKS; /* avoid FRAMECHANGED events*/ - slink_flag = 1; - } + if (G.f & G_DOSCRIPTLINKS) + BPY_do_all_scripts(SCRIPT_RENDER, 0); tstate = PyEval_SaveThread(); RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); - if (slink_flag) { - G.f |= G_DOSCRIPTLINKS; - BPY_do_all_scripts(SCRIPT_POSTRENDER); - } + BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); G.scene->r.efra = end_frame; } @@ -603,13 +596,13 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self ) "start frame must be less or equal to end frame"); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_RENDER); + BPY_do_all_scripts(SCRIPT_RENDER, 1); tstate = PyEval_SaveThread(); RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_POSTRENDER); + BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); } PyEval_RestoreThread(tstate); diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index 33484500328..c26eedd26fd 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -1274,16 +1274,9 @@ void BIF_store_spare(void) /* set up display, render an image or scene */ void BIF_do_render(int anim) { - int slink_flag = 0; + if (G.f & G_DOSCRIPTLINKS) + BPY_do_all_scripts(SCRIPT_RENDER, anim); - if (G.f & G_DOSCRIPTLINKS) { - BPY_do_all_scripts(SCRIPT_RENDER); - if (!anim) { /* avoid FRAMECHANGED slink in render callback */ - G.f &= ~G_DOSCRIPTLINKS; - slink_flag = 1; - } - } - BIF_store_spare(); do_render(anim); @@ -1294,8 +1287,8 @@ void BIF_do_render(int anim) } if(G.scene->r.dither_intensity != 0.0f) BIF_redraw_render_rect(); - if (slink_flag) G.f |= G_DOSCRIPTLINKS; - if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER); + + if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, anim); } void do_ogl_view3d_render(Render *re, View3D *v3d, int winx, int winy) diff --git a/source/creator/creator.c b/source/creator/creator.c index f27dee946ed..ac81557110f 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -618,23 +618,14 @@ int main(int argc, char **argv) if (G.scene) { if (a < argc) { int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); - int slink_flag= 0; Render *re= RE_NewRender(G.scene->id.name); - if (G.f & G_DOSCRIPTLINKS) { - BPY_do_all_scripts(SCRIPT_RENDER); - /* avoid FRAMECHANGED slink event - * (should only be triggered in anims): */ - G.f &= ~G_DOSCRIPTLINKS; - slink_flag= 1; - } + if (G.f & G_DOSCRIPTLINKS) + BPY_do_all_scripts(SCRIPT_RENDER, 0); RE_BlenderAnim(re, G.scene, frame, frame); - if (slink_flag) { - G.f |= G_DOSCRIPTLINKS; - BPY_do_all_scripts(SCRIPT_POSTRENDER); - } + BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); } } else { printf("\nError: no blend loaded. cannot use '-f'.\n"); @@ -645,12 +636,12 @@ int main(int argc, char **argv) Render *re= RE_NewRender(G.scene->id.name); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_RENDER); + BPY_do_all_scripts(SCRIPT_RENDER, 1); RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_POSTRENDER); + BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); } else { printf("\nError: no blend loaded. cannot use '-a'.\n"); } -- cgit v1.2.3 From 15bce017df4477e13eb480060cd86690ed11c2fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Sep 2008 01:39:34 +0000 Subject: scons update, BF_NO_ELBEEM wasnt working, WITH_BF_SDL wasnt implimented, WITH_CCGSUBSURF isnt used anymore. --- SConstruct | 12 ++++++++++++ source/blender/blenkernel/SConscript | 3 ++- source/blender/src/SConscript | 8 +++++++- source/blender/src/seqaudio.c | 20 +++++++++++++++++++- tools/Blender.py | 12 +++++++----- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/SConstruct b/SConstruct index 356f116e290..96b8c239c9c 100644 --- a/SConstruct +++ b/SConstruct @@ -267,6 +267,18 @@ if 'blenderlite' in B.targets: env['WITH_BF_YAFRAY'] = False env['WITH_BF_REDCODE'] = False env['WITH_BF_FTGL'] = False + env['WITH_BF_DDS'] = False + env['WITH_BF_ZLIB'] = False + env['WITH_BF_SDL'] = False + env['WITH_BF_JPEG'] = False + env['WITH_BF_PNG'] = False + env['WITH_BF_ODE'] = False + env['WITH_BF_BULLET'] = False + env['WITH_BF_BINRELOC'] = False + env['BF_BUILDINFO'] = False + env['BF_NO_ELBEEM'] = True + + # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir #B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index db67251f44e..f891b307b2c 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -43,7 +43,8 @@ if env['WITH_BF_QUICKTIME'] == 1: defs += ' WITH_QUICKTIME' incs += ' ' + env['BF_QUICKTIME_INC'] -defs += ' WITH_CCGSUBSURF' +if env['BF_NO_ELBEEM'] == 1: + defs += ' DISABLE_ELBEEM' if env['WITH_BF_PLAYER']: SConscript(['bad_level_call_stubs/SConscript']) diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript index c8c517e15ff..c421d1e8388 100644 --- a/source/blender/src/SConscript +++ b/source/blender/src/SConscript @@ -75,7 +75,13 @@ if env['WITH_BF_VERSE']: # TODO buildinfo if env['BF_BUILDINFO'] == 1: defs.append('NAN_BUILDINFO') - + +if env['BF_NO_ELBEEM'] == 1: + defs.append('DISABLE_ELBEEM') + +if env['WITH_BF_SDL'] == 0: + defs.append('DISABLE_SDL') + if (env['BF_SPLIT_SRC'] == 1) and (env['OURPLATFORM'] == 'win32-mingw'): for i in range(numlibs): env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] ) diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c index 7c27f32c242..2c86ac92c7f 100644 --- a/source/blender/src/seqaudio.c +++ b/source/blender/src/seqaudio.c @@ -27,6 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ + #include #include #include @@ -118,6 +119,7 @@ void makewavstring (char *string) void audio_mixdown() { +#ifndef DISABLE_SDL int file, c, totlen, totframe, i, oldcfra; char *buf; @@ -203,6 +205,7 @@ void audio_mixdown() MEM_freeN(buf); return; +#endif } void audiostream_fill(Uint8 *mixdown, int len) @@ -211,7 +214,7 @@ void audiostream_fill(Uint8 *mixdown, int len) int i; memset(mixdown, 0, len); - +#ifndef DISABLE_SDL for (i = 0; i < len; i += 64) { CFRA = (int) ( ((float)(audio_pos-64) /( G.scene->audio.mixrate*4 )) @@ -222,6 +225,7 @@ void audiostream_fill(Uint8 *mixdown, int len) } CFRA = oldcfra; +#endif } @@ -288,6 +292,7 @@ void audio_makestream(bSound *sound) } } +#ifndef DISABLE_SDL static void audio_fill_ram_sound(Sequence *seq, void * mixdown, Uint8 * sstream, int len) { @@ -318,7 +323,9 @@ static void audio_fill_ram_sound(Sequence *seq, void * mixdown, } seq->curpos += len; } +#endif +#ifndef DISABLE_SDL static void audio_fill_hd_sound(Sequence *seq, void * mixdown, Uint8 * sstream, int len) @@ -354,7 +361,9 @@ static void audio_fill_hd_sound(Sequence *seq, } seq->curpos += len; } +#endif +#ifndef DISABLE_SDL static void audio_fill_seq(Sequence * seq, void * mixdown, Uint8 *sstream, int len, int advance_only) { @@ -407,7 +416,9 @@ static void audio_fill_seq(Sequence * seq, void * mixdown, seq = seq->next; } } +#endif +#ifndef DISABLE_SDL void audio_fill(void *mixdown, Uint8 *sstream, int len) { Editing *ed; @@ -427,7 +438,9 @@ void audio_fill(void *mixdown, Uint8 *sstream, int len) } } } +#endif +#ifndef DISABLE_SDL static int audio_init(SDL_AudioSpec *desired) { SDL_AudioSpec *obtained, *hardware_spec; @@ -452,6 +465,7 @@ static int audio_init(SDL_AudioSpec *desired) SDL_PauseAudio(0); return 1; } +#endif static int audiostream_play_seq(Sequence * seq, Uint32 startframe) { @@ -498,6 +512,7 @@ static int audiostream_play_seq(Sequence * seq, Uint32 startframe) void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) { +#ifndef DISABLE_SDL static SDL_AudioSpec desired; Editing *ed; int have_sound = 0; @@ -539,6 +554,7 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) SDL_PauseAudio(0); audio_playing++; } +#endif } void audiostream_start(Uint32 frame) @@ -553,8 +569,10 @@ void audiostream_scrub(Uint32 frame) void audiostream_stop(void) { +#ifndef DISABLE_SDL SDL_PauseAudio(1); audio_playing=0; +#endif } int audiostream_pos(void) diff --git a/tools/Blender.py b/tools/Blender.py index 2a63ca5b697..8f565174b0e 100644 --- a/tools/Blender.py +++ b/tools/Blender.py @@ -111,15 +111,16 @@ def setup_staticlibs(lenv): '/usr/lib', lenv['BF_PYTHON_LIBPATH'], lenv['BF_OPENGL_LIBPATH'], - lenv['BF_SDL_LIBPATH'], lenv['BF_JPEG_LIBPATH'], lenv['BF_PNG_LIBPATH'], lenv['BF_ZLIB_LIBPATH'], lenv['BF_ICONV_LIBPATH'] ] - - - libincs += Split(lenv['BF_FFMPEG_LIBPATH']) + + if lenv['WITH_BF_SDL']: + libincs += Split(lenv['BF_SDL_LIBPATH']) + if lenv['WITH_BF_FFMPEG']: + libincs += Split(lenv['BF_FFMPEG_LIBPATH']) if lenv['WITH_BF_STATICCXX']: statlibs += Split(lenv['BF_CXX_LIB_STATIC']) if lenv['WITH_BF_OPENEXR']: @@ -172,7 +173,8 @@ def setup_syslibs(lenv): syslibs += Split(lenv['BF_OPENEXR_LIB']) if lenv['WITH_BF_FFMPEG']: syslibs += Split(lenv['BF_FFMPEG_LIB']) - syslibs += Split(lenv['BF_SDL_LIB']) + if lenv['WITH_BF_SDL']: + syslibs += Split(lenv['BF_SDL_LIB']) if not lenv['WITH_BF_STATICOPENGL']: syslibs += Split(lenv['BF_OPENGL_LIB']) if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross'): -- cgit v1.2.3 From 9c27e097df380dd1b83c0816a7777be1cf36dc4d Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 19 Sep 2008 12:33:17 +0000 Subject: == IPO Defines Cleanup == Just a bit of tidyup for IPO header-files. Warning: Moved IPO Curves + Drivers out of DNA_curve_types.h --- source/blender/makesdna/DNA_curve_types.h | 41 ---------- source/blender/makesdna/DNA_ipo_types.h | 123 ++++++++++++++++++++---------- source/blender/python/api2_2x/Ipocurve.h | 2 +- 3 files changed, 85 insertions(+), 81 deletions(-) diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index a4fb8dc1150..3722c365f39 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -187,37 +187,6 @@ typedef struct Curve { struct CharInfo curinfo; } Curve; -typedef struct IpoDriver { - struct Object *ob; - short blocktype, adrcode, type, flag; - char name[128]; /* bone or constraint(?), or python expression here */ -} IpoDriver; - -/* temp? we store more bone names in 1 driver... */ -#define DRIVER_NAME_OFFS 32 - -typedef struct IpoCurve { - struct IpoCurve *next, *prev; - - struct BPoint *bp; /* are these even used anywhere? */ - struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple)*totvert. i.e. keyframes */ - - rctf maxrct, totrct; /* bounding boxes */ - - short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */ - short totvert; /* total number of BezTriples (i.e. keyframes) on curve */ - short ipo, extrap; /* interpolation and extrapolation modes */ - short flag, rt; /* flag= settings; rt= ??? */ - float ymin, ymax; /* minimum/maximum y-extents for curve */ - unsigned int bitmask; /* ??? */ - - float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */ - float curval; /* value of ipo-curve for current frame */ - - IpoDriver *driver; /* pointer to ipo-driver for this curve */ - -} IpoCurve; - /* **************** CURVE ********************* */ /* texflag */ @@ -273,15 +242,5 @@ typedef struct IpoCurve { #define CU_UNDERLINE 4 #define CU_WRAP 8 /* wordwrap occured here */ -/* *************** driver ****************** */ - -/* driver->type */ -#define IPO_DRIVER_TYPE_NORMAL 0 -#define IPO_DRIVER_TYPE_PYTHON 1 - -/* driver->flag */ -/* invalid flag: currently only used for buggy pydriver expressions: */ -#define IPO_DRIVER_FLAG_INVALID 1 - #endif diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 2659de2f067..fe75148fb3b 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -24,7 +24,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Joshua Leung * * ***** END GPL LICENSE BLOCK ***** */ @@ -32,10 +32,54 @@ #define DNA_IPO_TYPES_H #include "DNA_listBase.h" +#include "DNA_curve_types.h" #include "DNA_vec_types.h" #include "DNA_ID.h" +/* -------------------------- Type Defines --------------------------- */ + +/* sometimes used - mainly for GE/Ketsji */ +typedef short IPO_Channel; + + +/* --- IPO Curve Driver --- */ + +/* IPO Curve Driver */ +typedef struct IpoDriver { + struct Object *ob; /* target/driver ob */ + short blocktype, adrcode; /* sub-channel to use */ + + short type, flag; /* driver settings */ + char name[128]; /* bone, or python expression here */ +} IpoDriver; + +/* --- IPO Curve --- */ + +/* IPO Curve */ +typedef struct IpoCurve { + struct IpoCurve *next, *prev; + + struct BPoint *bp; /* array of BPoints (sizeof(BPoint)*totvert) - i.e. baked/imported data */ + struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple)*totvert) - i.e. user-editable keyframes */ + + rctf maxrct, totrct; /* bounding boxes */ + + short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */ + short totvert; /* total number of BezTriples (i.e. keyframes) on curve */ + short ipo, extrap; /* interpolation and extrapolation modes */ + short flag, rt; /* flag= settings; rt= ??? */ + float ymin, ymax; /* minimum/maximum y-extents for curve */ + unsigned int bitmask; /* ??? */ + + float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */ + float curval; /* value of ipo-curve for current frame */ + + IpoDriver *driver; /* pointer to ipo-driver for this curve */ +} IpoCurve; + +/* --- ID-Datablock --- */ + /* IPO Data-Block */ typedef struct Ipo { ID id; @@ -47,13 +91,9 @@ typedef struct Ipo { short muteipo, pad; /* muteipo: either 0 or 1 (whether ipo block is muted) */ } Ipo; -/* NOTE: IpoCurve struct is defined in DNA_curve_types.h, not in here... */ - -/* sometimes used */ -typedef short IPO_Channel; +/* ----------- adrcodes (for matching ipo-curves to data) ------------- */ /* defines: are these duped or new? */ - #define IPOBUTY 17 #define TOB_IPO 1 @@ -64,7 +104,7 @@ typedef short IPO_Channel; #define IPO_DISPBITS 2 #define IPO_DISPTIME 3 -/* ******************** */ +/* ********** Object (ID_OB) ********** */ #define OB_TOTIPO 30 #define OB_TOTNAM 30 @@ -110,7 +150,7 @@ typedef short IPO_Channel; #define OB_ROT_DIFF 100 -/* ******************** */ +/* ********** Material (ID_MA) ********** */ #define MA_TOTIPO 40 #define MA_TOTNAM 26 @@ -179,7 +219,7 @@ typedef short IPO_Channel; #define MAP_VARF 13 #define MAP_DISP 14 -/* ******************** */ +/* ********** Texture (ID_TE) ********** */ #define TE_TOTIPO 26 #define TE_TOTNAM 26 @@ -216,21 +256,21 @@ typedef short IPO_Channel; #define TE_BRIGHT 25 #define TE_CONTRA 26 -/* ******************** */ +/* ******** Sequence (ID_SEQ) ********** */ #define SEQ_TOTIPO 1 #define SEQ_TOTNAM 1 #define SEQ_FAC1 1 -/* ******************** */ +/* ********* Curve (ID_CU) *********** */ #define CU_TOTIPO 1 #define CU_TOTNAM 1 #define CU_SPEED 1 -/* ******************** */ +/* ********* ShapeKey (ID_KE) *********** */ #define KEY_TOTIPO 64 #define KEY_TOTNAM 64 @@ -238,7 +278,7 @@ typedef short IPO_Channel; #define KEY_SPEED 0 #define KEY_NR 1 -/* ******************** */ +/* ********* World (ID_WO) *********** */ #define WO_TOTIPO 29 #define WO_TOTNAM 16 @@ -263,7 +303,7 @@ typedef short IPO_Channel; #define WO_STARDIST 15 #define WO_STARSIZE 16 -/* ******************** */ +/* ********** Lamp (ID_LA) ********** */ #define LA_TOTIPO 21 #define LA_TOTNAM 10 @@ -279,9 +319,8 @@ typedef short IPO_Channel; #define LA_QUAD2 9 #define LA_HALOINT 10 -/* ******************** */ +/* ********* Camera (ID_CA) ************ */ -/* yafray: totipo & totnam +2 because of added curves */ #define CAM_TOTIPO 7 #define CAM_TOTNAM 7 @@ -296,7 +335,7 @@ typedef short IPO_Channel; #define CAM_SHIFT_X 6 #define CAM_SHIFT_Y 7 -/* ******************** */ +/* ********* Sound (ID_SO) *********** */ #define SND_TOTIPO 4 #define SND_TOTNAM 4 @@ -306,9 +345,9 @@ typedef short IPO_Channel; #define SND_PANNING 3 #define SND_ATTEN 4 -/* ******************** */ +/* ******* PoseChannel (ID_PO) ********* */ -#define AC_TOTIPO 10 /* __NLA */ +#define AC_TOTIPO 10 #define AC_TOTNAM 10 #define AC_LOC_X 1 @@ -324,25 +363,15 @@ typedef short IPO_Channel; #define AC_QUAT_Y 27 #define AC_QUAT_Z 28 -/* ******************** */ -#define CO_TOTIPO 2 /* Constraint Ipos */ +/* ******** Constraint (ID_CO) ********** */ + +#define CO_TOTIPO 2 #define CO_TOTNAM 2 #define CO_ENFORCE 1 #define CO_HEADTAIL 2 -/* -#define CO_TIME 2 -#define CO_OFFSET_X 3 -#define CO_OFFSET_Y 4 -#define CO_OFFSET_Z 5 -#define CO_ORIENT_X 6 -#define CO_ORIENT_Y 7 -#define CO_ORIENT_Z 8 -#define CO_ROLL 9 -*/ - -/* ******************** */ -/* fluidsim ipos NT */ + +/* ****** FluidSim (ID_FLUIDSIM) ****** */ #define FLUIDSIM_TOTIPO 9 #define FLUIDSIM_TOTNAM 9 @@ -360,8 +389,8 @@ typedef short IPO_Channel; #define FLUIDSIM_ACTIVE 9 -/* ******************** */ -/* particle ipos */ +/* ******* Particle (ID_PA) ******** */ + #define PART_TOTIPO 25 #define PART_TOTNAM 25 @@ -398,8 +427,9 @@ typedef short IPO_Channel; #define PART_PD2_FMAXD 25 -/* these are IpoCurve specific */ -/* **************** IPO ********************* */ +/* -------------------- Defines: Flags and Types ------------------ */ + +/* ----- IPO Curve Defines ------- */ /* icu->vartype */ #define IPO_CHAR 0 @@ -409,6 +439,7 @@ typedef short IPO_Channel; #define IPO_FLOAT 4 #define IPO_DOUBLE 5 #define IPO_FLOAT_DEGR 6 + /* very special case, in keys */ #define IPO_BEZTRIPLE 100 #define IPO_BPOINT 101 @@ -423,7 +454,8 @@ typedef short IPO_Channel; #define IPO_CONST 0 #define IPO_LIN 1 #define IPO_BEZ 2 -#define IPO_MIXED 3 /* not used yet */ + /* not used yet */ +#define IPO_MIXED 3 /* icu->extrap */ #define IPO_HORIZ 0 @@ -441,6 +473,19 @@ typedef short IPO_Channel; #define IPO_PROTECT 64 #define IPO_MUTE 128 +/* ---------- IPO Drivers ----------- */ + +/* offset in driver->name for finding second posechannel for rot-diff */ +#define DRIVER_NAME_OFFS 32 + +/* driver->type */ +#define IPO_DRIVER_TYPE_NORMAL 0 +#define IPO_DRIVER_TYPE_PYTHON 1 + +/* driver->flag */ + /* invalid flag: currently only used for buggy pydriver expressions */ +#define IPO_DRIVER_FLAG_INVALID (1<<0) + #endif diff --git a/source/blender/python/api2_2x/Ipocurve.h b/source/blender/python/api2_2x/Ipocurve.h index 8263bf2022f..6f474d4d167 100644 --- a/source/blender/python/api2_2x/Ipocurve.h +++ b/source/blender/python/api2_2x/Ipocurve.h @@ -31,7 +31,7 @@ #define EXPP_IPOCURVE_H #include -#include "DNA_curve_types.h" /* declaration of IpoCurve */ +#include "DNA_ipo_types.h" /* declaration of IpoCurve */ /*****************************************************************************/ /* Python C_IpoCurve structure definition: */ -- cgit v1.2.3 From ef8a1dccc726f6212e23b1c1978c2e0a2baf5a47 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 19 Sep 2008 12:41:26 +0000 Subject: Bugfix #17643: Action Editor buffer copy/paste not working Removed superfluous check for destination IPO-block/IPO-curve which may not have existed. This meant that pasting keyframes into an "empty" Action Channel sometimes failed. --- source/blender/src/editaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index fe83976ee57..220265fcbaf 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -2102,7 +2102,7 @@ void paste_actdata () /* from selected channels */ for (ale= act_data.first; ale; ale= ale->next) { - Ipo *ipo_src=NULL, *ipo_dst=ale->key_data; + Ipo *ipo_src=NULL; bActionChannel *achan; IpoCurve *ico, *icu; BezTriple *bezt; @@ -2149,12 +2149,12 @@ void paste_actdata () } /* this shouldn't happen, but it might */ - if (ELEM(NULL, ipo_src, ipo_dst)) + if (ipo_src == NULL) continue; /* loop over curves, pasting keyframes */ for (ico= ipo_src->curve.first; ico; ico= ico->next) { - icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, "", ico->adrcode, 1); + icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, NULL, ico->adrcode, 1); if (icu) { /* just start pasting, with the the first keyframe on the current frame, and so on */ -- cgit v1.2.3 From 6f9a254d61d037a624bd631b2c12bbacd2e7c67c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 19 Sep 2008 12:43:21 +0000 Subject: PyConstraints: Basic (non-python) target evaluation still occurs when scriptlinks are disabled. --- source/blender/blenkernel/intern/constraint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index efb03b71438..99cf58e8e5a 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1872,7 +1872,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT { bPythonConstraint *data= con->data; - if ((G.f & G_DOSCRIPTLINKS) && VALID_CONS_TARGET(ct)) { + if (VALID_CONS_TARGET(ct)) { /* special exception for curves - depsgraph issues */ if (ct->tar->type == OB_CURVE) { Curve *cu= ct->tar->data; @@ -1886,7 +1886,10 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT * this matrix if it needs to do so */ constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); - BPY_pyconstraint_target(data, ct); + + /* only execute target calculation if allowed */ + if (G.f & G_DOSCRIPTLINKS) + BPY_pyconstraint_target(data, ct); } else if (ct) Mat4One(ct->matrix); @@ -1896,6 +1899,7 @@ static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targ { bPythonConstraint *data= con->data; + /* only evaluate in python if we're allowed to do so */ if ((G.f & G_DOSCRIPTLINKS)==0) return; /* currently removed, until I this can be re-implemented for multiple targets */ -- cgit v1.2.3 From a0504ac922b314929e0028b8bcd0c6b1cd7eef91 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 19 Sep 2008 14:18:41 +0000 Subject: Patch #8213 by Shunichi Fuji Fixes crash with FT fonts in some cases, just removed unnused line of code. --- source/blender/blenlib/intern/freetypefont.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 74f152ac635..48a40db6a72 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -404,8 +404,6 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) break; lcode = charcode; } - - err = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); return vfd; } -- cgit v1.2.3 From 65ddef19b92d39415a5943e01903d66ede9f1df6 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 19 Sep 2008 16:01:22 +0000 Subject: Patch #13422, By Roland Hess, Shadow Color Finally, after a long time new render candy for the non-game peoples! :) Good doc is here: (url splits in two) http://www.harkyman.com/2008/08/06/controllable-shadow-intensity- and-color/ Note the colorpicker for shadow is in "Shadow and Spot" panel. A bit hidden, could get more attention. For later. :) --- source/blender/makesdna/DNA_lamp_types.h | 3 +++ .../blender/render/intern/include/render_types.h | 1 + source/blender/render/intern/include/texture.h | 2 +- .../blender/render/intern/source/convertblender.c | 8 ++++++- source/blender/render/intern/source/pixelshading.c | 2 +- source/blender/render/intern/source/shadeoutput.c | 25 +++++++++++++++------- source/blender/render/intern/source/texture.c | 4 ++-- source/blender/src/buttons_shading.c | 11 +++++++++- 8 files changed, 42 insertions(+), 14 deletions(-) diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h index 2a39580bb5c..bc746e99864 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -50,6 +50,7 @@ typedef struct Lamp { short colormodel, totex; float r, g, b, k; + float shdwr, shdwg, shdwb, shdwpad; float energy, dist, spotsize, spotblend; float haint; @@ -138,6 +139,7 @@ typedef struct Lamp { /* Since it is used with LOCAL lamp, can't use LA_SHAD */ #define LA_YF_SOFT 16384 #define LA_LAYER_SHADOW 32768 +#define LA_SHAD_TEX (1<<16) /* layer_shadow */ #define LA_LAYER_SHADOW_BOTH 0 @@ -190,6 +192,7 @@ typedef struct Lamp { /* mapto */ #define LAMAP_COL 1 +#define LAMAP_SHAD 2 #endif /* DNA_LAMP_TYPES_H */ diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 7e2194549cc..1768b052b54 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -421,6 +421,7 @@ typedef struct LampRen { short type; int mode; float r, g, b, k; + float shdwr, shdwg, shdwb; float energy, haint; int lay; float spotsi,spotbl; diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 8e56c4a852f..62833566652 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -55,7 +55,7 @@ struct ImBuf; void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf); void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag); void do_material_tex(struct ShadeInput *shi); -void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf); +void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, short effect); void init_render_textures(Render *re); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 322d2066a6c..45d79be2f62 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3566,6 +3566,9 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) lar->r= lar->energy*la->r; lar->g= lar->energy*la->g; lar->b= lar->energy*la->b; + lar->shdwr= la->shdwr; + lar->shdwg= la->shdwg; + lar->shdwb= la->shdwb; lar->k= la->k; // area @@ -3718,7 +3721,10 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) for(c=0; cmtex[c] && la->mtex[c]->tex) { - lar->mode |= LA_TEXTURE; + if (la->mtex[c]->mapto & LAMAP_COL) + lar->mode |= LA_TEXTURE; + if (la->mtex[c]->mapto & LAMAP_SHAD) + lar->mode |= LA_SHAD_TEX; if(G.rendering) { if(re->osa) { diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 2e3509f0471..ef723eea6b5 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -141,7 +141,7 @@ static void render_lighting_halo(HaloRen *har, float *colf) VECCOPY(shi.co, rco); shi.osatex= 0; - do_lamp_tex(lar, lv, &shi, lacol); + do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE); } if(lar->type==LA_SPOT) { diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 5a80173d1f1..91621c24365 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1179,7 +1179,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int { Material *ma= shi->mat; VlakRen *vlr= shi->vlr; - float lv[3], lampdist, lacol[3], shadfac[4]; + float lv[3], lampdist, lacol[3], shadfac[4], lashdw[3]; float i, is, i_noshad, inp, *vn, *view, vnor[3], phongcorr=1.0f; float visifac; @@ -1219,7 +1219,12 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int lacol[1]= lar->g; lacol[2]= lar->b; - if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol); + lashdw[0]= lar->shdwr; + lashdw[1]= lar->shdwg; + lashdw[2]= lar->shdwb; + + if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE); + if(lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX); /* tangent case; calculate fake face normal, aligned with lampvector */ /* note, vnor==vn is used as tangent trigger for buffer shadow */ @@ -1342,13 +1347,13 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int if((lar->mode & LA_ONLYSHADOW) && i>0.0) { shadfac[3]= i*lar->energy*(1.0f-shadfac[3]); - shr->shad[0] -= shadfac[3]*shi->r; - shr->shad[1] -= shadfac[3]*shi->g; - shr->shad[2] -= shadfac[3]*shi->b; + shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]); + shr->shad[1] -= shadfac[3]*shi->g*(1.0f-lashdw[1]); + shr->shad[2] -= shadfac[3]*shi->b*(1.0f-lashdw[2]); - shr->spec[0] -= shadfac[3]*shi->specr; - shr->spec[1] -= shadfac[3]*shi->specg; - shr->spec[2] -= shadfac[3]*shi->specb; + shr->spec[0] -= shadfac[3]*shi->specr*(1.0f-lashdw[0]); + shr->spec[1] -= shadfac[3]*shi->specg*(1.0f-lashdw[1]); + shr->spec[2] -= shadfac[3]*shi->specb*(1.0f-lashdw[2]); return; } @@ -1366,6 +1371,10 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int else add_to_diffuse(shr->shad, shi, is, i*lacol[0], i*lacol[1], i*lacol[2]); } + /* add light for colored shadow */ + if (i_noshad>i && !(lashdw[0]==0 && lashdw[1]==0 && lashdw[2]==0)) { + add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]); + } if(i_noshad>0.0f) { if(passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) { if(ma->mode & MA_SHADOW_TRA) diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 27628d91465..628ac95710a 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -2301,7 +2301,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f /* ------------------------------------------------------------------------- */ /* colf supposed to be initialized with la->r,g,b */ -void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf) +void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, short effect) { Object *ob; MTex *mtex; @@ -2440,7 +2440,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf) } /* mapping */ - if(mtex->mapto & LAMAP_COL) { + if(((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) { float col[3]; if(rgb==0) { diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 6d5e1a62ad4..c41047ed788 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -2535,7 +2535,10 @@ static void lamp_panel_mapto(Object *ob, Lamp *la) uiDefButF(block, NUMSLI, B_LAMPPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard"); /* MAP TO */ - uiDefButBitS(block, TOG, MAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp"); + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, LAMAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp"); + uiDefButBitS(block, TOG, LAMAP_SHAD, B_LAMPPRV, "Shadow", 146,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the shadow color of the lamp"); + uiBlockEndAlign(block); uiBlockBeginAlign(block); uiDefButS(block, MENU, B_LAMPPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode"); @@ -2669,6 +2672,12 @@ static void lamp_panel_spot(Object *ob, Lamp *la) uiDefButBitI(block, TOG, LA_LAYER_SHADOW, B_LAMPPRV,"Layer", 10,90,80,19,&la->mode, 0, 0, 0, 0, "Causes only objects on the same layer to cast shadows"); uiBlockEndAlign(block); + if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && ((la->mode & LA_SHAD_RAY)||(la->mode & LA_SHAD_BUF))) { + uiBlockBeginAlign(block); + uiDefButF(block, COL, 0, "Shadow ", 10,90,80,19,&la->shdwr, 0, 0, 0, B_COLLAMP, "Sets the shadow color; default is black (RGB 0,0,0)"); + uiBlockEndAlign(block); + } + if(la->type==LA_SPOT) { uiBlockBeginAlign(block); uiDefButBitI(block, TOG, LA_SQUARE, B_LAMPREDRAW,"Square", 10,60,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles"); -- cgit v1.2.3 From 0f6fc0b207e48d413b728119506c399ae4597699 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 19 Sep 2008 16:09:26 +0000 Subject: Fix again for the NVidia driver bug. This time I'm just giving up using linking together the precompiled library shader code and material code and recompiling it all again for each material even if it gives a performance hit, since the previous workaround only worked on some driver versions still. --- source/blender/gpu/GPU_extensions.h | 4 ++-- source/blender/gpu/intern/gpu_codegen.c | 26 ++++++++++++++------------ source/blender/gpu/intern/gpu_extensions.c | 16 ++++++++++++---- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index d3faa81ebb1..3813fe3da8e 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -108,8 +108,8 @@ void GPU_framebuffer_restore(); - only for fragment shaders now - must call texture bind before setting a texture as uniform! */ -GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUShader *lib); -GPUShader *GPU_shader_create_lib(const char *code); +GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const char *libcode); /*GPUShader *lib);*/ +/*GPUShader *GPU_shader_create_lib(const char *code);*/ void GPU_shader_free(GPUShader *shader); void GPU_shader_bind(GPUShader *shader); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 78a99cab447..1c29bdc8741 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -188,8 +188,8 @@ static void BLI_dynstr_printf(DynStr *dynstr, const char *format, ...) * These are stored in a hash for lookup when creating a material. */ static GHash *FUNCTION_HASH= NULL; -static char *FUNCTION_PROTOTYPES= NULL; -static GPUShader *FUNCTION_LIB= NULL; +/*static char *FUNCTION_PROTOTYPES= NULL; +static GPUShader *FUNCTION_LIB= NULL;*/ static int gpu_str_prefix(char *str, char *prefix) { @@ -299,6 +299,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code) } } +#if 0 static char *gpu_generate_function_prototyps(GHash *hash) { DynStr *ds = BLI_dynstr_new(); @@ -346,14 +347,15 @@ static char *gpu_generate_function_prototyps(GHash *hash) return prototypes; } +#endif GPUFunction *GPU_lookup_function(char *name) { if(!FUNCTION_HASH) { FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp); gpu_parse_functions_string(FUNCTION_HASH, datatoc_gpu_shader_material_glsl); - FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH); - FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl); + /*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH); + FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/ } return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, name); @@ -370,14 +372,14 @@ void GPU_extensions_exit(void) BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN); FUNCTION_HASH = NULL; } - if(FUNCTION_PROTOTYPES) { + /*if(FUNCTION_PROTOTYPES) { MEM_freeN(FUNCTION_PROTOTYPES); FUNCTION_PROTOTYPES = NULL; - } - if(FUNCTION_LIB) { + }*/ + /*if(FUNCTION_LIB) { GPU_shader_free(FUNCTION_LIB); FUNCTION_LIB = NULL; - } + }*/ } /* GLSL code generation */ @@ -688,7 +690,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch DynStr *ds = BLI_dynstr_new(); char *code; - BLI_dynstr_append(ds, FUNCTION_PROTOTYPES); + /*BLI_dynstr_append(ds, FUNCTION_PROTOTYPES);*/ codegen_set_unique_ids(nodes); codegen_print_uniforms_functions(ds, nodes); @@ -1393,10 +1395,10 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri GPUPass *pass; char *vertexcode, *fragmentcode; - if(!FUNCTION_LIB) { + /*if(!FUNCTION_LIB) { GPU_nodes_free(nodes); return NULL; - } + }*/ /* prune unused nodes */ gpu_nodes_prune(nodes, outlink); @@ -1407,7 +1409,7 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri /* generate code and compile with opengl */ fragmentcode = code_generate_fragment(nodes, outlink->output, name); vertexcode = code_generate_vertex(nodes); - shader = GPU_shader_create(vertexcode, fragmentcode, FUNCTION_LIB); + shader = GPU_shader_create(vertexcode, fragmentcode, datatoc_gpu_shader_material_glsl); /*FUNCTION_LIB);*/ MEM_freeN(fragmentcode); MEM_freeN(vertexcode); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 4c3090dd2c1..10603aa7283 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -669,11 +669,13 @@ static void shader_print_errors(char *task, char *log, const char *code) fprintf(stderr, "%s\n", log); } -GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUShader *lib) +GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPUShader *lib,*/ const char *libcode) { GLint status; GLcharARB log[5000]; + const char *fragsource[2]; GLsizei length = 0; + GLint count; GPUShader *shader; if (!GLEW_ARB_vertex_shader || !GLEW_ARB_fragment_shader) @@ -712,8 +714,12 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUSh } if(fragcode) { + count = 0; + if(libcode) fragsource[count++] = libcode; + if(fragcode) fragsource[count++] = fragcode; + glAttachObjectARB(shader->object, shader->fragment); - glShaderSourceARB(shader->fragment, 1, (const char**)&fragcode, NULL); + glShaderSourceARB(shader->fragment, count, fragsource, NULL); glCompileShaderARB(shader->fragment); glGetObjectParameterivARB(shader->fragment, GL_OBJECT_COMPILE_STATUS_ARB, &status); @@ -727,8 +733,8 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUSh } } - if(lib && lib->lib) - glAttachObjectARB(shader->object, lib->lib); + /*if(lib && lib->lib) + glAttachObjectARB(shader->object, lib->lib);*/ glLinkProgramARB(shader->object); glGetObjectParameterivARB(shader->object, GL_OBJECT_LINK_STATUS_ARB, &status); @@ -743,6 +749,7 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUSh return shader; } +#if 0 GPUShader *GPU_shader_create_lib(const char *code) { GLint status; @@ -778,6 +785,7 @@ GPUShader *GPU_shader_create_lib(const char *code) return shader; } +#endif void GPU_shader_bind(GPUShader *shader) { -- cgit v1.2.3 From 905983229ae588d6ec31a202742b1433d46bc9b0 Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Fri, 19 Sep 2008 18:53:05 +0000 Subject: == Python Space Handlers == Patch #9673: "Short patch to make spacehandler event scripts work more like normal python gui script handlers" by Steven Truppe: http://projects.blender.org/tracker/?func=detail&atid=127&aid=9673&group_id=9 This patch adds the Blender.eventValue variable available for space handlers, holding the event value (aka 1 for button and key presses, X or Y coordinate for mousex / mousey movement). Thanks, Steven. PS: this doesn't break existing scripts. --- source/blender/python/BPY_extern.h | 2 +- source/blender/python/BPY_interface.c | 5 +++-- source/blender/python/api2_2x/doc/API_intro.py | 8 ++++++++ source/blender/python/api2_2x/doc/API_related.py | 13 ++++++++++--- source/blender/python/api2_2x/doc/Blender.py | 10 +++++++--- source/blender/src/drawview.c | 2 +- source/blender/src/space.c | 6 +++--- 7 files changed, 33 insertions(+), 13 deletions(-) diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 146093d6b99..aac3c51b97e 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -112,7 +112,7 @@ extern "C" { int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa); void BPY_screen_free_spacehandlers(struct bScreen *sc); int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event, - unsigned short space_event); + short eventValue, unsigned short space_event); void BPY_pydriver_update(void); float BPY_pydriver_eval(struct IpoDriver *driver); diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index c0dab4df651..31609970f6f 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -2475,7 +2475,7 @@ int BPY_add_spacehandler(Text *text, ScrArea *sa, char spacetype) } int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, - unsigned short space_event ) + short eventValue, unsigned short space_event ) { ScriptLink *scriptlink; int retval = 0; @@ -2515,8 +2515,9 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, PyDict_SetItemString(g_blenderdict, "bylink", Py_True); /* unlike normal scriptlinks, here Blender.link is int (space event type) */ EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event)); - /* note: DRAW space_events set event to 0 */ + /* note: DRAW space_events set event and val to 0 */ EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event)); + EXPP_dict_set_item_str(g_blenderdict, "eventValue", PyInt_FromLong(eventValue)); /* now run all assigned space handlers for this space and space_event */ for( index = 0; index < scriptlink->totscript; index++ ) { diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py index 2960d8ed1d2..192c9710ea2 100644 --- a/source/blender/python/api2_2x/doc/API_intro.py +++ b/source/blender/python/api2_2x/doc/API_intro.py @@ -61,6 +61,14 @@ The Blender Python API Reference - L{World} - L{sys} + Additional information: + ----------------------- + - L{API_related}: + - Calling scripts from command line + - Script links and space handlers + - How to register scripts in menus + - Recommended ways to document and support configuration options + Introduction: ============= diff --git a/source/blender/python/api2_2x/doc/API_related.py b/source/blender/python/api2_2x/doc/API_related.py index 4e29f95e76d..dcd2bdd1e60 100644 --- a/source/blender/python/api2_2x/doc/API_related.py +++ b/source/blender/python/api2_2x/doc/API_related.py @@ -226,6 +226,7 @@ Introduction: import Blender from Blender import Draw evt = Blender.event + val = Blender.eventValue return_it = False if evt == Draw.LEFTMOUSE: @@ -233,7 +234,7 @@ Introduction: elif evt == Draw.AKEY: print "Swallowing an 'a' character" else: - print "Let the 3D View itself process this event:", evt + print "Let the 3D View itself process this event: %d with value %d" % (evt, val) return_it = True # if Blender should not process itself the passed event: @@ -249,8 +250,14 @@ Introduction: tells what space this handler belongs to and the handler's type (EVENT, DRAW); - B{event}: - - EVENT handlers: an input event (check keys and mouse events in L{Draw}) - to be processed or ignored. + - EVENT handlers: an input event (check keys and mouse events in + L{Draw}) to be processed or ignored; + - DRAW handlers: 0 always; + - B{eventValue}: + - EVENT handlers: the event value, it indicates mouse button or key + presses (since we don't pass releases) as 1 and mouse movements + (Draw.MOUSE.X and Draw.MOUSE.Y) as the current x or y coordinate, + for example; - DRAW handlers: 0 always. B{Guidelines (important)}: diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py index 964b8f70e8b..9d89cae7137 100644 --- a/source/blender/python/api2_2x/doc/Blender.py +++ b/source/blender/python/api2_2x/doc/Blender.py @@ -10,8 +10,8 @@ """ The main Blender module. -B{New}: L{Run}, L{UpdateMenus}, new options to L{Get}, L{ShowHelp}, -L{SpaceHandlers} dictionary. +B{New}: new var L{eventValue} for space handlers, L{Run}, L{UpdateMenus}, +new options to L{Get}, L{ShowHelp}, L{SpaceHandlers} dictionary. L{UnpackModes} dictionary. Blender @@ -34,7 +34,11 @@ Blender - for normal L{GUI} scripts I{during the events callback}, it holds the ascii value of the current event, if it is a valid one. Users interested in this should also check the builtin 'ord' and 'chr' - Python functions. + Python functions. +@type eventValue: int +@var eventValue: used only for EVENT space handlers, it holds the event value: + - for mouse button and key presses it's 1, for mouse movement + (Draw.MOUSEX and Draw.MOUSEY) it has the new x or y coordinate, resp. @type mode: string @var mode: Blender's current mode: - 'interactive': normal mode, with an open window answering to user input; diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 42576c901d7..60d7ab599ab 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -3422,7 +3422,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata) /* run any view3d draw handler script links */ if (sa->scriptlink.totscript) - BPY_do_spacehandlers(sa, 0, SPACEHANDLER_VIEW3D_DRAW); + BPY_do_spacehandlers(sa, 0, 0, SPACEHANDLER_VIEW3D_DRAW); /* run scene redraw script links */ if((G.f & G_DOSCRIPTLINKS) && G.scene->scriptlink.totscript && diff --git a/source/blender/src/space.c b/source/blender/src/space.c index fb86620201b..64b5742dc54 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1206,8 +1206,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) */ if(event==LEFTMOUSE) { /* run any view3d event handler script links */ - if (event && sa->scriptlink.totscript) { - if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT)) + if (sa->scriptlink.totscript) { + if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT)) return; /* return if event was processed (swallowed) by handler(s) */ } @@ -1268,7 +1268,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) /* run any view3d event handler script links */ if (event && sa->scriptlink.totscript) - if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT)) + if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT)) return; /* return if event was processed (swallowed) by handler(s) */ /* TEXTEDITING?? */ -- cgit v1.2.3 From 00ed5a2cc9de18549e7872175a0514b55822815a Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 19 Sep 2008 20:22:54 +0000 Subject: Patch #17348 by Roger Wickes Fix in Bake Constraints script, better naming for new object. --- release/scripts/animation_bake_constraints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/animation_bake_constraints.py b/release/scripts/animation_bake_constraints.py index 8a416c3c488..58e9e2b1d02 100644 --- a/release/scripts/animation_bake_constraints.py +++ b/release/scripts/animation_bake_constraints.py @@ -602,7 +602,7 @@ def bakeObject(ob): #bakes the core object locrot and assigns the Ipo to a Clone if ob != None: # Clone the object - duplicate it, clean the clone, and create an ipo curve for the clone myob = duplicateLinked(ob) #clone it - myob.name= usrObjectNamePrefix + ob.getName() + myob.setName(usrObjectNamePrefix + ob.getName()) removeConstraintsOb(myob) #my object is a free man deLinkOb('Ipo',myob) #kids, it's not nice to share. you've been lied to if ob.getType() != ARMATURE: # baking armatures is based on bones, not object -- cgit v1.2.3 From a44177a4019536871da8c976fd4bbf38a30fd766 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Fri, 19 Sep 2008 20:41:38 +0000 Subject: BGE patch: new 'Advanced Settings' button to keep special Bullet options away from main UI. Three features that were on the main UI interface are now moved to the Advanced Settings panel: Margin, Actor (that becomes Sensor Actor) and No sleeping. Sensor Actor is now a feature: it can be turned on and off for all types of objects, and not just static objects. Select the Sensor Actor button to make the object visible to Near and Radar sensor. The button is selected by default for dynamic objects and unselected by default for static objects, to match previous behavior. --- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenloader/intern/readfile.c | 9 ++ source/blender/src/buttons_logic.c | 95 ++++++++++++++-------- source/blender/src/drawobject.c | 2 +- .../Converter/BL_BlenderDataConversion.cpp | 19 ++--- 5 files changed, 79 insertions(+), 48 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 0591937ea4c..5af8fde99c9 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -41,7 +41,7 @@ struct ListBase; struct MemFile; #define BLENDER_VERSION 247 -#define BLENDER_SUBVERSION 2 +#define BLENDER_SUBVERSION 3 #define BLENDER_MINVERSION 245 #define BLENDER_MINSUBVERSION 15 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f3f1a99cdbf..0df965b2cc1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7799,6 +7799,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){ + Object *ob; + for(ob = main->object.first; ob; ob= ob->id.next) { + // Starting from subversion 3, ACTOR is a separate feature. + // Before it was conditioning all the other dynamic flags + if (!(ob->gameflag & OB_ACTOR)) + ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE); + } + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index e16443460a1..45974e5704c 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -2969,6 +2969,45 @@ static void check_body_type(void *arg1_but, void *arg2_object) } } +static uiBlock *advanced_bullet_menu(void *arg_ob) +{ + uiBlock *block; + Object *ob = arg_ob; + short yco = 65, xco = 0; + + block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win); + /* use this for a fake extra empy space around the buttons */ + uiDefBut(block, LABEL, 0, "", -5, -10, 255, 100, NULL, 0, 0, 0, 0, ""); + + uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor", + xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, + "Objects that are detected by the Near and Radar sensor"); + + if (ob->gameflag & OB_DYNAMIC) { + uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping", + xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, + "Disable auto (de)activation"); + } + + yco -= 25; + xco = 0; + if (ob->gameflag & OB_DYNAMIC) { + if (ob->margin < 0.001f) + ob->margin = 0.06f; + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0, + "Collision margin"); + } else { + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0, + "Collision margin"); + } + + uiBlockSetDirection(block, UI_TOP); + + return block; +} + void buttons_bullet(uiBlock *block, Object *ob) { uiBut *but; @@ -2976,7 +3015,7 @@ void buttons_bullet(uiBlock *block, Object *ob) /* determine the body_type setting based on flags */ if (!(ob->gameflag & OB_COLLISION)) ob->body_type = OB_BODY_TYPE_NO_COLLISION; - else if (!(ob->gameflag & OB_DYNAMIC) || !(ob->gameflag & OB_DYNAMIC)) + else if (!(ob->gameflag & OB_DYNAMIC)) ob->body_type = OB_BODY_TYPE_STATIC; else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) ob->body_type = OB_BODY_TYPE_DYNAMIC; @@ -2985,61 +3024,51 @@ void buttons_bullet(uiBlock *block, Object *ob) else ob->body_type = OB_BODY_TYPE_SOFT; - uiBlockBeginAlign(block); but = uiDefButS(block, MENU, REDRAWVIEW3D, "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4", - 10, 205, 150, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation of the object"); + 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation"); uiButSetFunc(but, check_body_type, but, ob); if (ob->gameflag & OB_COLLISION) { - but = uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor", - 160,205,55,19, &ob->gameflag, 0, 0, 0, 0, - "Objects that are detected by the Near and Radar sensor"); - uiButSetFunc(but, check_actor, but, &ob->gameflag); - - uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 215,205,55,19, + + uiBlockSetCol(block, TH_BUT_SETTING1); + uiDefBlockBut(block, advanced_bullet_menu, ob, + "Advanced Settings", + 200, 205, 150, 20, "Display collision advanced settings"); + uiBlockSetCol(block, TH_BUT_SETTING2); + + uiBlockBeginAlign(block); + uiDefButBitI(block, TOG, OB_GHOST, 0, "Ghost", 10, 182, 60, 19, &ob->gameflag, 0, 0, 0, 0, "Objects that don't restitute collisions (like a ghost)"); + if ((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) { + uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 70, 182, 140, 19, + &ob->inertia, 0.01, 10.0, 10, 2, + "Bounding sphere radius, not used for other bounding shapes"); + } if(ob->gameflag & OB_DYNAMIC) { - uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19, - &ob->gameflag, 0, 0, 0, 0, - "Disable auto (de)activation"); - uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19, + uiDefButF(block, NUM, B_DIFF, "Mass:", 210, 182, 140, 19, &ob->mass, 0.01, 10000.0, 10, 2, "The mass of the Object"); - uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19, - &ob->inertia, 0.01, 10.0, 10, 2, - "Bounding sphere radius, not used for other bounding shapes"); - uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, + uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 162, 150, 19, &ob->damping, 0.0, 1.0, 10, 0, "General movement damping"); - uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, + uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 162, 190, 19, &ob->rdamping, 0.0, 1.0, 10, 0, "General rotation damping"); } uiBlockEndAlign(block); uiBlockBeginAlign(block); - if ((ob->gameflag & (OB_ACTOR|OB_DYNAMIC)) == (OB_ACTOR|OB_DYNAMIC)) { - if (ob->margin < 0.001f) - ob->margin = 0.06f; - uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, - &ob->margin, 0.001, 1.0, 1, 0, - "Collision margin"); - } else { - uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, - &ob->margin, 0.0, 1.0, 1, 0, - "Collision margin"); - } - uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 115, 105, 55, 19, - &ob->gameflag, 0, 0,0, 0, + uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 105, 80, 19, + &ob->gameflag, 0, 0, 0, 0, "Specify a bounds object for physics"); if (ob->gameflag & OB_BOUNDS) { uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Static Mesh%x4", //almost ready to enable this one: uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|", - 170, 105, 105, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type"); - uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 275,105,75,19, + 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type"); + uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19, &ob->gameflag, 0, 0, 0, 0, "Add Children"); } diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 8a3176e16b2..f5a4ac4556a 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -5187,7 +5187,7 @@ void draw_object(Base *base, int flag) } if(dtgameflag & OB_ACTOR) && (ob->gameflag & OB_DYNAMIC)) { + if(/*(ob->gameflag & OB_ACTOR) &&*/ (ob->gameflag & OB_DYNAMIC)) { float tmat[4][4], imat[4][4], vec[3]; vec[0]= vec[1]= vec[2]= 0.0; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 425e07a257c..593833742e7 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1315,19 +1315,12 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_isCompoundChild = isCompoundChild; objprop.m_hasCompoundChildren = (blenderobject->gameflag & OB_CHILD) != 0; objprop.m_margin = blenderobject->margin; - - if ((objprop.m_isactor = (blenderobject->gameflag & OB_ACTOR)!=0)) - { - objprop.m_dyna = (blenderobject->gameflag & OB_DYNAMIC) != 0; - objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0; - objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0; - objprop.m_disableSleeping = (blenderobject->gameflag & OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag - } else { - objprop.m_dyna = false; - objprop.m_angular_rigidbody = false; - objprop.m_ghost = false; - objprop.m_disableSleeping = false; - } + // ACTOR is now a separate feature + objprop.m_isactor = (blenderobject->gameflag & OB_ACTOR)!=0; + objprop.m_dyna = (blenderobject->gameflag & OB_DYNAMIC) != 0; + objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0; + objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0; + objprop.m_disableSleeping = (blenderobject->gameflag & OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag //mmm, for now, taks this for the size of the dynamicobject // Blender uses inertia for radius of dynamic object objprop.m_radius = blenderobject->inertia; -- cgit v1.2.3 From 4693a5af483dfe7f4c495b698035cc1bfc11a801 Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Fri, 19 Sep 2008 21:00:45 +0000 Subject: =?UTF-8?q?Linux=20platforms=20---------------=20Patch=20to=20incl?= =?UTF-8?q?ude=20freedesktop=20icons=20in=20linux=20release=20builds,=20co?= =?UTF-8?q?ntributed=20by=20Ralf=20H=C3=B6lzemer=20(cheleb).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SConstruct | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/SConstruct b/SConstruct index 96b8c239c9c..0a959cc5b7b 100644 --- a/SConstruct +++ b/SConstruct @@ -422,6 +422,26 @@ if env['OURPLATFORM']!='darwin': source=[dp+os.sep+f for f in df] scriptinstall.append(env.Install(dir=dir,source=source)) +#-- icons +if env['OURPLATFORM']=='linux2': + iconlist = [] + icontargetlist = [] + + for tp, tn, tf in os.walk('release/freedesktop/icons'): + if 'CVS' in tn: + tn.remove('CVS') + if '.svn' in tn: + tn.remove('.svn') + for f in tf: + print ">>>", env['BF_INSTALLDIR'], tp, f + iconlist.append(tp+os.sep+f) + icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f) + + iconinstall = [] + for targetdir,srcfile in zip(icontargetlist, iconlist): + td, tf = os.path.split(targetdir) + iconinstall.append(env.Install(dir=td, source=srcfile)) + #-- plugins pluglist = [] plugtargetlist = [] @@ -470,6 +490,8 @@ textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist) if env['OURPLATFORM']=='darwin': allinstall = [blenderinstall, plugininstall, textinstall] +elif env['OURPLATFORM']=='linux2': + allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall] else: allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall] -- cgit v1.2.3 From 650ae3b4e679f068fd8fdf73f0e6df561362b227 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 19 Sep 2008 21:52:15 +0000 Subject: Fix for bug #16662: modifiers on lattices were ignored sometimes when rendering opengl previews, it unnecessarily cleared lattice displists when it was really intended for shaded mode colors. --- source/blender/blenkernel/intern/displist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 3b79f6689c0..69c8f3406a2 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -757,7 +757,10 @@ void reshadeall_displist(void) for(base= G.scene->base.first; base; base= base->next) { ob= base->object; - freedisplist(&ob->disp); + + if(ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) + freedisplist(&ob->disp); + if(base->lay & G.scene->lay) { /* Metaballs have standard displist at the Object */ if(ob->type==OB_MBALL) shadeDispList(base); -- cgit v1.2.3 From 4f737bafa7c5366a2bf4c69d6e2b1c77ff64c73b Mon Sep 17 00:00:00 2001 From: Diego Borghetti Date: Fri, 19 Sep 2008 21:57:15 +0000 Subject: == Render == Commit patch #7788, allow to set the render step, so it's possible make render every N frames only. The step is change in Scene buttons (F10), below start and end frame buttons. Also add a command line options (-j), so it's possible to overwrite the file step (useful for renderfarm). [ Brecht, this work with OpenGL renders and simulated the skipped frames, please double check ] --- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenloader/intern/readfile.c | 10 +++++++++ source/blender/include/blendef.h | 1 + source/blender/makesdna/DNA_scene_types.h | 4 ++++ source/blender/python/api2_2x/sceneRender.c | 4 ++-- source/blender/render/extern/include/RE_pipeline.h | 2 +- source/blender/render/intern/source/pipeline.c | 24 +++++++++++++++++++--- source/blender/src/buttons_scene.c | 9 ++++---- source/blender/src/renderwin.c | 17 +++++++++++++-- source/creator/creator.c | 14 +++++++++++-- 10 files changed, 72 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 5af8fde99c9..8dbb90372f0 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -41,7 +41,7 @@ struct ListBase; struct MemFile; #define BLENDER_VERSION 247 -#define BLENDER_SUBVERSION 3 +#define BLENDER_SUBVERSION 4 #define BLENDER_MINVERSION 245 #define BLENDER_MINSUBVERSION 15 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0df965b2cc1..80defdbbf9c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7808,6 +7808,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE); } } + + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 4)){ + Scene *sce= main->scene.first; + while(sce) { + if(sce->frame_step==0) + sce->frame_step= 1; + sce= sce->id.next; + } + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h index a7f7bc2e4b8..7fd607f6feb 100644 --- a/source/blender/include/blendef.h +++ b/source/blender/include/blendef.h @@ -113,6 +113,7 @@ #define F_CFRA ((float)(G.scene->r.cfra)) #define SFRA (G.scene->r.sfra) #define EFRA (G.scene->r.efra) +#define STFRA (G.scene->frame_step) #define PSFRA ((G.scene->r.psfra != 0)? (G.scene->r.psfra): (G.scene->r.sfra)) #define PEFRA ((G.scene->r.psfra != 0)? (G.scene->r.pefra): (G.scene->r.efra)) #define FRA2TIME(a) ((((double) G.scene->r.frs_sec_base) * (a)) / G.scene->r.frs_sec) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 32522d1e866..3888cb48520 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -553,6 +553,10 @@ typedef struct Scene { /* Sculptmode data */ struct SculptData sculptdata; + + /* frame step. */ + int frame_step; + int pad; } Scene; diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 7958e66b44f..7f88acd3a87 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -496,7 +496,7 @@ PyObject *RenderData_Render( BPy_RenderData * self ) tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); @@ -599,7 +599,7 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self ) BPY_do_all_scripts(SCRIPT_RENDER, 1); tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 64cf7fcb37b..60557403143 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -185,7 +185,7 @@ void RE_TileProcessor(struct Render *re, int firsttile, int threaded); /* only RE_NewRender() needed, main Blender render calls */ void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra); +void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra, int tfra); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index bf2a72b4f9b..9d272d04506 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2559,10 +2559,12 @@ static void do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh) } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) +void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); + unsigned int lay; int cfrao= scene->r.cfra; + int nfra; /* do not fully call for each frame, it initializes & pops output window */ if(!render_initialize_from_scene(re, scene, 0)) @@ -2591,12 +2593,27 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) } } } else { - for(scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) { + for(nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) { char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ render_initialize_from_scene(re, scene, 1); - + + if(nfra!=scene->r.cfra) { + /* + * Skip this frame, but update for physics and particles system. + * From convertblender.c: + * in localview, lamps are using normal layers, objects only local bits. + */ + if(scene->lay & 0xFF000000) + lay= scene->lay & 0xFF000000; + else + lay= scene->lay; + + scene_update_for_newframe(scene, lay); + continue; + } + if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) { BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype); } @@ -2626,6 +2643,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) break; } + nfra+= tfra; } } diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index f2e20356f21..8ea71ce38dc 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -2315,12 +2315,13 @@ static void render_panel_anim(void) uiBlockEndAlign(block); uiBlockSetCol(block, TH_AUTO); - uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,40,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)"); - uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button"); + uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,50,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)"); + uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,50,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button"); uiBlockBeginAlign(block); - uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,10,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); - uiDefButI(block, NUM,REDRAWSEQ,"End:",789,10,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,20,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"End:",789,20,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"Step:",692,0,192,18, &G.scene->frame_step, 1.0, MAXFRAMEF, 0, 0, "Frame Step"); uiBlockEndAlign(block); } diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index c26eedd26fd..598b71930ed 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -1132,7 +1132,7 @@ static void do_render(int anim) } if(anim) - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); else RE_BlenderFrame(re, G.scene, G.scene->r.cfra); @@ -1338,16 +1338,28 @@ void BIF_do_ogl_render(View3D *v3d, int anim) if(anim) { bMovieHandle *mh= BKE_get_movie_handle(G.scene->r.imtype); + unsigned int lay; int cfrao= CFRA; + int nfra; if(BKE_imtype_is_movie(G.scene->r.imtype)) mh->start_movie(&G.scene->r, winx, winy); - for(CFRA= SFRA; CFRA<=EFRA; CFRA++) { + for(nfra= SFRA, CFRA= SFRA; CFRA<=EFRA; CFRA++) { /* user event can close window */ if(render_win==NULL) break; + if(nfra!=CFRA) { + if(G.scene->lay & 0xFF000000) + lay= G.scene->lay & 0xFF000000; + else + lay= G.scene->lay; + + scene_update_for_newframe(G.scene, lay); + continue; + } + do_ogl_view3d_render(re, v3d, winx, winy); glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32); if((G.scene->r.scemode & R_STAMP_INFO) && (G.scene->r.stamp & R_STAMP_DRAW)) { @@ -1382,6 +1394,7 @@ void BIF_do_ogl_render(View3D *v3d, int anim) printf("\n"); if(test_break()) break; + nfra+= STFRA; } if(BKE_imtype_is_movie(G.scene->r.imtype)) diff --git a/source/creator/creator.c b/source/creator/creator.c index ac81557110f..dffa755b264 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -202,6 +202,7 @@ static void print_help(void) printf (" -p \tOpen with lower left corner at , \n"); printf (" -m\t\tRead from disk (Don't buffer)\n"); printf (" -f \t\tSpecify FPS to start with\n"); + printf (" -j \tSet frame step to \n"); printf ("\nWindow options:\n"); printf (" -w\t\tForce opening with borders (default)\n"); @@ -623,7 +624,7 @@ int main(int argc, char **argv) if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_RENDER, 0); - RE_BlenderAnim(re, G.scene, frame, frame); + RE_BlenderAnim(re, G.scene, frame, frame, G.scene->frame_step); BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); } @@ -638,7 +639,7 @@ int main(int argc, char **argv) if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_RENDER, 1); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); @@ -669,6 +670,15 @@ int main(int argc, char **argv) printf("\nError: no blend loaded. cannot use '-e'.\n"); } break; + case 'j': + a++; + if(G.scene) { + int fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); + if (a < argc) (G.scene->frame_step) = fstep; + } else { + printf("\nError: no blend loaded. cannot use '-j'.\n"); + } + break; case 'P': a++; if (a < argc) { -- cgit v1.2.3 From a15296eff6ea2820694a5b1aedd7c17f9268ac71 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 19 Sep 2008 22:03:16 +0000 Subject: Small dependency debugging aid: now it also prints cycles for the object depsgrah instead of only armatures. --- source/blender/blenkernel/intern/depsgraph.c | 144 ++++++++++++++------------- 1 file changed, 75 insertions(+), 69 deletions(-) diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index d958c43aa40..11e61989dfa 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -865,12 +865,12 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) { - DagAdjList *itA = fob1->child; + DagAdjList *itA = fob2->parent; while (itA) { /* search if relation exist already */ - if (itA->node == fob2) { + if (itA->node == fob1) { itA->type |= rel; itA->count += 1; return; @@ -879,20 +879,23 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel } /* create new relation and insert at head. MALLOC alert! */ itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list"); - itA->node = fob2; + itA->node = fob1; itA->type = rel; itA->count = 1; - itA->next = fob1->child; + itA->next = fob2->parent; itA->name = name; - fob1->child = itA; + fob2->parent = itA; } -static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) { - DagAdjList *itA = fob2->parent; + DagAdjList *itA = fob1->child; + /* parent relation is for cycle checking */ + dag_add_parent_relation(forest, fob1, fob2, rel, name); + while (itA) { /* search if relation exist already */ - if (itA->node == fob1) { + if (itA->node == fob2) { itA->type |= rel; itA->count += 1; return; @@ -901,12 +904,12 @@ static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *f } /* create new relation and insert at head. MALLOC alert! */ itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list"); - itA->node = fob1; + itA->node = fob2; itA->type = rel; itA->count = 1; - itA->next = fob2->parent; + itA->next = fob1->child; itA->name = name; - fob2->parent = itA; + fob1->child = itA; } static char *dag_node_name(DagNode *node) @@ -966,6 +969,63 @@ static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, printf("\n"); } +static int dag_node_recurs_level(DagNode *node, int level) +{ + DagAdjList *itA; + int newlevel; + + node->color= DAG_BLACK; /* done */ + newlevel= ++level; + + for(itA= node->parent; itA; itA= itA->next) { + if(itA->node->color==DAG_WHITE) { + itA->node->ancestor_count= dag_node_recurs_level(itA->node, level); + newlevel= MAX2(newlevel, level+itA->node->ancestor_count); + } + else + newlevel= MAX2(newlevel, level+itA->node->ancestor_count); + } + + return newlevel; +} + +static void dag_check_cycle(DagForest *dag) +{ + DagNode *node; + DagAdjList *itA; + + /* tag nodes unchecked */ + for(node = dag->DagNode.first; node; node= node->next) + node->color= DAG_WHITE; + + for(node = dag->DagNode.first; node; node= node->next) { + if(node->color==DAG_WHITE) { + node->ancestor_count= dag_node_recurs_level(node, 0); + } + } + + /* check relations, and print errors */ + for(node = dag->DagNode.first; node; node= node->next) { + for(itA= node->parent; itA; itA= itA->next) { + if(itA->node->ancestor_count > node->ancestor_count) { + if(node->ob && itA->node->ob) { + printf("Dependency cycle detected:\n"); + dag_node_print_dependency_cycle(dag, itA->node, node, itA->name); + } + } + } + } + + /* parent relations are only needed for cycle checking, so free now */ + for(node = dag->DagNode.first; node; node= node->next) { + while (node->parent) { + itA = node->parent->next; + MEM_freeN(node->parent); + node->parent = itA; + } + } +} + /* * MainDAG is the DAG of all objects in current scene * used only for drawing there is one also in each scene @@ -1603,6 +1663,8 @@ void DAG_scene_sort(struct Scene *sce) build_dag(sce, DAG_RL_ALL_BUT_DATA); + dag_check_cycle(sce->theDag); + nqueue = queue_create(DAGQUEUEALLOC); for(node = sce->theDag->DagNode.first; node; node= node->next) { @@ -2212,57 +2274,6 @@ void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay) /* ******************* DAG FOR ARMATURE POSE ***************** */ -static int node_recurs_level(DagNode *node, int level) -{ - DagAdjList *itA; - int newlevel; - - node->color= DAG_BLACK; /* done */ - newlevel= ++level; - - for(itA= node->parent; itA; itA= itA->next) { - if(itA->node->color==DAG_WHITE) { - itA->node->ancestor_count= node_recurs_level(itA->node, level); - newlevel= MAX2(newlevel, level+itA->node->ancestor_count); - } - else - newlevel= MAX2(newlevel, level+itA->node->ancestor_count); - } - - return newlevel; -} - -static void pose_check_cycle(DagForest *dag) -{ - DagNode *node; - DagAdjList *itA; - - /* tag nodes unchecked */ - for(node = dag->DagNode.first; node; node= node->next) - node->color= DAG_WHITE; - - for(node = dag->DagNode.first; node; node= node->next) { - if(node->color==DAG_WHITE) { - node->ancestor_count= node_recurs_level(node, 0); - } - } - - /* check relations, and print errors */ - for(node = dag->DagNode.first; node; node= node->next) { - for(itA= node->parent; itA; itA= itA->next) { - if(itA->node->ancestor_count > node->ancestor_count) { - bPoseChannel *pchan= (bPoseChannel *)node->ob; - bPoseChannel *parchan= (bPoseChannel *)itA->node->ob; - - if(pchan && parchan) { - printf("Cycle detected:\n"); - dag_node_print_dependency_cycle(dag, itA->node, node, itA->name); - } - } - } - } -} - /* we assume its an armature with pose */ void DAG_pose_sort(Object *ob) { @@ -2292,7 +2303,6 @@ void DAG_pose_sort(Object *ob) if(pchan->parent) { node2 = dag_get_node(dag, pchan->parent); dag_add_relation(dag, node2, node, 0, "Parent Relation"); - dag_add_parent_relation(dag, node2, node, 0, "Parent Relation"); addtoroot = 0; } for (con = pchan->constraints.first; con; con=con->next) { @@ -2311,7 +2321,6 @@ void DAG_pose_sort(Object *ob) if(target) { node2 = dag_get_node(dag, target); dag_add_relation(dag, node2, node, 0, "Ipo Driver"); - dag_add_parent_relation(dag, node2, node, 0, "Ipo Driver"); /* uncommented this line, results in dependencies * not being added properly for this constraint, @@ -2331,7 +2340,6 @@ void DAG_pose_sort(Object *ob) if (target) { node2= dag_get_node(dag, target); dag_add_relation(dag, node2, node, 0, "IK Constraint"); - dag_add_parent_relation(dag, node2, node, 0, "IK Constraint"); if (con->type==CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = (bKinematicConstraint *)con->data; @@ -2348,7 +2356,6 @@ void DAG_pose_sort(Object *ob) while (parchan) { node3= dag_get_node(dag, parchan); dag_add_relation(dag, node2, node3, 0, "IK Constraint"); - dag_add_parent_relation(dag, node2, node3, 0, "IK Constraint"); segcount++; if (segcount==data->rootbone || segcount>255) break; // 255 is weak @@ -2365,11 +2372,10 @@ void DAG_pose_sort(Object *ob) } if (addtoroot == 1 ) { dag_add_relation(dag, rootnode, node, 0, "Root Bone Relation"); - dag_add_parent_relation(dag, rootnode, node, 0, "Root Bone Relation"); } } - pose_check_cycle(dag); + dag_check_cycle(dag); /* now we try to sort... */ tempbase.first= tempbase.last= NULL; -- cgit v1.2.3 From 5f3c4edb8ff475f94530d9bb5af3eeef816b5266 Mon Sep 17 00:00:00 2001 From: Diego Borghetti Date: Fri, 19 Sep 2008 22:51:05 +0000 Subject: == Outliner == Commit patch #8195 New outliner mode: Sequence, it's show all the sequence and strip that we have in the outliner, split it for type (particle, sound and so on..). Some notes to take care: * The strip can be selected with LMB * The sequence can be deleted with XKEY (all the selected) * The "Meta" are stored in a single tree (Meta Strip) with all the sequence. * Duplicate sequence (with the same name) are store in a single tree and you can select all the Sequence with LMB in the "root" entry. * Also show the directory path. [ As Ton point in the tracker, still need more work (and options, Luca made a really good list in the tracker), so move to the trunk and start working here, probably a good topic for next meeting. ] --- source/blender/include/BIF_editseq.h | 1 + source/blender/include/BIF_outliner.h | 5 +- source/blender/makesdna/DNA_space_types.h | 1 + source/blender/src/editseq.c | 29 +++- source/blender/src/header_oops.c | 8 +- source/blender/src/outliner.c | 279 ++++++++++++++++++++++++++++-- 6 files changed, 299 insertions(+), 24 deletions(-) diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index b353e7bb45c..be30a3eaaf3 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -52,6 +52,7 @@ struct Sequence* find_next_prev_sequence(struct Sequence *test, int lr, int sel) struct Sequence* find_nearest_seq(int *hand); int insert_gap(int gap, int cfra); void make_meta(void); +void select_single_seq(struct Sequence *seq, int deselect_all); void select_channel_direction(struct Sequence *test,int lr); void select_more_seq(void); void select_less_seq(void); diff --git a/source/blender/include/BIF_outliner.h b/source/blender/include/BIF_outliner.h index abf8b58b1c9..fcd206bb828 100644 --- a/source/blender/include/BIF_outliner.h +++ b/source/blender/include/BIF_outliner.h @@ -41,7 +41,7 @@ typedef struct TreeElement { short idcode; // from TreeStore id short xend; // width of item display, for select char *name; - void *directdata; // Armature Bones, Base, ... + void *directdata; // Armature Bones, Base, Sequence, Strip... } TreeElement; /* TreeElement->flag */ @@ -77,6 +77,9 @@ typedef struct TreeElement { #define TSE_LINKED_LAMP 23 #define TSE_POSEGRP_BASE 24 #define TSE_POSEGRP 25 +#define TSE_SEQUENCE 26 +#define TSE_SEQ_STRIP 27 +#define TSE_SEQUENCE_DUP 28 /* outliner search flags */ #define OL_FIND 0 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index c59cafc1ef0..226a3ecd834 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -589,6 +589,7 @@ typedef struct SpaceImaSel { #define SO_LIBRARIES 7 #define SO_VERSE_SESSION 8 #define SO_VERSE_MS 9 +#define SO_SEQUENCE 10 /* SpaceOops->storeflag */ #define SO_TREESTORE_CLEANUP 1 diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index e9d0b57a166..d16e3f28671 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -687,6 +687,24 @@ static void recurs_sel_seq(Sequence *seqm) } } +void select_single_seq(Sequence *seq, int deselect_all) +{ + if(deselect_all) + deselect_all_seq(); + set_last_seq(seq); + + if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { + if(seq->strip) + strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1); + } + else if((seq->type==SEQ_HD_SOUND) || (seq->type==SEQ_RAM_SOUND)) { + if(seq->strip) + strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1); + } + seq->flag|= SELECT; + recurs_sel_seq(seq); +} + void swap_select_seq(void) { Sequence *seq; @@ -932,7 +950,11 @@ void mouse_select_seq(void) } force_draw_plus(SPACE_BUTS, 0); - if(get_last_seq()) allqueue(REDRAWIPO, 0); + if(get_last_seq()) { + allqueue(REDRAWIPO, 0); + allqueue(REDRAWOOPS, 0); + } + BIF_undo_push("Select Strips, Sequencer"); std_rmouse_transform(transform_seq_nomarker); @@ -2211,6 +2233,7 @@ void del_seq(void) BIF_undo_push("Delete Strip(s), Sequencer"); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); } static Sequence *dupli_seq(Sequence *seq) @@ -2897,7 +2920,7 @@ void un_meta(void) BIF_undo_push("Un-Make Meta Strip, Sequencer"); allqueue(REDRAWSEQ, 0); - + allqueue(REDRAWOOPS, 0); } void exit_meta(void) @@ -2930,6 +2953,7 @@ void exit_meta(void) MEM_freeN(ms); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); BIF_undo_push("Exit Meta Strip, Sequence"); } @@ -2958,6 +2982,7 @@ void enter_meta(void) set_last_seq(NULL); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); BIF_undo_push("Enter Meta Strip, Sequence"); } diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c index ad65705b79d..68326c330ad 100644 --- a/source/blender/src/header_oops.c +++ b/source/blender/src/header_oops.c @@ -559,15 +559,15 @@ void oops_buttons(void) else { if(G.main->library.first) #ifdef WITH_VERSE - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #else - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ else #ifdef WITH_VERSE - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #else - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ } diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 52c5592be38..8d33496f068 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -56,9 +56,12 @@ #include "DNA_texture_types.h" #include "DNA_text_types.h" #include "DNA_world_types.h" +#include "DNA_sequence_types.h" #include "BLI_blenlib.h" +#include "IMB_imbuf_types.h" + #include "BKE_constraint.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" @@ -100,6 +103,7 @@ #include "BIF_screen.h" #include "BIF_space.h" #include "BIF_toolbox.h" +#include "BIF_editseq.h" #ifdef WITH_VERSE #include "BIF_verse.h" @@ -301,7 +305,7 @@ static ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode) while(te) { tselem= TREESTORE(te); - if(te->idcode==idcode && tselem->type==0) return tselem->id; + if(tselem->type==0 && te->idcode==idcode) return tselem->id; te= te->parent; } return NULL; @@ -558,8 +562,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->parent= parent; te->index= index; // for data arays - te->name= id->name+2; // default, can be overridden by Library or non-ID data - te->idcode= GS(id->name); + if((type!=TSE_SEQUENCE) && (type != TSE_SEQ_STRIP) && (type != TSE_SEQUENCE_DUP)) { + te->name= id->name+2; // default, can be overridden by Library or non-ID data + te->idcode= GS(id->name); + } if(type==0) { @@ -898,6 +904,65 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i break; } } + else if(type==TSE_SEQUENCE) { + Sequence *seq= (Sequence*) idv; + Sequence *p; + + /* + * The idcode is a little hack, but the outliner + * only check te->idcode if te->type is equal to zero, + * so this is "safe". + */ + te->idcode= seq->type; + te->directdata= seq; + + if(seq->type<7) { + /* + * This work like the sequence. + * If the sequence have a name (not default name) + * show it, in other case put the filename. + */ + if(strcmp(seq->name, "SQ")) + te->name= seq->name; + else { + if((seq->strip) && (seq->strip->stripdata)) + te->name= seq->strip->stripdata->name; + else if((seq->strip) && (seq->strip->tstripdata) && (seq->strip->tstripdata->ibuf)) + te->name= seq->strip->tstripdata->ibuf->name; + else + te->name= "SQ None"; + } + + if(seq->type==SEQ_META) { + te->name= "Meta Strip"; + p= seq->seqbase.first; + while(p) { + outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + p= p->next; + } + } + else + outliner_add_element(soops, &te->subtree, (void*)seq->strip, te, TSE_SEQ_STRIP, index); + } + else + te->name= "Effect"; + } + else if(type==TSE_SEQ_STRIP) { + Strip *strip= (Strip *)idv; + + if(strip->dir) + te->name= strip->dir; + else + te->name= "Strip None"; + te->directdata= strip; + } + else if(type==TSE_SEQUENCE_DUP) { + Sequence *seq= (Sequence*)idv; + + te->idcode= seq->type; + te->directdata= seq; + te->name= seq->strip->stripdata->name; + } #ifdef WITH_VERSE else if(type==ID_VS) { struct VerseSession *session = (VerseSession*)idv; @@ -964,6 +1029,62 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb) } } +/* Helped function to put duplicate sequence in the same tree. */ +int need_add_seq_dup(Sequence *seq) +{ + Sequence *p; + + if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name)) + return(1); + + /* + * First check backward, if we found a duplicate + * sequence before this, don't need it, just return. + */ + p= seq->prev; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->prev; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + return(2); + p= p->prev; + } + + p= seq->next; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + return(0); + p= p->next; + } + return(1); +} + +void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index) +{ + TreeElement *ch; + Sequence *p; + + p= seq; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + ch= outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + p= p->next; + } +} + static void outliner_build_tree(SpaceOops *soops) { Base *base; @@ -1120,6 +1241,30 @@ static void outliner_build_tree(SpaceOops *soops) } } #endif + else if(soops->outlinevis==SO_SEQUENCE) { + Sequence *seq; + Editing *ed; + int op; + + ed= G.scene->ed; + if(!ed) + return; + + seq= ed->seqbasep->first; + if(!seq) + return; + + while(seq) { + op= need_add_seq_dup(seq); + if(op==1) + ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + else if(op==0) { + ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0); + add_seq_dup(soops, seq, ten, 0); + } + seq= seq->next; + } + } else { ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0); if(ten) ten->directdata= BASACT; @@ -1884,6 +2029,50 @@ static int tree_element_active_pose(TreeElement *te, TreeStoreElem *tselem, int return 0; } +static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem, int set) +{ + Sequence *seq= (Sequence*) te->directdata; + + if(set) { + select_single_seq(seq, 1); + allqueue(REDRAWSEQ, 0); + } + else { + if(seq->flag & SELECT) + return(1); + } + return(0); +} + +static int tree_element_active_sequence_dup(TreeElement *te, TreeStoreElem *tselem, int set) +{ + Sequence *seq, *p; + Editing *ed; + + seq= (Sequence*)te->directdata; + if(set==0) { + if(seq->flag & SELECT) + return(1); + return(0); + } + + select_single_seq(seq, 1); + ed= G.scene->ed; + p= ed->seqbasep->first; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + select_single_seq(p, 0); + p= p->next; + } + allqueue(REDRAWSEQ, 0); + return(0); +} + /* generic call for non-id data to make/check active in UI */ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set) { @@ -1914,6 +2103,12 @@ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStore return tree_element_active_renderlayer(te, tselem, set); case TSE_POSEGRP: return tree_element_active_posegroup(te, tselem, set); + case TSE_SEQUENCE: + return tree_element_active_sequence(te, tselem, set); + break; + case TSE_SEQUENCE_DUP: + return tree_element_active_sequence_dup(te, tselem, set); + break; } return 0; } @@ -2035,6 +2230,8 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even if (G.qual == LR_CTRLKEY) { if(ELEM9(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) error("Cannot edit builtin name"); + else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) + error("Cannot edit sequence name"); else if(tselem->id->lib) { error_libdata(); } else if(te->idcode == ID_LI && te->parent) { @@ -2044,7 +2241,8 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even } } else { /* always makes active object */ - tree_element_active_object(soops, te); + if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) + tree_element_active_object(soops, te); if(tselem->type==0) { // the lib blocks /* editmode? */ @@ -2070,7 +2268,7 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even } else if(event==RIGHTMOUSE) { #ifdef WITH_VERSE - if(ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS)) + if((tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) && ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS)) verse_operation_menu(te); else #endif @@ -2274,8 +2472,8 @@ static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) /* check if 'tse' is in treestore */ tselem= ts->data; for(a=0; ausedelem; a++, tselem++) { - if(tselem->id==tse->id) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if(tselem->id==tse->id) { break; } } @@ -2488,12 +2686,18 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, tselem= TREESTORE(te); if(tselem->flag & TSE_SELECTED) { if(tselem->type) { + if(tselem->type==TSE_SEQUENCE) + *datalevel= TSE_SEQUENCE; + else if(tselem->type==TSE_SEQ_STRIP) + *datalevel= TSE_SEQ_STRIP; + else if(tselem->type==TSE_SEQUENCE_DUP) + *datalevel= TSE_SEQUENCE_DUP; #ifdef WITH_VERSE - if(te->idcode==ID_VS) *datalevel= TSE_VERSE_SESSION; + else if(te->idcode==ID_VS) *datalevel= TSE_VERSE_SESSION; else if(te->idcode==ID_VN) *datalevel= TSE_VERSE_OBJ_NODE; else if(*datalevel==0) *datalevel= tselem->type; #else - if(*datalevel==0) *datalevel= tselem->type; + else if(*datalevel==0) *datalevel= tselem->type; #endif else if(*datalevel!=tselem->type) *datalevel= -1; } @@ -2783,6 +2987,15 @@ static void vsession_cb(int event, TreeElement *te, TreeStoreElem *tselem) } #endif +static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem) +{ + Sequence *seq= (Sequence*) te->directdata; + if(event==1) { + select_single_seq(seq, 1); + allqueue(REDRAWSEQ, 0); + } +} + static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, void (*operation_cb)(int, TreeElement *, TreeStoreElem *)) { @@ -2805,10 +3018,14 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li void outliner_del(ScrArea *sa) { SpaceOops *soops= sa->spacedata.first; - outliner_do_object_operation(soops, &soops->tree, object_delete_cb); - DAG_scene_sort(G.scene); - countall(); - BIF_undo_push("Delete Objects"); + if(soops->outlinevis==SO_SEQUENCE) + del_seq(); + else { + outliner_do_object_operation(soops, &soops->tree, object_delete_cb); + DAG_scene_sort(G.scene); + countall(); + BIF_undo_push("Delete Objects"); + } allqueue(REDRAWALL, 0); } @@ -2941,7 +3158,13 @@ void outliner_operation_menu(ScrArea *sa) } } #endif - + else if(datalevel==TSE_SEQUENCE) { + short event= pupmenu("Sequence Operations %t|Select %x1"); + if(event>0) { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); + } + } + allqueue(REDRAWOOPS, 0); allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWVIEW3D, 0); @@ -3021,7 +3244,26 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen BIF_icon_draw(x, y, ICON_MATERIAL_DEHLT); break; case TSE_POSEGRP_BASE: BIF_icon_draw(x, y, ICON_VERTEXSEL); break; - + case TSE_SEQUENCE: + if((te->idcode==SEQ_MOVIE) || (te->idcode==SEQ_MOVIE_AND_HD_SOUND)) + BIF_icon_draw(x, y, ICON_SEQUENCE); + else if(te->idcode==SEQ_META) + BIF_icon_draw(x, y, ICON_DOT); + else if(te->idcode==SEQ_SCENE) + BIF_icon_draw(x, y, ICON_SCENE); + else if((te->idcode==SEQ_RAM_SOUND) || (te->idcode==SEQ_HD_SOUND)) + BIF_icon_draw(x, y, ICON_SOUND); + else if(te->idcode==SEQ_IMAGE) + BIF_icon_draw(x, y, ICON_IMAGE_COL); + else + BIF_icon_draw(x, y, ICON_PARTICLES); + break; + case TSE_SEQ_STRIP: + BIF_icon_draw(x, y, ICON_LIBRARY_DEHLT); + break; + case TSE_SEQUENCE_DUP: + BIF_icon_draw(x, y, ICON_OBJECT); + break; #ifdef WITH_VERSE case ID_VS: case ID_MS: @@ -3234,7 +3476,7 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st } /* open/close icon, only when sublevels, except for scene */ - if(te->subtree.first || (te->idcode==ID_SCE && tselem->type==0)) { + if(te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE)) { int icon_x; if((tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) || ELEM4(te->idcode,ID_VN,ID_VS, ID_MS, ID_SS)) icon_x = startx; @@ -3255,7 +3497,7 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st tselem_draw_icon(startx+offsx, *starty+2, tselem, te); offsx+= OL_X; - if(tselem->id->lib && tselem->type==0) { + if(tselem->type==0 && tselem->id->lib) { glPixelTransferf(GL_ALPHA_SCALE, 0.5); if(tselem->id->flag & LIB_INDIRECT) BIF_icon_draw(startx+offsx, *starty+2, ICON_DATALIB); @@ -3761,6 +4003,9 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb) if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) { if(tselem->flag & TSE_TEXTBUT) { + /* If we add support to rename Sequence. + * need change this. + */ if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name); -- cgit v1.2.3 From 4d551c0a0ded51c443f86696d5644510c0ca3065 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Sep 2008 04:37:10 +0000 Subject: Text.c - calling Text_reset within C/Api funcs didnt decref the Py_None Text_reset returned. - Text_delete wasnt checking if the input was an int. - a number of functions wernt checking if the text was removed. console.py - added clear output - command history leaves empty command before wrapping - add imports as dummy user input so commands written to a text file will run. - faster writing of output to a textblock. --- release/scripts/console.py | 65 ++++++++++++++---------- source/blender/python/api2_2x/Text.c | 95 +++++++++++++++++------------------- 2 files changed, 84 insertions(+), 76 deletions(-) diff --git a/release/scripts/console.py b/release/scripts/console.py index 9a18c724d47..cc1788ce24c 100644 --- a/release/scripts/console.py +++ b/release/scripts/console.py @@ -67,6 +67,8 @@ __FONT_SIZE__ = 2 # index for the list above, normal default. global __CONSOLE_LINE_OFFSET__ __CONSOLE_LINE_OFFSET__ = 0 +cmdBuffer = [] # dosnt need to be global + ''' # Generic Blender functions def getActScriptWinRect(): @@ -159,19 +161,13 @@ def include(filename): return compile(filedata, filename, 'exec') # Writes command line data to a blender text file. -def writeCmdData(cmdLineList, type): - if type == 3: - typeList = [0,1,2, 3, None] # all - else: - typeList = [type] # so we can use athe lists 'in' methiod - +def writeCmdData(type): newText = Text.New('command_output.py', 1) - for myCmd in cmdLineList: - if myCmd.type in typeList: # user input - newText.write('%s\n' % myCmd.cmd) + if type == 3: newText.write('\n'.join( [ myCmd.cmd for myCmd in cmdBuffer ] )) + else: newText.write('\n'.join( [ myCmd.cmd for myCmd in cmdBuffer if myCmd.type is type] )) Draw.PupMenu('%s written' % newText.name) -def insertCmdData(cmdBuffer): +def insertCmdData(): texts = list(bpy.data.texts) textNames = [tex.name for tex in texts] if textNames: @@ -337,7 +333,6 @@ def handle_event(evt, val): # Insert Char into the cammand line def insCh(ch): # Instert a char - global cmdBuffer global cursor # Later account for a cursor variable cmdBuffer[-1].cmd = ('%s%s%s' % ( cmdBuffer[-1].cmd[:cursor], ch, cmdBuffer[-1].cmd[cursor:])) @@ -346,7 +341,7 @@ def handle_event(evt, val): # Define Complex Key Actions # #------------------------------------------------------------------------------# def actionEnterKey(): - global histIndex, cursor, cmdBuffer + global histIndex, cursor def getIndent(string): # Gather white space to add in the previous line @@ -412,14 +407,20 @@ def handle_event(evt, val): # Clear the output based on __LINE_HISTORY__ if len(cmdBuffer) > __LINE_HISTORY__: - cmdBuffer = cmdBuffer[-__LINE_HISTORY__:] + cmdBuffer[:__LINE_HISTORY__] = [] histIndex = cursor = -1 # Reset cursor and history def actionUpKey(): - global histIndex, cmdBuffer + global histIndex if abs(histIndex)+1 >= len(cmdBuffer): histIndex = -1 + + # When wrapping allow 1 plank lines + if cmdBuffer[-1].cmd != '': + cmdBuffer[-1].cmd = '' + return + histIndex_orig = histIndex histIndex -= 1 @@ -431,9 +432,15 @@ def handle_event(evt, val): cmdBuffer[-1].cmd = cmdBuffer[histIndex].cmd def actionDownKey(): - global histIndex, cmdBuffer + global histIndex if histIndex >= -2: histIndex = -len(cmdBuffer) + + # When wrapping allow 1 plank lines + if cmdBuffer[-1].cmd != '': + cmdBuffer[-1].cmd = '' + return + histIndex_orig = histIndex histIndex += 1 while (cmdBuffer[histIndex].type != 0 and histIndex != -2) or \ @@ -446,18 +453,18 @@ def handle_event(evt, val): def actionRightMouse(): global __FONT_SIZE__ - choice = Draw.PupMenu('Console Menu%t|Write Input Data (white)|Write Output Data (blue)|Write Error Data (red)|Write All Text|%l|Insert Blender text|%l|Font Size|%l|Quit') + choice = Draw.PupMenu('Console Menu%t|Write Input Data (white)|Write Output Data (blue)|Write Error Data (red)|Write All Text|%l|Insert Blender text|%l|Font Size|%l|Clear Output|Quit') if choice == 1: - writeCmdData(cmdBuffer, 0) # type 0 user + writeCmdData(0) # type 0 user elif choice == 2: - writeCmdData(cmdBuffer, 1) # type 1 user output + writeCmdData(1) # type 1 user output elif choice == 3: - writeCmdData(cmdBuffer, 2) # type 2 errors + writeCmdData(2) # type 2 errors elif choice == 4: - writeCmdData(cmdBuffer, 3) # All + writeCmdData(3) # All elif choice == 6: - insertCmdData(cmdBuffer) # Insert text from Blender and run it. + insertCmdData() # Insert text from Blender and run it. elif choice == 8: # Fontsize. font_choice = Draw.PupMenu('Font Size%t|Large|Normal|Small|Tiny') @@ -471,8 +478,10 @@ def handle_event(evt, val): elif font_choice == 4: __FONT_SIZE__ = 0 Draw.Redraw() - - elif choice == 10: # Exit + elif choice == 10: # Clear all output + cmdBuffer[:] = [cmd for cmd in cmdBuffer if cmd.type == 0] # keep user input + Draw.Redraw() + elif choice == 11: # Exit Draw.Exit() @@ -783,7 +792,6 @@ __CONSOLE_VAR_DICT__ = {} # Initialize var dict # Print Startup lines, add __bpydoc__ to the console startup. -cmdBuffer = [] for l in __bpydoc__.split('
'): cmdBuffer.append( cmdLine(l, 1, None) ) @@ -827,12 +835,19 @@ def include_console(includeFile): def standard_imports(): # Write local to global __CONSOLE_VAR_DICT__ for reuse, + + exec('%s%s' % ('__CONSOLE_VAR_DICT__["bpy"]=', 'bpy')) + exec('%s%s' % ('__CONSOLE_VAR_DICT__["Blender"]=', 'Blender')) + for ls in (dir(), dir(Blender)): for __TMP_VAR_NAME__ in ls: # Execute the local > global coversion. exec('%s%s' % ('__CONSOLE_VAR_DICT__[__TMP_VAR_NAME__]=', __TMP_VAR_NAME__)) - exec('%s%s' % ('__CONSOLE_VAR_DICT__["bpy"]=', 'bpy')) + # Add dummy imports to input so output scripts to a text file work as expected + cmdBuffer.append(cmdLine('import bpy', 0, 1)) + cmdBuffer.append(cmdLine('import Blender', 0, 1)) # pretend we have been executed, as we kindof have. + cmdBuffer.append(cmdLine('from Blender import *', 0, 1)) if scriptDir and console_autoexec: include_console(console_autoexec) # pass the blender module diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c index 9719daaa3d4..c8b96fbd97e 100644 --- a/source/blender/python/api2_2x/Text.c +++ b/source/blender/python/api2_2x/Text.c @@ -47,6 +47,10 @@ #define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW +/* checks for the group being removed */ +#define TEXT_DEL_CHECK_PY(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Text has been removed" ) ) +#define TEXT_DEL_CHECK_INT(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Text has been removed" ) ) + /*****************************************************************************/ /* Python API function prototypes for the Text module. */ /*****************************************************************************/ @@ -109,6 +113,8 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args ); static PyObject *Text_suggest( BPy_Text * self, PyObject * args ); static PyObject *Text_showDocs( BPy_Text * self, PyObject * args ); +static void text_reset_internal( BPy_Text * self ); /* internal func */ + /*****************************************************************************/ /* Python BPy_Text methods table: */ /*****************************************************************************/ @@ -377,8 +383,7 @@ PyObject *Text_CreatePyObject( Text * txt ) "couldn't create BPy_Text PyObject" ); pytxt->text = txt; - pytxt->iol = NULL; - pytxt->ioc = -1; + text_reset_internal(pytxt); return ( PyObject * ) pytxt; } @@ -388,6 +393,7 @@ PyObject *Text_CreatePyObject( Text * txt ) /*****************************************************************************/ static PyObject *Text_getFilename( BPy_Text * self ) { + TEXT_DEL_CHECK_PY(self); if( self->text->name ) return PyString_FromString( self->text->name ); @@ -398,7 +404,9 @@ static PyObject *Text_getNLines( BPy_Text * self ) { /* text->nlines isn't updated in Blender (?) */ int nlines = 0; TextLine *line; - + + TEXT_DEL_CHECK_PY(self); + line = self->text->lines.first; while( line ) { /* so we have to count them ourselves */ @@ -415,9 +423,7 @@ static PyObject *Text_clear( BPy_Text * self) { int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); oldstate = txt_get_undostate( ); txt_set_undostate( 1 ); @@ -428,11 +434,15 @@ static PyObject *Text_clear( BPy_Text * self) Py_RETURN_NONE; } -static PyObject *Text_reset( BPy_Text * self ) +static void text_reset_internal( BPy_Text * self ) { self->iol = NULL; self->ioc = -1; +} +static PyObject *Text_reset( BPy_Text * self ) +{ + text_reset_internal(self); Py_RETURN_NONE; } @@ -440,9 +450,7 @@ static PyObject *Text_readline( BPy_Text * self ) { PyObject *tmpstr; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); /* Reset */ if (!self->iol && self->ioc == -1) { @@ -476,20 +484,18 @@ static PyObject *Text_write( BPy_Text * self, PyObject * value ) char *str = PyString_AsString(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - if( !str ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); + TEXT_DEL_CHECK_PY(self); + oldstate = txt_get_undostate( ); txt_insert_buf( self->text, str ); txt_move_eof( self->text, 0 ); txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -499,19 +505,17 @@ static PyObject *Text_insert( BPy_Text * self, PyObject * value ) char *str = PyString_AsString(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - if( !str ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); + + TEXT_DEL_CHECK_PY(self); oldstate = txt_get_undostate( ); txt_insert_buf( self->text, str ); txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -521,11 +525,10 @@ static PyObject *Text_delete( BPy_Text * self, PyObject * value ) int num = PyInt_AsLong(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - - if( !num ) + TEXT_DEL_CHECK_PY(self); + + /* zero num is invalid and -1 is an error value */ + if( !num || (num==-1 && PyErr_Occurred())) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected non-zero int argument" ); @@ -540,7 +543,7 @@ static PyObject *Text_delete( BPy_Text * self, PyObject * value ) } txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -550,6 +553,8 @@ static PyObject *Text_set( BPy_Text * self, PyObject * args ) int ival; char *attr; + TEXT_DEL_CHECK_PY(self); + if( !PyArg_ParseTuple( args, "si", &attr, &ival ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string and an int as arguments" ); @@ -570,9 +575,7 @@ static PyObject *Text_asLines( BPy_Text * self, PyObject * args ) PyObject *list, *tmpstr; int start=0, end=-1, i; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); if( !PyArg_ParseTuple( args, "|ii", &start, &end ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -608,10 +611,9 @@ static PyObject *Text_getCursorPos( BPy_Text * self ) TextLine *linep; int row, col; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if( !text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); for (row=0,linep=text->lines.first; linep!=text->curl; linep=linep->next) row++; @@ -625,9 +627,7 @@ static PyObject *Text_setCursorPos( BPy_Text * self, PyObject * args ) int row, col; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "ii", &row, &col)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -649,10 +649,9 @@ static PyObject *Text_getSelectPos( BPy_Text * self ) TextLine *linep; int row, col; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if( !text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); for (row=0,linep=text->lines.first; linep!=text->sell; linep=linep->next) row++; @@ -666,9 +665,7 @@ static PyObject *Text_setSelectPos( BPy_Text * self, PyObject * args ) int row, col; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "ii", &row, &col)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -690,10 +687,9 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args ) Text *text; char color[4]; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if (!text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); if (!PyArg_ParseTuple(args, "i(iii)i", &group, &r, &g, &b, &flags)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -723,9 +719,7 @@ static PyObject *Text_suggest( BPy_Text * self, PyObject * args ) char *prefix = NULL, *name, type; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); /* Parse args for a list of strings/tuples */ if (!PyArg_ParseTuple(args, "O!|s", &PyList_Type, &list, &prefix)) @@ -782,10 +776,8 @@ static PyObject *Text_showDocs( BPy_Text * self, PyObject * args ) { char *docs; SpaceText *st; - - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "s", &docs)) return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -839,6 +831,7 @@ static PyObject *Text_repr( BPy_Text * self ) /*****************************************************************************/ static PyObject *Text_getMode(BPy_Text * self) { + TEXT_DEL_CHECK_PY(self); return PyInt_FromLong( self->text->flags ); } -- cgit v1.2.3 From 415868b5e2dc1732aebe19c1fbd17d180249d396 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 20 Sep 2008 09:17:40 +0000 Subject: Fix for gcc compiler warning about a call to do_lamp_tex() resulting in "overflow in implicit constant conversion" --- source/blender/render/intern/include/texture.h | 2 +- source/blender/render/intern/source/texture.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 62833566652..be5471e07c4 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -55,7 +55,7 @@ struct ImBuf; void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf); void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag); void do_material_tex(struct ShadeInput *shi); -void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, short effect); +void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect); void init_render_textures(Render *re); diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 628ac95710a..c14425e274f 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -2301,7 +2301,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f /* ------------------------------------------------------------------------- */ /* colf supposed to be initialized with la->r,g,b */ -void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, short effect) +void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int effect) { Object *ob; MTex *mtex; -- cgit v1.2.3 From e7c62e903882947afce9dfea5beb1a2ed320cbe3 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 20 Sep 2008 10:02:13 +0000 Subject: Bugfix #17652: "K" mode for controlling keys and drivers cause crashes When using a transform and there didn't exist an IPO-channel for that transform's focus (i.e. no rot curves when rotating) and "K" mode was active, there would be a crash due to missing checks for such situations. --- source/blender/src/editipo.c | 10 +++------- source/blender/src/transform.c | 6 +++--- source/blender/src/transform_conversions.c | 6 +++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index 09862636085..ecb9e845104 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -3589,15 +3589,11 @@ void make_ipokey_transform(Object *ob, ListBase *lb, int sel) icu= icu->next; } - - ik= lb->first; - while(ik) { - /* map ipo-keys for drawing/editing if scaled ipo */ - if (NLA_IPO_SCALED) { + if (NLA_IPO_SCALED) { + for (ik= lb->first; ik; ik= ik->next) { + /* map ipo-keys for drawing/editing if scaled ipo */ ik->val= get_action_frame_inv(OBACT, ik->val); } - - ik= ik->next; } } diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 705a5f868e7..e21d543d34e 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -2548,9 +2548,9 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short float rot[3]; /* current IPO value for compatible euler */ - current_rot[0] = tdi->rotx[0]; - current_rot[1] = tdi->roty[0]; - current_rot[2] = tdi->rotz[0]; + current_rot[0] = (tdi->rotx) ? tdi->rotx[0] : 0.0f; + current_rot[1] = (tdi->roty) ? tdi->roty[0] : 0.0f; + current_rot[2] = (tdi->rotz) ? tdi->rotz[0] : 0.0f; VecMulf(current_rot, (float)(M_PI_2 / 9.0)); /* calculate the total rotatation in eulers */ diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 210a81927c8..7a2ca3f088b 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -4033,7 +4033,7 @@ static void createTransObject(TransInfo *t) ob= base->object; /* store ipo keys? */ - if (ob->id.lib == 0 && ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { + if ((ob->id.lib == 0) && (ob->ipo) && (ob->ipo->showkey) && (ob->ipoflag & OB_DRAWKEY)) { elems.first= elems.last= NULL; make_ipokey_transform(ob, &elems, 1); /* '1' only selected keys */ @@ -4041,7 +4041,7 @@ static void createTransObject(TransInfo *t) for(ik= elems.first; ik; ik= ik->next) t->total++; - + if(elems.first==NULL) t->total++; } @@ -4074,7 +4074,7 @@ static void createTransObject(TransInfo *t) } /* store ipo keys? */ - if(ob->id.lib == 0 && ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { + if((ob->id.lib == 0) && (ob->ipo) && (ob->ipo->showkey) && (ob->ipoflag & OB_DRAWKEY)) { popfirst(&elems); // bring back pushed listbase -- cgit v1.2.3 From c282178411a07fbca859885bd3e674e186756695 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 20 Sep 2008 10:10:50 +0000 Subject: Patch #17654: Fix for Scene.Get with input >20 chars Patch by Darryl Pogue (paradox). Blender cuts off datablock names at 20 chars, which causes issues if you're trying to access Scenes with a string longer than 20 chars. Ex. s = 'GuildPub-Writers_GLOBAL' Blender.Scene.New(s) #This creates the scene "GuildPub-Writers_GLOB" Blender.Scene.Get(s) #This throws an error: the name and the string don't match This patch cuts down the input of Scene.Get() to the 20 char limits, thus making the the above example return the correct scene. --- source/blender/python/api2_2x/Scene.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index eba951b8813..edb5e015eea 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -635,16 +635,19 @@ static PyObject *M_Scene_New( PyObject * self, PyObject * args, /*-----------------------Scene.Get()------------------------------------*/ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) { - char *name = NULL; + char *tname = NULL, name[22]; Scene *scene_iter; - if( !PyArg_ParseTuple( args, "|s", &name ) ) + if( !PyArg_ParseTuple( args, "|s", &tname ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument (or nothing)" ) ); + strncpy(name, tname, 21); + if( strlen(tname) >= 21 ) name[21]= 0; + scene_iter = G.main->scene.first; - if( name ) { /* (name) - Search scene by name */ + if( tname ) { /* (name) - Search scene by name */ PyObject *wanted_scene = NULL; -- cgit v1.2.3 From 224607982ad664eaccfd703cff105eb6393b2d3e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Sep 2008 10:11:42 +0000 Subject: Python api access to obcolor Option to copy obcolor in the copy menu Option to select same color in select grouped menu console.py - mistake in last commit caused a python error --- release/scripts/console.py | 8 ++++---- source/blender/blenlib/BLI_arithb.h | 1 + source/blender/blenlib/intern/arithb.c | 13 ++++++++++++ source/blender/python/api2_2x/Object.c | 32 ++++++++++++++++++++++++++++- source/blender/python/api2_2x/doc/Object.py | 2 ++ source/blender/src/editobject.c | 5 ++++- source/blender/src/space.c | 24 +++++++++++++++++++++- 7 files changed, 78 insertions(+), 7 deletions(-) diff --git a/release/scripts/console.py b/release/scripts/console.py index cc1788ce24c..0e46f41f581 100644 --- a/release/scripts/console.py +++ b/release/scripts/console.py @@ -417,8 +417,8 @@ def handle_event(evt, val): histIndex = -1 # When wrapping allow 1 plank lines - if cmdBuffer[-1].cmd != '': - cmdBuffer[-1].cmd = '' + if cmdBuffer[-1].cmd != ' ': + cmdBuffer[-1].cmd = ' ' return histIndex_orig = histIndex @@ -437,8 +437,8 @@ def handle_event(evt, val): histIndex = -len(cmdBuffer) # When wrapping allow 1 plank lines - if cmdBuffer[-1].cmd != '': - cmdBuffer[-1].cmd = '' + if cmdBuffer[-1].cmd != ' ': + cmdBuffer[-1].cmd = ' ' return histIndex_orig = histIndex diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 6e54fae58d0..4b858dcb503 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -91,6 +91,7 @@ float saasin(float fac); float sasqrt(float fac); int FloatCompare(float *v1, float *v2, float limit); +int FloatCompare4(float *v1, float *v2, float limit); float FloatLerpf(float target, float origin, float fac); float CalcNormFloat(float *v1, float *v2, float *v3, float *n); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index f89f90f7045..c6634eb7707 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -1026,6 +1026,19 @@ int FloatCompare( float *v1, float *v2, float limit) return 0; } +int FloatCompare4( float *v1, float *v2, float limit) +{ + + if( fabs(v1[0]-v2[0])object->col[0], self->object->col[1], self->object->col[2], self->object->col[3] ); +} + +static int Object_setColor( BPy_Object *self, PyObject *value ) +{ + int i; + float color[4]; + struct Object *object = self->object; + + value = PySequence_Tuple( value ); + + if( !value || !PyArg_ParseTuple( value, "ffff", &color[0], &color[1], &color[2], &color[3] ) ) { + Py_XDECREF( value ); + return EXPP_ReturnIntError( PyExc_TypeError, + "expected a list or tuple of 3 floats" ); + } + + Py_DECREF( value ); + + for( i = 0; i < 4; ++i ) { + object->col[i] = MAX2(MIN2(color[i], 1.0), 0); + } + return 0; +} + /* __copy__() */ static PyObject *Object_copy(BPy_Object * self) { @@ -5189,7 +5216,10 @@ static PyGetSetDef BPy_Object_getseters[] = { (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits, "Transparent materials for the active object (mesh only) enabled", (void *)OB_DRAWTRANSP}, - + {"color", + (getter)Object_getColor, (setter)Object_setColor, + "Object color used by the game engine and optionally for materials", + NULL}, {"enableNLAOverride", (getter)Object_getNLAflagBits, (setter)Object_setNLAflagBits, "Toggles Action-NLA based animation", diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py index 07942d58093..49cb14d1e66 100644 --- a/source/blender/python/api2_2x/doc/Object.py +++ b/source/blender/python/api2_2x/doc/Object.py @@ -552,6 +552,8 @@ class Object: @ivar transp: Enable transparent materials for the active object (mesh only). Also see B{TRANSP} bit in L{drawMode} attribute. @type transp: boolean + @ivar color: Object color used by the game engine and optionally for materials, 4 floats for RGBA object color. + @type color: tuple of 4 floats between 0 and 1 @ivar drawMode: The object's drawing mode bitfield. See L{DrawModes} constant dict for values. @type drawMode: int diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 2459f7ed23c..ef909a1e810 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -3672,6 +3672,9 @@ void copy_attr(short event) else if(event==30) { /* index object */ base->object->index= ob->index; } + else if(event==31) { /* object color */ + QUATCOPY(base->object->col, ob->col); + } } } base= base->next; @@ -3710,7 +3713,7 @@ void copy_attr_menu() * view3d_edit_object_copyattrmenu() and in toolbox.c */ - strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l"); + strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l"); strcat (str, "|Object Constraints%x22"); strcat (str, "|NLA Strips%x26"); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 64b5742dc54..198d8140ace 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -897,6 +897,25 @@ static short select_same_index_object(Object *ob) return changed; } +static short select_same_color(Object *ob) +{ + char changed = 0; + Base *base = FIRSTBASE; + + if (!ob) + return 0; + + while(base) { + if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005))) { + base->flag |= SELECT; + base->object->flag |= SELECT; + changed = 1; + } + base= base->next; + } + return changed; +} + void select_object_grouped(short nr) { short changed = 0; @@ -909,6 +928,7 @@ void select_object_grouped(short nr) else if(nr==7) changed = select_same_group(OBACT); else if(nr==8) changed = select_object_hooks(OBACT); else if(nr==9) changed = select_same_index_object(OBACT); + else if(nr==10) changed = select_same_color(OBACT); if (changed) { countall(); @@ -934,7 +954,9 @@ static void select_object_grouped_menu(void) "Objects of Same Type%x5|" "Objects on Shared Layers%x6|" "Objects in Same Group%x7|" - "Object Hooks%x8|Object PassIndex%x9"); + "Object Hooks%x8|" + "Object PassIndex%x9|" + "Object Color%x10"); /* here we go */ -- cgit v1.2.3 From a12375cb4f8dd97b8985854486485a94a869a5f1 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 20 Sep 2008 10:30:10 +0000 Subject: PyAPI - *.insertkey() Updated insertkey calls in PyAPI so that they behave like the new common_insertkey() behaviour. --- source/blender/python/api2_2x/Camera.c | 14 +++-- source/blender/python/api2_2x/Lamp.c | 28 +++++----- source/blender/python/api2_2x/Material.c | 78 ++++++++++++++-------------- source/blender/python/api2_2x/Object.c | 88 ++++++++++++++++++-------------- source/blender/python/api2_2x/Pose.c | 29 ++++++----- source/blender/python/api2_2x/World.c | 48 +++++++++-------- 6 files changed, 158 insertions(+), 127 deletions(-) diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c index 87c605ef612..af93a1130cb 100644 --- a/source/blender/python/api2_2x/Camera.c +++ b/source/blender/python/api2_2x/Camera.c @@ -36,6 +36,7 @@ #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" /* for M_PI */ +#include "DNA_userdef_types.h" #include "BSE_editipo.h" #include "BIF_keyframing.h" #include "BIF_space.h" @@ -1032,18 +1033,21 @@ static PyObject *Camera_repr( BPy_Camera * self ) static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args ) { - int key = 0; + int key = 0, flag = 0; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" ) ); - + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LENS){ - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, 0); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, flag); } else if (key == IPOKEY_CLIPPING){ - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, 0); - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, 0); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, flag); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 38968b64cf5..799833d4ee0 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -46,6 +46,7 @@ #include "gen_utils.h" #include "gen_library.h" #include "BKE_utildefines.h" +#include "DNA_userdef_types.h" #include "MEM_guardedalloc.h" /*****************************************************************************/ @@ -1336,7 +1337,7 @@ static int Lamp_setIpo( BPy_Lamp * self, PyObject * value ) static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1344,26 +1345,29 @@ static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) map = texchannel_to_adrcode(self->lamp->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_RGB ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, flag); } if (key == IPOKEY_ENERGY ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, flag); } if (key == IPOKEY_SPOTSIZE ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, flag); } if (key == IPOKEY_OFFSET ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, flag); } if (key == IPOKEY_SIZE ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index b118bdb30e7..d3bb6c8d158 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -32,6 +32,7 @@ #include "DNA_space_types.h" #include "DNA_material_types.h" +#include "DNA_userdef_types.h" #include "BKE_main.h" #include "BKE_global.h" #include "BKE_library.h" @@ -1873,7 +1874,7 @@ static int Material_setIpo( BPy_Material * self, PyObject * value ) static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1881,59 +1882,62 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) map = texchannel_to_adrcode(self->material->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, flag); } if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, flag); } if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, flag); } if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag); } if(key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, flag); } if(key==IPOKEY_ALLMIRROR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, flag); } if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, flag); } if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, flag); } if(key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index e8f45b82da4..5151fae8c65 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -2568,7 +2568,7 @@ static int Object_setMatrix( BPy_Object * self, MatrixObject * mat ) static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; - int key = 0; + int key = 0, flag = 0; char *actname= NULL; if( !PyArg_ParseTuple( args, "i", &key ) ) @@ -2578,35 +2578,39 @@ static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) if(ob->ipoflag & OB_ACTION_OB) actname= "Object"; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, flag); } if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, flag); } if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, flag); } if (key == IPOKEY_LAYER ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, flag); } if (key == IPOKEY_PI_STRENGTH ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, flag); } else if (key == IPOKEY_PI_FALLOFF ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, flag); } else if (key == IPOKEY_PI_SURFACEDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, flag); } else if (key == IPOKEY_PI_RANDOMDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, flag); } else if (key == IPOKEY_PI_PERM ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, flag); } allspace(REMAKEIPO, 0); @@ -2630,6 +2634,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) BPy_Action *sourceact; char *chanName; int actframe; + int flag=0; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2648,17 +2653,21 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) /* XXX: must check chanName actually exists, otherwise segfaults! */ //achan = get_action_channel(sourceact->action, chanName); - - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2680,6 +2689,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; + int flag = 0; char *chanName; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2695,16 +2705,20 @@ static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args /* XXX: must check chanName actually exists, otherwise segfaults! */ - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c index 52ede1cb3ee..06d736f2cb6 100644 --- a/source/blender/python/api2_2x/Pose.c +++ b/source/blender/python/api2_2x/Pose.c @@ -414,16 +414,17 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) { PyObject *parent_object = NULL; PyObject *constants = NULL, *item = NULL; - int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0; + int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0, flag = 0; bPoseChannel *pchan = NULL; if (!PyArg_ParseTuple(args, "O!i|Oi", &Object_Type, &parent_object, &frame, &constants, &no_ipo_update )) goto AttributeError; - /* incase we ever have a value other then 1 for fast */ - if (no_ipo_update) - no_ipo_update = 1; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (no_ipo_update) flag |= INSERTKEY_FAST; + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; //verify that this pchannel is part of the object->pose for (pchan = ((BPy_Object*)parent_object)->object->pose->chanbase.first; @@ -493,29 +494,29 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) //insert the pose keys if (self->posechannel->flag & POSE_ROT){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_W, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_W, flag); } if (self->posechannel->flag & POSE_LOC){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_Z, flag); } if (self->posechannel->flag & POSE_SIZE){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, flag); } //flip the frame back diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 0c57488a266..354d8cda0b7 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -43,6 +43,7 @@ #include "World.h" /*This must come first*/ #include "DNA_scene_types.h" /* for G.scene */ +#include "DNA_userdef_types.h" #include "BKE_global.h" #include "BKE_world.h" #include "BKE_main.h" @@ -988,7 +989,7 @@ World *World_FromPyObject( PyObject * py_obj ) static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -996,38 +997,41 @@ static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) map = texchannel_to_adrcode(self->world->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if(key == IPOKEY_ZENITH) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, flag); } if(key == IPOKEY_HORIZON) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, flag); } if(key == IPOKEY_MIST) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, flag); } if(key == IPOKEY_STARS) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, flag); } if(key == IPOKEY_OFFSET) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, flag); } if(key == IPOKEY_SIZE) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, flag); } allspace(REMAKEIPO, 0); -- cgit v1.2.3 From f510057fefea61a15fbbbd6556bf00a6350bb519 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Sep 2008 11:08:35 +0000 Subject: [#17600] char* -> const char* Thanks to Sean Bartell (wtachi), was causing many many warnings which distracted from the real problems. --- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenlib/BLI_blenlib.h | 2 +- source/blender/blenlib/intern/util.c | 2 +- source/blender/yafray/intern/export_File.cpp | 2 +- source/blender/yafray/intern/export_Plugin.cpp | 4 +- source/gameengine/Converter/BL_ActionActuator.cpp | 40 ++++++++++---------- .../Converter/BL_BlenderDataConversion.cpp | 2 +- .../Converter/BL_ShapeActionActuator.cpp | 34 ++++++++--------- source/gameengine/Expressions/PyObjectPlus.h | 14 +++---- source/gameengine/GameLogic/SCA_ActuatorSensor.cpp | 4 +- source/gameengine/GameLogic/SCA_DelaySensor.cpp | 12 +++--- source/gameengine/GameLogic/SCA_ISensor.cpp | 26 ++++++------- source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 30 +++++++-------- source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 16 ++++---- source/gameengine/GameLogic/SCA_MouseSensor.cpp | 4 +- .../gameengine/GameLogic/SCA_PropertyActuator.cpp | 8 ++-- source/gameengine/GameLogic/SCA_PropertySensor.cpp | 12 +++--- .../gameengine/GameLogic/SCA_PythonController.cpp | 16 ++++---- source/gameengine/GameLogic/SCA_PythonController.h | 4 +- source/gameengine/GameLogic/SCA_RandomActuator.cpp | 34 ++++++++--------- source/gameengine/GameLogic/SCA_RandomSensor.cpp | 6 +-- .../gameengine/GamePlayer/common/GPC_RawImage.cpp | 2 +- source/gameengine/GamePlayer/common/GPC_RawImage.h | 2 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 4 +- source/gameengine/Ketsji/BL_Shader.cpp | 28 +++++++------- source/gameengine/Ketsji/BL_Shader.h | 4 +- .../Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp | 10 ++--- source/gameengine/Ketsji/KX_CameraActuator.cpp | 20 +++++----- source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 44 +++++++++++----------- source/gameengine/Ketsji/KX_ConstraintActuator.h | 8 ++-- source/gameengine/Ketsji/KX_GameActuator.cpp | 4 +- source/gameengine/Ketsji/KX_IpoActuator.cpp | 28 +++++++------- source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 12 +++--- source/gameengine/Ketsji/KX_ParentActuator.cpp | 4 +- source/gameengine/Ketsji/KX_RadarSensor.cpp | 6 +-- source/gameengine/Ketsji/KX_RaySensor.cpp | 8 ++-- .../gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 18 ++++----- .../Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 2 +- source/gameengine/Ketsji/KX_SceneActuator.cpp | 12 +++--- source/gameengine/Ketsji/KX_StateActuator.cpp | 4 +- source/gameengine/Ketsji/KX_TouchSensor.cpp | 12 +++--- source/gameengine/Ketsji/KX_TrackToActuator.cpp | 12 +++--- source/gameengine/Ketsji/KX_VisibilityActuator.cpp | 2 +- .../gameengine/Rasterizer/RAS_2DFilterManager.cpp | 2 +- source/gameengine/Rasterizer/RAS_2DFilterManager.h | 2 +- .../RAS_OpenGLFilters/RAS_Blur2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Dilation2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Erosion2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_GrayScale2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Invert2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Laplacian2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Prewitt2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Sepia2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Sharpen2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Sobel2DFilter.h | 2 +- 55 files changed, 272 insertions(+), 272 deletions(-) diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index d65a99f23f0..e0afdec5e23 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1048,7 +1048,7 @@ static float nla_time(float cfra, float unit) static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip, Path *path, float pathdist, float *stride_offset) { bAction *act= strip->act; - char *name= strip->stridechannel; + const char *name= strip->stridechannel; bActionChannel *achan= get_action_channel(act, name); int stride_axis= strip->stride_axis; diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index a1db7adf33d..6a50e2de0e5 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -224,7 +224,7 @@ int BLI_strcaseeq(char *a, char *b); /* in util.c */ #ifdef WITH_ICONV -void BLI_string_to_utf8(char *original, char *utf_8, char *code); +void BLI_string_to_utf8(char *original, char *utf_8, const char *code); #endif /** diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index c27efcb7934..9dfe9557c1b 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1955,7 +1955,7 @@ int BLI_strncasecmp(const char *s1, const char *s2, int n) { #include "iconv.h" #include "localcharset.h" -void BLI_string_to_utf8(char *original, char *utf_8, char *code) +void BLI_string_to_utf8(char *original, char *utf_8, const char *code) { size_t inbytesleft=strlen(original); size_t outbytesleft=512; diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index f42e00daf6d..ea700965826 100644 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -96,7 +96,7 @@ static void addDrive(string &path) static string unixYafrayPath() { - static char *alternative[]= + static const char *alternative[]= { "/usr/local/bin/", "/usr/bin/", diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index a7d5653892f..92ec7ba8d82 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -98,7 +98,7 @@ static string YafrayPath() string path=find_path(); return path; #else - static char *alternative[]= + static const char *alternative[]= { "/usr/local/lib/", #ifdef __x86_64__ @@ -124,7 +124,7 @@ static string YafrayPluginPath() #ifdef WIN32 return find_path()+"\\plugins"; #else - static char *alternative[]= + static const char *alternative[]= { "/usr/local/lib/yafray", #ifdef __x86_64__ diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index c08427c6d27..16bdbe6269b 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -480,7 +480,7 @@ PyObject* BL_ActionActuator::_getattr(const STR_String& attr) { } /* setStart */ -char BL_ActionActuator::GetAction_doc[] = +const char BL_ActionActuator::GetAction_doc[] = "getAction()\n" "\tReturns a string containing the name of the current action.\n"; @@ -494,7 +494,7 @@ PyObject* BL_ActionActuator::PyGetAction(PyObject* self, } /* getProperty */ -char BL_ActionActuator::GetProperty_doc[] = +const char BL_ActionActuator::GetProperty_doc[] = "getProperty()\n" "\tReturns the name of the property to be used in FromProp mode.\n"; @@ -509,7 +509,7 @@ PyObject* BL_ActionActuator::PyGetProperty(PyObject* self, } /* getProperty */ -char BL_ActionActuator::GetFrameProperty_doc[] = +const char BL_ActionActuator::GetFrameProperty_doc[] = "getFrameProperty()\n" "\tReturns the name of the property, that is set to the current frame number.\n"; @@ -524,7 +524,7 @@ PyObject* BL_ActionActuator::PyGetFrameProperty(PyObject* self, } /* getFrame */ -char BL_ActionActuator::GetFrame_doc[] = +const char BL_ActionActuator::GetFrame_doc[] = "getFrame()\n" "\tReturns the current frame number.\n"; @@ -539,7 +539,7 @@ PyObject* BL_ActionActuator::PyGetFrame(PyObject* self, } /* getEnd */ -char BL_ActionActuator::GetEnd_doc[] = +const char BL_ActionActuator::GetEnd_doc[] = "getEnd()\n" "\tReturns the last frame of the action.\n"; @@ -554,7 +554,7 @@ PyObject* BL_ActionActuator::PyGetEnd(PyObject* self, } /* getStart */ -char BL_ActionActuator::GetStart_doc[] = +const char BL_ActionActuator::GetStart_doc[] = "getStart()\n" "\tReturns the starting frame of the action.\n"; @@ -569,7 +569,7 @@ PyObject* BL_ActionActuator::PyGetStart(PyObject* self, } /* getBlendin */ -char BL_ActionActuator::GetBlendin_doc[] = +const char BL_ActionActuator::GetBlendin_doc[] = "getBlendin()\n" "\tReturns the number of interpolation animation frames to be\n" "\tgenerated when this actuator is triggered.\n"; @@ -585,7 +585,7 @@ PyObject* BL_ActionActuator::PyGetBlendin(PyObject* self, } /* getPriority */ -char BL_ActionActuator::GetPriority_doc[] = +const char BL_ActionActuator::GetPriority_doc[] = "getPriority()\n" "\tReturns the priority for this actuator. Actuators with lower\n" "\tPriority numbers will override actuators with higher numbers.\n"; @@ -601,7 +601,7 @@ PyObject* BL_ActionActuator::PyGetPriority(PyObject* self, } /* setAction */ -char BL_ActionActuator::SetAction_doc[] = +const char BL_ActionActuator::SetAction_doc[] = "setAction(action, (reset))\n" "\t - action : The name of the action to set as the current action.\n" "\t - reset : Optional parameter indicating whether to reset the\n" @@ -640,7 +640,7 @@ PyObject* BL_ActionActuator::PySetAction(PyObject* self, } /* setStart */ -char BL_ActionActuator::SetStart_doc[] = +const char BL_ActionActuator::SetStart_doc[] = "setStart(start)\n" "\t - start : Specifies the starting frame of the animation.\n"; @@ -661,7 +661,7 @@ PyObject* BL_ActionActuator::PySetStart(PyObject* self, } /* setEnd */ -char BL_ActionActuator::SetEnd_doc[] = +const char BL_ActionActuator::SetEnd_doc[] = "setEnd(end)\n" "\t - end : Specifies the ending frame of the animation.\n"; @@ -682,7 +682,7 @@ PyObject* BL_ActionActuator::PySetEnd(PyObject* self, } /* setBlendin */ -char BL_ActionActuator::SetBlendin_doc[] = +const char BL_ActionActuator::SetBlendin_doc[] = "setBlendin(blendin)\n" "\t - blendin : Specifies the number of frames of animation to generate\n" "\t when making transitions between actions.\n"; @@ -704,7 +704,7 @@ PyObject* BL_ActionActuator::PySetBlendin(PyObject* self, } /* setBlendtime */ -char BL_ActionActuator::SetBlendtime_doc[] = +const char BL_ActionActuator::SetBlendtime_doc[] = "setBlendtime(blendtime)\n" "\t - blendtime : Allows the script to directly modify the internal timer\n" "\t used when generating transitions between actions. This\n" @@ -731,7 +731,7 @@ PyObject* BL_ActionActuator::PySetBlendtime(PyObject* self, } /* setPriority */ -char BL_ActionActuator::SetPriority_doc[] = +const char BL_ActionActuator::SetPriority_doc[] = "setPriority(priority)\n" "\t - priority : Specifies the new priority. Actuators will lower\n" "\t priority numbers will override actuators with higher\n" @@ -754,7 +754,7 @@ PyObject* BL_ActionActuator::PySetPriority(PyObject* self, } /* setFrame */ -char BL_ActionActuator::SetFrame_doc[] = +const char BL_ActionActuator::SetFrame_doc[] = "setFrame(frame)\n" "\t - frame : Specifies the new current frame for the animation\n"; @@ -779,7 +779,7 @@ PyObject* BL_ActionActuator::PySetFrame(PyObject* self, } /* setProperty */ -char BL_ActionActuator::SetProperty_doc[] = +const char BL_ActionActuator::SetProperty_doc[] = "setProperty(prop)\n" "\t - prop : A string specifying the property name to be used in\n" "\t FromProp playback mode.\n"; @@ -801,7 +801,7 @@ PyObject* BL_ActionActuator::PySetProperty(PyObject* self, } /* setFrameProperty */ -char BL_ActionActuator::SetFrameProperty_doc[] = +const char BL_ActionActuator::SetFrameProperty_doc[] = "setFrameProperty(prop)\n" "\t - prop : A string specifying the property of the frame set up update.\n"; @@ -840,7 +840,7 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* self, */ /* setChannel */ -char BL_ActionActuator::SetChannel_doc[] = +const char BL_ActionActuator::SetChannel_doc[] = "setChannel(channel, matrix)\n" "\t - channel : A string specifying the name of the bone channel.\n" "\t - matrix : A 4x4 matrix specifying the overriding transformation\n" @@ -924,7 +924,7 @@ PyObject* BL_ActionActuator::PySetChannel(PyObject* self, } /* getType */ -char BL_ActionActuator::GetType_doc[] = +const char BL_ActionActuator::GetType_doc[] = "getType()\n" "\tReturns the operation mode of the actuator.\n"; PyObject* BL_ActionActuator::PyGetType(PyObject* self, @@ -934,7 +934,7 @@ PyObject* BL_ActionActuator::PyGetType(PyObject* self, } /* setType */ -char BL_ActionActuator::SetType_doc[] = +const char BL_ActionActuator::SetType_doc[] = "setType(mode)\n" "\t - mode: Play (0), Flipper (2), LoopStop (3), LoopEnd (4) or Property (6)\n" "\tSet the operation mode of the actuator.\n"; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 593833742e7..ae9b8602500 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -308,7 +308,7 @@ static void GetRGB(short type, typedef struct MTF_localLayer { MTFace *face; - char *name; + const char *name; }MTF_localLayer; // ------------------------------------ diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index da5ca1e7c95..721c24dfb94 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -461,7 +461,7 @@ PyObject* BL_ShapeActionActuator::_getattr(const STR_String& attr) { } /* setStart */ -char BL_ShapeActionActuator::GetAction_doc[] = +const char BL_ShapeActionActuator::GetAction_doc[] = "getAction()\n" "\tReturns a string containing the name of the current action.\n"; @@ -473,7 +473,7 @@ PyObject* BL_ShapeActionActuator::PyGetAction(PyObject* self) { } /* getProperty */ -char BL_ShapeActionActuator::GetProperty_doc[] = +const char BL_ShapeActionActuator::GetProperty_doc[] = "getProperty()\n" "\tReturns the name of the property to be used in FromProp mode.\n"; @@ -486,7 +486,7 @@ PyObject* BL_ShapeActionActuator::PyGetProperty(PyObject* self) { } /* getFrame */ -char BL_ShapeActionActuator::GetFrame_doc[] = +const char BL_ShapeActionActuator::GetFrame_doc[] = "getFrame()\n" "\tReturns the current frame number.\n"; @@ -499,7 +499,7 @@ PyObject* BL_ShapeActionActuator::PyGetFrame(PyObject* self) { } /* getEnd */ -char BL_ShapeActionActuator::GetEnd_doc[] = +const char BL_ShapeActionActuator::GetEnd_doc[] = "getEnd()\n" "\tReturns the last frame of the action.\n"; @@ -512,7 +512,7 @@ PyObject* BL_ShapeActionActuator::PyGetEnd(PyObject* self) { } /* getStart */ -char BL_ShapeActionActuator::GetStart_doc[] = +const char BL_ShapeActionActuator::GetStart_doc[] = "getStart()\n" "\tReturns the starting frame of the action.\n"; @@ -525,7 +525,7 @@ PyObject* BL_ShapeActionActuator::PyGetStart(PyObject* self) { } /* getBlendin */ -char BL_ShapeActionActuator::GetBlendin_doc[] = +const char BL_ShapeActionActuator::GetBlendin_doc[] = "getBlendin()\n" "\tReturns the number of interpolation animation frames to be\n" "\tgenerated when this actuator is triggered.\n"; @@ -539,7 +539,7 @@ PyObject* BL_ShapeActionActuator::PyGetBlendin(PyObject* self) { } /* getPriority */ -char BL_ShapeActionActuator::GetPriority_doc[] = +const char BL_ShapeActionActuator::GetPriority_doc[] = "getPriority()\n" "\tReturns the priority for this actuator. Actuators with lower\n" "\tPriority numbers will override actuators with higher numbers.\n"; @@ -553,7 +553,7 @@ PyObject* BL_ShapeActionActuator::PyGetPriority(PyObject* self) { } /* setAction */ -char BL_ShapeActionActuator::SetAction_doc[] = +const char BL_ShapeActionActuator::SetAction_doc[] = "setAction(action, (reset))\n" "\t - action : The name of the action to set as the current action.\n" "\t Should be an action with Shape channels.\n" @@ -593,7 +593,7 @@ PyObject* BL_ShapeActionActuator::PySetAction(PyObject* self, } /* setStart */ -char BL_ShapeActionActuator::SetStart_doc[] = +const char BL_ShapeActionActuator::SetStart_doc[] = "setStart(start)\n" "\t - start : Specifies the starting frame of the animation.\n"; @@ -614,7 +614,7 @@ PyObject* BL_ShapeActionActuator::PySetStart(PyObject* self, } /* setEnd */ -char BL_ShapeActionActuator::SetEnd_doc[] = +const char BL_ShapeActionActuator::SetEnd_doc[] = "setEnd(end)\n" "\t - end : Specifies the ending frame of the animation.\n"; @@ -635,7 +635,7 @@ PyObject* BL_ShapeActionActuator::PySetEnd(PyObject* self, } /* setBlendin */ -char BL_ShapeActionActuator::SetBlendin_doc[] = +const char BL_ShapeActionActuator::SetBlendin_doc[] = "setBlendin(blendin)\n" "\t - blendin : Specifies the number of frames of animation to generate\n" "\t when making transitions between actions.\n"; @@ -657,7 +657,7 @@ PyObject* BL_ShapeActionActuator::PySetBlendin(PyObject* self, } /* setBlendtime */ -char BL_ShapeActionActuator::SetBlendtime_doc[] = +const char BL_ShapeActionActuator::SetBlendtime_doc[] = "setBlendtime(blendtime)\n" "\t - blendtime : Allows the script to directly modify the internal timer\n" "\t used when generating transitions between actions. This\n" @@ -684,7 +684,7 @@ PyObject* BL_ShapeActionActuator::PySetBlendtime(PyObject* self, } /* setPriority */ -char BL_ShapeActionActuator::SetPriority_doc[] = +const char BL_ShapeActionActuator::SetPriority_doc[] = "setPriority(priority)\n" "\t - priority : Specifies the new priority. Actuators will lower\n" "\t priority numbers will override actuators with higher\n" @@ -707,7 +707,7 @@ PyObject* BL_ShapeActionActuator::PySetPriority(PyObject* self, } /* setFrame */ -char BL_ShapeActionActuator::SetFrame_doc[] = +const char BL_ShapeActionActuator::SetFrame_doc[] = "setFrame(frame)\n" "\t - frame : Specifies the new current frame for the animation\n"; @@ -732,7 +732,7 @@ PyObject* BL_ShapeActionActuator::PySetFrame(PyObject* self, } /* setProperty */ -char BL_ShapeActionActuator::SetProperty_doc[] = +const char BL_ShapeActionActuator::SetProperty_doc[] = "setProperty(prop)\n" "\t - prop : A string specifying the property name to be used in\n" "\t FromProp playback mode.\n"; @@ -754,7 +754,7 @@ PyObject* BL_ShapeActionActuator::PySetProperty(PyObject* self, } /* getType */ -char BL_ShapeActionActuator::GetType_doc[] = +const char BL_ShapeActionActuator::GetType_doc[] = "getType()\n" "\tReturns the operation mode of the actuator.\n"; PyObject* BL_ShapeActionActuator::PyGetType(PyObject* self) { @@ -762,7 +762,7 @@ PyObject* BL_ShapeActionActuator::PyGetType(PyObject* self) { } /* setType */ -char BL_ShapeActionActuator::SetType_doc[] = +const char BL_ShapeActionActuator::SetType_doc[] = "setType(mode)\n" "\t - mode: Play (0), Flipper (2), LoopStop (3), LoopEnd (4) or Property (6)\n" "\tSet the operation mode of the actuator.\n"; diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index ccc9af2ed79..9d5e31aa757 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -73,7 +73,7 @@ typedef int Py_ssize_t; // some basic python macros #define Py_Return { Py_INCREF(Py_None); return Py_None;} -static inline void Py_Fatal(char *M) { +static inline void Py_Fatal(const char *M) { //cout << M << endl; exit(-1); }; @@ -152,28 +152,28 @@ static inline void Py_Fatal(char *M) { static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \ return ((class_name*) self)->Py##method_name(self, args, kwds); \ }; \ - static char method_name##_doc[]; \ + static const char method_name##_doc[]; \ #define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \ PyObject* Py##method_name(PyObject* self, PyObject* args); \ static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \ return ((class_name*) self)->Py##method_name(self, args); \ }; \ - static char method_name##_doc[]; \ + static const char method_name##_doc[]; \ #define KX_PYMETHOD_DOC_O(class_name, method_name) \ PyObject* Py##method_name(PyObject* self, PyObject* value); \ static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \ return ((class_name*) self)->Py##method_name(self, value); \ }; \ - static char method_name##_doc[]; \ + static const char method_name##_doc[]; \ #define KX_PYMETHOD_DOC_NOARGS(class_name, method_name) \ PyObject* Py##method_name(PyObject* self); \ static PyObject* sPy##method_name( PyObject* self) { \ return ((class_name*) self)->Py##method_name(self); \ }; \ - static char method_name##_doc[]; \ + static const char method_name##_doc[]; \ /* The line above should remain empty */ @@ -190,11 +190,11 @@ static inline void Py_Fatal(char *M) { * Function implementation macro */ #define KX_PYMETHODDEF_DOC(class_name, method_name, doc_string) \ -char class_name::method_name##_doc[] = doc_string; \ +const char class_name::method_name##_doc[] = doc_string; \ PyObject* class_name::Py##method_name(PyObject*, PyObject* args, PyObject*) #define KX_PYMETHODDEF_DOC_NOARG(class_name, method_name, doc_string) \ -char class_name::method_name##_doc[] = doc_string; \ +const char class_name::method_name##_doc[] = doc_string; \ PyObject* class_name::Py##method_name(PyObject*) /*------------------------------ diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp index 44a488fa719..95fb7e20ad0 100644 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp +++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp @@ -159,7 +159,7 @@ PyObject* SCA_ActuatorSensor::_getattr(const STR_String& attr) { } /* 3. getActuator */ -char SCA_ActuatorSensor::GetActuator_doc[] = +const char SCA_ActuatorSensor::GetActuator_doc[] = "getActuator()\n" "\tReturn the Actuator with which the sensor operates.\n"; PyObject* SCA_ActuatorSensor::PyGetActuator(PyObject* self) @@ -168,7 +168,7 @@ PyObject* SCA_ActuatorSensor::PyGetActuator(PyObject* self) } /* 4. setActuator */ -char SCA_ActuatorSensor::SetActuator_doc[] = +const char SCA_ActuatorSensor::SetActuator_doc[] = "setActuator(name)\n" "\t- name: string\n" "\tSets the Actuator with which to operate. If there is no Actuator\n" diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp index 4d05250e91c..577c523f51f 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp +++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp @@ -173,7 +173,7 @@ PyObject* SCA_DelaySensor::_getattr(const STR_String& attr) { _getattr_up(SCA_ISensor); } -char SCA_DelaySensor::SetDelay_doc[] = +const char SCA_DelaySensor::SetDelay_doc[] = "setDelay(delay)\n" "\t- delay: length of the initial OFF period as number of frame\n" "\t 0 for immediate trigger\n" @@ -193,7 +193,7 @@ PyObject* SCA_DelaySensor::PySetDelay(PyObject* self, PyObject* args, PyObject* Py_Return; } -char SCA_DelaySensor::SetDuration_doc[] = +const char SCA_DelaySensor::SetDuration_doc[] = "setDuration(duration)\n" "\t- duration: length of the ON period in number of frame after the initial off period\n" "\t 0 for no ON period\n" @@ -214,7 +214,7 @@ PyObject* SCA_DelaySensor::PySetDuration(PyObject* self, PyObject* args, PyObjec Py_Return; } -char SCA_DelaySensor::SetRepeat_doc[] = +const char SCA_DelaySensor::SetRepeat_doc[] = "setRepeat(repeat)\n" "\t- repeat: 1 if the initial OFF-ON cycle should be repeated indefinately\n" "\t 0 if the initial OFF-ON cycle should run only once\n" @@ -230,7 +230,7 @@ PyObject* SCA_DelaySensor::PySetRepeat(PyObject* self, PyObject* args, PyObject* Py_Return; } -char SCA_DelaySensor::GetDelay_doc[] = +const char SCA_DelaySensor::GetDelay_doc[] = "getDelay()\n" "\tReturn the delay parameter value\n"; PyObject* SCA_DelaySensor::PyGetDelay(PyObject* self) @@ -238,7 +238,7 @@ PyObject* SCA_DelaySensor::PyGetDelay(PyObject* self) return PyInt_FromLong(m_delay); } -char SCA_DelaySensor::GetDuration_doc[] = +const char SCA_DelaySensor::GetDuration_doc[] = "getDuration()\n" "\tReturn the duration parameter value\n"; PyObject* SCA_DelaySensor::PyGetDuration(PyObject* self) @@ -246,7 +246,7 @@ PyObject* SCA_DelaySensor::PyGetDuration(PyObject* self) return PyInt_FromLong(m_duration); } -char SCA_DelaySensor::GetRepeat_doc[] = +const char SCA_DelaySensor::GetRepeat_doc[] = "getRepeat()\n" "\tReturn the repeat parameter value\n"; PyObject* SCA_DelaySensor::PyGetRepeat(PyObject* self) diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp index 084b1395159..260805e0aa8 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ b/source/gameengine/GameLogic/SCA_ISensor.cpp @@ -277,7 +277,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr, CValue* event) } /* Python functions: */ -char SCA_ISensor::IsPositive_doc[] = +const char SCA_ISensor::IsPositive_doc[] = "isPositive()\n" "\tReturns whether the sensor is in an active state.\n"; PyObject* SCA_ISensor::PyIsPositive(PyObject* self) @@ -286,7 +286,7 @@ PyObject* SCA_ISensor::PyIsPositive(PyObject* self) return PyInt_FromLong(retval); } -char SCA_ISensor::IsTriggered_doc[] = +const char SCA_ISensor::IsTriggered_doc[] = "isTriggered()\n" "\tReturns whether the sensor has triggered the current controller.\n"; PyObject* SCA_ISensor::PyIsTriggered(PyObject* self) @@ -301,7 +301,7 @@ PyObject* SCA_ISensor::PyIsTriggered(PyObject* self) /** * getUsePulseMode: getter for the pulse mode (KX_TRUE = on) */ -char SCA_ISensor::GetUsePosPulseMode_doc[] = +const char SCA_ISensor::GetUsePosPulseMode_doc[] = "getUsePosPulseMode()\n" "\tReturns whether positive pulse mode is active.\n"; PyObject* SCA_ISensor::PyGetUsePosPulseMode(PyObject* self) @@ -312,7 +312,7 @@ PyObject* SCA_ISensor::PyGetUsePosPulseMode(PyObject* self) /** * setUsePulseMode: setter for the pulse mode (KX_TRUE = on) */ -char SCA_ISensor::SetUsePosPulseMode_doc[] = +const char SCA_ISensor::SetUsePosPulseMode_doc[] = "setUsePosPulseMode(pulse?)\n" "\t - pulse? : Pulse when a positive event occurs?\n" "\t (KX_TRUE, KX_FALSE)\n" @@ -328,7 +328,7 @@ PyObject* SCA_ISensor::PySetUsePosPulseMode(PyObject* self, PyObject* args, PyOb /** * getFrequency: getter for the pulse mode interval */ -char SCA_ISensor::GetFrequency_doc[] = +const char SCA_ISensor::GetFrequency_doc[] = "getFrequency()\n" "\tReturns the frequency of the updates in pulse mode.\n" ; PyObject* SCA_ISensor::PyGetFrequency(PyObject* self) @@ -339,7 +339,7 @@ PyObject* SCA_ISensor::PyGetFrequency(PyObject* self) /** * setFrequency: setter for the pulse mode (KX_TRUE = on) */ -char SCA_ISensor::SetFrequency_doc[] = +const char SCA_ISensor::SetFrequency_doc[] = "setFrequency(pulse_frequency)\n" "\t- pulse_frequency: The frequency of the updates in pulse mode (integer)" "\tSet the frequency of the updates in pulse mode.\n" @@ -363,7 +363,7 @@ PyObject* SCA_ISensor::PySetFrequency(PyObject* self, PyObject* args, PyObject* } -char SCA_ISensor::GetInvert_doc[] = +const char SCA_ISensor::GetInvert_doc[] = "getInvert()\n" "\tReturns whether or not pulses from this sensor are inverted.\n" ; PyObject* SCA_ISensor::PyGetInvert(PyObject* self) @@ -371,7 +371,7 @@ PyObject* SCA_ISensor::PyGetInvert(PyObject* self) return BoolToPyArg(m_invert); } -char SCA_ISensor::SetInvert_doc[] = +const char SCA_ISensor::SetInvert_doc[] = "setInvert(invert?)\n" "\t- invert?: Invert the event-values? (KX_TRUE, KX_FALSE)\n" "\tSet whether to invert pulses.\n"; @@ -383,7 +383,7 @@ PyObject* SCA_ISensor::PySetInvert(PyObject* self, PyObject* args, PyObject* kwd Py_Return; } -char SCA_ISensor::GetLevel_doc[] = +const char SCA_ISensor::GetLevel_doc[] = "getLevel()\n" "\tReturns whether this sensor is a level detector or a edge detector.\n" "\tIt makes a difference only in case of logic state transition (state actuator).\n" @@ -395,7 +395,7 @@ PyObject* SCA_ISensor::PyGetLevel(PyObject* self) return BoolToPyArg(m_level); } -char SCA_ISensor::SetLevel_doc[] = +const char SCA_ISensor::SetLevel_doc[] = "setLevel(level?)\n" "\t- level?: Detect level instead of edge? (KX_TRUE, KX_FALSE)\n" "\tSet whether to detect level or edge transition when entering a state.\n"; @@ -407,7 +407,7 @@ PyObject* SCA_ISensor::PySetLevel(PyObject* self, PyObject* args, PyObject* kwds Py_Return; } -char SCA_ISensor::GetUseNegPulseMode_doc[] = +const char SCA_ISensor::GetUseNegPulseMode_doc[] = "getUseNegPulseMode()\n" "\tReturns whether negative pulse mode is active.\n"; PyObject* SCA_ISensor::PyGetUseNegPulseMode(PyObject* self) @@ -415,7 +415,7 @@ PyObject* SCA_ISensor::PyGetUseNegPulseMode(PyObject* self) return BoolToPyArg(m_neg_pulsemode); } -char SCA_ISensor::SetUseNegPulseMode_doc[] = +const char SCA_ISensor::SetUseNegPulseMode_doc[] = "setUseNegPulseMode(pulse?)\n" "\t - pulse? : Pulse when a negative event occurs?\n" "\t (KX_TRUE, KX_FALSE)\n" @@ -428,7 +428,7 @@ PyObject* SCA_ISensor::PySetUseNegPulseMode(PyObject* self, PyObject* args, PyOb Py_Return; } -char SCA_ISensor::Reset_doc[] = +const char SCA_ISensor::Reset_doc[] = "reset()\n" "\tReset sensor internal state, effect depends on the type of sensor and settings.\n" "\tThe sensor is put in its initial state as if it was just activated.\n"; diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 3c08710c6ce..f486e7985b3 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -346,7 +346,7 @@ PyObject* SCA_JoystickSensor::_getattr(const STR_String& attr) { /* get index ---------------------------------------------------------- */ -char SCA_JoystickSensor::GetIndex_doc[] = +const char SCA_JoystickSensor::GetIndex_doc[] = "getIndex\n" "\tReturns the joystick index to use.\n"; PyObject* SCA_JoystickSensor::PyGetIndex( PyObject* self ) { @@ -355,7 +355,7 @@ PyObject* SCA_JoystickSensor::PyGetIndex( PyObject* self ) { /* set index ---------------------------------------------------------- */ -char SCA_JoystickSensor::SetIndex_doc[] = +const char SCA_JoystickSensor::SetIndex_doc[] = "setIndex\n" "\tSets the joystick index to use.\n"; PyObject* SCA_JoystickSensor::PySetIndex( PyObject* self, PyObject* value ) { @@ -370,7 +370,7 @@ PyObject* SCA_JoystickSensor::PySetIndex( PyObject* self, PyObject* value ) { } /* get axis ---------------------------------------------------------- */ -char SCA_JoystickSensor::GetAxis_doc[] = +const char SCA_JoystickSensor::GetAxis_doc[] = "getAxis\n" "\tReturns the current state of the axis.\n"; PyObject* SCA_JoystickSensor::PyGetAxis( PyObject* self) { @@ -379,7 +379,7 @@ PyObject* SCA_JoystickSensor::PyGetAxis( PyObject* self) { /* set axis ---------------------------------------------------------- */ -char SCA_JoystickSensor::SetAxis_doc[] = +const char SCA_JoystickSensor::SetAxis_doc[] = "setAxis\n" "\tSets the current state of the axis.\n"; PyObject* SCA_JoystickSensor::PySetAxis( PyObject* self, PyObject* args ) { @@ -395,7 +395,7 @@ PyObject* SCA_JoystickSensor::PySetAxis( PyObject* self, PyObject* args ) { /* get axis value ----------------------------------------------------- */ -char SCA_JoystickSensor::GetRealAxis_doc[] = +const char SCA_JoystickSensor::GetRealAxis_doc[] = "getAxisValue\n" "\tReturns a list of the values for each axis .\n"; PyObject* SCA_JoystickSensor::PyGetRealAxis( PyObject* self) { @@ -408,7 +408,7 @@ PyObject* SCA_JoystickSensor::PyGetRealAxis( PyObject* self) { /* get threshold ----------------------------------------------------- */ -char SCA_JoystickSensor::GetThreshold_doc[] = +const char SCA_JoystickSensor::GetThreshold_doc[] = "getThreshold\n" "\tReturns the threshold of the axis.\n"; PyObject* SCA_JoystickSensor::PyGetThreshold( PyObject* self) { @@ -417,7 +417,7 @@ PyObject* SCA_JoystickSensor::PyGetThreshold( PyObject* self) { /* set threshold ----------------------------------------------------- */ -char SCA_JoystickSensor::SetThreshold_doc[] = +const char SCA_JoystickSensor::SetThreshold_doc[] = "setThreshold\n" "\tSets the threshold of the axis.\n"; PyObject* SCA_JoystickSensor::PySetThreshold( PyObject* self, PyObject* args ) { @@ -431,7 +431,7 @@ PyObject* SCA_JoystickSensor::PySetThreshold( PyObject* self, PyObject* args ) { /* get button -------------------------------------------------------- */ -char SCA_JoystickSensor::GetButton_doc[] = +const char SCA_JoystickSensor::GetButton_doc[] = "getButton\n" "\tReturns the currently pressed button.\n"; PyObject* SCA_JoystickSensor::PyGetButton( PyObject* self) { @@ -440,7 +440,7 @@ PyObject* SCA_JoystickSensor::PyGetButton( PyObject* self) { /* set button -------------------------------------------------------- */ -char SCA_JoystickSensor::SetButton_doc[] = +const char SCA_JoystickSensor::SetButton_doc[] = "setButton\n" "\tSets the button the sensor reacts to.\n"; PyObject* SCA_JoystickSensor::PySetButton( PyObject* self, PyObject* args ) { @@ -455,7 +455,7 @@ PyObject* SCA_JoystickSensor::PySetButton( PyObject* self, PyObject* args ) { /* get hat ----------------------------------------------------------- */ -char SCA_JoystickSensor::GetHat_doc[] = +const char SCA_JoystickSensor::GetHat_doc[] = "getHat\n" "\tReturns the current direction of the hat.\n"; PyObject* SCA_JoystickSensor::PyGetHat( PyObject* self ) { @@ -464,7 +464,7 @@ PyObject* SCA_JoystickSensor::PyGetHat( PyObject* self ) { /* set hat ----------------------------------------------------------- */ -char SCA_JoystickSensor::SetHat_doc[] = +const char SCA_JoystickSensor::SetHat_doc[] = "setHat\n" "\tSets the hat the sensor reacts to.\n"; PyObject* SCA_JoystickSensor::PySetHat( PyObject* self, PyObject* args ) { @@ -479,7 +479,7 @@ PyObject* SCA_JoystickSensor::PySetHat( PyObject* self, PyObject* args ) { /* get # of ----------------------------------------------------- */ -char SCA_JoystickSensor::NumberOfAxes_doc[] = +const char SCA_JoystickSensor::NumberOfAxes_doc[] = "getNumAxes\n" "\tReturns the number of axes .\n"; PyObject* SCA_JoystickSensor::PyNumberOfAxes( PyObject* self ) { @@ -489,7 +489,7 @@ PyObject* SCA_JoystickSensor::PyNumberOfAxes( PyObject* self ) { } -char SCA_JoystickSensor::NumberOfButtons_doc[] = +const char SCA_JoystickSensor::NumberOfButtons_doc[] = "getNumButtons\n" "\tReturns the number of buttons .\n"; PyObject* SCA_JoystickSensor::PyNumberOfButtons( PyObject* self ) { @@ -498,7 +498,7 @@ PyObject* SCA_JoystickSensor::PyNumberOfButtons( PyObject* self ) { } -char SCA_JoystickSensor::NumberOfHats_doc[] = +const char SCA_JoystickSensor::NumberOfHats_doc[] = "getNumHats\n" "\tReturns the number of hats .\n"; PyObject* SCA_JoystickSensor::PyNumberOfHats( PyObject* self ) { @@ -506,7 +506,7 @@ PyObject* SCA_JoystickSensor::PyNumberOfHats( PyObject* self ) { return PyInt_FromLong( joy ? joy->GetNumberOfHats() : 0 ); } -char SCA_JoystickSensor::Connected_doc[] = +const char SCA_JoystickSensor::Connected_doc[] = "getConnected\n" "\tReturns True if a joystick is connected at this joysticks index.\n"; PyObject* SCA_JoystickSensor::PyConnected( PyObject* self ) { diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index fba1162993d..ac773139794 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -510,7 +510,7 @@ PyObject* SCA_KeyboardSensor::sPySetAllMode(PyObject* self, /** 1. GetKey : check which key this sensor looks at */ -char SCA_KeyboardSensor::GetKey_doc[] = +const char SCA_KeyboardSensor::GetKey_doc[] = "getKey()\n" "\tReturn the code of the key this sensor is listening to.\n" ; PyObject* SCA_KeyboardSensor::PyGetKey(PyObject* self, PyObject* args, PyObject* kwds) @@ -519,7 +519,7 @@ PyObject* SCA_KeyboardSensor::PyGetKey(PyObject* self, PyObject* args, PyObject* } /** 2. SetKey: change the key to look at */ -char SCA_KeyboardSensor::SetKey_doc[] = +const char SCA_KeyboardSensor::SetKey_doc[] = "setKey(keycode)\n" "\t- keycode: any code from GameKeys\n" "\tSet the key this sensor should listen to.\n" ; @@ -539,7 +539,7 @@ PyObject* SCA_KeyboardSensor::PySetKey(PyObject* self, PyObject* args, PyObject* } /** 3. GetHold1 : set the first bucky bit */ -char SCA_KeyboardSensor::GetHold1_doc[] = +const char SCA_KeyboardSensor::GetHold1_doc[] = "getHold1()\n" "\tReturn the code of the first key modifier to the key this \n" "\tsensor is listening to.\n" ; @@ -549,7 +549,7 @@ PyObject* SCA_KeyboardSensor::PyGetHold1(PyObject* self, PyObject* args, PyObjec } /** 4. SetHold1: change the first bucky bit */ -char SCA_KeyboardSensor::SetHold1_doc[] = +const char SCA_KeyboardSensor::SetHold1_doc[] = "setHold1(keycode)\n" "\t- keycode: any code from GameKeys\n" "\tSet the first modifier to the key this sensor should listen to.\n" ; @@ -569,7 +569,7 @@ PyObject* SCA_KeyboardSensor::PySetHold1(PyObject* self, PyObject* args, PyObjec } /** 5. GetHold2 : get the second bucky bit */ -char SCA_KeyboardSensor::GetHold2_doc[] = +const char SCA_KeyboardSensor::GetHold2_doc[] = "getHold2()\n" "\tReturn the code of the second key modifier to the key this \n" "\tsensor is listening to.\n" ; @@ -579,7 +579,7 @@ PyObject* SCA_KeyboardSensor::PyGetHold2(PyObject* self, PyObject* args, PyObjec } /** 6. SetHold2: change the second bucky bit */ -char SCA_KeyboardSensor::SetHold2_doc[] = +const char SCA_KeyboardSensor::SetHold2_doc[] = "setHold2(keycode)\n" "\t- keycode: any code from GameKeys\n" "\tSet the first modifier to the key this sensor should listen to.\n" ; @@ -599,7 +599,7 @@ PyObject* SCA_KeyboardSensor::PySetHold2(PyObject* self, PyObject* args, PyObjec } -char SCA_KeyboardSensor::GetPressedKeys_doc[] = +const char SCA_KeyboardSensor::GetPressedKeys_doc[] = "getPressedKeys()\n" "\tGet a list of pressed keys that have either been pressed, or just released this frame.\n" ; @@ -639,7 +639,7 @@ PyObject* SCA_KeyboardSensor::PyGetPressedKeys(PyObject* self, PyObject* args, P -char SCA_KeyboardSensor::GetCurrentlyPressedKeys_doc[] = +const char SCA_KeyboardSensor::GetCurrentlyPressedKeys_doc[] = "getCurrentlyPressedKeys()\n" "\tGet a list of keys that are currently pressed.\n" ; diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp index 2298ddb0743..8f56d153f02 100644 --- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp +++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp @@ -293,7 +293,7 @@ PyObject* SCA_MouseSensor::_getattr(const STR_String& attr) { } /* get x position ---------------------------------------------------------- */ -char SCA_MouseSensor::GetXPosition_doc[] = +const char SCA_MouseSensor::GetXPosition_doc[] = "getXPosition\n" "\tReturns the x-coordinate of the mouse sensor, in frame coordinates.\n" "\tThe lower-left corner is the origin. The coordinate is given in\n" @@ -305,7 +305,7 @@ PyObject* SCA_MouseSensor::PyGetXPosition(PyObject* self, } /* get y position ---------------------------------------------------------- */ -char SCA_MouseSensor::GetYPosition_doc[] = +const char SCA_MouseSensor::GetYPosition_doc[] = "getYPosition\n" "\tReturns the y-coordinate of the mouse sensor, in frame coordinates.\n" "\tThe lower-left corner is the origin. The coordinate is given in\n" diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 7062f2cef6a..e5ddd8d121c 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -257,7 +257,7 @@ PyObject* SCA_PropertyActuator::_getattr(const STR_String& attr) { } /* 1. setProperty */ -char SCA_PropertyActuator::SetProperty_doc[] = +const char SCA_PropertyActuator::SetProperty_doc[] = "setProperty(name)\n" "\t- name: string\n" "\tSet the property on which to operate. If there is no property\n" @@ -283,7 +283,7 @@ PyObject* SCA_PropertyActuator::PySetProperty(PyObject* self, PyObject* args, Py } /* 2. getProperty */ -char SCA_PropertyActuator::GetProperty_doc[] = +const char SCA_PropertyActuator::GetProperty_doc[] = "getProperty(name)\n" "\tReturn the property on which the actuator operates.\n"; PyObject* SCA_PropertyActuator::PyGetProperty(PyObject* self, PyObject* args, PyObject* kwds) @@ -292,7 +292,7 @@ PyObject* SCA_PropertyActuator::PyGetProperty(PyObject* self, PyObject* args, Py } /* 3. setValue */ -char SCA_PropertyActuator::SetValue_doc[] = +const char SCA_PropertyActuator::SetValue_doc[] = "setValue(value)\n" "\t- value: string\n" "\tSet the value with which the actuator operates. If the value\n" @@ -311,7 +311,7 @@ PyObject* SCA_PropertyActuator::PySetValue(PyObject* self, PyObject* args, PyObj } /* 4. getValue */ -char SCA_PropertyActuator::GetValue_doc[] = +const char SCA_PropertyActuator::GetValue_doc[] = "getValue()\n" "\tReturns the value with which the actuator operates.\n"; PyObject* SCA_PropertyActuator::PyGetValue(PyObject* self, PyObject* args, PyObject* kwds) diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index c50c011cc63..b1a4b776860 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -347,7 +347,7 @@ PyObject* SCA_PropertySensor::_getattr(const STR_String& attr) { } /* 1. getType */ -char SCA_PropertySensor::GetType_doc[] = +const char SCA_PropertySensor::GetType_doc[] = "getType()\n" "\tReturns the type of check this sensor performs.\n"; PyObject* SCA_PropertySensor::PyGetType(PyObject* self, PyObject* args, PyObject* kwds) @@ -356,7 +356,7 @@ PyObject* SCA_PropertySensor::PyGetType(PyObject* self, PyObject* args, PyObject } /* 2. setType */ -char SCA_PropertySensor::SetType_doc[] = +const char SCA_PropertySensor::SetType_doc[] = "setType(type)\n" "\t- type: KX_PROPSENSOR_EQUAL, KX_PROPSENSOR_NOTEQUAL,\n" "\t KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED,\n" @@ -379,7 +379,7 @@ PyObject* SCA_PropertySensor::PySetType(PyObject* self, PyObject* args, PyObject } /* 3. getProperty */ -char SCA_PropertySensor::GetProperty_doc[] = +const char SCA_PropertySensor::GetProperty_doc[] = "getProperty()\n" "\tReturn the property with which the sensor operates.\n"; PyObject* SCA_PropertySensor::PyGetProperty(PyObject* self, PyObject* args, PyObject* kwds) @@ -388,7 +388,7 @@ PyObject* SCA_PropertySensor::PyGetProperty(PyObject* self, PyObject* args, PyOb } /* 4. setProperty */ -char SCA_PropertySensor::SetProperty_doc[] = +const char SCA_PropertySensor::SetProperty_doc[] = "setProperty(name)\n" "\t- name: string\n" "\tSets the property with which to operate. If there is no property\n" @@ -414,7 +414,7 @@ PyObject* SCA_PropertySensor::PySetProperty(PyObject* self, PyObject* args, PyOb } /* 5. getValue */ -char SCA_PropertySensor::GetValue_doc[] = +const char SCA_PropertySensor::GetValue_doc[] = "getValue()\n" "\tReturns the value with which the sensor operates.\n"; PyObject* SCA_PropertySensor::PyGetValue(PyObject* self, PyObject* args, PyObject* kwds) @@ -423,7 +423,7 @@ PyObject* SCA_PropertySensor::PyGetValue(PyObject* self, PyObject* args, PyObjec } /* 6. setValue */ -char SCA_PropertySensor::SetValue_doc[] = +const char SCA_PropertySensor::SetValue_doc[] = "setValue(value)\n" "\t- value: string\n" "\tSet the value with which the sensor operates. If the value\n" diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 6e9a0a7c6b6..7e2fb081083 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -151,7 +151,7 @@ int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor) } #if 0 -static char* sPyGetCurrentController__doc__; +static const char* sPyGetCurrentController__doc__; #endif @@ -162,7 +162,7 @@ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject* self) } #if 0 -static char* sPyAddActiveActuator__doc__; +static const char* sPyAddActiveActuator__doc__; #endif PyObject* SCA_PythonController::sPyAddActiveActuator( @@ -199,9 +199,9 @@ PyObject* SCA_PythonController::sPyAddActiveActuator( } -char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()"; -char* SCA_PythonController::sPyAddActiveActuator__doc__= "addActiveActuator(actuator,bool)"; -char SCA_PythonController::GetActuators_doc[] = "getActuator"; +const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()"; +const char* SCA_PythonController::sPyAddActiveActuator__doc__= "addActiveActuator(actuator,bool)"; +const char SCA_PythonController::GetActuators_doc[] = "getActuator"; PyTypeObject SCA_PythonController::Type = { PyObject_HEAD_INIT(&PyType_Type) @@ -329,7 +329,7 @@ PyObject* SCA_PythonController::PyGetActuators(PyObject* self) return resultlist; } -char SCA_PythonController::GetSensor_doc[] = +const char SCA_PythonController::GetSensor_doc[] = "GetSensor (char sensorname) return linked sensor that is named [sensorname]\n"; PyObject* SCA_PythonController::PyGetSensor(PyObject* self, PyObject* value) @@ -359,7 +359,7 @@ SCA_PythonController::PyGetSensor(PyObject* self, PyObject* value) -char SCA_PythonController::GetActuator_doc[] = +const char SCA_PythonController::GetActuator_doc[] = "GetActuator (char sensorname) return linked actuator that is named [actuatorname]\n"; PyObject* SCA_PythonController::PyGetActuator(PyObject* self, PyObject* value) @@ -388,7 +388,7 @@ SCA_PythonController::PyGetActuator(PyObject* self, PyObject* value) } -char SCA_PythonController::GetSensors_doc[] = "getSensors returns a list of all attached sensors"; +const char SCA_PythonController::GetSensors_doc[] = "getSensors returns a list of all attached sensors"; PyObject* SCA_PythonController::PyGetSensors(PyObject* self) { diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h index 1b62e7ecb53..d9b2e242bea 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.h +++ b/source/gameengine/GameLogic/SCA_PythonController.h @@ -71,9 +71,9 @@ class SCA_PythonController : public SCA_IController { m_triggeredSensors.push_back(sensor); } int IsTriggered(class SCA_ISensor* sensor); - static char* sPyGetCurrentController__doc__; + static const char* sPyGetCurrentController__doc__; static PyObject* sPyGetCurrentController(PyObject* self); - static char* sPyAddActiveActuator__doc__; + static const char* sPyAddActiveActuator__doc__; static PyObject* sPyAddActiveActuator(PyObject* self, PyObject* args); virtual PyObject* _getattr(const STR_String& attr); diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 0a1ac2d0668..e87b3dba458 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -364,7 +364,7 @@ PyObject* SCA_RandomActuator::_getattr(const STR_String& attr) { } /* 1. setSeed */ -char SCA_RandomActuator::SetSeed_doc[] = +const char SCA_RandomActuator::SetSeed_doc[] = "setSeed(seed)\n" "\t- seed: integer\n" "\tSet the initial seed of the generator. Equal seeds produce\n" @@ -381,7 +381,7 @@ PyObject* SCA_RandomActuator::PySetSeed(PyObject* self, PyObject* args, PyObject Py_Return; } /* 2. getSeed */ -char SCA_RandomActuator::GetSeed_doc[] = +const char SCA_RandomActuator::GetSeed_doc[] = "getSeed()\n" "\tReturns the initial seed of the generator. Equal seeds produce\n" "\tequal series.\n"; @@ -390,7 +390,7 @@ PyObject* SCA_RandomActuator::PyGetSeed(PyObject* self, PyObject* args, PyObject } /* 4. getPara1 */ -char SCA_RandomActuator::GetPara1_doc[] = +const char SCA_RandomActuator::GetPara1_doc[] = "getPara1()\n" "\tReturns the first parameter of the active distribution. Refer\n" "\tto the documentation of the generator types for the meaning\n" @@ -400,7 +400,7 @@ PyObject* SCA_RandomActuator::PyGetPara1(PyObject* self, PyObject* args, PyObjec } /* 6. getPara2 */ -char SCA_RandomActuator::GetPara2_doc[] = +const char SCA_RandomActuator::GetPara2_doc[] = "getPara2()\n" "\tReturns the first parameter of the active distribution. Refer\n" "\tto the documentation of the generator types for the meaning\n" @@ -410,7 +410,7 @@ PyObject* SCA_RandomActuator::PyGetPara2(PyObject* self, PyObject* args, PyObjec } /* 8. getDistribution */ -char SCA_RandomActuator::GetDistribution_doc[] = +const char SCA_RandomActuator::GetDistribution_doc[] = "getDistribution()\n" "\tReturns the type of the active distribution.\n"; PyObject* SCA_RandomActuator::PyGetDistribution(PyObject* self, PyObject* args, PyObject* kwds) { @@ -418,7 +418,7 @@ PyObject* SCA_RandomActuator::PyGetDistribution(PyObject* self, PyObject* args, } /* 9. setProperty */ -char SCA_RandomActuator::SetProperty_doc[] = +const char SCA_RandomActuator::SetProperty_doc[] = "setProperty(name)\n" "\t- name: string\n" "\tSet the property to which the random value is assigned. If the \n" @@ -441,7 +441,7 @@ PyObject* SCA_RandomActuator::PySetProperty(PyObject* self, PyObject* args, PyOb Py_Return; } /* 10. getProperty */ -char SCA_RandomActuator::GetProperty_doc[] = +const char SCA_RandomActuator::GetProperty_doc[] = "getProperty(name)\n" "\tReturn the property to which the random value is assigned. If the \n" "\tgenerator and property types do not match, the assignment is ignored.\n"; @@ -450,7 +450,7 @@ PyObject* SCA_RandomActuator::PyGetProperty(PyObject* self, PyObject* args, PyOb } /* 11. setBoolConst */ -char SCA_RandomActuator::SetBoolConst_doc[] = +const char SCA_RandomActuator::SetBoolConst_doc[] = "setBoolConst(value)\n" "\t- value: 0 or 1\n" "\tSet this generator to produce a constant boolean value.\n"; @@ -470,7 +470,7 @@ PyObject* SCA_RandomActuator::PySetBoolConst(PyObject* self, Py_Return; } /* 12. setBoolUniform, */ -char SCA_RandomActuator::SetBoolUniform_doc[] = +const char SCA_RandomActuator::SetBoolUniform_doc[] = "setBoolUniform()\n" "\tSet this generator to produce true and false, each with 50%% chance of occuring\n"; PyObject* SCA_RandomActuator::PySetBoolUniform(PyObject* self, @@ -482,7 +482,7 @@ PyObject* SCA_RandomActuator::PySetBoolUniform(PyObject* self, Py_Return; } /* 13. setBoolBernouilli, */ -char SCA_RandomActuator::SetBoolBernouilli_doc[] = +const char SCA_RandomActuator::SetBoolBernouilli_doc[] = "setBoolBernouilli(value)\n" "\t- value: a float between 0 and 1\n" "\tReturn false value * 100%% of the time.\n"; @@ -500,7 +500,7 @@ PyObject* SCA_RandomActuator::PySetBoolBernouilli(PyObject* self, Py_Return; } /* 14. setIntConst,*/ -char SCA_RandomActuator::SetIntConst_doc[] = +const char SCA_RandomActuator::SetIntConst_doc[] = "setIntConst(value)\n" "\t- value: integer\n" "\tAlways return value\n"; @@ -518,7 +518,7 @@ PyObject* SCA_RandomActuator::PySetIntConst(PyObject* self, Py_Return; } /* 15. setIntUniform,*/ -char SCA_RandomActuator::SetIntUniform_doc[] = +const char SCA_RandomActuator::SetIntUniform_doc[] = "setIntUniform(lower_bound, upper_bound)\n" "\t- lower_bound: integer\n" "\t- upper_bound: integer\n" @@ -539,7 +539,7 @@ PyObject* SCA_RandomActuator::PySetIntUniform(PyObject* self, Py_Return; } /* 16. setIntPoisson, */ -char SCA_RandomActuator::SetIntPoisson_doc[] = +const char SCA_RandomActuator::SetIntPoisson_doc[] = "setIntPoisson(value)\n" "\t- value: float\n" "\tReturn a Poisson-distributed number. This performs a series\n" @@ -559,7 +559,7 @@ PyObject* SCA_RandomActuator::PySetIntPoisson(PyObject* self, Py_Return; } /* 17. setFloatConst,*/ -char SCA_RandomActuator::SetFloatConst_doc[] = +const char SCA_RandomActuator::SetFloatConst_doc[] = "setFloatConst(value)\n" "\t- value: float\n" "\tAlways return value\n"; @@ -577,7 +577,7 @@ PyObject* SCA_RandomActuator::PySetFloatConst(PyObject* self, Py_Return; } /* 18. setFloatUniform, */ -char SCA_RandomActuator::SetFloatUniform_doc[] = +const char SCA_RandomActuator::SetFloatUniform_doc[] = "setFloatUniform(lower_bound, upper_bound)\n" "\t- lower_bound: float\n" "\t- upper_bound: float\n" @@ -598,7 +598,7 @@ PyObject* SCA_RandomActuator::PySetFloatUniform(PyObject* self, Py_Return; } /* 19. setFloatNormal, */ -char SCA_RandomActuator::SetFloatNormal_doc[] = +const char SCA_RandomActuator::SetFloatNormal_doc[] = "setFloatNormal(mean, standard_deviation)\n" "\t- mean: float\n" "\t- standard_deviation: float\n" @@ -619,7 +619,7 @@ PyObject* SCA_RandomActuator::PySetFloatNormal(PyObject* self, Py_Return; } /* 20. setFloatNegativeExponential, */ -char SCA_RandomActuator::SetFloatNegativeExponential_doc[] = +const char SCA_RandomActuator::SetFloatNegativeExponential_doc[] = "setFloatNegativeExponential(half_life)\n" "\t- half_life: float\n" "\tReturn negative-exponentially distributed numbers. The half-life 'time'\n" diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp index 3626522e49a..2caca1a27ec 100644 --- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp +++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp @@ -165,7 +165,7 @@ PyObject* SCA_RandomSensor::_getattr(const STR_String& attr) { } /* 1. setSeed */ -char SCA_RandomSensor::SetSeed_doc[] = +const char SCA_RandomSensor::SetSeed_doc[] = "setSeed(seed)\n" "\t- seed: integer\n" "\tSet the initial seed of the generator. Equal seeds produce\n" @@ -183,7 +183,7 @@ PyObject* SCA_RandomSensor::PySetSeed(PyObject* self, PyObject* args, PyObject* } /* 2. getSeed */ -char SCA_RandomSensor::GetSeed_doc[] = +const char SCA_RandomSensor::GetSeed_doc[] = "getSeed()\n" "\tReturns the initial seed of the generator. Equal seeds produce\n" "\tequal series.\n"; @@ -192,7 +192,7 @@ PyObject* SCA_RandomSensor::PyGetSeed(PyObject* self, PyObject* args, PyObject* } /* 3. getLastDraw */ -char SCA_RandomSensor::GetLastDraw_doc[] = +const char SCA_RandomSensor::GetLastDraw_doc[] = "getLastDraw()\n" "\tReturn the last value that was drawn.\n"; PyObject* SCA_RandomSensor::PyGetLastDraw(PyObject* self, PyObject* args, PyObject* kwds) { diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp index a9cfb0a9366..e6e97cbdfd3 100644 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp @@ -45,7 +45,7 @@ GPC_RawImage::GPC_RawImage() bool GPC_RawImage::Load( - char *srcName, + const char *srcName, int destWidth, int destHeight, TImageAlignment alignment, int offsetX, int offsetY) { diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.h b/source/gameengine/GamePlayer/common/GPC_RawImage.h index 17c00d2fcc3..49a3043bffc 100644 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.h +++ b/source/gameengine/GamePlayer/common/GPC_RawImage.h @@ -61,7 +61,7 @@ public: * @param offsetX Amount of horzontal offset applied to the resource image. * @param offsetY Amount of vertical offset applied to the resource image. */ - virtual bool Load(char *srcName, + virtual bool Load(const char *srcName, int destWidth, int destHeight, TImageAlignment alignment = alignTopLeft, int offsetX = 0, int offsetY = 0); diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 01774a68cc4..4dfbbab7cd3 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -150,9 +150,9 @@ static BOOL scr_saver_init(int argc, char **argv) #endif /* WIN32 */ -void usage(char* program) +void usage(const char* program) { - char * consoleoption; + const char * consoleoption; #ifdef _WIN32 consoleoption = "-c "; #else diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index f28d3fa2912..80892764089 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -881,7 +881,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; int index=-1; if(PyArg_ParseTuple(args, "si", &uniform, &index)) { @@ -922,7 +922,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" ) Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; float value=0; if(PyArg_ParseTuple(args, "sf", &uniform, &value )) { @@ -946,7 +946,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)") if(mError) { Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; float array[2]={ 0,0 }; if(PyArg_ParseTuple(args, "sff", &uniform, &array[0],&array[1] )) { @@ -970,7 +970,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ") if(mError) { Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; float array[3]={0,0,0}; if(PyArg_ParseTuple(args, "sfff", &uniform, &array[0],&array[1],&array[2])) { @@ -995,7 +995,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) " if(mError) { Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; float array[4]={0,0,0,0}; if(PyArg_ParseTuple(args, "sffff", &uniform, &array[0],&array[1],&array[2], &array[3])) { @@ -1019,7 +1019,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" ) if(mError) { Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; int value=0; if(PyArg_ParseTuple(args, "si", &uniform, &value )) { @@ -1043,7 +1043,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)") if(mError) { Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; int array[2]={ 0,0 }; if(PyArg_ParseTuple(args, "sii", &uniform, &array[0],&array[1] )) { @@ -1068,7 +1068,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ") Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; int array[3]={0,0,0}; if(PyArg_ParseTuple(args, "siii", &uniform, &array[0],&array[1],&array[2])) { @@ -1091,7 +1091,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) " if(mError) { Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; int array[4]={0,0,0, 0}; if(PyArg_ParseTuple(args, "siiii", &uniform, &array[0],&array[1],&array[2], &array[3] )) { @@ -1114,7 +1114,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis if(mError) { Py_RETURN_NONE; } - char*uniform = ""; + const char *uniform = ""; PyObject *listPtr =0; float array_data[4] = {0.f,0.f,0.f,0.f}; @@ -1183,7 +1183,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3 if(mError) { Py_RETURN_NONE; } - char*uniform = ""; + const char *uniform = ""; PyObject *listPtr =0; int array_data[4] = {0,0,0,0}; @@ -1263,7 +1263,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, 0,0,0,1 }; - char *uniform=""; + const char *uniform=""; PyObject *matrix=0; int transp=1; // MT_ is row major so transpose by default.... if(PyArg_ParseTuple(args, "sO|i",&uniform, &matrix,&transp)) @@ -1304,7 +1304,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3, 0,0,1, }; - char *uniform=""; + const char *uniform=""; PyObject *matrix=0; int transp=1; // MT_ is row major so transpose by default.... if(PyArg_ParseTuple(args, "sO|i",&uniform, &matrix,&transp)) @@ -1358,7 +1358,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" ) Py_RETURN_NONE; } - char *uniform=""; + const char *uniform=""; int nloc=0; if(PyArg_ParseTuple(args, "si",&uniform, &nloc)) { diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h index c7fae31ba03..18ca8f8b4f8 100644 --- a/source/gameengine/Ketsji/BL_Shader.h +++ b/source/gameengine/Ketsji/BL_Shader.h @@ -102,8 +102,8 @@ private: bool mUse; // ... //BL_Sampler mSampler[MAXTEX]; // Number of samplers int mAttr; // Tangent attribute - char* vertProg; // Vertex program string - char* fragProg; // Fragment program string + const char* vertProg; // Vertex program string + const char* fragProg; // Fragment program string bool mError; // ... bool mDirty; // diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp index a35ab8b15e8..16dbe65d508 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp @@ -218,7 +218,7 @@ PyObject* KX_NetworkMessageSensor::_getattr(const STR_String& attr) { } // 1. Set the message subject that this sensor listens for -char KX_NetworkMessageSensor::SetSubjectFilterText_doc[] = +const char KX_NetworkMessageSensor::SetSubjectFilterText_doc[] = "\tsetSubjectFilterText(value)\n" "\tChange the message subject text that this sensor is listening to.\n"; @@ -235,7 +235,7 @@ PyObject* KX_NetworkMessageSensor::PySetSubjectFilterText( PyObject* self, PyObj } // 2. Get the number of messages received since the last frame -char KX_NetworkMessageSensor::GetFrameMessageCount_doc[] = +const char KX_NetworkMessageSensor::GetFrameMessageCount_doc[] = "\tgetFrameMessageCount()\n" "\tGet the number of messages received since the last frame.\n"; @@ -245,7 +245,7 @@ PyObject* KX_NetworkMessageSensor::PyGetFrameMessageCount( PyObject* ) } // 3. Get the message bodies -char KX_NetworkMessageSensor::GetBodies_doc[] = +const char KX_NetworkMessageSensor::GetBodies_doc[] = "\tgetBodies()\n" "\tGet the list of message bodies.\n"; @@ -259,7 +259,7 @@ PyObject* KX_NetworkMessageSensor::PyGetBodies( PyObject* ) } // 4. Get the message subject: field of the message sensor -char KX_NetworkMessageSensor::GetSubject_doc[] = +const char KX_NetworkMessageSensor::GetSubject_doc[] = "\tgetSubject()\n" "\tGet the subject: field of the message sensor.\n"; @@ -269,7 +269,7 @@ PyObject* KX_NetworkMessageSensor::PyGetSubject( PyObject* ) } // 5. Get the message subjects -char KX_NetworkMessageSensor::GetSubjects_doc[] = +const char KX_NetworkMessageSensor::GetSubjects_doc[] = "\tgetSubjects()\n" "\tGet list of message subjects.\n"; diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index 4948c0ea174..099b0d90870 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -414,7 +414,7 @@ PyObject* KX_CameraActuator::_getattr(const STR_String& attr) { _getattr_up(SCA_IActuator); } /* get obj ---------------------------------------------------------- */ -char KX_CameraActuator::GetObject_doc[] = +const char KX_CameraActuator::GetObject_doc[] = "getObject(name_only = 1)\n" "name_only - optional arg, when true will return the KX_GameObject rather then its name\n" "\tReturns the object this sensor reacts to.\n"; @@ -433,7 +433,7 @@ PyObject* KX_CameraActuator::PyGetObject(PyObject* self, PyObject* args) return m_ob->AddRef(); } /* set obj ---------------------------------------------------------- */ -char KX_CameraActuator::SetObject_doc[] = +const char KX_CameraActuator::SetObject_doc[] = "setObject(object)\n" "\t- object: KX_GameObject, string or None\n" "\tSets the object this sensor reacts to.\n"; @@ -455,7 +455,7 @@ PyObject* KX_CameraActuator::PySetObject(PyObject* self, PyObject* value) } /* get min ---------------------------------------------------------- */ -char KX_CameraActuator::GetMin_doc[] = +const char KX_CameraActuator::GetMin_doc[] = "getMin\n" "\tReturns the minimum value set in the Min: field.\n"; PyObject* KX_CameraActuator::PyGetMin(PyObject* self, @@ -465,7 +465,7 @@ PyObject* KX_CameraActuator::PyGetMin(PyObject* self, return PyFloat_FromDouble(m_minHeight); } /* set min ---------------------------------------------------------- */ -char KX_CameraActuator::SetMin_doc[] = +const char KX_CameraActuator::SetMin_doc[] = "setMin\n" "\tSets the minimum value.\n"; PyObject* KX_CameraActuator::PySetMin(PyObject* self, @@ -481,7 +481,7 @@ PyObject* KX_CameraActuator::PySetMin(PyObject* self, return NULL; } /* get min ---------------------------------------------------------- */ -char KX_CameraActuator::GetMax_doc[] = +const char KX_CameraActuator::GetMax_doc[] = "getMax\n" "\tReturns the maximum value set in the Max: field.\n"; PyObject* KX_CameraActuator::PyGetMax(PyObject* self, @@ -491,7 +491,7 @@ PyObject* KX_CameraActuator::PyGetMax(PyObject* self, return PyFloat_FromDouble(m_maxHeight); } /* set min ---------------------------------------------------------- */ -char KX_CameraActuator::SetMax_doc[] = +const char KX_CameraActuator::SetMax_doc[] = "setMax\n" "\tSets the maximum value.\n"; PyObject* KX_CameraActuator::PySetMax(PyObject* self, @@ -507,7 +507,7 @@ PyObject* KX_CameraActuator::PySetMax(PyObject* self, return NULL; } /* get height ---------------------------------------------------------- */ -char KX_CameraActuator::GetHeight_doc[] = +const char KX_CameraActuator::GetHeight_doc[] = "getHeight\n" "\tReturns the height value set in the height: field.\n"; PyObject* KX_CameraActuator::PyGetHeight(PyObject* self, @@ -517,7 +517,7 @@ PyObject* KX_CameraActuator::PyGetHeight(PyObject* self, return PyFloat_FromDouble(m_height); } /* set height ---------------------------------------------------------- */ -char KX_CameraActuator::SetHeight_doc[] = +const char KX_CameraActuator::SetHeight_doc[] = "setHeight\n" "\tSets the height value.\n"; PyObject* KX_CameraActuator::PySetHeight(PyObject* self, @@ -533,7 +533,7 @@ PyObject* KX_CameraActuator::PySetHeight(PyObject* self, return NULL; } /* set XY ---------------------------------------------------------- */ -char KX_CameraActuator::SetXY_doc[] = +const char KX_CameraActuator::SetXY_doc[] = "setXY\n" "\tSets axis the camera tries to get behind.\n" "\t1=x, 0=y\n"; @@ -551,7 +551,7 @@ PyObject* KX_CameraActuator::PySetXY(PyObject* self, } /* get XY -------------------------------------------------------------*/ -char KX_CameraActuator::GetXY_doc[] = +const char KX_CameraActuator::GetXY_doc[] = "getXY\n" "\tGets the axis the camera tries to get behind.\n" "\tTrue = X, False = Y\n"; diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index e0c9af5ae60..11af4b9324b 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -479,7 +479,7 @@ PyObject* KX_ConstraintActuator::_getattr(const STR_String& attr) { } /* 2. setDamp */ -char KX_ConstraintActuator::SetDamp_doc[] = +const char KX_ConstraintActuator::SetDamp_doc[] = "setDamp(duration)\n" "\t- duration: integer\n" "\tSets the time constant of the orientation and distance constraint.\n" @@ -498,7 +498,7 @@ PyObject* KX_ConstraintActuator::PySetDamp(PyObject* self, Py_Return; } /* 3. getDamp */ -char KX_ConstraintActuator::GetDamp_doc[] = +const char KX_ConstraintActuator::GetDamp_doc[] = "getDamp()\n" "\tReturns the damping parameter.\n"; PyObject* KX_ConstraintActuator::PyGetDamp(PyObject* self){ @@ -506,7 +506,7 @@ PyObject* KX_ConstraintActuator::PyGetDamp(PyObject* self){ } /* 2. setRotDamp */ -char KX_ConstraintActuator::SetRotDamp_doc[] = +const char KX_ConstraintActuator::SetRotDamp_doc[] = "setRotDamp(duration)\n" "\t- duration: integer\n" "\tSets the time constant of the orientation constraint.\n" @@ -525,7 +525,7 @@ PyObject* KX_ConstraintActuator::PySetRotDamp(PyObject* self, Py_Return; } /* 3. getRotDamp */ -char KX_ConstraintActuator::GetRotDamp_doc[] = +const char KX_ConstraintActuator::GetRotDamp_doc[] = "getRotDamp()\n" "\tReturns the damping time for application of the constraint.\n"; PyObject* KX_ConstraintActuator::PyGetRotDamp(PyObject* self){ @@ -533,7 +533,7 @@ PyObject* KX_ConstraintActuator::PyGetRotDamp(PyObject* self){ } /* 2. setDirection */ -char KX_ConstraintActuator::SetDirection_doc[] = +const char KX_ConstraintActuator::SetDirection_doc[] = "setDirection(vector)\n" "\t- vector: 3-tuple\n" "\tSets the reference direction in world coordinate for the orientation constraint.\n"; @@ -560,7 +560,7 @@ PyObject* KX_ConstraintActuator::PySetDirection(PyObject* self, Py_Return; } /* 3. getDirection */ -char KX_ConstraintActuator::GetDirection_doc[] = +const char KX_ConstraintActuator::GetDirection_doc[] = "getDirection()\n" "\tReturns the reference direction of the orientation constraint as a 3-tuple.\n"; PyObject* KX_ConstraintActuator::PyGetDirection(PyObject* self){ @@ -573,7 +573,7 @@ PyObject* KX_ConstraintActuator::PyGetDirection(PyObject* self){ } /* 2. setOption */ -char KX_ConstraintActuator::SetOption_doc[] = +const char KX_ConstraintActuator::SetOption_doc[] = "setOption(option)\n" "\t- option: integer\n" "\tSets several options of the distance constraint.\n" @@ -595,7 +595,7 @@ PyObject* KX_ConstraintActuator::PySetOption(PyObject* self, Py_Return; } /* 3. getOption */ -char KX_ConstraintActuator::GetOption_doc[] = +const char KX_ConstraintActuator::GetOption_doc[] = "getOption()\n" "\tReturns the option parameter.\n"; PyObject* KX_ConstraintActuator::PyGetOption(PyObject* self){ @@ -603,7 +603,7 @@ PyObject* KX_ConstraintActuator::PyGetOption(PyObject* self){ } /* 2. setTime */ -char KX_ConstraintActuator::SetTime_doc[] = +const char KX_ConstraintActuator::SetTime_doc[] = "setTime(duration)\n" "\t- duration: integer\n" "\tSets the activation time of the actuator.\n" @@ -624,7 +624,7 @@ PyObject* KX_ConstraintActuator::PySetTime(PyObject* self, Py_Return; } /* 3. getTime */ -char KX_ConstraintActuator::GetTime_doc[] = +const char KX_ConstraintActuator::GetTime_doc[] = "getTime()\n" "\tReturns the time parameter.\n"; PyObject* KX_ConstraintActuator::PyGetTime(PyObject* self){ @@ -632,7 +632,7 @@ PyObject* KX_ConstraintActuator::PyGetTime(PyObject* self){ } /* 2. setProperty */ -char KX_ConstraintActuator::SetProperty_doc[] = +const char KX_ConstraintActuator::SetProperty_doc[] = "setProperty(property)\n" "\t- property: string\n" "\tSets the name of the property or material for the ray detection of the distance constraint.\n" @@ -654,7 +654,7 @@ PyObject* KX_ConstraintActuator::PySetProperty(PyObject* self, Py_Return; } /* 3. getProperty */ -char KX_ConstraintActuator::GetProperty_doc[] = +const char KX_ConstraintActuator::GetProperty_doc[] = "getProperty()\n" "\tReturns the property parameter.\n"; PyObject* KX_ConstraintActuator::PyGetProperty(PyObject* self){ @@ -662,12 +662,12 @@ PyObject* KX_ConstraintActuator::PyGetProperty(PyObject* self){ } /* 4. setDistance */ -char KX_ConstraintActuator::SetDistance_doc[] = +const char KX_ConstraintActuator::SetDistance_doc[] = "setDistance(distance)\n" "\t- distance: float\n" "\tSets the target distance in distance constraint\n"; /* 4. setMin */ -char KX_ConstraintActuator::SetMin_doc[] = +const char KX_ConstraintActuator::SetMin_doc[] = "setMin(lower_bound)\n" "\t- lower_bound: float\n" "\tSets the lower value of the interval to which the value\n" @@ -694,11 +694,11 @@ PyObject* KX_ConstraintActuator::PySetMin(PyObject* self, Py_Return; } /* 5. getDistance */ -char KX_ConstraintActuator::GetDistance_doc[] = +const char KX_ConstraintActuator::GetDistance_doc[] = "getDistance()\n" "\tReturns the distance parameter \n"; /* 5. getMin */ -char KX_ConstraintActuator::GetMin_doc[] = +const char KX_ConstraintActuator::GetMin_doc[] = "getMin()\n" "\tReturns the lower value of the interval to which the value\n" "\tis clipped.\n"; @@ -707,12 +707,12 @@ PyObject* KX_ConstraintActuator::PyGetMin(PyObject* self) { } /* 6. setRayLength */ -char KX_ConstraintActuator::SetRayLength_doc[] = +const char KX_ConstraintActuator::SetRayLength_doc[] = "setRayLength(length)\n" "\t- length: float\n" "\tSets the maximum ray length of the distance constraint\n"; /* 6. setMax */ -char KX_ConstraintActuator::SetMax_doc[] = +const char KX_ConstraintActuator::SetMax_doc[] = "setMax(upper_bound)\n" "\t- upper_bound: float\n" "\tSets the upper value of the interval to which the value\n" @@ -739,11 +739,11 @@ PyObject* KX_ConstraintActuator::PySetMax(PyObject* self, Py_Return; } /* 7. getRayLength */ -char KX_ConstraintActuator::GetRayLength_doc[] = +const char KX_ConstraintActuator::GetRayLength_doc[] = "getRayLength()\n" "\tReturns the length of the ray\n"; /* 7. getMax */ -char KX_ConstraintActuator::GetMax_doc[] = +const char KX_ConstraintActuator::GetMax_doc[] = "getMax()\n" "\tReturns the upper value of the interval to which the value\n" "\tis clipped.\n"; @@ -754,7 +754,7 @@ PyObject* KX_ConstraintActuator::PyGetMax(PyObject* self) { /* This setter/getter probably for the constraint type */ /* 8. setLimit */ -char KX_ConstraintActuator::SetLimit_doc[] = +const char KX_ConstraintActuator::SetLimit_doc[] = "setLimit(type)\n" "\t- type: integer\n" "\t 1 : LocX\n" @@ -783,7 +783,7 @@ PyObject* KX_ConstraintActuator::PySetLimit(PyObject* self, Py_Return; } /* 9. getLimit */ -char KX_ConstraintActuator::GetLimit_doc[] = +const char KX_ConstraintActuator::GetLimit_doc[] = "getLimit()\n" "\tReturns the type of constraint.\n"; PyObject* KX_ConstraintActuator::PyGetLimit(PyObject* self) { diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.h b/source/gameengine/Ketsji/KX_ConstraintActuator.h index 6ec4de9aad9..99c09c1e5cc 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.h +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.h @@ -147,12 +147,12 @@ protected: KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetProperty); KX_PYMETHOD_DOC(KX_ConstraintActuator,SetMin); KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetMin); - static char SetDistance_doc[]; - static char GetDistance_doc[]; + static const char SetDistance_doc[]; + static const char GetDistance_doc[]; KX_PYMETHOD_DOC(KX_ConstraintActuator,SetMax); KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetMax); - static char SetRayLength_doc[]; - static char GetRayLength_doc[]; + static const char SetRayLength_doc[]; + static const char GetRayLength_doc[]; KX_PYMETHOD_DOC(KX_ConstraintActuator,SetLimit); KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetLimit); }; diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp index 91ddbbbfbc9..db9333eafa7 100644 --- a/source/gameengine/Ketsji/KX_GameActuator.cpp +++ b/source/gameengine/Ketsji/KX_GameActuator.cpp @@ -247,7 +247,7 @@ PyMethodDef KX_GameActuator::Methods[] = }; /* getFile */ -char KX_GameActuator::GetFile_doc[] = +const char KX_GameActuator::GetFile_doc[] = "getFile()\n" "get the name of the file to start.\n"; PyObject* KX_GameActuator::PyGetFile(PyObject* self, PyObject* args, PyObject* kwds) @@ -256,7 +256,7 @@ PyObject* KX_GameActuator::PyGetFile(PyObject* self, PyObject* args, PyObject* k } /* setFile */ -char KX_GameActuator::SetFile_doc[] = +const char KX_GameActuator::SetFile_doc[] = "setFile(name)\n" "set the name of the file to start.\n"; PyObject* KX_GameActuator::PySetFile(PyObject* self, PyObject* args, PyObject* kwds) diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index 75e4ade6574..d9945a4b131 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -462,7 +462,7 @@ PyObject* KX_IpoActuator::_getattr(const STR_String& attr) { /* set --------------------------------------------------------------------- */ -char KX_IpoActuator::Set_doc[] = +const char KX_IpoActuator::Set_doc[] = "set(type, startframe, endframe, mode?)\n" "\t - type: Play, PingPong, Flipper, LoopStop, LoopEnd or FromProp (string)\n" "\t - startframe: first frame to use (int)\n" @@ -505,7 +505,7 @@ PyObject* KX_IpoActuator::PySet(PyObject* self, } /* set property ----------------------------------------------------------- */ -char KX_IpoActuator::SetProperty_doc[] = +const char KX_IpoActuator::SetProperty_doc[] = "setProperty(propname)\n" "\t - propname: name of the property (string)\n" "\tSet the property to be used in FromProp mode.\n"; @@ -525,7 +525,7 @@ PyObject* KX_IpoActuator::PySetProperty(PyObject* self, } /* 4. setStart: */ -char KX_IpoActuator::SetStart_doc[] = +const char KX_IpoActuator::SetStart_doc[] = "setStart(frame)\n" "\t - frame: first frame to use (int)\n" "\tSet the frame from which the ipo starts playing.\n"; @@ -542,7 +542,7 @@ PyObject* KX_IpoActuator::PySetStart(PyObject* self, Py_Return; } /* 5. getStart: */ -char KX_IpoActuator::GetStart_doc[] = +const char KX_IpoActuator::GetStart_doc[] = "getStart()\n" "\tReturns the frame from which the ipo starts playing.\n"; PyObject* KX_IpoActuator::PyGetStart(PyObject* self) { @@ -550,7 +550,7 @@ PyObject* KX_IpoActuator::PyGetStart(PyObject* self) { } /* 6. setEnd: */ -char KX_IpoActuator::SetEnd_doc[] = +const char KX_IpoActuator::SetEnd_doc[] = "setEnd(frame)\n" "\t - frame: last frame to use (int)\n" "\tSet the frame at which the ipo stops playing.\n"; @@ -567,7 +567,7 @@ PyObject* KX_IpoActuator::PySetEnd(PyObject* self, Py_Return; } /* 7. getEnd: */ -char KX_IpoActuator::GetEnd_doc[] = +const char KX_IpoActuator::GetEnd_doc[] = "getEnd()\n" "\tReturns the frame at which the ipo stops playing.\n"; PyObject* KX_IpoActuator::PyGetEnd(PyObject* self) { @@ -575,7 +575,7 @@ PyObject* KX_IpoActuator::PyGetEnd(PyObject* self) { } /* 6. setIpoAsForce: */ -char KX_IpoActuator::SetIpoAsForce_doc[] = +const char KX_IpoActuator::SetIpoAsForce_doc[] = "setIpoAsForce(force?)\n" "\t - force? : interpret this ipo as a force? (KX_TRUE, KX_FALSE)\n" "\tSet whether to interpret the ipo as a force rather than a displacement.\n"; @@ -595,7 +595,7 @@ PyObject* KX_IpoActuator::PySetIpoAsForce(PyObject* self, Py_Return; } /* 7. getIpoAsForce: */ -char KX_IpoActuator::GetIpoAsForce_doc[] = +const char KX_IpoActuator::GetIpoAsForce_doc[] = "getIpoAsForce()\n" "\tReturns whether to interpret the ipo as a force rather than a displacement.\n"; PyObject* KX_IpoActuator::PyGetIpoAsForce(PyObject* self) { @@ -603,7 +603,7 @@ PyObject* KX_IpoActuator::PyGetIpoAsForce(PyObject* self) { } /* 6. setIpoAsForce: */ -char KX_IpoActuator::SetIpoAdd_doc[] = +const char KX_IpoActuator::SetIpoAdd_doc[] = "setIpoAdd(add?)\n" "\t - add? : add flag (KX_TRUE, KX_FALSE)\n" "\tSet whether to interpret the ipo as additive rather than absolute.\n"; @@ -623,7 +623,7 @@ PyObject* KX_IpoActuator::PySetIpoAdd(PyObject* self, Py_Return; } /* 7. getIpoAsForce: */ -char KX_IpoActuator::GetIpoAdd_doc[] = +const char KX_IpoActuator::GetIpoAdd_doc[] = "getIpoAsAdd()\n" "\tReturns whether to interpret the ipo as additive rather than absolute.\n"; PyObject* KX_IpoActuator::PyGetIpoAdd(PyObject* self) { @@ -631,7 +631,7 @@ PyObject* KX_IpoActuator::PyGetIpoAdd(PyObject* self) { } /* 8. setType: */ -char KX_IpoActuator::SetType_doc[] = +const char KX_IpoActuator::SetType_doc[] = "setType(mode)\n" "\t - mode: Play, PingPong, Flipper, LoopStop, LoopEnd or FromProp (string)\n" "\tSet the operation mode of the actuator.\n"; @@ -652,7 +652,7 @@ PyObject* KX_IpoActuator::PySetType(PyObject* self, Py_Return; } /* 9. getType: */ -char KX_IpoActuator::GetType_doc[] = +const char KX_IpoActuator::GetType_doc[] = "getType()\n" "\tReturns the operation mode of the actuator.\n"; PyObject* KX_IpoActuator::PyGetType(PyObject* self) { @@ -660,7 +660,7 @@ PyObject* KX_IpoActuator::PyGetType(PyObject* self) { } /* 10. setForceIpoActsLocal: */ -char KX_IpoActuator::SetForceIpoActsLocal_doc[] = +const char KX_IpoActuator::SetForceIpoActsLocal_doc[] = "setForceIpoActsLocal(local?)\n" "\t - local? : Apply the ipo-as-force in the object's local\n" "\t coordinates? (KX_TRUE, KX_FALSE)\n" @@ -680,7 +680,7 @@ PyObject* KX_IpoActuator::PySetForceIpoActsLocal(PyObject* self, Py_Return; } /* 11. getForceIpoActsLocal: */ -char KX_IpoActuator::GetForceIpoActsLocal_doc[] = +const char KX_IpoActuator::GetForceIpoActsLocal_doc[] = "getForceIpoActsLocal()\n" "\tReturn whether to apply the force in the object's local\n" "\tcoordinates rather than the world global coordinates.\n"; diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 6f76448707c..c2e4430d1bc 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -338,7 +338,7 @@ PyObject* KX_MouseFocusSensor::_getattr(const STR_String& attr) { } -char KX_MouseFocusSensor::GetHitObject_doc[] = +const char KX_MouseFocusSensor::GetHitObject_doc[] = "getHitObject()\n" "\tReturns the name of the object that was hit by this ray.\n"; PyObject* KX_MouseFocusSensor::PyGetHitObject(PyObject* self, @@ -353,7 +353,7 @@ PyObject* KX_MouseFocusSensor::PyGetHitObject(PyObject* self, } -char KX_MouseFocusSensor::GetHitPosition_doc[] = +const char KX_MouseFocusSensor::GetHitPosition_doc[] = "getHitPosition()\n" "\tReturns the position (in worldcoordinates) where the object was hit by this ray.\n"; PyObject* KX_MouseFocusSensor::PyGetHitPosition(PyObject* self, @@ -373,7 +373,7 @@ PyObject* KX_MouseFocusSensor::PyGetHitPosition(PyObject* self, } -char KX_MouseFocusSensor::GetRayDirection_doc[] = +const char KX_MouseFocusSensor::GetRayDirection_doc[] = "getRayDirection()\n" "\tReturns the direction from the ray (in worldcoordinates) .\n"; PyObject* KX_MouseFocusSensor::PyGetRayDirection(PyObject* self, @@ -394,7 +394,7 @@ PyObject* KX_MouseFocusSensor::PyGetRayDirection(PyObject* self, } -char KX_MouseFocusSensor::GetHitNormal_doc[] = +const char KX_MouseFocusSensor::GetHitNormal_doc[] = "getHitNormal()\n" "\tReturns the normal (in worldcoordinates) of the object at the location where the object was hit by this ray.\n"; PyObject* KX_MouseFocusSensor::PyGetHitNormal(PyObject* self, @@ -415,7 +415,7 @@ PyObject* KX_MouseFocusSensor::PyGetHitNormal(PyObject* self, /* getRayTarget */ -char KX_MouseFocusSensor::GetRayTarget_doc[] = +const char KX_MouseFocusSensor::GetRayTarget_doc[] = "getRayTarget()\n" "\tReturns the target of the ray that seeks the focus object,\n" "\tin worldcoordinates."; @@ -432,7 +432,7 @@ PyObject* KX_MouseFocusSensor::PyGetRayTarget(PyObject* self, } /* getRayTarget */ -char KX_MouseFocusSensor::GetRaySource_doc[] = +const char KX_MouseFocusSensor::GetRaySource_doc[] = "getRaySource()\n" "\tReturns the source of the ray that seeks the focus object,\n" "\tin worldcoordinates."; diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp index 3ca121f63f8..2dc2702ac27 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.cpp +++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp @@ -176,7 +176,7 @@ PyObject* KX_ParentActuator::_getattr(const STR_String& attr) { } /* 1. setObject */ -char KX_ParentActuator::SetObject_doc[] = +const char KX_ParentActuator::SetObject_doc[] = "setObject(object)\n" "\t- object: KX_GameObject, string or None\n" "\tSet the object to set as parent.\n"; @@ -199,7 +199,7 @@ PyObject* KX_ParentActuator::PySetObject(PyObject* self, PyObject* value) { /* 2. getObject */ /* get obj ---------------------------------------------------------- */ -char KX_ParentActuator::GetObject_doc[] = +const char KX_ParentActuator::GetObject_doc[] = "getObject(name_only = 1)\n" "name_only - optional arg, when true will return the KX_GameObject rather then its name\n" "\tReturns the object that is set to.\n"; diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index d371626b597..9a75e58c8ca 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -234,7 +234,7 @@ PyObject* KX_RadarSensor::_getattr(const STR_String& attr) { } /* getConeOrigin */ -char KX_RadarSensor::GetConeOrigin_doc[] = +const char KX_RadarSensor::GetConeOrigin_doc[] = "getConeOrigin()\n" "\tReturns the origin of the cone with which to test. The origin\n" "\tis in the middle of the cone."; @@ -251,7 +251,7 @@ PyObject* KX_RadarSensor::PyGetConeOrigin(PyObject* self, } /* getConeOrigin */ -char KX_RadarSensor::GetConeTarget_doc[] = +const char KX_RadarSensor::GetConeTarget_doc[] = "getConeTarget()\n" "\tReturns the center of the bottom face of the cone with which to test.\n"; PyObject* KX_RadarSensor::PyGetConeTarget(PyObject* self, @@ -267,7 +267,7 @@ PyObject* KX_RadarSensor::PyGetConeTarget(PyObject* self, } /* getConeOrigin */ -char KX_RadarSensor::GetConeHeight_doc[] = +const char KX_RadarSensor::GetConeHeight_doc[] = "getConeHeight()\n" "\tReturns the height of the cone with which to test.\n"; PyObject* KX_RadarSensor::PyGetConeHeight(PyObject* self, diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp index 8dc22fe13c1..64897bd62ba 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.cpp +++ b/source/gameengine/Ketsji/KX_RaySensor.cpp @@ -342,7 +342,7 @@ PyMethodDef KX_RaySensor::Methods[] = { {NULL,NULL} //Sentinel }; -char KX_RaySensor::GetHitObject_doc[] = +const char KX_RaySensor::GetHitObject_doc[] = "getHitObject()\n" "\tReturns the name of the object that was hit by this ray.\n"; PyObject* KX_RaySensor::PyGetHitObject(PyObject* self, @@ -357,7 +357,7 @@ PyObject* KX_RaySensor::PyGetHitObject(PyObject* self, } -char KX_RaySensor::GetHitPosition_doc[] = +const char KX_RaySensor::GetHitPosition_doc[] = "getHitPosition()\n" "\tReturns the position (in worldcoordinates) where the object was hit by this ray.\n"; PyObject* KX_RaySensor::PyGetHitPosition(PyObject* self, @@ -377,7 +377,7 @@ PyObject* KX_RaySensor::PyGetHitPosition(PyObject* self, } -char KX_RaySensor::GetRayDirection_doc[] = +const char KX_RaySensor::GetRayDirection_doc[] = "getRayDirection()\n" "\tReturns the direction from the ray (in worldcoordinates) .\n"; PyObject* KX_RaySensor::PyGetRayDirection(PyObject* self, @@ -397,7 +397,7 @@ PyObject* KX_RaySensor::PyGetRayDirection(PyObject* self, } -char KX_RaySensor::GetHitNormal_doc[] = +const char KX_RaySensor::GetHitNormal_doc[] = "getHitNormal()\n" "\tReturns the normal (in worldcoordinates) of the object at the location where the object was hit by this ray.\n"; PyObject* KX_RaySensor::PyGetHitNormal(PyObject* self, diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp index c4c190e9fa1..ba4a23eb427 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp @@ -209,7 +209,7 @@ PyObject* KX_SCA_AddObjectActuator::_getattr(const STR_String& attr) } /* 1. setObject */ -char KX_SCA_AddObjectActuator::SetObject_doc[] = +const char KX_SCA_AddObjectActuator::SetObject_doc[] = "setObject(object)\n" "\t- object: KX_GameObject, string or None\n" "\tSets the object that will be added. There has to be an object\n" @@ -234,7 +234,7 @@ PyObject* KX_SCA_AddObjectActuator::PySetObject(PyObject* self, PyObject* value) /* 2. setTime */ -char KX_SCA_AddObjectActuator::SetTime_doc[] = +const char KX_SCA_AddObjectActuator::SetTime_doc[] = "setTime(duration)\n" "\t- duration: integer\n" "\tSets the lifetime of the object that will be added, in frames. \n" @@ -258,7 +258,7 @@ PyObject* KX_SCA_AddObjectActuator::PySetTime(PyObject* self, PyObject* value) /* 3. getTime */ -char KX_SCA_AddObjectActuator::GetTime_doc[] = +const char KX_SCA_AddObjectActuator::GetTime_doc[] = "GetTime()\n" "\tReturns the lifetime of the object that will be added.\n"; @@ -270,7 +270,7 @@ PyObject* KX_SCA_AddObjectActuator::PyGetTime(PyObject* self) /* 4. getObject */ -char KX_SCA_AddObjectActuator::GetObject_doc[] = +const char KX_SCA_AddObjectActuator::GetObject_doc[] = "getObject(name_only = 1)\n" "name_only - optional arg, when true will return the KX_GameObject rather then its name\n" "\tReturns the name of the object that will be added.\n"; @@ -292,7 +292,7 @@ PyObject* KX_SCA_AddObjectActuator::PyGetObject(PyObject* self, PyObject* args) /* 5. getLinearVelocity */ -char KX_SCA_AddObjectActuator::GetLinearVelocity_doc[] = +const char KX_SCA_AddObjectActuator::GetLinearVelocity_doc[] = "GetLinearVelocity()\n" "\tReturns the linear velocity that will be assigned to \n" "\tthe created object.\n"; @@ -311,7 +311,7 @@ PyObject* KX_SCA_AddObjectActuator::PyGetLinearVelocity(PyObject* self) /* 6. setLinearVelocity */ -char KX_SCA_AddObjectActuator::SetLinearVelocity_doc[] = +const char KX_SCA_AddObjectActuator::SetLinearVelocity_doc[] = "setLinearVelocity(vx, vy, vz)\n" "\t- vx: float\n" "\t- vy: float\n" @@ -331,7 +331,7 @@ PyObject* KX_SCA_AddObjectActuator::PySetLinearVelocity(PyObject* self, PyObject } /* 7. getAngularVelocity */ -char KX_SCA_AddObjectActuator::GetAngularVelocity_doc[] = +const char KX_SCA_AddObjectActuator::GetAngularVelocity_doc[] = "GetAngularVelocity()\n" "\tReturns the angular velocity that will be assigned to \n" "\tthe created object.\n"; @@ -350,7 +350,7 @@ PyObject* KX_SCA_AddObjectActuator::PyGetAngularVelocity(PyObject* self) /* 8. setAngularVelocity */ -char KX_SCA_AddObjectActuator::SetAngularVelocity_doc[] = +const char KX_SCA_AddObjectActuator::SetAngularVelocity_doc[] = "setAngularVelocity(vx, vy, vz)\n" "\t- vx: float\n" "\t- vy: float\n" @@ -406,7 +406,7 @@ PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject(PyObject* self) /* 7. GetLastCreatedObject */ -char KX_SCA_AddObjectActuator::GetLastCreatedObject_doc[] = +const char KX_SCA_AddObjectActuator::GetLastCreatedObject_doc[] = "getLastCreatedObject()\n" "\tReturn the last created object. \n"; diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp index e1f11732085..a5cd3f85f85 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp @@ -99,7 +99,7 @@ PyObject* KX_SCA_ReplaceMeshActuator::_getattr(const STR_String& attr) /* 1. setMesh */ -char KX_SCA_ReplaceMeshActuator::SetMesh_doc[] = +const char KX_SCA_ReplaceMeshActuator::SetMesh_doc[] = "setMesh(name)\n" "\t- name: string or None\n" "\tSet the mesh that will be substituted for the current one.\n"; diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index d6164dc812a..7d0181b162f 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -278,7 +278,7 @@ PyObject* KX_SceneActuator::_getattr(const STR_String& attr) /* 2. setUseRestart--------------------------------------------------------- */ -char KX_SceneActuator::SetUseRestart_doc[] = +const char KX_SceneActuator::SetUseRestart_doc[] = "setUseRestart(flag)\n" "\t- flag: 0 or 1.\n" "\tSet flag to 1 to restart the scene.\n" ; @@ -301,7 +301,7 @@ PyObject* KX_SceneActuator::PySetUseRestart(PyObject* self, /* 3. getUseRestart: */ -char KX_SceneActuator::GetUseRestart_doc[] = +const char KX_SceneActuator::GetUseRestart_doc[] = "getUseRestart()\n" "\tReturn whether the scene will be restarted.\n" ; PyObject* KX_SceneActuator::PyGetUseRestart(PyObject* self, @@ -314,7 +314,7 @@ PyObject* KX_SceneActuator::PyGetUseRestart(PyObject* self, /* 4. set scene------------------------------------------------------------- */ -char KX_SceneActuator::SetScene_doc[] = +const char KX_SceneActuator::SetScene_doc[] = "setScene(scene)\n" "\t- scene: string\n" "\tSet the name of scene the actuator will switch to.\n" ; @@ -339,7 +339,7 @@ PyObject* KX_SceneActuator::PySetScene(PyObject* self, /* 5. getScene: */ -char KX_SceneActuator::GetScene_doc[] = +const char KX_SceneActuator::GetScene_doc[] = "getScene()\n" "\tReturn the name of the scene the actuator wants to switch to.\n" ; PyObject* KX_SceneActuator::PyGetScene(PyObject* self, @@ -352,7 +352,7 @@ PyObject* KX_SceneActuator::PyGetScene(PyObject* self, /* 6. set camera------------------------------------------------------------ */ -char KX_SceneActuator::SetCamera_doc[] = +const char KX_SceneActuator::SetCamera_doc[] = "setCamera(camera)\n" "\t- camera: string\n" "\tSet the camera to switch to.\n" ; @@ -394,7 +394,7 @@ PyObject* KX_SceneActuator::PySetCamera(PyObject* self, /* 7. getCamera: */ -char KX_SceneActuator::GetCamera_doc[] = +const char KX_SceneActuator::GetCamera_doc[] = "getCamera()\n" "\tReturn the name of the camera to switch to.\n" ; PyObject* KX_SceneActuator::PyGetCamera(PyObject* self, diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp index 95a79f0c480..be874c97b3c 100644 --- a/source/gameengine/Ketsji/KX_StateActuator.cpp +++ b/source/gameengine/Ketsji/KX_StateActuator.cpp @@ -157,7 +157,7 @@ KX_StateActuator::_getattr( /* set operation ---------------------------------------------------------- */ -char +const char KX_StateActuator::SetOperation_doc[] = "setOperation(op)\n" "\t - op : bit operation (0=Copy, 1=Set, 2=Clear, 3=Negate)" @@ -180,7 +180,7 @@ KX_StateActuator::PySetOperation(PyObject* self, } /* set mask ---------------------------------------------------------- */ -char +const char KX_StateActuator::SetMask_doc[] = "setMask(mask)\n" "\t - mask : bits that will be modified" diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp index 60e1d87d318..ad0b7428a24 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.cpp +++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp @@ -257,7 +257,7 @@ PyObject* KX_TouchSensor::_getattr(const STR_String& attr) { /* Python API */ /* 1. setProperty */ -char KX_TouchSensor::SetProperty_doc[] = +const char KX_TouchSensor::SetProperty_doc[] = "setProperty(name)\n" "\t- name: string\n" "\tSet the property or material to collide with. Use\n" @@ -283,7 +283,7 @@ PyObject* KX_TouchSensor::PySetProperty(PyObject* self, Py_Return; } /* 2. getProperty */ -char KX_TouchSensor::GetProperty_doc[] = +const char KX_TouchSensor::GetProperty_doc[] = "getProperty(name)\n" "\tReturns the property or material to collide with. Use\n" "\tgetTouchMaterial() to find out whether this sensor\n" @@ -294,7 +294,7 @@ PyObject* KX_TouchSensor::PyGetProperty(PyObject* self, return PyString_FromString(m_touchedpropname); } -char KX_TouchSensor::GetHitObject_doc[] = +const char KX_TouchSensor::GetHitObject_doc[] = "getHitObject()\n" ; PyObject* KX_TouchSensor::PyGetHitObject(PyObject* self, @@ -310,7 +310,7 @@ PyObject* KX_TouchSensor::PyGetHitObject(PyObject* self, Py_Return; } -char KX_TouchSensor::GetHitObjectList_doc[] = +const char KX_TouchSensor::GetHitObjectList_doc[] = "getHitObjectList()\n" "\tReturn a list of the objects this object collided with,\n" "\tbut only those matching the property/material condition.\n"; @@ -364,7 +364,7 @@ PyObject* KX_TouchSensor::PyGetHitObjectList(PyObject* self, } /* 5. getTouchMaterial */ -char KX_TouchSensor::GetTouchMaterial_doc[] = +const char KX_TouchSensor::GetTouchMaterial_doc[] = "getTouchMaterial()\n" "\tReturns KX_TRUE if this sensor looks for a specific material,\n" "\tKX_FALSE if it looks for a specific property.\n" ; @@ -376,7 +376,7 @@ PyObject* KX_TouchSensor::PyGetTouchMaterial(PyObject* self, } /* 6. setTouchMaterial */ -char KX_TouchSensor::SetTouchMaterial_doc[] = +const char KX_TouchSensor::SetTouchMaterial_doc[] = "setTouchMaterial(flag)\n" "\t- flag: KX_TRUE or KX_FALSE.\n" "\tSet flag to KX_TRUE to switch on positive pulse mode,\n" diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index 8b09cd4e953..42f11adf004 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -475,7 +475,7 @@ PyObject* KX_TrackToActuator::_getattr(const STR_String& attr) /* 1. setObject */ -char KX_TrackToActuator::SetObject_doc[] = +const char KX_TrackToActuator::SetObject_doc[] = "setObject(object)\n" "\t- object: KX_GameObject, string or None\n" "\tSet the object to track with the parent of this actuator.\n"; @@ -499,7 +499,7 @@ PyObject* KX_TrackToActuator::PySetObject(PyObject* self, PyObject* value) /* 2. getObject */ -char KX_TrackToActuator::GetObject_doc[] = +const char KX_TrackToActuator::GetObject_doc[] = "getObject(name_only = 1)\n" "name_only - optional arg, when true will return the KX_GameObject rather then its name\n" "\tReturns the object to track with the parent of this actuator\n"; @@ -521,7 +521,7 @@ PyObject* KX_TrackToActuator::PyGetObject(PyObject* self, PyObject* args) /* 3. setTime */ -char KX_TrackToActuator::SetTime_doc[] = +const char KX_TrackToActuator::SetTime_doc[] = "setTime(time)\n" "\t- time: integer\n" "\tSet the time in frames with which to delay the tracking motion.\n"; @@ -542,7 +542,7 @@ PyObject* KX_TrackToActuator::PySetTime(PyObject* self, PyObject* args, PyObject /* 4.getTime */ -char KX_TrackToActuator::GetTime_doc[] = +const char KX_TrackToActuator::GetTime_doc[] = "getTime()\n" "\t- time: integer\n" "\tReturn the time in frames with which the tracking motion is delayed.\n"; @@ -554,7 +554,7 @@ PyObject* KX_TrackToActuator::PyGetTime(PyObject* self, PyObject* args, PyObject /* 5. getUse3D */ -char KX_TrackToActuator::GetUse3D_doc[] = +const char KX_TrackToActuator::GetUse3D_doc[] = "getUse3D()\n" "\tReturns 1 if the motion is allowed to extend in the z-direction.\n"; PyObject* KX_TrackToActuator::PyGetUse3D(PyObject* self, PyObject* args, PyObject* kwds) @@ -565,7 +565,7 @@ PyObject* KX_TrackToActuator::PyGetUse3D(PyObject* self, PyObject* args, PyObjec /* 6. setUse3D */ -char KX_TrackToActuator::SetUse3D_doc[] = +const char KX_TrackToActuator::SetUse3D_doc[] = "setUse3D(value)\n" "\t- value: 0 or 1\n" "\tSet to 1 to allow the tracking motion to extend in the z-direction,\n" diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp index e60a8d7c099..7fe9d81e2e1 100644 --- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp +++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp @@ -137,7 +137,7 @@ KX_VisibilityActuator::_getattr( /* set visibility ---------------------------------------------------------- */ -char +const char KX_VisibilityActuator::SetVisible_doc[] = "setVisible(visible?)\n" "\t - visible? : Make the object visible? (KX_TRUE, KX_FALSE)" diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index ef206332057..6e5553d4781 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -85,7 +85,7 @@ RAS_2DFilterManager::~RAS_2DFilterManager() FreeTextures(); } -unsigned int RAS_2DFilterManager::CreateShaderProgram(char* shadersource) +unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource) { GLuint program = 0; GLuint fShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER); diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h index f5998e1f093..c16bd41dd0e 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.h @@ -33,7 +33,7 @@ class RAS_2DFilterManager { private: - unsigned int CreateShaderProgram(char* shadersource); + unsigned int CreateShaderProgram(const char* shadersource); unsigned int CreateShaderProgram(int filtermode); void AnalyseShader(int passindex, vector& propNames); void StartShaderProgram(int passindex); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h index 33c4b3faab0..81821639489 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_BLUR2DFILTER #define __RAS_BLUR2DFILTER -char * BlurFragmentShader=STRINGIFY( +const char * BlurFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h index c41e5ac06af..2ee75396f42 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_DILATION2DFILTER #define __RAS_DILATION2DFILTER -char * DilationFragmentShader=STRINGIFY( +const char * DilationFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h index 2bb357c958a..d3ce829bab0 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_EROSION2DFILTER #define __RAS_EROSION2DFILTER -char * ErosionFragmentShader=STRINGIFY( +const char * ErosionFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h index 7324edd4e92..ae51308e9a4 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_GRAYSCALE2DFILTER #define __RAS_GRAYSCALE2DFILTER -char * GrayScaleFragmentShader=STRINGIFY( +const char * GrayScaleFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; void main(void) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h index 5d90fe3475b..f723f619f68 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_INVERT2DFILTER #define __RAS_INVERT2DFILTER -char * InvertFragmentShader=STRINGIFY( +const char * InvertFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; void main(void) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h index cbe926976df..bfbb40b2fc9 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_LAPLACION2DFILTER #define __RAS_LAPLACION2DFILTER -char * LaplacionFragmentShader=STRINGIFY( +const char * LaplacionFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h index 7cd1082e5e3..0cbf8a7a802 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_PREWITT2DFILTER #define __RAS_PREWITT2DFILTER -char * PrewittFragmentShader=STRINGIFY( +const char * PrewittFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h index d1c16f39823..ca431af4cd7 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_SEPIA2DFILTER #define __RAS_SEPIA2DFILTER -char * SepiaFragmentShader=STRINGIFY( +const char * SepiaFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; void main(void) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h index 14e0be6df9d..5a9661e2617 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_SHARPEN2DFILTER #define __RAS_SHARPEN2DFILTER -char * SharpenFragmentShader=STRINGIFY( +const char * SharpenFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h index 40c17c285ce..142e4f0e3d4 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h @@ -28,7 +28,7 @@ #ifndef __RAS_SOBEL2DFILTER #define __RAS_SOBEL2DFILTER -char * SobelFragmentShader=STRINGIFY( +const char * SobelFragmentShader=STRINGIFY( uniform sampler2D bgl_RenderedTexture; uniform vec2 bgl_TextureCoordinateOffset[9]; -- cgit v1.2.3 From 3dbdd8939b418d39f42b6cc0b4fab38083b393cd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Sep 2008 11:54:27 +0000 Subject: 16624 was incorrect. Blender wont always give the requested name for new datablocks or for renaming. scripts need to account for this. --- source/blender/python/api2_2x/Scene.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index edb5e015eea..662656663c1 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -635,29 +635,24 @@ static PyObject *M_Scene_New( PyObject * self, PyObject * args, /*-----------------------Scene.Get()------------------------------------*/ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) { - char *tname = NULL, name[22]; + char *name = NULL; Scene *scene_iter; - if( !PyArg_ParseTuple( args, "|s", &tname ) ) + if( !PyArg_ParseTuple( args, "|s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument (or nothing)" ) ); - - strncpy(name, tname, 21); - if( strlen(tname) >= 21 ) name[21]= 0; scene_iter = G.main->scene.first; - if( tname ) { /* (name) - Search scene by name */ + if( name ) { /* (name) - Search scene by name */ PyObject *wanted_scene = NULL; - while( ( scene_iter ) && ( wanted_scene == NULL ) ) { - - if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) - wanted_scene = - Scene_CreatePyObject( scene_iter ); - - scene_iter = scene_iter->id.next; + for(;scene_iter; scene_iter = scene_iter->id.next) { + if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) { + wanted_scene = Scene_CreatePyObject( scene_iter ); + break; + } } if( wanted_scene == NULL ) { /* Requested scene doesn't exist */ @@ -681,19 +676,14 @@ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_MemoryError, "couldn't create PyList" ) ); - while( scene_iter ) { + for(; scene_iter; scene_iter = scene_iter->id.next, index++) { pyobj = Scene_CreatePyObject( scene_iter ); if( !pyobj ) { Py_DECREF(sce_pylist); - return ( EXPP_ReturnPyObjError - ( PyExc_MemoryError, - "couldn't create PyString" ) ); + return NULL; /* Scene_CreatePyObject sets an error */ } PyList_SET_ITEM( sce_pylist, index, pyobj ); - - scene_iter = scene_iter->id.next; - index++; } return sce_pylist; -- cgit v1.2.3 From 9b9edad6b6fb4db3f393ef408921f8411b588814 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 20 Sep 2008 12:26:18 +0000 Subject: Patch 17403, small gcc warning fixes. --- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- source/blender/blenlib/intern/edgehash.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 328dcada01a..5bc70e00891 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -3339,7 +3339,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, void writeBobjgz(char *filename, struct Object *ob, int useGlobalCoords, int append, float time) { char debugStrBuffer[256]; - int wri,i,j,totvert,totface; + int wri=0,i,j,totvert,totface; float wrf; gzFile gzf; DerivedMesh *dm; diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 3e1c8afb7a8..603c85655d7 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -77,8 +77,12 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) { unsigned int hash; Entry *e= malloc(sizeof(*e)); - if (v1nbuckets; + if (v1nbuckets; e->v0 = v0; e->v1 = v1; @@ -114,7 +118,11 @@ void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) { unsigned int hash; Entry *e; - if (v1nbuckets; for (e= eh->buckets[hash]; e; e= e->next) if (v0==e->v0 && v1==e->v1) -- cgit v1.2.3 From 63f10e6b550796307ccc22099efa9a7326290604 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 20 Sep 2008 12:28:01 +0000 Subject: Patch 17403, small gcc warning fixes. --- release/plugins/sequence/dnr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/plugins/sequence/dnr.c b/release/plugins/sequence/dnr.c index 7e7c168750e..b6a99de0622 100644 --- a/release/plugins/sequence/dnr.c +++ b/release/plugins/sequence/dnr.c @@ -110,9 +110,9 @@ static void doit(unsigned char * src_, unsigned char * dst_, unsigned char * dst = dst_; while (count--) { - *dst++ = table[(*src++ << 8) | *dst]; - *dst++ = table[(*src++ << 8) | *dst]; - *dst++ = table[(*src++ << 8) | *dst]; + *dst = table[(*src++ << 8) | *dst]; dst++; + *dst = table[(*src++ << 8) | *dst]; dst++; + *dst = table[(*src++ << 8) | *dst]; dst++; *dst++ = *src++; } -- cgit v1.2.3 From 2bd6e1ae82bf2a8fb7a2044b4e032b67cfec861d Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 20 Sep 2008 13:02:06 +0000 Subject: Patch #8461, by Rob Hausauer This unifies all usage of FTOCHAR, putting it in utildefines.h Submitter did several interesting tests for speed, check it here: http://projects.blender.org/tracker/?func=detail&atid=127&aid=8461&group_id=9 --- source/blender/blenkernel/BKE_utildefines.h | 2 ++ source/blender/blenkernel/intern/brush.c | 1 - source/blender/blenkernel/intern/colortools.c | 1 - source/blender/gpu/intern/gpu_extensions.c | 2 +- source/blender/imbuf/intern/divers.c | 2 +- source/blender/imbuf/intern/rectop.c | 5 +---- source/blender/render/intern/source/pipeline.c | 2 +- source/blender/render/intern/source/rendercore.c | 1 - source/blender/src/glutil.c | 1 - source/blender/src/renderwin.c | 1 - source/blender/src/seqscopes.c | 1 - source/blender/src/writeimage.c | 1 - 12 files changed, 6 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index d647a74c6e2..9662d6fbff8 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -102,6 +102,8 @@ #define AVG2(x, y) ( 0.5 * ((x) + (y)) ) +#define FTOCHAR(val) (val<=0.0f)? 0 : ((val>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*val)+0.5f)) + #define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} #define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);} #define QUATCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2); *(v1+3)= *(v2+3);} diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 6ea470a2263..1c53af97dbb 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -359,7 +359,6 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba) rgba[0]= rgba[1]= rgba[2]= rgba[3]= 1.0f; } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **outbuf) { diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 45b8bb7935c..1bc34aea9a1 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -650,7 +650,6 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const vecout[2]= curvemap_evaluateF(cumap->cm+2, fac); } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf) { diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 10603aa7283..a8dc369460c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -40,6 +40,7 @@ #include "BKE_image.h" #include "BKE_global.h" +#include "BKE_utildefines.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -154,7 +155,6 @@ struct GPUTexture { int depth; /* is a depth texture? */ }; -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) static unsigned char *GPU_texture_convert_pixels(int length, float *fpixels) { unsigned char *pixels, *p; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 84588b52573..8043e594454 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -38,6 +38,7 @@ #include "IMB_imbuf.h" #include "IMB_allocimbuf.h" #include "IMB_divers.h" +#include "BKE_utildefines.h" void imb_checkncols(struct ImBuf *ibuf) { @@ -171,7 +172,6 @@ void IMB_gamwarp(struct ImBuf *ibuf, double gamma) } } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.99f*val)) void IMB_rect_from_float(struct ImBuf *ibuf) { diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index a8ddb271309..56714c3b481 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -37,6 +37,7 @@ #include "IMB_imbuf.h" #include "IMB_allocimbuf.h" +#include "BKE_utildefines.h" /* blend modes */ @@ -514,10 +515,6 @@ void IMB_rectfill(struct ImBuf *drect, float col[4]) } } -/* maybe we should use BKE_utildefines.h */ -#define FTOCHAR(val) (val<=0.0f ? 0: (val>=1.0f ? 255: (char)(255.99f*val))) -#define CLAMP(a, b, c) if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c) -#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 9d272d04506..6bdd57612c7 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -38,6 +38,7 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" @@ -961,7 +962,6 @@ void RE_GetResultImage(Render *re, RenderResult *rr) } } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) /* caller is responsible for allocating rect in correct size! */ void RE_ResultGet32(Render *re, unsigned int *rect) { diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index bda02bea8d7..3992d1025ff 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1971,7 +1971,6 @@ void RE_shade_external(Render *re, ShadeInput *shi, ShadeResult *shr) /* ************************* bake ************************ */ -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) typedef struct BakeShade { ShadeSample ssamp; diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c index 69e3d4c7aac..69a44aff1e4 100644 --- a/source/blender/src/glutil.c +++ b/source/blender/src/glutil.c @@ -290,7 +290,6 @@ static int get_cached_work_texture(int *w_r, int *h_r) return texid; } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect) { float *f_rect; diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index 598b71930ed..b4d78b7fa37 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -426,7 +426,6 @@ static void renderwin_zoom(RenderWin *rw, int ZoomIn) { renderwin_queue_redraw(rw); } -#define FTOCHAR(val) val<=0.0f? 0 : (val>=(1.0f-0.5f/255.0f)? 255 :(char)((255.0f*val)+0.5f)) static void renderwin_mouse_moved(RenderWin *rw) { diff --git a/source/blender/src/seqscopes.c b/source/blender/src/seqscopes.c index 34cd27dfdd3..553752c0676 100644 --- a/source/blender/src/seqscopes.c +++ b/source/blender/src/seqscopes.c @@ -384,7 +384,6 @@ static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc) } } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.99f*val)) static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) { diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c index 1ef32fc33e8..b21c14bed35 100644 --- a/source/blender/src/writeimage.c +++ b/source/blender/src/writeimage.c @@ -80,7 +80,6 @@ void BIF_save_envmap(EnvMap *env, char *str) } -#define FTOCHAR(val) val<=0.0f?255: 255-(val>=255.0f?255: (char)(val)) /* callback for fileselect to save rendered image, renderresult was checked to exist */ static void save_rendered_image_cb_real(char *name, int confirm) -- cgit v1.2.3 From 0a364788c1f9007163b7d799d4758555af29b3be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Sep 2008 13:21:10 +0000 Subject: simple changes for bez point selection. use as a flag incase other flags are stored in bezt->f1,2,3 --- source/blender/blenkernel/intern/curve.c | 22 +++++------ source/blender/include/blendef.h | 4 ++ source/blender/src/drawipo.c | 2 +- source/blender/src/editcurve.c | 10 ++--- source/blender/src/editipo.c | 41 +++++++------------- source/blender/src/editipo_mods.c | 65 +++++++++++++------------------- source/blender/src/retopo.c | 6 +-- 7 files changed, 65 insertions(+), 85 deletions(-) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 396bdda9c10..c5ad9e58a4c 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1519,7 +1519,7 @@ void makeBevelList(Object *ob) bevp->y= bp->vec[1]; bevp->z= bp->vec[2]; bevp->alfa= bp->alfa; - bevp->f1= 1; + bevp->f1= SELECT; bevp++; bp++; } @@ -1579,11 +1579,11 @@ void makeBevelList(Object *ob) /* indicate with handlecodes double points */ if(prevbezt->h1==prevbezt->h2) { - if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1; + if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= SELECT; } else { - if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1; - else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->f1= 1; + if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= SELECT; + else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->f1= SELECT; } v1= data; @@ -2385,9 +2385,9 @@ void sethandlesNurb(short code) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(bezt->f1 || bezt->f3) { - if(bezt->f1) bezt->h1= code; - if(bezt->f3) bezt->h2= code; + if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if(bezt->f1 & SELECT) bezt->h1= code; + if(bezt->f3 & SELECT) bezt->h2= code; if(bezt->h1!=bezt->h2) { if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE; if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE; @@ -2415,8 +2415,8 @@ void sethandlesNurb(short code) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(bezt->f1 && bezt->h1) ok= 1; - if(bezt->f3 && bezt->h2) ok= 1; + if((bezt->f1 & SELECT) && bezt->h1) ok= 1; + if((bezt->f3 & SELECT) && bezt->h2) ok= 1; if(ok) break; bezt++; } @@ -2432,8 +2432,8 @@ void sethandlesNurb(short code) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(bezt->f1) bezt->h1= ok; - if(bezt->f3 ) bezt->h2= ok; + if(bezt->f1 & SELECT) bezt->h1= ok; + if(bezt->f3 & SELECT) bezt->h2= ok; bezt++; } diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h index 7fd607f6feb..5a883dc9e21 100644 --- a/source/blender/include/blendef.h +++ b/source/blender/include/blendef.h @@ -128,6 +128,10 @@ /* for curve objects in editmode that can have hidden handles - may use for IPO's later */ #define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) +#define BEZ_SEL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; } +#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } +#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; } + /* psfont */ #define FNT_PDRAW 1 #define FNT_HAEBERLI 2 diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index ec6a0f0d75b..1454c0d4f09 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -1315,7 +1315,7 @@ static void draw_ipohandles(int sel) glVertex2fv(fp+3); glVertex2fv(fp+6); glEnd(); } - else if( (bezt->f1 & 1)==sel) { + else if( (bezt->f1 & SELECT)==sel) { fp= bezt->vec[0]; cpack(col[bezt->h1]); diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c index 261bb26b0c4..f15ffcdcb58 100644 --- a/source/blender/src/editcurve.c +++ b/source/blender/src/editcurve.c @@ -262,7 +262,7 @@ static void printweightsNurb__doPrint(void *userData, Nurb *nurb, BPoint *bp, Be { char str[30]; - if (bp && (bp->f1&1)) { + if (bp && (bp->f1 & SELECT)) { sprintf(str,"%2.2f", bp->vec[3]); cpack(0x737373); @@ -2916,12 +2916,12 @@ void addvert_Nurb(int mode) if((nu->type & 7)==CU_BEZIER) { /* which bezpoint? */ if(bezt== nu->bezt) { /* first */ - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); newbezt = (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); memcpy(newbezt+1, bezt, nu->pntsu*sizeof(BezTriple)); *newbezt= *bezt; - newbezt->f1= newbezt->f2= newbezt->f3= SELECT; + BEZ_SEL(newbezt); if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1; else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */ VECCOPY(temp, bezt->vec[1]); @@ -2930,7 +2930,7 @@ void addvert_Nurb(int mode) bezt= newbezt+1; } else if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */ - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); newbezt = (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); memcpy(newbezt, nu->bezt, nu->pntsu*sizeof(BezTriple)); @@ -2939,7 +2939,7 @@ void addvert_Nurb(int mode) MEM_freeN(nu->bezt); nu->bezt= newbezt; newbezt+= nu->pntsu; - newbezt->f1= newbezt->f2= newbezt->f3= SELECT; + BEZ_SEL(newbezt); if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1; else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */ bezt= nu->bezt+nu->pntsu-1; diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index ecb9e845104..45641fc80ca 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -1318,14 +1318,10 @@ void update_editipo_flags(void) for(a=0; atotipo; a++) { if(ik->data[a]) { if(ik->flag & 1) { - ik->data[a]->f1 |= SELECT; - ik->data[a]->f2 |= SELECT; - ik->data[a]->f3 |= SELECT; + BEZ_SEL(ik->data[a]); } else { - ik->data[a]->f1 &= ~SELECT; - ik->data[a]->f2 &= ~SELECT; - ik->data[a]->f3 &= ~SELECT; + BEZ_DESEL(ik->data[a]); } } } @@ -1423,7 +1419,7 @@ static short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt) if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) { /* middle points get an advantage */ temp= -3+abs(mval[0]- sco[0][0])+ abs(mval[1]- sco[0][1]); - if( bezt1->f1 & 1) temp+=5; + if( bezt1->f1 & SELECT) temp+=5; if(tempf1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); } else { - bezt->f1= bezt->f2= bezt->f3= SELECT; + BEZ_SEL(bezt); } } else if(hand==0) { - if(bezt->f1 & SELECT) bezt->f1= 0; + if(bezt->f1 & SELECT) bezt->f1 &= ~SELECT; else bezt->f1= SELECT; } else { - if(bezt->f3 & SELECT) bezt->f3= 0; + if(bezt->f3 & SELECT) bezt->f3 &= ~SELECT; else bezt->f3= SELECT; } } @@ -1535,7 +1531,7 @@ void mouse_select_ipo(void) if(bezt) { if(hand==1) { - bezt->f1|= SELECT; bezt->f2|= SELECT; bezt->f3|= SELECT; + BEZ_SEL(bezt); } else if(hand==0) bezt->f1 |= SELECT; else bezt->f3 |= SELECT; @@ -2261,7 +2257,7 @@ void add_duplicate_editipo(void) while(b--) { *beztn= *bezt; if(bezt->f2 & SELECT) { - beztn->f1= beztn->f2= beztn->f3= 0; + BEZ_DESEL(beztn); beztn++; *beztn= *bezt; } @@ -3474,14 +3470,10 @@ void make_ipokey(void) if(ik->data[a]) { bezt= ik->data[a]; if(sel) { - bezt->f1 |= SELECT; - bezt->f2 |= SELECT; - bezt->f3 |= SELECT; + BEZ_SEL(bezt); } else { - bezt->f1 &= ~SELECT; - bezt->f2 &= ~SELECT; - bezt->f3 &= ~SELECT; + BEZ_DESEL(bezt); } } } @@ -4645,7 +4637,7 @@ void duplicate_ipo_keys(Ipo *ipo) for (icu=ipo->curve.first; icu; icu=icu->next){ for (i=0; itotvert; i++){ /* If a key is selected */ - if (icu->bezt[i].f2 & 1){ + if (icu->bezt[i].f2 & SELECT){ /* Expand the list */ newbezt = MEM_callocN(sizeof(BezTriple) * (icu->totvert+1), "beztriple"); memcpy (newbezt, icu->bezt, sizeof(BezTriple) * (i+1)); @@ -4655,15 +4647,10 @@ void duplicate_ipo_keys(Ipo *ipo) MEM_freeN (icu->bezt); icu->bezt=newbezt; /* Unselect the current key*/ - icu->bezt[i].f1 &= ~ 1; - icu->bezt[i].f2 &= ~ 1; - icu->bezt[i].f3 &= ~ 1; + BEZ_DESEL(&icu->bezt[i]); i++; /* Select the copied key */ - icu->bezt[i].f1 |= 1; - icu->bezt[i].f2 |= 1; - icu->bezt[i].f3 |= 1; - + BEZ_SEL(&icu->bezt[i]); } } } diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c index 24bb111c8d1..94a373d5841 100644 --- a/source/blender/src/editipo_mods.c +++ b/source/blender/src/editipo_mods.c @@ -136,10 +136,10 @@ void swap_selectall_editipo(void) b= ei->icu->totvert; while(b--) { if(totipo_vertsel) { - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); } else { - bezt->f1= bezt->f2= bezt->f3= SELECT; + BEZ_SEL(bezt); } bezt++; } @@ -228,7 +228,7 @@ void deselectall_editipo(void) bezt= ei->icu->bezt; b= ei->icu->totvert; while(b--) { - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_SEL(bezt); bezt++; } } @@ -374,18 +374,14 @@ static int selected_bezier_loop(int (*looptest)(EditIpo *), int select_bezier_add(BezTriple *bezt) { /* Select the bezier triple */ - bezt->f1 |= SELECT; - bezt->f2 |= SELECT; - bezt->f3 |= SELECT; + BEZ_SEL(bezt); return 0; } int select_bezier_subtract(BezTriple *bezt) { /* Deselect the bezier triple */ - bezt->f1 &= ~SELECT; - bezt->f2 &= ~SELECT; - bezt->f3 &= ~SELECT; + BEZ_DESEL(bezt); return 0; } @@ -412,9 +408,9 @@ static int set_bezier_auto(BezTriple *bezt) /* is a handle selected? If so * set it to type auto */ - if(bezt->f1 || bezt->f3) { - if(bezt->f1) bezt->h1= 1; /* the secret code for auto */ - if(bezt->f3) bezt->h2= 1; + if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if(bezt->f1 & SELECT) bezt->h1= 1; /* the secret code for auto */ + if(bezt->f3 & SELECT) bezt->h2= 1; /* if the handles are not of the same type, set them * to type free @@ -435,9 +431,9 @@ static int set_bezier_vector(BezTriple *bezt) /* is a handle selected? If so * set it to type vector */ - if(bezt->f1 || bezt->f3) { - if(bezt->f1) bezt->h1= 2; /* the code for vector */ - if(bezt->f3) bezt->h2= 2; + if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if(bezt->f1 & SELECT) bezt->h1= 2; /* the code for vector */ + if(bezt->f3 & SELECT) bezt->h2= 2; /* if the handles are not of the same type, set them * to type free @@ -455,8 +451,8 @@ static int bezier_isfree(BezTriple *bezt) /* queries whether the handle should be set * to type 'free' (I think) */ - if(bezt->f1 && bezt->h1) return 1; - if(bezt->f3 && bezt->h2) return 1; + if((bezt->f1 & SELECT) && bezt->h1) return 1; + if((bezt->f3 & SELECT) && bezt->h2) return 1; return 0; } @@ -464,8 +460,8 @@ static int set_bezier_free(BezTriple *bezt) { /* Sets selected bezier handles to type 'free' */ - if(bezt->f1) bezt->h1= HD_FREE; - if(bezt->f3) bezt->h2= HD_FREE; + if(bezt->f1 & SELECT) bezt->h1= HD_FREE; + if(bezt->f3 & SELECT) bezt->h2= HD_FREE; return 0; } @@ -473,8 +469,8 @@ static int set_bezier_align(BezTriple *bezt) { /* Sets selected bezier handles to type 'align' */ - if(bezt->f1) bezt->h1= HD_ALIGN; - if(bezt->f3) bezt->h2= HD_ALIGN; + if(bezt->f1 & SELECT) bezt->h1= HD_ALIGN; + if(bezt->f3 & SELECT) bezt->h2= HD_ALIGN; return 0; } @@ -1032,6 +1028,7 @@ void borderselect_ipo(void) select_proj_ipo(&rectf, val); } else { + int selflag= (val==LEFTMOUSE) ? SELECT : 0; ei= G.sipo->editipo; for(a=0; atotipo; a++, ei++) { @@ -1040,14 +1037,12 @@ void borderselect_ipo(void) b= ei->icu->totvert; bezt= ei->icu->bezt; while(b--) { - int bit= (val==LEFTMOUSE); - if(BLI_in_rctf(&rectf, bezt->vec[0][0], bezt->vec[0][1])) - bezt->f1 = (bezt->f1&~SELECT) | bit; + bezt->f1 = selflag ? (bezt->f1 | SELECT) : (bezt->f1 & ~SELECT); if(BLI_in_rctf(&rectf, bezt->vec[1][0], bezt->vec[1][1])) - bezt->f2 = (bezt->f2&~SELECT) | bit; + bezt->f2 = selflag ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT); if(BLI_in_rctf(&rectf, bezt->vec[2][0], bezt->vec[2][1])) - bezt->f3 = (bezt->f3&~SELECT) | bit; + bezt->f3 = selflag ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT); bezt++; } @@ -1211,19 +1206,13 @@ void set_ipo_key_selection(Ipo *ipo, int sel) for (icu=ipo->curve.first; icu; icu=icu->next){ for (i=0; itotvert; i++){ if (sel == 2) { - icu->bezt[i].f1^=1; - icu->bezt[i].f2^=1; - icu->bezt[i].f3^=1; + BEZ_INVSEL(&icu->bezt[i]); } else if (sel == 1){ - icu->bezt[i].f1|=1; - icu->bezt[i].f2|=1; - icu->bezt[i].f3|=1; + BEZ_SEL(&icu->bezt[i]); } else{ - icu->bezt[i].f1&=~1; - icu->bezt[i].f2&=~1; - icu->bezt[i].f3&=~1; + BEZ_DESEL(&icu->bezt[i]); } } } @@ -1240,10 +1229,10 @@ int fullselect_ipo_keys(Ipo *ipo) for (icu=ipo->curve.first; icu; icu=icu->next) { for (i=0; itotvert; i++){ - if (icu->bezt[i].f2 & 1){ + if (icu->bezt[i].f2 & SELECT){ tvtot+=3; - icu->bezt[i].f1 |= 1; - icu->bezt[i].f3 |= 1; + icu->bezt[i].f1 |= SELECT; + icu->bezt[i].f3 |= SELECT; } } } diff --git a/source/blender/src/retopo.c b/source/blender/src/retopo.c index 60be622e3ad..47eee872a8a 100644 --- a/source/blender/src/retopo.c +++ b/source/blender/src/retopo.c @@ -826,11 +826,11 @@ void retopo_do_all() } else if(nu->type & CU_BEZIER) { for(i=0; ipntsu; ++i) { - if(nu->bezt[i].f1 & 1) + if(nu->bezt[i].f1 & SELECT) retopo_do_vert(G.vd, nu->bezt[i].vec[0]); - if(nu->bezt[i].f2 & 1) + if(nu->bezt[i].f2 & SELECT) retopo_do_vert(G.vd, nu->bezt[i].vec[1]); - if(nu->bezt[i].f3 & 1) + if(nu->bezt[i].f3 & SELECT) retopo_do_vert(G.vd, nu->bezt[i].vec[2]); } } -- cgit v1.2.3 From 768e12a064cf524a14a84203b100a33235bba30e Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 20 Sep 2008 14:43:59 +0000 Subject: Patch #17631 by Early Ehlinger His log: One of the calls to PIL_dynlib_get_error_as_string was assuming that it would return a valid string and not NULL (perhaps by converting to std::string). This patch simply changes it to always return a string, even when the error is not recognized. --- source/blender/blenlib/intern/dynlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index c4692995f20..e7fa3332f43 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -77,12 +77,12 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { int err; /* if lib is NULL reset the last error code */ + err= GetLastError(); if (!lib) { SetLastError(ERROR_SUCCESS); - return NULL; + err = ERROR_SUCCESS; } - err= GetLastError(); if (err) { static char buf[1024]; @@ -96,7 +96,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { return buf; } - return NULL; + return "unrecognized error"; } void PIL_dynlib_close(PILdynlib *lib) { -- cgit v1.2.3 From 22a50402efc1fd9b725d7760c90b343e63191ee4 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sat, 20 Sep 2008 21:33:54 +0000 Subject: BGE patch: allow Bullet mesh shape sharing for objects copied with ALT-D. --- .../gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 12 ++++- .../Physics/Bullet/CcdPhysicsController.cpp | 58 ++++++++++++++++------ .../Physics/Bullet/CcdPhysicsController.h | 37 +++++++------- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 2 +- 4 files changed, 73 insertions(+), 36 deletions(-) diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index b3f24d97281..6f5f9e22506 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -767,7 +767,17 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, { if (!ci.m_mass) { - shapeInfo->SetMesh(meshobj, false); + // mesh shapes can be shared, check first if we already have a shape on that mesh + class CcdShapeConstructionInfo *sharedShapeInfo = CcdShapeConstructionInfo::FindMesh(meshobj, false); + if (sharedShapeInfo != NULL) + { + delete shapeInfo; + shapeInfo = sharedShapeInfo; + shapeInfo->AddRef(); + } else + { + shapeInfo->SetMesh(meshobj, false); + } bm = shapeInfo->CreateBulletShape(); //no moving concave meshes, so don't bother calculating inertia //bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index b1b97b5370f..1ec555f653d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -902,9 +902,25 @@ void DefaultMotionState::calculateWorldTransformations() } // Shape constructor +std::map CcdShapeConstructionInfo::m_meshShapeMap; + +CcdShapeConstructionInfo* CcdShapeConstructionInfo::FindMesh(RAS_MeshObject* mesh, bool polytope) +{ + if (polytope) + // not yet supported + return NULL; + + std::map::const_iterator mit = m_meshShapeMap.find(mesh); + if (mit != m_meshShapeMap.end()) + return mit->second; + return NULL; +} + bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, bool polytope) { // assume no shape information + // no support for dynamic change of shape yet + assert(m_meshObject == NULL); m_shapeType = PHY_SHAPE_NONE; m_vertexArray.clear(); m_polygonIndexArray.clear(); @@ -1006,6 +1022,11 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, bool polytope) return false; } m_meshObject = meshobj; + if (!polytope) + { + // triangle shape can be shared, store the mesh object in the map + m_meshShapeMap.insert(std::pair(meshobj,this)); + } return true; } @@ -1066,16 +1087,18 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape() break; case PHY_SHAPE_COMPOUND: - if (m_nextShape) + if (m_shapeArray.size() > 0) { compoundShape = new btCompoundShape(); - for (nextShapeInfo=m_nextShape; nextShapeInfo; nextShapeInfo = nextShapeInfo->m_nextShape) + for (std::vector::iterator sit = m_shapeArray.begin(); + sit != m_shapeArray.end(); + sit++) { - collisionShape = nextShapeInfo->CreateBulletShape(); + collisionShape = (*sit)->CreateBulletShape(); if (collisionShape) { - collisionShape->setLocalScaling(nextShapeInfo->m_childScale); - compoundShape->addChildShape(nextShapeInfo->m_childTrans, collisionShape); + collisionShape->setLocalScaling((*sit)->m_childScale); + compoundShape->addChildShape((*sit)->m_childTrans, collisionShape); } } collisionShape = compoundShape; @@ -1086,28 +1109,31 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape() void CcdShapeConstructionInfo::AddShape(CcdShapeConstructionInfo* shapeInfo) { - CcdShapeConstructionInfo* nextShape = this; - while (nextShape->m_nextShape != NULL) - nextShape = nextShape->m_nextShape; - nextShape->m_nextShape = shapeInfo; + m_shapeArray.push_back(shapeInfo); } CcdShapeConstructionInfo::~CcdShapeConstructionInfo() { - CcdShapeConstructionInfo* childShape = m_nextShape; - - while (childShape) + for (std::vector::iterator sit = m_shapeArray.begin(); + sit != m_shapeArray.end(); + sit++) { - CcdShapeConstructionInfo* nextShape = childShape->m_nextShape; - childShape->m_nextShape = NULL; - childShape->Release(); - childShape = nextShape; + (*sit)->Release(); } + m_shapeArray.clear(); if (m_unscaledShape) { DeleteBulletShape(m_unscaledShape); } m_vertexArray.clear(); + if (m_shapeType == PHY_SHAPE_MESH && m_meshObject != NULL) + { + std::map::iterator mit = m_meshShapeMap.find(m_meshObject); + if (mit != m_meshShapeMap.end() && mit->second == this) + { + m_meshShapeMap.erase(mit); + } + } } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 355c1d608b1..af146413c91 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -18,6 +18,7 @@ subject to the following restrictions: #define BULLET2_PHYSICSCONTROLLER_H #include +#include #include "PHY_IPhysicsController.h" @@ -42,15 +43,17 @@ class btCollisionShape; class CcdShapeConstructionInfo { public: + static CcdShapeConstructionInfo* FindMesh(RAS_MeshObject* mesh, bool polytope); + CcdShapeConstructionInfo() : m_shapeType(PHY_SHAPE_NONE), m_radius(1.0), m_height(1.0), m_halfExtend(0.f,0.f,0.f), m_childScale(1.0f,1.0f,1.0f), - m_nextShape(NULL), - m_unscaledShape(NULL), - m_refCount(1) + m_refCount(1), + m_meshObject(NULL), + m_unscaledShape(NULL) { m_childTrans.setIdentity(); } @@ -77,22 +80,19 @@ public: { return m_unscaledShape; } - CcdShapeConstructionInfo* GetNextShape() - { - return m_nextShape; - } CcdShapeConstructionInfo* GetChildShape(int i) { - CcdShapeConstructionInfo* shape = m_nextShape; - while (i > 0 && shape != NULL) - { - shape = shape->m_nextShape; - i--; - } - return shape; + if (i < 0 || i >= m_shapeArray.size()) + return NULL; + + return m_shapeArray.at(i); } bool SetMesh(RAS_MeshObject* mesh, bool polytope); + RAS_MeshObject* GetMesh(void) + { + return m_meshObject; + } btCollisionShape* CreateBulletShape(); @@ -109,14 +109,15 @@ public: std::vector m_polygonIndexArray; // Contains the array of polygon index in the // original mesh that correspond to shape triangles. // only set for concave mesh shape. - const RAS_MeshObject* m_meshObject; // Keep a pointer to the original mesh protected: - CcdShapeConstructionInfo* m_nextShape; // for compound shape - btBvhTriangleMeshShape* m_unscaledShape;// holds the shared unscale BVH mesh shape, - // the actual shape is of type btScaledBvhTriangleMeshShape + static std::map m_meshShapeMap; int m_refCount; // this class is shared between replicas // keep track of users so that we can release it + RAS_MeshObject* m_meshObject; // Keep a pointer to the original mesh + btBvhTriangleMeshShape* m_unscaledShape;// holds the shared unscale BVH mesh shape, + // the actual shape is of type btScaledBvhTriangleMeshShape + std::vector m_shapeArray; // for compound shapes }; struct CcdConstructionInfo diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 96caf885e7c..68b3df1695c 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -865,7 +865,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallbac if (shape == rayCallback.m_hitTriangleShape && rayCallback.m_hitTriangleIndex < shapeInfo->m_polygonIndexArray.size()) { - result.m_meshObject = shapeInfo->m_meshObject; + result.m_meshObject = shapeInfo->GetMesh(); result.m_polygon = shapeInfo->m_polygonIndexArray.at(rayCallback.m_hitTriangleIndex); // Bullet returns the normal from "outside". -- cgit v1.2.3 From a72b65011e826342eaf9620413714fbbf1a1d872 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sat, 20 Sep 2008 22:19:59 +0000 Subject: BGE bug fix: dupligroup scale not correctly applied to bullet shape. --- source/gameengine/Ketsji/KX_GameObject.cpp | 10 ++++++++++ source/gameengine/Ketsji/KX_Scene.cpp | 23 ----------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 252741754ec..15055a9cf93 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -823,7 +823,17 @@ void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale) void KX_GameObject::NodeSetRelativeScale(const MT_Vector3& scale) { if (GetSGNode()) + { GetSGNode()->RelativeScale(scale); + if (m_pPhysicsController1 && (!GetSGNode()->GetSGParent())) + { + // see note above + // we can use the local scale: it's the same thing for a root object + // and the world scale is not yet updated + MT_Vector3 newscale = GetSGNode()->GetLocalScale(); + m_pPhysicsController1->setScaling(newscale); + } + } } void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans) diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 72875bbc039..04db96c298c 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -694,17 +694,6 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) newscale*(groupobj->NodeGetWorldOrientation() * gameobj->NodeGetWorldPosition()); replica->NodeSetLocalPosition(newpos); - if (replica->GetPhysicsController()) - { - // not required, already done in NodeSetLocalOrientation.. - //replica->GetPhysicsController()->setPosition(newpos); - //replica->GetPhysicsController()->setOrientation(newori.getRotation()); - // Scaling has been set relatively hereabove, this does not - // set the scaling of the controller. I don't know why it's just the - // relative scale and not the full scale that has to be put here... - replica->GetPhysicsController()->setScaling(newscale); - } - replica->GetSGNode()->UpdateWorldData(0); replica->GetSGNode()->SetBBox(gameobj->GetSGNode()->BBox()); replica->GetSGNode()->SetRadius(gameobj->GetSGNode()->Radius()); @@ -829,18 +818,6 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, // set the replica's relative scale with the rootnode's scale replica->NodeSetRelativeScale(newscale); - if (replica->GetPhysicsController()) - { - // not needed, already done in NodeSetLocalPosition() - //replica->GetPhysicsController()->setPosition(newpos); - //replica->GetPhysicsController()->setOrientation(newori.getRotation()); - replica->GetPhysicsController()->setScaling(newscale); - } - - // here we want to set the relative scale: the rootnode's scale will override all other - // scalings, so lets better prepare for it - - replica->GetSGNode()->UpdateWorldData(0); replica->GetSGNode()->SetBBox(originalobj->GetSGNode()->BBox()); replica->GetSGNode()->SetRadius(originalobj->GetSGNode()->Radius()); -- cgit v1.2.3 From 877d70b14a972fb3d3aee52da0ad6b7bb4fbdef4 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sat, 20 Sep 2008 22:34:54 +0000 Subject: fixed sphere-sphere collision: contact points were not properly removed/refreshed. --- .../CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp index c9256473c00..c2b13f5903f 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp @@ -56,11 +56,16 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0 btScalar radius0 = sphere0->getRadius(); btScalar radius1 = sphere1->getRadius(); - //m_manifoldPtr->clearManifold(); //don't do this, it disables warmstarting +#ifdef CLEAR_MANIFOLD + m_manifoldPtr->clearManifold(); //don't do this, it disables warmstarting +#endif ///iff distance positive, don't generate a new contact if ( len > (radius0+radius1)) { +#ifndef CLEAR_MANIFOLD + resultOut->refreshContactPoints(); +#endif //CLEAR_MANIFOLD return; } ///distance (negative means penetration) @@ -82,7 +87,9 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0 resultOut->addContactPoint(normalOnSurfaceB,pos1,dist); - //no resultOut->refreshContactPoints(); needed, because of clearManifold (all points are new) +#ifndef CLEAR_MANIFOLD + resultOut->refreshContactPoints(); +#endif //CLEAR_MANIFOLD } -- cgit v1.2.3 From 2941f755f7990d2af2ff742d75b95ecbf34a83fc Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sat, 20 Sep 2008 23:45:45 +0000 Subject: attempt to support negative local scaling for convex hull, box,sphere, cylinder, cone and btScaledBvhTriangleMeshShape in Bullet. --- .../CollisionShapes/btConvexHullShape.cpp | 7 ++++++ .../CollisionShapes/btConvexHullShape.h | 3 ++- .../CollisionShapes/btConvexInternalShape.cpp | 2 +- .../btScaledBvhTriangleMeshShape.cpp | 26 ++++++++++++++++++---- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp index deb3954b5c3..2596858bc3a 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp @@ -36,6 +36,13 @@ btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int } + +void btConvexHullShape::setLocalScaling(const btVector3& scaling) +{ + m_localScaling = scaling; + recalcLocalAabb(); +} + void btConvexHullShape::addPoint(const btPoint3& point) { m_points.push_back(point); diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h index c029ca19403..4773de2dc51 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h @@ -71,7 +71,8 @@ public: virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const; virtual bool isInside(const btPoint3& pt,btScalar tolerance) const; - + ///in case we receive negative scaling + virtual void setLocalScaling(const btVector3& scaling); }; diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp index f828d28e18c..fb81c8a5bde 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp @@ -26,7 +26,7 @@ m_collisionMargin(CONVEX_DISTANCE_MARGIN) void btConvexInternalShape::setLocalScaling(const btVector3& scaling) { - m_localScaling = scaling; + m_localScaling = scaling.absolute(); } diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp index 5a17b4e2df0..845a5e3005d 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp @@ -56,8 +56,18 @@ void btScaledBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callb btScaledTriangleCallback scaledCallback(callback,m_localScaling); btVector3 invLocalScaling(1.f/m_localScaling.getX(),1.f/m_localScaling.getY(),1.f/m_localScaling.getZ()); - btVector3 scaledAabbMin = aabbMin * invLocalScaling; - btVector3 scaledAabbMax = aabbMax * invLocalScaling; + btVector3 scaledAabbMin,scaledAabbMax; + + ///support negative scaling + scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0]; + scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1]; + scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2]; + + scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0]; + scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1]; + scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2]; + + m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax); } @@ -66,8 +76,16 @@ void btScaledBvhTriangleMeshShape::getAabb(const btTransform& trans,btVector3& a { btVector3 localAabbMin = m_bvhTriMeshShape->getLocalAabbMin(); btVector3 localAabbMax = m_bvhTriMeshShape->getLocalAabbMax(); - localAabbMin *= m_localScaling; - localAabbMax *= m_localScaling; + + btVector3 tmpLocalAabbMin = localAabbMin * m_localScaling; + btVector3 tmpLocalAabbMax = localAabbMax * m_localScaling; + + localAabbMin[0] = (m_localScaling.getX() >= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0]; + localAabbMin[1] = (m_localScaling.getY() >= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1]; + localAabbMin[2] = (m_localScaling.getZ() >= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2]; + localAabbMax[0] = (m_localScaling.getX() <= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0]; + localAabbMax[1] = (m_localScaling.getY() <= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1]; + localAabbMax[2] = (m_localScaling.getZ() <= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2]; btVector3 localHalfExtents = btScalar(0.5)*(localAabbMax-localAabbMin); btScalar margin = m_bvhTriMeshShape->getMargin(); -- cgit v1.2.3 From deba5ab9a72ad09d935c29790f4af57c9bcb2a3a Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sun, 21 Sep 2008 01:13:54 +0000 Subject: encountered some issue with the btDbvtBroadphase, switch of a deferred collision feature. --- .../src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index fd82fd7cae3..e711078f4e2 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -119,7 +119,7 @@ void Process(const btDbvtNode* n) // btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache) { -m_deferedcollide = false; +m_deferedcollide = true;//false; m_needcleanup = true; m_releasepaircache = (paircache!=0)?false:true; m_prediction = 1/(btScalar)2; -- cgit v1.2.3 From 2064f5542ae8edf0c52bcc104f10696f5b6e3659 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Sep 2008 04:39:40 +0000 Subject: set the visibility state based on the objects render option in the outliner. - saves adding UV's to faces just to set the invisibility option or having an logic bricks to set the visibility state. --- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index ae9b8602500..daa67b147c3 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1601,6 +1601,8 @@ static KX_GameObject *gameobject_from_blenderobject( gameobj->SetPhysicsEnvironment(kxscene->GetPhysicsEnvironment()); gameobj->SetLayer(ob->lay); gameobj->SetBlenderObject(ob); + /* set the visibility state based on the objects render option in the outliner */ + if(ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0); } return gameobj; } -- cgit v1.2.3 From e11cd5a962803747ce3c0bddaef73a47d8938b63 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Sep 2008 05:38:28 +0000 Subject: game engine now compiles with SDL disabled. CDROM and Joystick wont function in this case --- intern/SoundSystem/SConscript | 3 ++ intern/SoundSystem/sdl/SND_SDLCDDevice.cpp | 17 ++++++- .../gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 54 ++++++++++++++++++---- .../gameengine/GameLogic/Joystick/SCA_Joystick.h | 10 ++-- .../GameLogic/Joystick/SCA_JoystickEvents.cpp | 3 +- .../GameLogic/Joystick/SCA_JoystickPrivate.h | 3 ++ .../gameengine/GameLogic/SCA_JoystickManager.cpp | 4 +- source/gameengine/GameLogic/SConscript | 7 ++- 8 files changed, 84 insertions(+), 17 deletions(-) diff --git a/intern/SoundSystem/SConscript b/intern/SoundSystem/SConscript index baf680f03f0..be19c4b7915 100644 --- a/intern/SoundSystem/SConscript +++ b/intern/SoundSystem/SConscript @@ -14,4 +14,7 @@ if env['WITH_BF_OPENAL']: else: defs = 'NO_SOUND' +if not env['WITH_BF_SDL']: + defs += ' DISABLE_SDL' + env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [20,140] ) diff --git a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp index 8bb6c642b11..0ab0fa94c7b 100644 --- a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp +++ b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp @@ -55,6 +55,10 @@ SND_SDLCDDevice::SND_SDLCDDevice() : void SND_SDLCDDevice::init() { +#ifdef DISABLE_SDL + fprintf(stderr, "Blender compiled without SDL, no CDROM support\n"); + return; +#else if (SDL_InitSubSystem(SDL_INIT_CDROM)) { fprintf(stderr, "Error initializing CDROM\n"); @@ -75,19 +79,23 @@ void SND_SDLCDDevice::init() /* Did if open? Check if cdrom is NULL */ if(!m_cdrom) { - fprintf(stderr, "Couldn't open drive: %s", SDL_GetError()); + fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError()); return; } +#endif } SND_SDLCDDevice::~SND_SDLCDDevice() { +#ifndef DISABLE_SDL StopCD(); SDL_CDClose(m_cdrom); +#endif } void SND_SDLCDDevice::NextFrame() { +#ifndef DISABLE_SDL m_frame++; m_frame &= 127; @@ -111,20 +119,24 @@ void SND_SDLCDDevice::NextFrame() } } +#endif } void SND_SDLCDDevice::PlayCD(int track) { +#ifndef DISABLE_SDL if ( m_cdrom && CD_INDRIVE(SDL_CDStatus(m_cdrom)) ) { SDL_CDPlayTracks(m_cdrom, track-1, 0, track, 0); m_cdplaying = true; m_cdtrack = track; } +#endif } void SND_SDLCDDevice::PauseCD(bool pause) { +#ifndef DISABLE_SDL if (!m_cdrom) return; @@ -132,13 +144,16 @@ void SND_SDLCDDevice::PauseCD(bool pause) SDL_CDPause(m_cdrom); else SDL_CDResume(m_cdrom); +#endif } void SND_SDLCDDevice::StopCD() { +#ifndef DISABLE_SDL if (m_cdrom) SDL_CDStop(m_cdrom); m_cdplaying = false; +#endif } void SND_SDLCDDevice::SetCDPlaymode(int playmode) diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index 06002060bf1..092956e6489 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -42,14 +42,18 @@ SCA_Joystick::SCA_Joystick(short int index) m_isinit(0), m_istrig(0) { +#ifndef DISABLE_SDL m_private = new PrivateData(); +#endif } SCA_Joystick::~SCA_Joystick() { +#ifndef DISABLE_SDL delete m_private; +#endif } SCA_Joystick *SCA_Joystick::m_instance[JOYINDEX_MAX]; @@ -57,6 +61,9 @@ int SCA_Joystick::m_refCount = 0; SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) { +#ifdef DISABLE_SDL + return NULL; +#else if (joyindex < 0 || joyindex >= JOYINDEX_MAX) { echo("Error-invalid joystick index: " << joyindex); return NULL; @@ -81,12 +88,14 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) m_refCount++; } return m_instance[joyindex]; +#endif } void SCA_Joystick::ReleaseInstance() { if (--m_refCount == 0) { +#ifndef DISABLE_SDL int i; for (i=0; im_joystick, button)? result = true:result = false; m_istrig = result; return result; +#endif } bool SCA_Joystick::aButtonReleaseIsPositive(int button) { +#ifdef DISABLE_SDL + return false; +#else bool result; SDL_JoystickGetButton(m_private->m_joystick, button)? result = false : result = true; m_istrig = result; return result; +#endif } @@ -199,6 +218,9 @@ int SCA_Joystick::pGetHat(int direction) int SCA_Joystick::GetNumberOfAxes() { +#ifdef DISABLE_SDL + return -1; +#else int number; if(m_isinit){ if(m_private->m_joystick){ @@ -207,11 +229,15 @@ int SCA_Joystick::GetNumberOfAxes() } } return -1; +#endif } int SCA_Joystick::GetNumberOfButtons() { +#ifdef DISABLE_SDL + return -1; +#else int number; if(m_isinit){ if(m_private->m_joystick){ @@ -220,11 +246,15 @@ int SCA_Joystick::GetNumberOfButtons() } } return -1; +#endif } int SCA_Joystick::GetNumberOfHats() { +#ifdef DISABLE_SDL + return -1; +#else int number; if(m_isinit){ if(m_private->m_joystick){ @@ -233,10 +263,14 @@ int SCA_Joystick::GetNumberOfHats() } } return -1; +#endif } bool SCA_Joystick::CreateJoystickDevice(void) { +#ifdef DISABLE_SDL + return false; +#else if(m_isinit == false){ if (m_joyindex>=SDL_NumJoysticks()) { // don't print a message, because this is done anyway @@ -251,11 +285,13 @@ bool SCA_Joystick::CreateJoystickDevice(void) m_isinit = true; } return true; +#endif } void SCA_Joystick::DestroyJoystickDevice(void) { +#ifndef DISABLE_SDL if (m_isinit){ if(SDL_JoystickOpened(m_joyindex)){ echo("Closing-joystick " << m_joyindex); @@ -263,21 +299,21 @@ void SCA_Joystick::DestroyJoystickDevice(void) } m_isinit = false; } +#endif } int SCA_Joystick::Connected(void) { - if (m_isinit){ - if(SDL_JoystickOpened(m_joyindex)){ - return 1; - } - } - +#ifndef DISABLE_SDL + if (m_isinit && SDL_JoystickOpened(m_joyindex)) + return 1; +#endif return 0; } void SCA_Joystick::pFillAxes() { +#ifndef DISABLE_SDL if(GetNumberOfAxes() == 1){ m_axis10 = SDL_JoystickGetAxis(m_private->m_joystick, 0); m_axis11 = SDL_JoystickGetAxis(m_private->m_joystick, 1); @@ -287,18 +323,20 @@ void SCA_Joystick::pFillAxes() m_axis20 = SDL_JoystickGetAxis(m_private->m_joystick, 2); m_axis21 = SDL_JoystickGetAxis(m_private->m_joystick, 3); }else{ - m_axis10 = 0;m_axis11 = 0; - m_axis20 = 0;m_axis21 = 0; + m_axis10 = m_axis11 = m_axis20 = m_axis21 = 0; } +#endif } int SCA_Joystick::pGetAxis(int axisnum, int udlr) { +#ifndef DISABLE_SDL if(axisnum == 1 && udlr == 1)return m_axis10; //u/d if(axisnum == 1 && udlr == 0)return m_axis11; //l/r if(axisnum == 2 && udlr == 0)return m_axis20; //... if(axisnum == 2 && udlr == 1)return m_axis21; +#endif return 0; } diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h index bcbb43241c2..ea7ecf7cefe 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h @@ -45,9 +45,9 @@ class SCA_Joystick static int m_refCount; class PrivateData; - +#ifndef DISABLE_SDL PrivateData *m_private; - +#endif int m_joyindex; /* @@ -104,6 +104,7 @@ class SCA_Joystick /* is triggered */ bool m_istrig; +#ifndef DISABLE_SDL /* * event callbacks */ @@ -113,7 +114,7 @@ class SCA_Joystick void OnButtonDown(SDL_Event *sdl_event); void OnNothing(SDL_Event *sdl_event); void OnBallMotion(SDL_Event *sdl_event){} - +#endif /* * Open the joystick */ @@ -226,8 +227,9 @@ public: */ int Connected(void); }; - +#ifndef DISABLE_SDL void Joystick_HandleEvents( void ); +#endif #endif diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp index 1e064f55397..0e2078265c9 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp @@ -29,7 +29,7 @@ #include "SCA_JoystickPrivate.h" - +#ifndef DISABLE_SDL void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) { pFillAxes(); @@ -102,3 +102,4 @@ void SCA_Joystick::HandleEvents(void) } } } +#endif diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h index bb6bfe2d4cc..acbbcae9cd7 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h @@ -29,6 +29,7 @@ #define __SCA_JOYSTICKPRIVATE_H__ #include "SCA_Joystick.h" +#ifndef DISABLE_SDL class SCA_Joystick::PrivateData { public: @@ -43,3 +44,5 @@ public: } }; #endif + +#endif diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index a86770a6e0a..d874b5b013a 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -63,9 +63,9 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) } else { set::iterator it; - +#ifndef DISABLE_SDL SCA_Joystick::HandleEvents(); /* Handle all SDL Joystick events */ - +#endif for (it = m_sensors.begin(); it != m_sensors.end(); it++) { SCA_JoystickSensor* joysensor = (SCA_JoystickSensor*)(*it); diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index 1ca884f6dec..fa5a3123215 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -10,4 +10,9 @@ incs += ' #/source/gameengine/Rasterizer' incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_SDL_INC'] -env.BlenderLib ( 'bf_logic', sources, Split(incs), [], libtype=['game','player'], priority=[30, 110] ) +defs = '' + +if not env['WITH_BF_SDL']: + defs += ' DISABLE_SDL' + +env.BlenderLib ( 'bf_logic', sources, Split(incs), Split(defs), libtype=['game','player'], priority=[30, 110] ) -- cgit v1.2.3 From a9988317c9d9cf312ec5de7f9c6bb3fb1e161847 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Sep 2008 10:12:33 +0000 Subject: Added select grouped property (objects with shared property names will be selected) (updated select group toolbox and header menu) Added 2 copy property options - Replace All and Merge All, since there was no way to remove all properties, or set all objects game properties to be the same as the active objects. Added set_ob_property(ob, prop) to property api. bugfix in python api, copyAllPropertiesTo, it didnt check for duplicates or that it wasnt copying from/to the same object. --- source/blender/blenkernel/BKE_property.h | 3 +- source/blender/blenkernel/intern/property.c | 16 ++++-- source/blender/blenloader/intern/readfile.c | 4 +- source/blender/python/api2_2x/Object.c | 17 ++++--- source/blender/src/drawmesh.c | 4 +- source/blender/src/drawobject.c | 2 +- source/blender/src/editobject.c | 50 +++++++++---------- source/blender/src/header_view3d.c | 6 ++- source/blender/src/space.c | 77 +++++++++++++++++------------ source/blender/src/toolbox.c | 2 + 10 files changed, 108 insertions(+), 73 deletions(-) diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h index f1587790c4a..6af1deda727 100644 --- a/source/blender/blenkernel/BKE_property.h +++ b/source/blender/blenkernel/BKE_property.h @@ -41,7 +41,8 @@ struct bProperty *copy_property(struct bProperty *prop); void copy_properties(struct ListBase *lbn, struct ListBase *lbo); void init_property(struct bProperty *prop); struct bProperty *new_property(int type); -struct bProperty *get_property(struct Object *ob, char *name); +struct bProperty *get_ob_property(struct Object *ob, char *name); +void set_ob_property(struct Object *ob, struct bProperty *propc); int compare_property(struct bProperty *prop, char *str); void set_property(struct bProperty *prop, char *str); void add_property(struct bProperty *prop, char *str); diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index f55bdd15279..d2eb058a9a0 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -83,8 +83,7 @@ bProperty *copy_property(bProperty *prop) void copy_properties(ListBase *lbn, ListBase *lbo) { bProperty *prop, *propn; - - lbn->first= lbn->last= 0; + free_properties( lbn ); /* incase we are copying to an object with props */ prop= lbo->first; while(prop) { propn= copy_property(prop); @@ -139,7 +138,7 @@ bProperty *new_property(int type) return prop; } -bProperty *get_property(Object *ob, char *name) +bProperty *get_ob_property(Object *ob, char *name) { bProperty *prop; @@ -151,6 +150,17 @@ bProperty *get_property(Object *ob, char *name) return NULL; } +void set_ob_property(Object *ob, bProperty *propc) +{ + bProperty *prop; + prop= get_ob_property(ob, propc->name); + if(prop) { + free_property(prop); + BLI_remlink(&ob->prop, prop); + } + BLI_addtail(&ob->prop, copy_property(propc)); +} + /* negative: prop is smaller * positive: prop is larger */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 80defdbbf9c..b013b51c026 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -136,7 +136,7 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BKE_property.h" // for get_property +#include "BKE_property.h" // for get_ob_property #include "BKE_sca.h" // for init_actuator #include "BKE_scene.h" #include "BKE_softbody.h" // sbNew() @@ -5325,7 +5325,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while (act) { if(act->type==ACT_IPO) { ia= act->data; - prop= get_property(ob, ia->name); + prop= get_ob_property(ob, ia->name); if(prop) { ia->type= ACT_IPO_FROM_PROP; } diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 5151fae8c65..1e5445cbd80 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -3002,7 +3002,7 @@ static PyObject *Object_getProperty( BPy_Object * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string" ); - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) return Property_CreatePyObject( prop ); @@ -3018,7 +3018,7 @@ static PyObject *Object_addProperty( BPy_Object * self, PyObject * args ) char *prop_type = NULL; short type = -1; BPy_Property *py_prop = NULL; - int argslen = PyObject_Length( args ); + int argslen = PyTuple_Size( args ); if( argslen == 3 || argslen == 2 ) { if( !PyArg_ParseTuple( args, "sO|s", &prop_name, &prop_data, @@ -3129,7 +3129,7 @@ static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args ) py_prop->property = NULL; } } else { - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) { BLI_remlink( &self->object->prop, prop ); free_property( prop ); @@ -3148,18 +3148,23 @@ static PyObject *Object_copyAllPropertiesTo( BPy_Object * self, PyObject * args ) { PyObject *dest; + Object *dest_ob; bProperty *prop = NULL; bProperty *propn = NULL; if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected an Object" ); - + + if (dest == (PyObject *)self) { + Py_RETURN_NONE; + } + dest_ob = ( ( BPy_Object * ) dest )->object; + /*make a copy of all its properties*/ prop = self->object->prop.first; while( prop ) { - propn = copy_property( prop ); - BLI_addtail( &( ( BPy_Object * ) dest )->object->prop, propn ); + set_ob_property( dest_ob, prop ); prop = prop->next; } diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index 8f22c704fd0..ba266fa8c29 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -467,7 +467,7 @@ void draw_mesh_text(Object *ob, int glsl) MFace *mf, *mface= me->mface; MTFace *tface= me->mtface; MCol *mcol= me->mcol; /* why does mcol exist? */ - bProperty *prop = get_property(ob, "Text"); + bProperty *prop = get_ob_property(ob, "Text"); GPUVertexAttribs gattribs; int a, totface= me->totface; @@ -568,7 +568,7 @@ void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect) dm->drawFacesTex(dm, draw_tface__set_draw); /* draw game engine text hack */ - if(get_property(ob, "Text")) + if(get_ob_property(ob, "Text")) draw_mesh_text(ob, 0); draw_textured_end(); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index f5a4ac4556a..527b36d0df4 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -2281,7 +2281,7 @@ static void draw_mesh_fancy(Base *base, int dt, int flag) glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); dm->drawFacesGLSL(dm, GPU_enable_material); - if(get_property(ob, "Text")) + if(get_ob_property(ob, "Text")) draw_mesh_text(ob, 1); GPU_disable_material(); diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index ef909a1e810..29d7b52487f 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -3192,7 +3192,7 @@ void flip_subdivison(int level) static void copymenu_properties(Object *ob) { - bProperty *prop, *propn, *propc; + bProperty *prop; Base *base; int nr, tot=0; char *str; @@ -3208,45 +3208,43 @@ static void copymenu_properties(Object *ob) return; } - str= MEM_callocN(24+32*tot, "copymenu prop"); + str= MEM_callocN(50 + 33*tot, "copymenu prop"); - strcpy(str, "Copy Property %t"); + strcpy(str, "Copy Property %t|Replace All|Merge All|%l"); tot= 0; prop= ob->prop.first; while(prop) { tot++; - strcat(str, " |"); + strcat(str, "|"); strcat(str, prop->name); prop= prop->next; } nr= pupmenu(str); - if(nr>0) { - tot= 0; - prop= ob->prop.first; - while(prop) { - tot++; - if(tot==nr) break; - prop= prop->next; + + if ( nr==1 || nr==2 ) { + base= FIRSTBASE; + while(base) { + if((base != BASACT) && TESTBASELIB(base)) { + if (nr==1) { /* replace */ + copy_properties( &base->object->prop, &ob->prop ); + } else { + for(prop = ob->prop.first; prop; prop= prop->next ) { + set_ob_property(base->object, prop); + } + } + } + base= base->next; } + } else if(nr>0) { + prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/ + if(prop) { - propc= prop; - - base= FIRSTBASE; - while(base) { - if(base != BASACT) { - if(TESTBASELIB(base)) { - prop= get_property(base->object, propc->name); - if(prop) { - free_property(prop); - BLI_remlink(&base->object->prop, prop); - } - propn= copy_property(propc); - BLI_addtail(&base->object->prop, propn); - } + for(base= FIRSTBASE; base; base= base->next) { + if((base != BASACT) && TESTBASELIB(base)) { + set_ob_property(base->object, prop); } - base= base->next; } } } diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 36ba819b3f1..827103cbb32 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -885,6 +885,8 @@ void do_view3d_select_object_groupedmenu(void *arg, int event) case 7: /* Objects in Same Group */ case 8: /* Object Hooks*/ case 9: /* Object PassIndex*/ + case 10: /* Object Color*/ + case 11: /* Game Properties*/ select_object_grouped((short)event); break; } @@ -907,7 +909,9 @@ static uiBlock *view3d_select_object_groupedmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Hooks|Shift G, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Color|Shift G, 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Game Properties|Shift G, Alt+1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 198d8140ace..d4460e55a3e 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -64,6 +64,7 @@ #include "DNA_modifier_types.h" /* used for select grouped hooks */ #include "DNA_object_types.h" #include "DNA_particle_types.h" +#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" @@ -93,7 +94,6 @@ #include "BKE_utildefines.h" #include "BKE_image.h" /* for IMA_TYPE_COMPOSITE and IMA_TYPE_R_RESULT */ #include "BKE_particle.h" - #include "BIF_spacetypes.h" /* first, nasty dependency with typedef */ #include "BIF_butspace.h" @@ -710,7 +710,7 @@ static short select_parent(void) /* Makes parent active and de-selected OBACT */ short changed = 0; Base *base, *startbase, *basact=NULL, *oldbasact; - if (!(OBACT) || !(OBACT->parent)) return 0; + if (!(OBACT->parent)) return 0; /* we know OBACT is valid */ BASACT->flag &= (~SELECT); BASACT->object->flag &= (~SELECT); startbase= FIRSTBASE; @@ -746,9 +746,6 @@ static short select_same_group(Object *ob) /* Select objects in the same group a char str[10 + (24*GROUP_MENU_MAX)]; char *p = str; int group_count=0, menu, i; - - if (!ob) - return 0; for ( group=G.main->group.first; group && group_count < GROUP_MENU_MAX; @@ -804,9 +801,6 @@ static short select_object_hooks(Object *ob) ModifierData *md; HookModifierData *hmd; - if (!ob) - return 0; - for (md = ob->modifiers.first; md; md=md->next) { if (md->type==eModifierType_Hook) { hmd= (HookModifierData*) md; @@ -829,8 +823,6 @@ static short select_same_parent(Object *ob) { short changed = 0; Base *base; - if (!ob) - return 0; for (base= FIRSTBASE; base; base= base->next) { if (BASE_SELECTABLE(base) && (base->object->parent==ob->parent) && !(base->flag & SELECT)) { @@ -846,8 +838,6 @@ static short select_same_type(Object *ob) { short changed = 0; Base *base; - if (!ob) - return 0; for (base= FIRSTBASE; base; base= base->next) { if (BASE_SELECTABLE(base) && (base->object->type == ob->type) && !(base->flag & SELECT)) { @@ -864,9 +854,6 @@ static short select_same_layer(Object *ob) char changed = 0; Base *base = FIRSTBASE; - if (!ob) - return 0; - while(base) { if (BASE_SELECTABLE(base) && (base->lay & ob->lay) && !(base->flag & SELECT)) { base->flag |= SELECT; @@ -883,9 +870,6 @@ static short select_same_index_object(Object *ob) char changed = 0; Base *base = FIRSTBASE; - if (!ob) - return 0; - while(base) { if (BASE_SELECTABLE(base) && (base->object->index == ob->index) && !(base->flag & SELECT)) { base->flag |= SELECT; @@ -902,9 +886,6 @@ static short select_same_color(Object *ob) char changed = 0; Base *base = FIRSTBASE; - if (!ob) - return 0; - while(base) { if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005))) { base->flag |= SELECT; @@ -916,19 +897,52 @@ static short select_same_color(Object *ob) return changed; } +static short objects_share_gameprop(Object *a, Object *b) +{ + bProperty *prop; + /*make a copy of all its properties*/ + + for( prop= a->prop.first; prop; prop = prop->next ) { + if ( get_ob_property(b, prop->name) ) + return 1; + } + return 0; +} + +static short select_same_gameprops(Object *ob) +{ + char changed = 0; + Base *base = FIRSTBASE; + + while(base) { + if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) { + base->flag |= SELECT; + base->object->flag |= SELECT; + changed = 1; + } + base= base->next; + } + return changed; +} + void select_object_grouped(short nr) { + Object *ob = OBACT; short changed = 0; - if(nr==1) changed = select_children(OBACT, 1); - else if(nr==2) changed = select_children(OBACT, 0); + + if (ob==NULL) return; + + if(nr==1) changed = select_children(ob, 1); + else if(nr==2) changed = select_children(ob, 0); else if(nr==3) changed = select_parent(); - else if(nr==4) changed = select_same_parent(OBACT); - else if(nr==5) changed = select_same_type(OBACT); - else if(nr==6) changed = select_same_layer(OBACT); - else if(nr==7) changed = select_same_group(OBACT); - else if(nr==8) changed = select_object_hooks(OBACT); - else if(nr==9) changed = select_same_index_object(OBACT); - else if(nr==10) changed = select_same_color(OBACT); + else if(nr==4) changed = select_same_parent(ob); + else if(nr==5) changed = select_same_type(ob); + else if(nr==6) changed = select_same_layer(ob); + else if(nr==7) changed = select_same_group(ob); + else if(nr==8) changed = select_object_hooks(ob); + else if(nr==9) changed = select_same_index_object(ob); + else if(nr==10) changed = select_same_color(ob); + else if(nr==11) changed = select_same_gameprops(ob); if (changed) { countall(); @@ -956,7 +970,8 @@ static void select_object_grouped_menu(void) "Objects in Same Group%x7|" "Object Hooks%x8|" "Object PassIndex%x9|" - "Object Color%x10"); + "Object Color%x10|" + "Game Properties%x11"); /* here we go */ diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index f38affde418..55feb4c0305 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -897,6 +897,8 @@ static TBitem tb_object_select_grouped[]= { { 0, "Objects in Same Group|Shift G, 7", 7, NULL}, { 0, "Object Hooks|Shift G, 8", 8, NULL}, { 0, "Object PassIndex|Shift G, 9", 9, NULL}, +{ 0, "Object Color|Shift G, 0", 9, NULL}, +{ 0, "Game Properties|Shift G, Alt+1", 9, NULL}, { -1, "", 0, do_view3d_select_object_groupedmenu}}; static TBitem tb_object_select[]= { -- cgit v1.2.3 From f7a528811183d5477816aff1c9d3dc7f597e1d58 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 21 Sep 2008 10:31:22 +0000 Subject: #bugfix #17337 FSA didn't work for atmosphere option. --- source/blender/render/intern/source/rendercore.c | 96 ++++++++++-------------- 1 file changed, 39 insertions(+), 57 deletions(-) diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 3992d1025ff..159d3422520 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -672,22 +672,10 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) GroupObject *go; LampRen *lar; RenderLayer *rlpp[RE_MAX_OSA]; - - int totsample, fullsample, sample; - int x, y,od; - short first_lamp; - float *zrect; - float *rgbrect; - float rgb[3]={0}; - float tmp_rgb[3]; - float fac; - float facm; + int totsample; + int x, y, od= 0; - fac = 0.5; - facm = 1.0 - fac; - totsample= get_sample_layers(pa, rl, rlpp); - fullsample= (totsample > 1); /* check that z pass is enabled */ if(pa->rectz==NULL) return; @@ -698,65 +686,59 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) if(zpass==NULL) return; /* check for at least one sun lamp that its atmosphere flag is is enabled */ - first_lamp = 1; for(go=R.lights.first; go; go= go->next) { lar= go->lampren; - if(lar->type==LA_SUN && lar->sunsky && - (lar->sunsky->effect_type & LA_SUN_EFFECT_AP)){ - first_lamp = 0; + if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) break; - } } /* do nothign and return if there is no sun lamp */ - if(first_lamp) + if(go==NULL) return; - zrect = zpass->rect; - rgbrect = rl->rectf; - od=0; - /* for each x,y and sun lamp*/ + /* for each x,y and each sample, and each sun lamp*/ for(y=pa->disprect.ymin; ydisprect.ymax; y++) { - for(x=pa->disprect.xmin; xdisprect.xmax; x++, zrect++, od++) { + for(x=pa->disprect.xmin; xdisprect.xmax; x++, od++) { + int sample; - first_lamp = 1; - for(go=R.lights.first; go; go= go->next) { - lar= go->lampren; - if(lar->type==LA_SUN && lar->sunsky) + for(sample=0; samplerectf + 4*od; + float rgb[3]; + int done= 0; + + for(go=R.lights.first; go; go= go->next) { + - { - /* if it's sky continue and don't apply atmosphere effect on it */ - if(*zrect >= 9.9e10){ - continue; - } - - if(lar->sunsky->effect_type & LA_SUN_EFFECT_AP){ - VECCOPY(tmp_rgb, (float*)(rgbrect+4*od)); - - shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect); + lar= go->lampren; + if(lar->type==LA_SUN && lar->sunsky) { - if(first_lamp){ - VECCOPY(rgb, tmp_rgb); - first_lamp = 0; + /* if it's sky continue and don't apply atmosphere effect on it */ + if(*zrect >= 9.9e10) { + continue; } - else{ - rgb[0] = facm*rgb[0] + fac*tmp_rgb[0]; - rgb[1] = facm*rgb[1] + fac*tmp_rgb[1]; - rgb[2] = facm*rgb[2] + fac*tmp_rgb[2]; + + if((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) { + float tmp_rgb[3]; + + VECCOPY(tmp_rgb, rgbrect); + shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect); + + if(done==0) { + VECCOPY(rgb, tmp_rgb); + done = 1; + } + else{ + rgb[0] = 0.5f*rgb[0] + 0.5f*tmp_rgb[0]; + rgb[1] = 0.5f*rgb[1] + 0.5f*tmp_rgb[1]; + rgb[2] = 0.5f*rgb[2] + 0.5f*tmp_rgb[2]; + } } } } - } - /* if at least for one sun lamp aerial perspective was applied*/ - if(first_lamp==0) - { - if(fullsample) { - for(sample=0; samplerectf + od*4), rgb); - } - } - else { - VECCOPY((float*)(rgbrect+4*od), rgb); + /* if at least for one sun lamp aerial perspective was applied*/ + if(done) { + VECCOPY(rgbrect, rgb); } } } -- cgit v1.2.3 From 92829e821f345596edec123e06187186e2471027 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 21 Sep 2008 12:03:41 +0000 Subject: Bugfix #17656 - Changed order for applying atmosphere, it does it now before alpha-adding sky, giving correct transparency - Added correction for de-premulling and premulling scatter color --- source/blender/render/intern/source/rendercore.c | 25 +++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 159d3422520..05ff0d3c020 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -713,7 +713,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) if(lar->type==LA_SUN && lar->sunsky) { /* if it's sky continue and don't apply atmosphere effect on it */ - if(*zrect >= 9.9e10) { + if(*zrect >= 9.9e10 || rgbrect[3]==0.0f) { continue; } @@ -721,7 +721,14 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) float tmp_rgb[3]; VECCOPY(tmp_rgb, rgbrect); + if(rgbrect[3]!=1.0f) { /* de-premul */ + float div= 1.0f/rgbrect[3]; + VECMUL(tmp_rgb, div); + } shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect); + if(rgbrect[3]!=1.0f) { /* premul */ + VECMUL(tmp_rgb, rgbrect[3]); + } if(done==0) { VECCOPY(rgb, tmp_rgb); @@ -1199,6 +1206,10 @@ void zbufshadeDA_tile(RenderPart *pa) } } + /* sun/sky */ + if(rl->layflag & SCE_LAY_SKY) + atm_tile(pa, rl); + /* sky before edge */ if(rl->layflag & SCE_LAY_SKY) sky_tile(pa, rl); @@ -1208,10 +1219,6 @@ void zbufshadeDA_tile(RenderPart *pa) if(R.r.mode & R_EDGE) edge_enhance_add(pa, rl->rectf, edgerect); - /* sun/sky */ - if(rl->layflag & SCE_LAY_SKY) - atm_tile(pa, rl); - if(rl->passflag & SCE_PASS_VECTOR) reset_sky_speed(pa, rl); @@ -1362,6 +1369,10 @@ void zbufshade_tile(RenderPart *pa) } } + /* sun/sky */ + if(rl->layflag & SCE_LAY_SKY) + atm_tile(pa, rl); + /* sky before edge */ if(rl->layflag & SCE_LAY_SKY) sky_tile(pa, rl); @@ -1372,10 +1383,6 @@ void zbufshade_tile(RenderPart *pa) edge_enhance_add(pa, rl->rectf, edgerect); } - /* sun/sky */ - if(rl->layflag & SCE_LAY_SKY) - atm_tile(pa, rl); - if(rl->passflag & SCE_PASS_VECTOR) reset_sky_speed(pa, rl); -- cgit v1.2.3